baseui 10.12.0 → 11.0.1
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 +15 -7
- package/datepicker/calendar.js.flow +23 -9
- package/datepicker/constants.js +12 -2
- package/datepicker/constants.js.flow +10 -0
- package/datepicker/datepicker.js +61 -30
- package/datepicker/datepicker.js.flow +77 -37
- 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-container.js.flow +2 -1
- package/datepicker/styled-components.js +23 -1
- package/datepicker/styled-components.js.flow +12 -2
- package/datepicker/types.js.flow +35 -10
- 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 +15 -7
- package/es/datepicker/constants.js +8 -0
- package/es/datepicker/datepicker.js +56 -29
- package/es/datepicker/day.js +77 -34
- package/es/datepicker/month.js +3 -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/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 +15 -7
- package/esm/datepicker/constants.js +8 -0
- package/esm/datepicker/datepicker.js +60 -30
- package/esm/datepicker/day.js +84 -34
- package/esm/datepicker/month.js +3 -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/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/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/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
|
@@ -6,21 +6,19 @@ LICENSE file in the root directory of this source tree.
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
// @flow
|
|
9
|
-
import { styled
|
|
10
|
-
import { STYLE_TYPE } from './constants.js';
|
|
9
|
+
import { styled } from '../styles/index.js';
|
|
11
10
|
|
|
12
11
|
import type { SharedStylePropsT } from './types.js';
|
|
13
12
|
|
|
14
13
|
function getBorderColor(props) {
|
|
15
|
-
const { $disabled, $checked, $
|
|
16
|
-
props;
|
|
14
|
+
const { $disabled, $checked, $error, $isIndeterminate, $theme, $isFocusVisible } = props;
|
|
17
15
|
const { colors } = $theme;
|
|
18
16
|
if ($disabled) {
|
|
19
17
|
return colors.tickFillDisabled;
|
|
20
18
|
} else if ($checked || $isIndeterminate) {
|
|
21
19
|
return 'transparent';
|
|
22
|
-
} else if ($error
|
|
23
|
-
return colors.
|
|
20
|
+
} else if ($error) {
|
|
21
|
+
return colors.borderNegative;
|
|
24
22
|
} else if ($isFocusVisible) {
|
|
25
23
|
return colors.borderSelected;
|
|
26
24
|
} else {
|
|
@@ -62,29 +60,15 @@ function getLabelPadding(props) {
|
|
|
62
60
|
}
|
|
63
61
|
|
|
64
62
|
function getBackgroundColor(props) {
|
|
65
|
-
const {
|
|
66
|
-
$disabled,
|
|
67
|
-
$checked,
|
|
68
|
-
$isIndeterminate,
|
|
69
|
-
$isError,
|
|
70
|
-
$error,
|
|
71
|
-
$isHovered,
|
|
72
|
-
$isActive,
|
|
73
|
-
$theme,
|
|
74
|
-
$checkmarkType,
|
|
75
|
-
} = props;
|
|
76
|
-
const isToggle = $checkmarkType === STYLE_TYPE.toggle;
|
|
63
|
+
const { $disabled, $checked, $isIndeterminate, $error, $isHovered, $isActive, $theme } = props;
|
|
77
64
|
const { colors } = $theme;
|
|
78
65
|
if ($disabled) {
|
|
79
|
-
if (isToggle) {
|
|
80
|
-
return colors.toggleFillDisabled;
|
|
81
|
-
}
|
|
82
66
|
if ($checked || $isIndeterminate) {
|
|
83
67
|
return colors.tickFillDisabled;
|
|
84
68
|
} else {
|
|
85
69
|
return colors.tickFill;
|
|
86
70
|
}
|
|
87
|
-
} else if (
|
|
71
|
+
} else if ($error && ($isIndeterminate || $checked)) {
|
|
88
72
|
if ($isActive) {
|
|
89
73
|
return colors.tickFillErrorSelectedHoverActive;
|
|
90
74
|
} else if ($isHovered) {
|
|
@@ -92,7 +76,7 @@ function getBackgroundColor(props) {
|
|
|
92
76
|
} else {
|
|
93
77
|
return colors.tickFillErrorSelected;
|
|
94
78
|
}
|
|
95
|
-
} else if ($error
|
|
79
|
+
} else if ($error) {
|
|
96
80
|
if ($isActive) {
|
|
97
81
|
return colors.tickFillErrorHoverActive;
|
|
98
82
|
} else if ($isHovered) {
|
|
@@ -110,11 +94,11 @@ function getBackgroundColor(props) {
|
|
|
110
94
|
}
|
|
111
95
|
} else {
|
|
112
96
|
if ($isActive) {
|
|
113
|
-
return
|
|
97
|
+
return colors.tickFillActive;
|
|
114
98
|
} else if ($isHovered) {
|
|
115
|
-
return
|
|
99
|
+
return colors.tickFillHover;
|
|
116
100
|
} else {
|
|
117
|
-
return
|
|
101
|
+
return colors.tickFill;
|
|
118
102
|
}
|
|
119
103
|
}
|
|
120
104
|
}
|
|
@@ -137,13 +121,12 @@ export const Root = styled<SharedStylePropsT>('label', (props) => {
|
|
|
137
121
|
});
|
|
138
122
|
|
|
139
123
|
export const Checkmark = styled<SharedStylePropsT>('span', (props) => {
|
|
140
|
-
const { $checked, $disabled, $
|
|
141
|
-
props;
|
|
124
|
+
const { $checked, $disabled, $error, $isIndeterminate, $theme, $isFocusVisible } = props;
|
|
142
125
|
const { sizing, animation } = $theme;
|
|
143
126
|
|
|
144
127
|
const tickColor = $disabled
|
|
145
128
|
? $theme.colors.tickMarkFillDisabled
|
|
146
|
-
: $
|
|
129
|
+
: $error
|
|
147
130
|
? $theme.colors.tickMarkFillError
|
|
148
131
|
: $theme.colors.tickMarkFill;
|
|
149
132
|
|
|
@@ -208,10 +191,9 @@ export const Checkmark = styled<SharedStylePropsT>('span', (props) => {
|
|
|
208
191
|
});
|
|
209
192
|
|
|
210
193
|
export const Label = styled<SharedStylePropsT>('div', (props) => {
|
|
211
|
-
const { $theme
|
|
194
|
+
const { $theme } = props;
|
|
212
195
|
const { typography } = $theme;
|
|
213
196
|
return ({
|
|
214
|
-
flex: $checkmarkType === STYLE_TYPE.toggle ? 'auto' : null,
|
|
215
197
|
verticalAlign: 'middle',
|
|
216
198
|
...getLabelPadding(props),
|
|
217
199
|
color: getLabelColor(props),
|
|
@@ -232,146 +214,58 @@ export const Input = styled('input', {
|
|
|
232
214
|
});
|
|
233
215
|
|
|
234
216
|
export const Toggle = styled<SharedStylePropsT>('div', (props) => {
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
backgroundColor: props.$theme.colors.mono100,
|
|
243
|
-
borderTopLeftRadius: borderRadius,
|
|
244
|
-
borderTopRightRadius: borderRadius,
|
|
245
|
-
borderBottomRightRadius: borderRadius,
|
|
246
|
-
borderBottomLeftRadius: borderRadius,
|
|
247
|
-
boxShadow: props.$isFocusVisible
|
|
248
|
-
? `0 0 0 3px ${props.$theme.colors.accent}`
|
|
249
|
-
: props.$theme.lighting.shadow400,
|
|
250
|
-
outline: 'none',
|
|
251
|
-
display: 'flex',
|
|
252
|
-
justifyContent: 'center',
|
|
253
|
-
height: props.$theme.sizing.scale800,
|
|
254
|
-
width: props.$theme.sizing.scale800,
|
|
255
|
-
}: {});
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
if (props.$checkmarkType === STYLE_TYPE.toggle_round) {
|
|
259
|
-
let backgroundColor = props.$theme.colors.toggleFill;
|
|
260
|
-
if (props.$disabled) {
|
|
261
|
-
backgroundColor = props.$theme.colors.toggleFillDisabled;
|
|
262
|
-
} else if (props.$checked && (props.$error || props.$isError)) {
|
|
263
|
-
backgroundColor = props.$theme.colors.borderError;
|
|
264
|
-
} else if (props.$checked) {
|
|
265
|
-
backgroundColor = props.$theme.colors.toggleFillChecked;
|
|
266
|
-
}
|
|
267
|
-
return {
|
|
268
|
-
backgroundColor,
|
|
269
|
-
borderTopLeftRadius: '50%',
|
|
270
|
-
borderTopRightRadius: '50%',
|
|
271
|
-
borderBottomRightRadius: '50%',
|
|
272
|
-
borderBottomLeftRadius: '50%',
|
|
273
|
-
boxShadow: props.$isFocusVisible
|
|
274
|
-
? `0 0 0 3px ${props.$theme.colors.accent}`
|
|
275
|
-
: props.$isHovered && !props.$disabled
|
|
276
|
-
? props.$theme.lighting.shadow500
|
|
277
|
-
: props.$theme.lighting.shadow400,
|
|
278
|
-
outline: 'none',
|
|
279
|
-
height: props.$theme.sizing.scale700,
|
|
280
|
-
width: props.$theme.sizing.scale700,
|
|
281
|
-
transform: props.$checked
|
|
282
|
-
? `translateX(${props.$theme.direction === 'rtl' ? '-100%' : '100%'})`
|
|
283
|
-
: null,
|
|
284
|
-
transition: `transform ${props.$theme.animation.timing200}`,
|
|
285
|
-
};
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
return {};
|
|
289
|
-
});
|
|
290
|
-
|
|
291
|
-
export const ToggleInner = styled<SharedStylePropsT>('div', (props) => {
|
|
292
|
-
if (props.$checkmarkType === STYLE_TYPE.toggle) {
|
|
293
|
-
// eslint-disable-next-line no-inner-declarations
|
|
294
|
-
const backgroundColor = () => {
|
|
295
|
-
if (props.$disabled) {
|
|
296
|
-
return props.$theme.colors.sliderHandleInnerFillDisabled;
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
if (props.$isActive && props.$checked) {
|
|
300
|
-
return props.$theme.colors.sliderHandleInnerFillSelectedActive;
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
if (props.$isHovered && props.$checked) {
|
|
304
|
-
return props.$theme.colors.sliderHandleInnerFillSelectedHover;
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
return props.$theme.colors.toggleTrackFill;
|
|
308
|
-
};
|
|
309
|
-
return {
|
|
310
|
-
height: props.$theme.sizing.scale300,
|
|
311
|
-
width: props.$theme.sizing.scale0,
|
|
312
|
-
borderTopLeftRadius: props.$theme.borders.radius100,
|
|
313
|
-
borderTopRightRadius: props.$theme.borders.radius100,
|
|
314
|
-
borderBottomRightRadius: props.$theme.borders.radius100,
|
|
315
|
-
borderBottomLeftRadius: props.$theme.borders.radius100,
|
|
316
|
-
backgroundColor: backgroundColor(),
|
|
317
|
-
};
|
|
217
|
+
let backgroundColor = props.$theme.colors.toggleFill;
|
|
218
|
+
if (props.$disabled) {
|
|
219
|
+
backgroundColor = props.$theme.colors.toggleFillDisabled;
|
|
220
|
+
} else if (props.$checked && props.$error) {
|
|
221
|
+
backgroundColor = props.$theme.colors.tickFillErrorSelected;
|
|
222
|
+
} else if (props.$checked) {
|
|
223
|
+
backgroundColor = props.$theme.colors.toggleFillChecked;
|
|
318
224
|
}
|
|
319
225
|
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
226
|
+
return {
|
|
227
|
+
backgroundColor,
|
|
228
|
+
borderTopLeftRadius: '50%',
|
|
229
|
+
borderTopRightRadius: '50%',
|
|
230
|
+
borderBottomRightRadius: '50%',
|
|
231
|
+
borderBottomLeftRadius: '50%',
|
|
232
|
+
boxShadow: props.$isFocusVisible
|
|
233
|
+
? `0 0 0 3px ${props.$theme.colors.accent}`
|
|
234
|
+
: props.$isHovered && !props.$disabled
|
|
235
|
+
? props.$theme.lighting.shadow500
|
|
236
|
+
: props.$theme.lighting.shadow400,
|
|
237
|
+
outline: 'none',
|
|
238
|
+
height: props.$theme.sizing.scale700,
|
|
239
|
+
width: props.$theme.sizing.scale700,
|
|
240
|
+
transform: props.$checked
|
|
241
|
+
? `translateX(${props.$theme.direction === 'rtl' ? '-100%' : '100%'})`
|
|
242
|
+
: null,
|
|
243
|
+
transition: `transform ${props.$theme.animation.timing200}`,
|
|
244
|
+
};
|
|
325
245
|
});
|
|
326
246
|
|
|
327
247
|
export const ToggleTrack = styled<SharedStylePropsT>('div', (props) => {
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
alignItems: 'center',
|
|
334
|
-
backgroundColor: getBackgroundColor(props),
|
|
335
|
-
borderTopLeftRadius: borderRadius,
|
|
336
|
-
borderTopRightRadius: borderRadius,
|
|
337
|
-
borderBottomRightRadius: borderRadius,
|
|
338
|
-
borderBottomLeftRadius: borderRadius,
|
|
339
|
-
display: 'flex',
|
|
340
|
-
height: props.$theme.sizing.scale600,
|
|
341
|
-
justifyContent: props.$checked ? 'flex-end' : 'flex-start',
|
|
342
|
-
marginTop: props.$theme.sizing.scale100,
|
|
343
|
-
marginBottom: props.$theme.sizing.scale100,
|
|
344
|
-
marginLeft: props.$theme.sizing.scale100,
|
|
345
|
-
marginRight: props.$theme.sizing.scale100,
|
|
346
|
-
width: props.$theme.sizing.scale1000,
|
|
347
|
-
}: {});
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
if (props.$checkmarkType === STYLE_TYPE.toggle_round) {
|
|
351
|
-
let backgroundColor = props.$theme.colors.toggleTrackFill;
|
|
352
|
-
if (props.$disabled) {
|
|
353
|
-
backgroundColor = props.$theme.colors.toggleTrackFillDisabled;
|
|
354
|
-
} else if ((props.$error || props.$isError) && props.$checked) {
|
|
355
|
-
backgroundColor = props.$theme.colors.tickFillError;
|
|
356
|
-
}
|
|
357
|
-
return {
|
|
358
|
-
alignItems: 'center',
|
|
359
|
-
backgroundColor,
|
|
360
|
-
borderTopLeftRadius: '7px',
|
|
361
|
-
borderTopRightRadius: '7px',
|
|
362
|
-
borderBottomRightRadius: '7px',
|
|
363
|
-
borderBottomLeftRadius: '7px',
|
|
364
|
-
display: 'flex',
|
|
365
|
-
height: props.$theme.sizing.scale550,
|
|
366
|
-
marginTop: props.$theme.sizing.scale200,
|
|
367
|
-
marginBottom: props.$theme.sizing.scale100,
|
|
368
|
-
marginLeft: props.$theme.sizing.scale200,
|
|
369
|
-
marginRight: props.$theme.sizing.scale100,
|
|
370
|
-
width: props.$theme.sizing.scale1000,
|
|
371
|
-
};
|
|
248
|
+
let backgroundColor = props.$theme.colors.toggleTrackFill;
|
|
249
|
+
if (props.$disabled) {
|
|
250
|
+
backgroundColor = props.$theme.colors.toggleTrackFillDisabled;
|
|
251
|
+
} else if (props.$error && props.$checked) {
|
|
252
|
+
backgroundColor = props.$theme.colors.tickFillError;
|
|
372
253
|
}
|
|
373
|
-
|
|
374
|
-
|
|
254
|
+
return {
|
|
255
|
+
alignItems: 'center',
|
|
256
|
+
backgroundColor,
|
|
257
|
+
borderTopLeftRadius: '7px',
|
|
258
|
+
borderTopRightRadius: '7px',
|
|
259
|
+
borderBottomRightRadius: '7px',
|
|
260
|
+
borderBottomLeftRadius: '7px',
|
|
261
|
+
display: 'flex',
|
|
262
|
+
height: props.$theme.sizing.scale550,
|
|
263
|
+
marginTop: props.$theme.sizing.scale200,
|
|
264
|
+
marginBottom: props.$theme.sizing.scale100,
|
|
265
|
+
marginLeft: props.$theme.sizing.scale200,
|
|
266
|
+
marginRight: props.$theme.sizing.scale100,
|
|
267
|
+
width: props.$theme.sizing.scale1000,
|
|
268
|
+
};
|
|
375
269
|
});
|
|
376
270
|
|
|
377
271
|
declare var __DEV__: boolean;
|
package/checkbox/types.js.flow
CHANGED
|
@@ -27,7 +27,6 @@ export type DefaultPropsT = {
|
|
|
27
27
|
children?: React$Node,
|
|
28
28
|
checked: boolean,
|
|
29
29
|
disabled: boolean,
|
|
30
|
-
isError: boolean,
|
|
31
30
|
error: boolean,
|
|
32
31
|
autoFocus: boolean,
|
|
33
32
|
isIndeterminate: boolean,
|
|
@@ -63,8 +62,6 @@ export type PropsT = {
|
|
|
63
62
|
required?: boolean,
|
|
64
63
|
/** Renders checkbox in errored state. */
|
|
65
64
|
error?: boolean,
|
|
66
|
-
/** You should use error instead. */
|
|
67
|
-
isError?: boolean,
|
|
68
65
|
/** Used to get a ref to the input element. Useful for programmatically focusing the input */
|
|
69
66
|
inputRef: ReactRefT<HTMLInputElement>,
|
|
70
67
|
/** Focus the checkbox on initial render. */
|
|
@@ -195,14 +192,12 @@ export type SharedStylePropsT = {
|
|
|
195
192
|
$isFocusVisible: boolean,
|
|
196
193
|
$isHovered: boolean,
|
|
197
194
|
$isActive: boolean,
|
|
198
|
-
$isError: boolean,
|
|
199
195
|
$error: boolean,
|
|
200
196
|
$checked: boolean,
|
|
201
197
|
$isIndeterminate: boolean,
|
|
202
198
|
$required: boolean,
|
|
203
199
|
$disabled: boolean,
|
|
204
200
|
$value: string,
|
|
205
|
-
$checkmarkType: StyleTypeT,
|
|
206
201
|
$labelPlacement: LabelPlacementT,
|
|
207
202
|
};
|
|
208
203
|
|
|
@@ -79,7 +79,7 @@ function FilterQuickControls(props) {
|
|
|
79
79
|
var locale = React.useContext(_index7.LocaleContext);
|
|
80
80
|
return /*#__PURE__*/React.createElement(_index2.ButtonGroup, {
|
|
81
81
|
size: _index.SIZE.mini,
|
|
82
|
-
kind: _index.KIND.
|
|
82
|
+
kind: _index.KIND.tertiary
|
|
83
83
|
}, /*#__PURE__*/React.createElement(_index.Button, {
|
|
84
84
|
type: "button",
|
|
85
85
|
onClick: props.onSelectAll
|
|
@@ -54,7 +54,7 @@ function FilterQuickControls(props: { onSelectAll: () => void, onClearSelection:
|
|
|
54
54
|
const locale = React.useContext(LocaleContext);
|
|
55
55
|
|
|
56
56
|
return (
|
|
57
|
-
<ButtonGroup size={SIZE.mini} kind={KIND.
|
|
57
|
+
<ButtonGroup size={SIZE.mini} kind={KIND.tertiary}>
|
|
58
58
|
<Button type="button" onClick={props.onSelectAll}>
|
|
59
59
|
{locale.datatable.categoricalFilterSelectAll}
|
|
60
60
|
</Button>
|
|
@@ -456,7 +456,7 @@ function DatetimeFilter(props) {
|
|
|
456
456
|
if (Array.isArray(date)) {
|
|
457
457
|
if (!date.length) return;
|
|
458
458
|
var nextDates = date.map(function (d, i) {
|
|
459
|
-
return (0, _index13.applyDateToTime)(rangeDates[i], d);
|
|
459
|
+
return d ? (0, _index13.applyDateToTime)(rangeDates[i], d) : null;
|
|
460
460
|
});
|
|
461
461
|
setRangeDates(nextDates);
|
|
462
462
|
}
|
|
@@ -382,7 +382,9 @@ function DatetimeFilter(props) {
|
|
|
382
382
|
onChange={({ date }) => {
|
|
383
383
|
if (Array.isArray(date)) {
|
|
384
384
|
if (!date.length) return;
|
|
385
|
-
const nextDates = date.map((d, i) =>
|
|
385
|
+
const nextDates = date.map((d, i) =>
|
|
386
|
+
d ? applyDateToTime(rangeDates[i], d) : null
|
|
387
|
+
);
|
|
386
388
|
setRangeDates(nextDates);
|
|
387
389
|
}
|
|
388
390
|
}}
|
package/data-table/column.js
CHANGED
|
@@ -84,7 +84,11 @@ function Column(options) {
|
|
|
84
84
|
display: 'flex',
|
|
85
85
|
height: '100%'
|
|
86
86
|
})
|
|
87
|
-
}, Boolean(props.onSelect) && /*#__PURE__*/React.createElement(
|
|
87
|
+
}, Boolean(props.onSelect) && /*#__PURE__*/React.createElement("span", {
|
|
88
|
+
className: css({
|
|
89
|
+
paddingRight: theme.sizing.scale300
|
|
90
|
+
})
|
|
91
|
+
}, /*#__PURE__*/React.createElement(_index.Checkbox, {
|
|
88
92
|
onChange: props.onSelect,
|
|
89
93
|
checked: props.isSelected,
|
|
90
94
|
overrides: {
|
|
@@ -95,7 +99,7 @@ function Column(options) {
|
|
|
95
99
|
}
|
|
96
100
|
}
|
|
97
101
|
}
|
|
98
|
-
}), /*#__PURE__*/React.createElement(ProvidedCell, props)));
|
|
102
|
+
})), /*#__PURE__*/React.createElement(ProvidedCell, props)));
|
|
99
103
|
}),
|
|
100
104
|
renderFilter: options.renderFilter || function () {
|
|
101
105
|
return null;
|
|
@@ -62,13 +62,15 @@ function Column<ValueT, FilterParamsT>(
|
|
|
62
62
|
})}
|
|
63
63
|
>
|
|
64
64
|
{Boolean(props.onSelect) && (
|
|
65
|
-
<
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
65
|
+
<span className={css({ paddingRight: theme.sizing.scale300 })}>
|
|
66
|
+
<Checkbox
|
|
67
|
+
onChange={props.onSelect}
|
|
68
|
+
checked={props.isSelected}
|
|
69
|
+
overrides={{
|
|
70
|
+
Checkmark: { style: { marginTop: null, marginBottom: null } },
|
|
71
|
+
}}
|
|
72
|
+
/>
|
|
73
|
+
</span>
|
|
72
74
|
)}
|
|
73
75
|
<ProvidedCell {...props} />
|
|
74
76
|
</div>
|
package/data-table/data-table.js
CHANGED
|
@@ -485,7 +485,7 @@ var InnerTableElement = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
485
485
|
});
|
|
486
486
|
},
|
|
487
487
|
size: _index.SIZE.compact,
|
|
488
|
-
kind: _index.KIND.
|
|
488
|
+
kind: _index.KIND.tertiary,
|
|
489
489
|
shape: _index.SHAPE.round,
|
|
490
490
|
overrides: {
|
|
491
491
|
BaseButton: {
|
|
@@ -555,7 +555,8 @@ function DataTable(_ref2) {
|
|
|
555
555
|
sortIndex = _ref2.sortIndex,
|
|
556
556
|
sortDirection = _ref2.sortDirection,
|
|
557
557
|
_ref2$textQuery = _ref2.textQuery,
|
|
558
|
-
textQuery = _ref2$textQuery === void 0 ? '' : _ref2$textQuery
|
|
558
|
+
textQuery = _ref2$textQuery === void 0 ? '' : _ref2$textQuery,
|
|
559
|
+
controlRef = _ref2.controlRef;
|
|
559
560
|
|
|
560
561
|
var _useStyletron13 = (0, _index2.useStyletron)(),
|
|
561
562
|
_useStyletron14 = _slicedToArray(_useStyletron13, 2),
|
|
@@ -754,6 +755,13 @@ function DataTable(_ref2) {
|
|
|
754
755
|
|
|
755
756
|
return result;
|
|
756
757
|
}, [sortedIndices, filteredIndices, onIncludedRowsChange, allRows]);
|
|
758
|
+
React.useImperativeHandle(controlRef, function () {
|
|
759
|
+
return {
|
|
760
|
+
getRows: function getRows() {
|
|
761
|
+
return rows;
|
|
762
|
+
}
|
|
763
|
+
};
|
|
764
|
+
}, [rows]);
|
|
757
765
|
|
|
758
766
|
var _React$useState19 = React.useState(0),
|
|
759
767
|
_React$useState20 = _slicedToArray(_React$useState19, 2),
|
|
@@ -587,7 +587,7 @@ const InnerTableElement = React.forwardRef<
|
|
|
587
587
|
})
|
|
588
588
|
}
|
|
589
589
|
size={BUTTON_SIZES.compact}
|
|
590
|
-
kind={BUTTON_KINDS.
|
|
590
|
+
kind={BUTTON_KINDS.tertiary}
|
|
591
591
|
shape={BUTTON_SHAPES.round}
|
|
592
592
|
overrides={{
|
|
593
593
|
BaseButton: {
|
|
@@ -658,6 +658,7 @@ export function DataTable({
|
|
|
658
658
|
sortIndex,
|
|
659
659
|
sortDirection,
|
|
660
660
|
textQuery = '',
|
|
661
|
+
controlRef,
|
|
661
662
|
}: DataTablePropsT) {
|
|
662
663
|
const [, theme] = useStyletron();
|
|
663
664
|
const locale = React.useContext(LocaleContext);
|
|
@@ -809,6 +810,8 @@ export function DataTable({
|
|
|
809
810
|
return result;
|
|
810
811
|
}, [sortedIndices, filteredIndices, onIncludedRowsChange, allRows]);
|
|
811
812
|
|
|
813
|
+
React.useImperativeHandle(controlRef, () => ({ getRows: () => rows }), [rows]);
|
|
814
|
+
|
|
812
815
|
const [browserScrollbarWidth, setBrowserScrollbarWidth] = React.useState(0);
|
|
813
816
|
const normalizedWidths = React.useMemo(() => {
|
|
814
817
|
const resizedWidths = measuredWidths.map((w, i) => Math.floor(w) + Math.floor(resizeDeltas[i]));
|
|
@@ -111,6 +111,9 @@ var HeaderCell = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
111
111
|
onFocus: handleFocus,
|
|
112
112
|
onBlur: handleBlur
|
|
113
113
|
}, props.isSelectable && /*#__PURE__*/React.createElement("span", {
|
|
114
|
+
className: css({
|
|
115
|
+
paddingRight: theme.sizing.scale300
|
|
116
|
+
}),
|
|
114
117
|
ref: checkboxRef
|
|
115
118
|
}, /*#__PURE__*/React.createElement(_index.Checkbox, {
|
|
116
119
|
onChange: function onChange(e) {
|
|
@@ -97,7 +97,7 @@ const HeaderCell = React.forwardRef<HeaderCellPropsT, HTMLDivElement>((props, re
|
|
|
97
97
|
onBlur={handleBlur}
|
|
98
98
|
>
|
|
99
99
|
{props.isSelectable && (
|
|
100
|
-
<span ref={checkboxRef}>
|
|
100
|
+
<span className={css({ paddingRight: theme.sizing.scale300 })} ref={checkboxRef}>
|
|
101
101
|
<Checkbox
|
|
102
102
|
onChange={(e) => {
|
|
103
103
|
if (props.isSelectedAll || props.isSelectedIndeterminate) {
|
package/data-table/index.d.ts
CHANGED
|
@@ -34,10 +34,7 @@ export interface SORT_DIRECTIONS {
|
|
|
34
34
|
}
|
|
35
35
|
export const SORT_DIRECTIONS: SORT_DIRECTIONS;
|
|
36
36
|
|
|
37
|
-
export type SortDirectionsT =
|
|
38
|
-
| SORT_DIRECTIONS['ASC']
|
|
39
|
-
| SORT_DIRECTIONS['DESC']
|
|
40
|
-
| null;
|
|
37
|
+
export type SortDirectionsT = SORT_DIRECTIONS['ASC'] | SORT_DIRECTIONS['DESC'] | null;
|
|
41
38
|
export type ColumnT = any;
|
|
42
39
|
export type RowT = {
|
|
43
40
|
id: number | string;
|
|
@@ -54,12 +51,13 @@ export type BatchActionT = {
|
|
|
54
51
|
renderIcon?: any;
|
|
55
52
|
};
|
|
56
53
|
|
|
54
|
+
export interface ImperativeMethods {
|
|
55
|
+
getRows: () => RowT[];
|
|
56
|
+
}
|
|
57
|
+
|
|
57
58
|
export type RowActionT = {
|
|
58
59
|
label: string;
|
|
59
|
-
onClick: (params: {
|
|
60
|
-
event: React.MouseEvent<HTMLButtonElement>;
|
|
61
|
-
row: RowT;
|
|
62
|
-
}) => any;
|
|
60
|
+
onClick: (params: { event: React.MouseEvent<HTMLButtonElement>; row: RowT }) => any;
|
|
63
61
|
renderIcon: any;
|
|
64
62
|
};
|
|
65
63
|
|
|
@@ -69,4 +67,5 @@ export type Props = {
|
|
|
69
67
|
columns: ColumnT[];
|
|
70
68
|
onSelectionChange?: (rows: RowT[]) => any;
|
|
71
69
|
rows: RowT[];
|
|
70
|
+
controlRef?: React.Ref<ImperativeMethods>;
|
|
72
71
|
};
|
package/data-table/types.js.flow
CHANGED
|
@@ -87,6 +87,13 @@ export type RowActionT = {|
|
|
|
87
87
|
renderButton?: React.AbstractComponent<{||}>,
|
|
88
88
|
|};
|
|
89
89
|
|
|
90
|
+
type ImperativeMethodsT = {|
|
|
91
|
+
getRows: () => RowT[],
|
|
92
|
+
|};
|
|
93
|
+
export type ControlRefT = {
|
|
94
|
+
current: ImperativeMethodsT | null,
|
|
95
|
+
};
|
|
96
|
+
|
|
90
97
|
export type StatefulDataTablePropsT = {|
|
|
91
98
|
batchActions?: BatchActionT[],
|
|
92
99
|
columns: ColumnT<>[],
|
|
@@ -109,6 +116,7 @@ export type StatefulDataTablePropsT = {|
|
|
|
109
116
|
rowHeight?: number,
|
|
110
117
|
rowHighlightIndex?: number,
|
|
111
118
|
searchable?: boolean,
|
|
119
|
+
controlRef?: ControlRefT,
|
|
112
120
|
|};
|
|
113
121
|
|
|
114
122
|
export type DataTablePropsT = {|
|
package/datepicker/calendar.js
CHANGED
|
@@ -339,10 +339,16 @@ var Calendar = /*#__PURE__*/function (_React$Component) {
|
|
|
339
339
|
|
|
340
340
|
|
|
341
341
|
if (Array.isArray(data.date)) {
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
342
|
+
var start = data.date[0] ? _this.dateHelpers.applyDateToTime(newTimeState[0], data.date[0]) : null;
|
|
343
|
+
var end = data.date[1] ? _this.dateHelpers.applyDateToTime(newTimeState[1], data.date[1]) : null;
|
|
344
|
+
newTimeState[0] = start;
|
|
345
|
+
|
|
346
|
+
if (end) {
|
|
347
|
+
updatedDate = [start, end];
|
|
348
|
+
newTimeState[1] = end;
|
|
349
|
+
} else {
|
|
350
|
+
updatedDate = [start];
|
|
351
|
+
}
|
|
346
352
|
} else if (!Array.isArray(_this.props.value) && data.date) {
|
|
347
353
|
newTimeState[0] = _this.dateHelpers.applyDateToTime(newTimeState[0], data.date);
|
|
348
354
|
updatedDate = newTimeState[0];
|
|
@@ -374,7 +380,7 @@ var Calendar = /*#__PURE__*/function (_React$Component) {
|
|
|
374
380
|
|
|
375
381
|
if (Array.isArray(_this.props.value)) {
|
|
376
382
|
var dates = _this.props.value.map(function (date, i) {
|
|
377
|
-
if (index === i) {
|
|
383
|
+
if (date && index === i) {
|
|
378
384
|
return _this.dateHelpers.applyTimeToDate(date, time);
|
|
379
385
|
}
|
|
380
386
|
|
|
@@ -382,7 +388,7 @@ var Calendar = /*#__PURE__*/function (_React$Component) {
|
|
|
382
388
|
});
|
|
383
389
|
|
|
384
390
|
onChange({
|
|
385
|
-
date: dates
|
|
391
|
+
date: [dates[0], dates[1]]
|
|
386
392
|
});
|
|
387
393
|
} else {
|
|
388
394
|
var date = _this.dateHelpers.applyTimeToDate(_this.props.value, time);
|
|
@@ -452,7 +458,9 @@ var Calendar = /*#__PURE__*/function (_React$Component) {
|
|
|
452
458
|
overrides: overrides,
|
|
453
459
|
value: _this.props.value,
|
|
454
460
|
peekNextMonth: _this.props.peekNextMonth,
|
|
455
|
-
fixedHeight: _this.props.fixedHeight
|
|
461
|
+
fixedHeight: _this.props.fixedHeight,
|
|
462
|
+
hasLockedBehavior: !!_this.props.hasLockedBehavior,
|
|
463
|
+
selectedInput: _this.props.selectedInput
|
|
456
464
|
})));
|
|
457
465
|
monthList.push( /*#__PURE__*/React.createElement("div", {
|
|
458
466
|
key: "month-component-".concat(i)
|