baseui 10.5.0 → 10.6.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.
Files changed (77) hide show
  1. package/button/styled-components.js +1 -1
  2. package/button/styled-components.js.flow +4 -1
  3. package/datepicker/calendar-header.js +227 -95
  4. package/datepicker/calendar-header.js.flow +270 -139
  5. package/datepicker/constants.js +4 -2
  6. package/datepicker/constants.js.flow +2 -0
  7. package/datepicker/day.js +1 -0
  8. package/datepicker/day.js.flow +1 -0
  9. package/datepicker/index.d.ts +1 -0
  10. package/datepicker/types.js.flow +1 -0
  11. package/datepicker/utils/calendar-header-helpers.js +51 -0
  12. package/datepicker/utils/calendar-header-helpers.js.flow +53 -0
  13. package/dnd-list/index.js.flow +2 -1
  14. package/drawer/drawer.js +2 -1
  15. package/drawer/drawer.js.flow +1 -1
  16. package/es/button/styled-components.js +1 -1
  17. package/es/datepicker/calendar-header.js +184 -84
  18. package/es/datepicker/constants.js +2 -1
  19. package/es/datepicker/day.js +1 -0
  20. package/es/datepicker/utils/calendar-header-helpers.js +34 -0
  21. package/es/dnd-list/index.js +2 -1
  22. package/es/drawer/drawer.js +2 -1
  23. package/es/popover/stateful-container.js +4 -0
  24. package/es/rating/emoticon-rating.js +3 -1
  25. package/es/rating/star-rating.js +3 -1
  26. package/es/select/select-component.js +4 -5
  27. package/es/select/styled-components.js +34 -4
  28. package/es/snackbar/snackbar-context.js +16 -4
  29. package/es/table-semantic/styled-components.js +6 -4
  30. package/es/table-semantic/table-builder.js +3 -0
  31. package/es/themes/dark-theme/color-component-tokens.js +1 -1
  32. package/es/themes/light-theme/color-component-tokens.js +9 -9
  33. package/es/tooltip/styled-components.js +8 -0
  34. package/esm/button/styled-components.js +1 -1
  35. package/esm/datepicker/calendar-header.js +226 -95
  36. package/esm/datepicker/constants.js +2 -1
  37. package/esm/datepicker/day.js +1 -0
  38. package/esm/datepicker/utils/calendar-header-helpers.js +45 -0
  39. package/esm/dnd-list/index.js +2 -1
  40. package/esm/drawer/drawer.js +2 -1
  41. package/esm/popover/stateful-container.js +4 -0
  42. package/esm/rating/emoticon-rating.js +2 -2
  43. package/esm/rating/star-rating.js +2 -2
  44. package/esm/select/select-component.js +4 -5
  45. package/esm/select/styled-components.js +28 -4
  46. package/esm/snackbar/snackbar-context.js +16 -4
  47. package/esm/table-semantic/styled-components.js +6 -4
  48. package/esm/table-semantic/table-builder.js +3 -0
  49. package/esm/themes/dark-theme/color-component-tokens.js +1 -1
  50. package/esm/themes/light-theme/color-component-tokens.js +9 -9
  51. package/esm/tooltip/styled-components.js +8 -0
  52. package/link/index.d.ts +1 -0
  53. package/menu/index.d.ts +7 -0
  54. package/menu/types.js.flow +12 -0
  55. package/package.json +2 -2
  56. package/popover/stateful-container.js +4 -0
  57. package/popover/stateful-container.js.flow +3 -0
  58. package/rating/emoticon-rating.js +2 -2
  59. package/rating/emoticon-rating.js.flow +4 -1
  60. package/rating/star-rating.js +2 -2
  61. package/rating/star-rating.js.flow +4 -1
  62. package/select/select-component.js +4 -5
  63. package/select/select-component.js.flow +4 -5
  64. package/select/styled-components.js +28 -4
  65. package/select/styled-components.js.flow +30 -2
  66. package/snackbar/snackbar-context.js +15 -4
  67. package/snackbar/snackbar-context.js.flow +15 -3
  68. package/table-semantic/styled-components.js +6 -4
  69. package/table-semantic/styled-components.js.flow +6 -4
  70. package/table-semantic/table-builder.js +3 -0
  71. package/table-semantic/table-builder.js.flow +3 -0
  72. package/themes/dark-theme/color-component-tokens.js +1 -1
  73. package/themes/dark-theme/color-component-tokens.js.flow +1 -1
  74. package/themes/light-theme/color-component-tokens.js +9 -9
  75. package/themes/light-theme/color-component-tokens.js.flow +9 -9
  76. package/tooltip/styled-components.js +8 -0
  77. package/tooltip/styled-components.js.flow +8 -0
@@ -31,6 +31,15 @@ export function useSnackbar() {
31
31
  dequeue: context.dequeue
32
32
  };
33
33
  }
34
+
35
+ function usePrevious(value) {
36
+ const ref = React.useRef();
37
+ React.useEffect(() => {
38
+ ref.current = value;
39
+ });
40
+ return ref.current;
41
+ }
42
+
34
43
  export default function SnackbarProvider({
35
44
  children,
36
45
  overrides = {},
@@ -46,10 +55,6 @@ export default function SnackbarProvider({
46
55
 
47
56
  function enqueue(elementProps, duration = defaultDuration) {
48
57
  setSnackbars(prev => {
49
- if (prev.length === 0) {
50
- enter(duration);
51
- }
52
-
53
58
  return [...prev, {
54
59
  elementProps,
55
60
  duration
@@ -57,6 +62,13 @@ export default function SnackbarProvider({
57
62
  });
58
63
  }
59
64
 
65
+ const prevSnackbars = usePrevious(snackbars) || [];
66
+ React.useEffect(() => {
67
+ if (prevSnackbars.length === 0 && snackbars.length >= 1) {
68
+ enter(snackbars[0].duration);
69
+ }
70
+ }, [snackbars, prevSnackbars]);
71
+
60
72
  function dequeue() {
61
73
  setContainerHeight(0);
62
74
  setSnackbars(prev => {
@@ -67,7 +67,8 @@ StyledTableHeadRow.displayName = "StyledTableHeadRow";
67
67
  export const StyledTableHeadCell = styled('th', ({
68
68
  $theme,
69
69
  $size,
70
- $divider
70
+ $divider,
71
+ $isNumeric
71
72
  }) => {
72
73
  const borderDir = $theme.direction === 'rtl' ? 'Left' : 'Right';
73
74
  const borderVertical = $divider === DIVIDER.grid || $divider === DIVIDER.vertical;
@@ -81,7 +82,7 @@ export const StyledTableHeadCell = styled('th', ({
81
82
  paddingLeft: padding,
82
83
  backgroundColor: $theme.colors.tableHeadBackgroundColor,
83
84
  color: $theme.colors.contentPrimary,
84
- textAlign: $theme.direction === 'rtl' ? 'right' : 'left',
85
+ textAlign: $theme.direction === 'rtl' || $isNumeric ? 'right' : 'left',
85
86
  verticalAlign: 'top',
86
87
  whiteSpace: 'nowrap',
87
88
  zIndex: 1,
@@ -170,7 +171,8 @@ export const StyledTableBodyCell = styled('td', ({
170
171
  $size,
171
172
  $divider,
172
173
  $isNumeric,
173
- $isLastRow
174
+ $isLastRow,
175
+ $isSortable
174
176
  }) => {
175
177
  const borderDir = $theme.direction === 'rtl' ? 'Left' : 'Right';
176
178
  const borderVertical = $divider === DIVIDER.vertical || $divider === DIVIDER.grid;
@@ -178,7 +180,7 @@ export const StyledTableBodyCell = styled('td', ({
178
180
  const padding = sizeToCellPadding($theme, $size);
179
181
  return { ...$theme.typography.font200,
180
182
  paddingTop: padding,
181
- paddingRight: padding,
183
+ paddingRight: !$isSortable ? padding : $theme.sizing.scale1000,
182
184
  paddingBottom: padding,
183
185
  paddingLeft: padding,
184
186
  color: $theme.colors.contentPrimary,
@@ -79,6 +79,7 @@ export default class TableBuilder extends React.Component {
79
79
  $col: col,
80
80
  $colIndex: colIndex,
81
81
  $divider: divider,
82
+ $isNumeric: col.numeric,
82
83
  $size: size
83
84
  }, tableHeadCellProps, colTableHeadCellProps), col.header);
84
85
  }
@@ -117,6 +118,7 @@ export default class TableBuilder extends React.Component {
117
118
  $col: col,
118
119
  $colIndex: colIndex,
119
120
  $divider: divider,
121
+ $isNumeric: col.numeric,
120
122
  role: "button",
121
123
  tabIndex: "0",
122
124
  "aria-label": `${col.tableHeadAriaLabel || col.header}, ${sortLabel}`,
@@ -143,6 +145,7 @@ export default class TableBuilder extends React.Component {
143
145
  $rowIndex: rowIndex,
144
146
  $isNumeric: col.numeric,
145
147
  $isLastRow: rowIndex === lastRowindex,
148
+ $isSortable: col.sortable,
146
149
  $size: size
147
150
  }, tableBodyCellProps, colTableBodyCellProps), col.children(row, rowIndex));
148
151
  }
@@ -91,7 +91,7 @@ export default ((themePrimitives = colorTokens) => ({
91
91
  linkActive: themePrimitives.primary300,
92
92
  // List
93
93
  listHeaderFill: themePrimitives.mono600,
94
- listBodyFill: themePrimitives.mono700,
94
+ listBodyFill: themePrimitives.mono800,
95
95
  listIconFill: themePrimitives.mono100,
96
96
  listBorder: themePrimitives.mono500,
97
97
  // ProgressSteps
@@ -20,32 +20,32 @@ export default ((themePrimitives = colorTokens) => ({
20
20
  buttonPrimaryActive: themePrimitives.primary600,
21
21
  buttonPrimarySelectedFill: themePrimitives.primary600,
22
22
  buttonPrimarySelectedText: themePrimitives.white,
23
- buttonPrimarySpinnerForeground: themePrimitives.primary50,
24
- buttonPrimarySpinnerBackground: themePrimitives.primary500,
23
+ buttonPrimarySpinnerForeground: themePrimitives.accent,
24
+ buttonPrimarySpinnerBackground: themePrimitives.primaryB,
25
25
  buttonSecondaryFill: themePrimitives.primary100,
26
26
  buttonSecondaryText: themePrimitives.primary,
27
27
  buttonSecondaryHover: themePrimitives.primary200,
28
28
  buttonSecondaryActive: themePrimitives.primary300,
29
29
  buttonSecondarySelectedFill: themePrimitives.primary300,
30
30
  buttonSecondarySelectedText: themePrimitives.primary,
31
- buttonSecondarySpinnerForeground: themePrimitives.primary700,
32
- buttonSecondarySpinnerBackground: themePrimitives.primary300,
31
+ buttonSecondarySpinnerForeground: themePrimitives.accent,
32
+ buttonSecondarySpinnerBackground: themePrimitives.primaryB,
33
33
  buttonTertiaryFill: 'transparent',
34
34
  buttonTertiaryText: themePrimitives.primary,
35
35
  buttonTertiaryHover: themePrimitives.primary50,
36
36
  buttonTertiaryActive: themePrimitives.primary100,
37
37
  buttonTertiarySelectedFill: themePrimitives.primary100,
38
38
  buttonTertiarySelectedText: themePrimitives.primary,
39
- buttonTertiarySpinnerForeground: themePrimitives.primary700,
40
- buttonTertiarySpinnerBackground: themePrimitives.primary300,
39
+ buttonTertiarySpinnerForeground: themePrimitives.accent,
40
+ buttonTertiarySpinnerBackground: themePrimitives.primary100,
41
41
  buttonMinimalFill: 'transparent',
42
42
  buttonMinimalText: themePrimitives.primary,
43
43
  buttonMinimalHover: themePrimitives.primary50,
44
44
  buttonMinimalActive: themePrimitives.primary100,
45
45
  buttonMinimalSelectedFill: themePrimitives.primary100,
46
46
  buttonMinimalSelectedText: themePrimitives.primary,
47
- buttonMinimalSpinnerForeground: themePrimitives.primary700,
48
- buttonMinimalSpinnerBackground: themePrimitives.primary300,
47
+ buttonMinimalSpinnerForeground: themePrimitives.accent,
48
+ buttonMinimalSpinnerBackground: themePrimitives.primary100,
49
49
  buttonDisabledFill: themePrimitives.mono200,
50
50
  buttonDisabledText: themePrimitives.mono600,
51
51
  buttonDisabledSpinnerForeground: themePrimitives.mono600,
@@ -91,7 +91,7 @@ export default ((themePrimitives = colorTokens) => ({
91
91
  linkActive: themePrimitives.primary500,
92
92
  // List
93
93
  listHeaderFill: themePrimitives.white,
94
- listBodyFill: themePrimitives.mono200,
94
+ listBodyFill: themePrimitives.white,
95
95
  listIconFill: themePrimitives.mono500,
96
96
  listBorder: themePrimitives.mono500,
97
97
  // ProgressSteps
@@ -21,6 +21,10 @@ import { getEndPosition } from '../popover/utils.js';
21
21
  */
22
22
  export const Body = styled('div', props => ({ ...getBodyStyles(props),
23
23
  backgroundColor: props.$theme.colors.tooltipBackground,
24
+ borderTopLeftRadius: props.$theme.borders.radius300,
25
+ borderTopRightRadius: props.$theme.borders.radius300,
26
+ borderBottomRightRadius: props.$theme.borders.radius300,
27
+ borderBottomLeftRadius: props.$theme.borders.radius300,
24
28
  boxShadow: props.$theme.lighting.shadow400,
25
29
  color: props.$theme.colors.tooltipText,
26
30
  // Reset transition property to opacity only, and static transform
@@ -30,6 +34,10 @@ export const Body = styled('div', props => ({ ...getBodyStyles(props),
30
34
  Body.displayName = "Body";
31
35
  export const Inner = styled('div', props => ({ ...getInnerStyles(props),
32
36
  backgroundColor: props.$theme.colors.tooltipBackground,
37
+ borderTopLeftRadius: props.$theme.borders.radius300,
38
+ borderTopRightRadius: props.$theme.borders.radius300,
39
+ borderBottomRightRadius: props.$theme.borders.radius300,
40
+ borderBottomLeftRadius: props.$theme.borders.radius300,
33
41
  paddingTop: props.$theme.sizing.scale300,
34
42
  paddingBottom: props.$theme.sizing.scale300,
35
43
  paddingLeft: props.$theme.sizing.scale600,
@@ -45,7 +45,7 @@ export var BaseButton = styled('button', function (_ref) {
45
45
  cursor: 'pointer',
46
46
  ':disabled': {
47
47
  cursor: 'not-allowed',
48
- backgroundColor: $theme.colors.buttonDisabledFill,
48
+ backgroundColor: $kind === KIND.minimal || $kind === KIND.tertiary ? 'transparent' : $theme.colors.buttonDisabledFill,
49
49
  color: $theme.colors.buttonDisabledText
50
50
  },
51
51
  marginLeft: 0,