@veracity/vui 0.2.0 → 0.2.2

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 (134) hide show
  1. package/avatar/avatar.js +5 -5
  2. package/avatar/theme.d.ts +5 -9
  3. package/avatar/theme.js +5 -18
  4. package/box/box.js +6 -6
  5. package/button/button.js +19 -23
  6. package/button/button.types.d.ts +33 -3
  7. package/button/buttonIcon.js +3 -3
  8. package/button/buttonText.js +3 -3
  9. package/button/buttons.js +8 -8
  10. package/button/context.js +1 -1
  11. package/button/theme.js +1 -6
  12. package/buttonGroup/buttonGroup.js +5 -10
  13. package/buttonGroup/context.js +1 -1
  14. package/card/card.js +4 -4
  15. package/checkbox/checkbox.js +13 -12
  16. package/checkbox/checkbox.types.d.ts +1 -1
  17. package/checkbox/checkboxGroup.js +7 -7
  18. package/checkbox/checkboxGroup.types.d.ts +2 -2
  19. package/checkbox/context.js +1 -1
  20. package/checkbox/theme.js +5 -2
  21. package/core/globalStyle.js +6 -8
  22. package/core/index.d.ts +1 -2
  23. package/core/index.js +2 -5
  24. package/core/resetCSS.js +2 -2
  25. package/core/styled.d.ts +192 -4
  26. package/core/styled.js +55 -13
  27. package/core/types/component.d.ts +2 -7
  28. package/core/types/index.d.ts +0 -2
  29. package/core/types/index.js +0 -2
  30. package/core/utils.d.ts +2 -2
  31. package/core/utils.js +13 -12
  32. package/divider/divider.js +6 -6
  33. package/heading/heading.js +6 -6
  34. package/heading/headings.js +6 -6
  35. package/icon/icon.js +6 -6
  36. package/icon/icon.types.d.ts +1 -2
  37. package/icons/library.js +9 -5
  38. package/icons/types.d.ts +1 -1
  39. package/image/image.js +4 -4
  40. package/input/context.js +1 -1
  41. package/input/input.js +11 -16
  42. package/input/input.types.d.ts +1 -2
  43. package/input/inputIcon.js +3 -3
  44. package/input/inputInput.js +4 -4
  45. package/link/context.d.ts +4 -0
  46. package/link/context.js +23 -0
  47. package/link/index.d.ts +2 -0
  48. package/link/index.js +2 -0
  49. package/link/link.d.ts +7 -1
  50. package/link/link.js +35 -7
  51. package/link/link.types.d.ts +5 -0
  52. package/link/linkIcon.d.ts +3 -0
  53. package/link/linkIcon.js +30 -0
  54. package/link/linkText.d.ts +3 -0
  55. package/link/linkText.js +30 -0
  56. package/link/theme.d.ts +27 -10
  57. package/link/theme.js +26 -12
  58. package/list/context.js +1 -1
  59. package/list/index.d.ts +1 -0
  60. package/list/index.js +1 -0
  61. package/list/list.d.ts +2 -0
  62. package/list/list.js +8 -11
  63. package/list/listDivider.d.ts +3 -0
  64. package/list/listDivider.js +30 -0
  65. package/list/listHeading.js +4 -4
  66. package/list/listIcon.js +3 -3
  67. package/list/listItem.js +8 -8
  68. package/list/listText.js +3 -3
  69. package/list/theme.d.ts +0 -16
  70. package/list/theme.js +6 -22
  71. package/notification/context.js +1 -1
  72. package/notification/notification.js +6 -11
  73. package/notification/notificationButton.js +3 -3
  74. package/notification/notificationIcon.js +3 -3
  75. package/notification/notificationText.js +3 -3
  76. package/notification/notificationTitle.js +3 -3
  77. package/p/p.js +6 -6
  78. package/package.json +1 -1
  79. package/panel/panel.js +4 -4
  80. package/radio/context.js +1 -1
  81. package/radio/radio.js +58 -13
  82. package/radio/radio.types.d.ts +1 -1
  83. package/radio/radioGroup.js +24 -17
  84. package/radio/radioGroup.types.d.ts +2 -2
  85. package/radio/theme.js +5 -2
  86. package/skeleton/skeleton.js +6 -6
  87. package/spinner/spinner.js +5 -5
  88. package/svg/svg.js +12 -12
  89. package/switch/context.js +1 -1
  90. package/switch/switch.js +12 -50
  91. package/switch/switch.types.d.ts +3 -3
  92. package/switch/switchButton.js +19 -21
  93. package/switch/switchLabel.js +3 -3
  94. package/switch/theme.d.ts +0 -5
  95. package/switch/theme.js +4 -9
  96. package/system/custom.d.ts +7 -20
  97. package/system/custom.js +19 -25
  98. package/system/system.d.ts +4 -3
  99. package/system/system.js +2 -2
  100. package/system/tables.d.ts +14 -0
  101. package/t/t.js +6 -6
  102. package/tag/context.js +1 -1
  103. package/tag/index.d.ts +1 -0
  104. package/tag/index.js +1 -0
  105. package/tag/tag.d.ts +2 -0
  106. package/tag/tag.js +16 -13
  107. package/tag/tag.types.d.ts +2 -0
  108. package/tag/tagButton.d.ts +3 -0
  109. package/tag/tagButton.js +41 -0
  110. package/tag/tagIcon.js +3 -3
  111. package/tag/tagText.js +3 -3
  112. package/tag/theme.d.ts +26 -0
  113. package/tag/theme.js +32 -3
  114. package/textarea/textarea.js +9 -9
  115. package/textarea/textarea.types.d.ts +1 -1
  116. package/theme/components.d.ts +58 -39
  117. package/theme/defaultTheme.d.ts +59 -39
  118. package/theme/foundations/index.d.ts +1 -0
  119. package/theme/foundations/shadows.js +2 -2
  120. package/theme/foundations/transformers.d.ts +1 -0
  121. package/theme/foundations/transformers.js +26 -0
  122. package/theme/index.d.ts +16 -0
  123. package/theme/index.js +33 -1
  124. package/utils/assertion.js +1 -2
  125. package/utils/function.js +9 -5
  126. package/utils/object.d.ts +4 -1
  127. package/utils/object.js +27 -28
  128. package/utils/types.d.ts +23 -1
  129. package/core/types/events.d.ts +0 -17
  130. package/core/types/styled.d.ts +0 -11
  131. package/core/types/styled.js +0 -2
  132. package/core/v.d.ts +0 -182
  133. package/core/v.js +0 -6
  134. /package/{core/types/events.js → system/tables.js} +0 -0
package/avatar/avatar.js CHANGED
@@ -54,15 +54,15 @@ var icon_1 = __importDefault(require("../icon"));
54
54
  var system_1 = require("../system");
55
55
  var utils_1 = require("../utils");
56
56
  var AvatarImage = styled_components_2.default.img(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n\theight: 100%;\n\twidth: 100%;\n\n\t", "\n"], ["\n\theight: 100%;\n\twidth: 100%;\n\n\t", "\n"])), styled_components_1.borders);
57
- exports.AvatarBase = styled_components_2.default.span.withConfig(core_1.forwardPropConfig(system_1.system))(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n\talign-items: center;\n\tdisplay: inline-flex;\n\tflex-shrink: 0;\n\tjustify-content: center;\n\tline-height: normal;\n\toutline: none;\n\n\t&:focus {\n\t\tborder-color: transparent;\n\t}\n\n\t", "\n"], ["\n\talign-items: center;\n\tdisplay: inline-flex;\n\tflex-shrink: 0;\n\tjustify-content: center;\n\tline-height: normal;\n\toutline: none;\n\n\t&:focus {\n\t\tborder-color: transparent;\n\t}\n\n\t", "\n"])), system_1.system);
57
+ exports.AvatarBase = styled_components_2.default.span.withConfig((0, core_1.forwardPropConfig)(system_1.system))(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n\talign-items: center;\n\tdisplay: inline-flex;\n\tflex-shrink: 0;\n\tjustify-content: center;\n\tline-height: normal;\n\toutline: none;\n\n\t&:focus {\n\t\tborder-color: transparent;\n\t}\n\n\t", "\n"], ["\n\talign-items: center;\n\tdisplay: inline-flex;\n\tflex-shrink: 0;\n\tjustify-content: center;\n\tline-height: normal;\n\toutline: none;\n\n\t&:focus {\n\t\tborder-color: transparent;\n\t}\n\n\t", "\n"])), system_1.system);
58
58
  function defaultGetInitials(name) {
59
59
  if (name === void 0) { name = ''; }
60
60
  var _a = __read(name.split(' '), 2), _b = _a[0], first = _b === void 0 ? '' : _b, _c = _a[1], last = _c === void 0 ? '' : _c;
61
61
  return ("" + first.charAt(0) + last.charAt(0)).toUpperCase();
62
62
  }
63
- exports.Avatar = core_1.vui(function (props, ref) {
64
- var _a = core_1.omitThemingProps(props), children = _a.children, className = _a.className, _b = _a.getInitials, getInitials = _b === void 0 ? defaultGetInitials : _b, icon = _a.icon, _c = _a.isInteractive, isInteractive = _c === void 0 ? props.onClick !== undefined : _c, isSquare = _a.isSquare, _d = _a.name, name = _d === void 0 ? '' : _d, src = _a.src, rest = __rest(_a, ["children", "className", "getInitials", "icon", "isInteractive", "isSquare", "name", "src"]);
65
- var _e = core_1.useStyleConfig('Avatar', props), activeBg = _e.activeBg, h = _e.h, hoverBg = _e.hoverBg, iconSize = _e.iconSize, styles = __rest(_e, ["activeBg", "h", "hoverBg", "iconSize"]);
63
+ exports.Avatar = (0, core_1.vui)(function (props, ref) {
64
+ var _a = (0, core_1.omitThemingProps)(props), children = _a.children, className = _a.className, _b = _a.getInitials, getInitials = _b === void 0 ? defaultGetInitials : _b, icon = _a.icon, _c = _a.isInteractive, isInteractive = _c === void 0 ? props.onClick !== undefined : _c, isSquare = _a.isSquare, _d = _a.name, name = _d === void 0 ? '' : _d, src = _a.src, rest = __rest(_a, ["children", "className", "getInitials", "icon", "isInteractive", "isSquare", "name", "src"]);
65
+ var _e = (0, core_1.useStyleConfig)('Avatar', props), activeBg = _e.activeBg, h = _e.h, hoverBg = _e.hoverBg, iconSize = _e.iconSize, styles = __rest(_e, ["activeBg", "h", "hoverBg", "iconSize"]);
66
66
  var borderRadius = isSquare ? 'lg' : '50%';
67
67
  var initials = getInitials(name);
68
68
  var interactiveProps = isInteractive
@@ -75,7 +75,7 @@ exports.Avatar = core_1.vui(function (props, ref) {
75
75
  userSelect: 'none'
76
76
  }
77
77
  : {};
78
- return (react_1.default.createElement(exports.AvatarBase, __assign({ borderRadius: borderRadius, className: utils_1.cs('vui-avatar', className), fontWeight: "medium", h: h, ref: ref, transitionDuration: "fast", w: h }, styles, interactiveProps, rest), children ? (children) : src ? (react_1.default.createElement(AvatarImage, { borderRadius: borderRadius, src: src })) : icon ? (react_1.default.createElement(icon_1.default, { name: icon, size: iconSize })) : initials ? (initials) : null));
78
+ return (react_1.default.createElement(exports.AvatarBase, __assign({ borderRadius: borderRadius, className: (0, utils_1.cs)('vui-avatar', className), fontWeight: "medium", h: h, ref: ref, transitionDuration: "fast", w: h }, styles, interactiveProps, rest), children ? (children) : src ? (react_1.default.createElement(AvatarImage, { borderRadius: borderRadius, src: src })) : icon ? (react_1.default.createElement(icon_1.default, { name: icon, size: iconSize })) : initials ? (initials) : null));
79
79
  });
80
80
  exports.Avatar.displayName = 'Avatar';
81
81
  exports.default = exports.Avatar;
package/avatar/theme.d.ts CHANGED
@@ -1,12 +1,4 @@
1
1
  import { Dict } from '../utils';
2
- declare function variantOutlined(props: Dict): {
3
- borderColor: string;
4
- borderWidth: number;
5
- hoverBg: string;
6
- activeBg: string;
7
- bg: string;
8
- color: string;
9
- };
10
2
  declare function variantSolid(props: Dict): {
11
3
  hoverBg: string;
12
4
  activeBg: string;
@@ -46,9 +38,13 @@ declare const _default: {
46
38
  h: number;
47
39
  iconSize: string;
48
40
  };
41
+ xl: {
42
+ fontSize: string;
43
+ h: number;
44
+ iconSize: string;
45
+ };
49
46
  };
50
47
  variants: {
51
- outlined: typeof variantOutlined;
52
48
  solid: typeof variantSolid;
53
49
  subtle: typeof variantSubtle;
54
50
  };
package/avatar/theme.js CHANGED
@@ -1,22 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- function variantOutlined(props) {
4
- var c = props.colorScheme;
5
- var styles = {
6
- borderColor: c + ".80",
7
- borderWidth: 1,
8
- hoverBg: c + ".20",
9
- activeBg: c + ".30",
10
- bg: 'transparent',
11
- color: c + ".80"
12
- };
13
- // Special cases
14
- if (c === 'prussian') {
15
- styles.activeBg = 'blue.30';
16
- styles.hoverBg = 'blue.20';
17
- }
18
- return styles;
19
- }
20
3
  function variantSolid(props) {
21
4
  var c = props.colorScheme;
22
5
  var styles = {
@@ -80,10 +63,14 @@ var sizes = {
80
63
  fontSize: 'lg',
81
64
  h: 48,
82
65
  iconSize: 'lg'
66
+ },
67
+ xl: {
68
+ fontSize: 'lg',
69
+ h: 64,
70
+ iconSize: 'lg'
83
71
  }
84
72
  };
85
73
  var variants = {
86
- outlined: variantOutlined,
87
74
  solid: variantSolid,
88
75
  subtle: variantSubtle
89
76
  };
package/box/box.js CHANGED
@@ -35,14 +35,14 @@ var styled_components_1 = __importDefault(require("styled-components"));
35
35
  var core_1 = require("../core");
36
36
  var system_1 = require("../system");
37
37
  var utils_1 = require("../utils");
38
- exports.BoxBase = styled_components_1.default.div.withConfig(core_1.forwardPropConfig(system_1.system))(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n\tdisplay: flex;\n\tmin-width: 0;\n\n\t", "\n"], ["\n\tdisplay: flex;\n\tmin-width: 0;\n\n\t", "\n"])), system_1.system);
39
- exports.Box = core_1.vui(function (props, ref) {
40
- var _a = core_1.omitThemingProps(props), align = _a.align, center = _a.center, centerH = _a.centerH, centerV = _a.centerV, className = _a.className, column = _a.column, direction = _a.direction, hoverShadow = _a.hoverShadow, justify = _a.justify, radius = _a.radius, shadow = _a.shadow, wrap = _a.wrap, rest = __rest(_a, ["align", "center", "centerH", "centerV", "className", "column", "direction", "hoverShadow", "justify", "radius", "shadow", "wrap"]);
41
- var styles = core_1.useStyleConfig('Box', props);
38
+ exports.BoxBase = styled_components_1.default.div.withConfig((0, core_1.forwardPropConfig)(system_1.system))(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n\tdisplay: flex;\n\tmin-width: 0;\n\n\t", "\n"], ["\n\tdisplay: flex;\n\tmin-width: 0;\n\n\t", "\n"])), system_1.system);
39
+ exports.Box = (0, core_1.vui)(function (props, ref) {
40
+ var _a = (0, core_1.omitThemingProps)(props), align = _a.align, center = _a.center, centerH = _a.centerH, centerV = _a.centerV, className = _a.className, column = _a.column, direction = _a.direction, hoverShadow = _a.hoverShadow, justify = _a.justify, radius = _a.radius, shadow = _a.shadow, wrap = _a.wrap, rest = __rest(_a, ["align", "center", "centerH", "centerV", "className", "column", "direction", "hoverShadow", "justify", "radius", "shadow", "wrap"]);
41
+ var styles = (0, core_1.useStyleConfig)('Box', props);
42
42
  var alignItems = (center || (column ? centerH : centerV)) && 'center';
43
43
  var flexDirection = column && 'column';
44
44
  var justifyContent = (center || (column ? centerV : centerH)) && 'center';
45
- var aliasedProps = utils_1.filterUndefined({
45
+ var aliasedProps = (0, utils_1.filterUndefined)({
46
46
  alignItems: align !== null && align !== void 0 ? align : alignItems,
47
47
  borderRadius: radius,
48
48
  boxShadow: shadow,
@@ -51,7 +51,7 @@ exports.Box = core_1.vui(function (props, ref) {
51
51
  hoverBoxShadow: hoverShadow,
52
52
  justifyContent: justify !== null && justify !== void 0 ? justify : justifyContent
53
53
  });
54
- return (react_1.default.createElement(exports.BoxBase, __assign({ className: utils_1.cs('vui-box', className), ref: ref, transitionDuration: "normal" }, styles, aliasedProps, rest)));
54
+ return (react_1.default.createElement(exports.BoxBase, __assign({ className: (0, utils_1.cs)('vui-box', className), ref: ref, transitionDuration: "normal" }, styles, aliasedProps, rest)));
55
55
  });
56
56
  exports.Box.displayName = 'Box';
57
57
  exports.default = exports.Box;
package/button/button.js CHANGED
@@ -60,37 +60,33 @@ var core_1 = require("../core");
60
60
  var system_1 = require("../system");
61
61
  var utils_1 = require("../utils");
62
62
  var ContentWrapper = styled_components_1.default.span(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n\tvisibility: hidden;\n"], ["\n\tvisibility: hidden;\n"])));
63
- var StateWrapper = styled_components_1.default.span.withConfig(core_1.forwardPropConfig(system_1.system))(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n\tbottom: 0;\n\tdisplay: flex;\n\tleft: 0;\n\tposition: absolute;\n\tright: 0;\n\ttop: 0;\n\n\t", "\n"], ["\n\tbottom: 0;\n\tdisplay: flex;\n\tleft: 0;\n\tposition: absolute;\n\tright: 0;\n\ttop: 0;\n\n\t", "\n"])), system_1.system);
64
- exports.ButtonBase = styled_components_1.default.button.withConfig(core_1.forwardPropConfig(system_1.system))(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n\talign-items: center;\n\tdisplay: inline-flex;\n\tflex-shrink: 0;\n\tjustify-content: center;\n\tline-height: normal;\n\toverflow: hidden;\n\tposition: relative;\n\tuser-select: none;\n\twidth: fit-content;\n\n\t&:focus,\n\t&:focus:hover {\n\t\tborder-color: transparent;\n\t\toutline: none;\n\t\tz-index: 1;\n\t}\n\n\t", "\n\n\t&:disabled {\n\t\t/* Specified here to avoid conflict with active/hover props */\n\t\tbackground-color: var(--vui-colors-disabled-bg);\n\t\tborder-color: var(--vui-colors-disabled-border);\n\t\tcolor: var(--vui-colors-disabled-font);\n\t\tcursor: not-allowed;\n\t}\n"], ["\n\talign-items: center;\n\tdisplay: inline-flex;\n\tflex-shrink: 0;\n\tjustify-content: center;\n\tline-height: normal;\n\toverflow: hidden;\n\tposition: relative;\n\tuser-select: none;\n\twidth: fit-content;\n\n\t&:focus,\n\t&:focus:hover {\n\t\tborder-color: transparent;\n\t\toutline: none;\n\t\tz-index: 1;\n\t}\n\n\t", "\n\n\t&:disabled {\n\t\t/* Specified here to avoid conflict with active/hover props */\n\t\tbackground-color: var(--vui-colors-disabled-bg);\n\t\tborder-color: var(--vui-colors-disabled-border);\n\t\tcolor: var(--vui-colors-disabled-font);\n\t\tcursor: not-allowed;\n\t}\n"])), system_1.system);
65
- exports.Button = core_1.vui(function (props, ref) {
63
+ var StateWrapper = styled_components_1.default.span.withConfig((0, core_1.forwardPropConfig)(system_1.system))(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n\tbottom: 0;\n\tdisplay: flex;\n\tleft: 0;\n\tposition: absolute;\n\tright: 0;\n\ttop: 0;\n\n\t", "\n"], ["\n\tbottom: 0;\n\tdisplay: flex;\n\tleft: 0;\n\tposition: absolute;\n\tright: 0;\n\ttop: 0;\n\n\t", "\n"])), system_1.system);
64
+ exports.ButtonBase = styled_components_1.default.button.withConfig((0, core_1.forwardPropConfig)(system_1.system))(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n\talign-items: center;\n\tdisplay: inline-flex;\n\tflex-shrink: 0;\n\tjustify-content: center;\n\tline-height: normal;\n\toverflow: hidden;\n\tposition: relative;\n\tuser-select: none;\n\twidth: fit-content;\n\n\t&:focus,\n\t&:focus:hover {\n\t\tborder-color: transparent;\n\t\toutline: none;\n\t\tz-index: 1;\n\t}\n\n\t", "\n\n\t&:disabled {\n\t\t/* Specified here to avoid conflict with active/hover props */\n\t\tbackground-color: var(--vui-colors-disabled-bg);\n\t\tborder-color: var(--vui-colors-disabled-border);\n\t\tcolor: var(--vui-colors-disabled-font);\n\t\tcursor: not-allowed;\n\t}\n"], ["\n\talign-items: center;\n\tdisplay: inline-flex;\n\tflex-shrink: 0;\n\tjustify-content: center;\n\tline-height: normal;\n\toverflow: hidden;\n\tposition: relative;\n\tuser-select: none;\n\twidth: fit-content;\n\n\t&:focus,\n\t&:focus:hover {\n\t\tborder-color: transparent;\n\t\toutline: none;\n\t\tz-index: 1;\n\t}\n\n\t", "\n\n\t&:disabled {\n\t\t/* Specified here to avoid conflict with active/hover props */\n\t\tbackground-color: var(--vui-colors-disabled-bg);\n\t\tborder-color: var(--vui-colors-disabled-border);\n\t\tcolor: var(--vui-colors-disabled-font);\n\t\tcursor: not-allowed;\n\t}\n"])), system_1.system);
65
+ exports.Button = (0, core_1.vui)(function (props, ref) {
66
66
  var _a, _b, _c, _d;
67
- var buttonGroupProps = context_2.useButtonGroup();
67
+ var buttonGroupProps = (0, context_2.useButtonGroup)();
68
68
  var mergedProps = __assign(__assign({}, buttonGroupProps), props);
69
69
  var borderWidthProp = mergedProps.borderWidth, children = mergedProps.children, className = mergedProps.className, colorSchemeProp = mergedProps.colorScheme, disabled = mergedProps.disabled, icon = mergedProps.icon, iconLeft = mergedProps.iconLeft, iconRight = mergedProps.iconRight, isElevated = mergedProps.isElevated, isFullWidth = mergedProps.isFullWidth, isLoading = mergedProps.isLoading, // eslint-disable-line
70
70
  isRound = mergedProps.isRound, isSplit = mergedProps.isSplit, size = mergedProps.size, _e = mergedProps.state, state = _e === void 0 ? props.isLoading ? 'loading' : '' : _e, stateMapping = mergedProps.stateMapping, text = mergedProps.text, variant = mergedProps.variant, rest = __rest(mergedProps, ["borderWidth", "children", "className", "colorScheme", "disabled", "icon", "iconLeft", "iconRight", "isElevated", "isFullWidth", "isLoading", "isRound", "isSplit", "size", "state", "stateMapping", "text", "variant"]);
71
- var hasState = Boolean(state);
71
+ var hasState = Boolean(state) && state !== 'idle';
72
72
  var states = __assign(__assign({}, consts_1.buttonStateMapping), stateMapping);
73
73
  var _f = (_a = states[state]) !== null && _a !== void 0 ? _a : {}, stateIconProps = _f.iconProps, stateProps = __rest(_f, ["iconProps"]);
74
- var colorScheme = utils_1.filterUndefined({
74
+ var colorScheme = (0, utils_1.filterUndefined)({
75
75
  colorScheme: (_c = (_b = states[state]) === null || _b === void 0 ? void 0 : _b.colorScheme) !== null && _c !== void 0 ? _c : colorSchemeProp
76
76
  });
77
- var styles = core_1.useStyleConfig('Button', __assign(__assign({}, mergedProps), colorScheme));
77
+ var styles = (0, core_1.useStyleConfig)('Button', __assign(__assign({}, mergedProps), colorScheme));
78
78
  var _g = styles.container, borderWidth = _g.borderWidth, h = _g.h, _h = _g.spaceX, spaceX = _h === void 0 ? 0 : _h, buttonStyles = __rest(_g, ["borderWidth", "h", "spaceX"]);
79
- var context = react_1.useMemo(function () { return utils_1.filterUndefined({ colorScheme: colorScheme, disabled: disabled, size: size, variant: variant }); }, [
80
- colorScheme,
81
- disabled,
82
- size,
83
- variant
84
- ]);
79
+ var context = (0, react_1.useMemo)(function () { return (0, utils_1.filterUndefined)({ colorScheme: colorScheme, disabled: disabled, size: size, variant: variant }); }, [colorScheme, disabled, size, variant]);
85
80
  var Content = hasState ? ContentWrapper : react_1.default.Fragment;
86
81
  // Apply more space for text and less space for icons
87
82
  var border = (_d = borderWidthProp !== null && borderWidthProp !== void 0 ? borderWidthProp : borderWidth) !== null && _d !== void 0 ? _d : 0;
88
- var spaceXItem = spaceX - border + 'px';
89
- var spaceXText = spaceX * 2 - border + 'px';
90
- var iconRightMl = isSplit ? 'auto' : spaceXItem;
91
- var pl = icon || iconLeft ? spaceXItem : spaceXText;
92
- var pr = icon || iconRight ? spaceXItem : spaceXText;
93
- var aliasedProps = utils_1.filterUndefined({
83
+ var spaceXItem = spaceX - border;
84
+ var spaceXText = spaceX * 2 - border;
85
+ var iconLeftMr = spaceXItem + 1 + 'px';
86
+ var iconRightMl = isSplit ? 'auto' : spaceXItem + 1 + 'px';
87
+ var pl = (icon || iconLeft ? spaceXItem : spaceXText) + 'px';
88
+ var pr = (icon || iconRight ? spaceXItem : spaceXText) + 'px';
89
+ var aliasedProps = (0, utils_1.filterUndefined)({
94
90
  borderRadius: isRound ? h / 2 : undefined,
95
91
  boxShadow: isElevated ? '2' : undefined,
96
92
  minW: icon ? 0 : undefined,
@@ -98,14 +94,14 @@ exports.Button = core_1.vui(function (props, ref) {
98
94
  w: isFullWidth ? '100%' : undefined
99
95
  });
100
96
  return (react_1.default.createElement(context_1.ButtonProvider, { value: context },
101
- react_1.default.createElement(exports.ButtonBase, __assign({ borderRadius: "md", borderWidth: border, className: utils_1.cs('vui-button', className), disabled: disabled, focusRing: 3, fontWeight: "medium", h: h, pl: pl, pr: pr, ref: ref, transitionDuration: "fast", type: "button" }, buttonStyles, aliasedProps, rest),
97
+ react_1.default.createElement(exports.ButtonBase, __assign({ borderRadius: "md", borderWidth: border, className: (0, utils_1.cs)('vui-button', className), disabled: disabled, focusRing: 3, fontWeight: "medium", h: h, pl: pl, pr: pr, ref: ref, transitionDuration: "fast", type: "button" }, buttonStyles, aliasedProps, rest),
102
98
  hasState && (react_1.default.createElement(StateWrapper, __assign({ onClick: function (e) { return e.stopPropagation(); } }, stateProps),
103
99
  react_1.default.createElement(buttonIcon_1.default, __assign({ m: "auto" }, stateIconProps)))),
104
100
  react_1.default.createElement(Content, null,
105
- utils_1.isString(icon) ? react_1.default.createElement(buttonIcon_1.default, { name: icon }) : icon,
101
+ (0, utils_1.isString)(icon) ? react_1.default.createElement(buttonIcon_1.default, { name: icon }) : icon,
106
102
  !icon && (react_1.default.createElement(react_1.default.Fragment, null,
107
- utils_1.isString(iconLeft) ? react_1.default.createElement(buttonIcon_1.default, { mr: spaceXItem, name: iconLeft }) : iconLeft, children !== null && children !== void 0 ? children : (utils_1.isReactText(text) ? react_1.default.createElement(buttonText_1.default, { text: text }) : text),
108
- utils_1.isString(iconRight) ? react_1.default.createElement(buttonIcon_1.default, { ml: iconRightMl, name: iconRight }) : iconRight))))));
103
+ (0, utils_1.isString)(iconLeft) ? react_1.default.createElement(buttonIcon_1.default, { mr: iconLeftMr, name: iconLeft }) : iconLeft, children !== null && children !== void 0 ? children : ((0, utils_1.isReactText)(text) ? react_1.default.createElement(buttonText_1.default, { text: text }) : text),
104
+ (0, utils_1.isString)(iconRight) ? react_1.default.createElement(buttonIcon_1.default, { ml: iconRightMl, name: iconRight }) : iconRight))))));
109
105
  });
110
106
  exports.Button.displayName = 'Button';
111
107
  exports.Button.Icon = buttonIcon_1.default;
@@ -2,22 +2,52 @@
2
2
  import { IconProp, IconProps } from '../icon';
3
3
  import { SystemProps } from '../system';
4
4
  import { ThemingProps } from '../theme';
5
- import { AnyElement } from '../utils';
5
+ import { AnyElement, AnyString } from '../utils';
6
6
  export interface ButtonProps extends SystemProps, ThemingProps<'Button'> {
7
- colorScheme?: 'blue' | 'green' | 'grey' | 'pink' | 'prussian' | 'red';
7
+ /**
8
+ * Available theme colors for this component.
9
+ * @default prussian
10
+ */
11
+ colorScheme?: 'blue' | 'green' | 'pink' | 'prussian' | 'red';
12
+ /** Icon that replaces any other content. */
8
13
  icon?: IconProp | AnyElement;
14
+ /** Socket placing icon before the children. */
9
15
  iconLeft?: IconProp | AnyElement;
16
+ /** Socket placing icon after the children. */
10
17
  iconRight?: IconProp | AnyElement;
18
+ /**
19
+ * Adds box shadow style.
20
+ * @default false
21
+ */
11
22
  isElevated?: boolean;
23
+ /**
24
+ * Makes the button take full width of the container.
25
+ * @default false
26
+ */
12
27
  isFullWidth?: boolean;
28
+ /**
29
+ * Replaces content with a loading spinner.
30
+ * @default false
31
+ */
13
32
  isLoading?: boolean;
33
+ /**
34
+ * Rounds the borders.
35
+ * @default false
36
+ */
14
37
  isRound?: boolean;
38
+ /**
39
+ * Separates right icon from the content.
40
+ * @default false
41
+ */
15
42
  isSplit?: boolean;
43
+ /** Replaces content with icon and color matching the operation state. */
16
44
  state?: ButtonState;
45
+ /** Object allowing configuration of state variants. */
17
46
  stateMapping?: ButtonStateMapping;
47
+ /** Socket placing text as alternative to children. */
18
48
  text?: React.ReactNode;
19
49
  }
20
- export declare type ButtonState = 'error' | 'loading' | 'success';
50
+ export declare type ButtonState = 'error' | 'idle' | 'loading' | 'success' | AnyString;
21
51
  export declare type ButtonStateMapping = Record<string, SystemProps & {
22
52
  colorScheme: ButtonProps['colorScheme'];
23
53
  iconProps: IconProps;
@@ -19,11 +19,11 @@ var react_1 = __importDefault(require("react"));
19
19
  var context_1 = require("./context");
20
20
  var core_1 = require("../core");
21
21
  var icon_1 = __importDefault(require("../icon"));
22
- exports.ButtonIcon = core_1.vui(function (props, ref) {
22
+ exports.ButtonIcon = (0, core_1.vui)(function (props, ref) {
23
23
  var _a;
24
- var buttonProps = (_a = context_1.useButton()) !== null && _a !== void 0 ? _a : {};
24
+ var buttonProps = (_a = (0, context_1.useButton)()) !== null && _a !== void 0 ? _a : {};
25
25
  var mergedProps = __assign(__assign({}, buttonProps), props);
26
- var styles = core_1.useStyleConfig('Button', mergedProps);
26
+ var styles = (0, core_1.useStyleConfig)('Button', mergedProps);
27
27
  return react_1.default.createElement(icon_1.default, __assign({ className: "vui-buttonIcon", ref: ref }, styles.icon, props));
28
28
  });
29
29
  exports.ButtonIcon.displayName = 'ButtonIcon';
@@ -19,11 +19,11 @@ var react_1 = __importDefault(require("react"));
19
19
  var context_1 = require("./context");
20
20
  var core_1 = require("../core");
21
21
  var t_1 = __importDefault(require("../t"));
22
- exports.ButtonText = core_1.vui(function (props, ref) {
22
+ exports.ButtonText = (0, core_1.vui)(function (props, ref) {
23
23
  var _a;
24
- var buttonProps = (_a = context_1.useButton()) !== null && _a !== void 0 ? _a : {};
24
+ var buttonProps = (_a = (0, context_1.useButton)()) !== null && _a !== void 0 ? _a : {};
25
25
  var mergedProps = __assign(__assign({}, buttonProps), props);
26
- var styles = core_1.useStyleConfig('Button', mergedProps);
26
+ var styles = (0, core_1.useStyleConfig)('Button', mergedProps);
27
27
  return react_1.default.createElement(t_1.default, __assign({ className: "vui-buttonText", fontSize: "inherit", ref: ref }, styles.text, props));
28
28
  });
29
29
  exports.ButtonText.displayName = 'ButtonText';
package/button/buttons.js CHANGED
@@ -18,11 +18,11 @@ exports.TextButton = exports.LineButton = exports.IconButton = exports.DangerBut
18
18
  var react_1 = __importDefault(require("react"));
19
19
  var button_1 = __importDefault(require("./button"));
20
20
  var core_1 = require("../core");
21
- exports.AppButton = core_1.vui(function (props, ref) { return (react_1.default.createElement(button_1.default, __assign({ colorScheme: "blue", ref: ref, variant: "solid" }, props))); });
22
- exports.BackButton = core_1.vui(function (props, ref) { return (react_1.default.createElement(exports.IconButton, __assign({ colorScheme: "blue", icon: "falChevronLeft", ref: ref, variant: "text" }, props))); });
23
- exports.CloseButton = core_1.vui(function (props, ref) { return (react_1.default.createElement(exports.IconButton, __assign({ colorScheme: "blue", icon: "falTimes", ref: ref, variant: "text" }, props))); });
24
- exports.CTAButton = core_1.vui(function (props, ref) { return (react_1.default.createElement(button_1.default, __assign({ colorScheme: "green", ref: ref, variant: "solid" }, props))); });
25
- exports.DangerButton = core_1.vui(function (props, ref) { return (react_1.default.createElement(button_1.default, __assign({ colorScheme: "red", ref: ref, variant: "solid" }, props))); });
26
- exports.IconButton = core_1.vui(function (props, ref) { return (react_1.default.createElement(button_1.default, __assign({ colorScheme: "blue", ref: ref, variant: "text" }, props))); });
27
- exports.LineButton = core_1.vui(function (props, ref) { return (react_1.default.createElement(button_1.default, __assign({ colorScheme: "blue", ref: ref, variant: "outlined" }, props))); });
28
- exports.TextButton = core_1.vui(function (props, ref) { return (react_1.default.createElement(button_1.default, __assign({ colorScheme: "blue", ref: ref, variant: "text" }, props))); });
21
+ exports.AppButton = (0, core_1.vui)(function (props, ref) { return (react_1.default.createElement(button_1.default, __assign({ colorScheme: "blue", ref: ref, variant: "solid" }, props))); });
22
+ exports.BackButton = (0, core_1.vui)(function (props, ref) { return (react_1.default.createElement(exports.IconButton, __assign({ colorScheme: "blue", icon: "falArrowLeft", ref: ref, variant: "text" }, props))); });
23
+ exports.CloseButton = (0, core_1.vui)(function (props, ref) { return (react_1.default.createElement(exports.IconButton, __assign({ colorScheme: "blue", icon: "falTimes", ref: ref, variant: "text" }, props))); });
24
+ exports.CTAButton = (0, core_1.vui)(function (props, ref) { return (react_1.default.createElement(button_1.default, __assign({ colorScheme: "green", ref: ref, variant: "solid" }, props))); });
25
+ exports.DangerButton = (0, core_1.vui)(function (props, ref) { return (react_1.default.createElement(button_1.default, __assign({ colorScheme: "red", ref: ref, variant: "solid" }, props))); });
26
+ exports.IconButton = (0, core_1.vui)(function (props, ref) { return (react_1.default.createElement(button_1.default, __assign({ colorScheme: "blue", ref: ref, variant: "text" }, props))); });
27
+ exports.LineButton = (0, core_1.vui)(function (props, ref) { return (react_1.default.createElement(button_1.default, __assign({ colorScheme: "blue", ref: ref, variant: "outlined" }, props))); });
28
+ exports.TextButton = (0, core_1.vui)(function (props, ref) { return (react_1.default.createElement(button_1.default, __assign({ colorScheme: "blue", ref: ref, variant: "text" }, props))); });
package/button/context.js CHANGED
@@ -18,6 +18,6 @@ var __read = (this && this.__read) || function (o, n) {
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
19
  exports.useButton = exports.ButtonProvider = void 0;
20
20
  var core_1 = require("../core");
21
- var _a = __read(core_1.createContext({ isOptional: true }), 2), ButtonProvider = _a[0], useButton = _a[1];
21
+ var _a = __read((0, core_1.createContext)({ isOptional: true }), 2), ButtonProvider = _a[0], useButton = _a[1];
22
22
  exports.ButtonProvider = ButtonProvider;
23
23
  exports.useButton = useButton;
package/button/theme.js CHANGED
@@ -32,6 +32,7 @@ function variantSolid(props) {
32
32
  if (c === 'prussian') {
33
33
  container.activeBg = 'prussian.60';
34
34
  container.hoverBg = 'prussian.70';
35
+ container.hoverBorderColor = 'prussian.70';
35
36
  }
36
37
  return { container: container };
37
38
  }
@@ -54,9 +55,6 @@ function variantSubtle(props) {
54
55
  container.bg = 'blue.20';
55
56
  container.borderColor = 'blue.20';
56
57
  }
57
- if (c === 'grey') {
58
- container.color = 'prussian.80';
59
- }
60
58
  return { container: container };
61
59
  }
62
60
  function variantText(props) {
@@ -76,9 +74,6 @@ function variantText(props) {
76
74
  container.hoverBg = 'blue.20';
77
75
  container.hoverBorderColor = 'blue.20';
78
76
  }
79
- if (c === 'grey') {
80
- container.color = 'prussian.80';
81
- }
82
77
  return { container: container };
83
78
  }
84
79
  var defaultProps = {
@@ -56,18 +56,13 @@ var helpers_1 = require("./helpers");
56
56
  var core_1 = require("../core");
57
57
  var system_1 = require("../system");
58
58
  var utils_1 = require("../utils");
59
- exports.ButtonGroupBase = styled_components_1.default.div.withConfig(core_1.forwardPropConfig(system_1.system))(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n\tdisplay: flex;\n\n\t// Border color between Buttons\n\t> *:not(:last-of-type):not(:disabled):not(:focus) {\n\t\tborder-right-color: ", ";\n\t}\n\n\t// First Button\n\t> *:first-of-type:not(:last-of-type) {\n\t\tborder-bottom-right-radius: 0;\n\t\tborder-right-width: 1px;\n\t\tborder-top-right-radius: 0;\n\t}\n\n\t// Middle Buttons\n\t> *:not(:first-of-type):not(:last-of-type) {\n\t\tborder-left-width: 0px;\n\t\tborder-radius: 0;\n\t\tborder-right-width: 1px;\n\t}\n\n\t// Last Button\n\t> *:not(:first-of-type):last-of-type {\n\t\tborder-bottom-left-radius: 0;\n\t\tborder-left-width: 0px;\n\t\tborder-top-left-radius: 0;\n\t}\n\n\t", "\n"], ["\n\tdisplay: flex;\n\n\t// Border color between Buttons\n\t> *:not(:last-of-type):not(:disabled):not(:focus) {\n\t\tborder-right-color: ", ";\n\t}\n\n\t// First Button\n\t> *:first-of-type:not(:last-of-type) {\n\t\tborder-bottom-right-radius: 0;\n\t\tborder-right-width: 1px;\n\t\tborder-top-right-radius: 0;\n\t}\n\n\t// Middle Buttons\n\t> *:not(:first-of-type):not(:last-of-type) {\n\t\tborder-left-width: 0px;\n\t\tborder-radius: 0;\n\t\tborder-right-width: 1px;\n\t}\n\n\t// Last Button\n\t> *:not(:first-of-type):last-of-type {\n\t\tborder-bottom-left-radius: 0;\n\t\tborder-left-width: 0px;\n\t\tborder-top-left-radius: 0;\n\t}\n\n\t", "\n"])), function (p) { return core_1.th.color(p.innerBorderColor); }, system_1.system);
60
- exports.ButtonGroup = core_1.vui(function (props, ref) {
59
+ exports.ButtonGroupBase = styled_components_1.default.div.withConfig((0, core_1.forwardPropConfig)(system_1.system))(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n\tdisplay: flex;\n\n\t// Border color between Buttons\n\t> *:not(:last-of-type):not(:disabled):not(:focus) {\n\t\tborder-right-color: ", ";\n\t}\n\n\t// First Button\n\t> *:first-of-type:not(:last-of-type) {\n\t\tborder-bottom-right-radius: 0;\n\t\tborder-right-width: 1px;\n\t\tborder-top-right-radius: 0;\n\t}\n\n\t// Middle Buttons\n\t> *:not(:first-of-type):not(:last-of-type) {\n\t\tborder-left-width: 0px;\n\t\tborder-radius: 0;\n\t\tborder-right-width: 1px;\n\t}\n\n\t// Last Button\n\t> *:not(:first-of-type):last-of-type {\n\t\tborder-bottom-left-radius: 0;\n\t\tborder-left-width: 0px;\n\t\tborder-top-left-radius: 0;\n\t}\n\n\t", "\n"], ["\n\tdisplay: flex;\n\n\t// Border color between Buttons\n\t> *:not(:last-of-type):not(:disabled):not(:focus) {\n\t\tborder-right-color: ", ";\n\t}\n\n\t// First Button\n\t> *:first-of-type:not(:last-of-type) {\n\t\tborder-bottom-right-radius: 0;\n\t\tborder-right-width: 1px;\n\t\tborder-top-right-radius: 0;\n\t}\n\n\t// Middle Buttons\n\t> *:not(:first-of-type):not(:last-of-type) {\n\t\tborder-left-width: 0px;\n\t\tborder-radius: 0;\n\t\tborder-right-width: 1px;\n\t}\n\n\t// Last Button\n\t> *:not(:first-of-type):last-of-type {\n\t\tborder-bottom-left-radius: 0;\n\t\tborder-left-width: 0px;\n\t\tborder-top-left-radius: 0;\n\t}\n\n\t", "\n"])), function (p) { return core_1.th.color(p.innerBorderColor); }, system_1.system);
60
+ exports.ButtonGroup = (0, core_1.vui)(function (props, ref) {
61
61
  var className = props.className, colorScheme = props.colorScheme, disabled = props.disabled, size = props.size, variant = props.variant, rest = __rest(props, ["className", "colorScheme", "disabled", "size", "variant"]);
62
- var innerBorderColor = helpers_1.getInnerBorderColor(props);
63
- var context = react_1.useMemo(function () { return utils_1.filterUndefined({ colorScheme: colorScheme, disabled: disabled, size: size, variant: variant }); }, [
64
- colorScheme,
65
- disabled,
66
- size,
67
- variant
68
- ]);
62
+ var innerBorderColor = (0, helpers_1.getInnerBorderColor)(props);
63
+ var context = (0, react_1.useMemo)(function () { return (0, utils_1.filterUndefined)({ colorScheme: colorScheme, disabled: disabled, size: size, variant: variant }); }, [colorScheme, disabled, size, variant]);
69
64
  return (react_1.default.createElement(context_1.ButtonGroupProvider, { value: context },
70
- react_1.default.createElement(exports.ButtonGroupBase, __assign({ className: utils_1.cs('vui-buttonGroup', className) }, { innerBorderColor: innerBorderColor, ref: ref }, rest))));
65
+ react_1.default.createElement(exports.ButtonGroupBase, __assign({ className: (0, utils_1.cs)('vui-buttonGroup', className) }, { innerBorderColor: innerBorderColor, ref: ref }, rest))));
71
66
  });
72
67
  exports.ButtonGroup.displayName = 'ButtonGroup';
73
68
  exports.default = exports.ButtonGroup;
@@ -18,6 +18,6 @@ var __read = (this && this.__read) || function (o, n) {
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
19
  exports.useButtonGroup = exports.ButtonGroupProvider = void 0;
20
20
  var core_1 = require("../core");
21
- var _a = __read(core_1.createContext({ isOptional: true }), 2), ButtonGroupProvider = _a[0], useButtonGroup = _a[1];
21
+ var _a = __read((0, core_1.createContext)({ isOptional: true }), 2), ButtonGroupProvider = _a[0], useButtonGroup = _a[1];
22
22
  exports.ButtonGroupProvider = ButtonGroupProvider;
23
23
  exports.useButtonGroup = useButtonGroup;
package/card/card.js CHANGED
@@ -30,9 +30,9 @@ var react_1 = __importDefault(require("react"));
30
30
  var box_1 = __importDefault(require("../box"));
31
31
  var core_1 = require("../core");
32
32
  var utils_1 = require("../utils");
33
- exports.Card = core_1.vui(function (props, ref) {
34
- var _a = core_1.omitThemingProps(props), className = _a.className, _b = _a.isInteractive, isInteractive = _b === void 0 ? props.onClick !== undefined : _b, rest = __rest(_a, ["className", "isInteractive"]);
35
- var styles = core_1.useStyleConfig('Card', props);
33
+ exports.Card = (0, core_1.vui)(function (props, ref) {
34
+ var _a = (0, core_1.omitThemingProps)(props), className = _a.className, _b = _a.isInteractive, isInteractive = _b === void 0 ? props.onClick !== undefined : _b, rest = __rest(_a, ["className", "isInteractive"]);
35
+ var styles = (0, core_1.useStyleConfig)('Card', props);
36
36
  var interactiveProps = isInteractive
37
37
  ? {
38
38
  cursor: 'pointer',
@@ -41,7 +41,7 @@ exports.Card = core_1.vui(function (props, ref) {
41
41
  userSelect: 'none'
42
42
  }
43
43
  : {};
44
- return (react_1.default.createElement(box_1.default, __assign({ bg: "white", borderRadius: "md", className: utils_1.cs('vui-card', className), ref: ref, ring: 1, ringColor: "transparent", shadow: "2" }, styles, interactiveProps, rest)));
44
+ return (react_1.default.createElement(box_1.default, __assign({ bg: "white", borderRadius: "md", className: (0, utils_1.cs)('vui-card', className), ref: ref, ring: 1, ringColor: "transparent", shadow: "2" }, styles, interactiveProps, rest)));
45
45
  });
46
46
  exports.Card.displayName = 'Card';
47
47
  exports.default = exports.Card;
@@ -74,28 +74,29 @@ var system_1 = require("../system");
74
74
  var t_1 = __importDefault(require("../t"));
75
75
  var utils_1 = require("../utils");
76
76
  exports.CheckboxInput = styled_components_1.default.input(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n\tcursor: inherit;\n\theight: 100%;\n\tleft: 0;\n\tmargin: 0;\n\topacity: 0;\n\tpadding: 0;\n\tposition: absolute;\n\ttop: 0;\n\twidth: 100%;\n\tz-index: 1;\n"], ["\n\tcursor: inherit;\n\theight: 100%;\n\tleft: 0;\n\tmargin: 0;\n\topacity: 0;\n\tpadding: 0;\n\tposition: absolute;\n\ttop: 0;\n\twidth: 100%;\n\tz-index: 1;\n"])));
77
- exports.CheckboxBase = styled_components_1.default.label.withConfig(core_1.forwardPropConfig(system_1.system))(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n\talign-items: center;\n\tcursor: pointer;\n\tdisplay: inline-flex;\n\twidth: fit-content;\n\n\t:hover .vui-checkboxControl {\n\t\tcolor: ", ";\n\t}\n\n\t&.disabled {\n\t\tcolor: var(--vui-colors-disabled-font);\n\t\tcursor: not-allowed;\n\n\t\t.vui-checkboxControl {\n\t\t\tcolor: var(--vui-colors-disabled-font);\n\t\t}\n\t}\n\n\t", "\n"], ["\n\talign-items: center;\n\tcursor: pointer;\n\tdisplay: inline-flex;\n\twidth: fit-content;\n\n\t:hover .vui-checkboxControl {\n\t\tcolor: ", ";\n\t}\n\n\t&.disabled {\n\t\tcolor: var(--vui-colors-disabled-font);\n\t\tcursor: not-allowed;\n\n\t\t.vui-checkboxControl {\n\t\t\tcolor: var(--vui-colors-disabled-font);\n\t\t}\n\t}\n\n\t", "\n"])), function (p) { return core_1.th.color(p.controlHoverColor)(p); }, system_1.system);
78
- exports.CheckboxControl = styled_components_1.default.span.withConfig(core_1.forwardPropConfig(system_1.system))(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n\tdisplay: inline-flex;\n\tflex-shrink: 0;\n\tposition: relative;\n\n\t", "\n"], ["\n\tdisplay: inline-flex;\n\tflex-shrink: 0;\n\tposition: relative;\n\n\t", "\n"])), system_1.system);
79
- exports.Checkbox = core_1.vui(function (props, ref) {
80
- var checkboxGroupProps = context_1.useCheckboxGroup();
77
+ exports.CheckboxBase = styled_components_1.default.label.withConfig((0, core_1.forwardPropConfig)(system_1.system))(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n\talign-items: center;\n\tcursor: pointer;\n\tdisplay: inline-flex;\n\twidth: fit-content;\n\n\t:hover .vui-checkboxControl {\n\t\tcolor: ", ";\n\t}\n\n\t&.disabled {\n\t\tcolor: var(--vui-colors-disabled-font);\n\t\tcursor: not-allowed;\n\n\t\t.vui-checkboxControl {\n\t\t\tcolor: var(--vui-colors-disabled-font);\n\t\t}\n\t}\n\n\t", "\n"], ["\n\talign-items: center;\n\tcursor: pointer;\n\tdisplay: inline-flex;\n\twidth: fit-content;\n\n\t:hover .vui-checkboxControl {\n\t\tcolor: ", ";\n\t}\n\n\t&.disabled {\n\t\tcolor: var(--vui-colors-disabled-font);\n\t\tcursor: not-allowed;\n\n\t\t.vui-checkboxControl {\n\t\t\tcolor: var(--vui-colors-disabled-font);\n\t\t}\n\t}\n\n\t", "\n"])), function (p) { return core_1.th.color(p.controlHoverColor)(p); }, system_1.system);
78
+ exports.CheckboxControl = styled_components_1.default.span.withConfig((0, core_1.forwardPropConfig)(system_1.system))(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n\tdisplay: inline-flex;\n\tflex-shrink: 0;\n\tposition: relative;\n\n\t", "\n"], ["\n\tdisplay: inline-flex;\n\tflex-shrink: 0;\n\tposition: relative;\n\n\t", "\n"])), system_1.system);
79
+ exports.Checkbox = (0, core_1.vui)(function (props, ref) {
80
+ var _a;
81
+ var _b = (_a = (0, context_1.useCheckboxGroup)()) !== null && _a !== void 0 ? _a : {}, groupDefaultValue = _b.defaultValue, checkboxGroupProps = __rest(_b, ["defaultValue"]);
81
82
  var mergedProps = __assign(__assign({}, checkboxGroupProps), props);
82
- var _a = core_1.omitThemingProps(mergedProps), checked = _a.checked, children = _a.children, className = _a.className, defaultChecked = _a.defaultChecked, disabled = _a.disabled, _b = _a.icon, iconProp = _b === void 0 ? 'cuiCheckboxUnselected' : _b, _c = _a.iconChecked, iconChecked = _c === void 0 ? 'cuiCheckboxSelected' : _c, _d = _a.iconIndeterminate, iconIndeterminate = _d === void 0 ? 'cuiCheckboxIndeterminate' : _d, id = _a.id, inputProps = _a.inputProps, inputRef = _a.inputRef, isIndeterminate = _a.isIndeterminate, label = _a.label, name = _a.name, onChange = _a.onChange, required = _a.required, value = _a.value, rest = __rest(_a, ["checked", "children", "className", "defaultChecked", "disabled", "icon", "iconChecked", "iconIndeterminate", "id", "inputProps", "inputRef", "isIndeterminate", "label", "name", "onChange", "required", "value"]);
83
- var _e = __read(react_1.useState(defaultChecked), 2), isChecked = _e[0], setIsChecked = _e[1];
84
- var styles = core_1.useStyleConfig('Checkbox', mergedProps);
85
- var _f = styles.control, controlColor = _f.color, hoverColor = _f.hoverColor, controlStyles = __rest(_f, ["color", "hoverColor"]);
86
- react_1.useEffect(function () {
87
- checked !== undefined && setIsChecked(checked);
88
- }, [checked]);
83
+ var _c = (0, core_1.omitThemingProps)(mergedProps), checked = _c.checked, children = _c.children, className = _c.className, _d = _c.defaultChecked, defaultChecked = _d === void 0 ? groupDefaultValue !== undefined ? groupDefaultValue.includes(props.value) : undefined : _d, disabled = _c.disabled, _e = _c.icon, iconProp = _e === void 0 ? 'cuiCheckboxUnselected' : _e, _f = _c.iconChecked, iconChecked = _f === void 0 ? 'cuiCheckboxSelected' : _f, _g = _c.iconIndeterminate, iconIndeterminate = _g === void 0 ? 'cuiCheckboxIndeterminate' : _g, id = _c.id, inputProps = _c.inputProps, inputRef = _c.inputRef, isIndeterminate = _c.isIndeterminate, label = _c.label, name = _c.name, onChange = _c.onChange, required = _c.required, value = _c.value, rest = __rest(_c, ["checked", "children", "className", "defaultChecked", "disabled", "icon", "iconChecked", "iconIndeterminate", "id", "inputProps", "inputRef", "isIndeterminate", "label", "name", "onChange", "required", "value"]);
84
+ var _h = __read((0, react_1.useState)(defaultChecked), 2), isChecked = _h[0], setIsChecked = _h[1];
85
+ var styles = (0, core_1.useStyleConfig)('Checkbox', mergedProps);
86
+ var _j = styles.control, controlColor = _j.color, hoverColor = _j.hoverColor, controlStyles = __rest(_j, ["color", "hoverColor"]);
89
87
  var isFilled = isChecked || isIndeterminate;
90
88
  var icon = isIndeterminate ? iconIndeterminate : isChecked ? iconChecked : iconProp;
91
89
  var controlMr = children || label ? 1 : 0;
92
90
  var color = isFilled ? controlColor : 'grey.60';
93
91
  var controlHoverColor = isFilled ? hoverColor : 'grey.90';
92
+ (0, react_1.useEffect)(function () {
93
+ checked !== undefined && setIsChecked(checked);
94
+ }, [checked]);
94
95
  function handleOnChange(e) {
95
96
  setIsChecked(e.target.checked);
96
97
  onChange === null || onChange === void 0 ? void 0 : onChange(e);
97
98
  }
98
- return (react_1.default.createElement(exports.CheckboxBase, __assign({ className: utils_1.cs('vui-checkbox', disabled && 'disabled', className), controlHoverColor: controlHoverColor, ref: ref }, styles.container, rest),
99
+ return (react_1.default.createElement(exports.CheckboxBase, __assign({ className: (0, utils_1.cs)('vui-checkbox', disabled && 'disabled', className), controlHoverColor: controlHoverColor, ref: ref }, styles.container, rest),
99
100
  react_1.default.createElement(exports.CheckboxControl, __assign({ borderRadius: "sm", className: "vui-checkboxControl", color: color, focusWithinRing: 3, mr: controlMr, transitionDuration: "fast" }, controlStyles),
100
101
  react_1.default.createElement(exports.CheckboxInput, __assign({ className: "vui-checkboxInput", onChange: handleOnChange, ref: inputRef, type: "checkbox" }, { checked: checked, defaultChecked: defaultChecked, disabled: disabled, id: id, name: name, required: required, value: value }, inputProps)),
101
102
  react_1.default.createElement(icon_1.default, { className: "vui-checkboxIcon", h: "100%", name: icon, w: "100%" })), children !== null && children !== void 0 ? children : (label && (react_1.default.createElement(t_1.default, __assign({ className: "vui-checkboxLabel", lineHeight: "normal" }, styles.label), label)))));
@@ -1,8 +1,8 @@
1
1
  import { HTMLAttributes } from 'react';
2
- import { ChangeEventHandler, FocusEventHandler } from '../core';
3
2
  import { IconProp } from '../icon';
4
3
  import { SystemProps } from '../system';
5
4
  import { ThemingProps } from '../theme';
5
+ import { ChangeEventHandler, FocusEventHandler } from '../utils';
6
6
  export interface CheckboxProps extends SystemProps, ThemingProps<'Checkbox'> {
7
7
  checked?: boolean;
8
8
  colorScheme?: 'blue' | 'prussian';
@@ -55,15 +55,15 @@ var context_1 = require("./context");
55
55
  var core_1 = require("../core");
56
56
  var system_1 = require("../system");
57
57
  var utils_1 = require("../utils");
58
- exports.CheckboxGroupBase = styled_components_1.default.div.withConfig(core_1.forwardPropConfig(system_1.system))(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n\tdisplay: flex;\n\tflex-direction: column;\n\n\t", "\n"], ["\n\tdisplay: flex;\n\tflex-direction: column;\n\n\t", "\n"])), system_1.system);
59
- exports.CheckboxGroup = core_1.vui(function (props, ref) {
60
- var className = props.className, colorScheme = props.colorScheme, disabled = props.disabled, name = props.name, onBlur = props.onBlur, onChange = props.onChange, onFocus = props.onFocus, row = props.row, size = props.size, variant = props.variant, rest = __rest(props, ["className", "colorScheme", "disabled", "name", "onBlur", "onChange", "onFocus", "row", "size", "variant"]);
61
- var context = react_1.useMemo(function () { return utils_1.filterUndefined({ colorScheme: colorScheme, disabled: disabled, name: name, onBlur: onBlur, onChange: onChange, onFocus: onFocus, size: size, variant: variant }); }, [colorScheme, disabled, name, onBlur, onChange, onFocus, size, variant]);
62
- var aliasedProps = utils_1.filterUndefined({
63
- flexDirection: row ? 'row' : undefined
58
+ exports.CheckboxGroupBase = styled_components_1.default.div.withConfig((0, core_1.forwardPropConfig)(system_1.system))(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n\tdisplay: flex;\n\tflex-direction: column;\n\n\t", "\n"], ["\n\tdisplay: flex;\n\tflex-direction: column;\n\n\t", "\n"])), system_1.system);
59
+ exports.CheckboxGroup = (0, core_1.vui)(function (props, ref) {
60
+ var className = props.className, colorScheme = props.colorScheme, defaultValue = props.defaultValue, disabled = props.disabled, isRow = props.isRow, name = props.name, onBlur = props.onBlur, onChange = props.onChange, onFocus = props.onFocus, size = props.size, variant = props.variant, rest = __rest(props, ["className", "colorScheme", "defaultValue", "disabled", "isRow", "name", "onBlur", "onChange", "onFocus", "size", "variant"]);
61
+ var context = (0, react_1.useMemo)(function () { return (0, utils_1.filterUndefined)({ colorScheme: colorScheme, defaultValue: defaultValue, disabled: disabled, name: name, onBlur: onBlur, onChange: onChange, onFocus: onFocus, size: size, variant: variant }); }, [colorScheme, defaultValue, disabled, name, onBlur, onChange, onFocus, size, variant]);
62
+ var aliasedProps = (0, utils_1.filterUndefined)({
63
+ flexDirection: isRow ? 'row' : undefined
64
64
  });
65
65
  return (react_1.default.createElement(context_1.CheckboxGroupProvider, { value: context },
66
- react_1.default.createElement(exports.CheckboxGroupBase, __assign({ className: utils_1.cs('vui-checkboxGroup', className), ref: ref }, aliasedProps, rest))));
66
+ react_1.default.createElement(exports.CheckboxGroupBase, __assign({ className: (0, utils_1.cs)('vui-checkboxGroup', className), ref: ref }, aliasedProps, rest))));
67
67
  });
68
68
  exports.CheckboxGroup.displayName = 'CheckboxGroup';
69
69
  exports.default = exports.CheckboxGroup;
@@ -1,12 +1,12 @@
1
- import { ChangeEventHandler, FocusEventHandler } from '../core';
2
1
  import { SystemProps } from '../system';
3
2
  import { ThemingProps } from '../theme';
3
+ import { ChangeEventHandler, FocusEventHandler } from '../utils';
4
4
  export interface CheckboxGroupProps extends SystemProps, ThemingProps<'Checkbox'> {
5
5
  colorScheme?: 'blue' | 'prussian';
6
6
  disabled?: boolean;
7
+ isRow?: boolean;
7
8
  name?: string;
8
9
  onBlur?: FocusEventHandler;
9
10
  onChange?: ChangeEventHandler;
10
11
  onFocus?: FocusEventHandler;
11
- row?: boolean;
12
12
  }
@@ -18,6 +18,6 @@ var __read = (this && this.__read) || function (o, n) {
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
19
  exports.useCheckboxGroup = exports.CheckboxGroupProvider = void 0;
20
20
  var core_1 = require("../core");
21
- var _a = __read(core_1.createContext({ isOptional: true }), 2), CheckboxGroupProvider = _a[0], useCheckboxGroup = _a[1];
21
+ var _a = __read((0, core_1.createContext)({ isOptional: true }), 2), CheckboxGroupProvider = _a[0], useCheckboxGroup = _a[1];
22
22
  exports.CheckboxGroupProvider = CheckboxGroupProvider;
23
23
  exports.useCheckboxGroup = useCheckboxGroup;
package/checkbox/theme.js CHANGED
@@ -2,12 +2,15 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  function variantDefault(props) {
4
4
  var c = props.colorScheme;
5
- var controlStyles = {
5
+ var control = {
6
6
  color: c + ".80",
7
7
  hoverColor: c + ".90"
8
8
  };
9
+ if (c === 'prussian') {
10
+ control.hoverColor = 'prussian.70';
11
+ }
9
12
  return {
10
- control: controlStyles
13
+ control: control
11
14
  };
12
15
  }
13
16
  var defaultProps = {
@@ -34,28 +34,26 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
34
34
  return (mod && mod.__esModule) ? mod : { "default": mod };
35
35
  };
36
36
  Object.defineProperty(exports, "__esModule", { value: true });
37
- var styled_components_1 = require("styled-components");
38
37
  var foundations_1 = __importDefault(require("../theme/foundations"));
39
38
  var styles_1 = require("../styles");
40
39
  var utils_1 = require("../utils");
41
- exports.default = styled_components_1.createGlobalStyle(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n\t", "\n\n\t:root {\n\t\t", "\n\n\t\t--vui-colors-disabled-bg: var(--vui-colors-grey-10);\n\t\t--vui-colors-disabled-border: var(--vui-colors-grey-50);\n\t\t--vui-colors-disabled-font: var(--vui-colors-grey-50);\n\t}\n\n\t* {\n\t\t--x-ring-color: var(--vui-colors-blue-50);\n\t\t--x-shadow: 0 0 0 0 transparent;\n\t}\n\n\t", "\n\n\t@keyframes vui-bounce {\n\t\t", "\n\t}\n\n\t@keyframes vui-fadeDown {\n\t\t", "\n\t}\n\n\t@keyframes vui-fadeIn {\n\t\t", "\n\t}\n\n\t@keyframes vui-fadeLeft {\n\t\t", "\n\t}\n\n\t@keyframes vui-fadeOut {\n\t\t", "\n\t}\n\n\t@keyframes vui-fadeRight {\n\t\t", "\n\t}\n\n\t@keyframes vui-fadeUp {\n\t\t", "\n\t}\n\n\t@keyframes vui-pulse {\n\t\t", "\n\t}\n\n\t@keyframes vui-spin {\n\t\t", "\n\t}\n"], ["\n\t", "\n\n\t:root {\n\t\t", "\n\n\t\t--vui-colors-disabled-bg: var(--vui-colors-grey-10);\n\t\t--vui-colors-disabled-border: var(--vui-colors-grey-50);\n\t\t--vui-colors-disabled-font: var(--vui-colors-grey-50);\n\t}\n\n\t* {\n\t\t--x-ring-color: var(--vui-colors-blue-50);\n\t\t--x-shadow: 0 0 0 0 transparent;\n\t}\n\n\t",
42
- "\n\n\t@keyframes vui-bounce {\n\t\t", "\n\t}\n\n\t@keyframes vui-fadeDown {\n\t\t", "\n\t}\n\n\t@keyframes vui-fadeIn {\n\t\t", "\n\t}\n\n\t@keyframes vui-fadeLeft {\n\t\t", "\n\t}\n\n\t@keyframes vui-fadeOut {\n\t\t", "\n\t}\n\n\t@keyframes vui-fadeRight {\n\t\t", "\n\t}\n\n\t@keyframes vui-fadeUp {\n\t\t", "\n\t}\n\n\t@keyframes vui-pulse {\n\t\t", "\n\t}\n\n\t@keyframes vui-spin {\n\t\t", "\n\t}\n"
40
+ var styled_1 = require("./styled");
41
+ exports.default = (0, styled_1.createGlobalStyle)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n\t", "\n\n\t:root {\n\t\t", "\n\n\t\t--vui-colors-disabled-bg: var(--vui-colors-grey-10);\n\t\t--vui-colors-disabled-border: var(--vui-colors-grey-50);\n\t\t--vui-colors-disabled-font: var(--vui-colors-grey-50);\n\t}\n\n\t* {\n\t\t--x-ring-color: var(--vui-colors-blue-50);\n\t\t--x-shadow: 0 0 0 0 transparent;\n\t}\n\n\t", "\n\n\t@keyframes vui-bounce {\n\t\t", "\n\t}\n\n\t@keyframes vui-fadeDown {\n\t\t", "\n\t}\n\n\t@keyframes vui-fadeIn {\n\t\t", "\n\t}\n\n\t@keyframes vui-fadeLeft {\n\t\t", "\n\t}\n\n\t@keyframes vui-fadeOut {\n\t\t", "\n\t}\n\n\t@keyframes vui-fadeRight {\n\t\t", "\n\t}\n\n\t@keyframes vui-fadeUp {\n\t\t", "\n\t}\n\n\t@keyframes vui-pulse {\n\t\t", "\n\t}\n\n\t@keyframes vui-spin {\n\t\t", "\n\t}\n"], ["\n\t", "\n\n\t:root {\n\t\t", "\n\n\t\t--vui-colors-disabled-bg: var(--vui-colors-grey-10);\n\t\t--vui-colors-disabled-border: var(--vui-colors-grey-50);\n\t\t--vui-colors-disabled-font: var(--vui-colors-grey-50);\n\t}\n\n\t* {\n\t\t--x-ring-color: var(--vui-colors-blue-50);\n\t\t--x-shadow: 0 0 0 0 transparent;\n\t}\n\n\t", "\n\n\t@keyframes vui-bounce {\n\t\t", "\n\t}\n\n\t@keyframes vui-fadeDown {\n\t\t", "\n\t}\n\n\t@keyframes vui-fadeIn {\n\t\t", "\n\t}\n\n\t@keyframes vui-fadeLeft {\n\t\t", "\n\t}\n\n\t@keyframes vui-fadeOut {\n\t\t", "\n\t}\n\n\t@keyframes vui-fadeRight {\n\t\t", "\n\t}\n\n\t@keyframes vui-fadeUp {\n\t\t", "\n\t}\n\n\t@keyframes vui-pulse {\n\t\t", "\n\t}\n\n\t@keyframes vui-spin {\n\t\t", "\n\t}\n"
43
42
  /** Recursively maps through all theme styles and generates a set of CSS properties */
44
43
  ])), styles_1.fontFaces, generateCSSVariables, function (p) {
45
- return p.globalStyle &&
46
- "\n\t\tbody {\n\t\t\tcolor: var(--vui-colors-prussian-80);\n\t\t\tfont-family: var(--vui-fonts-avenir);\n\t\t\tfont-size: var(--vui-fontSizes-md);\n\t\t}\n\t";
44
+ return p.globalStyle && (0, styled_1.css)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n\t\t\tbody {\n\t\t\t\tcolor: prussian.80;\n\t\t\t\tfont-family: avenir;\n\t\t\t\tfont-size: md;\n\t\t\t}\n\t\t"], ["\n\t\t\tbody {\n\t\t\t\tcolor: prussian.80;\n\t\t\t\tfont-family: avenir;\n\t\t\t\tfont-size: md;\n\t\t\t}\n\t\t"])));
47
45
  }, styles_1.bounce, styles_1.fadeDown, styles_1.fadeIn, styles_1.fadeLeft, styles_1.fadeOut, styles_1.fadeRight, styles_1.fadeUp, styles_1.pulse, styles_1.spin);
48
46
  /** Recursively maps through all theme styles and generates a set of CSS properties */
49
47
  function generateCSSVariables() {
50
48
  function computeStyle(name, value) {
51
- if (!utils_1.isObject(value))
49
+ if (!(0, utils_1.isObject)(value))
52
50
  return name + ": " + (typeof value === 'string' ? value : value + "px") + ";\n";
53
51
  return Object.entries(value).reduce(function (str, _a) {
54
52
  var _b = __read(_a, 2), key = _b[0], value = _b[1];
55
53
  return (str += computeStyle(name + "-" + key, value));
56
54
  }, '');
57
55
  }
58
- var animations = foundations_1.default.animations, styles = __rest(foundations_1.default, ["animations"]); // eslint-disable-line @typescript-eslint/no-unused-vars
56
+ var animations = foundations_1.default.animations, transformers = foundations_1.default.transformers, styles = __rest(foundations_1.default, ["animations", "transformers"]);
59
57
  return computeStyle('--vui', styles);
60
58
  }
61
- var templateObject_1;
59
+ var templateObject_1, templateObject_2;