baseui 0.0.0-next-e40d68e → 0.0.0-next-7c7b20c

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/button/index.d.ts CHANGED
@@ -37,8 +37,14 @@ export interface ButtonOverrides {
37
37
  LoadingSpinner?: Override<any>;
38
38
  }
39
39
 
40
+ export interface CustomColorsT {
41
+ backgroundColor: string;
42
+ color: string;
43
+ }
44
+
40
45
  export interface ButtonProps
41
46
  extends StyletronComponentInjectedProps<ButtonProps> {
47
+ colors?: CustomColorsT;
42
48
  href?: string;
43
49
  target?: string;
44
50
  children?: React.ReactNode;
@@ -18,6 +18,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
18
18
  var BaseButton = (0, _index.styled)('button', function (_ref) {
19
19
  var $theme = _ref.$theme,
20
20
  $size = _ref.$size,
21
+ $colors = _ref.$colors,
21
22
  $kind = _ref.$kind,
22
23
  $shape = _ref.$shape,
23
24
  $isLoading = _ref.$isLoading,
@@ -69,8 +70,9 @@ var BaseButton = (0, _index.styled)('button', function (_ref) {
69
70
  $theme: $theme,
70
71
  $size: $size,
71
72
  $shape: $shape
72
- })), getKindStyles({
73
+ })), getColorStyles({
73
74
  $theme: $theme,
75
+ $colors: $colors,
74
76
  $kind: $kind,
75
77
  $isLoading: $isLoading,
76
78
  $isSelected: $isSelected,
@@ -345,13 +347,27 @@ function getPaddingStyles(_ref12) {
345
347
  }
346
348
  }
347
349
 
348
- function getKindStyles(_ref13) {
350
+ function getColorStyles(_ref13) {
349
351
  var $theme = _ref13.$theme,
352
+ $colors = _ref13.$colors,
350
353
  $isLoading = _ref13.$isLoading,
351
354
  $isSelected = _ref13.$isSelected,
352
355
  $kind = _ref13.$kind,
353
356
  $disabled = _ref13.$disabled;
354
357
 
358
+ if ($colors) {
359
+ return {
360
+ color: $colors.color,
361
+ backgroundColor: $colors.backgroundColor,
362
+ ':hover': {
363
+ boxShadow: 'inset 999px 999px 0px rgba(0, 0, 0, 0.04)'
364
+ },
365
+ ':active': {
366
+ boxShadow: 'inset 999px 999px 0px rgba(0, 0, 0, 0.08)'
367
+ }
368
+ };
369
+ }
370
+
355
371
  if ($disabled) {
356
372
  return Object.freeze({});
357
373
  }
@@ -14,6 +14,7 @@ export const BaseButton = styled<SharedStylePropsT>(
14
14
  ({
15
15
  $theme,
16
16
  $size,
17
+ $colors,
17
18
  $kind,
18
19
  $shape,
19
20
  $isLoading,
@@ -55,8 +56,14 @@ export const BaseButton = styled<SharedStylePropsT>(
55
56
  ...getFontStyles({$theme, $size}),
56
57
  ...getBorderRadiiStyles({$theme, $size, $shape}),
57
58
  ...getPaddingStyles({$theme, $size, $shape}),
58
- // Kind style override
59
- ...getKindStyles({$theme, $kind, $isLoading, $isSelected, $disabled}),
59
+ ...getColorStyles({
60
+ $theme,
61
+ $colors,
62
+ $kind,
63
+ $isLoading,
64
+ $isSelected,
65
+ $disabled,
66
+ }),
60
67
  ...getShapeStyles({$theme, $shape, $size}),
61
68
  }),
62
69
  );
@@ -302,26 +309,43 @@ function getPaddingStyles({$theme, $size, $shape}) {
302
309
  }
303
310
  }
304
311
 
305
- type KindStylesT = {|
312
+ type ColorStylesT = {|
306
313
  color?: string,
307
314
  backgroundColor?: string,
308
315
  ':hover'?: {
309
- backgroundColor: string,
316
+ boxShadow?: string,
317
+ backgroundColor?: string,
310
318
  },
311
319
  ':focus'?: {
312
- backgroundColor: string,
320
+ boxShadow?: string,
321
+ backgroundColor?: string,
313
322
  },
314
323
  ':active'?: {
315
- backgroundColor: string,
324
+ boxShadow?: string,
325
+ backgroundColor?: string,
316
326
  },
317
327
  |};
318
- function getKindStyles({
328
+ function getColorStyles({
319
329
  $theme,
330
+ $colors,
320
331
  $isLoading,
321
332
  $isSelected,
322
333
  $kind,
323
334
  $disabled,
324
- }): KindStylesT {
335
+ }): ColorStylesT {
336
+ if ($colors) {
337
+ return {
338
+ color: $colors.color,
339
+ backgroundColor: $colors.backgroundColor,
340
+ ':hover': {
341
+ boxShadow: 'inset 999px 999px 0px rgba(0, 0, 0, 0.04)',
342
+ },
343
+ ':active': {
344
+ boxShadow: 'inset 999px 999px 0px rgba(0, 0, 0, 0.08)',
345
+ },
346
+ };
347
+ }
348
+
325
349
  if ($disabled) {
326
350
  return Object.freeze({});
327
351
  }
@@ -19,8 +19,14 @@ export type OverridesT = {
19
19
  LoadingSpinner?: OverrideT,
20
20
  };
21
21
 
22
+ export type CustomColorsT = {|
23
+ backgroundColor: string,
24
+ color: string,
25
+ |};
26
+
22
27
  export type ButtonPropsT = {
23
28
  children?: React$Node,
29
+ colors?: CustomColorsT,
24
30
  disabled?: boolean,
25
31
  /** A helper rendered at the end of the button. */
26
32
  // eslint-disable-next-line flowtype/no-weak-types
@@ -44,6 +50,7 @@ export type ButtonPropsT = {
44
50
  };
45
51
 
46
52
  export type SharedStylePropsT = {
53
+ $colors?: CustomColorsT,
47
54
  $kind?: $Keys<typeof KIND>,
48
55
  $isSelected?: boolean,
49
56
  $shape?: $Keys<typeof SHAPE>,
package/button/utils.js CHANGED
@@ -12,13 +12,15 @@ This source code is licensed under the MIT license found in the
12
12
  LICENSE file in the root directory of this source tree.
13
13
  */
14
14
  function getSharedProps(_ref) {
15
- var disabled = _ref.disabled,
15
+ var colors = _ref.colors,
16
+ disabled = _ref.disabled,
16
17
  isLoading = _ref.isLoading,
17
18
  isSelected = _ref.isSelected,
18
19
  kind = _ref.kind,
19
20
  shape = _ref.shape,
20
21
  size = _ref.size;
21
22
  return {
23
+ $colors: colors,
22
24
  $disabled: disabled,
23
25
  $isLoading: isLoading,
24
26
  $isSelected: isSelected,
@@ -8,6 +8,7 @@ LICENSE file in the root directory of this source tree.
8
8
  import type {ButtonPropsT} from './types.js';
9
9
 
10
10
  export function getSharedProps({
11
+ colors,
11
12
  disabled,
12
13
  isLoading,
13
14
  isSelected,
@@ -16,6 +17,7 @@ export function getSharedProps({
16
17
  size,
17
18
  }: ButtonPropsT) {
18
19
  return {
20
+ $colors: colors,
19
21
  $disabled: disabled,
20
22
  $isLoading: isLoading,
21
23
  $isSelected: isSelected,
@@ -9,6 +9,7 @@ import { KIND, SIZE, SHAPE } from './constants.js';
9
9
  export const BaseButton = styled('button', ({
10
10
  $theme,
11
11
  $size,
12
+ $colors,
12
13
  $kind,
13
14
  $shape,
14
15
  $isLoading,
@@ -64,9 +65,9 @@ export const BaseButton = styled('button', ({
64
65
  $size,
65
66
  $shape
66
67
  }),
67
- // Kind style override
68
- ...getKindStyles({
68
+ ...getColorStyles({
69
69
  $theme,
70
+ $colors,
70
71
  $kind,
71
72
  $isLoading,
72
73
  $isSelected,
@@ -344,13 +345,27 @@ function getPaddingStyles({
344
345
  }
345
346
  }
346
347
 
347
- function getKindStyles({
348
+ function getColorStyles({
348
349
  $theme,
350
+ $colors,
349
351
  $isLoading,
350
352
  $isSelected,
351
353
  $kind,
352
354
  $disabled
353
355
  }) {
356
+ if ($colors) {
357
+ return {
358
+ color: $colors.color,
359
+ backgroundColor: $colors.backgroundColor,
360
+ ':hover': {
361
+ boxShadow: 'inset 999px 999px 0px rgba(0, 0, 0, 0.04)'
362
+ },
363
+ ':active': {
364
+ boxShadow: 'inset 999px 999px 0px rgba(0, 0, 0, 0.08)'
365
+ }
366
+ };
367
+ }
368
+
354
369
  if ($disabled) {
355
370
  return Object.freeze({});
356
371
  }
@@ -5,6 +5,7 @@ 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
7
  export function getSharedProps({
8
+ colors,
8
9
  disabled,
9
10
  isLoading,
10
11
  isSelected,
@@ -13,6 +14,7 @@ export function getSharedProps({
13
14
  size
14
15
  }) {
15
16
  return {
17
+ $colors: colors,
16
18
  $disabled: disabled,
17
19
  $isLoading: isLoading,
18
20
  $isSelected: isSelected,
@@ -15,6 +15,7 @@ import { KIND, SIZE, SHAPE } from './constants.js';
15
15
  export var BaseButton = styled('button', function (_ref) {
16
16
  var $theme = _ref.$theme,
17
17
  $size = _ref.$size,
18
+ $colors = _ref.$colors,
18
19
  $kind = _ref.$kind,
19
20
  $shape = _ref.$shape,
20
21
  $isLoading = _ref.$isLoading,
@@ -66,8 +67,9 @@ export var BaseButton = styled('button', function (_ref) {
66
67
  $theme: $theme,
67
68
  $size: $size,
68
69
  $shape: $shape
69
- })), getKindStyles({
70
+ })), getColorStyles({
70
71
  $theme: $theme,
72
+ $colors: $colors,
71
73
  $kind: $kind,
72
74
  $isLoading: $isLoading,
73
75
  $isSelected: $isSelected,
@@ -337,13 +339,27 @@ function getPaddingStyles(_ref12) {
337
339
  }
338
340
  }
339
341
 
340
- function getKindStyles(_ref13) {
342
+ function getColorStyles(_ref13) {
341
343
  var $theme = _ref13.$theme,
344
+ $colors = _ref13.$colors,
342
345
  $isLoading = _ref13.$isLoading,
343
346
  $isSelected = _ref13.$isSelected,
344
347
  $kind = _ref13.$kind,
345
348
  $disabled = _ref13.$disabled;
346
349
 
350
+ if ($colors) {
351
+ return {
352
+ color: $colors.color,
353
+ backgroundColor: $colors.backgroundColor,
354
+ ':hover': {
355
+ boxShadow: 'inset 999px 999px 0px rgba(0, 0, 0, 0.04)'
356
+ },
357
+ ':active': {
358
+ boxShadow: 'inset 999px 999px 0px rgba(0, 0, 0, 0.08)'
359
+ }
360
+ };
361
+ }
362
+
347
363
  if ($disabled) {
348
364
  return Object.freeze({});
349
365
  }
@@ -5,13 +5,15 @@ 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
7
  export function getSharedProps(_ref) {
8
- var disabled = _ref.disabled,
8
+ var colors = _ref.colors,
9
+ disabled = _ref.disabled,
9
10
  isLoading = _ref.isLoading,
10
11
  isSelected = _ref.isSelected,
11
12
  kind = _ref.kind,
12
13
  shape = _ref.shape,
13
14
  size = _ref.size;
14
15
  return {
16
+ $colors: colors,
15
17
  $disabled: disabled,
16
18
  $isLoading: isLoading,
17
19
  $isSelected: isSelected,
package/menu/index.d.ts CHANGED
@@ -107,7 +107,7 @@ export interface StatefulContainerProps {
107
107
  removeMenuFromNesting?: (ref: React.Ref<HTMLElement>) => void;
108
108
  getParentMenu?: (ref: React.Ref<HTMLElement>) => void;
109
109
  getChildMenu?: (ref: React.Ref<HTMLElement>) => void;
110
- nestedMenuHoverIndex?: nubmer;
110
+ nestedMenuHoverIndex?: number;
111
111
  isNestedMenuVisible?: (ref: React.Ref<HTMLElement>) => boolean;
112
112
  }
113
113
  export interface StatefulContainerState {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "baseui",
3
- "version": "0.0.0-next-e40d68e",
3
+ "version": "0.0.0-next-7c7b20c",
4
4
  "description": "A React Component library implementing the Base design language",
5
5
  "keywords": [
6
6
  "react",