@veracity/vui 0.0.1 → 0.0.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 (72) hide show
  1. package/avatar/avatar.d.ts +6 -0
  2. package/avatar/avatar.js +86 -0
  3. package/avatar/avatar.types.d.ts +17 -0
  4. package/avatar/avatar.types.js +2 -0
  5. package/avatar/index.d.ts +3 -0
  6. package/avatar/index.js +20 -0
  7. package/avatar/theme.d.ts +56 -0
  8. package/avatar/theme.js +94 -0
  9. package/button/button.js +4 -2
  10. package/button/buttonGroup.d.ts +6 -0
  11. package/button/buttonGroup.js +75 -0
  12. package/button/buttonGroup.types.d.ts +9 -0
  13. package/button/buttonGroup.types.js +2 -0
  14. package/button/context.d.ts +4 -0
  15. package/button/context.js +23 -0
  16. package/button/index.d.ts +2 -0
  17. package/button/index.js +2 -0
  18. package/button/theme.d.ts +1 -0
  19. package/button/theme.js +1 -0
  20. package/checkbox/checkbox.d.ts +7 -0
  21. package/checkbox/checkbox.js +97 -0
  22. package/checkbox/checkbox.types.d.ts +25 -0
  23. package/checkbox/checkbox.types.js +2 -0
  24. package/checkbox/index.d.ts +3 -0
  25. package/checkbox/index.js +20 -0
  26. package/checkbox/theme.d.ts +24 -0
  27. package/checkbox/theme.js +31 -0
  28. package/controlLabel/controlLabel.d.ts +6 -0
  29. package/controlLabel/controlLabel.js +55 -0
  30. package/controlLabel/controlLabel.types.d.ts +10 -0
  31. package/controlLabel/controlLabel.types.js +2 -0
  32. package/controlLabel/index.d.ts +3 -0
  33. package/controlLabel/index.js +20 -0
  34. package/controlLabel/theme.d.ts +11 -0
  35. package/controlLabel/theme.js +15 -0
  36. package/core/types.d.ts +4 -0
  37. package/core/utils.js +2 -2
  38. package/divider/divider.d.ts +6 -0
  39. package/divider/divider.js +57 -0
  40. package/divider/divider.types.d.ts +10 -0
  41. package/divider/divider.types.js +2 -0
  42. package/divider/index.d.ts +3 -0
  43. package/divider/index.js +20 -0
  44. package/divider/theme.d.ts +6 -0
  45. package/divider/theme.js +10 -0
  46. package/heading/heading.js +1 -1
  47. package/index.d.ts +4 -0
  48. package/index.js +4 -0
  49. package/input/consts.d.ts +4 -0
  50. package/input/consts.js +4 -0
  51. package/input/input.js +10 -9
  52. package/input/input.types.d.ts +2 -1
  53. package/input/theme.d.ts +7 -0
  54. package/input/theme.js +9 -2
  55. package/label/label.js +1 -1
  56. package/label/theme.d.ts +16 -0
  57. package/label/theme.js +34 -1
  58. package/link/link.js +1 -1
  59. package/list/list.js +35 -6
  60. package/list/list.types.d.ts +6 -3
  61. package/list/listItem.js +8 -7
  62. package/list/listItem.types.d.ts +3 -2
  63. package/list/theme.d.ts +13 -5
  64. package/list/theme.js +27 -5
  65. package/package.json +1 -1
  66. package/system/typography.d.ts +9 -5
  67. package/t/t.types.d.ts +4 -4
  68. package/textarea/textarea.js +5 -3
  69. package/textarea/textarea.types.d.ts +2 -2
  70. package/theme/components.d.ts +120 -5
  71. package/theme/components.js +34 -26
  72. package/theme/defaultTheme.d.ts +120 -5
@@ -0,0 +1,6 @@
1
+ import { AvatarProps, AvatarStyleProps } from './avatar.types';
2
+ export declare const BaseAvatar: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme, {
3
+ [x: string]: {};
4
+ } & AvatarStyleProps, never>;
5
+ export declare const Avatar: import("styled-components").StyledComponent<"span", never, AvatarProps, never>;
6
+ export default Avatar;
@@ -0,0 +1,86 @@
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 __rest = (this && this.__rest) || function (s, e) {
18
+ var t = {};
19
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
20
+ t[p] = s[p];
21
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
22
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
23
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
24
+ t[p[i]] = s[p[i]];
25
+ }
26
+ return t;
27
+ };
28
+ var __read = (this && this.__read) || function (o, n) {
29
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
30
+ if (!m) return o;
31
+ var i = m.call(o), r, ar = [], e;
32
+ try {
33
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
34
+ }
35
+ catch (error) { e = { error: error }; }
36
+ finally {
37
+ try {
38
+ if (r && !r.done && (m = i["return"])) m.call(i);
39
+ }
40
+ finally { if (e) throw e.error; }
41
+ }
42
+ return ar;
43
+ };
44
+ var __importDefault = (this && this.__importDefault) || function (mod) {
45
+ return (mod && mod.__esModule) ? mod : { "default": mod };
46
+ };
47
+ Object.defineProperty(exports, "__esModule", { value: true });
48
+ exports.Avatar = exports.BaseAvatar = void 0;
49
+ var styled_components_1 = require("@xstyled/styled-components");
50
+ var react_1 = __importDefault(require("react"));
51
+ var styled_components_2 = __importDefault(require("styled-components"));
52
+ var core_1 = require("../core");
53
+ var icon_1 = __importDefault(require("../icon"));
54
+ var utils_1 = require("../utils");
55
+ var generator = styled_components_1.compose(styled_components_1.backgroundColor, styled_components_1.borders, styled_components_1.interactivity, styled_components_1.sizing, styled_components_1.space, styled_components_1.transitions, styled_components_1.typography);
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.BaseAvatar = styled_components_2.default.span.withConfig({
58
+ shouldForwardProp: core_1.shouldForwardProp(generator.meta.props)
59
+ })(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n\talign-items: center;\n\tdisplay: inline-flex;\n\tflex-shrink: 0;\n\tjustify-content: center;\n\tline-height: 1.333;\n\toutline: none;\n\ttransition: all 0s ease-in-out;\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: 1.333;\n\toutline: none;\n\ttransition: all 0s ease-in-out;\n\n\t&:focus {\n\t\tborder-color: transparent;\n\t}\n\n\t", "\n"])), generator);
60
+ function defaultGetInitials(name) {
61
+ if (name === void 0) { name = ''; }
62
+ var _a = __read(name.split(' '), 2), _b = _a[0], first = _b === void 0 ? '' : _b, _c = _a[1], last = _c === void 0 ? '' : _c;
63
+ return "" + first.charAt(0) + last.charAt(0);
64
+ }
65
+ exports.Avatar = core_1.forwardRef(function (props, ref) {
66
+ 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"]);
67
+ 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"]);
68
+ var borderRadius = isSquare ? 'lg' : '50%';
69
+ var initials = getInitials(name);
70
+ var interactiveProps = isInteractive
71
+ ? {
72
+ cursor: 'pointer',
73
+ hoverBg: hoverBg,
74
+ activeBg: activeBg,
75
+ focusRing: 3,
76
+ focusRingColor: 'blue.50',
77
+ tabIndex: 0,
78
+ userSelect: 'none'
79
+ }
80
+ : {};
81
+ var aliasedProps = utils_1.filterUndefined({});
82
+ return (react_1.default.createElement(exports.BaseAvatar, __assign({ borderRadius: borderRadius, className: utils_1.cs('vui-avatar', className), fontWeight: "medium", h: h, ref: ref, transitionDuration: "fast", w: h }, styles, interactiveProps, aliasedProps, rest), children ? (children) : src ? (react_1.default.createElement(AvatarImage, { borderRadius: borderRadius, src: src })) : icon ? (react_1.default.createElement(icon_1.default, { icon: icon, size: iconSize })) : initials ? (initials) : null));
83
+ });
84
+ exports.Avatar.displayName = 'Avatar';
85
+ exports.default = exports.Avatar;
86
+ var templateObject_1, templateObject_2;
@@ -0,0 +1,17 @@
1
+ import { HTMLAttributes } from 'react';
2
+ import { IconProp } from '../icon';
3
+ import { BackgroundColorProps, BordersProps, InteractivityProps, SizingProps, SpaceProps, TransitionsProps, TypographyProps } from '../system';
4
+ import { ThemingProps } from '../theme';
5
+ export interface AvatarImageStyleProps extends BordersProps {
6
+ }
7
+ export interface AvatarProps extends Omit<HTMLAttributes<HTMLSpanElement>, 'color'>, AvatarStyleProps, ThemingProps<'Avatar'> {
8
+ colorScheme?: 'blue' | 'green' | 'grey' | 'prussian' | 'red' | 'yellow';
9
+ getInitials?: (name: string) => string;
10
+ icon?: IconProp;
11
+ isInteractive?: boolean;
12
+ isSquare?: boolean;
13
+ name?: string;
14
+ src?: string;
15
+ }
16
+ export interface AvatarStyleProps extends BackgroundColorProps, BordersProps, InteractivityProps, SizingProps, SpaceProps, TransitionsProps, TypographyProps {
17
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,3 @@
1
+ export * from './avatar';
2
+ export * from './avatar.types';
3
+ export { default } from './avatar';
@@ -0,0 +1,20 @@
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("./avatar"), exports);
18
+ __exportStar(require("./avatar.types"), exports);
19
+ var avatar_1 = require("./avatar");
20
+ Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(avatar_1).default; } });
@@ -0,0 +1,56 @@
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
+ declare function variantSolid(props: Dict): {
11
+ hoverBg: string;
12
+ activeBg: string;
13
+ bg: string;
14
+ color: string;
15
+ };
16
+ declare function variantSubtle(props: Dict): {
17
+ hoverBg: string;
18
+ activeBg: string;
19
+ bg: string;
20
+ color: string;
21
+ };
22
+ declare const _default: {
23
+ defaultProps: {
24
+ colorScheme: string;
25
+ size: string;
26
+ variant: string;
27
+ };
28
+ sizes: {
29
+ xs: {
30
+ fontSize: string;
31
+ h: number;
32
+ iconSize: string;
33
+ };
34
+ sm: {
35
+ fontSize: string;
36
+ h: number;
37
+ iconSize: string;
38
+ };
39
+ md: {
40
+ fontSize: string;
41
+ h: number;
42
+ iconSize: string;
43
+ };
44
+ lg: {
45
+ fontSize: string;
46
+ h: number;
47
+ iconSize: string;
48
+ };
49
+ };
50
+ variants: {
51
+ outlined: typeof variantOutlined;
52
+ solid: typeof variantSolid;
53
+ subtle: typeof variantSubtle;
54
+ };
55
+ };
56
+ export default _default;
@@ -0,0 +1,94 @@
1
+ "use strict";
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
+ function variantSolid(props) {
21
+ var c = props.colorScheme;
22
+ var colors = {
23
+ hoverBg: c + ".90",
24
+ activeBg: c + ".100",
25
+ bg: c + ".80",
26
+ color: 'white'
27
+ };
28
+ if (c === 'yellow') {
29
+ colors.hoverBg = c + ".80";
30
+ colors.activeBg = c + ".90";
31
+ colors.bg = c + ".70";
32
+ }
33
+ return colors;
34
+ }
35
+ function variantSubtle(props) {
36
+ var c = props.colorScheme;
37
+ var colors = {
38
+ hoverBg: c + ".30",
39
+ activeBg: c + ".40",
40
+ bg: c + ".20",
41
+ color: c + ".80"
42
+ };
43
+ // Special cases
44
+ if (c === 'green') {
45
+ colors.color = c + ".90";
46
+ }
47
+ if (c === 'grey') {
48
+ colors.color = "prussian.80";
49
+ }
50
+ if (c === 'red') {
51
+ colors.color = c + ".90";
52
+ }
53
+ if (c === 'yellow') {
54
+ colors.color = c + ".100";
55
+ }
56
+ return colors;
57
+ }
58
+ var defaultProps = {
59
+ colorScheme: 'blue',
60
+ size: 'md',
61
+ variant: 'subtle'
62
+ };
63
+ var sizes = {
64
+ xs: {
65
+ fontSize: 'xs',
66
+ h: 24,
67
+ iconSize: 'xs'
68
+ },
69
+ sm: {
70
+ fontSize: 'sm',
71
+ h: 32,
72
+ iconSize: 'sm'
73
+ },
74
+ md: {
75
+ fontSize: 'md',
76
+ h: 40,
77
+ iconSize: 'md'
78
+ },
79
+ lg: {
80
+ fontSize: 'lg',
81
+ h: 48,
82
+ iconSize: 'lg'
83
+ }
84
+ };
85
+ var variants = {
86
+ outlined: variantOutlined,
87
+ solid: variantSolid,
88
+ subtle: variantSubtle
89
+ };
90
+ exports.default = {
91
+ defaultProps: defaultProps,
92
+ sizes: sizes,
93
+ variants: variants
94
+ };
package/button/button.js CHANGED
@@ -33,6 +33,7 @@ exports.Button = exports.BaseButton = void 0;
33
33
  var styled_components_1 = require("@xstyled/styled-components");
34
34
  var react_1 = __importDefault(require("react"));
35
35
  var styled_components_2 = __importDefault(require("styled-components"));
36
+ var context_1 = require("./context");
36
37
  var core_1 = require("../core");
37
38
  var icon_1 = __importDefault(require("../icon"));
38
39
  var utils_1 = require("../utils");
@@ -44,8 +45,9 @@ exports.BaseButton = styled_components_2.default.button.withConfig({
44
45
  })(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n\talign-items: center;\n\tdisplay: flex;\n\tflex-shrink: 0;\n\tjustify-content: center;\n\tline-height: 1.1;\n\tposition: relative;\n\ttransition: all 0s ease-in-out;\n\tuser-select: none;\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: flex;\n\tflex-shrink: 0;\n\tjustify-content: center;\n\tline-height: 1.1;\n\tposition: relative;\n\ttransition: all 0s ease-in-out;\n\tuser-select: none;\n\twidth: fit-content;\n\n\t&:focus {\n\t\tborder-color: transparent;\n\t\toutline: none;\n\t}\n\n\t", "\n"])), generator);
45
46
  exports.Button = core_1.forwardRef(function (props, ref) {
46
47
  var _a;
47
- var _b = core_1.omitThemingProps(props), borderWidthProp = _b.borderWidth, children = _b.children, className = _b.className, disabled = _b.disabled, icon = _b.icon, iconLeftProp = _b.iconLeft, iconRightProp = _b.iconRight, isElevated = _b.isElevated, isFullWidth = _b.isFullWidth, isLoading = _b.isLoading, isRound = _b.isRound, isSplit = _b.isSplit, itemLeftProp = _b.itemLeft, itemRightProp = _b.itemRight, text = _b.text, rest = __rest(_b, ["borderWidth", "children", "className", "disabled", "icon", "iconLeft", "iconRight", "isElevated", "isFullWidth", "isLoading", "isRound", "isSplit", "itemLeft", "itemRight", "text"]);
48
- var _c = core_1.useStyleConfig('Button', props), borderWidth = _c.borderWidth, h = _c.h, _d = _c.iconSize, iconSize = _d === void 0 ? 'md' : _d, minW = _c.minW, _e = _c.spaceX, spaceXBase = _e === void 0 ? 0 : _e, styles = __rest(_c, ["borderWidth", "h", "iconSize", "minW", "spaceX"]);
48
+ var group = context_1.useButtonGroup();
49
+ var _b = core_1.omitThemingProps(props), borderWidthProp = _b.borderWidth, children = _b.children, className = _b.className, _c = _b.disabled, disabled = _c === void 0 ? group === null || group === void 0 ? void 0 : group.disabled : _c, icon = _b.icon, iconLeftProp = _b.iconLeft, iconRightProp = _b.iconRight, isElevated = _b.isElevated, isFullWidth = _b.isFullWidth, isLoading = _b.isLoading, isRound = _b.isRound, isSplit = _b.isSplit, itemLeftProp = _b.itemLeft, itemRightProp = _b.itemRight, text = _b.text, rest = __rest(_b, ["borderWidth", "children", "className", "disabled", "icon", "iconLeft", "iconRight", "isElevated", "isFullWidth", "isLoading", "isRound", "isSplit", "itemLeft", "itemRight", "text"]);
50
+ var _d = core_1.useStyleConfig('Button', __assign(__assign({}, group), props)), borderWidth = _d.borderWidth, h = _d.h, _e = _d.iconSize, iconSize = _e === void 0 ? 'md' : _e, minW = _d.minW, _f = _d.spaceX, spaceXBase = _f === void 0 ? 0 : _f, styles = __rest(_d, ["borderWidth", "h", "iconSize", "minW", "spaceX"]);
49
51
  var Content = isLoading ? ContentWrapper : react_1.default.Fragment;
50
52
  var border = (_a = borderWidthProp !== null && borderWidthProp !== void 0 ? borderWidthProp : borderWidth) !== null && _a !== void 0 ? _a : 0;
51
53
  var spaceX = (spaceXBase - border) / 8;
@@ -0,0 +1,6 @@
1
+ import { ButtonGroupProps, ButtonGroupStyleProps } from './buttonGroup.types';
2
+ export declare const BaseButtonGroup: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
3
+ [x: string]: {};
4
+ } & ButtonGroupStyleProps, never>;
5
+ export declare const ButtonGroup: import("styled-components").StyledComponent<"div", never, ButtonGroupProps, never>;
6
+ export default ButtonGroup;
@@ -0,0 +1,75 @@
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.ButtonGroup = exports.BaseButtonGroup = void 0;
52
+ var styled_components_1 = require("@xstyled/styled-components");
53
+ var react_1 = __importStar(require("react"));
54
+ var styled_components_2 = __importDefault(require("styled-components"));
55
+ var context_1 = require("./context");
56
+ var core_1 = require("../core");
57
+ var utils_1 = require("../utils");
58
+ var generator = styled_components_1.compose(styled_components_1.flexboxes, styled_components_1.sizing, styled_components_1.space);
59
+ exports.BaseButtonGroup = styled_components_2.default.div.withConfig({
60
+ shouldForwardProp: core_1.shouldForwardProp(generator.meta.props)
61
+ })(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n\tdisplay: flex;\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> *:focus {\n\t\tz-index: 1;\n\t}\n\n\t", "\n"], ["\n\tdisplay: flex;\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> *:focus {\n\t\tz-index: 1;\n\t}\n\n\t", "\n"])), generator);
62
+ exports.ButtonGroup = core_1.forwardRef(function (props, ref) {
63
+ var className = props.className, colorScheme = props.colorScheme, disabled = props.disabled, size = props.size, variant = props.variant, rest = __rest(props, ["className", "colorScheme", "disabled", "size", "variant"]);
64
+ var context = react_1.useMemo(function () { return utils_1.filterUndefined({ colorScheme: colorScheme, disabled: disabled, size: size, variant: variant }); }, [
65
+ colorScheme,
66
+ disabled,
67
+ size,
68
+ variant
69
+ ]);
70
+ return (react_1.default.createElement(context_1.ButtonGroupProvider, { value: context },
71
+ react_1.default.createElement(exports.BaseButtonGroup, __assign({ className: utils_1.cs('vui-buttonGroup', className), ref: ref }, rest))));
72
+ });
73
+ exports.ButtonGroup.displayName = 'ButtonGroup';
74
+ exports.default = exports.ButtonGroup;
75
+ var templateObject_1;
@@ -0,0 +1,9 @@
1
+ import { HTMLAttributes } from 'react';
2
+ import { FlexboxesProps, SizingProps, SpaceProps } from '../system';
3
+ import { ThemingProps } from '../theme';
4
+ export interface ButtonGroupProps extends Omit<HTMLAttributes<HTMLDivElement>, 'color'>, ButtonGroupStyleProps, ThemingProps<'Button'> {
5
+ colorScheme?: 'blue' | 'green' | 'pink' | 'prussian' | 'red';
6
+ disabled?: boolean;
7
+ }
8
+ export interface ButtonGroupStyleProps extends FlexboxesProps, SizingProps, SpaceProps {
9
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import { Dict } from '../utils';
3
+ declare const ButtonGroupProvider: import("react").Provider<Dict<any>>, useButtonGroup: () => Dict<any>;
4
+ export { ButtonGroupProvider, useButtonGroup };
@@ -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.useButtonGroup = exports.ButtonGroupProvider = void 0;
20
+ var core_1 = require("../core");
21
+ var _a = __read(core_1.createContext({ isOptional: true }), 2), ButtonGroupProvider = _a[0], useButtonGroup = _a[1];
22
+ exports.ButtonGroupProvider = ButtonGroupProvider;
23
+ exports.useButtonGroup = useButtonGroup;
package/button/index.d.ts CHANGED
@@ -1,4 +1,6 @@
1
1
  export * from './button';
2
2
  export * from './button.types';
3
3
  export * from './buttons';
4
+ export * from './buttonGroup';
5
+ export * from './buttonGroup.types';
4
6
  export { default } from './button';
package/button/index.js CHANGED
@@ -17,5 +17,7 @@ exports.default = void 0;
17
17
  __exportStar(require("./button"), exports);
18
18
  __exportStar(require("./button.types"), exports);
19
19
  __exportStar(require("./buttons"), exports);
20
+ __exportStar(require("./buttonGroup"), exports);
21
+ __exportStar(require("./buttonGroup.types"), exports);
20
22
  var button_1 = require("./button");
21
23
  Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(button_1).default; } });
package/button/theme.d.ts CHANGED
@@ -8,6 +8,7 @@ declare function variantOutlined(props: Dict): {
8
8
  borderWidth: number;
9
9
  };
10
10
  declare function variantSolid(props: Dict): {
11
+ borderColor: string;
11
12
  hoverBg: string;
12
13
  activeBg: string;
13
14
  bg: string;
package/button/theme.js CHANGED
@@ -19,6 +19,7 @@ function variantOutlined(props) {
19
19
  function variantSolid(props) {
20
20
  var c = props.colorScheme;
21
21
  var styles = {
22
+ borderColor: c + ".100",
22
23
  hoverBg: c + ".90",
23
24
  activeBg: c + ".100",
24
25
  bg: c + ".80",
@@ -0,0 +1,7 @@
1
+ import { CheckboxProps, CheckboxStyleProps } from './checkbox.types';
2
+ export declare const Input: import("styled-components").StyledComponent<"input", import("styled-components").DefaultTheme, {}, never>;
3
+ export declare const BaseCheckbox: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme, {
4
+ [x: string]: {};
5
+ } & CheckboxStyleProps, never>;
6
+ export declare const Checkbox: import("styled-components").StyledComponent<"span", never, CheckboxProps, never>;
7
+ export default Checkbox;
@@ -0,0 +1,97 @@
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 __read = (this && this.__read) || function (o, n) {
48
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
49
+ if (!m) return o;
50
+ var i = m.call(o), r, ar = [], e;
51
+ try {
52
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
53
+ }
54
+ catch (error) { e = { error: error }; }
55
+ finally {
56
+ try {
57
+ if (r && !r.done && (m = i["return"])) m.call(i);
58
+ }
59
+ finally { if (e) throw e.error; }
60
+ }
61
+ return ar;
62
+ };
63
+ var __importDefault = (this && this.__importDefault) || function (mod) {
64
+ return (mod && mod.__esModule) ? mod : { "default": mod };
65
+ };
66
+ Object.defineProperty(exports, "__esModule", { value: true });
67
+ exports.Checkbox = exports.BaseCheckbox = exports.Input = void 0;
68
+ var styled_components_1 = require("@xstyled/styled-components");
69
+ var react_1 = __importStar(require("react"));
70
+ var styled_components_2 = __importDefault(require("styled-components"));
71
+ var icon_1 = __importDefault(require("../icon"));
72
+ var core_1 = require("../core");
73
+ var utils_1 = require("../utils");
74
+ var generator = styled_components_1.compose(styled_components_1.backgroundColor, styled_components_1.borders, styled_components_1.color, styled_components_1.sizing, styled_components_1.space, styled_components_1.transitions);
75
+ exports.Input = styled_components_2.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"])));
76
+ exports.BaseCheckbox = styled_components_2.default.span.withConfig({
77
+ shouldForwardProp: core_1.shouldForwardProp(generator.meta.props)
78
+ })(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n\tcursor: pointer;\n\tdisplay: inline-flex;\n\tposition: relative;\n\ttransition: all 0s ease-in-out;\n\n\tinput:disabled {\n\t\tcursor: not-allowed;\n\t}\n\n\t// Remove when icons are fixed\n\tpath {\n\t\tfill: currentColor;\n\t}\n\n\t", "\n"], ["\n\tcursor: pointer;\n\tdisplay: inline-flex;\n\tposition: relative;\n\ttransition: all 0s ease-in-out;\n\n\tinput:disabled {\n\t\tcursor: not-allowed;\n\t}\n\n\t// Remove when icons are fixed\n\tpath {\n\t\tfill: currentColor;\n\t}\n\n\t", "\n"])), generator);
79
+ exports.Checkbox = core_1.forwardRef(function (props, ref) {
80
+ var _a = core_1.omitThemingProps(props), checked = _a.checked, _b = _a.checkedIcon, checkedIcon = _b === void 0 ? 'cusCheckboxSelected' : _b, className = _a.className, defaultChecked = _a.defaultChecked, disabled = _a.disabled, _c = _a.icon, iconProp = _c === void 0 ? 'falSquare' : _c, _d = _a.indeterminateIcon, indeterminateIcon = _d === void 0 ? 'cusSquareMinus' : _d, inputProps = _a.inputProps, inputRef = _a.inputRef, isIndeterminate = _a.isIndeterminate, name = _a.name, onChange = _a.onChange, readOnly = _a.readOnly, required = _a.required, value = _a.value, rest = __rest(_a, ["checked", "checkedIcon", "className", "defaultChecked", "disabled", "icon", "indeterminateIcon", "inputProps", "inputRef", "isIndeterminate", "name", "onChange", "readOnly", "required", "value"]);
81
+ var _e = __read(react_1.useState(defaultChecked !== null && defaultChecked !== void 0 ? defaultChecked : checked), 2), isChecked = _e[0], setIsChecked = _e[1];
82
+ var _f = core_1.useStyleConfig('Checkbox', props), colorStyle = _f.color, h = _f.h, hoverColorStyle = _f.hoverColor, styles = __rest(_f, ["color", "h", "hoverColor"]);
83
+ var isFilled = isChecked || isIndeterminate;
84
+ var color = disabled ? 'grey.40' : isFilled ? colorStyle : 'grey.60';
85
+ var hoverColor = disabled ? 'grey.40' : isFilled ? hoverColorStyle : 'grey.80';
86
+ var icon = isIndeterminate ? indeterminateIcon : isChecked ? checkedIcon : iconProp;
87
+ function handleOnChange(e) {
88
+ setIsChecked(e.target.checked);
89
+ onChange === null || onChange === void 0 ? void 0 : onChange(e);
90
+ }
91
+ return (react_1.default.createElement(exports.BaseCheckbox, __assign({ borderRadius: "sm", className: utils_1.cs('vui-checkbox', className), color: color, focusWithinRing: 3, focusWithinRingColor: "blue.50", h: h, hoverColor: hoverColor, onChange: handleOnChange, ref: ref, transitionDuration: "fast", type: "checkbox", w: h }, styles, rest),
92
+ react_1.default.createElement(exports.Input, __assign({}, { checked: checked, defaultChecked: defaultChecked, disabled: disabled, name: name, onChange: onChange, readOnly: readOnly, required: required, value: value }, { className: "vui-checkboxInput", ref: inputRef, type: "checkbox" }, inputProps)),
93
+ react_1.default.createElement(icon_1.default, { h: "100%", icon: icon, w: "100%" })));
94
+ });
95
+ exports.Checkbox.displayName = 'Checkbox';
96
+ exports.default = exports.Checkbox;
97
+ var templateObject_1, templateObject_2;
@@ -0,0 +1,25 @@
1
+ import { HTMLAttributes } from 'react';
2
+ import { IconProp } from '../icon';
3
+ import { BackgroundColorProps, BordersProps, SizingProps, SpaceProps, TransitionsProps } from '../system';
4
+ import { ThemingProps } from '../theme';
5
+ export interface CheckboxProps extends Omit<HTMLAttributes<HTMLSpanElement>, 'onChange'>, CheckboxStyleProps, ThemingProps<'Checkbox'> {
6
+ checked?: boolean;
7
+ checkedIcon?: IconProp;
8
+ colorScheme?: 'blue' | 'prussian';
9
+ disabled?: boolean;
10
+ icon?: IconProp;
11
+ indeterminateIcon?: IconProp;
12
+ inputProps?: InputProps;
13
+ inputRef?: React.MutableRefObject<HTMLInputElement | null> | null;
14
+ isIndeterminate?: boolean;
15
+ name?: string;
16
+ onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
17
+ readOnly?: boolean;
18
+ required?: boolean;
19
+ value?: number | string;
20
+ }
21
+ export interface CheckboxStyleProps extends BackgroundColorProps, BordersProps, SizingProps, SpaceProps, TransitionsProps {
22
+ }
23
+ interface InputProps extends HTMLAttributes<HTMLInputElement> {
24
+ }
25
+ export {};
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,3 @@
1
+ export * from './checkbox';
2
+ export * from './checkbox.types';
3
+ export { default } from './checkbox';