baseui 11.0.1 → 11.1.0
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/a11y/index.d.ts +1 -1
- package/accordion/index.d.ts +25 -28
- package/app-nav-bar/app-nav-bar.js +33 -40
- package/app-nav-bar/app-nav-bar.js.flow +46 -62
- package/app-nav-bar/index.d.ts +9 -8
- package/app-nav-bar/styled-components.js +49 -29
- package/app-nav-bar/styled-components.js.flow +25 -8
- package/app-nav-bar/types.js.flow +2 -0
- package/aspect-ratio-box/index.d.ts +2 -4
- package/avatar/index.d.ts +6 -12
- package/badge/badge.js +109 -0
- package/badge/badge.js.flow +91 -0
- package/badge/constants.js +54 -0
- package/badge/constants.js.flow +52 -0
- package/badge/hint-dot.js +96 -0
- package/badge/hint-dot.js.flow +68 -0
- package/badge/index.d.ts +97 -0
- package/badge/index.js +80 -0
- package/badge/index.js.flow +20 -0
- package/badge/notification-circle.js +103 -0
- package/badge/notification-circle.js.flow +81 -0
- package/badge/package.json +4 -0
- package/badge/styled-components.js +242 -0
- package/badge/styled-components.js.flow +325 -0
- package/badge/types.js +11 -0
- package/badge/types.js.flow +59 -0
- package/badge/utils.js +33 -0
- package/badge/utils.js.flow +23 -0
- package/banner/banner.js +283 -0
- package/banner/banner.js.flow +253 -0
- package/banner/constants.js +35 -0
- package/banner/constants.js.flow +33 -0
- package/banner/index.d.ts +75 -0
- package/banner/index.js +44 -0
- package/banner/index.js.flow +16 -0
- package/banner/package.json +4 -0
- package/banner/styled-components.js +131 -0
- package/banner/styled-components.js.flow +119 -0
- package/banner/types.js +11 -0
- package/banner/types.js.flow +66 -0
- package/block/index.d.ts +4 -4
- package/breadcrumbs/breadcrumbs.js +5 -1
- package/breadcrumbs/breadcrumbs.js.flow +2 -2
- package/breadcrumbs/index.d.ts +5 -5
- package/button/button.js +2 -1
- package/button/button.js.flow +1 -0
- package/button/index.d.ts +19 -29
- package/button-group/index.d.ts +18 -24
- package/card/index.d.ts +16 -14
- package/checkbox/index.d.ts +17 -21
- package/combobox/index.d.ts +7 -11
- package/data-table/index.d.ts +7 -10
- package/datepicker/calendar.js +16 -11
- package/datepicker/calendar.js.flow +12 -9
- package/datepicker/datepicker.js +58 -58
- package/datepicker/datepicker.js.flow +51 -34
- package/datepicker/index.d.ts +42 -63
- 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 -4
- package/datepicker/stateful-datepicker.js +6 -1
- package/datepicker/stateful-datepicker.js.flow +7 -1
- package/datepicker/types.js.flow +21 -43
- package/datepicker/utils/date-helpers.js +1 -1
- package/datepicker/utils/date-helpers.js.flow +1 -1
- package/dnd-list/index.d.ts +22 -35
- package/drawer/index.d.ts +22 -27
- package/es/app-nav-bar/app-nav-bar.js +9 -19
- package/es/app-nav-bar/styled-components.js +32 -13
- package/es/badge/badge.js +70 -0
- package/es/badge/constants.js +42 -0
- package/es/badge/hint-dot.js +55 -0
- package/es/badge/index.js +11 -0
- package/es/badge/notification-circle.js +65 -0
- package/es/badge/styled-components.js +296 -0
- package/es/badge/types.js +8 -0
- package/es/badge/utils.js +17 -0
- package/es/banner/banner.js +213 -0
- package/es/banner/constants.js +24 -0
- package/es/banner/index.js +9 -0
- package/es/banner/styled-components.js +122 -0
- package/es/banner/types.js +8 -0
- package/es/breadcrumbs/breadcrumbs.js +5 -1
- package/es/button/button.js +1 -0
- package/es/datepicker/calendar.js +15 -10
- package/es/datepicker/datepicker.js +52 -52
- 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/utils/date-helpers.js +1 -1
- package/es/helper/helper-steps.js +3 -1
- package/es/input/base-input.js +18 -11
- package/es/input/input.js +15 -10
- package/es/input/masked-input.js +5 -2
- package/es/input/utils.js +4 -2
- package/es/locale/tr_TR.js +115 -0
- package/es/notification/notification.js +16 -1
- package/es/payment-card/custom-cards.config.js +22 -0
- package/es/payment-card/icons/uatp.js +52 -0
- package/es/payment-card/payment-card.js +8 -3
- package/es/popover/popover.js +2 -1
- package/es/popover/stateful-container.js +2 -0
- package/es/popover/styled-components.js +2 -1
- package/es/progress-steps/numbered-step.js +2 -2
- package/es/select/select-component.js +48 -23
- package/es/select/utils/default-filter-options.js +1 -1
- package/es/snackbar/snackbar-context.js +1 -1
- package/es/table-semantic/styled-components.js +14 -0
- package/es/table-semantic/table-builder.js +12 -5
- package/es/textarea/textarea.js +15 -9
- package/es/themes/dark-theme/color-component-tokens.js +8 -0
- package/es/themes/light-theme/color-component-tokens.js +8 -0
- package/es/tree-view/tree-label.js +9 -1
- package/esm/app-nav-bar/app-nav-bar.js +32 -38
- package/esm/app-nav-bar/styled-components.js +46 -28
- package/esm/badge/badge.js +97 -0
- package/esm/badge/constants.js +42 -0
- package/esm/badge/hint-dot.js +83 -0
- package/esm/badge/index.js +11 -0
- package/esm/badge/notification-circle.js +91 -0
- package/esm/badge/styled-components.js +235 -0
- package/esm/badge/types.js +8 -0
- package/esm/badge/utils.js +17 -0
- package/esm/banner/banner.js +271 -0
- package/esm/banner/constants.js +24 -0
- package/esm/banner/index.js +9 -0
- package/esm/banner/styled-components.js +113 -0
- package/esm/banner/types.js +8 -0
- package/esm/breadcrumbs/breadcrumbs.js +5 -1
- package/esm/button/button.js +2 -1
- package/esm/datepicker/calendar.js +16 -11
- package/esm/datepicker/datepicker.js +58 -58
- 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/utils/date-helpers.js +1 -1
- package/esm/helper/helper-steps.js +3 -1
- package/esm/input/base-input.js +18 -11
- package/esm/input/input.js +15 -10
- package/esm/input/masked-input.js +6 -3
- package/esm/input/utils.js +4 -2
- package/esm/locale/tr_TR.js +115 -0
- package/esm/notification/notification.js +17 -1
- package/esm/payment-card/custom-cards.config.js +22 -0
- package/esm/payment-card/icons/uatp.js +53 -0
- package/esm/payment-card/payment-card.js +9 -7
- package/esm/popover/popover.js +2 -1
- package/esm/popover/stateful-container.js +2 -0
- package/esm/popover/styled-components.js +3 -2
- package/esm/progress-steps/numbered-step.js +2 -2
- package/esm/select/select-component.js +85 -59
- package/esm/select/utils/default-filter-options.js +1 -1
- package/esm/snackbar/snackbar-context.js +1 -1
- package/esm/table-semantic/styled-components.js +31 -18
- package/esm/table-semantic/table-builder.js +34 -23
- package/esm/textarea/textarea.js +15 -9
- package/esm/themes/dark-theme/color-component-tokens.js +8 -0
- package/esm/themes/light-theme/color-component-tokens.js +8 -0
- package/esm/tree-view/tree-label.js +10 -2
- package/file-uploader/index.d.ts +11 -11
- package/flex-grid/index.d.ts +3 -3
- package/form-control/index.d.ts +7 -19
- package/header-navigation/index.d.ts +8 -9
- package/heading/index.d.ts +3 -4
- package/helper/helper-steps.js +19 -13
- package/helper/helper-steps.js.flow +3 -1
- package/helper/index.d.ts +7 -7
- package/helpers/base-provider.d.ts +16 -0
- package/helpers/overrides.d.ts +23 -0
- package/icon/index.d.ts +32 -32
- package/index.d.ts +34 -114
- package/input/base-input.js +18 -11
- package/input/base-input.js.flow +18 -6
- package/input/index.d.ts +29 -32
- package/input/input.js +15 -10
- package/input/input.js.flow +10 -5
- package/input/masked-input.js +6 -3
- package/input/masked-input.js.flow +3 -0
- package/input/types.js.flow +4 -0
- package/input/utils.js +4 -2
- package/input/utils.js.flow +2 -1
- package/layer/index.d.ts +6 -11
- package/layout-grid/index.d.ts +25 -7
- package/link/index.d.ts +2 -2
- package/list/index.d.ts +26 -31
- package/{locale.ts → locale/index.d.ts} +8 -0
- package/locale/tr_TR.js +123 -0
- package/locale/tr_TR.js.flow +124 -0
- package/map-marker/index.d.ts +41 -47
- package/menu/index.d.ts +27 -37
- package/modal/index.d.ts +28 -38
- package/notification/index.d.ts +2 -3
- package/notification/notification.js +18 -1
- package/notification/notification.js.flow +15 -1
- package/overrides.ts +2 -22
- package/package.json +26 -17
- package/pagination/index.d.ts +22 -26
- package/payment-card/custom-cards.config.js +30 -0
- package/payment-card/custom-cards.config.js.flow +29 -0
- package/payment-card/icons/uatp.js +67 -0
- package/payment-card/icons/uatp.js.flow +62 -0
- package/payment-card/index.d.ts +8 -8
- package/payment-card/payment-card.js +12 -7
- package/payment-card/payment-card.js.flow +12 -0
- package/phone-input/index.d.ts +261 -269
- package/pin-code/index.d.ts +11 -18
- package/popover/index.d.ts +39 -55
- package/popover/popover.js +2 -1
- package/popover/popover.js.flow +2 -1
- package/popover/stateful-container.js +2 -0
- package/popover/stateful-container.js.flow +2 -0
- package/popover/styled-components.js +3 -2
- package/popover/styled-components.js.flow +2 -1
- package/popover/types.js.flow +1 -0
- package/progress-bar/index.d.ts +11 -12
- package/progress-steps/index.d.ts +16 -16
- package/progress-steps/numbered-step.js.flow +2 -2
- package/radio/index.d.ts +12 -15
- package/rating/index.d.ts +9 -12
- package/select/index.d.ts +34 -36
- package/select/select-component.js +82 -56
- package/select/select-component.js.flow +46 -34
- package/select/types.js.flow +1 -0
- package/select/utils/default-filter-options.js +1 -1
- package/select/utils/default-filter-options.js.flow +1 -1
- package/side-navigation/index.d.ts +11 -13
- package/skeleton/index.d.ts +1 -1
- package/slider/index.d.ts +17 -26
- package/snackbar/index.d.ts +8 -8
- package/snackbar/snackbar-context.js +1 -1
- package/snackbar/snackbar-context.js.flow +1 -1
- package/spinner/index.d.ts +4 -3
- package/styles/index.d.ts +82 -2
- package/table/index.d.ts +16 -16
- package/table-grid/index.d.ts +6 -8
- package/table-semantic/index.d.ts +26 -32
- package/table-semantic/styled-components.js +33 -19
- package/table-semantic/styled-components.js.flow +12 -0
- package/table-semantic/table-builder.js +38 -22
- package/table-semantic/table-builder.js.flow +32 -17
- package/table-semantic/types.js.flow +1 -0
- package/tabs/index.d.ts +20 -23
- package/tabs-motion/index.d.ts +23 -23
- package/tag/index.d.ts +14 -18
- package/tag/types.js.flow +1 -1
- package/textarea/index.d.ts +11 -14
- package/textarea/textarea.js +15 -9
- package/textarea/textarea.js.flow +11 -5
- package/textarea/types.js.flow +1 -0
- package/theme.ts +36 -777
- package/themes/dark-theme/color-component-tokens.js +8 -0
- package/themes/dark-theme/color-component-tokens.js.flow +9 -0
- package/themes/index.d.ts +765 -0
- package/themes/light-theme/color-component-tokens.js +8 -0
- package/themes/light-theme/color-component-tokens.js.flow +9 -0
- package/themes/types.js.flow +9 -0
- package/timepicker/index.d.ts +5 -8
- package/timezonepicker/index.d.ts +5 -8
- package/toast/index.d.ts +26 -40
- package/tokens/index.d.ts +1 -1
- package/tooltip/index.d.ts +7 -9
- package/tree-view/index.d.ts +15 -19
- package/tree-view/tree-label.js +10 -2
- package/tree-view/tree-label.js.flow +4 -4
- package/typography/index.d.ts +37 -37
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (c) Uber Technologies, Inc.
|
|
3
|
+
|
|
4
|
+
This source code is licensed under the MIT license found in the
|
|
5
|
+
LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
export { Banner } from './banner.js';
|
|
8
|
+
export * from './constants.js';
|
|
9
|
+
export * from './styled-components.js';
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (c) Uber Technologies, Inc.
|
|
3
|
+
|
|
4
|
+
This source code is licensed under the MIT license found in the
|
|
5
|
+
LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import { styled } from '../styles/index.js';
|
|
8
|
+
import { ACTION_POSITION } from './constants.js';
|
|
9
|
+
export const StyledRoot = styled('div', ({
|
|
10
|
+
$theme,
|
|
11
|
+
$backgroundColor,
|
|
12
|
+
$color,
|
|
13
|
+
$nested
|
|
14
|
+
}) => {
|
|
15
|
+
const radius = $nested ? $theme.borders.radius300 : $theme.borders.radius400;
|
|
16
|
+
return {
|
|
17
|
+
backgroundColor: $backgroundColor,
|
|
18
|
+
borderStartStartRadius: radius,
|
|
19
|
+
borderStartEndRadius: radius,
|
|
20
|
+
borderEndStartRadius: radius,
|
|
21
|
+
borderEndEndRadius: radius,
|
|
22
|
+
color: $color,
|
|
23
|
+
display: 'grid',
|
|
24
|
+
gridColumnGap: $theme.sizing.scale600,
|
|
25
|
+
gridTemplateColumns: 'min-content auto min-content',
|
|
26
|
+
gridTemplateRows: 'auto min-content',
|
|
27
|
+
margin: $theme.sizing.scale600
|
|
28
|
+
};
|
|
29
|
+
});
|
|
30
|
+
StyledRoot.displayName = "StyledRoot";
|
|
31
|
+
export const StyledLeadingContent = styled('div', ({
|
|
32
|
+
$theme,
|
|
33
|
+
$includesArtwork
|
|
34
|
+
}) => {
|
|
35
|
+
return {
|
|
36
|
+
alignItems: 'center',
|
|
37
|
+
display: 'flex',
|
|
38
|
+
paddingInlineStart: $includesArtwork ? $theme.sizing.scale600 : null
|
|
39
|
+
};
|
|
40
|
+
});
|
|
41
|
+
StyledLeadingContent.displayName = "StyledLeadingContent";
|
|
42
|
+
export const StyledMessageContent = styled('div', ({
|
|
43
|
+
$theme,
|
|
44
|
+
$actionPosition
|
|
45
|
+
}) => {
|
|
46
|
+
return {
|
|
47
|
+
display: 'flex',
|
|
48
|
+
flexDirection: 'column',
|
|
49
|
+
justifyContent: 'center',
|
|
50
|
+
paddingBlockStart: $theme.sizing.scale600,
|
|
51
|
+
paddingBlockEnd: $actionPosition === ACTION_POSITION.trailing ? $theme.sizing.scale600 : null
|
|
52
|
+
};
|
|
53
|
+
});
|
|
54
|
+
StyledMessageContent.displayName = "StyledMessageContent";
|
|
55
|
+
export const StyledTrailingContent = styled('div', ({
|
|
56
|
+
$theme
|
|
57
|
+
}) => {
|
|
58
|
+
return {
|
|
59
|
+
display: 'flex',
|
|
60
|
+
gridRowEnd: 'span 2',
|
|
61
|
+
marginInlineStart: 'auto'
|
|
62
|
+
};
|
|
63
|
+
});
|
|
64
|
+
StyledTrailingContent.displayName = "StyledTrailingContent";
|
|
65
|
+
export const StyledBelowContent = styled('div', ({
|
|
66
|
+
$theme,
|
|
67
|
+
$actionPosition
|
|
68
|
+
}) => {
|
|
69
|
+
return {
|
|
70
|
+
gridColumnStart: 2,
|
|
71
|
+
paddingBlockStart: $actionPosition === ACTION_POSITION.below ? $theme.sizing.scale300 : null,
|
|
72
|
+
paddingBlockEnd: $actionPosition === ACTION_POSITION.below ? $theme.sizing.scale600 : null
|
|
73
|
+
};
|
|
74
|
+
});
|
|
75
|
+
StyledBelowContent.displayName = "StyledBelowContent";
|
|
76
|
+
export const StyledTitle = styled('div', ({
|
|
77
|
+
$theme
|
|
78
|
+
}) => {
|
|
79
|
+
return $theme.typography.LabelMedium;
|
|
80
|
+
});
|
|
81
|
+
StyledTitle.displayName = "StyledTitle";
|
|
82
|
+
export const StyledMessage = styled('div', ({
|
|
83
|
+
$theme
|
|
84
|
+
}) => {
|
|
85
|
+
return $theme.typography.ParagraphMedium;
|
|
86
|
+
});
|
|
87
|
+
StyledMessage.displayName = "StyledMessage";
|
|
88
|
+
export const StyledTrailingButtonContainer = styled('div', ({
|
|
89
|
+
$theme
|
|
90
|
+
}) => {
|
|
91
|
+
return {
|
|
92
|
+
display: 'flex',
|
|
93
|
+
alignItems: 'center',
|
|
94
|
+
paddingInlineEnd: $theme.sizing.scale600
|
|
95
|
+
};
|
|
96
|
+
});
|
|
97
|
+
StyledTrailingButtonContainer.displayName = "StyledTrailingButtonContainer";
|
|
98
|
+
export const StyledTrailingIconButton = styled('button', ({
|
|
99
|
+
$theme,
|
|
100
|
+
$nested
|
|
101
|
+
}) => {
|
|
102
|
+
const radius = $nested ? $theme.borders.radius300 : $theme.borders.radius400;
|
|
103
|
+
return {
|
|
104
|
+
alignItems: 'center',
|
|
105
|
+
background: 'none',
|
|
106
|
+
border: 'none',
|
|
107
|
+
borderStartEndRadius: radius,
|
|
108
|
+
borderEndEndRadius: radius,
|
|
109
|
+
color: 'inherit',
|
|
110
|
+
cursor: 'pointer',
|
|
111
|
+
display: 'flex',
|
|
112
|
+
paddingInlineStart: $theme.sizing.scale600,
|
|
113
|
+
paddingInlineEnd: $theme.sizing.scale600,
|
|
114
|
+
':hover': {
|
|
115
|
+
boxShadow: 'inset 999px 999px 0px rgba(0, 0, 0, 0.04)'
|
|
116
|
+
},
|
|
117
|
+
':active': {
|
|
118
|
+
boxShadow: 'inset 999px 999px 0px rgba(0, 0, 0, 0.08)'
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
});
|
|
122
|
+
StyledTrailingIconButton.displayName = "StyledTrailingIconButton";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (c) Uber Technologies, Inc.
|
|
3
|
+
|
|
4
|
+
This source code is licensed under the MIT license found in the
|
|
5
|
+
LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import * as React from 'react';
|
|
8
|
+
import { ACTION_POSITION, ARTWORK_TYPE, HIERARCHY, KIND } from './constants.js';
|
|
@@ -39,7 +39,11 @@ export function Breadcrumbs(props) {
|
|
|
39
39
|
$itemIndex: index
|
|
40
40
|
}, baseListItemProps), child, (showTrailingSeparator || index !== childrenArray.length - 1) && /*#__PURE__*/React.createElement(Separator, _extends({}, baseSeparatorProps, {
|
|
41
41
|
key: `separator-${index}`
|
|
42
|
-
}), /*#__PURE__*/React.createElement(ThemeContext.Consumer, null, theme => theme.direction === 'rtl' ? /*#__PURE__*/React.createElement(Left,
|
|
42
|
+
}), /*#__PURE__*/React.createElement(ThemeContext.Consumer, null, theme => theme.direction === 'rtl' ? /*#__PURE__*/React.createElement(Left, _extends({
|
|
43
|
+
size: 16
|
|
44
|
+
}, baseIconProps)) : /*#__PURE__*/React.createElement(Right, _extends({
|
|
45
|
+
size: 16
|
|
46
|
+
}, baseIconProps))))));
|
|
43
47
|
});
|
|
44
48
|
return /*#__PURE__*/React.createElement(LocaleContext.Consumer, null, locale => /*#__PURE__*/React.createElement(Root, _extends({
|
|
45
49
|
"aria-label": props['aria-label'] || props.ariaLabel || locale.breadcrumbs.ariaLabel,
|
package/es/button/button.js
CHANGED
|
@@ -252,11 +252,11 @@ export default class Calendar extends React.Component {
|
|
|
252
252
|
const {
|
|
253
253
|
onChange = params => {}
|
|
254
254
|
} = this.props;
|
|
255
|
-
let updatedDate = data.date; //
|
|
256
|
-
|
|
257
|
-
const newTimeState = [...this.state.time]; // Apply the currently selected time values (saved in state) to the updated date
|
|
255
|
+
let updatedDate = data.date; // Apply the currently selected time values (saved in state) to the updated date
|
|
258
256
|
|
|
259
257
|
if (Array.isArray(data.date)) {
|
|
258
|
+
// We'll need to update the date in time values of internal state
|
|
259
|
+
const newTimeState = [...this.state.time];
|
|
260
260
|
const start = data.date[0] ? this.dateHelpers.applyDateToTime(newTimeState[0], data.date[0]) : null;
|
|
261
261
|
const end = data.date[1] ? this.dateHelpers.applyDateToTime(newTimeState[1], data.date[1]) : null;
|
|
262
262
|
newTimeState[0] = start;
|
|
@@ -266,16 +266,21 @@ export default class Calendar extends React.Component {
|
|
|
266
266
|
newTimeState[1] = end;
|
|
267
267
|
} else {
|
|
268
268
|
updatedDate = [start];
|
|
269
|
-
}
|
|
269
|
+
} // Update the date in time values of internal state
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
this.setState({
|
|
273
|
+
time: newTimeState
|
|
274
|
+
});
|
|
270
275
|
} else if (!Array.isArray(this.props.value) && data.date) {
|
|
271
|
-
newTimeState
|
|
272
|
-
updatedDate = newTimeState
|
|
273
|
-
} // Update the date in time values of internal state
|
|
276
|
+
const newTimeState = this.dateHelpers.applyDateToTime(this.state.time[0], data.date);
|
|
277
|
+
updatedDate = newTimeState; // Update the date in time values of internal state
|
|
274
278
|
|
|
279
|
+
this.setState({
|
|
280
|
+
time: [newTimeState]
|
|
281
|
+
});
|
|
282
|
+
}
|
|
275
283
|
|
|
276
|
-
this.setState({
|
|
277
|
-
time: newTimeState
|
|
278
|
-
});
|
|
279
284
|
onChange({
|
|
280
285
|
date: updatedDate
|
|
281
286
|
});
|
|
@@ -45,7 +45,39 @@ export default class Datepicker extends React.Component {
|
|
|
45
45
|
|
|
46
46
|
_defineProperty(this, "dateHelpers", void 0);
|
|
47
47
|
|
|
48
|
-
_defineProperty(this, "
|
|
48
|
+
_defineProperty(this, "handleChange", date => {
|
|
49
|
+
const onChange = this.props.onChange;
|
|
50
|
+
const onRangeChange = this.props.onRangeChange;
|
|
51
|
+
|
|
52
|
+
if (Array.isArray(date)) {
|
|
53
|
+
if (onChange && date.every(Boolean)) {
|
|
54
|
+
// flowlint-next-line unclear-type:off
|
|
55
|
+
onChange({
|
|
56
|
+
date: date
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (onRangeChange) {
|
|
61
|
+
onRangeChange({
|
|
62
|
+
date: [...date]
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
} else {
|
|
66
|
+
if (onChange) {
|
|
67
|
+
onChange({
|
|
68
|
+
date
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (onRangeChange) {
|
|
73
|
+
onRangeChange({
|
|
74
|
+
date
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
_defineProperty(this, "onCalendarSelect", data => {
|
|
49
81
|
let isOpen = false;
|
|
50
82
|
let isPseudoFocused = false;
|
|
51
83
|
let calendarFocused = false;
|
|
@@ -114,9 +146,7 @@ export default class Datepicker extends React.Component {
|
|
|
114
146
|
}),
|
|
115
147
|
inputValue: this.formatDisplayValue(nextDate)
|
|
116
148
|
});
|
|
117
|
-
this.
|
|
118
|
-
date: nextDate
|
|
119
|
-
});
|
|
149
|
+
this.handleChange(nextDate);
|
|
120
150
|
});
|
|
121
151
|
|
|
122
152
|
_defineProperty(this, "formatDisplayValue", date => {
|
|
@@ -218,16 +248,10 @@ export default class Datepicker extends React.Component {
|
|
|
218
248
|
const formatString = this.normalizeDashes(this.props.formatString);
|
|
219
249
|
|
|
220
250
|
if (typeof mask === 'string' && inputValue === mask.replace(/9/g, ' ') || inputValue.length === 0) {
|
|
221
|
-
if (this.props.
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
});
|
|
226
|
-
} else {
|
|
227
|
-
this.props.onChange({
|
|
228
|
-
date: null
|
|
229
|
-
});
|
|
230
|
-
}
|
|
251
|
+
if (this.props.range) {
|
|
252
|
+
this.handleChange([]);
|
|
253
|
+
} else {
|
|
254
|
+
this.handleChange(null);
|
|
231
255
|
}
|
|
232
256
|
}
|
|
233
257
|
|
|
@@ -253,18 +277,12 @@ export default class Datepicker extends React.Component {
|
|
|
253
277
|
endDate = parseDateString(right);
|
|
254
278
|
}
|
|
255
279
|
|
|
256
|
-
const
|
|
280
|
+
const datesValid = this.dateHelpers.isValid(startDate) && this.dateHelpers.isValid(endDate); // added equal case so that times within the same day can be expressed
|
|
257
281
|
|
|
258
|
-
|
|
259
|
-
const datesValid = this.dateHelpers.isValid(startDate) && this.dateHelpers.isValid(endDate); // added equal case so that times within the same day can be expressed
|
|
260
|
-
|
|
261
|
-
const rangeValid = this.dateHelpers.isAfter(endDate, startDate) || this.dateHelpers.isEqual(startDate, endDate);
|
|
282
|
+
const rangeValid = this.dateHelpers.isAfter(endDate, startDate) || this.dateHelpers.isEqual(startDate, endDate);
|
|
262
283
|
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
date: [startDate, endDate]
|
|
266
|
-
});
|
|
267
|
-
}
|
|
284
|
+
if (datesValid && rangeValid) {
|
|
285
|
+
this.handleChange([startDate, endDate]);
|
|
268
286
|
}
|
|
269
287
|
} else {
|
|
270
288
|
const dateString = this.normalizeDashes(inputValue);
|
|
@@ -280,12 +298,11 @@ export default class Datepicker extends React.Component {
|
|
|
280
298
|
|
|
281
299
|
const {
|
|
282
300
|
displayValueAtRangeIndex,
|
|
283
|
-
onChange,
|
|
284
301
|
range,
|
|
285
302
|
value
|
|
286
303
|
} = this.props;
|
|
287
304
|
|
|
288
|
-
if (date && this.dateHelpers.isValid(date)
|
|
305
|
+
if (date && this.dateHelpers.isValid(date)) {
|
|
289
306
|
if (range && Array.isArray(value) && typeof displayValueAtRangeIndex === 'number') {
|
|
290
307
|
let [left, right] = value;
|
|
291
308
|
|
|
@@ -293,22 +310,16 @@ export default class Datepicker extends React.Component {
|
|
|
293
310
|
left = date;
|
|
294
311
|
|
|
295
312
|
if (!right) {
|
|
296
|
-
|
|
297
|
-
date: [left]
|
|
298
|
-
});
|
|
313
|
+
this.handleChange([left]);
|
|
299
314
|
} else {
|
|
300
315
|
if (this.dateHelpers.isAfter(right, left) || this.dateHelpers.isEqual(left, right)) {
|
|
301
|
-
|
|
302
|
-
date: [left, right]
|
|
303
|
-
});
|
|
316
|
+
this.handleChange([left, right]);
|
|
304
317
|
} else {
|
|
305
318
|
// Is resetting back to previous value appropriate? Invalid range is not
|
|
306
319
|
// communicated to the user, but if it was not reset the text value would
|
|
307
320
|
// show one value and date value another. This seems a bit better but clearly
|
|
308
321
|
// has a downside.
|
|
309
|
-
|
|
310
|
-
date: [...value]
|
|
311
|
-
});
|
|
322
|
+
this.handleChange([...value]);
|
|
312
323
|
}
|
|
313
324
|
}
|
|
314
325
|
} else if (displayValueAtRangeIndex === 1) {
|
|
@@ -316,26 +327,18 @@ export default class Datepicker extends React.Component {
|
|
|
316
327
|
|
|
317
328
|
if (!left) {
|
|
318
329
|
// If start value is not defined, set start/end to the same day.
|
|
319
|
-
|
|
320
|
-
date: [right, right]
|
|
321
|
-
});
|
|
330
|
+
this.handleChange([right, right]);
|
|
322
331
|
} else {
|
|
323
332
|
if (this.dateHelpers.isAfter(right, left) || this.dateHelpers.isEqual(left, right)) {
|
|
324
|
-
|
|
325
|
-
date: [left, right]
|
|
326
|
-
});
|
|
333
|
+
this.handleChange([left, right]);
|
|
327
334
|
} else {
|
|
328
335
|
// See comment above about resetting dates on invalid range
|
|
329
|
-
|
|
330
|
-
date: [...value]
|
|
331
|
-
});
|
|
336
|
+
this.handleChange([...value]);
|
|
332
337
|
}
|
|
333
338
|
}
|
|
334
339
|
}
|
|
335
340
|
} else {
|
|
336
|
-
|
|
337
|
-
date
|
|
338
|
-
});
|
|
341
|
+
this.handleChange(date);
|
|
339
342
|
}
|
|
340
343
|
}
|
|
341
344
|
}
|
|
@@ -427,9 +430,6 @@ export default class Datepicker extends React.Component {
|
|
|
427
430
|
const placeholder = this.props.placeholder || this.props.placeholder === '' ? this.props.placeholder : this.props.range && !this.props.separateRangeInputs ? `YYYY/MM/DD ${INPUT_DELIMITER} YYYY/MM/DD` : 'YYYY/MM/DD';
|
|
428
431
|
const [startDate = '', endDate = ''] = (this.state.inputValue || '').split(` ${INPUT_DELIMITER} `);
|
|
429
432
|
const value = inputRole === INPUT_ROLE.startDate ? startDate : inputRole === INPUT_ROLE.endDate ? endDate : this.state.inputValue;
|
|
430
|
-
|
|
431
|
-
const onChange = event => this.handleInputChange(event, inputRole);
|
|
432
|
-
|
|
433
433
|
return /*#__PURE__*/React.createElement(InputComponent, _extends({
|
|
434
434
|
"aria-disabled": this.props.disabled,
|
|
435
435
|
"aria-label": this.props['aria-label'] || (this.props.range ? locale.datepicker.ariaLabelRange : locale.datepicker.ariaLabel),
|
|
@@ -444,7 +444,7 @@ export default class Datepicker extends React.Component {
|
|
|
444
444
|
onFocus: () => this.open(inputRole),
|
|
445
445
|
onBlur: this.handleInputBlur,
|
|
446
446
|
onKeyDown: this.handleKeyDown,
|
|
447
|
-
onChange:
|
|
447
|
+
onChange: event => this.handleInputChange(event, inputRole),
|
|
448
448
|
placeholder: placeholder,
|
|
449
449
|
mask: this.getMask(),
|
|
450
450
|
required: this.props.required,
|
|
@@ -477,7 +477,7 @@ export default class Datepicker extends React.Component {
|
|
|
477
477
|
trapTabbing: true,
|
|
478
478
|
value: this.props.value
|
|
479
479
|
}, this.props, {
|
|
480
|
-
onChange: this.
|
|
480
|
+
onChange: this.onCalendarSelect,
|
|
481
481
|
selectedInput: this.state.selectedInput,
|
|
482
482
|
hasLockedBehavior: this.hasLockedBehavior()
|
|
483
483
|
}))
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
|
|
1
3
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
4
|
|
|
3
5
|
/*
|
|
@@ -12,7 +14,10 @@ import Calendar from './calendar.js';
|
|
|
12
14
|
|
|
13
15
|
class StatefulComponent extends React.Component {
|
|
14
16
|
render() {
|
|
15
|
-
return /*#__PURE__*/React.createElement(StatefulContainer, this.props, extendedProps => /*#__PURE__*/React.createElement(Calendar, extendedProps
|
|
17
|
+
return /*#__PURE__*/React.createElement(StatefulContainer, this.props, extendedProps => /*#__PURE__*/React.createElement(Calendar, _extends({}, extendedProps, {
|
|
18
|
+
// flowlint-next-line unclear-type:off
|
|
19
|
+
onChange: extendedProps.onChange
|
|
20
|
+
})));
|
|
16
21
|
}
|
|
17
22
|
|
|
18
23
|
}
|
|
@@ -20,9 +20,29 @@ class StatefulContainer extends React.Component {
|
|
|
20
20
|
this.internalSetState(STATE_CHANGE_TYPE.change, {
|
|
21
21
|
value: date
|
|
22
22
|
});
|
|
23
|
+
const onChange = this.props.onChange;
|
|
23
24
|
|
|
24
|
-
if (
|
|
25
|
-
|
|
25
|
+
if (onChange) {
|
|
26
|
+
if (Array.isArray(date)) {
|
|
27
|
+
if (date.every(Boolean)) {
|
|
28
|
+
// flowlint-next-line unclear-type:off
|
|
29
|
+
onChange({
|
|
30
|
+
date: date
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
} else {
|
|
34
|
+
onChange({
|
|
35
|
+
date
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const onRangeChange = this.props.onRangeChange;
|
|
41
|
+
|
|
42
|
+
if (onRangeChange) {
|
|
43
|
+
onRangeChange({
|
|
44
|
+
date
|
|
45
|
+
});
|
|
26
46
|
}
|
|
27
47
|
});
|
|
28
48
|
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
|
|
1
3
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
4
|
|
|
3
5
|
/*
|
|
@@ -12,7 +14,10 @@ import Datepicker from './datepicker.js';
|
|
|
12
14
|
|
|
13
15
|
class StatefulComponent extends React.Component {
|
|
14
16
|
render() {
|
|
15
|
-
return /*#__PURE__*/React.createElement(StatefulContainer, this.props, extendedProps => /*#__PURE__*/React.createElement(Datepicker, extendedProps
|
|
17
|
+
return /*#__PURE__*/React.createElement(StatefulContainer, this.props, extendedProps => /*#__PURE__*/React.createElement(Datepicker, _extends({}, extendedProps, {
|
|
18
|
+
// flowlint-next-line unclear-type:off
|
|
19
|
+
onChange: extendedProps.onChange
|
|
20
|
+
})));
|
|
16
21
|
}
|
|
17
22
|
|
|
18
23
|
}
|
|
@@ -63,7 +63,7 @@ class DateHelpers {
|
|
|
63
63
|
const UtilsClass = adapter.constructor;
|
|
64
64
|
const className = adapter.constructor.name; // This ensures that if the adapter class isn't
|
|
65
65
|
// supported it just falls back the default formats
|
|
66
|
-
// NOTE: in e2e tests
|
|
66
|
+
// NOTE: in e2e tests playwright seems to add
|
|
67
67
|
// a JSHandle wrapping class to all objects
|
|
68
68
|
// so className always resolves to JSHandle:e
|
|
69
69
|
// and if falls back to the default
|
|
@@ -5,7 +5,9 @@ This source code is licensed under the MIT license found in the
|
|
|
5
5
|
LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import * as React from 'react';
|
|
8
|
-
import
|
|
8
|
+
import ArrowLeft from '../icon/arrow-left.js';
|
|
9
|
+
import ArrowRight from '../icon/arrow-right.js';
|
|
10
|
+
import Check from '../icon/check.js';
|
|
9
11
|
import { Button, KIND, SHAPE } from '../button/index.js';
|
|
10
12
|
import { useStyletron } from '../styles/index.js';
|
|
11
13
|
export function HelperSteps({
|
package/es/input/base-input.js
CHANGED
|
@@ -37,7 +37,7 @@ class BaseInput extends React.Component {
|
|
|
37
37
|
});
|
|
38
38
|
|
|
39
39
|
_defineProperty(this, "onInputKeyDown", e => {
|
|
40
|
-
if (this.props.clearOnEscape && e.key === 'Escape' && this.inputRef.current) {
|
|
40
|
+
if (this.props.clearOnEscape && e.key === 'Escape' && this.inputRef.current && !this.props.readOnly) {
|
|
41
41
|
this.clearValue(); // prevent event from closing modal or doing something unexpected
|
|
42
42
|
|
|
43
43
|
e.stopPropagation();
|
|
@@ -51,17 +51,21 @@ class BaseInput extends React.Component {
|
|
|
51
51
|
});
|
|
52
52
|
|
|
53
53
|
_defineProperty(this, "onFocus", e => {
|
|
54
|
-
this.
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
54
|
+
if (!this.props.readOnly) {
|
|
55
|
+
this.setState({
|
|
56
|
+
isFocused: true
|
|
57
|
+
});
|
|
58
|
+
this.props.onFocus(e);
|
|
59
|
+
}
|
|
58
60
|
});
|
|
59
61
|
|
|
60
62
|
_defineProperty(this, "onBlur", e => {
|
|
61
|
-
this.
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
if (!this.props.readOnly) {
|
|
64
|
+
this.setState({
|
|
65
|
+
isFocused: false
|
|
66
|
+
});
|
|
67
|
+
this.props.onBlur(e);
|
|
68
|
+
}
|
|
65
69
|
});
|
|
66
70
|
|
|
67
71
|
_defineProperty(this, "handleFocusForMaskToggle", event => {
|
|
@@ -192,10 +196,11 @@ class BaseInput extends React.Component {
|
|
|
192
196
|
clearable,
|
|
193
197
|
value,
|
|
194
198
|
disabled,
|
|
199
|
+
readOnly,
|
|
195
200
|
overrides = {}
|
|
196
201
|
} = this.props;
|
|
197
202
|
|
|
198
|
-
if (disabled || !clearable || value == null || typeof value === 'string' && value.length === 0) {
|
|
203
|
+
if (disabled || readOnly || !clearable || value == null || typeof value === 'string' && value.length === 0) {
|
|
199
204
|
return null;
|
|
200
205
|
}
|
|
201
206
|
|
|
@@ -265,6 +270,7 @@ class BaseInput extends React.Component {
|
|
|
265
270
|
"aria-required": this.props.required,
|
|
266
271
|
autoComplete: autoComplete,
|
|
267
272
|
disabled: this.props.disabled,
|
|
273
|
+
readOnly: this.props.readOnly,
|
|
268
274
|
id: this.props.id,
|
|
269
275
|
inputMode: this.props.inputMode,
|
|
270
276
|
maxLength: this.props.maxLength,
|
|
@@ -322,7 +328,8 @@ _defineProperty(BaseInput, "defaultProps", {
|
|
|
322
328
|
required: false,
|
|
323
329
|
role: null,
|
|
324
330
|
size: SIZE.default,
|
|
325
|
-
type: 'text'
|
|
331
|
+
type: 'text',
|
|
332
|
+
readOnly: false
|
|
326
333
|
});
|
|
327
334
|
|
|
328
335
|
export default BaseInput;
|
package/es/input/input.js
CHANGED
|
@@ -20,21 +20,25 @@ class Input extends React.Component {
|
|
|
20
20
|
super(...args);
|
|
21
21
|
|
|
22
22
|
_defineProperty(this, "state", {
|
|
23
|
-
isFocused: this.props.autoFocus || false
|
|
23
|
+
isFocused: this.props.autoFocus && !this.props.readOnly || false
|
|
24
24
|
});
|
|
25
25
|
|
|
26
26
|
_defineProperty(this, "onFocus", e => {
|
|
27
|
-
this.
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
if (!this.props.readOnly) {
|
|
28
|
+
this.setState({
|
|
29
|
+
isFocused: true
|
|
30
|
+
});
|
|
31
|
+
this.props.onFocus(e);
|
|
32
|
+
}
|
|
31
33
|
});
|
|
32
34
|
|
|
33
35
|
_defineProperty(this, "onBlur", e => {
|
|
34
|
-
this.
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
if (!this.props.readOnly) {
|
|
37
|
+
this.setState({
|
|
38
|
+
isFocused: false
|
|
39
|
+
});
|
|
40
|
+
this.props.onBlur(e);
|
|
41
|
+
}
|
|
38
42
|
});
|
|
39
43
|
}
|
|
40
44
|
|
|
@@ -94,7 +98,8 @@ _defineProperty(Input, "defaultProps", {
|
|
|
94
98
|
startEnhancer: null,
|
|
95
99
|
endEnhancer: null,
|
|
96
100
|
clearable: false,
|
|
97
|
-
type: 'text'
|
|
101
|
+
type: 'text',
|
|
102
|
+
readOnly: false
|
|
98
103
|
});
|
|
99
104
|
|
|
100
105
|
function getAdjoinedProp(startEnhancer, endEnhancer) {
|
package/es/input/masked-input.js
CHANGED
|
@@ -23,6 +23,7 @@ const MaskOverride = /*#__PURE__*/React.forwardRef(({
|
|
|
23
23
|
onBlur,
|
|
24
24
|
value,
|
|
25
25
|
disabled,
|
|
26
|
+
readOnly,
|
|
26
27
|
...restProps
|
|
27
28
|
}, ref) => {
|
|
28
29
|
return /*#__PURE__*/React.createElement(InputMask, _extends({
|
|
@@ -30,14 +31,16 @@ const MaskOverride = /*#__PURE__*/React.forwardRef(({
|
|
|
30
31
|
onFocus: onFocus,
|
|
31
32
|
onBlur: onBlur,
|
|
32
33
|
value: value,
|
|
33
|
-
disabled: disabled
|
|
34
|
+
disabled: disabled,
|
|
35
|
+
readOnly: readOnly
|
|
34
36
|
}, restProps), props => /*#__PURE__*/React.createElement(StyledInput, _extends({
|
|
35
37
|
ref: ref,
|
|
36
38
|
onChange: onChange,
|
|
37
39
|
onFocus: onFocus,
|
|
38
40
|
onBlur: onBlur,
|
|
39
41
|
value: value,
|
|
40
|
-
disabled: disabled
|
|
42
|
+
disabled: disabled,
|
|
43
|
+
readOnly: readOnly
|
|
41
44
|
}, props)));
|
|
42
45
|
});
|
|
43
46
|
MaskOverride.displayName = 'MaskOverride';
|
package/es/input/utils.js
CHANGED
|
@@ -11,7 +11,8 @@ export function getSharedProps(props, state) {
|
|
|
11
11
|
positive,
|
|
12
12
|
adjoined,
|
|
13
13
|
size,
|
|
14
|
-
required
|
|
14
|
+
required,
|
|
15
|
+
readOnly
|
|
15
16
|
} = props;
|
|
16
17
|
const {
|
|
17
18
|
isFocused
|
|
@@ -23,6 +24,7 @@ export function getSharedProps(props, state) {
|
|
|
23
24
|
$positive: positive,
|
|
24
25
|
$adjoined: adjoined,
|
|
25
26
|
$size: size,
|
|
26
|
-
$required: required
|
|
27
|
+
$required: required,
|
|
28
|
+
$isReadOnly: readOnly
|
|
27
29
|
};
|
|
28
30
|
}
|