superdesk-ui-framework 2.4.16 → 2.4.19
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/_accessibility.scss +3 -2
- package/app-typescript/components/Dropdown.tsx +0 -1
- package/app-typescript/components/Input.tsx +8 -3
- package/app-typescript/components/Select.tsx +13 -3
- package/app-typescript/components/Tag.tsx +2 -2
- package/dist/examples.bundle.js +261 -73
- package/dist/playgrounds/react-playgrounds/SamsPlayground.tsx +14 -1
- package/dist/react/Inputs.tsx +20 -2
- package/dist/react/Selects.tsx +23 -1
- package/dist/superdesk-ui.bundle.css +3 -2
- package/dist/superdesk-ui.bundle.js +45 -15
- package/dist/vendor.bundle.js +10 -6
- package/examples/pages/playgrounds/react-playgrounds/SamsPlayground.tsx +14 -1
- package/examples/pages/react/Inputs.tsx +20 -2
- package/examples/pages/react/Selects.tsx +23 -1
- package/package.json +1 -1
- package/react/components/Dropdown.js +0 -1
- package/react/components/Input.d.ts +2 -1
- package/react/components/Input.js +4 -1
- package/react/components/Select.d.ts +3 -1
- package/react/components/Select.js +11 -2
- package/react/components/Tag.js +1 -1
package/dist/react/Inputs.tsx
CHANGED
@@ -33,7 +33,7 @@ export default class InputsDoc extends React.Component<{}, IState> {
|
|
33
33
|
<p className='docs-page__paragraph'></p>
|
34
34
|
<Markup.ReactMarkup>
|
35
35
|
<Markup.ReactMarkupPreview>
|
36
|
-
<div className='docs-page__content-row
|
36
|
+
<div className='docs-page__content-row'>
|
37
37
|
<div className='form__row'>
|
38
38
|
<CheckGroup>
|
39
39
|
<Checkbox checked={this.state.required} label={{text:'Required input'}} onChange={(value) => {this.setState({required: value})}} />
|
@@ -45,7 +45,7 @@ export default class InputsDoc extends React.Component<{}, IState> {
|
|
45
45
|
|
46
46
|
<div className='form__row'>
|
47
47
|
<Input label='Input label'
|
48
|
-
value='This is
|
48
|
+
value='This is the value'
|
49
49
|
maxLength={30}
|
50
50
|
error='This is error message'
|
51
51
|
info='This is some hint message'
|
@@ -57,6 +57,23 @@ export default class InputsDoc extends React.Component<{}, IState> {
|
|
57
57
|
</div>
|
58
58
|
</div>
|
59
59
|
|
60
|
+
<div className='docs-page__content-row docs-page__content-row--no-margin'>
|
61
|
+
<p className="docs-page__paragraph">// Hidden label</p>
|
62
|
+
<div className='form__row'>
|
63
|
+
<Input label='Hidden input label'
|
64
|
+
value='Lorem ipsum input'
|
65
|
+
maxLength={30}
|
66
|
+
error='This is an error message'
|
67
|
+
info='This is a hint message'
|
68
|
+
inlineLabel={true}
|
69
|
+
labelHidden={true}
|
70
|
+
required={false}
|
71
|
+
disabled={false}
|
72
|
+
invalid={false}
|
73
|
+
onChange={(value) => {}} />
|
74
|
+
</div>
|
75
|
+
</div>
|
76
|
+
|
60
77
|
</Markup.ReactMarkupPreview>
|
61
78
|
<Markup.ReactMarkupCode>{`
|
62
79
|
<Input label='Input label'
|
@@ -80,6 +97,7 @@ export default class InputsDoc extends React.Component<{}, IState> {
|
|
80
97
|
<Prop name='info' isRequired={false} type='string' default='/' description='Hint text'/>
|
81
98
|
<Prop name='error' isRequired={false} type='string' default='/' description='Error text'/>
|
82
99
|
<Prop name='inlineLabel' isRequired={false} type='boolean' default='false' description='Position labels as inline'/>
|
100
|
+
<Prop name='labelHidden' isRequired={false} type='boolean' default='false' description='Hide the label. The label will still be accessible to screen-readers.'/>
|
83
101
|
<Prop name='required' isRequired={false} type='boolean' default='false' description='Mark field as required'/>
|
84
102
|
<Prop name='disabled' isRequired={false} type='boolean' default='false' description='Mark field as disabled'/>
|
85
103
|
<Prop name='invalid' isRequired={false} type='boolean' default='false' description='Mark field as invalid'/>
|
package/dist/react/Selects.tsx
CHANGED
@@ -37,7 +37,7 @@ export default class InputsDoc extends React.Component<{}, IState> {
|
|
37
37
|
<p className='docs-page__paragraph'></p>
|
38
38
|
<Markup.ReactMarkup>
|
39
39
|
<Markup.ReactMarkupPreview>
|
40
|
-
<div className='docs-page__content-row
|
40
|
+
<div className='docs-page__content-row'>
|
41
41
|
<div className='form__row'>
|
42
42
|
<CheckGroup>
|
43
43
|
<Checkbox checked={this.state.required} label={{ text: 'Required input' }} onChange={(value) => { this.setState({ required: value }) }} />
|
@@ -63,6 +63,27 @@ export default class InputsDoc extends React.Component<{}, IState> {
|
|
63
63
|
</div>
|
64
64
|
</div>
|
65
65
|
|
66
|
+
<div className='docs-page__content-row docs-page__content-row--no-margin'>
|
67
|
+
<p className="docs-page__paragraph">// Hidden label</p>
|
68
|
+
<div className='form__row'>
|
69
|
+
<Select label='Hidden select label'
|
70
|
+
value='Option 1'
|
71
|
+
error='Error message'
|
72
|
+
info='This is a hint message'
|
73
|
+
inlineLabel={true}
|
74
|
+
labelHidden={true}
|
75
|
+
required={false}
|
76
|
+
disabled={false}
|
77
|
+
invalid={this.state.invalid}
|
78
|
+
onChange={(value) => { console.log(value) }}>
|
79
|
+
<Option>Option 1</Option>
|
80
|
+
<Option>Option 2</Option>
|
81
|
+
<Option>Option 3</Option>
|
82
|
+
<Option>Option 4</Option>
|
83
|
+
</Select>
|
84
|
+
</div>
|
85
|
+
</div>
|
86
|
+
|
66
87
|
</Markup.ReactMarkupPreview>
|
67
88
|
<Markup.ReactMarkupCode>{`
|
68
89
|
<Select label='Select label'
|
@@ -87,6 +108,7 @@ export default class InputsDoc extends React.Component<{}, IState> {
|
|
87
108
|
<Prop name='info' isRequired={false} type='string' default='/' description='Hint text' />
|
88
109
|
<Prop name='error' isRequired={false} type='string' default='/' description='Error text' />
|
89
110
|
<Prop name='inlineLabel' isRequired={false} type='boolean' default='false' description='Position labels as inline' />
|
111
|
+
<Prop name='labelHidden' isRequired={false} type='boolean' default='false' description='Hide the label. The label will still be accessible to screen-readers.'/>
|
90
112
|
<Prop name='required' isRequired={false} type='boolean' default='false' description='Mark field as required' />
|
91
113
|
<Prop name='disabled' isRequired={false} type='boolean' default='false' description='Mark field as disabled' />
|
92
114
|
<Prop name='invalid' isRequired={false} type='boolean' default='false' description='Mark field as invalid' />
|
@@ -19092,12 +19092,13 @@ tags-input {
|
|
19092
19092
|
opacity: 1 !important; }
|
19093
19093
|
|
19094
19094
|
.a11y-only {
|
19095
|
-
position: absolute;
|
19095
|
+
position: absolute !important;
|
19096
19096
|
top: 0;
|
19097
19097
|
z-index: -1;
|
19098
19098
|
pointer-events: none;
|
19099
19099
|
opacity: 0;
|
19100
|
-
height: 1px;
|
19100
|
+
height: 1px !important;
|
19101
|
+
width: 1px !important;
|
19101
19102
|
overflow: hidden; }
|
19102
19103
|
|
19103
19104
|
.sd-popover {
|
@@ -38267,13 +38267,21 @@ function mapToStyles(_ref2) {
|
|
38267
38267
|
adaptive = _ref2.adaptive,
|
38268
38268
|
roundOffsets = _ref2.roundOffsets,
|
38269
38269
|
isFixed = _ref2.isFixed;
|
38270
|
+
var _offsets$x = offsets.x,
|
38271
|
+
x = _offsets$x === void 0 ? 0 : _offsets$x,
|
38272
|
+
_offsets$y = offsets.y,
|
38273
|
+
y = _offsets$y === void 0 ? 0 : _offsets$y;
|
38270
38274
|
|
38271
|
-
var _ref3 =
|
38272
|
-
|
38273
|
-
|
38274
|
-
|
38275
|
-
|
38275
|
+
var _ref3 = typeof roundOffsets === 'function' ? roundOffsets({
|
38276
|
+
x: x,
|
38277
|
+
y: y
|
38278
|
+
}) : {
|
38279
|
+
x: x,
|
38280
|
+
y: y
|
38281
|
+
};
|
38276
38282
|
|
38283
|
+
x = _ref3.x;
|
38284
|
+
y = _ref3.y;
|
38277
38285
|
var hasX = offsets.hasOwnProperty('x');
|
38278
38286
|
var hasY = offsets.hasOwnProperty('y');
|
38279
38287
|
var sideX = __WEBPACK_IMPORTED_MODULE_0__enums_js__["l" /* left */];
|
@@ -38318,6 +38326,17 @@ function mapToStyles(_ref2) {
|
|
38318
38326
|
position: position
|
38319
38327
|
}, adaptive && unsetSides);
|
38320
38328
|
|
38329
|
+
var _ref4 = roundOffsets === true ? roundOffsetsByDPR({
|
38330
|
+
x: x,
|
38331
|
+
y: y
|
38332
|
+
}) : {
|
38333
|
+
x: x,
|
38334
|
+
y: y
|
38335
|
+
};
|
38336
|
+
|
38337
|
+
x = _ref4.x;
|
38338
|
+
y = _ref4.y;
|
38339
|
+
|
38321
38340
|
if (gpuAcceleration) {
|
38322
38341
|
var _Object$assign;
|
38323
38342
|
|
@@ -38327,9 +38346,9 @@ function mapToStyles(_ref2) {
|
|
38327
38346
|
return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : '', _Object$assign2[sideX] = hasX ? x + "px" : '', _Object$assign2.transform = '', _Object$assign2));
|
38328
38347
|
}
|
38329
38348
|
|
38330
|
-
function computeStyles(
|
38331
|
-
var state =
|
38332
|
-
options =
|
38349
|
+
function computeStyles(_ref5) {
|
38350
|
+
var state = _ref5.state,
|
38351
|
+
options = _ref5.options;
|
38333
38352
|
var _options$gpuAccelerat = options.gpuAcceleration,
|
38334
38353
|
gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat,
|
38335
38354
|
_options$adaptive = options.adaptive,
|
@@ -59635,7 +59654,7 @@ module.exports = function(isValidElement, throwOnDirectAccess) {
|
|
59635
59654
|
if (checkerResult == null) {
|
59636
59655
|
return null;
|
59637
59656
|
}
|
59638
|
-
if (checkerResult.data.
|
59657
|
+
if (checkerResult.data && has(checkerResult.data, 'expectedType')) {
|
59639
59658
|
expectedTypes.push(checkerResult.data.expectedType);
|
59640
59659
|
}
|
59641
59660
|
}
|
@@ -60265,8 +60284,11 @@ var Input = /** @class */ (function (_super) {
|
|
60265
60284
|
'sd-input--disabled': this.props.disabled,
|
60266
60285
|
'sd-input--invalid': this.props.invalid || this.state.invalid,
|
60267
60286
|
});
|
60287
|
+
var labelClasses = classnames_1.default('sd-input__label', {
|
60288
|
+
'a11y-only': this.props.labelHidden,
|
60289
|
+
});
|
60268
60290
|
return (React.createElement("div", { className: classes },
|
60269
|
-
|
60291
|
+
React.createElement("label", { className: labelClasses, htmlFor: this.htmlId, id: this.htmlId + 'label' }, this.props.label),
|
60270
60292
|
React.createElement("input", { className: 'sd-input__input', type: 'text', id: this.htmlId, value: this.state.value, "aria-label": this.props.label, "aria-describedby": this.htmlId + 'label', onChange: this.handleChange, disabled: this.props.disabled }),
|
60271
60293
|
this.props.maxLength ?
|
60272
60294
|
React.createElement("div", { className: 'sd-input__char-count' },
|
@@ -60349,6 +60371,13 @@ var Select = /** @class */ (function (_super) {
|
|
60349
60371
|
this.setState({ value: event.target.value });
|
60350
60372
|
this.props.onChange(event.target.value);
|
60351
60373
|
};
|
60374
|
+
Select.prototype.componentDidUpdate = function (prevProps) {
|
60375
|
+
var _a, _b;
|
60376
|
+
if (this.props.value !== prevProps.value) {
|
60377
|
+
this.setState({ value: (_a = this.props.value) !== null && _a !== void 0 ? _a : '' });
|
60378
|
+
this.props.onChange((_b = this.props.value) !== null && _b !== void 0 ? _b : '');
|
60379
|
+
}
|
60380
|
+
};
|
60352
60381
|
Select.prototype.render = function () {
|
60353
60382
|
var classes = classnames_1.default('sd-input sd-input--is-select', {
|
60354
60383
|
'sd-input--inline-label': this.props.inlineLabel,
|
@@ -60356,9 +60385,11 @@ var Select = /** @class */ (function (_super) {
|
|
60356
60385
|
'sd-input--disabled': this.props.disabled,
|
60357
60386
|
'sd-input--invalid': this.props.invalid || this.state.invalid,
|
60358
60387
|
});
|
60388
|
+
var labelClasses = classnames_1.default('sd-input__label', {
|
60389
|
+
'a11y-only': this.props.labelHidden,
|
60390
|
+
});
|
60359
60391
|
return (React.createElement("div", { className: classes },
|
60360
|
-
this.props.label
|
60361
|
-
React.createElement("label", { className: 'sd-input__label', htmlFor: this.htmlId }, this.props.label) : null,
|
60392
|
+
React.createElement("label", { className: labelClasses, htmlFor: this.htmlId }, this.props.label),
|
60362
60393
|
React.createElement("select", { className: 'sd-input__select', id: this.htmlId, value: this.state.value, "aria-label": this.props.label, "aria-describedby": this.htmlId, onChange: this.handleChange, disabled: this.props.disabled }, this.props.children),
|
60363
60394
|
React.createElement("div", { className: 'sd-input__message-box' },
|
60364
60395
|
this.props.info && !this.props.invalid && !this.state.invalid ?
|
@@ -71196,7 +71227,6 @@ exports.Dropdown = function (_a) {
|
|
71196
71227
|
if (toggleRef && menuRef) {
|
71197
71228
|
core_1.createPopper(toggleRef, menuRef, {
|
71198
71229
|
placement: checkAlign() ? 'bottom-end' : 'bottom-start',
|
71199
|
-
strategy: 'fixed',
|
71200
71230
|
});
|
71201
71231
|
menuRef.style.display = 'block';
|
71202
71232
|
}
|
@@ -71429,7 +71459,7 @@ function getClippingParents(element) {
|
|
71429
71459
|
|
71430
71460
|
|
71431
71461
|
return clippingParents.filter(function (clippingParent) {
|
71432
|
-
return Object(__WEBPACK_IMPORTED_MODULE_7__instanceOf_js__["a" /* isElement */])(clippingParent) && Object(__WEBPACK_IMPORTED_MODULE_10__contains_js__["a" /* default */])(clippingParent, clipperElement) && Object(__WEBPACK_IMPORTED_MODULE_11__getNodeName_js__["a" /* default */])(clippingParent) !== 'body'
|
71462
|
+
return Object(__WEBPACK_IMPORTED_MODULE_7__instanceOf_js__["a" /* isElement */])(clippingParent) && Object(__WEBPACK_IMPORTED_MODULE_10__contains_js__["a" /* default */])(clippingParent, clipperElement) && Object(__WEBPACK_IMPORTED_MODULE_11__getNodeName_js__["a" /* default */])(clippingParent) !== 'body';
|
71433
71463
|
});
|
71434
71464
|
} // Gets the maximum area that the element is visible in due to any number of
|
71435
71465
|
// clipping parents
|
@@ -72051,7 +72081,7 @@ exports.Tag = function (_a) {
|
|
72051
72081
|
_b["tag-label--" + shade] = shade && shade !== 'light',
|
72052
72082
|
_b['tag-label--square'] = shape === 'square',
|
72053
72083
|
_b));
|
72054
|
-
return (React.createElement("
|
72084
|
+
return (React.createElement("span", { className: classes, key: keyValue },
|
72055
72085
|
text,
|
72056
72086
|
!readOnly ? React.createElement("button", { className: 'tag-label__remove', onClick: onClick },
|
72057
72087
|
React.createElement("i", { className: 'icon-close-small' })) : null));
|
package/dist/vendor.bundle.js
CHANGED
@@ -28243,7 +28243,7 @@ __webpack_require__(7);
|
|
28243
28243
|
/***/ (function(module, exports, __webpack_require__) {
|
28244
28244
|
|
28245
28245
|
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
|
28246
|
-
* jQuery UI Widget 1.13.
|
28246
|
+
* jQuery UI Widget 1.13.1
|
28247
28247
|
* http://jqueryui.com
|
28248
28248
|
*
|
28249
28249
|
* Copyright jQuery Foundation and other contributors
|
@@ -28324,7 +28324,7 @@ $.widget = function( name, base, prototype ) {
|
|
28324
28324
|
constructor = $[ namespace ][ name ] = function( options, element ) {
|
28325
28325
|
|
28326
28326
|
// Allow instantiation without "new" keyword
|
28327
|
-
if ( !this._createWidget ) {
|
28327
|
+
if ( !this || !this._createWidget ) {
|
28328
28328
|
return new constructor( options, element );
|
28329
28329
|
}
|
28330
28330
|
|
@@ -28746,6 +28746,8 @@ $.Widget.prototype = {
|
|
28746
28746
|
}, options );
|
28747
28747
|
|
28748
28748
|
function bindRemoveEvent() {
|
28749
|
+
var nodesToBind = [];
|
28750
|
+
|
28749
28751
|
options.element.each( function( _, element ) {
|
28750
28752
|
var isTracked = $.map( that.classesElementLookup, function( elements ) {
|
28751
28753
|
return elements;
|
@@ -28755,11 +28757,13 @@ $.Widget.prototype = {
|
|
28755
28757
|
} );
|
28756
28758
|
|
28757
28759
|
if ( !isTracked ) {
|
28758
|
-
|
28759
|
-
remove: "_untrackClassesElement"
|
28760
|
-
} );
|
28760
|
+
nodesToBind.push( element );
|
28761
28761
|
}
|
28762
28762
|
} );
|
28763
|
+
|
28764
|
+
that._on( $( nodesToBind ), {
|
28765
|
+
remove: "_untrackClassesElement"
|
28766
|
+
} );
|
28763
28767
|
}
|
28764
28768
|
|
28765
28769
|
function processClassString( classes, checkOption ) {
|
@@ -29024,7 +29028,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
29024
29028
|
|
29025
29029
|
$.ui = $.ui || {};
|
29026
29030
|
|
29027
|
-
return $.ui.version = "1.13.
|
29031
|
+
return $.ui.version = "1.13.1";
|
29028
29032
|
|
29029
29033
|
} );
|
29030
29034
|
|
@@ -228,7 +228,20 @@ export class SamsPlayground extends React.Component<IProps, IState> {
|
|
228
228
|
<Badge text={item.priority} shape='square' color={item.priorityColor} />
|
229
229
|
</GridElements.GridItemFooterBlock>
|
230
230
|
<GridElements.GridItemFooterActions>
|
231
|
-
<
|
231
|
+
<Dropdown
|
232
|
+
align = 'right'
|
233
|
+
append = {true}
|
234
|
+
items={[
|
235
|
+
{
|
236
|
+
type: 'group', label: 'Actions', items: [
|
237
|
+
'divider',
|
238
|
+
{ label: 'Edit', icon: 'pencil', onSelect: () => this.setState({ dropDownState: 'Edit ' }) },
|
239
|
+
{ label: 'Download', icon: 'download', onSelect: () => this.setState({ dropDownState: 'Download' }) },
|
240
|
+
{ label: 'Delete', icon: 'trash', onSelect: () => this.setState({ dropDownState: 'Delete' }) },
|
241
|
+
]
|
242
|
+
}]}>
|
243
|
+
<IconButton ariaValue='dropdown-more-options' icon='dots-vertical' onClick={() => false} />
|
244
|
+
</Dropdown>
|
232
245
|
</GridElements.GridItemFooterActions>
|
233
246
|
</GridElements.GridItemFooter>
|
234
247
|
</GridElements.GridItem>
|
@@ -33,7 +33,7 @@ export default class InputsDoc extends React.Component<{}, IState> {
|
|
33
33
|
<p className='docs-page__paragraph'></p>
|
34
34
|
<Markup.ReactMarkup>
|
35
35
|
<Markup.ReactMarkupPreview>
|
36
|
-
<div className='docs-page__content-row
|
36
|
+
<div className='docs-page__content-row'>
|
37
37
|
<div className='form__row'>
|
38
38
|
<CheckGroup>
|
39
39
|
<Checkbox checked={this.state.required} label={{text:'Required input'}} onChange={(value) => {this.setState({required: value})}} />
|
@@ -45,7 +45,7 @@ export default class InputsDoc extends React.Component<{}, IState> {
|
|
45
45
|
|
46
46
|
<div className='form__row'>
|
47
47
|
<Input label='Input label'
|
48
|
-
value='This is
|
48
|
+
value='This is the value'
|
49
49
|
maxLength={30}
|
50
50
|
error='This is error message'
|
51
51
|
info='This is some hint message'
|
@@ -57,6 +57,23 @@ export default class InputsDoc extends React.Component<{}, IState> {
|
|
57
57
|
</div>
|
58
58
|
</div>
|
59
59
|
|
60
|
+
<div className='docs-page__content-row docs-page__content-row--no-margin'>
|
61
|
+
<p className="docs-page__paragraph">// Hidden label</p>
|
62
|
+
<div className='form__row'>
|
63
|
+
<Input label='Hidden input label'
|
64
|
+
value='Lorem ipsum input'
|
65
|
+
maxLength={30}
|
66
|
+
error='This is an error message'
|
67
|
+
info='This is a hint message'
|
68
|
+
inlineLabel={true}
|
69
|
+
labelHidden={true}
|
70
|
+
required={false}
|
71
|
+
disabled={false}
|
72
|
+
invalid={false}
|
73
|
+
onChange={(value) => {}} />
|
74
|
+
</div>
|
75
|
+
</div>
|
76
|
+
|
60
77
|
</Markup.ReactMarkupPreview>
|
61
78
|
<Markup.ReactMarkupCode>{`
|
62
79
|
<Input label='Input label'
|
@@ -80,6 +97,7 @@ export default class InputsDoc extends React.Component<{}, IState> {
|
|
80
97
|
<Prop name='info' isRequired={false} type='string' default='/' description='Hint text'/>
|
81
98
|
<Prop name='error' isRequired={false} type='string' default='/' description='Error text'/>
|
82
99
|
<Prop name='inlineLabel' isRequired={false} type='boolean' default='false' description='Position labels as inline'/>
|
100
|
+
<Prop name='labelHidden' isRequired={false} type='boolean' default='false' description='Hide the label. The label will still be accessible to screen-readers.'/>
|
83
101
|
<Prop name='required' isRequired={false} type='boolean' default='false' description='Mark field as required'/>
|
84
102
|
<Prop name='disabled' isRequired={false} type='boolean' default='false' description='Mark field as disabled'/>
|
85
103
|
<Prop name='invalid' isRequired={false} type='boolean' default='false' description='Mark field as invalid'/>
|
@@ -37,7 +37,7 @@ export default class InputsDoc extends React.Component<{}, IState> {
|
|
37
37
|
<p className='docs-page__paragraph'></p>
|
38
38
|
<Markup.ReactMarkup>
|
39
39
|
<Markup.ReactMarkupPreview>
|
40
|
-
<div className='docs-page__content-row
|
40
|
+
<div className='docs-page__content-row'>
|
41
41
|
<div className='form__row'>
|
42
42
|
<CheckGroup>
|
43
43
|
<Checkbox checked={this.state.required} label={{ text: 'Required input' }} onChange={(value) => { this.setState({ required: value }) }} />
|
@@ -63,6 +63,27 @@ export default class InputsDoc extends React.Component<{}, IState> {
|
|
63
63
|
</div>
|
64
64
|
</div>
|
65
65
|
|
66
|
+
<div className='docs-page__content-row docs-page__content-row--no-margin'>
|
67
|
+
<p className="docs-page__paragraph">// Hidden label</p>
|
68
|
+
<div className='form__row'>
|
69
|
+
<Select label='Hidden select label'
|
70
|
+
value='Option 1'
|
71
|
+
error='Error message'
|
72
|
+
info='This is a hint message'
|
73
|
+
inlineLabel={true}
|
74
|
+
labelHidden={true}
|
75
|
+
required={false}
|
76
|
+
disabled={false}
|
77
|
+
invalid={this.state.invalid}
|
78
|
+
onChange={(value) => { console.log(value) }}>
|
79
|
+
<Option>Option 1</Option>
|
80
|
+
<Option>Option 2</Option>
|
81
|
+
<Option>Option 3</Option>
|
82
|
+
<Option>Option 4</Option>
|
83
|
+
</Select>
|
84
|
+
</div>
|
85
|
+
</div>
|
86
|
+
|
66
87
|
</Markup.ReactMarkupPreview>
|
67
88
|
<Markup.ReactMarkupCode>{`
|
68
89
|
<Select label='Select label'
|
@@ -87,6 +108,7 @@ export default class InputsDoc extends React.Component<{}, IState> {
|
|
87
108
|
<Prop name='info' isRequired={false} type='string' default='/' description='Hint text' />
|
88
109
|
<Prop name='error' isRequired={false} type='string' default='/' description='Error text' />
|
89
110
|
<Prop name='inlineLabel' isRequired={false} type='boolean' default='false' description='Position labels as inline' />
|
111
|
+
<Prop name='labelHidden' isRequired={false} type='boolean' default='false' description='Hide the label. The label will still be accessible to screen-readers.'/>
|
90
112
|
<Prop name='required' isRequired={false} type='boolean' default='false' description='Mark field as required' />
|
91
113
|
<Prop name='disabled' isRequired={false} type='boolean' default='false' description='Mark field as disabled' />
|
92
114
|
<Prop name='invalid' isRequired={false} type='boolean' default='false' description='Mark field as invalid' />
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import * as React from 'react';
|
2
2
|
interface IProps {
|
3
3
|
value?: string;
|
4
|
-
label
|
4
|
+
label: string;
|
5
5
|
maxLength?: number;
|
6
6
|
info?: string;
|
7
7
|
error?: string;
|
@@ -9,6 +9,7 @@ interface IProps {
|
|
9
9
|
disabled?: boolean;
|
10
10
|
invalid?: boolean;
|
11
11
|
inlineLabel?: boolean;
|
12
|
+
labelHidden?: boolean;
|
12
13
|
onChange(newValue: string): void;
|
13
14
|
}
|
14
15
|
interface IState {
|
@@ -66,8 +66,11 @@ var Input = /** @class */ (function (_super) {
|
|
66
66
|
'sd-input--disabled': this.props.disabled,
|
67
67
|
'sd-input--invalid': this.props.invalid || this.state.invalid,
|
68
68
|
});
|
69
|
+
var labelClasses = classnames_1.default('sd-input__label', {
|
70
|
+
'a11y-only': this.props.labelHidden,
|
71
|
+
});
|
69
72
|
return (React.createElement("div", { className: classes },
|
70
|
-
|
73
|
+
React.createElement("label", { className: labelClasses, htmlFor: this.htmlId, id: this.htmlId + 'label' }, this.props.label),
|
71
74
|
React.createElement("input", { className: 'sd-input__input', type: 'text', id: this.htmlId, value: this.state.value, "aria-label": this.props.label, "aria-describedby": this.htmlId + 'label', onChange: this.handleChange, disabled: this.props.disabled }),
|
72
75
|
this.props.maxLength ?
|
73
76
|
React.createElement("div", { className: 'sd-input__char-count' },
|
@@ -1,13 +1,14 @@
|
|
1
1
|
import * as React from 'react';
|
2
2
|
interface ISelect {
|
3
3
|
value?: string;
|
4
|
-
label
|
4
|
+
label: string;
|
5
5
|
info?: string;
|
6
6
|
error?: string;
|
7
7
|
required?: boolean;
|
8
8
|
disabled?: boolean;
|
9
9
|
invalid?: boolean;
|
10
10
|
inlineLabel?: boolean;
|
11
|
+
labelHidden?: boolean;
|
11
12
|
onChange(newValue: string): void;
|
12
13
|
}
|
13
14
|
interface IState {
|
@@ -18,6 +19,7 @@ declare class Select extends React.Component<ISelect, IState> {
|
|
18
19
|
constructor(props: ISelect);
|
19
20
|
htmlId: string;
|
20
21
|
handleChange(event: React.ChangeEvent<HTMLSelectElement>): void;
|
22
|
+
componentDidUpdate(prevProps: any): void;
|
21
23
|
render(): JSX.Element;
|
22
24
|
}
|
23
25
|
interface IOption {
|
@@ -56,6 +56,13 @@ var Select = /** @class */ (function (_super) {
|
|
56
56
|
this.setState({ value: event.target.value });
|
57
57
|
this.props.onChange(event.target.value);
|
58
58
|
};
|
59
|
+
Select.prototype.componentDidUpdate = function (prevProps) {
|
60
|
+
var _a, _b;
|
61
|
+
if (this.props.value !== prevProps.value) {
|
62
|
+
this.setState({ value: (_a = this.props.value) !== null && _a !== void 0 ? _a : '' });
|
63
|
+
this.props.onChange((_b = this.props.value) !== null && _b !== void 0 ? _b : '');
|
64
|
+
}
|
65
|
+
};
|
59
66
|
Select.prototype.render = function () {
|
60
67
|
var classes = classnames_1.default('sd-input sd-input--is-select', {
|
61
68
|
'sd-input--inline-label': this.props.inlineLabel,
|
@@ -63,9 +70,11 @@ var Select = /** @class */ (function (_super) {
|
|
63
70
|
'sd-input--disabled': this.props.disabled,
|
64
71
|
'sd-input--invalid': this.props.invalid || this.state.invalid,
|
65
72
|
});
|
73
|
+
var labelClasses = classnames_1.default('sd-input__label', {
|
74
|
+
'a11y-only': this.props.labelHidden,
|
75
|
+
});
|
66
76
|
return (React.createElement("div", { className: classes },
|
67
|
-
this.props.label
|
68
|
-
React.createElement("label", { className: 'sd-input__label', htmlFor: this.htmlId }, this.props.label) : null,
|
77
|
+
React.createElement("label", { className: labelClasses, htmlFor: this.htmlId }, this.props.label),
|
69
78
|
React.createElement("select", { className: 'sd-input__select', id: this.htmlId, value: this.state.value, "aria-label": this.props.label, "aria-describedby": this.htmlId, onChange: this.handleChange, disabled: this.props.disabled }, this.props.children),
|
70
79
|
React.createElement("div", { className: 'sd-input__message-box' },
|
71
80
|
this.props.info && !this.props.invalid && !this.state.invalid ?
|
package/react/components/Tag.js
CHANGED
@@ -32,7 +32,7 @@ exports.Tag = function (_a) {
|
|
32
32
|
_b["tag-label--" + shade] = shade && shade !== 'light',
|
33
33
|
_b['tag-label--square'] = shape === 'square',
|
34
34
|
_b));
|
35
|
-
return (React.createElement("
|
35
|
+
return (React.createElement("span", { className: classes, key: keyValue },
|
36
36
|
text,
|
37
37
|
!readOnly ? React.createElement("button", { className: 'tag-label__remove', onClick: onClick },
|
38
38
|
React.createElement("i", { className: 'icon-close-small' })) : null));
|