@veracity/vui 0.0.15 → 0.2.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 (195) hide show
  1. package/avatar/avatar.js +2 -2
  2. package/box/box.js +1 -1
  3. package/button/button.d.ts +7 -1
  4. package/button/button.js +56 -23
  5. package/button/button.types.d.ts +8 -6
  6. package/button/buttonIcon.d.ts +3 -0
  7. package/{alert/alertText.js → button/buttonIcon.js} +9 -9
  8. package/button/buttonText.d.ts +3 -0
  9. package/button/buttonText.js +30 -0
  10. package/button/buttons.d.ts +4 -3
  11. package/button/buttons.js +4 -3
  12. package/button/consts.js +3 -2
  13. package/button/context.d.ts +2 -2
  14. package/button/context.js +4 -4
  15. package/button/index.d.ts +2 -2
  16. package/button/index.js +2 -2
  17. package/button/theme.d.ts +79 -41
  18. package/button/theme.js +85 -46
  19. package/{button → buttonGroup}/buttonGroup.d.ts +3 -1
  20. package/{button → buttonGroup}/buttonGroup.js +4 -2
  21. package/buttonGroup/context.d.ts +4 -0
  22. package/buttonGroup/context.js +23 -0
  23. package/buttonGroup/helpers.d.ts +3 -0
  24. package/buttonGroup/helpers.js +10 -0
  25. package/buttonGroup/index.d.ts +4 -0
  26. package/{alert → buttonGroup}/index.js +4 -8
  27. package/card/card.d.ts +3 -0
  28. package/{tile/tile.js → card/card.js} +8 -7
  29. package/{tile/tile.types.d.ts → card/card.types.d.ts} +1 -1
  30. package/card/index.d.ts +3 -0
  31. package/{tile → card}/index.js +4 -4
  32. package/card/theme.d.ts +6 -0
  33. package/card/theme.js +10 -0
  34. package/checkbox/checkbox.js +4 -4
  35. package/checkbox/checkbox.types.d.ts +1 -1
  36. package/checkbox/checkboxGroup.types.d.ts +1 -1
  37. package/core/globalStyle.d.ts +4 -1
  38. package/core/globalStyle.js +7 -3
  39. package/core/index.d.ts +2 -0
  40. package/core/index.js +5 -1
  41. package/core/styled.d.ts +4 -0
  42. package/core/styled.js +80 -0
  43. package/core/types/component.d.ts +12 -12
  44. package/core/types/index.d.ts +1 -0
  45. package/core/types/index.js +1 -0
  46. package/core/types/styled.d.ts +11 -0
  47. package/core/utils.d.ts +2 -2
  48. package/core/utils.js +7 -7
  49. package/core/v.d.ts +182 -0
  50. package/core/v.js +6 -0
  51. package/core/vuiProvider.d.ts +13 -2
  52. package/core/vuiProvider.js +1 -1
  53. package/divider/divider.types.d.ts +1 -1
  54. package/heading/heading.types.d.ts +2 -1
  55. package/icon/helpers.d.ts +2 -3
  56. package/icon/helpers.js +6 -8
  57. package/icon/icon.js +3 -2
  58. package/icon/icon.types.d.ts +4 -2
  59. package/icons/library.js +1 -1
  60. package/icons/types.d.ts +1 -1
  61. package/image/image.d.ts +3 -0
  62. package/image/image.js +38 -0
  63. package/image/image.types.d.ts +5 -0
  64. package/image/index.d.ts +3 -0
  65. package/{label → image}/index.js +4 -4
  66. package/image/theme.d.ts +6 -0
  67. package/image/theme.js +10 -0
  68. package/index.d.ts +6 -3
  69. package/index.js +6 -3
  70. package/input/context.d.ts +4 -0
  71. package/{alert → input}/context.js +4 -4
  72. package/input/index.d.ts +2 -0
  73. package/input/index.js +2 -0
  74. package/input/input.d.ts +7 -2
  75. package/input/input.js +33 -22
  76. package/input/input.types.d.ts +7 -3
  77. package/input/inputIcon.d.ts +3 -0
  78. package/input/inputIcon.js +30 -0
  79. package/input/inputInput.d.ts +5 -0
  80. package/input/inputInput.js +36 -0
  81. package/input/theme.d.ts +40 -15
  82. package/input/theme.js +40 -16
  83. package/list/index.d.ts +3 -1
  84. package/list/index.js +3 -1
  85. package/list/list.d.ts +2 -0
  86. package/list/list.js +3 -1
  87. package/list/list.types.d.ts +19 -1
  88. package/list/listHeading.d.ts +2 -2
  89. package/list/listHeading.js +2 -2
  90. package/list/listIcon.js +1 -1
  91. package/list/listItem.d.ts +1 -1
  92. package/list/listItem.js +8 -5
  93. package/list/listText.d.ts +3 -0
  94. package/list/listText.js +30 -0
  95. package/list/theme.d.ts +20 -6
  96. package/list/theme.js +26 -12
  97. package/notification/consts.d.ts +2 -0
  98. package/{alert → notification}/consts.js +7 -7
  99. package/notification/context.d.ts +4 -0
  100. package/notification/context.js +23 -0
  101. package/notification/index.d.ts +8 -0
  102. package/notification/index.js +25 -0
  103. package/notification/notification.d.ts +13 -0
  104. package/{alert/alert.js → notification/notification.js} +25 -25
  105. package/notification/notification.types.d.ts +20 -0
  106. package/notification/notificationButton.d.ts +3 -0
  107. package/{alert/alertButton.js → notification/notificationButton.js} +8 -8
  108. package/notification/notificationIcon.d.ts +3 -0
  109. package/{alert/alertIcon.js → notification/notificationIcon.js} +9 -9
  110. package/notification/notificationText.d.ts +3 -0
  111. package/notification/notificationText.js +30 -0
  112. package/notification/notificationTitle.d.ts +3 -0
  113. package/notification/notificationTitle.js +30 -0
  114. package/{alert → notification}/theme.d.ts +0 -15
  115. package/{alert → notification}/theme.js +1 -22
  116. package/package.json +2 -3
  117. package/panel/index.d.ts +3 -0
  118. package/panel/index.js +20 -0
  119. package/panel/panel.d.ts +3 -0
  120. package/panel/panel.js +39 -0
  121. package/panel/panel.types.d.ts +4 -0
  122. package/{tile → panel}/theme.d.ts +1 -8
  123. package/{tile → panel}/theme.js +4 -11
  124. package/radio/radio.js +4 -4
  125. package/radio/radio.types.d.ts +1 -1
  126. package/radio/radioGroup.types.d.ts +1 -1
  127. package/skeleton/skeleton.types.d.ts +1 -0
  128. package/spinner/spinner.types.d.ts +1 -0
  129. package/svg/cache.js +1 -5
  130. package/svg/svg.js +2 -3
  131. package/switch/index.d.ts +0 -1
  132. package/switch/index.js +0 -1
  133. package/switch/switch.js +6 -6
  134. package/switch/switch.types.d.ts +19 -4
  135. package/switch/switchButton.d.ts +2 -2
  136. package/switch/switchButton.js +18 -19
  137. package/switch/theme.d.ts +41 -46
  138. package/switch/theme.js +50 -72
  139. package/system/borders.d.ts +3 -1
  140. package/system/custom.d.ts +24 -7
  141. package/system/custom.js +33 -13
  142. package/system/system.d.ts +2 -2
  143. package/system/system.js +1 -1
  144. package/t/t.types.d.ts +2 -1
  145. package/tag/context.d.ts +4 -0
  146. package/tag/context.js +23 -0
  147. package/tag/index.d.ts +6 -0
  148. package/tag/index.js +23 -0
  149. package/tag/tag.d.ts +11 -0
  150. package/tag/tag.js +99 -0
  151. package/{label/label.types.d.ts → tag/tag.types.d.ts} +6 -7
  152. package/tag/tag.types.js +2 -0
  153. package/tag/tagIcon.d.ts +3 -0
  154. package/{alert/alertTitle.js → tag/tagIcon.js} +9 -9
  155. package/tag/tagText.d.ts +3 -0
  156. package/tag/tagText.js +30 -0
  157. package/tag/theme.d.ts +65 -0
  158. package/tag/theme.js +78 -0
  159. package/textarea/textarea.js +2 -1
  160. package/textarea/textarea.types.d.ts +1 -0
  161. package/theme/components.d.ts +291 -223
  162. package/theme/components.js +32 -28
  163. package/theme/defaultTheme.d.ts +291 -223
  164. package/utils/assertion.d.ts +14 -0
  165. package/utils/assertion.js +34 -0
  166. package/utils/index.d.ts +1 -0
  167. package/utils/index.js +1 -0
  168. package/utils/object.d.ts +5 -18
  169. package/utils/object.js +17 -50
  170. package/utils/types.d.ts +2 -0
  171. package/alert/alert.d.ts +0 -13
  172. package/alert/alert.types.d.ts +0 -20
  173. package/alert/alertButton.d.ts +0 -3
  174. package/alert/alertIcon.d.ts +0 -3
  175. package/alert/alertText.d.ts +0 -3
  176. package/alert/alertTitle.d.ts +0 -3
  177. package/alert/consts.d.ts +0 -2
  178. package/alert/context.d.ts +0 -4
  179. package/alert/index.d.ts +0 -8
  180. package/label/index.d.ts +0 -3
  181. package/label/label.d.ts +0 -5
  182. package/label/label.js +0 -71
  183. package/label/theme.d.ts +0 -61
  184. package/label/theme.js +0 -107
  185. package/list/listItem.types.d.ts +0 -16
  186. package/switch/switchButton.types.d.ts +0 -19
  187. package/tile/index.d.ts +0 -3
  188. package/tile/tile.d.ts +0 -3
  189. /package/{button → buttonGroup}/buttonGroup.types.d.ts +0 -0
  190. /package/{button → buttonGroup}/buttonGroup.types.js +0 -0
  191. /package/{alert/alert.types.js → card/card.types.js} +0 -0
  192. /package/{label/label.types.js → core/types/styled.js} +0 -0
  193. /package/{list/listItem.types.js → image/image.types.js} +0 -0
  194. /package/{switch/switchButton.types.js → notification/notification.types.js} +0 -0
  195. /package/{tile/tile.types.js → panel/panel.types.js} +0 -0
package/switch/theme.js CHANGED
@@ -1,109 +1,87 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- function sizeLg(props) {
4
- var variant = props.variant;
3
+ function sizeLg() {
4
+ var container = {};
5
5
  var button = {
6
- fontSize: 'md'
6
+ fontSize: 'md',
7
+ minW: 50,
8
+ thumb: {
9
+ h: 24,
10
+ w: 24
11
+ },
12
+ track: {
13
+ h: 28
14
+ }
7
15
  };
8
16
  var label = {
9
17
  size: 'lg'
10
18
  };
11
- var thumb = {
12
- h: 24,
13
- w: 24
14
- };
15
- var track = {
16
- h: 28,
17
- minW: 50
18
- };
19
- if (variant === 'thin') {
20
- track.h = 18;
21
- track.minW = 40;
22
- }
23
- return { button: button, label: label, thumb: thumb, track: track };
19
+ return { container: container, button: button, label: label };
24
20
  }
25
- function sizeMd(props) {
26
- var variant = props.variant;
21
+ function sizeMd() {
22
+ var container = {};
27
23
  var button = {
28
- fontSize: 'sm'
24
+ fontSize: 'sm',
25
+ minW: 42,
26
+ thumb: {
27
+ h: 20,
28
+ w: 20
29
+ },
30
+ track: {
31
+ h: 24
32
+ }
29
33
  };
30
34
  var label = {
31
35
  size: 'md'
32
36
  };
33
- var thumb = {
34
- h: 20,
35
- w: 20
36
- };
37
- var track = {
38
- h: 24,
39
- minW: 42
40
- };
41
- if (variant === 'thin') {
42
- track.h = 14;
43
- track.minW = 32;
44
- }
45
- return { button: button, label: label, thumb: thumb, track: track };
37
+ return { container: container, button: button, label: label };
46
38
  }
47
- function sizeSm(props) {
48
- var variant = props.variant;
39
+ function sizeSm() {
40
+ var container = {};
49
41
  var button = {
50
- fontSize: 'xs'
42
+ fontSize: 'xs',
43
+ minW: 34,
44
+ thumb: {
45
+ h: 16,
46
+ w: 16
47
+ },
48
+ track: {
49
+ h: 20
50
+ }
51
51
  };
52
52
  var label = {
53
53
  size: 'sm'
54
54
  };
55
- var thumb = {
56
- h: 16,
57
- w: 16
58
- };
59
- var track = {
60
- h: 20,
61
- minW: 34
62
- };
63
- if (variant === 'thin') {
64
- track.h = 10;
65
- track.minW = 24;
66
- }
67
- return { button: button, label: label, thumb: thumb, track: track };
55
+ return { container: container, button: button, label: label };
68
56
  }
69
57
  function variantContained(props) {
70
58
  var c = props.colorScheme;
71
- var thumb = {
72
- bg: 'white'
73
- };
74
- var track = {
75
- bg: c + ".80",
76
- ring: 3
77
- };
78
- return { thumb: thumb, track: track };
79
- }
80
- function variantThin(props) {
81
- var c = props.colorScheme;
82
- var thumb = {
83
- bg: 'white',
84
- borderColor: c + ".80",
85
- borderWidth: 1,
86
- ring: 3
87
- };
88
- var track = {
89
- bg: c + ".80"
90
- };
91
- return { thumb: thumb, track: track };
59
+ var container = {};
60
+ var button = {
61
+ thumb: {
62
+ bg: 'white'
63
+ },
64
+ track: {
65
+ bg: c + ".80",
66
+ ring: 3
67
+ }
68
+ };
69
+ var label = {};
70
+ return { container: container, button: button, label: label };
92
71
  }
93
72
  var defaultProps = {
94
73
  colorScheme: 'blue',
95
74
  size: 'md',
96
75
  variant: 'contained'
97
76
  };
98
- var parts = ['container', 'button', 'label', 'track', 'thumb'];
77
+ var parts = ['container', 'button', 'label'];
99
78
  var sizes = {
100
79
  sm: sizeSm,
101
80
  md: sizeMd,
102
81
  lg: sizeLg
103
82
  };
104
83
  var variants = {
105
- contained: variantContained,
106
- thin: variantThin
84
+ contained: variantContained
107
85
  };
108
86
  exports.default = {
109
87
  defaultProps: defaultProps,
@@ -77,7 +77,7 @@ export interface BorderStyleProps {
77
77
  borderStyle?: BorderStyleProp;
78
78
  hoverBorderStyle?: BorderStyleProp;
79
79
  }
80
- declare type BorderRadiusProp = SystemProp<RadiusGetter, VuiTheme>;
80
+ export declare type BorderRadiusProp = SystemProp<RadiusGetter, VuiTheme>;
81
81
  export interface BorderRadiusProps {
82
82
  borderRadius?: BorderRadiusProp;
83
83
  hoverBorderRadius?: BorderRadiusProp;
@@ -129,6 +129,7 @@ export interface RingProps {
129
129
  focusRing?: RingProp;
130
130
  focusVisibleRing?: RingProp;
131
131
  focusWithinRing?: RingProp;
132
+ hoverRing?: RingProp;
132
133
  }
133
134
  declare type RingColorProp = SystemProp<ColorGetter, VuiTheme>;
134
135
  export interface RingColorProps {
@@ -136,6 +137,7 @@ export interface RingColorProps {
136
137
  focusRingColor?: RingColorProp;
137
138
  focusVisibleRingColor?: RingColorProp;
138
139
  focusWithinRingColor?: RingColorProp;
140
+ hoverRingColor?: RingColorProp;
139
141
  }
140
142
  export interface BordersProps extends BorderProps, BorderTopProps, BorderRightProps, BorderBottomProps, BorderLeftProps, BorderColorProps, BorderTopColorProps, BorderRightColorProps, BorderBottomColorProps, BorderLeftColorProps, BorderWidthProps, BorderTopWidthProps, BorderRightWidthProps, BorderBottomWidthProps, BorderLeftWidthProps, BorderStyleProps, BorderRadiusProps, OutlineProps, OutlineColorProps, OutlineWidthProps, OutlineStyleProps, DivideXProps, DivideYProps, DivideXReverseProps, DivideYReverseProps, DivideColorProps, DivideStyleProps, RingProps, RingColorProps {
141
143
  }
@@ -1,14 +1,31 @@
1
- /** Provides styling to truncate multi-line text. */
2
- export declare const maxLines: import("@xstyled/system").StyleGenerator;
3
- export interface MaxLinesProps {
4
- maxLines?: number;
1
+ import { BorderRadiusProp } from './borders';
2
+ export interface BorderRadiusBottomProps {
3
+ borderRadiusBottom?: BorderRadiusProp;
5
4
  }
6
- /** Provides styling to truncate single-line text. */
7
- export declare const isTruncated: import("@xstyled/system").StyleGenerator;
8
- export declare const wordBreak: import("@xstyled/system").StyleGenerator;
5
+ export declare const borderRadiusBottom: import("@xstyled/system").StyleGenerator;
6
+ export interface BorderRadiusLeftProps {
7
+ borderRadiusLeft?: BorderRadiusProp;
8
+ }
9
+ export declare const borderRadiusLeft: import("@xstyled/system").StyleGenerator;
10
+ export interface BorderRadiusRightProps {
11
+ borderRadiusRight?: BorderRadiusProp;
12
+ }
13
+ export declare const borderRadiusRight: import("@xstyled/system").StyleGenerator;
14
+ export interface BorderRadiusTopProps {
15
+ borderRadiusTop?: BorderRadiusProp;
16
+ }
17
+ export declare const borderRadiusTop: import("@xstyled/system").StyleGenerator;
9
18
  export interface IsTruncatedProps {
10
19
  isTruncated?: boolean;
11
20
  }
21
+ /** Provides styling to truncate single-line text. */
22
+ export declare const isTruncated: import("@xstyled/system").StyleGenerator;
23
+ export interface MaxLinesProps {
24
+ maxLines?: number;
25
+ }
26
+ /** Provides styling to truncate multi-line text. */
27
+ export declare const maxLines: import("@xstyled/system").StyleGenerator;
12
28
  export declare type WordBreakProps = {
13
29
  wordBreak?: 'normal' | 'break-all' | 'keep-all' | 'break-word';
14
30
  };
31
+ export declare const wordBreak: import("@xstyled/system").StyleGenerator;
package/system/custom.js CHANGED
@@ -1,19 +1,26 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.wordBreak = exports.isTruncated = exports.maxLines = void 0;
3
+ exports.wordBreak = exports.maxLines = exports.isTruncated = exports.borderRadiusTop = exports.borderRadiusRight = exports.borderRadiusLeft = exports.borderRadiusBottom = void 0;
4
4
  var system_1 = require("@xstyled/system");
5
- /** Provides styling to truncate multi-line text. */
6
- exports.maxLines = system_1.style({
7
- prop: 'maxLines',
8
- cssProperty: function (value) {
9
- return {
10
- display: '-webkit-box',
11
- overflow: 'hidden',
12
- '-webkit-line-clamp': "" + value,
13
- '-webkit-box-orient': 'vertical'
14
- };
15
- },
16
- states: {}
5
+ exports.borderRadiusBottom = system_1.style({
6
+ prop: 'borderRadiusBottom',
7
+ themeGet: system_1.getRadius,
8
+ cssProperty: ['borderBottomLeftRadius', 'borderBottomRightRadius']
9
+ });
10
+ exports.borderRadiusLeft = system_1.style({
11
+ prop: 'borderRadiusLeft',
12
+ themeGet: system_1.getRadius,
13
+ cssProperty: ['borderBottomLeftRadius', 'borderTopLeftRadius']
14
+ });
15
+ exports.borderRadiusRight = system_1.style({
16
+ prop: 'borderRadiusRight',
17
+ themeGet: system_1.getRadius,
18
+ cssProperty: ['borderBottomRightRadius', 'borderTopRightRadius']
19
+ });
20
+ exports.borderRadiusTop = system_1.style({
21
+ prop: 'borderRadiusTop',
22
+ themeGet: system_1.getRadius,
23
+ cssProperty: ['borderTopLeftRadius', 'borderTopRightRadius']
17
24
  });
18
25
  /** Provides styling to truncate single-line text. */
19
26
  exports.isTruncated = system_1.style({
@@ -27,6 +34,19 @@ exports.isTruncated = system_1.style({
27
34
  },
28
35
  states: {}
29
36
  });
37
+ /** Provides styling to truncate multi-line text. */
38
+ exports.maxLines = system_1.style({
39
+ prop: 'maxLines',
40
+ cssProperty: function (value) {
41
+ return {
42
+ display: '-webkit-box',
43
+ overflow: 'hidden',
44
+ '-webkit-line-clamp': "" + value,
45
+ '-webkit-box-orient': 'vertical'
46
+ };
47
+ },
48
+ states: {}
49
+ });
30
50
  exports.wordBreak = system_1.style({
31
51
  prop: 'wordBreak'
32
52
  });
@@ -4,14 +4,14 @@ import { BordersProps } from './borders';
4
4
  import { EffectsProps } from './effects';
5
5
  import { FlexboxesProps } from './flexboxes';
6
6
  import { InteractivityProps } from './interactivity';
7
- import { IsTruncatedProps, MaxLinesProps, WordBreakProps } from './custom';
7
+ import { BorderRadiusBottomProps, BorderRadiusLeftProps, BorderRadiusRightProps, BorderRadiusTopProps, IsTruncatedProps, MaxLinesProps, WordBreakProps } from './custom';
8
8
  import { LayoutProps } from './layout';
9
9
  import { SizingProps } from './sizing';
10
10
  import { SpaceProps } from './space';
11
11
  import { TransformsProps } from './transforms';
12
12
  import { TransitionsProps } from './transitions';
13
13
  import { TypographyProps } from './typography';
14
- export interface SystemProps extends AnimationsProps, BackgroundColorProps, BordersProps, EffectsProps, FlexboxesProps, InteractivityProps, IsTruncatedProps, LayoutProps, MaxLinesProps, SizingProps, SpaceProps, TransformsProps, TransitionsProps, TypographyProps, WordBreakProps {
14
+ export interface SystemProps extends AnimationsProps, BackgroundColorProps, BordersProps, BorderRadiusBottomProps, BorderRadiusLeftProps, BorderRadiusRightProps, BorderRadiusTopProps, EffectsProps, FlexboxesProps, InteractivityProps, IsTruncatedProps, LayoutProps, MaxLinesProps, SizingProps, SpaceProps, TransformsProps, TransitionsProps, TypographyProps, WordBreakProps {
15
15
  }
16
16
  declare const _default: import("@xstyled/system").StyleGenerator;
17
17
  export default _default;
package/system/system.js CHANGED
@@ -2,4 +2,4 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  var system_1 = require("@xstyled/system");
4
4
  var custom_1 = require("./custom");
5
- exports.default = system_1.compose(system_1.animation, system_1.backgroundColor, system_1.borders, system_1.color, system_1.effects, system_1.flexboxes, system_1.interactivity, custom_1.isTruncated, system_1.layout, custom_1.maxLines, system_1.sizing, system_1.space, system_1.transforms, system_1.transitions, system_1.typography, custom_1.wordBreak);
5
+ exports.default = system_1.compose(system_1.animation, system_1.backgroundColor, system_1.borders, custom_1.borderRadiusBottom, custom_1.borderRadiusLeft, custom_1.borderRadiusRight, custom_1.borderRadiusTop, system_1.color, system_1.effects, system_1.flexboxes, system_1.interactivity, custom_1.isTruncated, system_1.layout, custom_1.maxLines, system_1.sizing, system_1.space, system_1.transforms, system_1.transitions, system_1.typography, custom_1.wordBreak);
package/t/t.types.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { ReactText } from 'react';
1
2
  import { SystemProps, TypographyProps } from '../system';
2
3
  import { ThemingProps } from '../theme';
3
4
  export interface TProps extends SystemProps, ThemingProps<'T'> {
@@ -5,6 +6,6 @@ export interface TProps extends SystemProps, ThemingProps<'T'> {
5
6
  casing?: TypographyProps['textTransform'];
6
7
  centerV?: boolean;
7
8
  decoration?: TypographyProps['textDecoration'];
8
- text?: number | string;
9
+ text?: ReactText;
9
10
  weight?: TypographyProps['fontWeight'];
10
11
  }
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import { Dict } from '../utils';
3
+ declare const TagProvider: import("react").Provider<Dict<any>>, useTag: () => Dict<any>;
4
+ export { TagProvider, useTag };
package/tag/context.js ADDED
@@ -0,0 +1,23 @@
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
+ };
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ exports.useTag = exports.TagProvider = void 0;
20
+ var core_1 = require("../core");
21
+ var _a = __read(core_1.createContext({ isOptional: true }), 2), TagProvider = _a[0], useTag = _a[1];
22
+ exports.TagProvider = TagProvider;
23
+ exports.useTag = useTag;
package/tag/index.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ export * from './context';
2
+ export * from './tag';
3
+ export * from './tag.types';
4
+ export * from './tagIcon';
5
+ export * from './tagText';
6
+ export { default } from './tag';
package/tag/index.js ADDED
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
12
+ var __importDefault = (this && this.__importDefault) || function (mod) {
13
+ return (mod && mod.__esModule) ? mod : { "default": mod };
14
+ };
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.default = void 0;
17
+ __exportStar(require("./context"), exports);
18
+ __exportStar(require("./tag"), exports);
19
+ __exportStar(require("./tag.types"), exports);
20
+ __exportStar(require("./tagIcon"), exports);
21
+ __exportStar(require("./tagText"), exports);
22
+ var tag_1 = require("./tag");
23
+ Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(tag_1).default; } });
package/tag/tag.d.ts ADDED
@@ -0,0 +1,11 @@
1
+ import { TagProps } from './tag.types';
2
+ import TagIcon from './tagIcon';
3
+ import TagText from './tagText';
4
+ import { VuiComponent } from '../core';
5
+ import { SystemProps } from '../system';
6
+ export declare const TagBase: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme, SystemProps, never>;
7
+ export declare const Tag: VuiComponent<"span", TagProps> & {
8
+ Icon: typeof TagIcon;
9
+ Text: typeof TagText;
10
+ };
11
+ export default Tag;
package/tag/tag.js ADDED
@@ -0,0 +1,99 @@
1
+ "use strict";
2
+ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
3
+ if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
4
+ return cooked;
5
+ };
6
+ var __assign = (this && this.__assign) || function () {
7
+ __assign = Object.assign || function(t) {
8
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
9
+ s = arguments[i];
10
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
11
+ t[p] = s[p];
12
+ }
13
+ return t;
14
+ };
15
+ return __assign.apply(this, arguments);
16
+ };
17
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
18
+ if (k2 === undefined) k2 = k;
19
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
20
+ }) : (function(o, m, k, k2) {
21
+ if (k2 === undefined) k2 = k;
22
+ o[k2] = m[k];
23
+ }));
24
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
25
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
26
+ }) : function(o, v) {
27
+ o["default"] = v;
28
+ });
29
+ var __importStar = (this && this.__importStar) || function (mod) {
30
+ if (mod && mod.__esModule) return mod;
31
+ var result = {};
32
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
33
+ __setModuleDefault(result, mod);
34
+ return result;
35
+ };
36
+ var __rest = (this && this.__rest) || function (s, e) {
37
+ var t = {};
38
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
39
+ t[p] = s[p];
40
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
41
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
42
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
43
+ t[p[i]] = s[p[i]];
44
+ }
45
+ return t;
46
+ };
47
+ var __importDefault = (this && this.__importDefault) || function (mod) {
48
+ return (mod && mod.__esModule) ? mod : { "default": mod };
49
+ };
50
+ Object.defineProperty(exports, "__esModule", { value: true });
51
+ exports.Tag = exports.TagBase = void 0;
52
+ var react_1 = __importStar(require("react"));
53
+ var styled_components_1 = __importDefault(require("styled-components"));
54
+ var context_1 = require("./context");
55
+ var tagIcon_1 = __importDefault(require("./tagIcon"));
56
+ var tagText_1 = __importDefault(require("./tagText"));
57
+ var core_1 = require("../core");
58
+ var system_1 = require("../system");
59
+ var utils_1 = require("../utils");
60
+ exports.TagBase = styled_components_1.default.span.withConfig(core_1.forwardPropConfig(system_1.system))(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n\talign-items: center;\n\tdisplay: inline-flex;\n\tjustify-content: center;\n\tline-height: normal;\n\tposition: relative;\n\twidth: fit-content;\n\n\t&:focus {\n\t\tborder-color: transparent;\n\t\toutline: none;\n\t}\n\n\t", "\n"], ["\n\talign-items: center;\n\tdisplay: inline-flex;\n\tjustify-content: center;\n\tline-height: normal;\n\tposition: relative;\n\twidth: fit-content;\n\n\t&:focus {\n\t\tborder-color: transparent;\n\t\toutline: none;\n\t}\n\n\t", "\n"])), system_1.system);
61
+ exports.Tag = core_1.vui(function (props, ref) {
62
+ var casing = props.casing, children = props.children, className = props.className, colorScheme = props.colorScheme, icon = props.icon, iconLeft = props.iconLeft, iconRight = props.iconRight, isFullWidth = props.isFullWidth, _a = props.isInteractive, isInteractive = _a === void 0 ? props.onClick !== undefined : _a, isRound = props.isRound, _b = props.isTruncated, isTruncated = _b === void 0 ? true : _b, itemLeft = props.itemLeft, itemRight = props.itemRight, size = props.size, text = props.text, variant = props.variant, weight = props.weight, rest = __rest(props, ["casing", "children", "className", "colorScheme", "icon", "iconLeft", "iconRight", "isFullWidth", "isInteractive", "isRound", "isTruncated", "itemLeft", "itemRight", "size", "text", "variant", "weight"]);
63
+ var styles = core_1.useStyleConfig('Tag', props);
64
+ var _c = styles.container, activeBg = _c.activeBg, h = _c.h, hoverBg = _c.hoverBg, _d = _c.spaceX, spaceXBase = _d === void 0 ? 0 : _d, tagStyles = __rest(_c, ["activeBg", "h", "hoverBg", "spaceX"]);
65
+ var context = react_1.useMemo(function () { return utils_1.filterUndefined({ colorScheme: colorScheme, size: size, variant: variant }); }, [colorScheme, size, variant]);
66
+ var spaceX = spaceXBase / 8;
67
+ var spaceXText = (spaceXBase + 4) / 8;
68
+ var pl = icon || itemLeft || iconLeft ? spaceX : spaceXText;
69
+ var pr = icon || itemRight || iconRight ? spaceX : spaceXText;
70
+ var interactiveProps = isInteractive
71
+ ? {
72
+ cursor: 'pointer',
73
+ hoverBg: hoverBg,
74
+ activeBg: activeBg,
75
+ focusRing: 3,
76
+ tabIndex: 0,
77
+ userSelect: 'none'
78
+ }
79
+ : {};
80
+ var aliasedProps = utils_1.filterUndefined({
81
+ borderRadius: isRound ? h / 2 : undefined,
82
+ fontWeight: weight,
83
+ textTransform: casing,
84
+ w: isFullWidth ? '100%' : undefined
85
+ });
86
+ return (react_1.default.createElement(context_1.TagProvider, { value: context },
87
+ react_1.default.createElement(exports.TagBase, __assign({ borderRadius: "md", className: utils_1.cs('vui-tag', className), fontWeight: "medium", h: h, pl: pl, pr: pr, ref: ref, transitionDuration: "fast" }, tagStyles, interactiveProps, aliasedProps, rest),
88
+ utils_1.isString(icon) ? react_1.default.createElement(tagIcon_1.default, { name: icon }) : icon,
89
+ !icon && (react_1.default.createElement(react_1.default.Fragment, null,
90
+ itemLeft,
91
+ utils_1.isString(iconLeft) ? react_1.default.createElement(tagIcon_1.default, { mr: spaceX, name: iconLeft }) : iconLeft, children !== null && children !== void 0 ? children : (utils_1.isReactText(text) ? react_1.default.createElement(tagText_1.default, __assign({}, { isTruncated: isTruncated, text: text })) : text),
92
+ utils_1.isString(iconRight) ? react_1.default.createElement(tagIcon_1.default, { ml: spaceX, name: iconRight }) : iconRight,
93
+ itemRight)))));
94
+ });
95
+ exports.Tag.displayName = 'Tag';
96
+ exports.Tag.Icon = tagIcon_1.default;
97
+ exports.Tag.Text = tagText_1.default;
98
+ exports.default = exports.Tag;
99
+ var templateObject_1;
@@ -2,19 +2,18 @@
2
2
  import { IconProp } from '../icon';
3
3
  import { SystemProps, TypographyProps } from '../system';
4
4
  import { ThemingProps } from '../theme';
5
- export interface LabelProps extends SystemProps, ThemingProps<'Label'> {
5
+ import { AnyElement } from '../utils';
6
+ export interface TagProps extends SystemProps, ThemingProps<'Tag'> {
6
7
  casing?: TypographyProps['textTransform'];
7
8
  colorScheme?: 'blue' | 'green' | 'grey' | 'prussian' | 'red' | 'yellow';
8
- icon?: IconProp;
9
- iconLeft?: IconProp;
10
- iconRight?: IconProp;
11
- isElevated?: boolean;
9
+ icon?: IconProp | AnyElement;
10
+ iconLeft?: IconProp | AnyElement;
11
+ iconRight?: IconProp | AnyElement;
12
12
  isFullWidth?: boolean;
13
13
  isInteractive?: boolean;
14
14
  isRound?: boolean;
15
- isSplit?: boolean;
16
15
  itemLeft?: React.ReactNode;
17
16
  itemRight?: React.ReactNode;
18
- text?: number | string;
17
+ text?: React.ReactNode;
19
18
  weight?: TypographyProps['fontWeight'];
20
19
  }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,3 @@
1
+ import { IconProps } from '../icon';
2
+ export declare const TagIcon: import("../core").VuiComponent<"svg", IconProps>;
3
+ export default TagIcon;
@@ -14,17 +14,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
14
14
  return (mod && mod.__esModule) ? mod : { "default": mod };
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.AlertTitle = void 0;
17
+ exports.TagIcon = void 0;
18
18
  var react_1 = __importDefault(require("react"));
19
19
  var context_1 = require("./context");
20
20
  var core_1 = require("../core");
21
- var t_1 = require("../t");
22
- exports.AlertTitle = core_1.vui(function (props, ref) {
21
+ var icon_1 = __importDefault(require("../icon"));
22
+ exports.TagIcon = core_1.vui(function (props, ref) {
23
23
  var _a;
24
- var alertProps = (_a = context_1.useAlert()) !== null && _a !== void 0 ? _a : {};
25
- var mergedProps = __assign(__assign({}, alertProps), props);
26
- var styles = core_1.useStyleConfig('Alert', mergedProps);
27
- return react_1.default.createElement(t_1.T, __assign({ className: "vui-alertTitle", ref: ref, weight: "demi" }, styles.title, props));
24
+ var tagProps = (_a = context_1.useTag()) !== null && _a !== void 0 ? _a : {};
25
+ var mergedProps = __assign(__assign({}, tagProps), props);
26
+ var styles = core_1.useStyleConfig('Tag', mergedProps);
27
+ return react_1.default.createElement(icon_1.default, __assign({ className: "vui-tagIcon", ref: ref }, styles.icon, props));
28
28
  });
29
- exports.AlertTitle.displayName = 'AlertTitle';
30
- exports.default = exports.AlertTitle;
29
+ exports.TagIcon.displayName = 'TagIcon';
30
+ exports.default = exports.TagIcon;
@@ -0,0 +1,3 @@
1
+ import { TProps } from '../t';
2
+ export declare const TagText: import("../core").VuiComponent<"span", TProps>;
3
+ export default TagText;
package/tag/tagText.js ADDED
@@ -0,0 +1,30 @@
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
+ var __importDefault = (this && this.__importDefault) || function (mod) {
14
+ return (mod && mod.__esModule) ? mod : { "default": mod };
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.TagText = void 0;
18
+ var react_1 = __importDefault(require("react"));
19
+ var context_1 = require("./context");
20
+ var core_1 = require("../core");
21
+ var t_1 = __importDefault(require("../t"));
22
+ exports.TagText = core_1.vui(function (props, ref) {
23
+ var _a;
24
+ var tagProps = (_a = context_1.useTag()) !== null && _a !== void 0 ? _a : {};
25
+ var mergedProps = __assign(__assign({}, tagProps), props);
26
+ var styles = core_1.useStyleConfig('Tag', mergedProps);
27
+ return react_1.default.createElement(t_1.default, __assign({ className: "vui-tagText", fontSize: "inherit", ref: ref }, styles.text, props));
28
+ });
29
+ exports.TagText.displayName = 'TagText';
30
+ exports.default = exports.TagText;