@veracity/vui 0.2.0 → 0.2.1

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 (89) hide show
  1. package/avatar/avatar.js +5 -5
  2. package/box/box.js +6 -6
  3. package/button/button.js +19 -23
  4. package/button/button.types.d.ts +33 -3
  5. package/button/buttonIcon.js +3 -3
  6. package/button/buttonText.js +3 -3
  7. package/button/buttons.js +8 -8
  8. package/button/context.js +1 -1
  9. package/button/theme.js +0 -6
  10. package/buttonGroup/buttonGroup.js +5 -10
  11. package/buttonGroup/context.js +1 -1
  12. package/card/card.js +4 -4
  13. package/checkbox/checkbox.js +12 -12
  14. package/checkbox/checkboxGroup.js +7 -7
  15. package/checkbox/checkboxGroup.types.d.ts +1 -1
  16. package/checkbox/context.js +1 -1
  17. package/checkbox/theme.js +5 -2
  18. package/core/globalStyle.js +2 -3
  19. package/core/resetCSS.js +1 -1
  20. package/core/styled.js +11 -7
  21. package/core/utils.js +9 -9
  22. package/core/v.js +1 -1
  23. package/divider/divider.js +6 -6
  24. package/heading/heading.js +6 -6
  25. package/heading/headings.js +6 -6
  26. package/icon/icon.js +6 -6
  27. package/icons/library.js +9 -5
  28. package/image/image.js +4 -4
  29. package/input/context.js +1 -1
  30. package/input/input.js +11 -16
  31. package/input/inputIcon.js +3 -3
  32. package/input/inputInput.js +4 -4
  33. package/link/link.js +6 -6
  34. package/list/context.js +1 -1
  35. package/list/list.js +6 -11
  36. package/list/listHeading.js +3 -3
  37. package/list/listIcon.js +3 -3
  38. package/list/listItem.js +8 -8
  39. package/list/listText.js +3 -3
  40. package/notification/context.js +1 -1
  41. package/notification/notification.js +6 -11
  42. package/notification/notificationButton.js +3 -3
  43. package/notification/notificationIcon.js +3 -3
  44. package/notification/notificationText.js +3 -3
  45. package/notification/notificationTitle.js +3 -3
  46. package/p/p.js +6 -6
  47. package/package.json +1 -1
  48. package/panel/panel.js +4 -4
  49. package/radio/context.js +1 -1
  50. package/radio/radio.js +58 -13
  51. package/radio/radioGroup.js +25 -17
  52. package/radio/radioGroup.types.d.ts +1 -1
  53. package/radio/theme.js +5 -2
  54. package/skeleton/skeleton.js +6 -6
  55. package/spinner/spinner.js +5 -5
  56. package/svg/svg.js +12 -12
  57. package/switch/context.js +1 -1
  58. package/switch/switch.js +12 -50
  59. package/switch/switch.types.d.ts +2 -2
  60. package/switch/switchButton.js +19 -21
  61. package/switch/switchLabel.js +3 -3
  62. package/system/custom.d.ts +11 -7
  63. package/system/custom.js +24 -13
  64. package/system/system.d.ts +4 -3
  65. package/system/system.js +2 -2
  66. package/system/tables.d.ts +14 -0
  67. package/system/tables.js +2 -0
  68. package/t/t.js +6 -6
  69. package/tag/context.js +1 -1
  70. package/tag/index.d.ts +1 -0
  71. package/tag/index.js +1 -0
  72. package/tag/tag.d.ts +2 -0
  73. package/tag/tag.js +14 -12
  74. package/tag/tag.types.d.ts +1 -0
  75. package/tag/tagButton.d.ts +3 -0
  76. package/tag/tagButton.js +30 -0
  77. package/tag/tagIcon.js +3 -3
  78. package/tag/tagText.js +3 -3
  79. package/tag/theme.d.ts +26 -0
  80. package/tag/theme.js +32 -3
  81. package/textarea/textarea.js +9 -9
  82. package/theme/components.d.ts +26 -0
  83. package/theme/defaultTheme.d.ts +26 -0
  84. package/theme/foundations/shadows.js +2 -2
  85. package/theme/index.d.ts +16 -0
  86. package/theme/index.js +33 -1
  87. package/utils/assertion.js +1 -2
  88. package/utils/function.js +9 -5
  89. package/utils/object.js +3 -3
@@ -2,30 +2,34 @@ import { BorderRadiusProp } from './borders';
2
2
  export interface BorderRadiusBottomProps {
3
3
  borderRadiusBottom?: BorderRadiusProp;
4
4
  }
5
- export declare const borderRadiusBottom: import("@xstyled/system").StyleGenerator;
5
+ export declare const borderRadiusBottom: import("@xstyled/styled-components").StyleGenerator;
6
6
  export interface BorderRadiusLeftProps {
7
7
  borderRadiusLeft?: BorderRadiusProp;
8
8
  }
9
- export declare const borderRadiusLeft: import("@xstyled/system").StyleGenerator;
9
+ export declare const borderRadiusLeft: import("@xstyled/styled-components").StyleGenerator;
10
10
  export interface BorderRadiusRightProps {
11
11
  borderRadiusRight?: BorderRadiusProp;
12
12
  }
13
- export declare const borderRadiusRight: import("@xstyled/system").StyleGenerator;
13
+ export declare const borderRadiusRight: import("@xstyled/styled-components").StyleGenerator;
14
14
  export interface BorderRadiusTopProps {
15
15
  borderRadiusTop?: BorderRadiusProp;
16
16
  }
17
- export declare const borderRadiusTop: import("@xstyled/system").StyleGenerator;
17
+ export declare const borderRadiusTop: import("@xstyled/styled-components").StyleGenerator;
18
18
  export interface IsTruncatedProps {
19
19
  isTruncated?: boolean;
20
20
  }
21
21
  /** Provides styling to truncate single-line text. */
22
- export declare const isTruncated: import("@xstyled/system").StyleGenerator;
22
+ export declare const isTruncated: import("@xstyled/styled-components").StyleGenerator;
23
23
  export interface MaxLinesProps {
24
24
  maxLines?: number;
25
25
  }
26
26
  /** Provides styling to truncate multi-line text. */
27
- export declare const maxLines: import("@xstyled/system").StyleGenerator;
27
+ export declare const maxLines: import("@xstyled/styled-components").StyleGenerator;
28
+ export declare type SpaceAroundProps = {
29
+ spaceAround?: number | string;
30
+ };
31
+ export declare const spaceAround: import("@xstyled/styled-components").StyleGenerator;
28
32
  export declare type WordBreakProps = {
29
33
  wordBreak?: 'normal' | 'break-all' | 'keep-all' | 'break-word';
30
34
  };
31
- export declare const wordBreak: import("@xstyled/system").StyleGenerator;
35
+ export declare const wordBreak: import("@xstyled/styled-components").StyleGenerator;
package/system/custom.js CHANGED
@@ -1,29 +1,29 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.wordBreak = exports.maxLines = exports.isTruncated = exports.borderRadiusTop = exports.borderRadiusRight = exports.borderRadiusLeft = exports.borderRadiusBottom = void 0;
4
- var system_1 = require("@xstyled/system");
5
- exports.borderRadiusBottom = system_1.style({
3
+ exports.wordBreak = exports.spaceAround = exports.maxLines = exports.isTruncated = exports.borderRadiusTop = exports.borderRadiusRight = exports.borderRadiusLeft = exports.borderRadiusBottom = void 0;
4
+ var styled_components_1 = require("@xstyled/styled-components");
5
+ exports.borderRadiusBottom = (0, styled_components_1.style)({
6
6
  prop: 'borderRadiusBottom',
7
- themeGet: system_1.getRadius,
7
+ themeGet: styled_components_1.getRadius,
8
8
  cssProperty: ['borderBottomLeftRadius', 'borderBottomRightRadius']
9
9
  });
10
- exports.borderRadiusLeft = system_1.style({
10
+ exports.borderRadiusLeft = (0, styled_components_1.style)({
11
11
  prop: 'borderRadiusLeft',
12
- themeGet: system_1.getRadius,
12
+ themeGet: styled_components_1.getRadius,
13
13
  cssProperty: ['borderBottomLeftRadius', 'borderTopLeftRadius']
14
14
  });
15
- exports.borderRadiusRight = system_1.style({
15
+ exports.borderRadiusRight = (0, styled_components_1.style)({
16
16
  prop: 'borderRadiusRight',
17
- themeGet: system_1.getRadius,
17
+ themeGet: styled_components_1.getRadius,
18
18
  cssProperty: ['borderBottomRightRadius', 'borderTopRightRadius']
19
19
  });
20
- exports.borderRadiusTop = system_1.style({
20
+ exports.borderRadiusTop = (0, styled_components_1.style)({
21
21
  prop: 'borderRadiusTop',
22
- themeGet: system_1.getRadius,
22
+ themeGet: styled_components_1.getRadius,
23
23
  cssProperty: ['borderTopLeftRadius', 'borderTopRightRadius']
24
24
  });
25
25
  /** Provides styling to truncate single-line text. */
26
- exports.isTruncated = system_1.style({
26
+ exports.isTruncated = (0, styled_components_1.style)({
27
27
  prop: 'isTruncated',
28
28
  cssProperty: function () {
29
29
  return {
@@ -35,7 +35,7 @@ exports.isTruncated = system_1.style({
35
35
  states: {}
36
36
  });
37
37
  /** Provides styling to truncate multi-line text. */
38
- exports.maxLines = system_1.style({
38
+ exports.maxLines = (0, styled_components_1.style)({
39
39
  prop: 'maxLines',
40
40
  cssProperty: function (value) {
41
41
  return {
@@ -47,6 +47,17 @@ exports.maxLines = system_1.style({
47
47
  },
48
48
  states: {}
49
49
  });
50
- exports.wordBreak = system_1.style({
50
+ exports.spaceAround = (0, styled_components_1.style)({
51
+ prop: 'spaceAround',
52
+ themeGet: styled_components_1.getSpace,
53
+ cssProperty: function (value) {
54
+ return {
55
+ '& > *': {
56
+ margin: value
57
+ }
58
+ };
59
+ }
60
+ });
61
+ exports.wordBreak = (0, styled_components_1.style)({
51
62
  prop: 'wordBreak'
52
63
  });
@@ -4,14 +4,15 @@ import { BordersProps } from './borders';
4
4
  import { EffectsProps } from './effects';
5
5
  import { FlexboxesProps } from './flexboxes';
6
6
  import { InteractivityProps } from './interactivity';
7
- import { BorderRadiusBottomProps, BorderRadiusLeftProps, BorderRadiusRightProps, BorderRadiusTopProps, IsTruncatedProps, MaxLinesProps, WordBreakProps } from './custom';
7
+ import { BorderRadiusBottomProps, BorderRadiusLeftProps, BorderRadiusRightProps, BorderRadiusTopProps, IsTruncatedProps, MaxLinesProps, SpaceAroundProps, WordBreakProps } from './custom';
8
8
  import { LayoutProps } from './layout';
9
9
  import { SizingProps } from './sizing';
10
10
  import { SpaceProps } from './space';
11
+ import { TablesProps } from './tables';
11
12
  import { TransformsProps } from './transforms';
12
13
  import { TransitionsProps } from './transitions';
13
14
  import { TypographyProps } from './typography';
14
- export interface SystemProps extends AnimationsProps, BackgroundColorProps, BordersProps, BorderRadiusBottomProps, BorderRadiusLeftProps, BorderRadiusRightProps, BorderRadiusTopProps, EffectsProps, FlexboxesProps, InteractivityProps, IsTruncatedProps, LayoutProps, MaxLinesProps, SizingProps, SpaceProps, TransformsProps, TransitionsProps, TypographyProps, WordBreakProps {
15
+ export interface SystemProps extends AnimationsProps, BackgroundColorProps, BordersProps, BorderRadiusBottomProps, BorderRadiusLeftProps, BorderRadiusRightProps, BorderRadiusTopProps, EffectsProps, FlexboxesProps, InteractivityProps, IsTruncatedProps, LayoutProps, MaxLinesProps, SizingProps, SpaceProps, SpaceAroundProps, TablesProps, TransformsProps, TransitionsProps, TypographyProps, WordBreakProps {
15
16
  }
16
- declare const _default: import("@xstyled/system").StyleGenerator;
17
+ declare const _default: import("@xstyled/styled-components").StyleGenerator;
17
18
  export default _default;
package/system/system.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- var system_1 = require("@xstyled/system");
3
+ var styled_components_1 = require("@xstyled/styled-components");
4
4
  var custom_1 = require("./custom");
5
- exports.default = system_1.compose(system_1.animation, system_1.backgroundColor, system_1.borders, custom_1.borderRadiusBottom, custom_1.borderRadiusLeft, custom_1.borderRadiusRight, custom_1.borderRadiusTop, system_1.color, system_1.effects, system_1.flexboxes, system_1.interactivity, custom_1.isTruncated, system_1.layout, custom_1.maxLines, system_1.sizing, system_1.space, system_1.transforms, system_1.transitions, system_1.typography, custom_1.wordBreak);
5
+ exports.default = (0, styled_components_1.compose)(styled_components_1.animation, styled_components_1.backgroundColor, styled_components_1.borders, custom_1.borderRadiusBottom, custom_1.borderRadiusLeft, custom_1.borderRadiusRight, custom_1.borderRadiusTop, styled_components_1.color, styled_components_1.effects, styled_components_1.flexboxes, styled_components_1.interactivity, custom_1.isTruncated, styled_components_1.layout, custom_1.maxLines, styled_components_1.sizing, styled_components_1.space, custom_1.spaceAround, styled_components_1.tables, styled_components_1.transforms, styled_components_1.transitions, styled_components_1.typography, custom_1.wordBreak);
@@ -0,0 +1,14 @@
1
+ import { SystemProp } from '@xstyled/system';
2
+ import * as CSS from 'csstype';
3
+ import { VuiTheme } from '../theme';
4
+ declare type BorderCollapseProp = SystemProp<CSS.Property.BorderCollapse, VuiTheme>;
5
+ export interface BorderCollapseProps {
6
+ borderCollapse?: BorderCollapseProp;
7
+ }
8
+ declare type TableLayoutProp = SystemProp<CSS.Property.TableLayout, VuiTheme>;
9
+ export interface TableLayoutProps {
10
+ tableLayout?: TableLayoutProp;
11
+ }
12
+ export interface TablesProps extends BorderCollapseProps, TableLayoutProps {
13
+ }
14
+ export {};
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/t/t.js CHANGED
@@ -35,11 +35,11 @@ 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.TBase = styled_components_1.default.span.withConfig(core_1.forwardPropConfig(system_1.system))(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n\t", "\n"], ["\n\t", "\n"])), system_1.system);
39
- exports.T = core_1.vui(function (props, ref) {
40
- var _a = core_1.omitThemingProps(props), align = _a.align, casing = _a.casing, centerV = _a.centerV, children = _a.children, className = _a.className, decoration = _a.decoration, text = _a.text, weight = _a.weight, rest = __rest(_a, ["align", "casing", "centerV", "children", "className", "decoration", "text", "weight"]);
41
- var styles = core_1.useStyleConfig('T', props);
42
- var aliasedProps = utils_1.filterUndefined({
38
+ exports.TBase = styled_components_1.default.span.withConfig((0, core_1.forwardPropConfig)(system_1.system))(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n\t", "\n"], ["\n\t", "\n"])), system_1.system);
39
+ exports.T = (0, core_1.vui)(function (props, ref) {
40
+ var _a = (0, core_1.omitThemingProps)(props), align = _a.align, casing = _a.casing, centerV = _a.centerV, children = _a.children, className = _a.className, decoration = _a.decoration, text = _a.text, weight = _a.weight, rest = __rest(_a, ["align", "casing", "centerV", "children", "className", "decoration", "text", "weight"]);
41
+ var styles = (0, core_1.useStyleConfig)('T', props);
42
+ var aliasedProps = (0, utils_1.filterUndefined)({
43
43
  alignItems: centerV ? 'center' : undefined,
44
44
  display: centerV ? 'inline-flex' : undefined,
45
45
  fontWeight: weight,
@@ -47,7 +47,7 @@ exports.T = core_1.vui(function (props, ref) {
47
47
  textDecoration: decoration,
48
48
  textTransform: casing
49
49
  });
50
- return (react_1.default.createElement(exports.TBase, __assign({ className: utils_1.cs('vui-t', className), ref: ref, transitionDuration: "fast" }, styles, aliasedProps, rest), children !== null && children !== void 0 ? children : text));
50
+ return (react_1.default.createElement(exports.TBase, __assign({ className: (0, utils_1.cs)('vui-t', className), ref: ref, transitionDuration: "fast" }, styles, aliasedProps, rest), children !== null && children !== void 0 ? children : text));
51
51
  });
52
52
  exports.T.displayName = 'T';
53
53
  exports.default = exports.T;
package/tag/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.useTag = exports.TagProvider = void 0;
20
20
  var core_1 = require("../core");
21
- var _a = __read(core_1.createContext({ isOptional: true }), 2), TagProvider = _a[0], useTag = _a[1];
21
+ var _a = __read((0, core_1.createContext)({ isOptional: true }), 2), TagProvider = _a[0], useTag = _a[1];
22
22
  exports.TagProvider = TagProvider;
23
23
  exports.useTag = useTag;
package/tag/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export * from './context';
2
2
  export * from './tag';
3
3
  export * from './tag.types';
4
+ export * from './tagButton';
4
5
  export * from './tagIcon';
5
6
  export * from './tagText';
6
7
  export { default } from './tag';
package/tag/index.js CHANGED
@@ -17,6 +17,7 @@ exports.default = void 0;
17
17
  __exportStar(require("./context"), exports);
18
18
  __exportStar(require("./tag"), exports);
19
19
  __exportStar(require("./tag.types"), exports);
20
+ __exportStar(require("./tagButton"), exports);
20
21
  __exportStar(require("./tagIcon"), exports);
21
22
  __exportStar(require("./tagText"), exports);
22
23
  var tag_1 = require("./tag");
package/tag/tag.d.ts CHANGED
@@ -1,10 +1,12 @@
1
1
  import { TagProps } from './tag.types';
2
+ import TagButton from './tagButton';
2
3
  import TagIcon from './tagIcon';
3
4
  import TagText from './tagText';
4
5
  import { VuiComponent } from '../core';
5
6
  import { SystemProps } from '../system';
6
7
  export declare const TagBase: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme, SystemProps, never>;
7
8
  export declare const Tag: VuiComponent<"span", TagProps> & {
9
+ Button: typeof TagButton;
8
10
  Icon: typeof TagIcon;
9
11
  Text: typeof TagText;
10
12
  };
package/tag/tag.js CHANGED
@@ -52,17 +52,18 @@ exports.Tag = exports.TagBase = void 0;
52
52
  var react_1 = __importStar(require("react"));
53
53
  var styled_components_1 = __importDefault(require("styled-components"));
54
54
  var context_1 = require("./context");
55
+ var tagButton_1 = __importDefault(require("./tagButton"));
55
56
  var tagIcon_1 = __importDefault(require("./tagIcon"));
56
57
  var tagText_1 = __importDefault(require("./tagText"));
57
58
  var core_1 = require("../core");
58
59
  var system_1 = require("../system");
59
60
  var utils_1 = require("../utils");
60
- exports.TagBase = styled_components_1.default.span.withConfig(core_1.forwardPropConfig(system_1.system))(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n\talign-items: center;\n\tdisplay: inline-flex;\n\tjustify-content: center;\n\tline-height: normal;\n\tposition: relative;\n\twidth: fit-content;\n\n\t&:focus {\n\t\tborder-color: transparent;\n\t\toutline: none;\n\t}\n\n\t", "\n"], ["\n\talign-items: center;\n\tdisplay: inline-flex;\n\tjustify-content: center;\n\tline-height: normal;\n\tposition: relative;\n\twidth: fit-content;\n\n\t&:focus {\n\t\tborder-color: transparent;\n\t\toutline: none;\n\t}\n\n\t", "\n"])), system_1.system);
61
- exports.Tag = core_1.vui(function (props, ref) {
62
- var casing = props.casing, children = props.children, className = props.className, colorScheme = props.colorScheme, icon = props.icon, iconLeft = props.iconLeft, iconRight = props.iconRight, isFullWidth = props.isFullWidth, _a = props.isInteractive, isInteractive = _a === void 0 ? props.onClick !== undefined : _a, isRound = props.isRound, _b = props.isTruncated, isTruncated = _b === void 0 ? true : _b, itemLeft = props.itemLeft, itemRight = props.itemRight, size = props.size, text = props.text, variant = props.variant, weight = props.weight, rest = __rest(props, ["casing", "children", "className", "colorScheme", "icon", "iconLeft", "iconRight", "isFullWidth", "isInteractive", "isRound", "isTruncated", "itemLeft", "itemRight", "size", "text", "variant", "weight"]);
63
- var styles = core_1.useStyleConfig('Tag', props);
64
- var _c = styles.container, activeBg = _c.activeBg, h = _c.h, hoverBg = _c.hoverBg, _d = _c.spaceX, spaceXBase = _d === void 0 ? 0 : _d, tagStyles = __rest(_c, ["activeBg", "h", "hoverBg", "spaceX"]);
65
- var context = react_1.useMemo(function () { return utils_1.filterUndefined({ colorScheme: colorScheme, size: size, variant: variant }); }, [colorScheme, size, variant]);
61
+ exports.TagBase = styled_components_1.default.span.withConfig((0, core_1.forwardPropConfig)(system_1.system))(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n\talign-items: center;\n\tdisplay: inline-flex;\n\tjustify-content: center;\n\tline-height: normal;\n\tposition: relative;\n\twidth: fit-content;\n\n\t&:focus {\n\t\tborder-color: transparent;\n\t\toutline: none;\n\t}\n\n\t", "\n"], ["\n\talign-items: center;\n\tdisplay: inline-flex;\n\tjustify-content: center;\n\tline-height: normal;\n\tposition: relative;\n\twidth: fit-content;\n\n\t&:focus {\n\t\tborder-color: transparent;\n\t\toutline: none;\n\t}\n\n\t", "\n"])), system_1.system);
62
+ exports.Tag = (0, core_1.vui)(function (props, ref) {
63
+ var casing = props.casing, children = props.children, className = props.className, _a = props.colorScheme, colorScheme = _a === void 0 ? 'blue' : _a, icon = props.icon, iconLeft = props.iconLeft, iconRight = props.iconRight, isFullWidth = props.isFullWidth, _b = props.isInteractive, isInteractive = _b === void 0 ? props.onClick !== undefined : _b, isRound = props.isRound, _c = props.isTruncated, isTruncated = _c === void 0 ? true : _c, itemLeft = props.itemLeft, itemRight = props.itemRight, onDelete = props.onDelete, _d = props.size, size = _d === void 0 ? 'md' : _d, text = props.text, _e = props.variant, variant = _e === void 0 ? 'subtle' : _e, weight = props.weight, rest = __rest(props, ["casing", "children", "className", "colorScheme", "icon", "iconLeft", "iconRight", "isFullWidth", "isInteractive", "isRound", "isTruncated", "itemLeft", "itemRight", "onDelete", "size", "text", "variant", "weight"]);
64
+ var styles = (0, core_1.useStyleConfig)('Tag', props);
65
+ var _f = styles.container, activeBg = _f.activeBg, h = _f.h, hoverBg = _f.hoverBg, _g = _f.spaceX, spaceXBase = _g === void 0 ? 0 : _g, tagStyles = __rest(_f, ["activeBg", "h", "hoverBg", "spaceX"]);
66
+ var context = (0, react_1.useMemo)(function () { return (0, utils_1.filterUndefined)({ colorScheme: colorScheme, size: size, variant: variant }); }, [colorScheme, size, variant]);
66
67
  var spaceX = spaceXBase / 8;
67
68
  var spaceXText = (spaceXBase + 4) / 8;
68
69
  var pl = icon || itemLeft || iconLeft ? spaceX : spaceXText;
@@ -77,22 +78,23 @@ exports.Tag = core_1.vui(function (props, ref) {
77
78
  userSelect: 'none'
78
79
  }
79
80
  : {};
80
- var aliasedProps = utils_1.filterUndefined({
81
+ var aliasedProps = (0, utils_1.filterUndefined)({
81
82
  borderRadius: isRound ? h / 2 : undefined,
82
83
  fontWeight: weight,
83
84
  textTransform: casing,
84
85
  w: isFullWidth ? '100%' : undefined
85
86
  });
86
87
  return (react_1.default.createElement(context_1.TagProvider, { value: context },
87
- react_1.default.createElement(exports.TagBase, __assign({ borderRadius: "md", className: utils_1.cs('vui-tag', className), fontWeight: "medium", h: h, pl: pl, pr: pr, ref: ref, transitionDuration: "fast" }, tagStyles, interactiveProps, aliasedProps, rest),
88
- utils_1.isString(icon) ? react_1.default.createElement(tagIcon_1.default, { name: icon }) : icon,
88
+ react_1.default.createElement(exports.TagBase, __assign({ borderRadius: "md", className: (0, utils_1.cs)('vui-tag', className), fontWeight: "medium", h: h, pl: pl, pr: pr, ref: ref, transitionDuration: "fast" }, tagStyles, interactiveProps, aliasedProps, rest),
89
+ (0, utils_1.isString)(icon) ? react_1.default.createElement(tagIcon_1.default, { name: icon }) : icon,
89
90
  !icon && (react_1.default.createElement(react_1.default.Fragment, null,
90
91
  itemLeft,
91
- utils_1.isString(iconLeft) ? react_1.default.createElement(tagIcon_1.default, { mr: spaceX, name: iconLeft }) : iconLeft, children !== null && children !== void 0 ? children : (utils_1.isReactText(text) ? react_1.default.createElement(tagText_1.default, __assign({}, { isTruncated: isTruncated, text: text })) : text),
92
- utils_1.isString(iconRight) ? react_1.default.createElement(tagIcon_1.default, { ml: spaceX, name: iconRight }) : iconRight,
93
- itemRight)))));
92
+ (0, utils_1.isString)(iconLeft) ? react_1.default.createElement(tagIcon_1.default, { mr: spaceX, name: iconLeft }) : iconLeft, children !== null && children !== void 0 ? children : ((0, utils_1.isReactText)(text) ? react_1.default.createElement(tagText_1.default, __assign({}, { isTruncated: isTruncated, text: text })) : text),
93
+ (0, utils_1.isString)(iconRight) ? react_1.default.createElement(tagIcon_1.default, { ml: spaceX, name: iconRight }) : iconRight,
94
+ onDelete ? react_1.default.createElement(tagButton_1.default, { ml: spaceX, onClick: onDelete }) : itemRight)))));
94
95
  });
95
96
  exports.Tag.displayName = 'Tag';
97
+ exports.Tag.Button = tagButton_1.default;
96
98
  exports.Tag.Icon = tagIcon_1.default;
97
99
  exports.Tag.Text = tagText_1.default;
98
100
  exports.default = exports.Tag;
@@ -14,6 +14,7 @@ export interface TagProps extends SystemProps, ThemingProps<'Tag'> {
14
14
  isRound?: boolean;
15
15
  itemLeft?: React.ReactNode;
16
16
  itemRight?: React.ReactNode;
17
+ onDelete?: () => void;
17
18
  text?: React.ReactNode;
18
19
  weight?: TypographyProps['fontWeight'];
19
20
  }
@@ -0,0 +1,3 @@
1
+ import { ButtonProps } from '../button';
2
+ export declare const TagButton: import("../core").VuiComponent<"button", ButtonProps>;
3
+ export default TagButton;
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __importDefault = (this && this.__importDefault) || function (mod) {
14
+ return (mod && mod.__esModule) ? mod : { "default": mod };
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.TagButton = void 0;
18
+ var react_1 = __importDefault(require("react"));
19
+ var context_1 = require("./context");
20
+ var button_1 = __importDefault(require("../button"));
21
+ var core_1 = require("../core");
22
+ exports.TagButton = (0, core_1.vui)(function (props, ref) {
23
+ var _a;
24
+ var tagProps = (_a = (0, context_1.useTag)()) !== null && _a !== void 0 ? _a : {};
25
+ var mergedProps = __assign(__assign({}, tagProps), props);
26
+ var styles = (0, core_1.useStyleConfig)('Tag', mergedProps);
27
+ return (react_1.default.createElement(button_1.default, __assign({ className: "vui-tagButton", colorScheme: mergedProps.colorScheme, icon: "falTimes", isRound: true, mr: -0.5, ref: ref }, styles.button, props)));
28
+ });
29
+ exports.TagButton.displayName = 'TagButton';
30
+ exports.default = exports.TagButton;
package/tag/tagIcon.js CHANGED
@@ -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.TagIcon = core_1.vui(function (props, ref) {
22
+ exports.TagIcon = (0, core_1.vui)(function (props, ref) {
23
23
  var _a;
24
- var tagProps = (_a = context_1.useTag()) !== null && _a !== void 0 ? _a : {};
24
+ var tagProps = (_a = (0, context_1.useTag)()) !== null && _a !== void 0 ? _a : {};
25
25
  var mergedProps = __assign(__assign({}, tagProps), props);
26
- var styles = core_1.useStyleConfig('Tag', mergedProps);
26
+ var styles = (0, core_1.useStyleConfig)('Tag', mergedProps);
27
27
  return react_1.default.createElement(icon_1.default, __assign({ className: "vui-tagIcon", ref: ref }, styles.icon, props));
28
28
  });
29
29
  exports.TagIcon.displayName = 'TagIcon';
package/tag/tagText.js CHANGED
@@ -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.TagText = core_1.vui(function (props, ref) {
22
+ exports.TagText = (0, core_1.vui)(function (props, ref) {
23
23
  var _a;
24
- var tagProps = (_a = context_1.useTag()) !== null && _a !== void 0 ? _a : {};
24
+ var tagProps = (_a = (0, context_1.useTag)()) !== null && _a !== void 0 ? _a : {};
25
25
  var mergedProps = __assign(__assign({}, tagProps), props);
26
- var styles = core_1.useStyleConfig('Tag', mergedProps);
26
+ var styles = (0, core_1.useStyleConfig)('Tag', mergedProps);
27
27
  return react_1.default.createElement(t_1.default, __assign({ className: "vui-tagText", fontSize: "inherit", ref: ref }, styles.text, props));
28
28
  });
29
29
  exports.TagText.displayName = 'TagText';
package/tag/theme.d.ts CHANGED
@@ -6,6 +6,15 @@ declare function variantSolid(props: Dict): {
6
6
  bg: string;
7
7
  color: string;
8
8
  };
9
+ button: {
10
+ hoverBorderColor: string;
11
+ borderColor: string;
12
+ color: string;
13
+ hoverBg: string;
14
+ activeBg: string;
15
+ bg: string;
16
+ variant: string;
17
+ };
9
18
  };
10
19
  declare function variantSubtle(props: Dict): {
11
20
  container: {
@@ -14,6 +23,14 @@ declare function variantSubtle(props: Dict): {
14
23
  bg: string;
15
24
  color: string;
16
25
  };
26
+ button: {
27
+ hoverBorderColor: string;
28
+ borderColor: string;
29
+ color: string;
30
+ hoverBg: string;
31
+ activeBg: string;
32
+ variant: string;
33
+ };
17
34
  };
18
35
  declare const _default: {
19
36
  defaultProps: {
@@ -29,6 +46,9 @@ declare const _default: {
29
46
  h: number;
30
47
  spaceX: number;
31
48
  };
49
+ button: {
50
+ size: string;
51
+ };
32
52
  icon: {
33
53
  size: string;
34
54
  };
@@ -40,6 +60,9 @@ declare const _default: {
40
60
  h: number;
41
61
  spaceX: number;
42
62
  };
63
+ button: {
64
+ size: string;
65
+ };
43
66
  icon: {
44
67
  size: string;
45
68
  };
@@ -51,6 +74,9 @@ declare const _default: {
51
74
  h: number;
52
75
  spaceX: number;
53
76
  };
77
+ button: {
78
+ size: string;
79
+ };
54
80
  icon: {
55
81
  size: string;
56
82
  };
package/tag/theme.js CHANGED
@@ -8,12 +8,24 @@ function variantSolid(props) {
8
8
  bg: c + ".80",
9
9
  color: 'white'
10
10
  };
11
+ var button = {
12
+ hoverBorderColor: "transparent",
13
+ borderColor: "transparent",
14
+ color: 'white',
15
+ hoverBg: c + ".70",
16
+ activeBg: c + ".60",
17
+ bg: c + ".80",
18
+ variant: 'solid'
19
+ };
11
20
  if (c === 'yellow') {
12
21
  container.hoverBg = c + ".80";
13
22
  container.activeBg = c + ".90";
14
23
  container.bg = c + ".70";
24
+ button.hoverBg = 'yellow.60';
25
+ button.activeBg = 'yellow.50';
26
+ button.bg = 'yellow.70';
15
27
  }
16
- return { container: container };
28
+ return { container: container, button: button };
17
29
  }
18
30
  function variantSubtle(props) {
19
31
  var c = props.colorScheme;
@@ -23,14 +35,22 @@ function variantSubtle(props) {
23
35
  bg: c + ".20",
24
36
  color: 'prussian.80'
25
37
  };
26
- return { container: container };
38
+ var button = {
39
+ hoverBorderColor: "transparent",
40
+ borderColor: "transparent",
41
+ color: c + ".90",
42
+ hoverBg: c + ".30",
43
+ activeBg: c + ".40",
44
+ variant: 'outlined'
45
+ };
46
+ return { container: container, button: button };
27
47
  }
28
48
  var defaultProps = {
29
49
  colorScheme: 'blue',
30
50
  size: 'md',
31
51
  variant: 'subtle'
32
52
  };
33
- var parts = ['container', 'icon', 'text'];
53
+ var parts = ['container', 'button', 'icon', 'text'];
34
54
  var sizes = {
35
55
  sm: {
36
56
  container: {
@@ -38,6 +58,9 @@ var sizes = {
38
58
  h: 24,
39
59
  spaceX: 4
40
60
  },
61
+ button: {
62
+ size: 'xs'
63
+ },
41
64
  icon: {
42
65
  size: 'xs'
43
66
  },
@@ -49,6 +72,9 @@ var sizes = {
49
72
  h: 32,
50
73
  spaceX: 6
51
74
  },
75
+ button: {
76
+ size: 'xs'
77
+ },
52
78
  icon: {
53
79
  size: 'sm'
54
80
  },
@@ -60,6 +86,9 @@ var sizes = {
60
86
  h: 40,
61
87
  spaceX: 8
62
88
  },
89
+ button: {
90
+ size: 'sm'
91
+ },
63
92
  icon: {
64
93
  size: 'md'
65
94
  },
@@ -72,25 +72,25 @@ var core_1 = require("../core");
72
72
  var system_1 = require("../system");
73
73
  var t_1 = __importDefault(require("../t"));
74
74
  var utils_1 = require("../utils");
75
- exports.TextareaTextarea = styled_components_1.default.textarea.withConfig(core_1.forwardPropConfig(system_1.system))(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n\tborder-width: 1px;\n\theight: 100%;\n\toutline: none;\n\tresize: none;\n\twidth: 100%;\n\n\t:disabled,\n\t:disabled::placeholder {\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\t", "\n"], ["\n\tborder-width: 1px;\n\theight: 100%;\n\toutline: none;\n\tresize: none;\n\twidth: 100%;\n\n\t:disabled,\n\t:disabled::placeholder {\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\t", "\n"])), system_1.system);
76
- exports.TextareaBase = styled_components_1.default.div.withConfig(core_1.forwardPropConfig(system_1.system))(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n\tdisplay: flex;\n\tflex-direction: column;\n\tmin-height: 80px;\n\tposition: relative;\n\twidth: 100%;\n\n\t", "\n"], ["\n\tdisplay: flex;\n\tflex-direction: column;\n\tmin-height: 80px;\n\tposition: relative;\n\twidth: 100%;\n\n\t", "\n"])), system_1.system);
77
- exports.Textarea = core_1.vui(function (props, ref) {
78
- var _a = __read(react_1.useState(helpers_1.getInitialCount(props)), 2), count = _a[0], setCount = _a[1];
79
- var _b = core_1.omitThemingProps(props), autoFocus = _b.autoFocus, className = _b.className, colorSchemeProp = _b.colorScheme, defaultValue = _b.defaultValue, disabled = _b.disabled, id = _b.id, isInvalid = _b.isInvalid, maxLength = _b.maxLength, name = _b.name, onBlur = _b.onBlur, onChangeProp = _b.onChange, onFocus = _b.onFocus, placeholder = _b.placeholder, readOnly = _b.readOnly, required = _b.required, resize = _b.resize, showCount = _b.showCount, _c = _b.textareaProps, textareaProps = _c === void 0 ? {} : _c, textareaRef = _b.textareaRef, value = _b.value, rest = __rest(_b, ["autoFocus", "className", "colorScheme", "defaultValue", "disabled", "id", "isInvalid", "maxLength", "name", "onBlur", "onChange", "onFocus", "placeholder", "readOnly", "required", "resize", "showCount", "textareaProps", "textareaRef", "value"]);
80
- var colorProps = utils_1.filterUndefined({
75
+ exports.TextareaTextarea = styled_components_1.default.textarea.withConfig((0, core_1.forwardPropConfig)(system_1.system))(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n\tborder-width: 1px;\n\theight: 100%;\n\toutline: none;\n\tresize: none;\n\twidth: 100%;\n\n\t:disabled,\n\t:disabled::placeholder {\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\t", "\n"], ["\n\tborder-width: 1px;\n\theight: 100%;\n\toutline: none;\n\tresize: none;\n\twidth: 100%;\n\n\t:disabled,\n\t:disabled::placeholder {\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\t", "\n"])), system_1.system);
76
+ exports.TextareaBase = styled_components_1.default.div.withConfig((0, core_1.forwardPropConfig)(system_1.system))(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n\tdisplay: flex;\n\tflex-direction: column;\n\tmin-height: 80px;\n\tposition: relative;\n\twidth: 100%;\n\n\t", "\n"], ["\n\tdisplay: flex;\n\tflex-direction: column;\n\tmin-height: 80px;\n\tposition: relative;\n\twidth: 100%;\n\n\t", "\n"])), system_1.system);
77
+ exports.Textarea = (0, core_1.vui)(function (props, ref) {
78
+ var _a = __read((0, react_1.useState)((0, helpers_1.getInitialCount)(props)), 2), count = _a[0], setCount = _a[1];
79
+ var _b = (0, core_1.omitThemingProps)(props), autoFocus = _b.autoFocus, className = _b.className, colorSchemeProp = _b.colorScheme, defaultValue = _b.defaultValue, disabled = _b.disabled, id = _b.id, isInvalid = _b.isInvalid, maxLength = _b.maxLength, name = _b.name, onBlur = _b.onBlur, onChangeProp = _b.onChange, onFocus = _b.onFocus, placeholder = _b.placeholder, readOnly = _b.readOnly, required = _b.required, resize = _b.resize, showCount = _b.showCount, _c = _b.textareaProps, textareaProps = _c === void 0 ? {} : _c, textareaRef = _b.textareaRef, value = _b.value, rest = __rest(_b, ["autoFocus", "className", "colorScheme", "defaultValue", "disabled", "id", "isInvalid", "maxLength", "name", "onBlur", "onChange", "onFocus", "placeholder", "readOnly", "required", "resize", "showCount", "textareaProps", "textareaRef", "value"]);
80
+ var colorProps = (0, utils_1.filterUndefined)({
81
81
  colorScheme: colorSchemeProp !== null && colorSchemeProp !== void 0 ? colorSchemeProp : (isInvalid ? 'red' : undefined)
82
82
  });
83
- var styles = core_1.useStyleConfig('Textarea', __assign(__assign({}, colorProps), props));
83
+ var styles = (0, core_1.useStyleConfig)('Textarea', __assign(__assign({}, colorProps), props));
84
84
  function onChange(e) {
85
85
  setCount(e.target.value.length);
86
86
  onChangeProp === null || onChangeProp === void 0 ? void 0 : onChangeProp(e);
87
87
  }
88
- var aliasedProps = utils_1.filterUndefined({
88
+ var aliasedProps = (0, utils_1.filterUndefined)({
89
89
  bg: readOnly ? 'grey.20' : undefined,
90
90
  focusBorderColor: !readOnly ? 'transparent' : undefined,
91
91
  focusRing: readOnly ? 0 : undefined
92
92
  });
93
- return (react_1.default.createElement(exports.TextareaBase, __assign({ className: utils_1.cs('vui-textarea', className), ref: ref }, styles.container, rest),
93
+ return (react_1.default.createElement(exports.TextareaBase, __assign({ className: (0, utils_1.cs)('vui-textarea', className), ref: ref }, styles.container, rest),
94
94
  react_1.default.createElement(exports.TextareaTextarea, __assign({ borderRadius: "md", className: "vui-textareaTextarea", p: 1, placeholderColor: "grey.60", ref: textareaRef, transitionDuration: "fast" }, {
95
95
  autoFocus: autoFocus,
96
96
  defaultValue: defaultValue,
@@ -786,6 +786,9 @@ declare const _default: {
786
786
  h: number;
787
787
  spaceX: number;
788
788
  };
789
+ button: {
790
+ size: string;
791
+ };
789
792
  icon: {
790
793
  size: string;
791
794
  };
@@ -797,6 +800,9 @@ declare const _default: {
797
800
  h: number;
798
801
  spaceX: number;
799
802
  };
803
+ button: {
804
+ size: string;
805
+ };
800
806
  icon: {
801
807
  size: string;
802
808
  };
@@ -808,6 +814,9 @@ declare const _default: {
808
814
  h: number;
809
815
  spaceX: number;
810
816
  };
817
+ button: {
818
+ size: string;
819
+ };
811
820
  icon: {
812
821
  size: string;
813
822
  };
@@ -822,6 +831,15 @@ declare const _default: {
822
831
  bg: string;
823
832
  color: string;
824
833
  };
834
+ button: {
835
+ hoverBorderColor: string;
836
+ borderColor: string;
837
+ color: string;
838
+ hoverBg: string;
839
+ activeBg: string;
840
+ bg: string;
841
+ variant: string;
842
+ };
825
843
  };
826
844
  subtle: (props: import("..").Dict<any>) => {
827
845
  container: {
@@ -830,6 +848,14 @@ declare const _default: {
830
848
  bg: string;
831
849
  color: string;
832
850
  };
851
+ button: {
852
+ hoverBorderColor: string;
853
+ borderColor: string;
854
+ color: string;
855
+ hoverBg: string;
856
+ activeBg: string;
857
+ variant: string;
858
+ };
833
859
  };
834
860
  };
835
861
  };