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/es/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
|
|
@@ -4,14 +4,12 @@ Copyright (c) Uber Technologies, Inc.
|
|
|
4
4
|
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
|
-
import { styled
|
|
8
|
-
import { STYLE_TYPE } from './constants.js';
|
|
7
|
+
import { styled } from '../styles/index.js';
|
|
9
8
|
|
|
10
9
|
function getBorderColor(props) {
|
|
11
10
|
const {
|
|
12
11
|
$disabled,
|
|
13
12
|
$checked,
|
|
14
|
-
$isError,
|
|
15
13
|
$error,
|
|
16
14
|
$isIndeterminate,
|
|
17
15
|
$theme,
|
|
@@ -25,8 +23,8 @@ function getBorderColor(props) {
|
|
|
25
23
|
return colors.tickFillDisabled;
|
|
26
24
|
} else if ($checked || $isIndeterminate) {
|
|
27
25
|
return 'transparent';
|
|
28
|
-
} else if ($error
|
|
29
|
-
return colors.
|
|
26
|
+
} else if ($error) {
|
|
27
|
+
return colors.borderNegative;
|
|
30
28
|
} else if ($isFocusVisible) {
|
|
31
29
|
return colors.borderSelected;
|
|
32
30
|
} else {
|
|
@@ -82,29 +80,22 @@ function getBackgroundColor(props) {
|
|
|
82
80
|
$disabled,
|
|
83
81
|
$checked,
|
|
84
82
|
$isIndeterminate,
|
|
85
|
-
$isError,
|
|
86
83
|
$error,
|
|
87
84
|
$isHovered,
|
|
88
85
|
$isActive,
|
|
89
|
-
$theme
|
|
90
|
-
$checkmarkType
|
|
86
|
+
$theme
|
|
91
87
|
} = props;
|
|
92
|
-
const isToggle = $checkmarkType === STYLE_TYPE.toggle;
|
|
93
88
|
const {
|
|
94
89
|
colors
|
|
95
90
|
} = $theme;
|
|
96
91
|
|
|
97
92
|
if ($disabled) {
|
|
98
|
-
if (isToggle) {
|
|
99
|
-
return colors.toggleFillDisabled;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
93
|
if ($checked || $isIndeterminate) {
|
|
103
94
|
return colors.tickFillDisabled;
|
|
104
95
|
} else {
|
|
105
96
|
return colors.tickFill;
|
|
106
97
|
}
|
|
107
|
-
} else if (
|
|
98
|
+
} else if ($error && ($isIndeterminate || $checked)) {
|
|
108
99
|
if ($isActive) {
|
|
109
100
|
return colors.tickFillErrorSelectedHoverActive;
|
|
110
101
|
} else if ($isHovered) {
|
|
@@ -112,7 +103,7 @@ function getBackgroundColor(props) {
|
|
|
112
103
|
} else {
|
|
113
104
|
return colors.tickFillErrorSelected;
|
|
114
105
|
}
|
|
115
|
-
} else if ($error
|
|
106
|
+
} else if ($error) {
|
|
116
107
|
if ($isActive) {
|
|
117
108
|
return colors.tickFillErrorHoverActive;
|
|
118
109
|
} else if ($isHovered) {
|
|
@@ -130,11 +121,11 @@ function getBackgroundColor(props) {
|
|
|
130
121
|
}
|
|
131
122
|
} else {
|
|
132
123
|
if ($isActive) {
|
|
133
|
-
return
|
|
124
|
+
return colors.tickFillActive;
|
|
134
125
|
} else if ($isHovered) {
|
|
135
|
-
return
|
|
126
|
+
return colors.tickFillHover;
|
|
136
127
|
} else {
|
|
137
|
-
return
|
|
128
|
+
return colors.tickFill;
|
|
138
129
|
}
|
|
139
130
|
}
|
|
140
131
|
}
|
|
@@ -168,7 +159,6 @@ export const Checkmark = styled('span', props => {
|
|
|
168
159
|
const {
|
|
169
160
|
$checked,
|
|
170
161
|
$disabled,
|
|
171
|
-
$isError,
|
|
172
162
|
$error,
|
|
173
163
|
$isIndeterminate,
|
|
174
164
|
$theme,
|
|
@@ -178,7 +168,7 @@ export const Checkmark = styled('span', props => {
|
|
|
178
168
|
sizing,
|
|
179
169
|
animation
|
|
180
170
|
} = $theme;
|
|
181
|
-
const tickColor = $disabled ? $theme.colors.tickMarkFillDisabled : $
|
|
171
|
+
const tickColor = $disabled ? $theme.colors.tickMarkFillDisabled : $error ? $theme.colors.tickMarkFillError : $theme.colors.tickMarkFill;
|
|
182
172
|
const indeterminate = encodeURIComponent(`
|
|
183
173
|
<svg width="14" height="4" viewBox="0 0 14 4" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
184
174
|
<path d="M14 0.5H0V3.5H14V0.5Z" fill="${tickColor}"/>
|
|
@@ -234,14 +224,12 @@ export const Checkmark = styled('span', props => {
|
|
|
234
224
|
Checkmark.displayName = "Checkmark";
|
|
235
225
|
export const Label = styled('div', props => {
|
|
236
226
|
const {
|
|
237
|
-
$theme
|
|
238
|
-
$checkmarkType
|
|
227
|
+
$theme
|
|
239
228
|
} = props;
|
|
240
229
|
const {
|
|
241
230
|
typography
|
|
242
231
|
} = $theme;
|
|
243
232
|
return {
|
|
244
|
-
flex: $checkmarkType === STYLE_TYPE.toggle ? 'auto' : null,
|
|
245
233
|
verticalAlign: 'middle',
|
|
246
234
|
...getLabelPadding(props),
|
|
247
235
|
color: getLabelColor(props),
|
|
@@ -262,137 +250,54 @@ export const Input = styled('input', {
|
|
|
262
250
|
});
|
|
263
251
|
Input.displayName = "Input";
|
|
264
252
|
export const Toggle = styled('div', props => {
|
|
265
|
-
|
|
266
|
-
const borderRadius = props.$theme.borders.useRoundedCorners ? props.$theme.borders.radius200 : null;
|
|
267
|
-
return { ...expandBorderStyles(props.$theme.borders.border300),
|
|
268
|
-
alignItems: 'center',
|
|
269
|
-
backgroundColor: props.$theme.colors.mono100,
|
|
270
|
-
borderTopLeftRadius: borderRadius,
|
|
271
|
-
borderTopRightRadius: borderRadius,
|
|
272
|
-
borderBottomRightRadius: borderRadius,
|
|
273
|
-
borderBottomLeftRadius: borderRadius,
|
|
274
|
-
boxShadow: props.$isFocusVisible ? `0 0 0 3px ${props.$theme.colors.accent}` : props.$theme.lighting.shadow400,
|
|
275
|
-
outline: 'none',
|
|
276
|
-
display: 'flex',
|
|
277
|
-
justifyContent: 'center',
|
|
278
|
-
height: props.$theme.sizing.scale800,
|
|
279
|
-
width: props.$theme.sizing.scale800
|
|
280
|
-
};
|
|
281
|
-
}
|
|
253
|
+
let backgroundColor = props.$theme.colors.toggleFill;
|
|
282
254
|
|
|
283
|
-
if (props.$
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
backgroundColor = props.$theme.colors.borderError;
|
|
290
|
-
} else if (props.$checked) {
|
|
291
|
-
backgroundColor = props.$theme.colors.toggleFillChecked;
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
return {
|
|
295
|
-
backgroundColor,
|
|
296
|
-
borderTopLeftRadius: '50%',
|
|
297
|
-
borderTopRightRadius: '50%',
|
|
298
|
-
borderBottomRightRadius: '50%',
|
|
299
|
-
borderBottomLeftRadius: '50%',
|
|
300
|
-
boxShadow: props.$isFocusVisible ? `0 0 0 3px ${props.$theme.colors.accent}` : props.$isHovered && !props.$disabled ? props.$theme.lighting.shadow500 : props.$theme.lighting.shadow400,
|
|
301
|
-
outline: 'none',
|
|
302
|
-
height: props.$theme.sizing.scale700,
|
|
303
|
-
width: props.$theme.sizing.scale700,
|
|
304
|
-
transform: props.$checked ? `translateX(${props.$theme.direction === 'rtl' ? '-100%' : '100%'})` : null,
|
|
305
|
-
transition: `transform ${props.$theme.animation.timing200}`
|
|
306
|
-
};
|
|
255
|
+
if (props.$disabled) {
|
|
256
|
+
backgroundColor = props.$theme.colors.toggleFillDisabled;
|
|
257
|
+
} else if (props.$checked && props.$error) {
|
|
258
|
+
backgroundColor = props.$theme.colors.tickFillErrorSelected;
|
|
259
|
+
} else if (props.$checked) {
|
|
260
|
+
backgroundColor = props.$theme.colors.toggleFillChecked;
|
|
307
261
|
}
|
|
308
262
|
|
|
309
|
-
return {
|
|
263
|
+
return {
|
|
264
|
+
backgroundColor,
|
|
265
|
+
borderTopLeftRadius: '50%',
|
|
266
|
+
borderTopRightRadius: '50%',
|
|
267
|
+
borderBottomRightRadius: '50%',
|
|
268
|
+
borderBottomLeftRadius: '50%',
|
|
269
|
+
boxShadow: props.$isFocusVisible ? `0 0 0 3px ${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(${props.$theme.direction === 'rtl' ? '-100%' : '100%'})` : null,
|
|
274
|
+
transition: `transform ${props.$theme.animation.timing200}`
|
|
275
|
+
};
|
|
310
276
|
});
|
|
311
277
|
Toggle.displayName = "Toggle";
|
|
312
|
-
export const ToggleInner = styled('div', props => {
|
|
313
|
-
if (props.$checkmarkType === STYLE_TYPE.toggle) {
|
|
314
|
-
// eslint-disable-next-line no-inner-declarations
|
|
315
|
-
const backgroundColor = () => {
|
|
316
|
-
if (props.$disabled) {
|
|
317
|
-
return props.$theme.colors.sliderHandleInnerFillDisabled;
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
if (props.$isActive && props.$checked) {
|
|
321
|
-
return props.$theme.colors.sliderHandleInnerFillSelectedActive;
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
if (props.$isHovered && props.$checked) {
|
|
325
|
-
return props.$theme.colors.sliderHandleInnerFillSelectedHover;
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
return props.$theme.colors.toggleTrackFill;
|
|
329
|
-
};
|
|
330
|
-
|
|
331
|
-
return {
|
|
332
|
-
height: props.$theme.sizing.scale300,
|
|
333
|
-
width: props.$theme.sizing.scale0,
|
|
334
|
-
borderTopLeftRadius: props.$theme.borders.radius100,
|
|
335
|
-
borderTopRightRadius: props.$theme.borders.radius100,
|
|
336
|
-
borderBottomRightRadius: props.$theme.borders.radius100,
|
|
337
|
-
borderBottomLeftRadius: props.$theme.borders.radius100,
|
|
338
|
-
backgroundColor: backgroundColor()
|
|
339
|
-
};
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
if (props.$checkmarkType === STYLE_TYPE.toggle_round) {
|
|
343
|
-
return {};
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
return {};
|
|
347
|
-
});
|
|
348
|
-
ToggleInner.displayName = "ToggleInner";
|
|
349
278
|
export const ToggleTrack = styled('div', props => {
|
|
350
|
-
|
|
351
|
-
const borderRadius = props.$theme.borders.useRoundedCorners ? props.$theme.borders.radius200 : null;
|
|
352
|
-
return {
|
|
353
|
-
alignItems: 'center',
|
|
354
|
-
backgroundColor: getBackgroundColor(props),
|
|
355
|
-
borderTopLeftRadius: borderRadius,
|
|
356
|
-
borderTopRightRadius: borderRadius,
|
|
357
|
-
borderBottomRightRadius: borderRadius,
|
|
358
|
-
borderBottomLeftRadius: borderRadius,
|
|
359
|
-
display: 'flex',
|
|
360
|
-
height: props.$theme.sizing.scale600,
|
|
361
|
-
justifyContent: props.$checked ? 'flex-end' : 'flex-start',
|
|
362
|
-
marginTop: props.$theme.sizing.scale100,
|
|
363
|
-
marginBottom: props.$theme.sizing.scale100,
|
|
364
|
-
marginLeft: props.$theme.sizing.scale100,
|
|
365
|
-
marginRight: props.$theme.sizing.scale100,
|
|
366
|
-
width: props.$theme.sizing.scale1000
|
|
367
|
-
};
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
if (props.$checkmarkType === STYLE_TYPE.toggle_round) {
|
|
371
|
-
let backgroundColor = props.$theme.colors.toggleTrackFill;
|
|
372
|
-
|
|
373
|
-
if (props.$disabled) {
|
|
374
|
-
backgroundColor = props.$theme.colors.toggleTrackFillDisabled;
|
|
375
|
-
} else if ((props.$error || props.$isError) && props.$checked) {
|
|
376
|
-
backgroundColor = props.$theme.colors.tickFillError;
|
|
377
|
-
}
|
|
279
|
+
let backgroundColor = props.$theme.colors.toggleTrackFill;
|
|
378
280
|
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
borderTopRightRadius: '7px',
|
|
384
|
-
borderBottomRightRadius: '7px',
|
|
385
|
-
borderBottomLeftRadius: '7px',
|
|
386
|
-
display: 'flex',
|
|
387
|
-
height: props.$theme.sizing.scale550,
|
|
388
|
-
marginTop: props.$theme.sizing.scale200,
|
|
389
|
-
marginBottom: props.$theme.sizing.scale100,
|
|
390
|
-
marginLeft: props.$theme.sizing.scale200,
|
|
391
|
-
marginRight: props.$theme.sizing.scale100,
|
|
392
|
-
width: props.$theme.sizing.scale1000
|
|
393
|
-
};
|
|
281
|
+
if (props.$disabled) {
|
|
282
|
+
backgroundColor = props.$theme.colors.toggleTrackFillDisabled;
|
|
283
|
+
} else if (props.$error && props.$checked) {
|
|
284
|
+
backgroundColor = props.$theme.colors.tickFillError;
|
|
394
285
|
}
|
|
395
286
|
|
|
396
|
-
return {
|
|
287
|
+
return {
|
|
288
|
+
alignItems: 'center',
|
|
289
|
+
backgroundColor,
|
|
290
|
+
borderTopLeftRadius: '7px',
|
|
291
|
+
borderTopRightRadius: '7px',
|
|
292
|
+
borderBottomRightRadius: '7px',
|
|
293
|
+
borderBottomLeftRadius: '7px',
|
|
294
|
+
display: 'flex',
|
|
295
|
+
height: props.$theme.sizing.scale550,
|
|
296
|
+
marginTop: props.$theme.sizing.scale200,
|
|
297
|
+
marginBottom: props.$theme.sizing.scale100,
|
|
298
|
+
marginLeft: props.$theme.sizing.scale200,
|
|
299
|
+
marginRight: props.$theme.sizing.scale100,
|
|
300
|
+
width: props.$theme.sizing.scale1000
|
|
301
|
+
};
|
|
397
302
|
});
|
|
398
303
|
ToggleTrack.displayName = "ToggleTrack";
|
|
@@ -37,7 +37,7 @@ function FilterQuickControls(props) {
|
|
|
37
37
|
const locale = React.useContext(LocaleContext);
|
|
38
38
|
return /*#__PURE__*/React.createElement(ButtonGroup, {
|
|
39
39
|
size: SIZE.mini,
|
|
40
|
-
kind: KIND.
|
|
40
|
+
kind: KIND.tertiary
|
|
41
41
|
}, /*#__PURE__*/React.createElement(Button, {
|
|
42
42
|
type: "button",
|
|
43
43
|
onClick: props.onSelectAll
|
|
@@ -322,7 +322,7 @@ function DatetimeFilter(props) {
|
|
|
322
322
|
}) => {
|
|
323
323
|
if (Array.isArray(date)) {
|
|
324
324
|
if (!date.length) return;
|
|
325
|
-
const nextDates = date.map((d, i) => applyDateToTime(rangeDates[i], d));
|
|
325
|
+
const nextDates = date.map((d, i) => d ? applyDateToTime(rangeDates[i], d) : null);
|
|
326
326
|
setRangeDates(nextDates);
|
|
327
327
|
}
|
|
328
328
|
},
|
package/es/data-table/column.js
CHANGED
|
@@ -49,7 +49,11 @@ function Column(options) {
|
|
|
49
49
|
display: 'flex',
|
|
50
50
|
height: '100%'
|
|
51
51
|
})
|
|
52
|
-
}, Boolean(props.onSelect) && /*#__PURE__*/React.createElement(
|
|
52
|
+
}, Boolean(props.onSelect) && /*#__PURE__*/React.createElement("span", {
|
|
53
|
+
className: css({
|
|
54
|
+
paddingRight: theme.sizing.scale300
|
|
55
|
+
})
|
|
56
|
+
}, /*#__PURE__*/React.createElement(Checkbox, {
|
|
53
57
|
onChange: props.onSelect,
|
|
54
58
|
checked: props.isSelected,
|
|
55
59
|
overrides: {
|
|
@@ -60,7 +64,7 @@ function Column(options) {
|
|
|
60
64
|
}
|
|
61
65
|
}
|
|
62
66
|
}
|
|
63
|
-
}), /*#__PURE__*/React.createElement(ProvidedCell, props)));
|
|
67
|
+
})), /*#__PURE__*/React.createElement(ProvidedCell, props)));
|
|
64
68
|
}),
|
|
65
69
|
renderFilter: options.renderFilter || (() => null),
|
|
66
70
|
sortable: Boolean(options.sortable) && Boolean(options.sortFn),
|
|
@@ -396,7 +396,7 @@ const InnerTableElement = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
396
396
|
row: ctx.rows[ctx.rowHighlightIndex - 1]
|
|
397
397
|
}),
|
|
398
398
|
size: BUTTON_SIZES.compact,
|
|
399
|
-
kind: BUTTON_KINDS.
|
|
399
|
+
kind: BUTTON_KINDS.tertiary,
|
|
400
400
|
shape: BUTTON_SHAPES.round,
|
|
401
401
|
overrides: {
|
|
402
402
|
BaseButton: {
|
|
@@ -459,7 +459,8 @@ export function DataTable({
|
|
|
459
459
|
selectedRowIds,
|
|
460
460
|
sortIndex,
|
|
461
461
|
sortDirection,
|
|
462
|
-
textQuery = ''
|
|
462
|
+
textQuery = '',
|
|
463
|
+
controlRef
|
|
463
464
|
}) {
|
|
464
465
|
const [, theme] = useStyletron();
|
|
465
466
|
const locale = React.useContext(LocaleContext);
|
|
@@ -596,6 +597,9 @@ export function DataTable({
|
|
|
596
597
|
|
|
597
598
|
return result;
|
|
598
599
|
}, [sortedIndices, filteredIndices, onIncludedRowsChange, allRows]);
|
|
600
|
+
React.useImperativeHandle(controlRef, () => ({
|
|
601
|
+
getRows: () => rows
|
|
602
|
+
}), [rows]);
|
|
599
603
|
const [browserScrollbarWidth, setBrowserScrollbarWidth] = React.useState(0);
|
|
600
604
|
const normalizedWidths = React.useMemo(() => {
|
|
601
605
|
const resizedWidths = measuredWidths.map((w, i) => Math.floor(w) + Math.floor(resizeDeltas[i]));
|
|
@@ -69,6 +69,9 @@ const HeaderCell = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
69
69
|
onFocus: handleFocus,
|
|
70
70
|
onBlur: handleBlur
|
|
71
71
|
}, props.isSelectable && /*#__PURE__*/React.createElement("span", {
|
|
72
|
+
className: css({
|
|
73
|
+
paddingRight: theme.sizing.scale300
|
|
74
|
+
}),
|
|
72
75
|
ref: checkboxRef
|
|
73
76
|
}, /*#__PURE__*/React.createElement(Checkbox, {
|
|
74
77
|
onChange: e => {
|
|
@@ -252,24 +252,35 @@ 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)) {
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
258
|
+
// We'll need to update the date in time values of internal state
|
|
259
|
+
const newTimeState = [...this.state.time];
|
|
260
|
+
const start = data.date[0] ? this.dateHelpers.applyDateToTime(newTimeState[0], data.date[0]) : null;
|
|
261
|
+
const end = data.date[1] ? this.dateHelpers.applyDateToTime(newTimeState[1], data.date[1]) : null;
|
|
262
|
+
newTimeState[0] = start;
|
|
263
|
+
|
|
264
|
+
if (end) {
|
|
265
|
+
updatedDate = [start, end];
|
|
266
|
+
newTimeState[1] = end;
|
|
267
|
+
} else {
|
|
268
|
+
updatedDate = [start];
|
|
269
|
+
} // Update the date in time values of internal state
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
this.setState({
|
|
273
|
+
time: newTimeState
|
|
263
274
|
});
|
|
264
275
|
} else if (!Array.isArray(this.props.value) && data.date) {
|
|
265
|
-
newTimeState
|
|
266
|
-
updatedDate = newTimeState
|
|
267
|
-
} // 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
|
|
268
278
|
|
|
279
|
+
this.setState({
|
|
280
|
+
time: [newTimeState]
|
|
281
|
+
});
|
|
282
|
+
}
|
|
269
283
|
|
|
270
|
-
this.setState({
|
|
271
|
-
time: newTimeState
|
|
272
|
-
});
|
|
273
284
|
onChange({
|
|
274
285
|
date: updatedDate
|
|
275
286
|
});
|
|
@@ -289,14 +300,14 @@ export default class Calendar extends React.Component {
|
|
|
289
300
|
|
|
290
301
|
if (Array.isArray(this.props.value)) {
|
|
291
302
|
const dates = this.props.value.map((date, i) => {
|
|
292
|
-
if (index === i) {
|
|
303
|
+
if (date && index === i) {
|
|
293
304
|
return this.dateHelpers.applyTimeToDate(date, time);
|
|
294
305
|
}
|
|
295
306
|
|
|
296
307
|
return date;
|
|
297
308
|
});
|
|
298
309
|
onChange({
|
|
299
|
-
date: dates
|
|
310
|
+
date: [dates[0], dates[1]]
|
|
300
311
|
});
|
|
301
312
|
} else {
|
|
302
313
|
const date = this.dateHelpers.applyTimeToDate(this.props.value, time);
|
|
@@ -355,7 +366,9 @@ export default class Calendar extends React.Component {
|
|
|
355
366
|
overrides: overrides,
|
|
356
367
|
value: this.props.value,
|
|
357
368
|
peekNextMonth: this.props.peekNextMonth,
|
|
358
|
-
fixedHeight: this.props.fixedHeight
|
|
369
|
+
fixedHeight: this.props.fixedHeight,
|
|
370
|
+
hasLockedBehavior: !!this.props.hasLockedBehavior,
|
|
371
|
+
selectedInput: this.props.selectedInput
|
|
359
372
|
})));
|
|
360
373
|
monthList.push( /*#__PURE__*/React.createElement("div", {
|
|
361
374
|
key: `month-component-${i}`
|
|
@@ -25,4 +25,12 @@ export const DEFAULT_MONTHS = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];
|
|
|
25
25
|
export const DENSITY = {
|
|
26
26
|
high: 'high',
|
|
27
27
|
default: 'default'
|
|
28
|
+
};
|
|
29
|
+
export const INPUT_ROLE = {
|
|
30
|
+
startDate: 'startDate',
|
|
31
|
+
endDate: 'endDate'
|
|
32
|
+
};
|
|
33
|
+
export const RANGED_CALENDAR_BEHAVIOR = {
|
|
34
|
+
default: 'default',
|
|
35
|
+
locked: 'locked'
|
|
28
36
|
};
|