baseui 14.0.0 → 15.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.
Files changed (162) hide show
  1. package/accordion/accordion.js +4 -4
  2. package/accordion/panel.d.ts +1 -1
  3. package/accordion/stateless-accordion.js +8 -8
  4. package/accordion/styled-components.js +1 -1
  5. package/accordion/types.d.ts +1 -1
  6. package/app-nav-bar/mobile-menu.js +3 -1
  7. package/banner/banner.js +3 -1
  8. package/banner/types.d.ts +2 -1
  9. package/bottom-navigation/bottom-navigation.js +4 -6
  10. package/bottom-navigation/selector.js +1 -1
  11. package/bottom-navigation/styled-components.js +1 -1
  12. package/button/button.d.ts +1 -3
  13. package/button/button.js +6 -2
  14. package/button/styled-components.d.ts +1 -0
  15. package/button/styled-components.js +61 -4
  16. package/button/types.d.ts +15 -3
  17. package/button-timed/button-timed.js +4 -5
  18. package/button-timed/styled-components.js +5 -3
  19. package/button-timed/types.d.ts +1 -1
  20. package/data-table/column-categorical.js +2 -2
  21. package/data-table/column-numerical.js +3 -18
  22. package/data-table/locale.d.ts +2 -0
  23. package/data-table/locale.js +2 -1
  24. package/data-table/stateful-container.js +1 -1
  25. package/data-table/stateful-data-table.js +7 -3
  26. package/data-table/types.d.ts +2 -0
  27. package/datepicker/day.js +2 -4
  28. package/datepicker/utils/date-helpers.d.ts +1 -0
  29. package/datepicker/utils/date-helpers.js +3 -0
  30. package/dialog/dialog.d.ts +1 -1
  31. package/dialog/dialog.js +38 -56
  32. package/dialog/styled-components.d.ts +2 -2
  33. package/dialog/styled-components.js +56 -24
  34. package/dialog/types.d.ts +5 -2
  35. package/dnd-list/list.js +1 -1
  36. package/dnd-list/stateful-list-container.js +1 -1
  37. package/file-uploader/constants.d.ts +18 -0
  38. package/file-uploader/constants.js +32 -0
  39. package/file-uploader/file-uploader.d.ts +2 -2
  40. package/file-uploader/file-uploader.js +406 -117
  41. package/file-uploader/index.d.ts +1 -1
  42. package/file-uploader/index.js +67 -18
  43. package/file-uploader/locale.d.ts +10 -10
  44. package/file-uploader/locale.js +5 -5
  45. package/file-uploader/styled-components.d.ts +13 -6
  46. package/file-uploader/styled-components.js +261 -64
  47. package/file-uploader/types.d.ts +49 -32
  48. package/file-uploader/utils.d.ts +5 -0
  49. package/file-uploader/utils.js +45 -0
  50. package/file-uploader-basic/file-uploader-basic.d.ts +10 -0
  51. package/file-uploader-basic/file-uploader-basic.js +173 -0
  52. package/file-uploader-basic/index.d.ts +4 -0
  53. package/file-uploader-basic/index.js +71 -0
  54. package/file-uploader-basic/locale.d.ts +15 -0
  55. package/file-uploader-basic/locale.js +21 -0
  56. package/file-uploader-basic/styled-components.d.ts +7 -0
  57. package/file-uploader-basic/styled-components.js +83 -0
  58. package/file-uploader-basic/types.d.ts +41 -0
  59. package/form-control/form-control.js +38 -3
  60. package/form-control/styled-components.d.ts +2 -0
  61. package/form-control/styled-components.js +22 -2
  62. package/form-control/types.d.ts +4 -0
  63. package/helpers/react-helpers.js +1 -1
  64. package/icon/circle-check-filled.d.ts +9 -0
  65. package/icon/circle-check-filled.js +50 -0
  66. package/icon/circle-exclamation-point-filled.d.ts +9 -0
  67. package/icon/circle-exclamation-point-filled.js +50 -0
  68. package/icon/hide.js +1 -1
  69. package/icon/icon-exports.d.ts +4 -0
  70. package/icon/icon-exports.js +28 -0
  71. package/icon/paperclip-filled.d.ts +9 -0
  72. package/icon/paperclip-filled.js +50 -0
  73. package/icon/show.js +1 -1
  74. package/icon/trash-can-filled.d.ts +9 -0
  75. package/{button-docked/button-docked.js → icon/trash-can-filled.js} +35 -16
  76. package/list/list-item.js +0 -2
  77. package/locale/en_US.js +14 -12
  78. package/locale/es_AR.js +9 -1
  79. package/locale/index.d.ts +3 -0
  80. package/locale/index.js +1 -0
  81. package/locale/tr_TR.js +9 -1
  82. package/locale/types.d.ts +2 -0
  83. package/message-card/message-card.js +2 -2
  84. package/message-card/utils.js +8 -3
  85. package/mobile-header/mobile-header.js +0 -1
  86. package/modal/modal-button.d.ts +1 -3
  87. package/package.json +5 -2
  88. package/page-control/page-control.js +1 -3
  89. package/payment-card/custom-cards.config.d.ts +1 -11
  90. package/payment-card/payment-card.js +1 -3
  91. package/phone-input/base-country-picker.js +2 -2
  92. package/phone-input/country-picker.js +0 -10
  93. package/progress-bar/progressbar-rounded.js +1 -1
  94. package/progress-bar/styled-components.js +8 -6
  95. package/rating/styled-components.js +3 -2
  96. package/rating/svg-icons.d.ts +5 -5
  97. package/rating/svg-icons.js +20 -20
  98. package/segmented-control/segmented-control.js +1 -2
  99. package/segmented-control/stateful-segmented-control.js +1 -2
  100. package/select/multi-value.js +1 -1
  101. package/sheet/sheet.js +1 -3
  102. package/snackbar/index.d.ts +1 -0
  103. package/snackbar/snackbar-context.d.ts +1 -2
  104. package/snackbar/snackbar-context.js +27 -21
  105. package/spinner/index.d.ts +4 -2
  106. package/stepper/stepper.js +29 -30
  107. package/styles/__mocks__/styled.js +0 -2
  108. package/styles/as-primary-export-hoc.js +0 -2
  109. package/styles/styled.js +0 -2
  110. package/styles/types.d.ts +7 -3
  111. package/system-banner/system-banner.js +1 -3
  112. package/tabs-motion/tabs.js +2 -2
  113. package/tag/constants.d.ts +5 -4
  114. package/tag/constants.js +7 -6
  115. package/tag/index.d.ts +1 -1
  116. package/tag/index.js +7 -7
  117. package/tag/styled-components.d.ts +1 -1
  118. package/tag/styled-components.js +137 -124
  119. package/tag/tag.js +2 -2
  120. package/tag/types.d.ts +9 -8
  121. package/tag/types.js +2 -2
  122. package/themes/dark-theme/color-component-tokens.d.ts +2 -2
  123. package/themes/dark-theme/color-component-tokens.js +279 -275
  124. package/themes/dark-theme/color-foundation-tokens.d.ts +3 -0
  125. package/themes/dark-theme/{color-tokens.js → color-foundation-tokens.js} +11 -14
  126. package/themes/dark-theme/color-semantic-tokens.d.ts +2 -2
  127. package/themes/dark-theme/color-semantic-tokens.js +52 -58
  128. package/themes/dark-theme/create-dark-theme.d.ts +1 -1
  129. package/themes/dark-theme/create-dark-theme.js +12 -32
  130. package/themes/dark-theme/dark-theme.js +4 -4
  131. package/themes/dark-theme/primitives.js +2 -2
  132. package/themes/light-theme/color-component-tokens.d.ts +2 -2
  133. package/themes/light-theme/color-component-tokens.js +287 -282
  134. package/themes/light-theme/color-foundation-tokens.d.ts +3 -0
  135. package/themes/light-theme/{color-tokens.js → color-foundation-tokens.js} +10 -13
  136. package/themes/light-theme/color-semantic-tokens.d.ts +2 -2
  137. package/themes/light-theme/color-semantic-tokens.js +50 -53
  138. package/themes/light-theme/create-light-theme.d.ts +1 -1
  139. package/themes/light-theme/create-light-theme.js +12 -32
  140. package/themes/light-theme/light-theme.js +4 -4
  141. package/themes/light-theme/primitives.js +2 -2
  142. package/themes/types.d.ts +74 -13
  143. package/themes/utils.d.ts +1 -1
  144. package/themes/utils.js +4 -4
  145. package/tile/tile-group.js +2 -2
  146. package/timezonepicker/update-tzdata.js +0 -1
  147. package/tokens/color-primitive-tokens.d.ts +5 -0
  148. package/tokens/color-primitive-tokens.js +301 -0
  149. package/tokens/index.d.ts +5 -4
  150. package/tokens/index.js +25 -3
  151. package/tokens/types.d.ts +170 -1
  152. package/button-docked/button-docked.d.ts +0 -4
  153. package/button-docked/index.d.ts +0 -3
  154. package/button-docked/index.js +0 -40
  155. package/button-docked/styled-components.d.ts +0 -5
  156. package/button-docked/styled-components.js +0 -55
  157. package/button-docked/types.d.ts +0 -14
  158. package/themes/dark-theme/color-tokens.d.ts +0 -3
  159. package/themes/light-theme/color-tokens.d.ts +0 -3
  160. package/tokens/colors.d.ts +0 -3
  161. package/tokens/colors.js +0 -125
  162. /package/{button-docked → file-uploader-basic}/types.js +0 -0
@@ -84,17 +84,17 @@ class Accordion extends React.Component {
84
84
  lastItem.current && lastItem.current.focus();
85
85
  }
86
86
  if (e.keyCode === ARROW_UP) {
87
- e.preventDefault();
88
87
  const activeItemIdx = itemRefs.findIndex(item => item.current === document.activeElement);
89
- if (activeItemIdx > 0) {
88
+ if (activeItemIdx >= 0) {
89
+ e.preventDefault();
90
90
  const prevItem = itemRefs[activeItemIdx - 1];
91
91
  prevItem.current && prevItem.current.focus();
92
92
  }
93
93
  }
94
94
  if (e.keyCode === ARROW_DOWN) {
95
- e.preventDefault();
96
95
  const activeItemIdx = itemRefs.findIndex(item => item.current === document.activeElement);
97
- if (activeItemIdx < itemRefs.length - 1) {
96
+ if (activeItemIdx >= 0 && activeItemIdx < itemRefs.length - 1) {
97
+ e.preventDefault();
98
98
  const nextItem = itemRefs[activeItemIdx + 1];
99
99
  nextItem.current && nextItem.current.focus();
100
100
  }
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  declare const ForwardedPanel: React.ForwardRefExoticComponent<{
3
- children: React.ReactNode;
3
+ children?: React.ReactNode;
4
4
  disabled?: boolean;
5
5
  'aria-controls'?: string;
6
6
  key?: React.Key;
@@ -33,13 +33,13 @@ function StatelessAccordion({
33
33
  return /*#__PURE__*/React.createElement(Root, _extends({
34
34
  "data-baseweb": "accordion"
35
35
  }, rootProps), React.Children.map(children, (child, index) => {
36
- let normalizedChild = (0, _reactIs.isElement)(child) || (0, _reactIs.isPortal)(child) ? child :
37
- /*#__PURE__*/
38
- // if primitive value - wrap it in a fragment
39
- React.createElement(React.Fragment, null, child);
40
- const key = normalizedChild.key || String(index);
41
- return /*#__PURE__*/React.cloneElement(normalizedChild, {
42
- disabled: normalizedChild.props.disabled || disabled,
36
+ if (!(0, _reactIs.isElement)(child) && !(0, _reactIs.isPortal)(child)) {
37
+ return child;
38
+ }
39
+ const element = child;
40
+ const key = element.key || String(index);
41
+ return /*#__PURE__*/React.cloneElement(element, {
42
+ disabled: element.props.disabled || disabled,
43
43
  expanded: expanded.includes(key),
44
44
  key,
45
45
  onChange:
@@ -66,7 +66,7 @@ function StatelessAccordion({
66
66
  expanded: next
67
67
  });
68
68
  } : onChange,
69
- overrides: normalizedChild.props.overrides || PanelOverrides,
69
+ overrides: element.props.overrides || PanelOverrides,
70
70
  renderAll
71
71
  });
72
72
  }));
@@ -87,7 +87,7 @@ const ToggleIcon = exports.ToggleIcon = (0, _styles.styled)('svg', props => {
87
87
  return {
88
88
  ...(0, _styledComponents.getSvgStyles)(props),
89
89
  flexShrink: 0,
90
- color: $color || $theme.colors.contentPrimary,
90
+ color: $color || $theme.colors.contentTierary,
91
91
  cursor: $disabled ? 'not-allowed' : 'pointer'
92
92
  };
93
93
  });
@@ -87,7 +87,7 @@ export type StatelessAccordionProps = {
87
87
  };
88
88
  type SharedPanelProps = {
89
89
  /** The content visible when Panel is expanded. */
90
- children: React.ReactNode;
90
+ children?: React.ReactNode;
91
91
  /** Defaults to the disabled value provided by the parent Accordion component. */
92
92
  disabled?: boolean;
93
93
  /** Id for a panel, when provided populates aria-controls
@@ -48,7 +48,9 @@ const MobileNavMenuItem = /*#__PURE__*/React.forwardRef((props, ref) => {
48
48
  // Replace with a user menu item renderer
49
49
  return /*#__PURE__*/React.createElement(UserMenuProfileListItem, _extends({}, restProps, userMenuProfileListItemProps, {
50
50
  ref: ref
51
- }), /*#__PURE__*/React.createElement(_userProfileTile.default, item.item));
51
+ }), /*#__PURE__*/React.createElement(_userProfileTile.default, _extends({}, item.item, {
52
+ overrides: overrides
53
+ })));
52
54
  }
53
55
  return (
54
56
  /*#__PURE__*/
package/banner/banner.js CHANGED
@@ -146,10 +146,12 @@ function Trailing({
146
146
  }));
147
147
  }
148
148
  const [TrailingButtonContainer, trailingButtonContainerProps] = (0, _overrides.getOverrides)(overrides.TrailingButtonContainer, _styledComponents.StyledTrailingButtonContainer);
149
+ const trailingButtonOverrides = overrides?.TrailingButton;
150
+ const trailingButtonBackgroundColor = trailingButtonOverrides?.style?.backgroundColor ? trailingButtonOverrides.style.backgroundColor : backgroundColor;
149
151
  if (action.label) {
150
152
  return /*#__PURE__*/React.createElement(TrailingButtonContainer, trailingButtonContainerProps, /*#__PURE__*/React.createElement(_index.Button, {
151
153
  colors: {
152
- backgroundColor,
154
+ backgroundColor: trailingButtonBackgroundColor,
153
155
  color
154
156
  },
155
157
  onClick: action.onClick,
package/banner/types.d.ts CHANGED
@@ -29,12 +29,13 @@ export type BannerOverrides = {
29
29
  Title?: Override;
30
30
  TrailingContent?: Override;
31
31
  TrailingButtonContainer?: Override;
32
+ TrailingButton?: Override;
32
33
  TrailingIconButton?: Override;
33
34
  };
34
35
  export type BannerProps = {
35
36
  action?: ActionContent;
36
37
  artwork?: ArtworkContent;
37
- children: React.ReactNode;
38
+ children?: React.ReactNode;
38
39
  hierarchy?: Hierarchy;
39
40
  kind?: Kind;
40
41
  overrides?: BannerOverrides;
@@ -34,7 +34,6 @@ const BottomNavigation = ({
34
34
  const [displayOverflow, setDisplayOverflow] = React.useState(false);
35
35
  const NavItemPanelRefs = React.useRef([]);
36
36
  function scrollToTop(idx) {
37
- // @ts-expect-error todo(ts-migration) TS2339 Property 'scrollTo' does not exist on type 'never'.
38
37
  NavItemPanelRefs.current[idx].scrollTo({
39
38
  top: 0,
40
39
  left: 0,
@@ -45,7 +44,6 @@ const BottomNavigation = ({
45
44
  if (displayOverflow) {
46
45
  setDisplayOverflow(false);
47
46
  }
48
- // @ts-expect-error todo(ts-migration) TS2722 Cannot invoke an object which is possibly 'undefined'.
49
47
  onChange({
50
48
  activeKey
51
49
  });
@@ -79,9 +77,7 @@ const BottomNavigation = ({
79
77
  if (!navItem) return;
80
78
  const isActive = activeKey === idx && !displayOverflow;
81
79
  return /*#__PURE__*/React.createElement(_panel.Panel, {
82
- isActive: isActive
83
- // @ts-expect-error todo(ts-migration) TS2345 Argument of type 'unknown' is not assignable to parameter of type 'never'.
84
- ,
80
+ isActive: isActive,
85
81
  ref: element => NavItemPanelRefs.current.push(element),
86
82
  overrides: navItem.props.overrides,
87
83
  key: idx,
@@ -98,7 +94,9 @@ const BottomNavigation = ({
98
94
  const idx = overflowIdx + MAX_SELECTORS - 1;
99
95
  return /*#__PURE__*/React.createElement(_list.ListItem, {
100
96
  artwork: props => /*#__PURE__*/React.createElement(Icon, props),
101
- endEnhancer: () => /*#__PURE__*/React.createElement(_icon.ChevronRight, null),
97
+ endEnhancer: () => /*#__PURE__*/React.createElement(_icon.ChevronRight, {
98
+ title: ""
99
+ }),
102
100
  onClick: () => {
103
101
  activeKey === idx && !displayOverflow ? scrollToTop(idx) : handleNavItemChange(idx);
104
102
  },
@@ -33,7 +33,7 @@ const Selector = ({
33
33
  "aria-selected": isActive
34
34
  }, SelectorProps), /*#__PURE__*/React.createElement(Icon, {
35
35
  size: 20,
36
- color: isActive ? theme.colors.contentPrimary : theme.colors.contentTertiary
36
+ color: isActive ? theme.colors.bottomNavigationSelectedText : theme.colors.bottomNavigationText
37
37
  }), /*#__PURE__*/React.createElement(Title, _extends({
38
38
  $isActive: isActive
39
39
  }, TitleProps), title));
@@ -60,7 +60,7 @@ const StyledTitle = exports.StyledTitle = (0, _styles.styled)('div', ({
60
60
  $isActive
61
61
  }) => ({
62
62
  ...$theme.typography.LabelXSmall,
63
- color: $isActive ? $theme.colors.contentPrimary : $theme.colors.contentTertiary
63
+ color: $isActive ? $theme.colors.bottomNavigationSelectedText : $theme.colors.bottomNavigationText
64
64
  }));
65
65
  StyledTitle.displayName = "StyledTitle";
66
66
  StyledTitle.displayName = 'StyledTitle';
@@ -1,9 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import type { ButtonProps, SharedStyleProps } from './types';
3
3
  export interface ButtonComponentType {
4
- <C extends React.ElementType = 'button'>(props: ButtonProps & SharedStyleProps & Omit<React.ComponentProps<C>, keyof ButtonProps | keyof SharedStyleProps> & {
5
- $as?: C | React.ComponentType<any> | keyof JSX.IntrinsicElements;
6
- }): JSX.Element;
4
+ <C extends React.ElementType = 'button'>(props: ButtonProps & Omit<React.ComponentProps<C>, keyof ButtonProps | keyof SharedStyleProps> & SharedStyleProps<C | React.ComponentType<any> | keyof JSX.IntrinsicElements>): JSX.Element;
7
5
  displayName?: string;
8
6
  }
9
7
  declare const ForwardedButton: ButtonComponentType;
package/button/button.js CHANGED
@@ -83,11 +83,12 @@ class Button extends React.Component {
83
83
  ...restProps
84
84
  } = this.props;
85
85
  // Get overrides
86
+ const isAnchor = 'href' in restProps && Boolean(restProps?.href);
86
87
  const [BaseButton, baseButtonProps] = (0, _overrides.getOverrides)(
87
88
  // adding both (1) BaseButton and (2) Root
88
89
  // (1) because it's a Button under the hood
89
90
  // (2) because we want consistency with the rest of the components
90
- overrides.BaseButton || overrides.Root, _styledComponents.BaseButton);
91
+ overrides.BaseButton || overrides.Root, isAnchor ? _styledComponents.AnchorBaseButton : _styledComponents.BaseButton);
91
92
  const [LoadingSpinner, loadingSpinnerProps] = (0, _overrides.getOverrides)(overrides.LoadingSpinner, _styledComponents.LoadingSpinner);
92
93
  const [LoadingSpinnerContainer, loadingSpinnerContainerProps] = (0, _overrides.getOverrides)(overrides.LoadingSpinnerContainer, _styledComponents.LoadingSpinnerContainer);
93
94
  const sharedProps = {
@@ -99,10 +100,13 @@ class Button extends React.Component {
99
100
  ['aria-busy']: 'true',
100
101
  ['aria-live']: 'polite'
101
102
  } : {};
103
+ const ariaDisabledProps = restProps?.disabled && isAnchor ? {
104
+ ['aria-disabled']: true
105
+ } : {};
102
106
  return /*#__PURE__*/React.createElement(BaseButton, _extends({
103
107
  ref: forwardedRef,
104
108
  "data-baseweb": "button"
105
- }, ariaLoadingElements, sharedProps, restProps, baseButtonProps, {
109
+ }, ariaLoadingElements, ariaDisabledProps, sharedProps, restProps, baseButtonProps, {
106
110
  // Applies last to override passed in onClick
107
111
  onClick: this.internalOnClick,
108
112
  onFocus: (0, _focusVisible.forkFocus)({
@@ -1,5 +1,6 @@
1
1
  import type { SharedStyleProps } from './types';
2
2
  export declare const BaseButton: import("styletron-react").StyletronComponent<"button", SharedStyleProps>;
3
+ export declare const AnchorBaseButton: import("styletron-react").StyletronComponent<"a", SharedStyleProps>;
3
4
  export declare const EndEnhancer: import("styletron-react").StyletronComponent<"div", SharedStyleProps>;
4
5
  export declare const StartEnhancer: import("styletron-react").StyletronComponent<"div", SharedStyleProps>;
5
6
  export declare const LoadingSpinnerContainer: import("styletron-react").StyletronComponent<"div", SharedStyleProps>;
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.StartEnhancer = exports.LoadingSpinnerContainer = exports.LoadingSpinner = exports.EndEnhancer = exports.BaseButton = void 0;
6
+ exports.StartEnhancer = exports.LoadingSpinnerContainer = exports.LoadingSpinner = exports.EndEnhancer = exports.BaseButton = exports.AnchorBaseButton = void 0;
7
7
  var _styles = require("../styles");
8
8
  var _constants = require("./constants");
9
9
  /*
@@ -13,7 +13,10 @@ This source code is licensed under the MIT license found in the
13
13
  LICENSE file in the root directory of this source tree.
14
14
  */
15
15
 
16
- const BaseButton = exports.BaseButton = (0, _styles.styled)('button', ({
16
+ // note: Tried doing a standard override of the styled function, but it didn't work
17
+ // it seems like there is some bug when override $as
18
+
19
+ const createStyledBaseButton = (type, styleFn) => (0, _styles.styled)(type, ({
17
20
  $theme,
18
21
  $size,
19
22
  $colors,
@@ -22,7 +25,8 @@ const BaseButton = exports.BaseButton = (0, _styles.styled)('button', ({
22
25
  $isLoading,
23
26
  $isSelected,
24
27
  $disabled,
25
- $isFocusVisible
28
+ $isFocusVisible,
29
+ $as
26
30
  }) => ({
27
31
  display: 'inline-flex',
28
32
  // need to maintain button width while showing loading spinner
@@ -80,12 +84,44 @@ const BaseButton = exports.BaseButton = (0, _styles.styled)('button', ({
80
84
  $isSelected,
81
85
  $disabled
82
86
  }),
87
+ ...getAnchorDisabledStyles({
88
+ $as,
89
+ $theme,
90
+ $kind,
91
+ $isSelected,
92
+ $disabled
93
+ }),
83
94
  ...getShapeStyles({
84
95
  $shape,
85
96
  $size
97
+ }),
98
+ ...styleFn?.({
99
+ $theme,
100
+ $size,
101
+ $colors,
102
+ $kind,
103
+ $shape,
104
+ $isLoading,
105
+ $isSelected,
106
+ $disabled,
107
+ $isFocusVisible,
108
+ $as
86
109
  })
87
110
  }));
88
- BaseButton.displayName = "BaseButton";
111
+ const BaseButton = exports.BaseButton = createStyledBaseButton('button');
112
+ BaseButton.displayName = 'BaseButton';
113
+ const AnchorBaseButton = exports.AnchorBaseButton = createStyledBaseButton('a', ({
114
+ $theme,
115
+ $kind,
116
+ $isSelected,
117
+ $disabled
118
+ }) => getAnchorDisabledStyles({
119
+ $as: 'a',
120
+ $theme,
121
+ $kind,
122
+ $isSelected,
123
+ $disabled
124
+ }));
89
125
  BaseButton.displayName = 'BaseButton';
90
126
  const EndEnhancer = exports.EndEnhancer = (0, _styles.styled)('div', ({
91
127
  $theme
@@ -270,6 +306,27 @@ function getFontStyles({
270
306
  return $theme.typography.font350;
271
307
  }
272
308
  }
309
+ function getAnchorDisabledStyles({
310
+ $as,
311
+ $theme,
312
+ $kind,
313
+ $isSelected,
314
+ $disabled
315
+ }) {
316
+ if (!($as === 'a' && $disabled)) {
317
+ return {};
318
+ }
319
+ return {
320
+ cursor: 'not-allowed',
321
+ pointerEvents: 'none',
322
+ ...getDisabledStyles({
323
+ $theme,
324
+ $kind,
325
+ $isSelected,
326
+ $disabled
327
+ })
328
+ };
329
+ }
273
330
 
274
331
  // @ts-ignore
275
332
  function getDisabledStyles({
package/button/types.d.ts CHANGED
@@ -13,7 +13,7 @@ export type CustomColors = {
13
13
  backgroundColor: string;
14
14
  color: string;
15
15
  };
16
- export type ButtonProps = {
16
+ interface BaseButtonProps {
17
17
  children?: React.ReactNode;
18
18
  colors?: CustomColors;
19
19
  disabled?: boolean;
@@ -34,8 +34,18 @@ export type ButtonProps = {
34
34
  /** A helper rendered at the start of the button. */
35
35
  startEnhancer?: React.ReactNode | React.ComponentType<any>;
36
36
  type?: 'submit' | 'reset' | 'button';
37
- };
38
- export type SharedStyleProps = {
37
+ }
38
+ export interface LinkButtonProps {
39
+ /** Convert button to <a> tag allowing for opening links directly.
40
+ *
41
+ * Use this over window.open as it handles accessibility better.
42
+ */
43
+ href?: string | null;
44
+ target?: string;
45
+ }
46
+ export interface ButtonProps extends BaseButtonProps, LinkButtonProps {
47
+ }
48
+ export type SharedStyleProps<AS = React.ComponentType<any> | keyof JSX.IntrinsicElements> = {
39
49
  $colors?: CustomColors;
40
50
  $kind?: keyof typeof KIND;
41
51
  $isSelected?: boolean;
@@ -44,4 +54,6 @@ export type SharedStyleProps = {
44
54
  $isLoading?: boolean;
45
55
  $disabled?: boolean;
46
56
  $isFocusVisible?: boolean;
57
+ $as?: AS;
47
58
  };
59
+ export {};
@@ -24,6 +24,7 @@ const ButtonTimed = props => {
24
24
  paused = false,
25
25
  onClick: onClickProp,
26
26
  disabled,
27
+ kind = _button.KIND.primary,
27
28
  children,
28
29
  overrides = {},
29
30
  ...restProps
@@ -60,7 +61,7 @@ const ButtonTimed = props => {
60
61
  } = overrides;
61
62
  const [TimerContainer, timerContainerProps] = (0, _overrides.getOverrides)(TimerContainerOverride, _styledComponents.StyledTimerContainer);
62
63
  const buttonMergedOverrides = (0, _overrides.mergeOverrides)({
63
- BaseButton: {
64
+ Root: {
64
65
  component: _styledComponents.StyledBaseButtonTimed,
65
66
  props: {
66
67
  $initialTime: initialTime,
@@ -73,9 +74,7 @@ const ButtonTimed = props => {
73
74
  }
74
75
  }
75
76
  }, {
76
- Root: buttonOverrides.Root || {},
77
- // @ts-ignore
78
- BaseButton: buttonOverrides.BaseButton,
77
+ Root: buttonOverrides.Root || buttonOverrides.BaseButton || {},
79
78
  StartEnhancer: buttonOverrides.StartEnhancer || {},
80
79
  EndEnhancer: buttonOverrides.EndEnhancer || {},
81
80
  LoadingSpinnerContainer: buttonOverrides.LoadingSpinnerContainer || {},
@@ -85,7 +84,7 @@ const ButtonTimed = props => {
85
84
  overrides: buttonMergedOverrides,
86
85
  onClick: onClick,
87
86
  size: _button.SIZE.large,
88
- kind: _button.KIND.primary,
87
+ kind: kind,
89
88
  shape: _button.SHAPE.default,
90
89
  disabled: disabled || timeRemaining === 0
91
90
  }), children, /*#__PURE__*/React.createElement(TimerContainer, timerContainerProps, `(${(0, _utils.formatTime)(timeRemaining)})`));
@@ -20,6 +20,7 @@ const StyledBaseButtonTimed = exports.StyledBaseButtonTimed = (0, _index.withSty
20
20
  $timeElapsed
21
21
  }) => {
22
22
  const completionPercentage = $timeElapsed / $initialTime * 100;
23
+ const restPercentage = 100 - completionPercentage;
23
24
  const timeLeft = $initialTime - $timeElapsed;
24
25
  return {
25
26
  position: 'relative',
@@ -28,10 +29,10 @@ const StyledBaseButtonTimed = exports.StyledBaseButtonTimed = (0, _index.withSty
28
29
  animationDuration: `${timeLeft}s`,
29
30
  animationName: {
30
31
  from: {
31
- transform: `translateX(${completionPercentage}%)`
32
+ transform: `translateX(${completionPercentage}%) scaleX(${restPercentage}%)`
32
33
  },
33
34
  to: {
34
- transform: 'translateX(100%)'
35
+ transform: 'translateX(100%) scaleX(0)'
35
36
  }
36
37
  },
37
38
  animationTimingFunction: 'linear',
@@ -41,7 +42,8 @@ const StyledBaseButtonTimed = exports.StyledBaseButtonTimed = (0, _index.withSty
41
42
  height: '100%',
42
43
  zIndex: '1',
43
44
  position: 'absolute',
44
- backgroundColor: (0, _util.hexToRgb)($theme.colors.backgroundPrimary, '0.2')
45
+ backgroundColor: (0, _util.hexToRgb)($theme.colors.backgroundPrimary, '0.2'),
46
+ transformOrigin: 'left'
45
47
  }
46
48
  } : {})
47
49
  };
@@ -4,7 +4,7 @@ import type { Override } from '../helpers/overrides';
4
4
  export type ButtonTimedOverrides = ButtonOverrides & {
5
5
  TimerContainer?: Override;
6
6
  };
7
- export type ButtonTimedProps = Omit<ButtonProps, 'kind' | 'shape' | 'size' | 'onClick' | 'overrides'> & {
7
+ export type ButtonTimedProps = Omit<ButtonProps, 'shape' | 'size' | 'onClick' | 'overrides'> & {
8
8
  initialTime: number;
9
9
  paused?: boolean;
10
10
  onClick: (a?: React.SyntheticEvent<HTMLButtonElement>) => unknown;
@@ -122,14 +122,14 @@ function CategoricalFilter(props) {
122
122
  value: query,
123
123
  onChange: event => setQuery(event.target.value),
124
124
  clearable: true
125
- }), !query && /*#__PURE__*/React.createElement("div", {
125
+ }), /*#__PURE__*/React.createElement("div", {
126
126
  style: {
127
127
  // @ts-ignore
128
128
  marginTop: showQuery ? theme.sizing.scale600 : null
129
129
  }
130
130
  }, /*#__PURE__*/React.createElement(FilterQuickControls, {
131
131
  onSelectAll: () => {
132
- categories.forEach(c => selection.add(c));
132
+ filteredCategories.forEach(c => selection.add(c));
133
133
  setSelection(new Set(selection));
134
134
  },
135
135
  onClearSelection: () => {
@@ -66,7 +66,6 @@ function validateInput(input) {
66
66
 
67
67
  // @ts-ignore
68
68
  const bisect = (0, _d.bisector)(d => d.x0);
69
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
70
69
  const Histogram = /*#__PURE__*/React.memo(function Histogram({
71
70
  data,
72
71
  lower,
@@ -83,9 +82,7 @@ const Histogram = /*#__PURE__*/React.memo(function Histogram({
83
82
  yScale
84
83
  } = React.useMemo(() => {
85
84
  const bins = (0, _d.bin)().thresholds(Math.min(data.length, _constants.MAX_BIN_COUNT))(data);
86
- const xScale = (0, _d.scaleLinear)()
87
- // @ts-expect-error todo(ts-migration) TS2345 Argument of type '(number | undefined)[]' is not assignable to parameter of type 'Iterable<NumberValue>'.
88
- .domain([bins[0].x0, bins[bins.length - 1].x1]).range([0, _constants.HISTOGRAM_SIZE.width]).clamp(true);
85
+ const xScale = (0, _d.scaleLinear)().domain([bins[0].x0, bins[bins.length - 1].x1]).range([0, _constants.HISTOGRAM_SIZE.width]).clamp(true);
89
86
  const yScale = (0, _d.scaleLinear)()
90
87
  // @ts-ignore
91
88
  .domain([0, (0, _d.max)(bins, d => d.length)]).nice().range([_constants.HISTOGRAM_SIZE.height, 0]);
@@ -114,19 +111,15 @@ const Histogram = /*#__PURE__*/React.memo(function Histogram({
114
111
  overflow: 'visible'
115
112
  })
116
113
  }, /*#__PURE__*/React.createElement("svg", _constants.HISTOGRAM_SIZE, bins.map((d, index) => {
117
- // @ts-expect-error todo(ts-migration) TS2345 Argument of type 'number | undefined' is not assignable to parameter of type 'NumberValue'.
118
114
  const x = xScale(d.x0) + 1;
119
115
  const y = yScale(d.length);
120
- // @ts-expect-error todo(ts-migration) TS2345 Argument of type 'number | undefined' is not assignable to parameter of type 'NumberValue'.
121
116
  const width = Math.max(0, xScale(d.x1) - xScale(d.x0) - 1);
122
117
  const height = yScale(0) - yScale(d.length);
123
118
  let included;
124
119
  if (singleIndexNearest != null) {
125
120
  included = index === singleIndexNearest;
126
121
  } else {
127
- // @ts-expect-error todo(ts-migration) TS18048 'd.x1' is possibly 'undefined'.
128
122
  const withinLower = d.x1 > lower;
129
- // @ts-expect-error todo(ts-migration) TS18048 'd.x0' is possibly 'undefined'.
130
123
  const withinUpper = d.x0 <= upper;
131
124
  included = withinLower && withinUpper;
132
125
  }
@@ -201,19 +194,14 @@ function NumericalFilter(props) {
201
194
  // once the user is done inputting.
202
195
  // we validate then format to the given precision
203
196
  let l = isRange ? lv : sv;
204
- // @ts-expect-error todo(ts-migration) TS2322 Type 'string | number | undefined' is not assignable to type 'number'.
205
197
  l = validateInput(l) ? l : min;
206
198
  let h = validateInput(uv) ? uv : max;
207
-
208
- // @ts-expect-error todo(ts-migration) TS2345 Argument of type 'string | number | undefined' is not assignable to parameter of type 'number'.
209
199
  return [roundToFixed(l, precision), roundToFixed(h, precision)];
210
200
  }, [isRange, focused, sv, lv, uv, precision]);
211
201
 
212
202
  // We have our slider values range from 1 to the bin size, so we have a scale which
213
203
  // takes in the data driven range and maps it to values the scale can always handle
214
- const sliderScale = React.useMemo(() => (0, _d.scaleLinear)()
215
- // @ts-expect-error todo(ts-migration) TS2345 Argument of type '(string | undefined)[]' is not assignable to parameter of type 'Iterable<NumberValue>'.
216
- .domain([min, max]).rangeRound([1, _constants.MAX_BIN_COUNT])
204
+ const sliderScale = React.useMemo(() => (0, _d.scaleLinear)().domain([min, max]).rangeRound([1, _constants.MAX_BIN_COUNT])
217
205
  // We clamp the values within our min and max even if a user enters a huge number
218
206
  .clamp(true), [min, max]);
219
207
  let sliderValue = isRange ? [sliderScale(inputValueLower), sliderScale(inputValueUpper)] : [sliderScale(inputValueLower)];
@@ -395,10 +383,7 @@ function NumericalFilter(props) {
395
383
  },
396
384
  onFocus: () => setFocus(true),
397
385
  onBlur: () => setFocus(false)
398
- }), isRange &&
399
- /*#__PURE__*/
400
- // @ts-expect-error todo(ts-migration) TS2769 No overload matches this call.
401
- React.createElement(_input.Input, {
386
+ }), isRange && /*#__PURE__*/React.createElement(_input.Input, {
402
387
  min: min,
403
388
  max: max,
404
389
  size: _input.SIZE.mini,
@@ -36,6 +36,7 @@ export type DataTableLocale = {
36
36
  selectRow: string;
37
37
  selectAllRows: string;
38
38
  sortColumn: string;
39
+ textQueryPlaceholder: string;
39
40
  };
40
41
  declare const locale: {
41
42
  emptyState: string;
@@ -75,5 +76,6 @@ declare const locale: {
75
76
  selectRow: string;
76
77
  selectAllRows: string;
77
78
  sortColumn: string;
79
+ textQueryPlaceholder: string;
78
80
  };
79
81
  export default locale;
@@ -48,6 +48,7 @@ const locale = {
48
48
  booleanColumnFalseShort: 'F',
49
49
  selectRow: 'Select row',
50
50
  selectAllRows: 'Select all rows',
51
- sortColumn: 'Sort column'
51
+ sortColumn: 'Sort column',
52
+ textQueryPlaceholder: 'Search...'
52
53
  };
53
54
  var _default = exports.default = locale;
@@ -30,7 +30,7 @@ const StatefulContainer = props => {
30
30
  const [sortIndex, setSortIndex] = React.useState(typeof props.initialSortIndex === 'number' ? props.initialSortIndex : -1);
31
31
  const [sortDirection, setSortDirection] = React.useState(props.initialSortDirection);
32
32
  const [filters, setFilters] = React.useState(props.initialFilters || new Map());
33
- const [textQuery, setTextQuery] = React.useState('');
33
+ const [textQuery, setTextQuery] = React.useState(typeof props.initialTextQuery === 'string' ? props.initialTextQuery : '');
34
34
  const [selectedRowIds, setSelectedRowIds] = React.useState(props.initialSelectedRowIds || new Set());
35
35
 
36
36
  // @ts-ignore
@@ -42,7 +42,7 @@ function useResizeObserver(ref, callback) {
42
42
  function QueryInput(props) {
43
43
  const [css, theme] = (0, _styles.useStyletron)();
44
44
  const locale = React.useContext(_locale.LocaleContext);
45
- const [value, setValue] = React.useState('');
45
+ const [value, setValue] = React.useState(props.textQuery);
46
46
  React.useEffect(() => {
47
47
  const timeout = setTimeout(() => props.onChange(value), 250);
48
48
  return () => clearTimeout(timeout);
@@ -70,7 +70,8 @@ function QueryInput(props) {
70
70
  size: _input.SIZE.compact,
71
71
  onChange: event => setValue(event.target.value),
72
72
  value: value,
73
- clearable: true
73
+ clearable: true,
74
+ placeholder: props.textQueryPlaceholder || locale.datatable.textQueryPlaceholder
74
75
  }));
75
76
  }
76
77
 
@@ -149,6 +150,7 @@ function StatefulDataTable(props) {
149
150
  initialSelectedRowIds: props.initialSelectedRowIds,
150
151
  initialSortIndex: props.initialSortIndex,
151
152
  initialSortDirection: props.initialSortDirection,
153
+ initialTextQuery: props.initialTextQuery,
152
154
  onFilterAdd: props.onFilterAdd,
153
155
  onFilterRemove: props.onFilterRemove,
154
156
  onIncludedRowsChange: props.onIncludedRowsChange,
@@ -191,7 +193,9 @@ function StatefulDataTable(props) {
191
193
  paddingTop: theme.sizing.scale500
192
194
  })
193
195
  }, searchable && /*#__PURE__*/React.createElement(QueryInput, {
194
- onChange: onTextQueryChange
196
+ onChange: onTextQueryChange,
197
+ textQuery: textQuery,
198
+ textQueryPlaceholder: props.textQueryPlaceholder
195
199
  }), filterable && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_filterMenu.default, {
196
200
  columns: props.columns,
197
201
  filters: filters,
@@ -81,6 +81,7 @@ export type StatefulDataTableProps = {
81
81
  initialSelectedRowIds?: Set<number | string>;
82
82
  initialSortIndex?: number;
83
83
  initialSortDirection?: SortDirections;
84
+ initialTextQuery?: string;
84
85
  loading?: boolean;
85
86
  loadingMessage?: string | React.ComponentType<{}>;
86
87
  onFilterAdd?: (b: string, a: {
@@ -98,6 +99,7 @@ export type StatefulDataTableProps = {
98
99
  rowHeight?: number;
99
100
  rowHighlightIndex?: number;
100
101
  searchable?: boolean;
102
+ textQueryPlaceholder?: string;
101
103
  controlRef?: ControlRef;
102
104
  };
103
105
  export type DataTableProps = {
package/datepicker/day.js CHANGED
@@ -205,11 +205,9 @@ class Day extends React.Component {
205
205
  });
206
206
  _defineProperty(this, "clampToDayStart", dt => {
207
207
  const {
208
- setSeconds,
209
- setMinutes,
210
- setHours
208
+ startOfDay
211
209
  } = this.dateHelpers;
212
- return setSeconds(setMinutes(setHours(dt, 0), 0), 0);
210
+ return startOfDay(dt);
213
211
  });
214
212
  this.dateHelpers = new _dateHelpers.default(props.adapter);
215
213
  }
@@ -82,6 +82,7 @@ declare class DateHelpers<T> {
82
82
  setHours: (b: T, a: number) => T;
83
83
  setMonth: (b: T, a: number) => T;
84
84
  setYear: (b: T, a: number) => T;
85
+ startOfDay: (a: T) => T;
85
86
  getMinutes: (a: T) => number;
86
87
  getHours: (a: T) => number;
87
88
  getMonth: (a: T) => number;