baseui 10.12.1 → 11.0.2
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/README.md +3 -3
- package/accordion/accordion.js +60 -13
- package/accordion/accordion.js.flow +49 -12
- package/accordion/index.d.ts +0 -3
- package/accordion/panel.js +7 -6
- package/accordion/panel.js.flow +20 -20
- package/accordion/stateless-accordion.js +2 -4
- package/accordion/stateless-accordion.js.flow +0 -2
- package/accordion/types.js.flow +0 -5
- package/button/constants.js +1 -2
- package/button/constants.js.flow +0 -1
- package/button/index.d.ts +0 -1
- package/button/styled-components.js +2 -29
- package/button/styled-components.js.flow +2 -30
- package/checkbox/checkbox.js +6 -30
- package/checkbox/checkbox.js.flow +7 -38
- package/checkbox/constants.js +2 -1
- package/checkbox/constants.js.flow +2 -1
- package/checkbox/index.d.ts +4 -6
- package/checkbox/index.js +0 -6
- package/checkbox/index.js.flow +0 -1
- package/checkbox/styled-components.js +52 -149
- package/checkbox/styled-components.js.flow +59 -165
- package/checkbox/types.js.flow +0 -5
- package/data-table/column-categorical.js +1 -1
- package/data-table/column-categorical.js.flow +1 -1
- package/data-table/column-datetime.js +1 -1
- package/data-table/column-datetime.js.flow +3 -1
- package/data-table/column.js +6 -2
- package/data-table/column.js.flow +9 -7
- package/data-table/data-table.js +10 -2
- package/data-table/data-table.js.flow +4 -1
- package/data-table/header-cell.js +3 -0
- package/data-table/header-cell.js.flow +1 -1
- package/data-table/index.d.ts +7 -8
- package/data-table/stateful-data-table.js +2 -1
- package/data-table/stateful-data-table.js.flow +1 -0
- package/data-table/types.js.flow +8 -0
- package/datepicker/calendar.js +28 -15
- package/datepicker/calendar.js.flow +31 -14
- package/datepicker/constants.js +12 -2
- package/datepicker/constants.js.flow +10 -0
- package/datepicker/datepicker.js +117 -86
- package/datepicker/datepicker.js.flow +123 -66
- package/datepicker/day.js +85 -34
- package/datepicker/day.js.flow +118 -54
- package/datepicker/locale.js.flow +0 -1
- package/datepicker/month.js +3 -1
- package/datepicker/month.js.flow +2 -0
- package/datepicker/stateful-calendar.js +6 -1
- package/datepicker/stateful-calendar.js.flow +8 -1
- package/datepicker/stateful-container.js +23 -2
- package/datepicker/stateful-container.js.flow +17 -3
- package/datepicker/stateful-datepicker.js +6 -1
- package/datepicker/stateful-datepicker.js.flow +7 -1
- package/datepicker/styled-components.js +23 -1
- package/datepicker/styled-components.js.flow +12 -2
- package/datepicker/types.js.flow +46 -43
- package/datepicker/utils/date-helpers.js +30 -0
- package/datepicker/utils/date-helpers.js.flow +12 -0
- package/datepicker/week.js +3 -1
- package/datepicker/week.js.flow +2 -0
- package/es/accordion/accordion.js +52 -12
- package/es/accordion/panel.js +7 -5
- package/es/accordion/stateless-accordion.js +2 -4
- package/es/button/constants.js +1 -2
- package/es/button/styled-components.js +2 -29
- package/es/checkbox/checkbox.js +7 -32
- package/es/checkbox/constants.js +2 -1
- package/es/checkbox/index.js +1 -1
- package/es/checkbox/styled-components.js +51 -146
- package/es/data-table/column-categorical.js +1 -1
- package/es/data-table/column-datetime.js +1 -1
- package/es/data-table/column.js +6 -2
- package/es/data-table/data-table.js +6 -2
- package/es/data-table/header-cell.js +3 -0
- package/es/data-table/stateful-data-table.js +2 -1
- package/es/datepicker/calendar.js +28 -15
- package/es/datepicker/constants.js +8 -0
- package/es/datepicker/datepicker.js +106 -79
- package/es/datepicker/day.js +77 -34
- package/es/datepicker/month.js +3 -1
- package/es/datepicker/stateful-calendar.js +6 -1
- package/es/datepicker/stateful-container.js +22 -2
- package/es/datepicker/stateful-datepicker.js +6 -1
- package/es/datepicker/styled-components.js +8 -2
- package/es/datepicker/types.js +1 -1
- package/es/datepicker/utils/date-helpers.js +16 -0
- package/es/datepicker/week.js +3 -1
- package/es/file-uploader/file-uploader.js +4 -4
- package/es/form-control/styled-components.js +0 -1
- package/es/header-navigation/styled-components.js +3 -3
- package/es/helpers/overrides.js +1 -2
- package/es/input/styled-components.js +4 -4
- package/es/layer/layer.js +4 -4
- package/es/list/list-item.js +5 -1
- package/es/list/menu-adapter.js +4 -0
- package/es/locale/index.js +0 -7
- package/es/menu/stateful-container.js +0 -1
- package/es/menu/styled-components.js +1 -1
- package/es/modal/index.js +1 -1
- package/es/modal/modal.js +19 -65
- package/es/modal/styled-components.js +12 -48
- package/es/phone-input/default-props.js +1 -1
- package/es/phone-input/index.js +0 -4
- package/es/phone-input/phone-input-lite.js +55 -31
- package/es/radio/radio.js +1 -7
- package/es/radio/radiogroup.js +3 -28
- package/es/radio/styled-components.js +4 -5
- package/es/rating/styled-components.js +3 -3
- package/es/select/index.js +1 -2
- package/es/select/select-component.js +20 -20
- package/es/select/styled-components.js +21 -17
- package/es/snackbar/snackbar-context.js +1 -1
- package/es/snackbar/styled-components.js +2 -2
- package/es/spinner/index.js +3 -9
- package/es/spinner/styled-components.js +2 -32
- package/es/table/filter.js +3 -3
- package/es/tag/styled-components.js +1 -1
- package/es/themes/dark-theme/color-component-tokens.js +0 -38
- package/es/themes/dark-theme/color-tokens.js +0 -2
- package/es/themes/dark-theme/create-dark-theme.js +0 -2
- package/es/themes/dark-theme/dark-theme.js +0 -2
- package/es/themes/light-theme/color-component-tokens.js +0 -38
- package/es/themes/light-theme/color-tokens.js +0 -2
- package/es/themes/light-theme/create-light-theme.js +0 -2
- package/es/themes/light-theme/light-theme.js +0 -2
- package/es/timepicker/timepicker.js +1 -8
- package/es/typography/index.js +1 -31
- package/esm/accordion/accordion.js +60 -13
- package/esm/accordion/panel.js +7 -6
- package/esm/accordion/stateless-accordion.js +2 -4
- package/esm/button/constants.js +1 -2
- package/esm/button/styled-components.js +2 -29
- package/esm/checkbox/checkbox.js +7 -30
- package/esm/checkbox/constants.js +2 -1
- package/esm/checkbox/index.js +1 -1
- package/esm/checkbox/styled-components.js +52 -147
- package/esm/data-table/column-categorical.js +1 -1
- package/esm/data-table/column-datetime.js +1 -1
- package/esm/data-table/column.js +6 -2
- package/esm/data-table/data-table.js +10 -2
- package/esm/data-table/header-cell.js +3 -0
- package/esm/data-table/stateful-data-table.js +2 -1
- package/esm/datepicker/calendar.js +28 -15
- package/esm/datepicker/constants.js +8 -0
- package/esm/datepicker/datepicker.js +116 -86
- package/esm/datepicker/day.js +84 -34
- package/esm/datepicker/month.js +3 -1
- package/esm/datepicker/stateful-calendar.js +6 -1
- package/esm/datepicker/stateful-container.js +23 -2
- package/esm/datepicker/stateful-datepicker.js +6 -1
- package/esm/datepicker/styled-components.js +24 -2
- package/esm/datepicker/types.js +1 -1
- package/esm/datepicker/utils/date-helpers.js +30 -0
- package/esm/datepicker/week.js +3 -1
- package/esm/file-uploader/file-uploader.js +4 -4
- package/esm/form-control/styled-components.js +0 -1
- package/esm/header-navigation/styled-components.js +3 -3
- package/esm/helpers/overrides.js +1 -2
- package/esm/input/styled-components.js +4 -4
- package/esm/layer/layer.js +4 -4
- package/esm/list/list-item.js +5 -1
- package/esm/list/menu-adapter.js +4 -0
- package/esm/locale/index.js +0 -7
- package/esm/menu/stateful-container.js +0 -1
- package/esm/menu/styled-components.js +1 -1
- package/esm/modal/index.js +1 -1
- package/esm/modal/modal.js +28 -71
- package/esm/modal/styled-components.js +6 -38
- package/esm/phone-input/default-props.js +1 -1
- package/esm/phone-input/index.js +0 -4
- package/esm/phone-input/phone-input-lite.js +60 -37
- package/esm/radio/radio.js +1 -7
- package/esm/radio/radiogroup.js +3 -28
- package/esm/radio/styled-components.js +4 -5
- package/esm/rating/styled-components.js +3 -3
- package/esm/select/index.js +1 -2
- package/esm/select/select-component.js +20 -20
- package/esm/select/styled-components.js +21 -14
- package/esm/snackbar/snackbar-context.js +1 -1
- package/esm/snackbar/styled-components.js +2 -2
- package/esm/spinner/index.js +3 -9
- package/esm/spinner/styled-components.js +2 -40
- package/esm/table/filter.js +3 -3
- package/esm/tag/styled-components.js +1 -1
- package/esm/themes/dark-theme/color-component-tokens.js +0 -38
- package/esm/themes/dark-theme/color-tokens.js +0 -2
- package/esm/themes/dark-theme/create-dark-theme.js +1 -2
- package/esm/themes/dark-theme/dark-theme.js +1 -2
- package/esm/themes/light-theme/color-component-tokens.js +0 -38
- package/esm/themes/light-theme/color-tokens.js +0 -2
- package/esm/themes/light-theme/create-light-theme.js +1 -2
- package/esm/themes/light-theme/light-theme.js +1 -2
- package/esm/timepicker/timepicker.js +1 -8
- package/esm/typography/index.js +1 -35
- package/file-uploader/file-uploader.js +3 -3
- package/file-uploader/file-uploader.js.flow +4 -4
- package/form-control/index.d.ts +9 -0
- package/form-control/styled-components.js +0 -1
- package/form-control/styled-components.js.flow +0 -1
- package/header-navigation/styled-components.js +3 -3
- package/header-navigation/styled-components.js.flow +3 -3
- package/helpers/overrides.js +1 -2
- package/helpers/overrides.js.flow +1 -1
- package/input/index.d.ts +5 -9
- package/input/styled-components.js +4 -4
- package/input/styled-components.js.flow +4 -4
- package/layer/layer.js +4 -4
- package/layer/layer.js.flow +4 -3
- package/list/list-item.js +5 -1
- package/list/list-item.js.flow +4 -0
- package/list/menu-adapter.js +4 -0
- package/list/menu-adapter.js.flow +4 -0
- package/list/types.js.flow +4 -0
- package/locale/index.js +0 -7
- package/locale/index.js.flow +0 -7
- package/locale.ts +0 -1
- package/menu/index.d.ts +1 -3
- package/menu/stateful-container.js +0 -1
- package/menu/stateful-container.js.flow +0 -1
- package/menu/styled-components.js +1 -1
- package/menu/styled-components.js.flow +1 -1
- package/modal/index.d.ts +4 -6
- package/modal/index.js +0 -6
- package/modal/index.js.flow +0 -1
- package/modal/modal.js +27 -70
- package/modal/modal.js.flow +17 -83
- package/modal/styled-components.js +7 -40
- package/modal/styled-components.js.flow +12 -44
- package/modal/types.js.flow +1 -10
- package/package.json +3 -2
- package/phone-input/default-props.js +1 -1
- package/phone-input/default-props.js.flow +1 -1
- package/phone-input/index.d.ts +0 -1
- package/phone-input/index.js +0 -36
- package/phone-input/index.js.flow +0 -4
- package/phone-input/phone-input-lite.js +63 -38
- package/phone-input/phone-input-lite.js.flow +66 -44
- package/radio/index.d.ts +4 -9
- package/radio/radio.js +1 -7
- package/radio/radio.js.flow +1 -8
- package/radio/radiogroup.js +3 -28
- package/radio/radiogroup.js.flow +2 -26
- package/radio/styled-components.js +4 -5
- package/radio/styled-components.js.flow +3 -4
- package/radio/types.js.flow +4 -15
- package/rating/styled-components.js +3 -3
- package/rating/styled-components.js.flow +3 -3
- package/select/index.d.ts +0 -2
- package/select/index.js +0 -6
- package/select/index.js.flow +0 -2
- package/select/select-component.js +23 -24
- package/select/select-component.js.flow +25 -14
- package/select/styled-components.js +23 -17
- package/select/styled-components.js.flow +17 -12
- package/snackbar/snackbar-context.js +1 -1
- package/snackbar/snackbar-context.js.flow +1 -1
- package/snackbar/styled-components.js +1 -1
- package/snackbar/styled-components.js.flow +11 -11
- package/spinner/index.d.ts +5 -18
- package/spinner/index.js +2 -68
- package/spinner/index.js.flow +2 -27
- package/spinner/styled-components.js +9 -45
- package/spinner/styled-components.js.flow +2 -34
- package/spinner/types.js.flow +1 -19
- package/styles/types.js.flow +0 -2
- package/table/filter.js +3 -3
- package/table/filter.js.flow +3 -3
- package/tag/styled-components.js +1 -1
- package/tag/styled-components.js.flow +1 -1
- package/tag/types.js.flow +1 -1
- package/theme.ts +0 -81
- package/themes/dark-theme/color-component-tokens.js +0 -38
- package/themes/dark-theme/color-component-tokens.js.flow +0 -42
- package/themes/dark-theme/color-tokens.js +0 -2
- package/themes/dark-theme/color-tokens.js.flow +0 -2
- package/themes/dark-theme/create-dark-theme.js +1 -3
- package/themes/dark-theme/create-dark-theme.js.flow +0 -2
- package/themes/dark-theme/dark-theme.js +1 -3
- package/themes/dark-theme/dark-theme.js.flow +0 -2
- package/themes/light-theme/color-component-tokens.js +0 -38
- package/themes/light-theme/color-component-tokens.js.flow +0 -43
- package/themes/light-theme/color-tokens.js +0 -2
- package/themes/light-theme/color-tokens.js.flow +0 -2
- package/themes/light-theme/create-light-theme.js +1 -3
- package/themes/light-theme/create-light-theme.js.flow +0 -2
- package/themes/light-theme/light-theme.js +1 -3
- package/themes/light-theme/light-theme.js.flow +0 -2
- package/themes/types.js.flow +0 -68
- package/timepicker/timepicker.js +1 -8
- package/timepicker/timepicker.js.flow +4 -10
- package/typography/index.d.ts +0 -23
- package/typography/index.js +2 -57
- package/typography/index.js.flow +0 -31
- package/es/spinner/spinner.js +0 -68
- package/es/themes/dark-theme/color-deprecated-semantic-tokens.js +0 -35
- package/es/themes/light-theme/color-deprecated-semantic-tokens.js +0 -35
- package/esm/spinner/spinner.js +0 -125
- package/esm/themes/dark-theme/color-deprecated-semantic-tokens.js +0 -38
- package/esm/themes/light-theme/color-deprecated-semantic-tokens.js +0 -38
- package/spinner/spinner.js +0 -136
- package/spinner/spinner.js.flow +0 -75
- package/themes/dark-theme/color-deprecated-semantic-tokens.js +0 -50
- package/themes/dark-theme/color-deprecated-semantic-tokens.js.flow +0 -42
- package/themes/light-theme/color-deprecated-semantic-tokens.js +0 -50
- package/themes/light-theme/color-deprecated-semantic-tokens.js.flow +0 -42
package/esm/checkbox/checkbox.js
CHANGED
|
@@ -32,7 +32,7 @@ LICENSE file in the root directory of this source tree.
|
|
|
32
32
|
*/
|
|
33
33
|
import * as React from 'react';
|
|
34
34
|
import { getOverride, getOverrideProps } from '../helpers/overrides.js';
|
|
35
|
-
import { Checkmark as StyledCheckmark, Input as StyledInput, Label as StyledLabel, Root as StyledRoot, Toggle as StyledToggle,
|
|
35
|
+
import { Checkmark as StyledCheckmark, Input as StyledInput, Label as StyledLabel, Root as StyledRoot, Toggle as StyledToggle, ToggleTrack as StyledToggleTrack } from './styled-components.js';
|
|
36
36
|
import { STYLE_TYPE } from './constants.js';
|
|
37
37
|
import { isFocusVisible } from '../utils/focusVisible.js';
|
|
38
38
|
|
|
@@ -124,10 +124,6 @@ var StatelessCheckbox = /*#__PURE__*/function (_React$Component) {
|
|
|
124
124
|
}
|
|
125
125
|
});
|
|
126
126
|
|
|
127
|
-
_defineProperty(_assertThisInitialized(_this), "isToggle", function () {
|
|
128
|
-
return _this.props.checkmarkType === STYLE_TYPE.toggle || _this.props.checkmarkType === STYLE_TYPE.toggle_round;
|
|
129
|
-
});
|
|
130
|
-
|
|
131
127
|
return _this;
|
|
132
128
|
}
|
|
133
129
|
|
|
@@ -140,32 +136,19 @@ var StatelessCheckbox = /*#__PURE__*/function (_React$Component) {
|
|
|
140
136
|
|
|
141
137
|
if (autoFocus && inputRef.current) {
|
|
142
138
|
inputRef.current.focus();
|
|
143
|
-
} // TODO(v11)
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
if (process.env.NODE_ENV !== "production") {
|
|
147
|
-
if (this.props.checkmarkType === STYLE_TYPE.toggle) {
|
|
148
|
-
console.warn("baseui:Checkbox The STYLE_TYPE.toggle value on the 'checkmarkType' prop does not conform to the current base design specification. " + 'Please update your code to STYLE_TYPE.toggle_round. This will be updated automatically in a future major version.');
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
if (this.props.isError) {
|
|
152
|
-
console.warn('baseui:Checkbox Property "isError" will be removed in the next major version. Use "error" property instead.');
|
|
153
|
-
}
|
|
154
139
|
}
|
|
155
140
|
}
|
|
156
141
|
}, {
|
|
157
142
|
key: "render",
|
|
158
143
|
value: function render() {
|
|
159
|
-
var checkmarkType = this.props.checkmarkType;
|
|
160
144
|
var _this$props2 = this.props,
|
|
161
145
|
_this$props2$override = _this$props2.overrides,
|
|
162
146
|
overrides = _this$props2$override === void 0 ? {} : _this$props2$override,
|
|
163
147
|
onChange = _this$props2.onChange,
|
|
164
148
|
_this$props2$labelPla = _this$props2.labelPlacement,
|
|
165
|
-
labelPlacement = _this$props2$labelPla === void 0 ? this.
|
|
149
|
+
labelPlacement = _this$props2$labelPla === void 0 ? this.props.checkmarkType === STYLE_TYPE.toggle ? 'left' : 'right' : _this$props2$labelPla,
|
|
166
150
|
inputRef = _this$props2.inputRef,
|
|
167
151
|
isIndeterminate = _this$props2.isIndeterminate,
|
|
168
|
-
isError = _this$props2.isError,
|
|
169
152
|
error = _this$props2.error,
|
|
170
153
|
disabled = _this$props2.disabled,
|
|
171
154
|
value = _this$props2.value,
|
|
@@ -180,14 +163,12 @@ var StatelessCheckbox = /*#__PURE__*/function (_React$Component) {
|
|
|
180
163
|
LabelOverride = overrides.Label,
|
|
181
164
|
InputOverride = overrides.Input,
|
|
182
165
|
ToggleOverride = overrides.Toggle,
|
|
183
|
-
ToggleInnerOverride = overrides.ToggleInner,
|
|
184
166
|
ToggleTrackOverride = overrides.ToggleTrack;
|
|
185
167
|
var Root = getOverride(RootOverride) || StyledRoot;
|
|
186
168
|
var Checkmark = getOverride(CheckmarkOverride) || StyledCheckmark;
|
|
187
169
|
var Label = getOverride(LabelOverride) || StyledLabel;
|
|
188
170
|
var Input = getOverride(InputOverride) || StyledInput;
|
|
189
171
|
var Toggle = getOverride(ToggleOverride) || StyledToggle;
|
|
190
|
-
var ToggleInner = getOverride(ToggleInnerOverride) || StyledToggleInner;
|
|
191
172
|
var ToggleTrack = getOverride(ToggleTrackOverride) || StyledToggleTrack;
|
|
192
173
|
var inputEvents = {
|
|
193
174
|
onChange: onChange,
|
|
@@ -205,17 +186,14 @@ var StatelessCheckbox = /*#__PURE__*/function (_React$Component) {
|
|
|
205
186
|
$isFocusVisible: this.state.isFocusVisible,
|
|
206
187
|
$isHovered: this.state.isHovered,
|
|
207
188
|
$isActive: this.state.isActive,
|
|
208
|
-
$isError: isError,
|
|
209
189
|
$error: error,
|
|
210
190
|
$checked: checked,
|
|
211
191
|
$isIndeterminate: isIndeterminate,
|
|
212
192
|
$required: required,
|
|
213
193
|
$disabled: disabled,
|
|
214
|
-
$value: value
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
var labelComp = /*#__PURE__*/React.createElement(Label, _extends({
|
|
194
|
+
$value: value
|
|
195
|
+
};
|
|
196
|
+
var labelComp = children && /*#__PURE__*/React.createElement(Label, _extends({
|
|
219
197
|
$labelPlacement: labelPlacement
|
|
220
198
|
}, sharedProps, getOverrideProps(LabelOverride)), this.props.containsInteractiveElement ?
|
|
221
199
|
/*#__PURE__*/
|
|
@@ -230,7 +208,7 @@ var StatelessCheckbox = /*#__PURE__*/function (_React$Component) {
|
|
|
230
208
|
"data-baseweb": "checkbox",
|
|
231
209
|
title: title || null,
|
|
232
210
|
$labelPlacement: labelPlacement
|
|
233
|
-
}, sharedProps, mouseEvents, getOverrideProps(RootOverride)), (labelPlacement === 'top' || labelPlacement === 'left') && labelComp, this.
|
|
211
|
+
}, sharedProps, mouseEvents, getOverrideProps(RootOverride)), (labelPlacement === 'top' || labelPlacement === 'left') && labelComp, this.props.checkmarkType === STYLE_TYPE.toggle ? /*#__PURE__*/React.createElement(ToggleTrack, _extends({}, sharedProps, getOverrideProps(ToggleTrackOverride)), /*#__PURE__*/React.createElement(Toggle, _extends({}, sharedProps, getOverrideProps(ToggleOverride)))) : /*#__PURE__*/React.createElement(Checkmark, _extends({}, sharedProps, getOverrideProps(CheckmarkOverride))), /*#__PURE__*/React.createElement(Input, _extends({
|
|
234
212
|
value: value,
|
|
235
213
|
name: name,
|
|
236
214
|
checked: checked,
|
|
@@ -239,7 +217,7 @@ var StatelessCheckbox = /*#__PURE__*/function (_React$Component) {
|
|
|
239
217
|
"aria-checked": isIndeterminate ? 'mixed' : checked,
|
|
240
218
|
"aria-describedby": this.props['aria-describedby'],
|
|
241
219
|
"aria-errormessage": this.props['aria-errormessage'],
|
|
242
|
-
"aria-invalid": error ||
|
|
220
|
+
"aria-invalid": error || null,
|
|
243
221
|
"aria-required": required || null,
|
|
244
222
|
disabled: disabled,
|
|
245
223
|
type: type,
|
|
@@ -262,7 +240,6 @@ _defineProperty(StatelessCheckbox, "defaultProps", {
|
|
|
262
240
|
autoFocus: false,
|
|
263
241
|
isIndeterminate: false,
|
|
264
242
|
inputRef: /*#__PURE__*/React.createRef(),
|
|
265
|
-
isError: false,
|
|
266
243
|
error: false,
|
|
267
244
|
type: 'checkbox',
|
|
268
245
|
checkmarkType: STYLE_TYPE.default,
|
|
@@ -12,7 +12,8 @@ export var STATE_TYPE = {
|
|
|
12
12
|
export var STYLE_TYPE = Object.freeze({
|
|
13
13
|
default: 'default',
|
|
14
14
|
toggle: 'toggle',
|
|
15
|
-
|
|
15
|
+
// maintaining key with aliased value to assist in transition to v11 but will be removed soon after release
|
|
16
|
+
toggle_round: 'toggle'
|
|
16
17
|
});
|
|
17
18
|
export var LABEL_PLACEMENT = Object.freeze({
|
|
18
19
|
top: 'top',
|
package/esm/checkbox/index.js
CHANGED
|
@@ -8,5 +8,5 @@ export { default as StatefulCheckbox } from './stateful-checkbox.js';
|
|
|
8
8
|
export { default as StatefulContainer } from './stateful-checkbox-container.js';
|
|
9
9
|
export { default as Checkbox } from './checkbox.js'; // Styled elements
|
|
10
10
|
|
|
11
|
-
export { Root as StyledRoot, Checkmark as StyledCheckmark, Label as StyledLabel, Input as StyledInput, Toggle as StyledToggle,
|
|
11
|
+
export { Root as StyledRoot, Checkmark as StyledCheckmark, Label as StyledLabel, Input as StyledInput, Toggle as StyledToggle, ToggleTrack as StyledToggleTrack } from './styled-components.js';
|
|
12
12
|
export { STATE_TYPE, STYLE_TYPE, LABEL_PLACEMENT } from './constants.js'; // Flow
|
|
@@ -10,13 +10,11 @@ Copyright (c) Uber Technologies, Inc.
|
|
|
10
10
|
This source code is licensed under the MIT license found in the
|
|
11
11
|
LICENSE file in the root directory of this source tree.
|
|
12
12
|
*/
|
|
13
|
-
import { styled
|
|
14
|
-
import { STYLE_TYPE } from './constants.js';
|
|
13
|
+
import { styled } from '../styles/index.js';
|
|
15
14
|
|
|
16
15
|
function getBorderColor(props) {
|
|
17
16
|
var $disabled = props.$disabled,
|
|
18
17
|
$checked = props.$checked,
|
|
19
|
-
$isError = props.$isError,
|
|
20
18
|
$error = props.$error,
|
|
21
19
|
$isIndeterminate = props.$isIndeterminate,
|
|
22
20
|
$theme = props.$theme,
|
|
@@ -27,8 +25,8 @@ function getBorderColor(props) {
|
|
|
27
25
|
return colors.tickFillDisabled;
|
|
28
26
|
} else if ($checked || $isIndeterminate) {
|
|
29
27
|
return 'transparent';
|
|
30
|
-
} else if ($error
|
|
31
|
-
return colors.
|
|
28
|
+
} else if ($error) {
|
|
29
|
+
return colors.borderNegative;
|
|
32
30
|
} else if ($isFocusVisible) {
|
|
33
31
|
return colors.borderSelected;
|
|
34
32
|
} else {
|
|
@@ -76,26 +74,19 @@ function getBackgroundColor(props) {
|
|
|
76
74
|
var $disabled = props.$disabled,
|
|
77
75
|
$checked = props.$checked,
|
|
78
76
|
$isIndeterminate = props.$isIndeterminate,
|
|
79
|
-
$isError = props.$isError,
|
|
80
77
|
$error = props.$error,
|
|
81
78
|
$isHovered = props.$isHovered,
|
|
82
79
|
$isActive = props.$isActive,
|
|
83
|
-
$theme = props.$theme
|
|
84
|
-
$checkmarkType = props.$checkmarkType;
|
|
85
|
-
var isToggle = $checkmarkType === STYLE_TYPE.toggle;
|
|
80
|
+
$theme = props.$theme;
|
|
86
81
|
var colors = $theme.colors;
|
|
87
82
|
|
|
88
83
|
if ($disabled) {
|
|
89
|
-
if (isToggle) {
|
|
90
|
-
return colors.toggleFillDisabled;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
84
|
if ($checked || $isIndeterminate) {
|
|
94
85
|
return colors.tickFillDisabled;
|
|
95
86
|
} else {
|
|
96
87
|
return colors.tickFill;
|
|
97
88
|
}
|
|
98
|
-
} else if (
|
|
89
|
+
} else if ($error && ($isIndeterminate || $checked)) {
|
|
99
90
|
if ($isActive) {
|
|
100
91
|
return colors.tickFillErrorSelectedHoverActive;
|
|
101
92
|
} else if ($isHovered) {
|
|
@@ -103,7 +94,7 @@ function getBackgroundColor(props) {
|
|
|
103
94
|
} else {
|
|
104
95
|
return colors.tickFillErrorSelected;
|
|
105
96
|
}
|
|
106
|
-
} else if ($error
|
|
97
|
+
} else if ($error) {
|
|
107
98
|
if ($isActive) {
|
|
108
99
|
return colors.tickFillErrorHoverActive;
|
|
109
100
|
} else if ($isHovered) {
|
|
@@ -121,11 +112,11 @@ function getBackgroundColor(props) {
|
|
|
121
112
|
}
|
|
122
113
|
} else {
|
|
123
114
|
if ($isActive) {
|
|
124
|
-
return
|
|
115
|
+
return colors.tickFillActive;
|
|
125
116
|
} else if ($isHovered) {
|
|
126
|
-
return
|
|
117
|
+
return colors.tickFillHover;
|
|
127
118
|
} else {
|
|
128
|
-
return
|
|
119
|
+
return colors.tickFill;
|
|
129
120
|
}
|
|
130
121
|
}
|
|
131
122
|
}
|
|
@@ -152,14 +143,13 @@ Root.displayName = "Root";
|
|
|
152
143
|
export var Checkmark = styled('span', function (props) {
|
|
153
144
|
var $checked = props.$checked,
|
|
154
145
|
$disabled = props.$disabled,
|
|
155
|
-
$isError = props.$isError,
|
|
156
146
|
$error = props.$error,
|
|
157
147
|
$isIndeterminate = props.$isIndeterminate,
|
|
158
148
|
$theme = props.$theme,
|
|
159
149
|
$isFocusVisible = props.$isFocusVisible;
|
|
160
150
|
var sizing = $theme.sizing,
|
|
161
151
|
animation = $theme.animation;
|
|
162
|
-
var tickColor = $disabled ? $theme.colors.tickMarkFillDisabled : $
|
|
152
|
+
var tickColor = $disabled ? $theme.colors.tickMarkFillDisabled : $error ? $theme.colors.tickMarkFillError : $theme.colors.tickMarkFill;
|
|
163
153
|
var indeterminate = encodeURIComponent("\n <svg width=\"14\" height=\"4\" viewBox=\"0 0 14 4\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M14 0.5H0V3.5H14V0.5Z\" fill=\"".concat(tickColor, "\"/>\n </svg>\n "));
|
|
164
154
|
var check = encodeURIComponent("\n <svg width=\"17\" height=\"13\" viewBox=\"0 0 17 13\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M6.50002 12.6L0.400024 6.60002L2.60002 4.40002L6.50002 8.40002L13.9 0.900024L16.1 3.10002L6.50002 12.6Z\" fill=\"".concat(tickColor, "\"/>\n </svg>\n "));
|
|
165
155
|
var borderRadius = $theme.borders.inputBorderRadius;
|
|
@@ -206,11 +196,9 @@ export var Checkmark = styled('span', function (props) {
|
|
|
206
196
|
});
|
|
207
197
|
Checkmark.displayName = "Checkmark";
|
|
208
198
|
export var Label = styled('div', function (props) {
|
|
209
|
-
var $theme = props.$theme
|
|
210
|
-
$checkmarkType = props.$checkmarkType;
|
|
199
|
+
var $theme = props.$theme;
|
|
211
200
|
var typography = $theme.typography;
|
|
212
201
|
return _objectSpread(_objectSpread(_objectSpread({
|
|
213
|
-
flex: $checkmarkType === STYLE_TYPE.toggle ? 'auto' : null,
|
|
214
202
|
verticalAlign: 'middle'
|
|
215
203
|
}, getLabelPadding(props)), {}, {
|
|
216
204
|
color: getLabelColor(props)
|
|
@@ -231,137 +219,54 @@ export var Input = styled('input', {
|
|
|
231
219
|
});
|
|
232
220
|
Input.displayName = "Input";
|
|
233
221
|
export var Toggle = styled('div', function (props) {
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
borderBottomLeftRadius: borderRadius,
|
|
243
|
-
boxShadow: props.$isFocusVisible ? "0 0 0 3px ".concat(props.$theme.colors.accent) : props.$theme.lighting.shadow400,
|
|
244
|
-
outline: 'none',
|
|
245
|
-
display: 'flex',
|
|
246
|
-
justifyContent: 'center',
|
|
247
|
-
height: props.$theme.sizing.scale800,
|
|
248
|
-
width: props.$theme.sizing.scale800
|
|
249
|
-
});
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
if (props.$checkmarkType === STYLE_TYPE.toggle_round) {
|
|
253
|
-
var backgroundColor = props.$theme.colors.toggleFill;
|
|
254
|
-
|
|
255
|
-
if (props.$disabled) {
|
|
256
|
-
backgroundColor = props.$theme.colors.toggleFillDisabled;
|
|
257
|
-
} else if (props.$checked && (props.$error || props.$isError)) {
|
|
258
|
-
backgroundColor = props.$theme.colors.borderError;
|
|
259
|
-
} else if (props.$checked) {
|
|
260
|
-
backgroundColor = props.$theme.colors.toggleFillChecked;
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
return {
|
|
264
|
-
backgroundColor: backgroundColor,
|
|
265
|
-
borderTopLeftRadius: '50%',
|
|
266
|
-
borderTopRightRadius: '50%',
|
|
267
|
-
borderBottomRightRadius: '50%',
|
|
268
|
-
borderBottomLeftRadius: '50%',
|
|
269
|
-
boxShadow: props.$isFocusVisible ? "0 0 0 3px ".concat(props.$theme.colors.accent) : props.$isHovered && !props.$disabled ? props.$theme.lighting.shadow500 : props.$theme.lighting.shadow400,
|
|
270
|
-
outline: 'none',
|
|
271
|
-
height: props.$theme.sizing.scale700,
|
|
272
|
-
width: props.$theme.sizing.scale700,
|
|
273
|
-
transform: props.$checked ? "translateX(".concat(props.$theme.direction === 'rtl' ? '-100%' : '100%', ")") : null,
|
|
274
|
-
transition: "transform ".concat(props.$theme.animation.timing200)
|
|
275
|
-
};
|
|
222
|
+
var backgroundColor = props.$theme.colors.toggleFill;
|
|
223
|
+
|
|
224
|
+
if (props.$disabled) {
|
|
225
|
+
backgroundColor = props.$theme.colors.toggleFillDisabled;
|
|
226
|
+
} else if (props.$checked && props.$error) {
|
|
227
|
+
backgroundColor = props.$theme.colors.tickFillErrorSelected;
|
|
228
|
+
} else if (props.$checked) {
|
|
229
|
+
backgroundColor = props.$theme.colors.toggleFillChecked;
|
|
276
230
|
}
|
|
277
231
|
|
|
278
|
-
return {
|
|
232
|
+
return {
|
|
233
|
+
backgroundColor: backgroundColor,
|
|
234
|
+
borderTopLeftRadius: '50%',
|
|
235
|
+
borderTopRightRadius: '50%',
|
|
236
|
+
borderBottomRightRadius: '50%',
|
|
237
|
+
borderBottomLeftRadius: '50%',
|
|
238
|
+
boxShadow: props.$isFocusVisible ? "0 0 0 3px ".concat(props.$theme.colors.accent) : props.$isHovered && !props.$disabled ? props.$theme.lighting.shadow500 : props.$theme.lighting.shadow400,
|
|
239
|
+
outline: 'none',
|
|
240
|
+
height: props.$theme.sizing.scale700,
|
|
241
|
+
width: props.$theme.sizing.scale700,
|
|
242
|
+
transform: props.$checked ? "translateX(".concat(props.$theme.direction === 'rtl' ? '-100%' : '100%', ")") : null,
|
|
243
|
+
transition: "transform ".concat(props.$theme.animation.timing200)
|
|
244
|
+
};
|
|
279
245
|
});
|
|
280
246
|
Toggle.displayName = "Toggle";
|
|
281
|
-
export var ToggleInner = styled('div', function (props) {
|
|
282
|
-
if (props.$checkmarkType === STYLE_TYPE.toggle) {
|
|
283
|
-
// eslint-disable-next-line no-inner-declarations
|
|
284
|
-
var backgroundColor = function backgroundColor() {
|
|
285
|
-
if (props.$disabled) {
|
|
286
|
-
return props.$theme.colors.sliderHandleInnerFillDisabled;
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
if (props.$isActive && props.$checked) {
|
|
290
|
-
return props.$theme.colors.sliderHandleInnerFillSelectedActive;
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
if (props.$isHovered && props.$checked) {
|
|
294
|
-
return props.$theme.colors.sliderHandleInnerFillSelectedHover;
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
return props.$theme.colors.toggleTrackFill;
|
|
298
|
-
};
|
|
299
|
-
|
|
300
|
-
return {
|
|
301
|
-
height: props.$theme.sizing.scale300,
|
|
302
|
-
width: props.$theme.sizing.scale0,
|
|
303
|
-
borderTopLeftRadius: props.$theme.borders.radius100,
|
|
304
|
-
borderTopRightRadius: props.$theme.borders.radius100,
|
|
305
|
-
borderBottomRightRadius: props.$theme.borders.radius100,
|
|
306
|
-
borderBottomLeftRadius: props.$theme.borders.radius100,
|
|
307
|
-
backgroundColor: backgroundColor()
|
|
308
|
-
};
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
if (props.$checkmarkType === STYLE_TYPE.toggle_round) {
|
|
312
|
-
return {};
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
return {};
|
|
316
|
-
});
|
|
317
|
-
ToggleInner.displayName = "ToggleInner";
|
|
318
247
|
export var ToggleTrack = styled('div', function (props) {
|
|
319
|
-
|
|
320
|
-
var borderRadius = props.$theme.borders.useRoundedCorners ? props.$theme.borders.radius200 : null;
|
|
321
|
-
return {
|
|
322
|
-
alignItems: 'center',
|
|
323
|
-
backgroundColor: getBackgroundColor(props),
|
|
324
|
-
borderTopLeftRadius: borderRadius,
|
|
325
|
-
borderTopRightRadius: borderRadius,
|
|
326
|
-
borderBottomRightRadius: borderRadius,
|
|
327
|
-
borderBottomLeftRadius: borderRadius,
|
|
328
|
-
display: 'flex',
|
|
329
|
-
height: props.$theme.sizing.scale600,
|
|
330
|
-
justifyContent: props.$checked ? 'flex-end' : 'flex-start',
|
|
331
|
-
marginTop: props.$theme.sizing.scale100,
|
|
332
|
-
marginBottom: props.$theme.sizing.scale100,
|
|
333
|
-
marginLeft: props.$theme.sizing.scale100,
|
|
334
|
-
marginRight: props.$theme.sizing.scale100,
|
|
335
|
-
width: props.$theme.sizing.scale1000
|
|
336
|
-
};
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
if (props.$checkmarkType === STYLE_TYPE.toggle_round) {
|
|
340
|
-
var backgroundColor = props.$theme.colors.toggleTrackFill;
|
|
341
|
-
|
|
342
|
-
if (props.$disabled) {
|
|
343
|
-
backgroundColor = props.$theme.colors.toggleTrackFillDisabled;
|
|
344
|
-
} else if ((props.$error || props.$isError) && props.$checked) {
|
|
345
|
-
backgroundColor = props.$theme.colors.tickFillError;
|
|
346
|
-
}
|
|
248
|
+
var backgroundColor = props.$theme.colors.toggleTrackFill;
|
|
347
249
|
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
borderTopRightRadius: '7px',
|
|
353
|
-
borderBottomRightRadius: '7px',
|
|
354
|
-
borderBottomLeftRadius: '7px',
|
|
355
|
-
display: 'flex',
|
|
356
|
-
height: props.$theme.sizing.scale550,
|
|
357
|
-
marginTop: props.$theme.sizing.scale200,
|
|
358
|
-
marginBottom: props.$theme.sizing.scale100,
|
|
359
|
-
marginLeft: props.$theme.sizing.scale200,
|
|
360
|
-
marginRight: props.$theme.sizing.scale100,
|
|
361
|
-
width: props.$theme.sizing.scale1000
|
|
362
|
-
};
|
|
250
|
+
if (props.$disabled) {
|
|
251
|
+
backgroundColor = props.$theme.colors.toggleTrackFillDisabled;
|
|
252
|
+
} else if (props.$error && props.$checked) {
|
|
253
|
+
backgroundColor = props.$theme.colors.tickFillError;
|
|
363
254
|
}
|
|
364
255
|
|
|
365
|
-
return {
|
|
256
|
+
return {
|
|
257
|
+
alignItems: 'center',
|
|
258
|
+
backgroundColor: backgroundColor,
|
|
259
|
+
borderTopLeftRadius: '7px',
|
|
260
|
+
borderTopRightRadius: '7px',
|
|
261
|
+
borderBottomRightRadius: '7px',
|
|
262
|
+
borderBottomLeftRadius: '7px',
|
|
263
|
+
display: 'flex',
|
|
264
|
+
height: props.$theme.sizing.scale550,
|
|
265
|
+
marginTop: props.$theme.sizing.scale200,
|
|
266
|
+
marginBottom: props.$theme.sizing.scale100,
|
|
267
|
+
marginLeft: props.$theme.sizing.scale200,
|
|
268
|
+
marginRight: props.$theme.sizing.scale100,
|
|
269
|
+
width: props.$theme.sizing.scale1000
|
|
270
|
+
};
|
|
366
271
|
});
|
|
367
272
|
ToggleTrack.displayName = "ToggleTrack";
|
|
@@ -57,7 +57,7 @@ function FilterQuickControls(props) {
|
|
|
57
57
|
var locale = React.useContext(LocaleContext);
|
|
58
58
|
return /*#__PURE__*/React.createElement(ButtonGroup, {
|
|
59
59
|
size: SIZE.mini,
|
|
60
|
-
kind: KIND.
|
|
60
|
+
kind: KIND.tertiary
|
|
61
61
|
}, /*#__PURE__*/React.createElement(Button, {
|
|
62
62
|
type: "button",
|
|
63
63
|
onClick: props.onSelectAll
|
|
@@ -425,7 +425,7 @@ function DatetimeFilter(props) {
|
|
|
425
425
|
if (Array.isArray(date)) {
|
|
426
426
|
if (!date.length) return;
|
|
427
427
|
var nextDates = date.map(function (d, i) {
|
|
428
|
-
return applyDateToTime(rangeDates[i], d);
|
|
428
|
+
return d ? applyDateToTime(rangeDates[i], d) : null;
|
|
429
429
|
});
|
|
430
430
|
setRangeDates(nextDates);
|
|
431
431
|
}
|
package/esm/data-table/column.js
CHANGED
|
@@ -75,7 +75,11 @@ function Column(options) {
|
|
|
75
75
|
display: 'flex',
|
|
76
76
|
height: '100%'
|
|
77
77
|
})
|
|
78
|
-
}, Boolean(props.onSelect) && /*#__PURE__*/React.createElement(
|
|
78
|
+
}, Boolean(props.onSelect) && /*#__PURE__*/React.createElement("span", {
|
|
79
|
+
className: css({
|
|
80
|
+
paddingRight: theme.sizing.scale300
|
|
81
|
+
})
|
|
82
|
+
}, /*#__PURE__*/React.createElement(Checkbox, {
|
|
79
83
|
onChange: props.onSelect,
|
|
80
84
|
checked: props.isSelected,
|
|
81
85
|
overrides: {
|
|
@@ -86,7 +90,7 @@ function Column(options) {
|
|
|
86
90
|
}
|
|
87
91
|
}
|
|
88
92
|
}
|
|
89
|
-
}), /*#__PURE__*/React.createElement(ProvidedCell, props)));
|
|
93
|
+
})), /*#__PURE__*/React.createElement(ProvidedCell, props)));
|
|
90
94
|
}),
|
|
91
95
|
renderFilter: options.renderFilter || function () {
|
|
92
96
|
return null;
|
|
@@ -466,7 +466,7 @@ var InnerTableElement = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
466
466
|
});
|
|
467
467
|
},
|
|
468
468
|
size: BUTTON_SIZES.compact,
|
|
469
|
-
kind: BUTTON_KINDS.
|
|
469
|
+
kind: BUTTON_KINDS.tertiary,
|
|
470
470
|
shape: BUTTON_SHAPES.round,
|
|
471
471
|
overrides: {
|
|
472
472
|
BaseButton: {
|
|
@@ -536,7 +536,8 @@ export function DataTable(_ref2) {
|
|
|
536
536
|
sortIndex = _ref2.sortIndex,
|
|
537
537
|
sortDirection = _ref2.sortDirection,
|
|
538
538
|
_ref2$textQuery = _ref2.textQuery,
|
|
539
|
-
textQuery = _ref2$textQuery === void 0 ? '' : _ref2$textQuery
|
|
539
|
+
textQuery = _ref2$textQuery === void 0 ? '' : _ref2$textQuery,
|
|
540
|
+
controlRef = _ref2.controlRef;
|
|
540
541
|
|
|
541
542
|
var _useStyletron13 = useStyletron(),
|
|
542
543
|
_useStyletron14 = _slicedToArray(_useStyletron13, 2),
|
|
@@ -735,6 +736,13 @@ export function DataTable(_ref2) {
|
|
|
735
736
|
|
|
736
737
|
return result;
|
|
737
738
|
}, [sortedIndices, filteredIndices, onIncludedRowsChange, allRows]);
|
|
739
|
+
React.useImperativeHandle(controlRef, function () {
|
|
740
|
+
return {
|
|
741
|
+
getRows: function getRows() {
|
|
742
|
+
return rows;
|
|
743
|
+
}
|
|
744
|
+
};
|
|
745
|
+
}, [rows]);
|
|
738
746
|
|
|
739
747
|
var _React$useState19 = React.useState(0),
|
|
740
748
|
_React$useState20 = _slicedToArray(_React$useState19, 2),
|
|
@@ -95,6 +95,9 @@ var HeaderCell = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
95
95
|
onFocus: handleFocus,
|
|
96
96
|
onBlur: handleBlur
|
|
97
97
|
}, props.isSelectable && /*#__PURE__*/React.createElement("span", {
|
|
98
|
+
className: css({
|
|
99
|
+
paddingRight: theme.sizing.scale300
|
|
100
|
+
}),
|
|
98
101
|
ref: checkboxRef
|
|
99
102
|
}, /*#__PURE__*/React.createElement(Checkbox, {
|
|
100
103
|
onChange: function onChange(e) {
|
|
@@ -315,25 +315,36 @@ var Calendar = /*#__PURE__*/function (_React$Component) {
|
|
|
315
315
|
_defineProperty(_assertThisInitialized(_this), "handleDateChange", function (data) {
|
|
316
316
|
var _this$props$onChange = _this.props.onChange,
|
|
317
317
|
onChange = _this$props$onChange === void 0 ? function (params) {} : _this$props$onChange;
|
|
318
|
-
var updatedDate = data.date; //
|
|
318
|
+
var updatedDate = data.date; // Apply the currently selected time values (saved in state) to the updated date
|
|
319
319
|
|
|
320
|
-
|
|
320
|
+
if (Array.isArray(data.date)) {
|
|
321
|
+
// We'll need to update the date in time values of internal state
|
|
322
|
+
var newTimeState = _toConsumableArray(_this.state.time);
|
|
321
323
|
|
|
324
|
+
var start = data.date[0] ? _this.dateHelpers.applyDateToTime(newTimeState[0], data.date[0]) : null;
|
|
325
|
+
var end = data.date[1] ? _this.dateHelpers.applyDateToTime(newTimeState[1], data.date[1]) : null;
|
|
326
|
+
newTimeState[0] = start;
|
|
322
327
|
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
newTimeState[
|
|
326
|
-
|
|
328
|
+
if (end) {
|
|
329
|
+
updatedDate = [start, end];
|
|
330
|
+
newTimeState[1] = end;
|
|
331
|
+
} else {
|
|
332
|
+
updatedDate = [start];
|
|
333
|
+
} // Update the date in time values of internal state
|
|
334
|
+
|
|
335
|
+
|
|
336
|
+
_this.setState({
|
|
337
|
+
time: newTimeState
|
|
327
338
|
});
|
|
328
339
|
} else if (!Array.isArray(_this.props.value) && data.date) {
|
|
329
|
-
|
|
330
|
-
updatedDate = newTimeState[0];
|
|
331
|
-
} // Update the date in time values of internal state
|
|
340
|
+
var _newTimeState = _this.dateHelpers.applyDateToTime(_this.state.time[0], data.date);
|
|
332
341
|
|
|
342
|
+
updatedDate = _newTimeState; // Update the date in time values of internal state
|
|
333
343
|
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
344
|
+
_this.setState({
|
|
345
|
+
time: [_newTimeState]
|
|
346
|
+
});
|
|
347
|
+
}
|
|
337
348
|
|
|
338
349
|
onChange({
|
|
339
350
|
date: updatedDate
|
|
@@ -356,7 +367,7 @@ var Calendar = /*#__PURE__*/function (_React$Component) {
|
|
|
356
367
|
|
|
357
368
|
if (Array.isArray(_this.props.value)) {
|
|
358
369
|
var dates = _this.props.value.map(function (date, i) {
|
|
359
|
-
if (index === i) {
|
|
370
|
+
if (date && index === i) {
|
|
360
371
|
return _this.dateHelpers.applyTimeToDate(date, time);
|
|
361
372
|
}
|
|
362
373
|
|
|
@@ -364,7 +375,7 @@ var Calendar = /*#__PURE__*/function (_React$Component) {
|
|
|
364
375
|
});
|
|
365
376
|
|
|
366
377
|
onChange({
|
|
367
|
-
date: dates
|
|
378
|
+
date: [dates[0], dates[1]]
|
|
368
379
|
});
|
|
369
380
|
} else {
|
|
370
381
|
var date = _this.dateHelpers.applyTimeToDate(_this.props.value, time);
|
|
@@ -434,7 +445,9 @@ var Calendar = /*#__PURE__*/function (_React$Component) {
|
|
|
434
445
|
overrides: overrides,
|
|
435
446
|
value: _this.props.value,
|
|
436
447
|
peekNextMonth: _this.props.peekNextMonth,
|
|
437
|
-
fixedHeight: _this.props.fixedHeight
|
|
448
|
+
fixedHeight: _this.props.fixedHeight,
|
|
449
|
+
hasLockedBehavior: !!_this.props.hasLockedBehavior,
|
|
450
|
+
selectedInput: _this.props.selectedInput
|
|
438
451
|
})));
|
|
439
452
|
monthList.push( /*#__PURE__*/React.createElement("div", {
|
|
440
453
|
key: "month-component-".concat(i)
|
|
@@ -25,4 +25,12 @@ export var DEFAULT_MONTHS = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];
|
|
|
25
25
|
export var DENSITY = {
|
|
26
26
|
high: 'high',
|
|
27
27
|
default: 'default'
|
|
28
|
+
};
|
|
29
|
+
export var INPUT_ROLE = {
|
|
30
|
+
startDate: 'startDate',
|
|
31
|
+
endDate: 'endDate'
|
|
32
|
+
};
|
|
33
|
+
export var RANGED_CALENDAR_BEHAVIOR = {
|
|
34
|
+
default: 'default',
|
|
35
|
+
locked: 'locked'
|
|
28
36
|
};
|