@veracity/vui 0.2.1 → 0.2.3

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 (71) hide show
  1. package/avatar/theme.d.ts +5 -9
  2. package/avatar/theme.js +5 -18
  3. package/button/theme.js +1 -0
  4. package/checkbox/checkbox.js +5 -4
  5. package/checkbox/checkbox.types.d.ts +1 -1
  6. package/checkbox/checkboxGroup.types.d.ts +1 -1
  7. package/core/globalStyle.js +5 -6
  8. package/core/index.d.ts +1 -2
  9. package/core/index.js +2 -5
  10. package/core/resetCSS.js +2 -2
  11. package/core/styled.d.ts +192 -4
  12. package/core/styled.js +45 -7
  13. package/core/types/component.d.ts +2 -7
  14. package/core/types/index.d.ts +0 -2
  15. package/core/types/index.js +0 -2
  16. package/core/utils.d.ts +2 -2
  17. package/core/utils.js +8 -7
  18. package/icon/icon.types.d.ts +1 -2
  19. package/icons/types.d.ts +1 -1
  20. package/input/input.types.d.ts +1 -2
  21. package/link/context.d.ts +4 -0
  22. package/link/context.js +23 -0
  23. package/link/index.d.ts +2 -0
  24. package/link/index.js +2 -0
  25. package/link/link.d.ts +7 -1
  26. package/link/link.js +31 -3
  27. package/link/link.types.d.ts +5 -0
  28. package/link/linkIcon.d.ts +3 -0
  29. package/link/linkIcon.js +30 -0
  30. package/link/linkText.d.ts +3 -0
  31. package/link/linkText.js +30 -0
  32. package/link/theme.d.ts +27 -10
  33. package/link/theme.js +26 -12
  34. package/list/index.d.ts +1 -0
  35. package/list/index.js +1 -0
  36. package/list/list.d.ts +2 -0
  37. package/list/list.js +3 -1
  38. package/list/listDivider.d.ts +3 -0
  39. package/list/listDivider.js +30 -0
  40. package/list/listHeading.js +1 -1
  41. package/list/theme.d.ts +0 -16
  42. package/list/theme.js +6 -22
  43. package/package.json +2 -2
  44. package/radio/radio.types.d.ts +1 -1
  45. package/radio/radioGroup.js +0 -1
  46. package/radio/radioGroup.types.d.ts +1 -1
  47. package/switch/switch.types.d.ts +1 -1
  48. package/switch/theme.d.ts +0 -5
  49. package/switch/theme.js +4 -9
  50. package/system/custom.d.ts +0 -17
  51. package/system/custom.js +4 -21
  52. package/system/system.d.ts +2 -2
  53. package/system/system.js +1 -1
  54. package/tag/tag.js +6 -5
  55. package/tag/tag.types.d.ts +1 -0
  56. package/tag/tagButton.js +13 -2
  57. package/textarea/textarea.types.d.ts +1 -1
  58. package/theme/components.d.ts +32 -39
  59. package/theme/defaultTheme.d.ts +33 -39
  60. package/theme/foundations/index.d.ts +1 -0
  61. package/theme/foundations/transformers.d.ts +1 -0
  62. package/theme/foundations/transformers.js +26 -0
  63. package/utils/object.d.ts +4 -1
  64. package/utils/object.js +27 -28
  65. package/utils/types.d.ts +23 -1
  66. package/core/types/events.d.ts +0 -17
  67. package/core/types/events.js +0 -2
  68. package/core/types/styled.d.ts +0 -11
  69. package/core/types/styled.js +0 -2
  70. package/core/v.d.ts +0 -182
  71. package/core/v.js +0 -6
@@ -155,6 +155,7 @@ declare const defaultTheme: {
155
155
  sizes: {};
156
156
  spaces: {};
157
157
  transformers: {
158
+ border: (value: string | number, { props }: any) => string;
158
159
  space: (value: string | number) => string;
159
160
  };
160
161
  transforms: {};
@@ -188,16 +189,13 @@ declare const defaultTheme: {
188
189
  h: number;
189
190
  iconSize: string;
190
191
  };
192
+ xl: {
193
+ fontSize: string;
194
+ h: number;
195
+ iconSize: string;
196
+ };
191
197
  };
192
198
  variants: {
193
- outlined: (props: import("..").Dict<any>) => {
194
- borderColor: string;
195
- borderWidth: number;
196
- hoverBg: string;
197
- activeBg: string;
198
- bg: string;
199
- color: string;
200
- };
201
199
  solid: (props: import("..").Dict<any>) => {
202
200
  hoverBg: string;
203
201
  activeBg: string;
@@ -510,28 +508,45 @@ declare const defaultTheme: {
510
508
  size: string;
511
509
  variant: string;
512
510
  };
511
+ parts: string[];
513
512
  sizes: {
514
- xs: {
515
- fontSize: string;
516
- };
517
513
  sm: {
518
- fontSize: string;
514
+ container: {
515
+ fontSize: string;
516
+ };
517
+ icon: {
518
+ size: string;
519
+ };
519
520
  };
520
521
  md: {
521
- fontSize: string;
522
+ container: {
523
+ fontSize: string;
524
+ };
525
+ icon: {
526
+ size: string;
527
+ };
522
528
  };
523
529
  lg: {
524
- fontSize: string;
530
+ container: {
531
+ fontSize: string;
532
+ };
533
+ icon: {
534
+ size: string;
535
+ };
525
536
  };
526
537
  };
527
538
  variants: {
528
539
  default: (props: import("..").Dict<any>) => {
529
- color: string;
530
- hoverColor: string;
540
+ container: {
541
+ color: string;
542
+ hoverColor: string;
543
+ };
531
544
  };
532
545
  light: (props: import("..").Dict<any>) => {
533
- color: string;
534
- hoverColor: string;
546
+ container: {
547
+ color: string;
548
+ hoverColor: string;
549
+ };
535
550
  };
536
551
  };
537
552
  };
@@ -544,8 +559,6 @@ declare const defaultTheme: {
544
559
  parts: string[];
545
560
  sizes: {
546
561
  sm: {
547
- container: {};
548
- heading: {};
549
562
  icon: {
550
563
  size: string;
551
564
  };
@@ -553,11 +566,8 @@ declare const defaultTheme: {
553
566
  fontSize: string;
554
567
  h: number;
555
568
  };
556
- text: {};
557
569
  };
558
570
  md: {
559
- container: {};
560
- heading: {};
561
571
  icon: {
562
572
  size: string;
563
573
  };
@@ -565,11 +575,8 @@ declare const defaultTheme: {
565
575
  fontSize: string;
566
576
  h: number;
567
577
  };
568
- text: {};
569
578
  };
570
579
  lg: {
571
- container: {};
572
- heading: {};
573
580
  item: {
574
581
  fontSize: string;
575
582
  h: number;
@@ -577,11 +584,8 @@ declare const defaultTheme: {
577
584
  icon: {
578
585
  size: string;
579
586
  };
580
- text: {};
581
587
  };
582
588
  xl: {
583
- container: {};
584
- heading: {};
585
589
  item: {
586
590
  fontSize: string;
587
591
  h: number;
@@ -589,16 +593,11 @@ declare const defaultTheme: {
589
593
  icon: {
590
594
  scale: number;
591
595
  };
592
- text: {};
593
596
  };
594
597
  };
595
598
  variants: {
596
599
  default: (props: import("..").Dict<any>) => {
597
- container: {};
598
- heading: {};
599
- icon: {};
600
600
  item: import("..").Dict<any>;
601
- text: {};
602
601
  };
603
602
  ordered: {
604
603
  container: {
@@ -847,7 +846,6 @@ declare const defaultTheme: {
847
846
  parts: string[];
848
847
  sizes: {
849
848
  sm: () => {
850
- container: {};
851
849
  button: {
852
850
  fontSize: string;
853
851
  minW: number;
@@ -864,7 +862,6 @@ declare const defaultTheme: {
864
862
  };
865
863
  };
866
864
  md: () => {
867
- container: {};
868
865
  button: {
869
866
  fontSize: string;
870
867
  minW: number;
@@ -881,7 +878,6 @@ declare const defaultTheme: {
881
878
  };
882
879
  };
883
880
  lg: () => {
884
- container: {};
885
881
  button: {
886
882
  fontSize: string;
887
883
  minW: number;
@@ -900,7 +896,6 @@ declare const defaultTheme: {
900
896
  };
901
897
  variants: {
902
898
  contained: (props: import("..").Dict<any>) => {
903
- container: {};
904
899
  button: {
905
900
  thumb: {
906
901
  bg: string;
@@ -910,7 +905,6 @@ declare const defaultTheme: {
910
905
  ring: number;
911
906
  };
912
907
  };
913
- label: {};
914
908
  };
915
909
  };
916
910
  };
@@ -155,6 +155,7 @@ declare const _default: {
155
155
  sizes: {};
156
156
  spaces: {};
157
157
  transformers: {
158
+ border: (value: string | number, { props }: any) => string;
158
159
  space: (value: string | number) => string;
159
160
  };
160
161
  transforms: {};
@@ -1,4 +1,5 @@
1
1
  declare const _default: {
2
+ border: (value: number | string, { props }: any) => string;
2
3
  space: (value: string | number) => string;
3
4
  };
4
5
  export default _default;
@@ -1,6 +1,32 @@
1
1
  "use strict";
2
+ var __read = (this && this.__read) || function (o, n) {
3
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
4
+ if (!m) return o;
5
+ var i = m.call(o), r, ar = [], e;
6
+ try {
7
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
8
+ }
9
+ catch (error) { e = { error: error }; }
10
+ finally {
11
+ try {
12
+ if (r && !r.done && (m = i["return"])) m.call(i);
13
+ }
14
+ finally { if (e) throw e.error; }
15
+ }
16
+ return ar;
17
+ };
2
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
+ var system_1 = require("@xstyled/system");
3
20
  exports.default = {
21
+ border: function (value, _a) {
22
+ var props = _a.props;
23
+ if (typeof value === 'number')
24
+ return value + "px solid";
25
+ var values = value.split(' ');
26
+ var _b = __read(values, 3), width = _b[0], style = _b[1], color = _b[2];
27
+ var colorValue = (0, system_1.getColor)(color)(props);
28
+ return width + " " + style + " " + colorValue;
29
+ },
4
30
  space: function (value) {
5
31
  return typeof value === 'string' ? value : value * 8 + "px";
6
32
  }
package/utils/object.d.ts CHANGED
@@ -7,7 +7,10 @@ export declare const filterUndefined: (object: Dict) => Dict<any>;
7
7
  * - Key exists in target and both keys are arrays => concat (not unique)
8
8
  * - Key isn't an object, an array or doesn't exist in target => override
9
9
  */
10
- export declare function merge<Target extends Dict, Source extends Dict>(target: Target, source: Source): Target & Source;
10
+ export declare function merge<S1 extends Dict>(s1: S1): S1;
11
+ export declare function merge<S1 extends Dict, S2 extends Dict>(s1: S1, s2: S2): S1 & S2;
12
+ export declare function merge<S1 extends Dict, S2 extends Dict, S3 extends Dict>(s1: S1, s2: S2, s3: S3): S1 & S2 & S3;
13
+ export declare function merge<S1 extends Dict, S2 extends Dict, S3 extends Dict, S4 extends Dict>(s1: S1, s2: S2, s3: S3, s4: S4): S1 & S2 & S3 & S4;
11
14
  /**
12
15
  * Returns the items of an object that meet the condition specified in a callback function.
13
16
  */
package/utils/object.js CHANGED
@@ -1,46 +1,45 @@
1
1
  "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
2
  Object.defineProperty(exports, "__esModule", { value: true });
14
3
  exports.objectFilter = exports.merge = exports.filterUndefined = void 0;
15
4
  var assertion_1 = require("./assertion");
16
5
  /** Removes keys from an object if their value is undefined. */
17
6
  var filterUndefined = function (object) { return objectFilter(object, function (val) { return val !== null && val !== undefined; }); };
18
7
  exports.filterUndefined = filterUndefined;
19
- /**
20
- * Recursively deep merges two objects in an immutable fashion, following these rules:
21
- * - Key exists in target and both keys are objects => merge
22
- * - Key exists in target and both keys are arrays => concat (not unique)
23
- * - Key isn't an object, an array or doesn't exist in target => override
24
- */
25
- function merge(target, source) {
26
- var output = __assign({}, target);
27
- if ((0, assertion_1.isObject)(target) && (0, assertion_1.isObject)(source)) {
8
+ function merge() {
9
+ var sources = [];
10
+ for (var _i = 0; _i < arguments.length; _i++) {
11
+ sources[_i] = arguments[_i];
12
+ }
13
+ var target = {};
14
+ sources.forEach(function (source) {
15
+ if (!(0, assertion_1.isObject)(source))
16
+ return;
28
17
  Object.keys(source).forEach(function (key) {
29
- var _a;
30
18
  if (key === '__proto__')
31
19
  return;
32
- if (key in target && (0, assertion_1.isObject)(target[key]) && (0, assertion_1.isObject)(source[key])) {
33
- output[key] = merge(target[key], source[key]);
20
+ if (target[key] === undefined) {
21
+ // Key not in target yet, assign source
22
+ target[key] = source[key];
34
23
  }
35
- else if (key in target && (0, assertion_1.isArray)(target[key]) && (0, assertion_1.isArray)(source[key])) {
36
- output[key] = (_a = target[key]) === null || _a === void 0 ? void 0 : _a.concat(source[key]);
24
+ else if (typeof target[key] === typeof source[key]) {
25
+ // Same types
26
+ if ((0, assertion_1.isObject)(source[key])) {
27
+ target[key] = merge(target[key], source[key]);
28
+ }
29
+ else if ((0, assertion_1.isArray)(source[key])) {
30
+ target[key] = target[key].concat(source[key]);
31
+ }
32
+ else {
33
+ target[key] = source[key];
34
+ }
35
+ // Different types
37
36
  }
38
37
  else {
39
- output[key] = source[key];
38
+ return;
40
39
  }
41
40
  });
42
- }
43
- return output;
41
+ });
42
+ return target;
44
43
  }
45
44
  exports.merge = merge;
46
45
  /**
package/utils/types.d.ts CHANGED
@@ -1,5 +1,27 @@
1
- /// <reference types="react" />
1
+ import React, { ComponentPropsWithoutRef, ComponentPropsWithRef, ElementType } from 'react';
2
2
  export declare type AnyElement = React.ReactNode & {};
3
3
  export declare type AnyNumber = number & {};
4
4
  export declare type AnyString = string & {};
5
+ /** Type of change event defaulted to input element */
6
+ export declare type ChangeEvent<T = HTMLInputElement> = React.ChangeEvent<T>;
7
+ /** Type of change event handler defaulted to input element */
8
+ export declare type ChangeEventHandler<T = HTMLInputElement> = React.ChangeEventHandler<T>;
5
9
  export declare type Dict<T = any> = Record<string, T>;
10
+ /** Type of blur/focus event defaulted to any html element */
11
+ export declare type FocusEvent<T = HTMLElement> = React.FocusEvent<T>;
12
+ /** Type of blur/focus event handler defaulted to any html element */
13
+ export declare type FocusEventHandler<T = HTMLElement> = React.FocusEventHandler<T>;
14
+ /** Type of keyboard event defaulted to any html element */
15
+ export declare type KeyboardEvent<T = HTMLElement> = React.KeyboardEvent<T>;
16
+ /** Type of keyboard event handler defaulted to any html element */
17
+ export declare type KeyboardEventHandler<T = HTMLElement> = React.KeyboardEventHandler<T>;
18
+ /** Type of mouse event defaulted to any html element */
19
+ export declare type MouseEvent<T = HTMLElement> = React.MouseEvent<T>;
20
+ /** Type of mouse event handler defaulted to any html element */
21
+ export declare type MouseEventHandler<T = HTMLElement> = React.MouseEventHandler<T>;
22
+ /** Merges component/element base props and custom props */
23
+ export declare type PropsOf<C extends ElementType, Props = {}> = RightJoinProps<ComponentPropsWithoutRef<C>, Props>;
24
+ /** Merges component/element base props and custom props including ref */
25
+ export declare type RefPropsOf<C extends ElementType, Props = {}> = RightJoinProps<ComponentPropsWithRef<C>, Props>;
26
+ /** Merges props definitions, overriding source keys */
27
+ export declare type RightJoinProps<SourceProps, OverrideProps> = Omit<SourceProps, keyof OverrideProps> & OverrideProps;
@@ -1,17 +0,0 @@
1
- import React from 'react';
2
- /** Type of change event defaulted to input element */
3
- export declare type ChangeEvent<T = HTMLInputElement> = React.ChangeEvent<T>;
4
- /** Type of change event handler defaulted to input element */
5
- export declare type ChangeEventHandler<T = HTMLInputElement> = React.ChangeEventHandler<T>;
6
- /** Type of blur/focus event defaulted to any html element */
7
- export declare type FocusEvent<T = HTMLElement> = React.FocusEvent<T>;
8
- /** Type of blur/focus event handler defaulted to any html element */
9
- export declare type FocusEventHandler<T = HTMLElement> = React.FocusEventHandler<T>;
10
- /** Type of keyboard event defaulted to any html element */
11
- export declare type KeyboardEvent<T = HTMLElement> = React.KeyboardEvent<T>;
12
- /** Type of keyboard event handler defaulted to any html element */
13
- export declare type KeyboardEventHandler<T = HTMLElement> = React.KeyboardEventHandler<T>;
14
- /** Type of mouse event defaulted to any html element */
15
- export declare type MouseEvent<T = HTMLElement> = React.MouseEvent<T>;
16
- /** Type of mouse event handler defaulted to any html element */
17
- export declare type MouseEventHandler<T = HTMLElement> = React.MouseEventHandler<T>;
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,11 +0,0 @@
1
- /// <reference types="react" />
2
- import { AnyStyledComponent, DefaultTheme, StyledComponentInnerAttrs, StyledComponentInnerComponent, StyledComponentInnerOtherProps, ThemedStyledFunction } from 'styled-components';
3
- import { SystemProps } from '../../system';
4
- declare type ThemedStyledComponentFactories<T extends object> = {
5
- [TTag in keyof JSX.IntrinsicElements]: ThemedStyledFunction<TTag, T, SystemProps>;
6
- };
7
- export interface VStyled<T extends object = DefaultTheme> extends ThemedStyledComponentFactories<T> {
8
- <C extends AnyStyledComponent>(component: C): ThemedStyledFunction<StyledComponentInnerComponent<C>, T, StyledComponentInnerOtherProps<C> & SystemProps, StyledComponentInnerAttrs<C>>;
9
- <C extends keyof JSX.IntrinsicElements | React.ComponentType<any>>(component: C): ThemedStyledFunction<C, T, SystemProps>;
10
- }
11
- export {};
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });