orcs-design-system 3.1.2 → 3.1.3
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/es/components/DatePicker/DatePicker.stories.js +43 -5
- package/es/components/DatePicker/index.js +58 -8
- package/es/components/Select/Select.stories.js +32 -0
- package/es/components/Select/index.js +37 -6
- package/es/components/TextArea/TextArea.stories.js +2 -2
- package/es/components/TextInput/TextInput.stories.js +2 -2
- package/package.json +1 -1
|
@@ -41,15 +41,45 @@ var SingleDate = function SingleDate() {
|
|
|
41
41
|
displayFormat: "DD/MM/YY"
|
|
42
42
|
});
|
|
43
43
|
};
|
|
44
|
-
var
|
|
45
|
-
var _useState5 = useState(
|
|
44
|
+
var InvalidRequiredDate = function InvalidRequiredDate() {
|
|
45
|
+
var _useState5 = useState(null),
|
|
46
46
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
var _useState7 = useState(
|
|
47
|
+
date = _useState6[0],
|
|
48
|
+
setDate = _useState6[1];
|
|
49
|
+
var _useState7 = useState(false),
|
|
50
50
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
51
51
|
focused = _useState8[0],
|
|
52
52
|
setFocused = _useState8[1];
|
|
53
|
+
var onDateChange = function onDateChange(selectedDate) {
|
|
54
|
+
setDate(selectedDate);
|
|
55
|
+
};
|
|
56
|
+
var onFocusChange = function onFocusChange(el) {
|
|
57
|
+
setFocused(el.focused);
|
|
58
|
+
};
|
|
59
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(DatePicker, {
|
|
60
|
+
id: "invalid date",
|
|
61
|
+
single: true,
|
|
62
|
+
label: "Project start date - date required",
|
|
63
|
+
required: true,
|
|
64
|
+
date: date,
|
|
65
|
+
invalid: true,
|
|
66
|
+
placeholder: "Date",
|
|
67
|
+
focused: focused,
|
|
68
|
+
onDateChange: onDateChange,
|
|
69
|
+
onFocusChange: onFocusChange,
|
|
70
|
+
numberOfMonths: 1,
|
|
71
|
+
displayFormat: "DD/MM/YY"
|
|
72
|
+
}));
|
|
73
|
+
};
|
|
74
|
+
var DateRange = function DateRange() {
|
|
75
|
+
var _useState9 = useState({}),
|
|
76
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
77
|
+
dates = _useState10[0],
|
|
78
|
+
setDates = _useState10[1];
|
|
79
|
+
var _useState11 = useState(null),
|
|
80
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
81
|
+
focused = _useState12[0],
|
|
82
|
+
setFocused = _useState12[1];
|
|
53
83
|
var onDatesChange = function onDatesChange(_ref) {
|
|
54
84
|
var startDate = _ref.startDate,
|
|
55
85
|
endDate = _ref.endDate;
|
|
@@ -71,6 +101,9 @@ var DateRange = function DateRange() {
|
|
|
71
101
|
export var singleDate = function singleDate() {
|
|
72
102
|
return /*#__PURE__*/React.createElement(SingleDate, null);
|
|
73
103
|
};
|
|
104
|
+
export var invalidRequiredDate = function invalidRequiredDate() {
|
|
105
|
+
return /*#__PURE__*/React.createElement(InvalidRequiredDate, null);
|
|
106
|
+
};
|
|
74
107
|
export var dateRange = function dateRange() {
|
|
75
108
|
return /*#__PURE__*/React.createElement(DateRange, null);
|
|
76
109
|
};
|
|
@@ -79,6 +112,11 @@ singleDate.__docgenInfo = {
|
|
|
79
112
|
"methods": [],
|
|
80
113
|
"displayName": "singleDate"
|
|
81
114
|
};
|
|
115
|
+
invalidRequiredDate.__docgenInfo = {
|
|
116
|
+
"description": "",
|
|
117
|
+
"methods": [],
|
|
118
|
+
"displayName": "invalidRequiredDate"
|
|
119
|
+
};
|
|
82
120
|
dateRange.__docgenInfo = {
|
|
83
121
|
"description": "",
|
|
84
122
|
"methods": [],
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
4
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
4
5
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
5
6
|
import _inherits from "@babel/runtime/helpers/inherits";
|
|
6
7
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
7
8
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
8
|
-
var _excluded = ["single", "range", "width", "height", "zIndex"];
|
|
9
|
+
var _excluded = ["single", "range", "width", "height", "zIndex", "invalid", "required", "label", "id", "startDateId", "boldLabel"];
|
|
9
10
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
10
11
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
11
12
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
@@ -16,6 +17,7 @@ import momentPropTypes from "react-moment-proptypes";
|
|
|
16
17
|
import omit from "lodash/omit";
|
|
17
18
|
import "react-dates/lib/css/_datepicker.css";
|
|
18
19
|
import "react-dates/initialize";
|
|
20
|
+
import { Small } from "../Typography";
|
|
19
21
|
import { DateRangePicker, SingleDatePicker } from "react-dates";
|
|
20
22
|
import styled from "styled-components";
|
|
21
23
|
import { themeGet } from "@styled-system/theme-get";
|
|
@@ -43,6 +45,7 @@ var defaultProps = {
|
|
|
43
45
|
block: false,
|
|
44
46
|
small: false,
|
|
45
47
|
regular: false,
|
|
48
|
+
invalid: false,
|
|
46
49
|
// calendar presentation and interaction related props
|
|
47
50
|
renderMonthText: null,
|
|
48
51
|
orientation: HORIZONTAL_ORIENTATION,
|
|
@@ -83,10 +86,18 @@ var defaultProps = {
|
|
|
83
86
|
return date;
|
|
84
87
|
}
|
|
85
88
|
};
|
|
89
|
+
var DatePickerLabel = styled.label.withConfig({
|
|
90
|
+
displayName: "DatePicker__DatePickerLabel",
|
|
91
|
+
componentId: "sc-15292wq-0"
|
|
92
|
+
})(["display:block;margin-bottom:", ";font-size:", ";font-weight:", ";color:", ";"], themeGet("space.xs"), themeGet("fontSizes.1"), function (props) {
|
|
93
|
+
return props.boldLabel ? themeGet("fontWeights.2") : themeGet("fontWeights.1");
|
|
94
|
+
}, function (props) {
|
|
95
|
+
return props.invalid ? themeGet("colors.dangerDark") : themeGet("colors.greyDarkest");
|
|
96
|
+
});
|
|
86
97
|
var DatePickerContainer = styled.div.withConfig({
|
|
87
98
|
displayName: "DatePicker__DatePickerContainer",
|
|
88
|
-
componentId: "sc-15292wq-
|
|
89
|
-
})([".SingleDatePickerInput,.DateRangePickerInput{display:block;cursor:text;-moz-appearance:none;-webkit-appearance:none;appearance:none;box-shadow:none;font-family:\"Open Sans\",\"Helvetica Neue\",Helvetica,Arial,sans-serif;border:0;border-radius:0;background:transparent;}.SingleDatePickerInput__withBorder,.DateRangePickerInput__withBorder{border:none;border-radius:0;}.SingleDatePicker{width:", ";}.DateInput{width:", ";background:none;}.DateRangePickerInput_arrow_svg path{fill:", ";}.SingleDatePicker_picker,.DateRangePicker_picker{background:none;z-index:", ";}.DateInput_input{display:block;cursor:text;-moz-appearance:none;-webkit-appearance:none;appearance:none;box-shadow:none;font-family:\"Open Sans\",\"Helvetica Neue\",Helvetica,Arial,sans-serif;font-size:", ";font-weight:", ";z-index:1;transition:", ";background:", ";color:", ";height:", ";width:", ";padding:5px 12px 6px 12px;border-radius:", ";border:1px solid ", ";&:hover{border:1px solid ", ";}&:focus{outline:0;box-shadow:", " ", ";border:1px solid ", ";}&::placeholder{color:", ";}}.DateInput_input__focused{outline:0;box-shadow:", " ", ";border:1px solid ", ";}.DayPickerKeyboardShortcuts_panel{color:", ";}.CalendarDay__default{transition:", ";}.CalendarDay__selected,.CalendarDay__selected:active,.CalendarDay__selected:hover{background:", ";border:1px solid ", ";}.DayPickerKeyboardShortcuts_show__bottomRight{border-radius:0 0 3px 0;overflow:hidden;}.DayPickerKeyboardShortcuts_show__topRight{border-radius:0 3px 0 0;overflow:hidden;}.DayPickerKeyboardShortcuts_show__bottomRight:before,.DayPickerKeyboardShortcuts_show__topRight:before{border-right:33px solid ", ";transition:", ";}.DayPickerKeyboardShortcuts_show__bottomRight:hover:before,.DayPickerKeyboardShortcuts_show__topRight:hover:before{border-right:33px solid ", ";}.CalendarDay__selected_span,.CalendarDay__hovered_span,.CalendarDay__hovered_span:active{background:", ";border:1px solid ", ";color:", ";}.CalendarDay__hovered_span:hover,.CalendarDay__default:hover{background:", ";border:1px double ", ";color:", ";}.CalendarDay__selected_span:active,.CalendarDay__selected_span:hover{background:", ";border:1px solid ", ";}.DateInput_fang{margin-top:1px;z-index:", ";}"], function (props) {
|
|
99
|
+
componentId: "sc-15292wq-1"
|
|
100
|
+
})([".SingleDatePickerInput,.DateRangePickerInput{display:block;cursor:text;-moz-appearance:none;-webkit-appearance:none;appearance:none;box-shadow:none;font-family:\"Open Sans\",\"Helvetica Neue\",Helvetica,Arial,sans-serif;border:0;border-radius:0;background:transparent;}.SingleDatePickerInput__withBorder,.DateRangePickerInput__withBorder{border:none;border-radius:0;}.SingleDatePicker{width:", ";}.DateInput{width:", ";background:none;position:relative;}.DateRangePickerInput_arrow_svg path{fill:", ";}.SingleDatePicker_picker,.DateRangePicker_picker{background:none;z-index:", ";}.DateInput_input{display:block;cursor:text;-moz-appearance:none;-webkit-appearance:none;appearance:none;box-shadow:none;font-family:\"Open Sans\",\"Helvetica Neue\",Helvetica,Arial,sans-serif;font-size:", ";font-weight:", ";z-index:1;transition:", ";background:", ";color:", ";height:", ";width:", ";padding:5px 12px 6px 12px;border-radius:", ";border:1px solid ", ";&:hover{border:1px solid ", ";}&:focus{outline:0;box-shadow:", " ", ";border:1px solid ", ";}&::placeholder{color:", ";}}.DateInput_input__focused{outline:0;box-shadow:", " ", ";border:1px solid ", ";}.DayPickerKeyboardShortcuts_panel{color:", ";}.CalendarDay__default{transition:", ";}.CalendarDay__selected,.CalendarDay__selected:active,.CalendarDay__selected:hover{background:", ";border:1px solid ", ";}.DayPickerKeyboardShortcuts_show__bottomRight{border-radius:0 0 3px 0;overflow:hidden;}.DayPickerKeyboardShortcuts_show__topRight{border-radius:0 3px 0 0;overflow:hidden;}.DayPickerKeyboardShortcuts_show__bottomRight:before,.DayPickerKeyboardShortcuts_show__topRight:before{border-right:33px solid ", ";transition:", ";}.DayPickerKeyboardShortcuts_show__bottomRight:hover:before,.DayPickerKeyboardShortcuts_show__topRight:hover:before{border-right:33px solid ", ";}.CalendarDay__selected_span,.CalendarDay__hovered_span,.CalendarDay__hovered_span:active{background:", ";border:1px solid ", ";color:", ";}.CalendarDay__hovered_span:hover,.CalendarDay__default:hover{background:", ";border:1px double ", ";color:", ";}.CalendarDay__selected_span:active,.CalendarDay__selected_span:hover{background:", ";border:1px solid ", ";}.DateInput_fang{margin-top:1px;z-index:", ";}"], function (props) {
|
|
90
101
|
return props.width ? props.width : "110px";
|
|
91
102
|
}, function (props) {
|
|
92
103
|
return props.width ? props.width : "110px";
|
|
@@ -111,15 +122,15 @@ var DatePickerContainer = styled.div.withConfig({
|
|
|
111
122
|
}, function (props) {
|
|
112
123
|
return themeGet("radii.2")(props);
|
|
113
124
|
}, function (props) {
|
|
114
|
-
return themeGet("colors.black30")(props);
|
|
125
|
+
return props.invalid ? themeGet("colors.danger")(props) : themeGet("colors.black30")(props);
|
|
115
126
|
}, function (props) {
|
|
116
|
-
return themeGet("colors.primary")(props);
|
|
127
|
+
return props.invalid ? themeGet("colors.danger")(props) : themeGet("colors.primary")(props);
|
|
117
128
|
}, function (props) {
|
|
118
129
|
return themeGet("shadows.thinOutline")(props);
|
|
119
130
|
}, function (props) {
|
|
120
131
|
return themeGet("colors.primary30")(props);
|
|
121
132
|
}, function (props) {
|
|
122
|
-
return themeGet("colors.primary")(props);
|
|
133
|
+
return props.invalid ? themeGet("colors.danger")(props) : themeGet("colors.primary")(props);
|
|
123
134
|
}, function (props) {
|
|
124
135
|
return themeGet("colors.grey")(props);
|
|
125
136
|
}, function (props) {
|
|
@@ -182,12 +193,38 @@ var DatePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
182
193
|
width = _this$props.width,
|
|
183
194
|
height = _this$props.height,
|
|
184
195
|
zIndex = _this$props.zIndex,
|
|
196
|
+
invalid = _this$props.invalid,
|
|
197
|
+
required = _this$props.required,
|
|
198
|
+
label = _this$props.label,
|
|
199
|
+
id = _this$props.id,
|
|
200
|
+
startDateId = _this$props.startDateId,
|
|
201
|
+
boldLabel = _this$props.boldLabel,
|
|
185
202
|
pickerProps = _objectWithoutProperties(_this$props, _excluded);
|
|
186
203
|
return /*#__PURE__*/React.createElement(DatePickerContainer, {
|
|
187
204
|
width: width,
|
|
188
205
|
height: height,
|
|
189
|
-
|
|
190
|
-
|
|
206
|
+
invalid: invalid,
|
|
207
|
+
zIndex: zIndex,
|
|
208
|
+
required: required
|
|
209
|
+
}, single ? /*#__PURE__*/React.createElement(React.Fragment, null, label && /*#__PURE__*/React.createElement(DatePickerLabel, {
|
|
210
|
+
htmlFor: id,
|
|
211
|
+
invalid: invalid,
|
|
212
|
+
boldLabel: boldLabel
|
|
213
|
+
}, label, required && /*#__PURE__*/React.createElement(Small, {
|
|
214
|
+
color: "danger",
|
|
215
|
+
ml: "xs"
|
|
216
|
+
}, "*")), /*#__PURE__*/React.createElement(SingleDatePicker, _extends({
|
|
217
|
+
id: id
|
|
218
|
+
}, pickerProps))) : range ? /*#__PURE__*/React.createElement(React.Fragment, null, label && /*#__PURE__*/React.createElement(DatePickerLabel, {
|
|
219
|
+
htmlFor: startDateId,
|
|
220
|
+
invalid: invalid,
|
|
221
|
+
boldLabel: boldLabel
|
|
222
|
+
}, label, required && /*#__PURE__*/React.createElement(Small, {
|
|
223
|
+
color: "danger",
|
|
224
|
+
ml: "xs"
|
|
225
|
+
}, "*")), /*#__PURE__*/React.createElement(DateRangePicker, _extends({
|
|
226
|
+
id: id
|
|
227
|
+
}, pickerProps))) : null);
|
|
191
228
|
}
|
|
192
229
|
}]);
|
|
193
230
|
return DatePicker;
|
|
@@ -220,6 +257,8 @@ DatePicker.propTypes = _objectSpread({
|
|
|
220
257
|
width: PropTypes.string,
|
|
221
258
|
/** For specifying height of input (specify units) */
|
|
222
259
|
height: PropTypes.string,
|
|
260
|
+
/** Applies invalid input styles */
|
|
261
|
+
invalid: PropTypes.bool,
|
|
223
262
|
/**
|
|
224
263
|
* Should not be visible
|
|
225
264
|
* @ignore
|
|
@@ -390,6 +429,17 @@ DatePicker.__docgenInfo = {
|
|
|
390
429
|
},
|
|
391
430
|
"required": false
|
|
392
431
|
},
|
|
432
|
+
"invalid": {
|
|
433
|
+
"defaultValue": {
|
|
434
|
+
"value": "false",
|
|
435
|
+
"computed": false
|
|
436
|
+
},
|
|
437
|
+
"description": "Applies invalid input styles",
|
|
438
|
+
"type": {
|
|
439
|
+
"name": "bool"
|
|
440
|
+
},
|
|
441
|
+
"required": false
|
|
442
|
+
},
|
|
393
443
|
"renderMonthText": {
|
|
394
444
|
"defaultValue": {
|
|
395
445
|
"value": "null",
|
|
@@ -61,6 +61,28 @@ export var defaultSelect = function defaultSelect() {
|
|
|
61
61
|
defaultSelect.story = {
|
|
62
62
|
name: "Default"
|
|
63
63
|
};
|
|
64
|
+
export var invalidSelect = function invalidSelect() {
|
|
65
|
+
return /*#__PURE__*/React.createElement(Select, {
|
|
66
|
+
options: options,
|
|
67
|
+
invalid: true,
|
|
68
|
+
label: "Select label - invalid message",
|
|
69
|
+
inputId: "invalidSelect"
|
|
70
|
+
});
|
|
71
|
+
};
|
|
72
|
+
invalidSelect.story = {
|
|
73
|
+
name: "Invalid"
|
|
74
|
+
};
|
|
75
|
+
export var mandatorySelect = function mandatorySelect() {
|
|
76
|
+
return /*#__PURE__*/React.createElement(Select, {
|
|
77
|
+
options: options,
|
|
78
|
+
mandatory: true,
|
|
79
|
+
label: "Select label",
|
|
80
|
+
inputId: "mandatorySelect"
|
|
81
|
+
});
|
|
82
|
+
};
|
|
83
|
+
mandatorySelect.story = {
|
|
84
|
+
name: "Mandatory"
|
|
85
|
+
};
|
|
64
86
|
export var disabledSelect = function disabledSelect() {
|
|
65
87
|
return /*#__PURE__*/React.createElement(Select, {
|
|
66
88
|
options: options,
|
|
@@ -208,6 +230,16 @@ defaultSelect.__docgenInfo = {
|
|
|
208
230
|
"methods": [],
|
|
209
231
|
"displayName": "defaultSelect"
|
|
210
232
|
};
|
|
233
|
+
invalidSelect.__docgenInfo = {
|
|
234
|
+
"description": "",
|
|
235
|
+
"methods": [],
|
|
236
|
+
"displayName": "invalidSelect"
|
|
237
|
+
};
|
|
238
|
+
mandatorySelect.__docgenInfo = {
|
|
239
|
+
"description": "",
|
|
240
|
+
"methods": [],
|
|
241
|
+
"displayName": "mandatorySelect"
|
|
242
|
+
};
|
|
211
243
|
disabledSelect.__docgenInfo = {
|
|
212
244
|
"description": "",
|
|
213
245
|
"methods": [],
|
|
@@ -12,6 +12,7 @@ import { space, layout, compose } from "styled-system";
|
|
|
12
12
|
import { css } from "@styled-system/css";
|
|
13
13
|
import shouldForwardProp from "@styled-system/should-forward-prop";
|
|
14
14
|
import { themeGet } from "@styled-system/theme-get";
|
|
15
|
+
import { Small } from "../Typography";
|
|
15
16
|
var SelectStyles = compose(space, layout);
|
|
16
17
|
var Wrapper = styled("div").withConfig({
|
|
17
18
|
shouldForwardProp: shouldForwardProp,
|
|
@@ -36,12 +37,13 @@ var Label = styled("label").withConfig({
|
|
|
36
37
|
})(function (props) {
|
|
37
38
|
return css({
|
|
38
39
|
display: "block",
|
|
39
|
-
color: props.inverted ? themeGet("colors.white")(props) : themeGet("colors.greyDarkest")(props),
|
|
40
|
+
color: props.inverted ? themeGet("colors.white")(props) : props.invalid ? themeGet("colors.dangerDark")(props) : themeGet("colors.greyDarkest")(props),
|
|
40
41
|
fontSize: themeGet("fontSizes.1")(props),
|
|
41
42
|
fontWeight: props.bold ? themeGet("fontWeights.2")(props) : themeGet("fontWeights.1")(props),
|
|
42
43
|
mb: "xs"
|
|
43
44
|
});
|
|
44
45
|
});
|
|
46
|
+
|
|
45
47
|
/**
|
|
46
48
|
*
|
|
47
49
|
* This component uses React Select: <https://react-select.com/home>
|
|
@@ -118,7 +120,9 @@ var Select = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
118
120
|
boxShadow: "none",
|
|
119
121
|
opacity: state.isDisabled ? 0.7 : 1,
|
|
120
122
|
"&:hover": {
|
|
121
|
-
borderColor: themeGet("colors.
|
|
123
|
+
borderColor: props.invalid ? themeGet("colors.danger")({
|
|
124
|
+
theme: theme
|
|
125
|
+
}) : themeGet("colors.primary")({
|
|
122
126
|
theme: theme
|
|
123
127
|
})
|
|
124
128
|
},
|
|
@@ -145,7 +149,12 @@ var Select = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
145
149
|
fontSize: themeGet("fontSizes.1")({
|
|
146
150
|
theme: theme
|
|
147
151
|
}),
|
|
148
|
-
overflow: "hidden"
|
|
152
|
+
overflow: "hidden",
|
|
153
|
+
border: "1px solid ".concat(props.invalid ? themeGet("colors.danger")({
|
|
154
|
+
theme: theme
|
|
155
|
+
}) : themeGet("colors.black30")({
|
|
156
|
+
theme: theme
|
|
157
|
+
}))
|
|
149
158
|
});
|
|
150
159
|
},
|
|
151
160
|
container: function container(provided, state) {
|
|
@@ -327,8 +336,12 @@ var Select = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
327
336
|
}, SelectStyles), props.label && /*#__PURE__*/React.createElement(Label, {
|
|
328
337
|
inverted: props.inverted,
|
|
329
338
|
bold: props.bold,
|
|
330
|
-
htmlFor: props.inputId
|
|
331
|
-
|
|
339
|
+
htmlFor: props.inputId,
|
|
340
|
+
invalid: props.invalid
|
|
341
|
+
}, props.label, props.mandatory && /*#__PURE__*/React.createElement(Small, {
|
|
342
|
+
color: "danger",
|
|
343
|
+
ml: "xs"
|
|
344
|
+
}, "*")), props.selectType === "creatable" ? /*#__PURE__*/React.createElement(CreatableSelect, _extends({
|
|
332
345
|
ref: ref,
|
|
333
346
|
styles: customStyles,
|
|
334
347
|
theme: theme,
|
|
@@ -392,7 +405,11 @@ Select.propTypes = {
|
|
|
392
405
|
/** Specify if you want react-select createable option */
|
|
393
406
|
selectType: PropTypes.oneOf(["default", "createable", "async"]),
|
|
394
407
|
/** Specify if you want to overwrite existing customStyles */
|
|
395
|
-
updateStyles: PropTypes.func
|
|
408
|
+
updateStyles: PropTypes.func,
|
|
409
|
+
/** Applies invalid input styles */
|
|
410
|
+
invalid: PropTypes.bool,
|
|
411
|
+
/** Shows asterisk to denote a mandatory field */
|
|
412
|
+
mandatory: PropTypes.bool
|
|
396
413
|
};
|
|
397
414
|
Select.defaultProps = {
|
|
398
415
|
selectType: "default"
|
|
@@ -534,6 +551,20 @@ Select.__docgenInfo = {
|
|
|
534
551
|
"name": "func"
|
|
535
552
|
},
|
|
536
553
|
"required": false
|
|
554
|
+
},
|
|
555
|
+
"invalid": {
|
|
556
|
+
"description": "Applies invalid input styles",
|
|
557
|
+
"type": {
|
|
558
|
+
"name": "bool"
|
|
559
|
+
},
|
|
560
|
+
"required": false
|
|
561
|
+
},
|
|
562
|
+
"mandatory": {
|
|
563
|
+
"description": "Shows asterisk to denote a mandatory field",
|
|
564
|
+
"type": {
|
|
565
|
+
"name": "bool"
|
|
566
|
+
},
|
|
567
|
+
"required": false
|
|
537
568
|
}
|
|
538
569
|
}
|
|
539
570
|
};
|
|
@@ -42,7 +42,7 @@ export var statesTextArea = function statesTextArea() {
|
|
|
42
42
|
my: "r"
|
|
43
43
|
}, /*#__PURE__*/React.createElement(TextArea, {
|
|
44
44
|
id: "TextArea03",
|
|
45
|
-
label: "Message",
|
|
45
|
+
label: "Message - invalid message",
|
|
46
46
|
invalid: true
|
|
47
47
|
}), /*#__PURE__*/React.createElement(TextArea, {
|
|
48
48
|
id: "TextArea04",
|
|
@@ -80,7 +80,7 @@ export var invertedTextArea = function invertedTextArea() {
|
|
|
80
80
|
inverted: true
|
|
81
81
|
}), /*#__PURE__*/React.createElement(TextArea, {
|
|
82
82
|
id: "TextArea07",
|
|
83
|
-
label: "Message",
|
|
83
|
+
label: "Message - invalid message",
|
|
84
84
|
inverted: true,
|
|
85
85
|
invalid: true
|
|
86
86
|
}), /*#__PURE__*/React.createElement(TextArea, {
|
|
@@ -19,7 +19,7 @@ export var defaultTextInput = function defaultTextInput() {
|
|
|
19
19
|
id: "textInput2",
|
|
20
20
|
key: "textInput2",
|
|
21
21
|
type: "text",
|
|
22
|
-
label: "Full name",
|
|
22
|
+
label: "Full name - invalid message",
|
|
23
23
|
placeholder: "E.g. John Smith",
|
|
24
24
|
invalid: true
|
|
25
25
|
}), /*#__PURE__*/React.createElement(TextInput, {
|
|
@@ -68,7 +68,7 @@ export var floatingLabel = function floatingLabel() {
|
|
|
68
68
|
id: "textInput6",
|
|
69
69
|
key: "textInput6",
|
|
70
70
|
type: "text",
|
|
71
|
-
label: "Full name",
|
|
71
|
+
label: "Full name - invalid message",
|
|
72
72
|
placeholder: "E.g. John Smith",
|
|
73
73
|
floating: true,
|
|
74
74
|
invalid: true
|