baseui 0.0.0-next-a3fb288 → 0.0.0-next-913cc0e

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.
@@ -10,11 +10,22 @@ LICENSE file in the root directory of this source tree.
10
10
  */
11
11
  import * as React from 'react';
12
12
  import { Toast, TYPE } from '../toast/index.js';
13
+ import { mergeOverrides } from '../helpers/overrides.js';
13
14
  export default class Notification extends React.Component {
14
15
  render() {
16
+ const overrides = mergeOverrides({
17
+ Body: {
18
+ style: {
19
+ marginTop: 0,
20
+ marginBottom: 0
21
+ }
22
+ }
23
+ }, this.props.overrides);
15
24
  return /*#__PURE__*/React.createElement(Toast, _extends({
16
25
  "data-baseweb": "notification"
17
- }, this.props));
26
+ }, this.props, {
27
+ overrides: overrides
28
+ }));
18
29
  }
19
30
 
20
31
  }
@@ -37,7 +37,7 @@ const filterOptions = (options, filterValue, excludeOptions, newProps) => {
37
37
  acc.add(option[props.valueKey]);
38
38
  return acc;
39
39
  }, new Set());
40
- const re = new RegExp(`${props.matchPos === 'start' ? '$' : ''}${escapeRegExp(filterValue)}`, props.ignoreCase ? 'i' : ''); // $FlowFixMe
40
+ const re = new RegExp(`${props.matchPos === 'start' ? '^' : ''}${escapeRegExp(filterValue)}`, props.ignoreCase ? 'i' : ''); // $FlowFixMe
41
41
 
42
42
  return options.filter(option => {
43
43
  if (excludeValues.has(option[props.valueKey])) return false;
@@ -32,6 +32,7 @@ LICENSE file in the root directory of this source tree.
32
32
  */
33
33
  import * as React from 'react';
34
34
  import { Toast, TYPE } from '../toast/index.js';
35
+ import { mergeOverrides } from '../helpers/overrides.js';
35
36
 
36
37
  var Notification = /*#__PURE__*/function (_React$Component) {
37
38
  _inherits(Notification, _React$Component);
@@ -47,9 +48,19 @@ var Notification = /*#__PURE__*/function (_React$Component) {
47
48
  _createClass(Notification, [{
48
49
  key: "render",
49
50
  value: function render() {
51
+ var overrides = mergeOverrides({
52
+ Body: {
53
+ style: {
54
+ marginTop: 0,
55
+ marginBottom: 0
56
+ }
57
+ }
58
+ }, this.props.overrides);
50
59
  return /*#__PURE__*/React.createElement(Toast, _extends({
51
60
  "data-baseweb": "notification"
52
- }, this.props));
61
+ }, this.props, {
62
+ overrides: overrides
63
+ }));
53
64
  }
54
65
  }]);
55
66
 
@@ -43,7 +43,7 @@ var filterOptions = function filterOptions(options, filterValue, excludeOptions,
43
43
  acc.add(option[props.valueKey]);
44
44
  return acc;
45
45
  }, new Set());
46
- var re = new RegExp("".concat(props.matchPos === 'start' ? '$' : '').concat(escapeRegExp(filterValue)), props.ignoreCase ? 'i' : ''); // $FlowFixMe
46
+ var re = new RegExp("".concat(props.matchPos === 'start' ? '^' : '').concat(escapeRegExp(filterValue)), props.ignoreCase ? 'i' : ''); // $FlowFixMe
47
47
 
48
48
  return options.filter(function (option) {
49
49
  if (excludeValues.has(option[props.valueKey])) return false;
package/index.d.ts CHANGED
@@ -5,53 +5,47 @@ import {
5
5
  WithStyleFn as StyletronWithStyleFn,
6
6
  StyledFn as StyletronStyledFn,
7
7
  } from 'styletron-react';
8
- import {Override, Overrides} from './overrides';
9
- import {Locale} from './locale';
10
- import {Theme, ThemePrimitives} from './theme';
8
+ import { Override, Overrides } from './overrides';
9
+ import { Locale } from './locale';
10
+ import { Theme, ThemePrimitives } from './theme';
11
11
 
12
12
  type UseStyletronFn<Theme> = () => [(arg: StyleObject) => string, Theme];
13
13
  export function createThemedUseStyletron<Theme>(): UseStyletronFn<Theme>;
14
14
  export const useStyletron: UseStyletronFn<Theme>;
15
- export function withWrapper<
16
- C extends StyletronComponent<any>,
17
- P extends object
18
- >(
15
+ export function withWrapper<C extends StyletronComponent<any>, P extends object>(
19
16
  component: C,
20
- wrapper: (component: C) => React.ComponentType<P>,
17
+ wrapper: (component: C) => React.ComponentType<P>
21
18
  ): StyletronComponent<React.ComponentProps<C> & P>;
22
19
 
23
20
  export function createTheme<P extends object>(
24
21
  primitives: Partial<ThemePrimitives>,
25
- overrides?: P,
22
+ overrides?: P
26
23
  ): Theme & P;
27
24
  export function createLightTheme<P extends object>(
28
25
  primitives: Partial<ThemePrimitives>,
29
- overrides?: P,
26
+ overrides?: P
30
27
  ): Theme & P;
31
28
  export function createDarkTheme<P extends object>(
32
29
  primitives: Partial<ThemePrimitives>,
33
- overrides?: P,
30
+ overrides?: P
34
31
  ): Theme & P;
35
- export function mergeOverrides<T>(
36
- target?: Overrides<T>,
37
- source?: Overrides<T>,
38
- ): Overrides<T>;
32
+ export function mergeOverrides<T>(target?: Overrides<T>, source?: Overrides<T>): Overrides<T>;
39
33
  export function styled<
40
34
  P extends object,
41
35
  C extends keyof JSX.IntrinsicElements | React.ComponentType<any>,
42
36
  T = Theme
43
37
  >(
44
38
  component: C,
45
- styledFn: StyleObject | ((props: {$theme: T} & P) => StyleObject),
39
+ styledFn: StyleObject | ((props: { $theme: T } & P) => StyleObject)
46
40
  ): StyletronComponent<
47
- Pick<
48
- React.ComponentProps<C>,
49
- Exclude<keyof React.ComponentProps<C>, {className: string}>
50
- > &
51
- P
41
+ Pick<React.ComponentProps<C>, Exclude<keyof React.ComponentProps<C>, { className: string }>> & P
52
42
  >;
43
+ export function withStyle<C extends StyletronComponent<any>, P extends object, T = Theme>(
44
+ component: C,
45
+ styledFn: StyleObject | ((props: { $theme: T } & P) => StyleObject)
46
+ ): StyletronComponent<React.ComponentProps<C> & P>;
53
47
 
54
- export {Theme} from 'baseui/theme';
48
+ export { Theme } from 'baseui/theme';
55
49
  export const LightTheme: Theme;
56
50
  export const LightThemeMove: Theme;
57
51
  export const lightThemePrimitives: ThemePrimitives;
@@ -85,18 +79,11 @@ export interface ThemeProviderProps {
85
79
  export const ThemeProvider: React.FC<ThemeProviderProps>;
86
80
 
87
81
  export interface StyledFn<T> extends StyletronStyledFn {
88
- <
89
- C extends keyof JSX.IntrinsicElements | React.ComponentType<any>,
90
- P extends object
91
- >(
82
+ <C extends keyof JSX.IntrinsicElements | React.ComponentType<any>, P extends object>(
92
83
  component: C,
93
- style: (props: {$theme: T} & P) => StyleObject,
84
+ style: (props: { $theme: T } & P) => StyleObject
94
85
  ): StyletronComponent<
95
- Pick<
96
- React.ComponentProps<C>,
97
- Exclude<keyof React.ComponentProps<C>, {className: string}>
98
- > &
99
- P
86
+ Pick<React.ComponentProps<C>, Exclude<keyof React.ComponentProps<C>, { className: string }>> & P
100
87
  >;
101
88
  }
102
89
 
@@ -105,10 +92,8 @@ export function createThemedStyled<Theme>(): StyledFn<Theme>;
105
92
  export interface WithStyleFn<T = Theme> extends StyletronWithStyleFn {
106
93
  <C extends StyletronComponent<any>, P extends object, T1 = T>(
107
94
  component: C,
108
- style: (props: P & {$theme: T1}) => StyleObject,
95
+ style: (props: P & { $theme: T1 }) => StyleObject
109
96
  ): StyletronComponent<React.ComponentProps<C> & P>;
110
97
  }
111
98
 
112
- export const withStyle: WithStyleFn;
113
-
114
99
  export function createThemedWithStyle<Theme>(): WithStyleFn<Theme>;
@@ -11,6 +11,8 @@ var React = _interopRequireWildcard(require("react"));
11
11
 
12
12
  var _index = require("../toast/index.js");
13
13
 
14
+ var _overrides = require("../helpers/overrides.js");
15
+
14
16
  function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
15
17
 
16
18
  function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
@@ -53,9 +55,19 @@ var Notification = /*#__PURE__*/function (_React$Component) {
53
55
  _createClass(Notification, [{
54
56
  key: "render",
55
57
  value: function render() {
58
+ var overrides = (0, _overrides.mergeOverrides)({
59
+ Body: {
60
+ style: {
61
+ marginTop: 0,
62
+ marginBottom: 0
63
+ }
64
+ }
65
+ }, this.props.overrides);
56
66
  return /*#__PURE__*/React.createElement(_index.Toast, _extends({
57
67
  "data-baseweb": "notification"
58
- }, this.props));
68
+ }, this.props, {
69
+ overrides: overrides
70
+ }));
59
71
  }
60
72
  }]);
61
73
 
@@ -9,6 +9,7 @@ import * as React from 'react';
9
9
 
10
10
  import { Toast, TYPE } from '../toast/index.js';
11
11
  import type { ToastPropsT, ToastPropsShapeT } from '../toast/types.js';
12
+ import { mergeOverrides } from '../helpers/overrides.js';
12
13
 
13
14
  export default class Notification extends React.Component<ToastPropsT> {
14
15
  static defaultProps: ToastPropsShapeT = {
@@ -17,7 +18,11 @@ export default class Notification extends React.Component<ToastPropsT> {
17
18
  };
18
19
 
19
20
  render() {
20
- return <Toast data-baseweb="notification" {...this.props} />;
21
+ const overrides = mergeOverrides(
22
+ { Body: { style: { marginTop: 0, marginBottom: 0 } } },
23
+ this.props.overrides
24
+ );
25
+ return <Toast data-baseweb="notification" {...this.props} overrides={overrides} />;
21
26
  }
22
27
  }
23
28
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "baseui",
3
- "version": "0.0.0-next-a3fb288",
3
+ "version": "0.0.0-next-913cc0e",
4
4
  "description": "A React Component library implementing the Base design language",
5
5
  "keywords": [
6
6
  "react",
@@ -50,7 +50,7 @@ var filterOptions = function filterOptions(options, filterValue, excludeOptions,
50
50
  acc.add(option[props.valueKey]);
51
51
  return acc;
52
52
  }, new Set());
53
- var re = new RegExp("".concat(props.matchPos === 'start' ? '$' : '').concat(escapeRegExp(filterValue)), props.ignoreCase ? 'i' : ''); // $FlowFixMe
53
+ var re = new RegExp("".concat(props.matchPos === 'start' ? '^' : '').concat(escapeRegExp(filterValue)), props.ignoreCase ? 'i' : ''); // $FlowFixMe
54
54
 
55
55
  return options.filter(function (option) {
56
56
  if (excludeValues.has(option[props.valueKey])) return false;
@@ -58,7 +58,7 @@ const filterOptions = (
58
58
  }, new Set());
59
59
 
60
60
  const re = new RegExp(
61
- `${props.matchPos === 'start' ? '$' : ''}${escapeRegExp(filterValue)}`,
61
+ `${props.matchPos === 'start' ? '^' : ''}${escapeRegExp(filterValue)}`,
62
62
  props.ignoreCase ? 'i' : ''
63
63
  );
64
64
 
@@ -1,5 +1,5 @@
1
- import {StyletronComponent} from 'styletron-react';
2
- import {Sizing} from '../theme.ts';
1
+ import { StyletronComponent } from 'styletron-react';
2
+ import { Sizing } from '../theme.ts';
3
3
 
4
4
  export enum SIZE {
5
5
  small = 'small',
@@ -8,6 +8,7 @@ export enum SIZE {
8
8
  }
9
9
 
10
10
  export interface SpinnerProps {
11
+ [key: string]: any;
11
12
  $color?: string;
12
13
  $borderWidth?: number | string | SIZE | Sizing;
13
14
  $size?: number | string | SIZE | Sizing;