superdesk-ui-framework 4.0.31 → 4.0.33
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/form-elements/_forms-general.scss +1 -1
- package/app/styles/form-elements/_inputs.scss +8 -2
- package/app-typescript/components/Form/InputWrapper.tsx +10 -1
- package/app-typescript/components/Layouts/Panel.tsx +8 -1
- package/app-typescript/components/Menu.tsx +2 -1
- package/app-typescript/components/Navigation/SideBarTabs.tsx +4 -1
- package/app-typescript/components/Select.tsx +1 -1
- package/app-typescript/components/SubNav.tsx +2 -0
- package/app-typescript/components/TreeSelect/TreeSelect.tsx +26 -20
- package/dist/examples.bundle.js +28 -22
- package/dist/superdesk-ui.bundle.css +7 -2
- package/dist/superdesk-ui.bundle.js +27 -21
- package/package.json +1 -1
- package/react/components/Form/InputWrapper.d.ts +4 -0
- package/react/components/Form/InputWrapper.js +6 -4
- package/react/components/Layouts/Panel.d.ts +1 -0
- package/react/components/Layouts/Panel.js +1 -1
- package/react/components/Menu.d.ts +1 -0
- package/react/components/Menu.js +2 -1
- package/react/components/Navigation/SideBarTabs.d.ts +1 -0
- package/react/components/Navigation/SideBarTabs.js +2 -2
- package/react/components/Select.js +1 -1
- package/react/components/SubNav.d.ts +1 -0
- package/react/components/SubNav.js +1 -1
- package/react/components/TreeSelect/TreeSelect.d.ts +4 -1
- package/react/components/TreeSelect/TreeSelect.js +14 -11
@@ -758,6 +758,7 @@
|
|
758
758
|
.sd-input__input-container {
|
759
759
|
grid-row: 2/3;
|
760
760
|
grid-column: 2/4;
|
761
|
+
min-width: min-content;
|
761
762
|
}
|
762
763
|
|
763
764
|
.sd-input__input-container:has(input[type="time"]) {
|
@@ -825,7 +826,7 @@
|
|
825
826
|
display: inline-block;
|
826
827
|
margin-inline-end: var(--space--1);
|
827
828
|
pointer-events: none;
|
828
|
-
opacity: 0.4;
|
829
|
+
opacity: 0.4;
|
829
830
|
z-index: 0;
|
830
831
|
transition: opacity 0.2s ease;
|
831
832
|
}
|
@@ -859,7 +860,7 @@
|
|
859
860
|
-webkit-font-smoothing: antialiased;
|
860
861
|
margin-inline-end: var(--space--1);
|
861
862
|
pointer-events: none;
|
862
|
-
opacity: 0.6;
|
863
|
+
opacity: 0.6;
|
863
864
|
z-index: 0;
|
864
865
|
transition: opacity 0.2s ease;
|
865
866
|
}
|
@@ -959,6 +960,11 @@
|
|
959
960
|
}
|
960
961
|
}
|
961
962
|
|
963
|
+
.sd-input--content-width {
|
964
|
+
width: max-content;
|
965
|
+
min-width: 100px;
|
966
|
+
}
|
967
|
+
|
962
968
|
.sd-input--invalid {
|
963
969
|
.sd-input__input,
|
964
970
|
.sd-input__select,
|
@@ -12,7 +12,13 @@ export interface IInputCommon {
|
|
12
12
|
inlineLabel?: boolean;
|
13
13
|
labelHidden?: boolean;
|
14
14
|
tabindex?: number;
|
15
|
+
|
16
|
+
/**
|
17
|
+
* Defaults to `true`
|
18
|
+
* If set to false, it will be as wide as content
|
19
|
+
*/
|
15
20
|
fullWidth?: boolean;
|
21
|
+
|
16
22
|
boxedStyle?: boolean;
|
17
23
|
boxedLable?: boolean;
|
18
24
|
}
|
@@ -44,11 +50,14 @@ export class InputWrapper extends React.Component<IPropsBase, IState> {
|
|
44
50
|
}
|
45
51
|
|
46
52
|
render() {
|
53
|
+
const fullWidth = this.props.fullWidth ?? true;
|
54
|
+
|
47
55
|
const classes = classNames('sd-input', {
|
48
56
|
'sd-input--inline-label': this.props.inlineLabel,
|
49
57
|
'sd-input--required': this.props.required,
|
50
58
|
'sd-input--disabled': this.props.disabled,
|
51
|
-
'sd-input--full-width':
|
59
|
+
'sd-input--full-width': fullWidth,
|
60
|
+
'sd-input--content-width': !fullWidth,
|
52
61
|
'sd-input--invalid': this.props.invalid,
|
53
62
|
'sd-input--medium': this.props.size === undefined,
|
54
63
|
[`sd-input--${this.props.size}`]: this.props.size || this.props.size !== undefined,
|
@@ -26,6 +26,7 @@ interface IPropsPanel {
|
|
26
26
|
| {custom: React.CSSProperties['width']};
|
27
27
|
background?: 'transparent' | 'light' | 'grey'; // defaults to light (white)
|
28
28
|
open?: boolean;
|
29
|
+
['data-test-id']?: string;
|
29
30
|
}
|
30
31
|
|
31
32
|
export default class Panel extends React.PureComponent<IPropsPanel> {
|
@@ -52,7 +53,13 @@ export default class Panel extends React.PureComponent<IPropsPanel> {
|
|
52
53
|
let classes2 = classNames('side-panel__container', classes2Obj);
|
53
54
|
|
54
55
|
return (
|
55
|
-
<div
|
56
|
+
<div
|
57
|
+
className={classes2}
|
58
|
+
style={style}
|
59
|
+
data-theme={this.props.theme ? `${this.props.theme}-ui` : null}
|
60
|
+
data-test-id={this.props['data-test-id']}
|
61
|
+
|
62
|
+
>
|
56
63
|
<div className={classes}>
|
57
64
|
{this.props.children}
|
58
65
|
</div>
|
@@ -58,6 +58,7 @@ interface IMenuBranch {
|
|
58
58
|
interface IProps {
|
59
59
|
items: Array<IMenuItem>;
|
60
60
|
children: (toggle: (event: SyntheticEvent) => void) => JSX.Element;
|
61
|
+
'data-test-id'?: string;
|
61
62
|
}
|
62
63
|
|
63
64
|
function isSeparator(item: IMenuItem): item is ISeparator {
|
@@ -162,7 +163,7 @@ export class Menu extends React.Component<IProps, {}> {
|
|
162
163
|
firstMenuItem.focus();
|
163
164
|
}
|
164
165
|
}}
|
165
|
-
data-test-id=
|
166
|
+
data-test-id={this.props['data-test-id'] ?? 'menu'}
|
166
167
|
zIndex={this.zIndex}
|
167
168
|
/>
|
168
169
|
</div>
|
@@ -9,6 +9,7 @@ interface IProps {
|
|
9
9
|
items: Array<ISideBarTab | 'divider'>;
|
10
10
|
side?: 'none' | 'left' | 'right';
|
11
11
|
disabled?: boolean;
|
12
|
+
['data-test-id']?: string;
|
12
13
|
}
|
13
14
|
|
14
15
|
export interface ISideBarTab {
|
@@ -44,7 +45,7 @@ export class SideBarTabs extends React.PureComponent<IProps> {
|
|
44
45
|
|
45
46
|
render() {
|
46
47
|
return (
|
47
|
-
<div className='sd-sidetab-menu sd-sidetab-menu--static'>
|
48
|
+
<div className='sd-sidetab-menu sd-sidetab-menu--static' data-test-id={this.props['data-test-id']}>
|
48
49
|
<ul>
|
49
50
|
{this.props.items.map((item, index) => {
|
50
51
|
if (item === 'divider') {
|
@@ -65,6 +66,8 @@ export class SideBarTabs extends React.PureComponent<IProps> {
|
|
65
66
|
},
|
66
67
|
)}
|
67
68
|
onClick={() => this.handleClick(item)}
|
69
|
+
data-test-id='widget-icon'
|
70
|
+
data-test-value={item.id}
|
68
71
|
>
|
69
72
|
{item.badgeValue != null && (
|
70
73
|
<Badge text={item['badgeValue']} type='primary' />
|
@@ -50,7 +50,7 @@ class Select extends React.Component<ISelect> {
|
|
50
50
|
className='sd-input__select'
|
51
51
|
id={this.htmlId}
|
52
52
|
value={this.props.value}
|
53
|
-
aria-describedby={this.htmlId}
|
53
|
+
aria-describedby={this.htmlId + 'label'}
|
54
54
|
tabIndex={this.props.tabindex}
|
55
55
|
onChange={this.handleChange}
|
56
56
|
disabled={this.props.disabled || this.props.readonly}
|
@@ -5,6 +5,7 @@ interface IProps {
|
|
5
5
|
color?: 'light' | 'darker' | 'blueGrey' | 'blueGreyDarker'; // defaults to 'light'
|
6
6
|
theme?: 'light' | 'dark'; // defaults to 'light
|
7
7
|
className?: string;
|
8
|
+
['data-test-id']?: string;
|
8
9
|
}
|
9
10
|
interface IPropsDivider {
|
10
11
|
width?: 'small' | 'medium' | 'large' | 'x-large'; // defaults to 'medium'
|
@@ -38,6 +39,7 @@ export class SubNav extends React.PureComponent<IProps> {
|
|
38
39
|
<div
|
39
40
|
data-theme={this.props.theme ? `${this.props.theme}-ui` : defaultTheme}
|
40
41
|
className={classes}
|
42
|
+
data-test-id={this.props['data-test-id']}
|
41
43
|
>
|
42
44
|
{this.props.children}
|
43
45
|
</div>
|
@@ -54,7 +54,10 @@ interface IPropsBase<T> extends IInputWrapper {
|
|
54
54
|
getBackgroundColor?(item: T): string;
|
55
55
|
getBorderColor?(item: T): string;
|
56
56
|
optionTemplate?(item: T): React.ComponentType<T> | JSX.Element;
|
57
|
-
valueTemplate?(
|
57
|
+
valueTemplate?(
|
58
|
+
item: T,
|
59
|
+
Wrapper: React.ComponentType<{backgroundColor?: string}>,
|
60
|
+
): React.ComponentType<T> | JSX.Element;
|
58
61
|
onChange(e: Array<T>): void;
|
59
62
|
}
|
60
63
|
|
@@ -632,6 +635,24 @@ export class TreeSelect<T> extends React.Component<IProps<T>, IState<T>> {
|
|
632
635
|
});
|
633
636
|
}
|
634
637
|
|
638
|
+
private renderItemContent(item: T, Wrapper: React.ComponentType<{backgroundColor?: string}>) {
|
639
|
+
if (this.props.valueTemplate) {
|
640
|
+
return this.props.valueTemplate(item, Wrapper);
|
641
|
+
}
|
642
|
+
|
643
|
+
const content = this.props.optionTemplate?.(item) ?? (
|
644
|
+
<span>
|
645
|
+
{this.props.getLabel(item)}
|
646
|
+
</span>
|
647
|
+
);
|
648
|
+
|
649
|
+
return (
|
650
|
+
<Wrapper>
|
651
|
+
{content}
|
652
|
+
</Wrapper>
|
653
|
+
);
|
654
|
+
}
|
655
|
+
|
635
656
|
render() {
|
636
657
|
if (this.props.preview) {
|
637
658
|
return (
|
@@ -702,7 +723,7 @@ export class TreeSelect<T> extends React.Component<IProps<T>, IState<T>> {
|
|
702
723
|
labelHidden={this.props.labelHidden}
|
703
724
|
htmlId={this.htmlId}
|
704
725
|
tabindex={this.props.tabindex}
|
705
|
-
fullWidth={this.props.
|
726
|
+
fullWidth={this.props.fullWidth}
|
706
727
|
data-test-id={this.props['data-test-id']}
|
707
728
|
>
|
708
729
|
<div
|
@@ -762,16 +783,7 @@ export class TreeSelect<T> extends React.Component<IProps<T>, IState<T>> {
|
|
762
783
|
|
763
784
|
return (
|
764
785
|
<ItemWrapper itemId={itemId} key={itemId} i={i}>
|
765
|
-
{this.
|
766
|
-
? this.props.valueTemplate(item, Wrapper)
|
767
|
-
: (
|
768
|
-
<Wrapper>
|
769
|
-
<span>
|
770
|
-
{this.props.getLabel(item)}
|
771
|
-
</span>
|
772
|
-
</Wrapper>
|
773
|
-
)
|
774
|
-
}
|
786
|
+
{this.renderItemContent(item, Wrapper)}
|
775
787
|
</ItemWrapper>
|
776
788
|
);
|
777
789
|
})}
|
@@ -863,14 +875,7 @@ export class TreeSelect<T> extends React.Component<IProps<T>, IState<T>> {
|
|
863
875
|
);
|
864
876
|
|
865
877
|
return <React.Fragment key={i}>
|
866
|
-
{this.
|
867
|
-
? this.props.valueTemplate(item, Wrapper)
|
868
|
-
: (
|
869
|
-
<Wrapper>
|
870
|
-
<span>{this.props.getLabel(item)}</span>
|
871
|
-
</Wrapper>
|
872
|
-
)
|
873
|
-
}
|
878
|
+
{this.renderItemContent(item, Wrapper)}
|
874
879
|
</React.Fragment>;
|
875
880
|
})}
|
876
881
|
</div>
|
@@ -886,6 +891,7 @@ export class TreeSelect<T> extends React.Component<IProps<T>, IState<T>> {
|
|
886
891
|
style={{
|
887
892
|
zIndex: this.zIndex,
|
888
893
|
width: this.treeSelectRef.current?.offsetWidth,
|
894
|
+
minWidth: '300px',
|
889
895
|
}}
|
890
896
|
ref={this.dropdownRef}
|
891
897
|
>
|
package/dist/examples.bundle.js
CHANGED
@@ -45093,12 +45093,14 @@ var InputWrapper = /** @class */ (function (_super) {
|
|
45093
45093
|
}
|
45094
45094
|
InputWrapper.prototype.render = function () {
|
45095
45095
|
var _a;
|
45096
|
-
var _b;
|
45096
|
+
var _b, _c;
|
45097
|
+
var fullWidth = (_b = this.props.fullWidth) !== null && _b !== void 0 ? _b : true;
|
45097
45098
|
var classes = (0, classnames_1.default)('sd-input', (_a = {
|
45098
45099
|
'sd-input--inline-label': this.props.inlineLabel,
|
45099
45100
|
'sd-input--required': this.props.required,
|
45100
45101
|
'sd-input--disabled': this.props.disabled,
|
45101
|
-
'sd-input--full-width':
|
45102
|
+
'sd-input--full-width': fullWidth,
|
45103
|
+
'sd-input--content-width': !fullWidth,
|
45102
45104
|
'sd-input--invalid': this.props.invalid,
|
45103
45105
|
'sd-input--medium': this.props.size === undefined
|
45104
45106
|
},
|
@@ -45114,8 +45116,8 @@ var InputWrapper = /** @class */ (function (_super) {
|
|
45114
45116
|
React.createElement("label", { className: labelClasses, htmlFor: this.props.htmlId, id: this.props.htmlId + 'label', tabIndex: this.props.tabindex === undefined ? undefined : -1 }, this.props.label),
|
45115
45117
|
React.createElement("div", { className: "sd-input__input-container" }, this.props.children),
|
45116
45118
|
this.props.maxLength
|
45117
|
-
&& React.createElement("div", { className: 'sd-input__char-count' }, (
|
45118
|
-
|
45119
|
+
&& React.createElement("div", { className: 'sd-input__char-count' }, (_c = this.props.value) === null || _c === void 0 ? void 0 :
|
45120
|
+
_c.toString().length,
|
45119
45121
|
" / ",
|
45120
45122
|
this.props.maxLength),
|
45121
45123
|
React.createElement("div", { className: 'sd-input__message-box' },
|
@@ -65287,7 +65289,7 @@ var Panel = /** @class */ (function (_super) {
|
|
65287
65289
|
style.width = this.props.size.custom;
|
65288
65290
|
}
|
65289
65291
|
var classes2 = (0, classnames_1.default)('side-panel__container', classes2Obj);
|
65290
|
-
return (React.createElement("div", { className: classes2, style: style, "data-theme": this.props.theme ? "".concat(this.props.theme, "-ui") : null },
|
65292
|
+
return (React.createElement("div", { className: classes2, style: style, "data-theme": this.props.theme ? "".concat(this.props.theme, "-ui") : null, "data-test-id": this.props['data-test-id'] },
|
65291
65293
|
React.createElement("div", { className: classes }, this.props.children)));
|
65292
65294
|
};
|
65293
65295
|
return Panel;
|
@@ -79480,9 +79482,17 @@ var TreeSelect = /** @class */ (function (_super) {
|
|
79480
79482
|
value: (0, common_1.arrayMove)(this.state.value, result.source.index, result.destination.index),
|
79481
79483
|
});
|
79482
79484
|
};
|
79485
|
+
TreeSelect.prototype.renderItemContent = function (item, Wrapper) {
|
79486
|
+
var _a, _b, _c;
|
79487
|
+
if (this.props.valueTemplate) {
|
79488
|
+
return this.props.valueTemplate(item, Wrapper);
|
79489
|
+
}
|
79490
|
+
var content = (_c = (_b = (_a = this.props).optionTemplate) === null || _b === void 0 ? void 0 : _b.call(_a, item)) !== null && _c !== void 0 ? _c : (React.createElement("span", null, this.props.getLabel(item)));
|
79491
|
+
return (React.createElement(Wrapper, null, content));
|
79492
|
+
};
|
79483
79493
|
TreeSelect.prototype.render = function () {
|
79484
79494
|
var _this = this;
|
79485
|
-
var _a
|
79495
|
+
var _a;
|
79486
79496
|
if (this.props.preview) {
|
79487
79497
|
return (React.createElement(SelectPreview_1.SelectPreview, { kind: this.props.allowMultiple
|
79488
79498
|
? {
|
@@ -79515,7 +79525,7 @@ var TreeSelect = /** @class */ (function (_super) {
|
|
79515
79525
|
var children = _a.children;
|
79516
79526
|
return React.createElement(React.Fragment, null, children);
|
79517
79527
|
};
|
79518
|
-
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, fullWidth:
|
79528
|
+
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, fullWidth: this.props.fullWidth, "data-test-id": this.props['data-test-id'] },
|
79519
79529
|
React.createElement("div", { className: "\n tags-input sd-input__input\n tags-input--".concat(this.props.allowMultiple ? 'multi-select' : 'single-select'), ref: this.treeSelectRef, "data-test-id": this.props.allowMultiple ? undefined : 'open-popover' }, this.props.allowMultiple
|
79520
79530
|
? React.createElement("div", { className: "tags-input__tags" },
|
79521
79531
|
this.props.readOnly
|
@@ -79535,10 +79545,7 @@ var TreeSelect = /** @class */ (function (_super) {
|
|
79535
79545
|
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, draggable: _this.props.sortable }, children));
|
79536
79546
|
};
|
79537
79547
|
var itemId = _this.props.getId(item);
|
79538
|
-
return (React.createElement(ItemWrapper, { itemId: itemId, key: itemId, i: i }, _this.
|
79539
|
-
? _this.props.valueTemplate(item, Wrapper)
|
79540
|
-
: (React.createElement(Wrapper, null,
|
79541
|
-
React.createElement("span", null, _this.props.getLabel(item))))));
|
79548
|
+
return (React.createElement(ItemWrapper, { itemId: itemId, key: itemId, i: i }, _this.renderItemContent(item, Wrapper)));
|
79542
79549
|
})),
|
79543
79550
|
this.state.value.length > 0
|
79544
79551
|
? (this.props.readOnly || this.props.disabled)
|
@@ -79571,16 +79578,14 @@ var TreeSelect = /** @class */ (function (_super) {
|
|
79571
79578
|
(_this.props.readOnly !== true && _this.props.required !== true) && (React.createElement("span", { className: "tags-input__remove-button", "data-test-id": "clear-value" },
|
79572
79579
|
React.createElement(Icon_1.Icon, { name: 'remove-sign' }))))));
|
79573
79580
|
};
|
79574
|
-
return React.createElement(React.Fragment, { key: i }, _this.
|
79575
|
-
? _this.props.valueTemplate(item, Wrapper)
|
79576
|
-
: (React.createElement(Wrapper, null,
|
79577
|
-
React.createElement("span", null, _this.props.getLabel(item)))));
|
79581
|
+
return React.createElement(React.Fragment, { key: i }, _this.renderItemContent(item, Wrapper));
|
79578
79582
|
}))),
|
79579
79583
|
React.createElement(WithPortal_1.WithPortal, { active: this.state.openDropdown, "data-test-id": "tree-select-popover" },
|
79580
79584
|
React.createElement("div", { className: "autocomplete autocomplete--multi-select"
|
79581
79585
|
+ (this.props.width === 'medium' ? ' autocomplete--fixed-width' : ''), style: {
|
79582
79586
|
zIndex: this.zIndex,
|
79583
|
-
width: (
|
79587
|
+
width: (_a = this.treeSelectRef.current) === null || _a === void 0 ? void 0 : _a.offsetWidth,
|
79588
|
+
minWidth: '300px',
|
79584
79589
|
}, ref: this.dropdownRef },
|
79585
79590
|
React.createElement("div", { className: 'autocomplete__header' },
|
79586
79591
|
React.createElement("div", { className: "autocomplete__icon" },
|
@@ -84618,7 +84623,7 @@ var Select = /** @class */ (function (_super) {
|
|
84618
84623
|
}
|
84619
84624
|
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, readonly: this.props.readonly, info: this.props.info, inlineLabel: this.props.inlineLabel, labelHidden: this.props.labelHidden, fullWidth: this.props.fullWidth, htmlId: this.htmlId, tabindex: this.props.tabindex },
|
84620
84625
|
React.createElement("span", { className: 'sd-input__select-caret-wrapper' },
|
84621
|
-
React.createElement("select", { className: 'sd-input__select', id: this.htmlId, value: this.props.value, "aria-describedby": this.htmlId, tabIndex: this.props.tabindex, onChange: this.handleChange, disabled: this.props.disabled || this.props.readonly, "data-test-id": this.props['data-test-id'] }, this.props.children))));
|
84626
|
+
React.createElement("select", { className: 'sd-input__select', id: this.htmlId, value: this.props.value, "aria-describedby": this.htmlId + 'label', tabIndex: this.props.tabindex, onChange: this.handleChange, disabled: this.props.disabled || this.props.readonly, "data-test-id": this.props['data-test-id'] }, this.props.children))));
|
84622
84627
|
};
|
84623
84628
|
return Select;
|
84624
84629
|
}(React.Component));
|
@@ -128219,7 +128224,7 @@ var SubNav = /** @class */ (function (_super) {
|
|
128219
128224
|
_a["subnav--".concat(this.props.color)] = this.props.color || this.props.color !== undefined,
|
128220
128225
|
_a), this.props.className);
|
128221
128226
|
var defaultTheme = darkColors.includes(this.props.color || '') ? 'dark-ui' : null;
|
128222
|
-
return (React.createElement("div", { "data-theme": this.props.theme ? "".concat(this.props.theme, "-ui") : defaultTheme, className: classes }, this.props.children));
|
128227
|
+
return (React.createElement("div", { "data-theme": this.props.theme ? "".concat(this.props.theme, "-ui") : defaultTheme, className: classes, "data-test-id": this.props['data-test-id'] }, this.props.children));
|
128223
128228
|
};
|
128224
128229
|
return SubNav;
|
128225
128230
|
}(React.PureComponent));
|
@@ -149169,6 +149174,7 @@ var Menu = /** @class */ (function (_super) {
|
|
149169
149174
|
};
|
149170
149175
|
Menu.prototype.render = function () {
|
149171
149176
|
var _this = this;
|
149177
|
+
var _a;
|
149172
149178
|
return (React.createElement(React.Fragment, null,
|
149173
149179
|
this.props.children(this.toggle),
|
149174
149180
|
React.createElement("div", { onKeyDown: function (event) {
|
@@ -149186,7 +149192,7 @@ var Menu = /** @class */ (function (_super) {
|
|
149186
149192
|
if (firstMenuItem instanceof HTMLElement) {
|
149187
149193
|
firstMenuItem.focus();
|
149188
149194
|
}
|
149189
|
-
}, "data-test-id":
|
149195
|
+
}, "data-test-id": (_a = this.props['data-test-id']) !== null && _a !== void 0 ? _a : 'menu', zIndex: this.zIndex }))));
|
149190
149196
|
};
|
149191
149197
|
return Menu;
|
149192
149198
|
}(React.Component));
|
@@ -154425,7 +154431,7 @@ var SideBarTabs = /** @class */ (function (_super) {
|
|
154425
154431
|
};
|
154426
154432
|
SideBarTabs.prototype.render = function () {
|
154427
154433
|
var _this = this;
|
154428
|
-
return (React.createElement("div", { className: 'sd-sidetab-menu sd-sidetab-menu--static' },
|
154434
|
+
return (React.createElement("div", { className: 'sd-sidetab-menu sd-sidetab-menu--static', "data-test-id": this.props['data-test-id'] },
|
154429
154435
|
React.createElement("ul", null, this.props.items.map(function (item, index) {
|
154430
154436
|
if (item === 'divider') {
|
154431
154437
|
return (React.createElement("li", { key: index, className: 'sd-sidetab-menu__spacer' }));
|
@@ -154433,7 +154439,7 @@ var SideBarTabs = /** @class */ (function (_super) {
|
|
154433
154439
|
else {
|
154434
154440
|
return (React.createElement("li", { key: index, "data-sd-tooltip": item.tooltip, "data-flow": 'left' },
|
154435
154441
|
React.createElement("button", { disabled: _this.props.disabled, role: 'button', "aria-label": item.tooltip, className: (0, classnames_1.default)('sd-sidetab-menu__btn', { 'sd-sidetab-menu__btn--active': item.id === _this.props.activeTab && _this.props.disabled !== true,
|
154436
|
-
}), onClick: function () { return _this.handleClick(item); } },
|
154442
|
+
}), onClick: function () { return _this.handleClick(item); }, "data-test-id": 'widget-icon', "data-test-value": item.id },
|
154437
154443
|
item.badgeValue != null && (React.createElement(Badge_1.Badge, { text: item['badgeValue'], type: 'primary' })),
|
154438
154444
|
React.createElement("span", { className: 'sd-sidetab-menu__main-icon ' },
|
154439
154445
|
React.createElement(Icon_1.Icon, { size: item['size'], name: item['icon'] })),
|
@@ -188153,7 +188159,7 @@ exports.ThreePaneLayoutPattern = ThreePaneLayoutPattern;
|
|
188153
188159
|
/* 938 */
|
188154
188160
|
/***/ (function(module, exports) {
|
188155
188161
|
|
188156
|
-
module.exports = {"name":"superdesk-ui-framework","version":"4.0.
|
188162
|
+
module.exports = {"name":"superdesk-ui-framework","version":"4.0.33","license":"AGPL-3.0","repository":{"type":"git","url":"https://github.com/superdesk/superdesk-ui-framework.git"},"main":"dist/superdesk-ui.bundle.js","types":"react/index.d.ts","contributors":["Nemanja Pavlovic","Vladimir Stefanovic","Darko Tomic","Aleksandar Jelicic","Tomas Kikutis","Dragana Zivkovic"],"scripts":{"start":"webpack-dev-server --config tasks/webpack.dev.js","server":"webpack --watch --config tasks/webpack.prod.js && tsc-watch","build":"webpack --config tasks/webpack.prod.js && tsc","build-ui":"webpack && tsc && npm run lint","playground-lint":"tsc -p examples/pages/playgrounds/react-playgrounds --noEmit","lint":"eslint --parser=@typescript-eslint/parser app && tslint -c tslint.json 'app-typescript/**/*.{ts,tsx}' && npm run playground-lint","lint-fix":"tsc -p tsconfig.json --noEmit && tslint --fix -c tslint.json 'app-typescript/**/*.{ts,tsx}'","prepublishOnly":"npm run build","unit-test":"mocha","debug-unit-tests":"mocha --inspect-brk"},"devDependencies":{"@types/assert":"^1.5.6","@types/chart.js":"^2.9.24","@types/classnames":"^2.2.9","@types/enzyme":"^3.10.12","@types/enzyme-adapter-react-16":"^1.0.6","@types/lodash":"^4.14.161","@types/mocha":"^9.1.1","@types/react":"16.8.23","@types/react-beautiful-dnd":"^13.1.2","@types/react-dom":"16.8.0","@types/react-router-dom":"^5.1.2","@types/react-scrollspy":"^3.3.5","@typescript-eslint/parser":"^5.58.0","angular":"^1.7.9","angular-animate":"^1.7.9","angular-route":"^1.7.9","babel-core":"^6.26.0","babel-loader":"^7.1.2","babel-plugin-transform-object-rest-spread":"^6.26.0","babel-preset-es2015":"^6.24.1","babel-preset-react":"^6.24.1","classnames":"^2.2.5","clean-webpack-plugin":"^1.0.0","code-prettify":"^0.1.0","copy-webpack-plugin":"^4.6.0","css-loader":"^2.1.1","enzyme":"^3.11.0","enzyme-adapter-react-16":"^1.15.7","eslint":"^4.6.1","eslint-loader":"^1.9.0","eslint-plugin-angular":"^3.1.1","eslint-plugin-react":"^7.3.0","extract-text-webpack-plugin":"^3.0.2","file-loader":"^0.11.2","html-loader":"^0.5.1","html-webpack-plugin":"^2.30.1","jquery":"^3.1.1","jquery-ui":"^1.12.1","jsdom":"20.0.3","jsdom-global":"3.0.2","lodash":"4.17.21","mocha":"^8.4.0","moment":"^2.29.3","node-sass":"6.0","prismjs":"^1.28.0","prop-types":"^15.6.0","react":"16.8.6","react-dom":"16.8.6","react-redux":"^5.0.6","react-router-dom":"^5.1.2","redux":"^3.7.2","redux-form":"^7.0.4","sass-loader":"^6.0.6","style-loader":"^0.18.2","superdesk-code-style":"^1.1.2","ts-loader":"^6.0.2","ts-node":"^10.9.1","tslint":"^5.18.0","typescript":"4.9.5","url-loader":"^1.1.2","webpack":"^3.5.5","webpack-cli":"3.3.10","webpack-dev-server":"2.11.1","webpack-merge":"^4.2.1"},"dependencies":{"@popperjs/core":"^2.4.0","@superdesk/common":"0.0.28","@superdesk/primereact":"^5.0.2-12","@superdesk/react-resizable-panels":"0.0.39","chart.js":"^2.9.3","date-fns":"2.7.0","popper-max-size-modifier":"^0.2.0","popper.js":"1.14.4","primeicons":"2.0.0","react-beautiful-dnd":"^13.0.0","react-id-generator":"^3.0.0","react-scrollspy":"^3.4.3","tippy.js":"^6.3.7"},"peerDependencies":{"moment":"*"},"volta":{"node":"14.21.3"}}
|
188157
188163
|
|
188158
188164
|
/***/ }),
|
188159
188165
|
/* 939 */
|
@@ -39294,7 +39294,7 @@ textarea.sd-media-carousel__media-title {
|
|
39294
39294
|
.form__row--flex .form__row-item:only-child {
|
39295
39295
|
margin: 0; }
|
39296
39296
|
|
39297
|
-
.form__row--flex .form__row-item
|
39297
|
+
.form__row--flex .form__row-item {
|
39298
39298
|
flex-basis: 0; }
|
39299
39299
|
|
39300
39300
|
.form__row--flex .form__row-item--no-grow {
|
@@ -40193,7 +40193,8 @@ textarea.sd-media-carousel__media-title {
|
|
40193
40193
|
grid-column: 2/4; }
|
40194
40194
|
.sd-input .sd-input__input-container {
|
40195
40195
|
grid-row: 2/3;
|
40196
|
-
grid-column: 2/4;
|
40196
|
+
grid-column: 2/4;
|
40197
|
+
min-width: min-content; }
|
40197
40198
|
.sd-input .sd-input__input-container:has(input[type="time"]) {
|
40198
40199
|
min-width: 110px; }
|
40199
40200
|
.sd-input textarea.sd-input__input {
|
@@ -40346,6 +40347,10 @@ textarea.sd-media-carousel__media-title {
|
|
40346
40347
|
inset-block-start: -2px;
|
40347
40348
|
inset-inline-end: 4px; }
|
40348
40349
|
|
40350
|
+
.sd-input--content-width {
|
40351
|
+
width: max-content;
|
40352
|
+
min-width: 100px; }
|
40353
|
+
|
40349
40354
|
.sd-input--invalid .sd-input__input,
|
40350
40355
|
.sd-input--invalid .sd-input__select,
|
40351
40356
|
.sd-input--invalid .sd-input__duration-input,
|
@@ -44597,12 +44597,14 @@ var InputWrapper = /** @class */ (function (_super) {
|
|
44597
44597
|
}
|
44598
44598
|
InputWrapper.prototype.render = function () {
|
44599
44599
|
var _a;
|
44600
|
-
var _b;
|
44600
|
+
var _b, _c;
|
44601
|
+
var fullWidth = (_b = this.props.fullWidth) !== null && _b !== void 0 ? _b : true;
|
44601
44602
|
var classes = (0, classnames_1.default)('sd-input', (_a = {
|
44602
44603
|
'sd-input--inline-label': this.props.inlineLabel,
|
44603
44604
|
'sd-input--required': this.props.required,
|
44604
44605
|
'sd-input--disabled': this.props.disabled,
|
44605
|
-
'sd-input--full-width':
|
44606
|
+
'sd-input--full-width': fullWidth,
|
44607
|
+
'sd-input--content-width': !fullWidth,
|
44606
44608
|
'sd-input--invalid': this.props.invalid,
|
44607
44609
|
'sd-input--medium': this.props.size === undefined
|
44608
44610
|
},
|
@@ -44618,8 +44620,8 @@ var InputWrapper = /** @class */ (function (_super) {
|
|
44618
44620
|
React.createElement("label", { className: labelClasses, htmlFor: this.props.htmlId, id: this.props.htmlId + 'label', tabIndex: this.props.tabindex === undefined ? undefined : -1 }, this.props.label),
|
44619
44621
|
React.createElement("div", { className: "sd-input__input-container" }, this.props.children),
|
44620
44622
|
this.props.maxLength
|
44621
|
-
&& React.createElement("div", { className: 'sd-input__char-count' }, (
|
44622
|
-
|
44623
|
+
&& React.createElement("div", { className: 'sd-input__char-count' }, (_c = this.props.value) === null || _c === void 0 ? void 0 :
|
44624
|
+
_c.toString().length,
|
44623
44625
|
" / ",
|
44624
44626
|
this.props.maxLength),
|
44625
44627
|
React.createElement("div", { className: 'sd-input__message-box' },
|
@@ -64791,7 +64793,7 @@ var Panel = /** @class */ (function (_super) {
|
|
64791
64793
|
style.width = this.props.size.custom;
|
64792
64794
|
}
|
64793
64795
|
var classes2 = (0, classnames_1.default)('side-panel__container', classes2Obj);
|
64794
|
-
return (React.createElement("div", { className: classes2, style: style, "data-theme": this.props.theme ? "".concat(this.props.theme, "-ui") : null },
|
64796
|
+
return (React.createElement("div", { className: classes2, style: style, "data-theme": this.props.theme ? "".concat(this.props.theme, "-ui") : null, "data-test-id": this.props['data-test-id'] },
|
64795
64797
|
React.createElement("div", { className: classes }, this.props.children)));
|
64796
64798
|
};
|
64797
64799
|
return Panel;
|
@@ -78601,9 +78603,17 @@ var TreeSelect = /** @class */ (function (_super) {
|
|
78601
78603
|
value: (0, common_1.arrayMove)(this.state.value, result.source.index, result.destination.index),
|
78602
78604
|
});
|
78603
78605
|
};
|
78606
|
+
TreeSelect.prototype.renderItemContent = function (item, Wrapper) {
|
78607
|
+
var _a, _b, _c;
|
78608
|
+
if (this.props.valueTemplate) {
|
78609
|
+
return this.props.valueTemplate(item, Wrapper);
|
78610
|
+
}
|
78611
|
+
var content = (_c = (_b = (_a = this.props).optionTemplate) === null || _b === void 0 ? void 0 : _b.call(_a, item)) !== null && _c !== void 0 ? _c : (React.createElement("span", null, this.props.getLabel(item)));
|
78612
|
+
return (React.createElement(Wrapper, null, content));
|
78613
|
+
};
|
78604
78614
|
TreeSelect.prototype.render = function () {
|
78605
78615
|
var _this = this;
|
78606
|
-
var _a
|
78616
|
+
var _a;
|
78607
78617
|
if (this.props.preview) {
|
78608
78618
|
return (React.createElement(SelectPreview_1.SelectPreview, { kind: this.props.allowMultiple
|
78609
78619
|
? {
|
@@ -78636,7 +78646,7 @@ var TreeSelect = /** @class */ (function (_super) {
|
|
78636
78646
|
var children = _a.children;
|
78637
78647
|
return React.createElement(React.Fragment, null, children);
|
78638
78648
|
};
|
78639
|
-
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, fullWidth:
|
78649
|
+
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, fullWidth: this.props.fullWidth, "data-test-id": this.props['data-test-id'] },
|
78640
78650
|
React.createElement("div", { className: "\n tags-input sd-input__input\n tags-input--".concat(this.props.allowMultiple ? 'multi-select' : 'single-select'), ref: this.treeSelectRef, "data-test-id": this.props.allowMultiple ? undefined : 'open-popover' }, this.props.allowMultiple
|
78641
78651
|
? React.createElement("div", { className: "tags-input__tags" },
|
78642
78652
|
this.props.readOnly
|
@@ -78656,10 +78666,7 @@ var TreeSelect = /** @class */ (function (_super) {
|
|
78656
78666
|
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, draggable: _this.props.sortable }, children));
|
78657
78667
|
};
|
78658
78668
|
var itemId = _this.props.getId(item);
|
78659
|
-
return (React.createElement(ItemWrapper, { itemId: itemId, key: itemId, i: i }, _this.
|
78660
|
-
? _this.props.valueTemplate(item, Wrapper)
|
78661
|
-
: (React.createElement(Wrapper, null,
|
78662
|
-
React.createElement("span", null, _this.props.getLabel(item))))));
|
78669
|
+
return (React.createElement(ItemWrapper, { itemId: itemId, key: itemId, i: i }, _this.renderItemContent(item, Wrapper)));
|
78663
78670
|
})),
|
78664
78671
|
this.state.value.length > 0
|
78665
78672
|
? (this.props.readOnly || this.props.disabled)
|
@@ -78692,16 +78699,14 @@ var TreeSelect = /** @class */ (function (_super) {
|
|
78692
78699
|
(_this.props.readOnly !== true && _this.props.required !== true) && (React.createElement("span", { className: "tags-input__remove-button", "data-test-id": "clear-value" },
|
78693
78700
|
React.createElement(Icon_1.Icon, { name: 'remove-sign' }))))));
|
78694
78701
|
};
|
78695
|
-
return React.createElement(React.Fragment, { key: i }, _this.
|
78696
|
-
? _this.props.valueTemplate(item, Wrapper)
|
78697
|
-
: (React.createElement(Wrapper, null,
|
78698
|
-
React.createElement("span", null, _this.props.getLabel(item)))));
|
78702
|
+
return React.createElement(React.Fragment, { key: i }, _this.renderItemContent(item, Wrapper));
|
78699
78703
|
}))),
|
78700
78704
|
React.createElement(WithPortal_1.WithPortal, { active: this.state.openDropdown, "data-test-id": "tree-select-popover" },
|
78701
78705
|
React.createElement("div", { className: "autocomplete autocomplete--multi-select"
|
78702
78706
|
+ (this.props.width === 'medium' ? ' autocomplete--fixed-width' : ''), style: {
|
78703
78707
|
zIndex: this.zIndex,
|
78704
|
-
width: (
|
78708
|
+
width: (_a = this.treeSelectRef.current) === null || _a === void 0 ? void 0 : _a.offsetWidth,
|
78709
|
+
minWidth: '300px',
|
78705
78710
|
}, ref: this.dropdownRef },
|
78706
78711
|
React.createElement("div", { className: 'autocomplete__header' },
|
78707
78712
|
React.createElement("div", { className: "autocomplete__icon" },
|
@@ -83739,7 +83744,7 @@ var Select = /** @class */ (function (_super) {
|
|
83739
83744
|
}
|
83740
83745
|
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, readonly: this.props.readonly, info: this.props.info, inlineLabel: this.props.inlineLabel, labelHidden: this.props.labelHidden, fullWidth: this.props.fullWidth, htmlId: this.htmlId, tabindex: this.props.tabindex },
|
83741
83746
|
React.createElement("span", { className: 'sd-input__select-caret-wrapper' },
|
83742
|
-
React.createElement("select", { className: 'sd-input__select', id: this.htmlId, value: this.props.value, "aria-describedby": this.htmlId, tabIndex: this.props.tabindex, onChange: this.handleChange, disabled: this.props.disabled || this.props.readonly, "data-test-id": this.props['data-test-id'] }, this.props.children))));
|
83747
|
+
React.createElement("select", { className: 'sd-input__select', id: this.htmlId, value: this.props.value, "aria-describedby": this.htmlId + 'label', tabIndex: this.props.tabindex, onChange: this.handleChange, disabled: this.props.disabled || this.props.readonly, "data-test-id": this.props['data-test-id'] }, this.props.children))));
|
83743
83748
|
};
|
83744
83749
|
return Select;
|
83745
83750
|
}(React.Component));
|
@@ -127340,7 +127345,7 @@ var SubNav = /** @class */ (function (_super) {
|
|
127340
127345
|
_a["subnav--".concat(this.props.color)] = this.props.color || this.props.color !== undefined,
|
127341
127346
|
_a), this.props.className);
|
127342
127347
|
var defaultTheme = darkColors.includes(this.props.color || '') ? 'dark-ui' : null;
|
127343
|
-
return (React.createElement("div", { "data-theme": this.props.theme ? "".concat(this.props.theme, "-ui") : defaultTheme, className: classes }, this.props.children));
|
127348
|
+
return (React.createElement("div", { "data-theme": this.props.theme ? "".concat(this.props.theme, "-ui") : defaultTheme, className: classes, "data-test-id": this.props['data-test-id'] }, this.props.children));
|
127344
127349
|
};
|
127345
127350
|
return SubNav;
|
127346
127351
|
}(React.PureComponent));
|
@@ -148290,6 +148295,7 @@ var Menu = /** @class */ (function (_super) {
|
|
148290
148295
|
};
|
148291
148296
|
Menu.prototype.render = function () {
|
148292
148297
|
var _this = this;
|
148298
|
+
var _a;
|
148293
148299
|
return (React.createElement(React.Fragment, null,
|
148294
148300
|
this.props.children(this.toggle),
|
148295
148301
|
React.createElement("div", { onKeyDown: function (event) {
|
@@ -148307,7 +148313,7 @@ var Menu = /** @class */ (function (_super) {
|
|
148307
148313
|
if (firstMenuItem instanceof HTMLElement) {
|
148308
148314
|
firstMenuItem.focus();
|
148309
148315
|
}
|
148310
|
-
}, "data-test-id":
|
148316
|
+
}, "data-test-id": (_a = this.props['data-test-id']) !== null && _a !== void 0 ? _a : 'menu', zIndex: this.zIndex }))));
|
148311
148317
|
};
|
148312
148318
|
return Menu;
|
148313
148319
|
}(React.Component));
|
@@ -153546,7 +153552,7 @@ var SideBarTabs = /** @class */ (function (_super) {
|
|
153546
153552
|
};
|
153547
153553
|
SideBarTabs.prototype.render = function () {
|
153548
153554
|
var _this = this;
|
153549
|
-
return (React.createElement("div", { className: 'sd-sidetab-menu sd-sidetab-menu--static' },
|
153555
|
+
return (React.createElement("div", { className: 'sd-sidetab-menu sd-sidetab-menu--static', "data-test-id": this.props['data-test-id'] },
|
153550
153556
|
React.createElement("ul", null, this.props.items.map(function (item, index) {
|
153551
153557
|
if (item === 'divider') {
|
153552
153558
|
return (React.createElement("li", { key: index, className: 'sd-sidetab-menu__spacer' }));
|
@@ -153554,7 +153560,7 @@ var SideBarTabs = /** @class */ (function (_super) {
|
|
153554
153560
|
else {
|
153555
153561
|
return (React.createElement("li", { key: index, "data-sd-tooltip": item.tooltip, "data-flow": 'left' },
|
153556
153562
|
React.createElement("button", { disabled: _this.props.disabled, role: 'button', "aria-label": item.tooltip, className: (0, classnames_1.default)('sd-sidetab-menu__btn', { 'sd-sidetab-menu__btn--active': item.id === _this.props.activeTab && _this.props.disabled !== true,
|
153557
|
-
}), onClick: function () { return _this.handleClick(item); } },
|
153563
|
+
}), onClick: function () { return _this.handleClick(item); }, "data-test-id": 'widget-icon', "data-test-value": item.id },
|
153558
153564
|
item.badgeValue != null && (React.createElement(Badge_1.Badge, { text: item['badgeValue'], type: 'primary' })),
|
153559
153565
|
React.createElement("span", { className: 'sd-sidetab-menu__main-icon ' },
|
153560
153566
|
React.createElement(Icon_1.Icon, { size: item['size'], name: item['icon'] })),
|
package/package.json
CHANGED
@@ -10,6 +10,10 @@ export interface IInputCommon {
|
|
10
10
|
inlineLabel?: boolean;
|
11
11
|
labelHidden?: boolean;
|
12
12
|
tabindex?: number;
|
13
|
+
/**
|
14
|
+
* Defaults to `true`
|
15
|
+
* If set to false, it will be as wide as content
|
16
|
+
*/
|
13
17
|
fullWidth?: boolean;
|
14
18
|
boxedStyle?: boolean;
|
15
19
|
boxedLable?: boolean;
|
@@ -57,12 +57,14 @@ var InputWrapper = /** @class */ (function (_super) {
|
|
57
57
|
}
|
58
58
|
InputWrapper.prototype.render = function () {
|
59
59
|
var _a;
|
60
|
-
var _b;
|
60
|
+
var _b, _c;
|
61
|
+
var fullWidth = (_b = this.props.fullWidth) !== null && _b !== void 0 ? _b : true;
|
61
62
|
var classes = (0, classnames_1.default)('sd-input', (_a = {
|
62
63
|
'sd-input--inline-label': this.props.inlineLabel,
|
63
64
|
'sd-input--required': this.props.required,
|
64
65
|
'sd-input--disabled': this.props.disabled,
|
65
|
-
'sd-input--full-width':
|
66
|
+
'sd-input--full-width': fullWidth,
|
67
|
+
'sd-input--content-width': !fullWidth,
|
66
68
|
'sd-input--invalid': this.props.invalid,
|
67
69
|
'sd-input--medium': this.props.size === undefined
|
68
70
|
},
|
@@ -78,8 +80,8 @@ var InputWrapper = /** @class */ (function (_super) {
|
|
78
80
|
React.createElement("label", { className: labelClasses, htmlFor: this.props.htmlId, id: this.props.htmlId + 'label', tabIndex: this.props.tabindex === undefined ? undefined : -1 }, this.props.label),
|
79
81
|
React.createElement("div", { className: "sd-input__input-container" }, this.props.children),
|
80
82
|
this.props.maxLength
|
81
|
-
&& React.createElement("div", { className: 'sd-input__char-count' }, (
|
82
|
-
|
83
|
+
&& React.createElement("div", { className: 'sd-input__char-count' }, (_c = this.props.value) === null || _c === void 0 ? void 0 :
|
84
|
+
_c.toString().length,
|
83
85
|
" / ",
|
84
86
|
this.props.maxLength),
|
85
87
|
React.createElement("div", { className: 'sd-input__message-box' },
|
@@ -71,7 +71,7 @@ var Panel = /** @class */ (function (_super) {
|
|
71
71
|
style.width = this.props.size.custom;
|
72
72
|
}
|
73
73
|
var classes2 = (0, classnames_1.default)('side-panel__container', classes2Obj);
|
74
|
-
return (React.createElement("div", { className: classes2, style: style, "data-theme": this.props.theme ? "".concat(this.props.theme, "-ui") : null },
|
74
|
+
return (React.createElement("div", { className: classes2, style: style, "data-theme": this.props.theme ? "".concat(this.props.theme, "-ui") : null, "data-test-id": this.props['data-test-id'] },
|
75
75
|
React.createElement("div", { className: classes }, this.props.children)));
|
76
76
|
};
|
77
77
|
return Panel;
|
package/react/components/Menu.js
CHANGED
@@ -108,6 +108,7 @@ var Menu = /** @class */ (function (_super) {
|
|
108
108
|
};
|
109
109
|
Menu.prototype.render = function () {
|
110
110
|
var _this = this;
|
111
|
+
var _a;
|
111
112
|
return (React.createElement(React.Fragment, null,
|
112
113
|
this.props.children(this.toggle),
|
113
114
|
React.createElement("div", { onKeyDown: function (event) {
|
@@ -125,7 +126,7 @@ var Menu = /** @class */ (function (_super) {
|
|
125
126
|
if (firstMenuItem instanceof HTMLElement) {
|
126
127
|
firstMenuItem.focus();
|
127
128
|
}
|
128
|
-
}, "data-test-id":
|
129
|
+
}, "data-test-id": (_a = this.props['data-test-id']) !== null && _a !== void 0 ? _a : 'menu', zIndex: this.zIndex }))));
|
129
130
|
};
|
130
131
|
return Menu;
|
131
132
|
}(React.Component));
|
@@ -70,7 +70,7 @@ var SideBarTabs = /** @class */ (function (_super) {
|
|
70
70
|
};
|
71
71
|
SideBarTabs.prototype.render = function () {
|
72
72
|
var _this = this;
|
73
|
-
return (React.createElement("div", { className: 'sd-sidetab-menu sd-sidetab-menu--static' },
|
73
|
+
return (React.createElement("div", { className: 'sd-sidetab-menu sd-sidetab-menu--static', "data-test-id": this.props['data-test-id'] },
|
74
74
|
React.createElement("ul", null, this.props.items.map(function (item, index) {
|
75
75
|
if (item === 'divider') {
|
76
76
|
return (React.createElement("li", { key: index, className: 'sd-sidetab-menu__spacer' }));
|
@@ -78,7 +78,7 @@ var SideBarTabs = /** @class */ (function (_super) {
|
|
78
78
|
else {
|
79
79
|
return (React.createElement("li", { key: index, "data-sd-tooltip": item.tooltip, "data-flow": 'left' },
|
80
80
|
React.createElement("button", { disabled: _this.props.disabled, role: 'button', "aria-label": item.tooltip, className: (0, classnames_1.default)('sd-sidetab-menu__btn', { 'sd-sidetab-menu__btn--active': item.id === _this.props.activeTab && _this.props.disabled !== true,
|
81
|
-
}), onClick: function () { return _this.handleClick(item); } },
|
81
|
+
}), onClick: function () { return _this.handleClick(item); }, "data-test-id": 'widget-icon', "data-test-value": item.id },
|
82
82
|
item.badgeValue != null && (React.createElement(Badge_1.Badge, { text: item['badgeValue'], type: 'primary' })),
|
83
83
|
React.createElement("span", { className: 'sd-sidetab-menu__main-icon ' },
|
84
84
|
React.createElement(Icon_1.Icon, { size: item['size'], name: item['icon'] })),
|
@@ -63,7 +63,7 @@ var Select = /** @class */ (function (_super) {
|
|
63
63
|
}
|
64
64
|
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, readonly: this.props.readonly, info: this.props.info, inlineLabel: this.props.inlineLabel, labelHidden: this.props.labelHidden, fullWidth: this.props.fullWidth, htmlId: this.htmlId, tabindex: this.props.tabindex },
|
65
65
|
React.createElement("span", { className: 'sd-input__select-caret-wrapper' },
|
66
|
-
React.createElement("select", { className: 'sd-input__select', id: this.htmlId, value: this.props.value, "aria-describedby": this.htmlId, tabIndex: this.props.tabindex, onChange: this.handleChange, disabled: this.props.disabled || this.props.readonly, "data-test-id": this.props['data-test-id'] }, this.props.children))));
|
66
|
+
React.createElement("select", { className: 'sd-input__select', id: this.htmlId, value: this.props.value, "aria-describedby": this.htmlId + 'label', tabIndex: this.props.tabindex, onChange: this.handleChange, disabled: this.props.disabled || this.props.readonly, "data-test-id": this.props['data-test-id'] }, this.props.children))));
|
67
67
|
};
|
68
68
|
return Select;
|
69
69
|
}(React.Component));
|
@@ -75,7 +75,7 @@ var SubNav = /** @class */ (function (_super) {
|
|
75
75
|
_a["subnav--".concat(this.props.color)] = this.props.color || this.props.color !== undefined,
|
76
76
|
_a), this.props.className);
|
77
77
|
var defaultTheme = darkColors.includes(this.props.color || '') ? 'dark-ui' : null;
|
78
|
-
return (React.createElement("div", { "data-theme": this.props.theme ? "".concat(this.props.theme, "-ui") : defaultTheme, className: classes }, this.props.children));
|
78
|
+
return (React.createElement("div", { "data-theme": this.props.theme ? "".concat(this.props.theme, "-ui") : defaultTheme, className: classes, "data-test-id": this.props['data-test-id'] }, this.props.children));
|
79
79
|
};
|
80
80
|
return SubNav;
|
81
81
|
}(React.PureComponent));
|
@@ -35,7 +35,9 @@ interface IPropsBase<T> extends IInputWrapper {
|
|
35
35
|
getBackgroundColor?(item: T): string;
|
36
36
|
getBorderColor?(item: T): string;
|
37
37
|
optionTemplate?(item: T): React.ComponentType<T> | JSX.Element;
|
38
|
-
valueTemplate?(item: T, Wrapper: React.
|
38
|
+
valueTemplate?(item: T, Wrapper: React.ComponentType<{
|
39
|
+
backgroundColor?: string;
|
40
|
+
}>): React.ComponentType<T> | JSX.Element;
|
39
41
|
onChange(e: Array<T>): void;
|
40
42
|
}
|
41
43
|
interface IPropsSync<T> extends IPropsBase<T> {
|
@@ -89,6 +91,7 @@ export declare class TreeSelect<T> extends React.Component<IProps<T>, IState<T>>
|
|
89
91
|
private ICancelFn;
|
90
92
|
handleDebounce(): void;
|
91
93
|
onDragEnd(result: DropResult): void;
|
94
|
+
private renderItemContent;
|
92
95
|
render(): JSX.Element;
|
93
96
|
}
|
94
97
|
export {};
|
@@ -527,9 +527,17 @@ var TreeSelect = /** @class */ (function (_super) {
|
|
527
527
|
value: (0, common_1.arrayMove)(this.state.value, result.source.index, result.destination.index),
|
528
528
|
});
|
529
529
|
};
|
530
|
+
TreeSelect.prototype.renderItemContent = function (item, Wrapper) {
|
531
|
+
var _a, _b, _c;
|
532
|
+
if (this.props.valueTemplate) {
|
533
|
+
return this.props.valueTemplate(item, Wrapper);
|
534
|
+
}
|
535
|
+
var content = (_c = (_b = (_a = this.props).optionTemplate) === null || _b === void 0 ? void 0 : _b.call(_a, item)) !== null && _c !== void 0 ? _c : (React.createElement("span", null, this.props.getLabel(item)));
|
536
|
+
return (React.createElement(Wrapper, null, content));
|
537
|
+
};
|
530
538
|
TreeSelect.prototype.render = function () {
|
531
539
|
var _this = this;
|
532
|
-
var _a
|
540
|
+
var _a;
|
533
541
|
if (this.props.preview) {
|
534
542
|
return (React.createElement(SelectPreview_1.SelectPreview, { kind: this.props.allowMultiple
|
535
543
|
? {
|
@@ -562,7 +570,7 @@ var TreeSelect = /** @class */ (function (_super) {
|
|
562
570
|
var children = _a.children;
|
563
571
|
return React.createElement(React.Fragment, null, children);
|
564
572
|
};
|
565
|
-
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, fullWidth:
|
573
|
+
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, fullWidth: this.props.fullWidth, "data-test-id": this.props['data-test-id'] },
|
566
574
|
React.createElement("div", { className: "\n tags-input sd-input__input\n tags-input--".concat(this.props.allowMultiple ? 'multi-select' : 'single-select'), ref: this.treeSelectRef, "data-test-id": this.props.allowMultiple ? undefined : 'open-popover' }, this.props.allowMultiple
|
567
575
|
? React.createElement("div", { className: "tags-input__tags" },
|
568
576
|
this.props.readOnly
|
@@ -582,10 +590,7 @@ var TreeSelect = /** @class */ (function (_super) {
|
|
582
590
|
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, draggable: _this.props.sortable }, children));
|
583
591
|
};
|
584
592
|
var itemId = _this.props.getId(item);
|
585
|
-
return (React.createElement(ItemWrapper, { itemId: itemId, key: itemId, i: i }, _this.
|
586
|
-
? _this.props.valueTemplate(item, Wrapper)
|
587
|
-
: (React.createElement(Wrapper, null,
|
588
|
-
React.createElement("span", null, _this.props.getLabel(item))))));
|
593
|
+
return (React.createElement(ItemWrapper, { itemId: itemId, key: itemId, i: i }, _this.renderItemContent(item, Wrapper)));
|
589
594
|
})),
|
590
595
|
this.state.value.length > 0
|
591
596
|
? (this.props.readOnly || this.props.disabled)
|
@@ -618,16 +623,14 @@ var TreeSelect = /** @class */ (function (_super) {
|
|
618
623
|
(_this.props.readOnly !== true && _this.props.required !== true) && (React.createElement("span", { className: "tags-input__remove-button", "data-test-id": "clear-value" },
|
619
624
|
React.createElement(Icon_1.Icon, { name: 'remove-sign' }))))));
|
620
625
|
};
|
621
|
-
return React.createElement(React.Fragment, { key: i }, _this.
|
622
|
-
? _this.props.valueTemplate(item, Wrapper)
|
623
|
-
: (React.createElement(Wrapper, null,
|
624
|
-
React.createElement("span", null, _this.props.getLabel(item)))));
|
626
|
+
return React.createElement(React.Fragment, { key: i }, _this.renderItemContent(item, Wrapper));
|
625
627
|
}))),
|
626
628
|
React.createElement(WithPortal_1.WithPortal, { active: this.state.openDropdown, "data-test-id": "tree-select-popover" },
|
627
629
|
React.createElement("div", { className: "autocomplete autocomplete--multi-select"
|
628
630
|
+ (this.props.width === 'medium' ? ' autocomplete--fixed-width' : ''), style: {
|
629
631
|
zIndex: this.zIndex,
|
630
|
-
width: (
|
632
|
+
width: (_a = this.treeSelectRef.current) === null || _a === void 0 ? void 0 : _a.offsetWidth,
|
633
|
+
minWidth: '300px',
|
631
634
|
}, ref: this.dropdownRef },
|
632
635
|
React.createElement("div", { className: 'autocomplete__header' },
|
633
636
|
React.createElement("div", { className: "autocomplete__icon" },
|