@veracity/vui 0.0.10 → 0.0.11

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.
package/alert/alert.js CHANGED
@@ -58,9 +58,9 @@ var core_1 = require("../core");
58
58
  var utils_1 = require("../utils");
59
59
  exports.Alert = core_1.vui(function (props, ref) {
60
60
  var _a;
61
- var action = props.action, children = props.children, className = props.className, _b = props.colorScheme, colorSchemeProp = _b === void 0 ? 'blue' : _b, iconProp = props.icon, isVertical = props.isVertical, onClose = props.onClose, size = props.size, status = props.status, statusMapping = props.statusMapping, text = props.text, title = props.title, variant = props.variant, rest = __rest(props, ["action", "children", "className", "colorScheme", "icon", "isVertical", "onClose", "size", "status", "statusMapping", "text", "title", "variant"]);
61
+ var action = props.action, children = props.children, className = props.className, _b = props.colorScheme, colorSchemeProp = _b === void 0 ? 'blue' : _b, icon = props.icon, isVertical = props.isVertical, onClose = props.onClose, size = props.size, _c = props.status, status = _c === void 0 ? '' : _c, statusMapping = props.statusMapping, text = props.text, title = props.title, variant = props.variant, rest = __rest(props, ["action", "children", "className", "colorScheme", "icon", "isVertical", "onClose", "size", "status", "statusMapping", "text", "title", "variant"]);
62
62
  var statuses = __assign(__assign({}, consts_1.alertStatusMapping), statusMapping);
63
- var _c = (_a = (status && statuses[status])) !== null && _a !== void 0 ? _a : {}, _d = _c.colorScheme, colorScheme = _d === void 0 ? colorSchemeProp : _d, _e = _c.icon, icon = _e === void 0 ? iconProp : _e;
63
+ var _d = ((_a = statuses[status]) !== null && _a !== void 0 ? _a : {}).colorScheme, colorScheme = _d === void 0 ? colorSchemeProp : _d;
64
64
  var styles = core_1.useStyleConfig('Alert', __assign({ colorScheme: colorScheme }, props));
65
65
  var context = react_1.useMemo(function () { return utils_1.filterUndefined({ colorScheme: colorScheme, isVertical: isVertical, size: size, status: status, variant: variant }); }, [
66
66
  colorScheme,
@@ -71,7 +71,7 @@ exports.Alert = core_1.vui(function (props, ref) {
71
71
  ]);
72
72
  return (react_1.default.createElement(context_1.AlertProvider, { value: context },
73
73
  react_1.default.createElement(box_1.default, __assign({ borderRadius: "md", className: utils_1.cs('vui-alert', className), px: 1.5, py: 1, ref: ref, w: "fit-content" }, styles.container, rest), children ? (children) : (react_1.default.createElement(react_1.default.Fragment, null,
74
- typeof icon === 'string' ? (react_1.default.createElement(alertIcon_1.default, { animation: status === 'loading' ? 'spin' : undefined, icon: icon })) : (icon),
74
+ status ? react_1.default.createElement(alertIcon_1.default, null) : typeof icon === 'string' ? react_1.default.createElement(alertIcon_1.default, { icon: icon }) : icon,
75
75
  react_1.default.createElement(alertMessage_1.default, null,
76
76
  title && react_1.default.createElement(alertTitle_1.default, null, title),
77
77
  text && react_1.default.createElement(alertText_1.default, null, text)),
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  import { BoxProps } from '../box';
3
+ import { IconProps } from '../icon';
3
4
  import { ThemingProps } from '../theme';
4
5
  export interface AlertProps extends Omit<BoxProps, 'size' | 'variant'>, ThemingProps<'Alert'> {
5
6
  action?: React.ReactElement;
@@ -15,5 +16,5 @@ export interface AlertProps extends Omit<BoxProps, 'size' | 'variant'>, ThemingP
15
16
  export declare type AlertStatus = 'error' | 'info' | 'loading' | 'success' | 'warning';
16
17
  export declare type AlertStatusMapping = Record<string, {
17
18
  colorScheme?: AlertProps['colorScheme'];
18
- icon: AlertProps['icon'];
19
+ iconProps: IconProps;
19
20
  }>;
@@ -25,9 +25,9 @@ exports.AlertIcon = core_1.vui(function (props, ref) {
25
25
  var alertProps = (_a = context_1.useAlert()) !== null && _a !== void 0 ? _a : {};
26
26
  var mergedProps = __assign(__assign({}, alertProps), props);
27
27
  var styles = core_1.useStyleConfig('Alert', mergedProps);
28
- var status = mergedProps.status;
29
- var icon = ((_b = (status && consts_1.alertStatusMapping[status])) !== null && _b !== void 0 ? _b : {}).icon;
30
- return (react_1.default.createElement(icon_1.default, __assign({ animation: status === 'loading' ? 'spin' : undefined, className: "vui-alertIcon", icon: icon, mr: 1, my: 0.5, ref: ref, size: "md" }, styles.icon, props)));
28
+ var _c = mergedProps.status, status = _c === void 0 ? '' : _c;
29
+ var iconProps = ((_b = consts_1.alertStatusMapping[status]) !== null && _b !== void 0 ? _b : {}).iconProps;
30
+ return (react_1.default.createElement(icon_1.default, __assign({ className: "vui-alertIcon", mr: 1, my: 0.5, ref: ref, size: "md" }, styles.icon, iconProps, props)));
31
31
  });
32
32
  exports.AlertIcon.displayName = 'AlertIcon';
33
33
  exports.default = exports.AlertIcon;
@@ -1,3 +1,3 @@
1
1
  import { HeadingProps } from '../heading';
2
- export declare const AlertTitle: import("../core").VuiComponent<"h2", HeadingProps>;
2
+ export declare const AlertTitle: import("../core").VuiComponent<"h6", HeadingProps>;
3
3
  export default AlertTitle;
@@ -24,7 +24,7 @@ exports.AlertTitle = core_1.vui(function (props, ref) {
24
24
  var alertProps = (_a = context_1.useAlert()) !== null && _a !== void 0 ? _a : {};
25
25
  var mergedProps = __assign(__assign({}, alertProps), props);
26
26
  var styles = core_1.useStyleConfig('Alert', mergedProps);
27
- return react_1.default.createElement(heading_1.H2, __assign({ className: "vui-alertTitle", lineHeight: 1.5, mr: 1, ref: ref }, styles.title, props));
27
+ return react_1.default.createElement(heading_1.H6, __assign({ className: "vui-alertTitle", lineHeight: 1.5, mr: 1, ref: ref }, styles.title, props));
28
28
  });
29
29
  exports.AlertTitle.displayName = 'AlertTitle';
30
30
  exports.default = exports.AlertTitle;
package/alert/consts.js CHANGED
@@ -4,22 +4,34 @@ exports.alertStatusMapping = void 0;
4
4
  exports.alertStatusMapping = {
5
5
  error: {
6
6
  colorScheme: 'red',
7
- icon: 'falTimesCircle'
7
+ iconProps: {
8
+ icon: 'falTimesCircle'
9
+ }
8
10
  },
9
11
  info: {
10
12
  colorScheme: 'blue',
11
- icon: 'falInfoCircle'
13
+ iconProps: {
14
+ icon: 'falInfoCircle'
15
+ }
12
16
  },
13
17
  loading: {
14
18
  colorScheme: 'blue',
15
- icon: 'falSpinner'
19
+ iconProps: {
20
+ animation: 'vui-spin 0.6s linear infinite',
21
+ fill: ['blue.40', 'blue.60'],
22
+ icon: 'fadSpinnerThird'
23
+ }
16
24
  },
17
25
  success: {
18
26
  colorScheme: 'green',
19
- icon: 'falCheckCircle'
27
+ iconProps: {
28
+ icon: 'falCheckCircle'
29
+ }
20
30
  },
21
31
  warning: {
22
32
  colorScheme: 'yellow',
23
- icon: 'falExclamationCircle'
33
+ iconProps: {
34
+ icon: 'falExclamationCircle'
35
+ }
24
36
  }
25
37
  };
package/button/button.js CHANGED
@@ -32,22 +32,28 @@ Object.defineProperty(exports, "__esModule", { value: true });
32
32
  exports.Button = exports.ButtonBase = void 0;
33
33
  var react_1 = __importDefault(require("react"));
34
34
  var styled_components_1 = __importDefault(require("styled-components"));
35
+ var consts_1 = require("./consts");
35
36
  var context_1 = require("./context");
36
37
  var core_1 = require("../core");
37
38
  var icon_1 = __importDefault(require("../icon"));
38
39
  var system_1 = require("../system");
39
40
  var utils_1 = require("../utils");
40
41
  var ContentWrapper = styled_components_1.default.span(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n\tvisibility: hidden;\n"], ["\n\tvisibility: hidden;\n"])));
41
- var LoadingWrapper = styled_components_1.default.span(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\tbottom: 0;\n\tdisplay: flex;\n\tleft: 0;\n\tposition: absolute;\n\tright: 0;\n\ttop: 0;\n"])));
42
- 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: flex;\n\tflex-shrink: 0;\n\tjustify-content: center;\n\tline-height: normal;\n\tposition: relative;\n\tuser-select: none;\n\twidth: fit-content;\n\n\t&:focus {\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: flex;\n\tflex-shrink: 0;\n\tjustify-content: center;\n\tline-height: normal;\n\tposition: relative;\n\tuser-select: none;\n\twidth: fit-content;\n\n\t&:focus {\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);
42
+ 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);
43
+ 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: 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\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: 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\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);
43
44
  exports.Button = core_1.vui(function (props, ref) {
44
- var _a;
45
+ var _a, _b;
45
46
  var buttonGroupProps = context_1.useButtonGroup();
46
47
  var mergedProps = __assign(__assign({}, buttonGroupProps), props);
47
- var _b = core_1.omitThemingProps(mergedProps), 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', mergedProps), 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"]);
49
- var Content = isLoading ? ContentWrapper : react_1.default.Fragment;
50
- var border = (_a = borderWidthProp !== null && borderWidthProp !== void 0 ? borderWidthProp : borderWidth) !== null && _a !== void 0 ? _a : 0;
48
+ var _c = core_1.omitThemingProps(mergedProps), borderWidthProp = _c.borderWidth, children = _c.children, className = _c.className, disabled = _c.disabled, icon = _c.icon, iconLeftProp = _c.iconLeft, iconRightProp = _c.iconRight, isElevated = _c.isElevated, isFullWidth = _c.isFullWidth,
49
+ // isLoading,
50
+ isRound = _c.isRound, isSplit = _c.isSplit, itemLeftProp = _c.itemLeft, itemRightProp = _c.itemRight, _d = _c.state, state = _d === void 0 ? '' : _d, stateMapping = _c.stateMapping, text = _c.text, rest = __rest(_c, ["borderWidth", "children", "className", "disabled", "icon", "iconLeft", "iconRight", "isElevated", "isFullWidth", "isRound", "isSplit", "itemLeft", "itemRight", "state", "stateMapping", "text"]);
51
+ var hasState = Boolean(state);
52
+ var states = __assign(__assign({}, consts_1.buttonStateMapping), stateMapping);
53
+ var _e = (_a = states[state]) !== null && _a !== void 0 ? _a : {}, iconProps = _e.iconProps, stateProps = __rest(_e, ["iconProps"]);
54
+ var _f = core_1.useStyleConfig('Button', mergedProps), borderWidth = _f.borderWidth, h = _f.h, _g = _f.iconSize, iconSize = _g === void 0 ? 'md' : _g, minW = _f.minW, _h = _f.spaceX, spaceXBase = _h === void 0 ? 0 : _h, styles = __rest(_f, ["borderWidth", "h", "iconSize", "minW", "spaceX"]);
55
+ var Content = hasState ? ContentWrapper : react_1.default.Fragment;
56
+ var border = (_b = borderWidthProp !== null && borderWidthProp !== void 0 ? borderWidthProp : borderWidth) !== null && _b !== void 0 ? _b : 0;
51
57
  var spaceX = (spaceXBase - border) / 8;
52
58
  var spaceXText = spaceX * 2;
53
59
  var iconRightMl = isSplit ? 'auto' : spaceX;
@@ -61,12 +67,12 @@ exports.Button = core_1.vui(function (props, ref) {
61
67
  var aliasedProps = utils_1.filterUndefined({
62
68
  borderRadius: isRound ? h / 2 : undefined,
63
69
  boxShadow: isElevated ? 2 : undefined,
64
- pointerEvents: isLoading ? 'none' : undefined,
70
+ pointerEvents: hasState ? 'none' : undefined,
65
71
  w: isFullWidth ? '100%' : undefined
66
72
  });
67
73
  return (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, minW: minWidth, pl: pl, pr: pr, ref: ref, transitionDuration: "fast", type: "button" }, styles, aliasedProps, rest),
68
- isLoading && (react_1.default.createElement(LoadingWrapper, { onClick: function (e) { return e.stopPropagation(); } },
69
- react_1.default.createElement(icon_1.default, { animation: "spin", icon: "falSpinner", m: "auto", size: iconSize }))),
74
+ hasState && (react_1.default.createElement(StateWrapper, __assign({ onClick: function (e) { return e.stopPropagation(); } }, stateProps),
75
+ react_1.default.createElement(icon_1.default, __assign({ m: "auto", size: iconSize }, iconProps)))),
70
76
  react_1.default.createElement(Content, null, icon ? (react_1.default.createElement(icon_1.default, { icon: icon, size: iconSize })) : (react_1.default.createElement(react_1.default.Fragment, null,
71
77
  itemLeft, children !== null && children !== void 0 ? children : text,
72
78
  itemRight)))));
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { IconProp } from '../icon';
2
+ import { IconProp, IconProps } from '../icon';
3
3
  import { SystemProps } from '../system';
4
4
  import { ThemingProps } from '../theme';
5
5
  export interface ButtonProps extends SystemProps, ThemingProps<'Button'> {
@@ -14,5 +14,11 @@ export interface ButtonProps extends SystemProps, ThemingProps<'Button'> {
14
14
  isSplit?: boolean;
15
15
  itemLeft?: React.ReactNode;
16
16
  itemRight?: React.ReactNode;
17
+ state?: ButtonState;
18
+ stateMapping?: ButtonStateMapping;
17
19
  text?: number | string;
18
20
  }
21
+ export declare type ButtonState = 'error' | 'loading' | 'success';
22
+ export declare type ButtonStateMapping = Record<string, SystemProps & {
23
+ iconProps: IconProps;
24
+ }>;
@@ -0,0 +1,2 @@
1
+ import { ButtonStateMapping } from './button.types';
2
+ export declare const buttonStateMapping: ButtonStateMapping;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buttonStateMapping = void 0;
4
+ exports.buttonStateMapping = {
5
+ error: {
6
+ bg: 'red.80',
7
+ iconProps: {
8
+ animation: 'fadeDown',
9
+ icon: 'falTimesCircle'
10
+ }
11
+ },
12
+ loading: {
13
+ iconProps: {
14
+ animation: 'vui-spin 0.6s linear infinite',
15
+ fill: ['', 'transparent'],
16
+ icon: 'fadSpinnerThird'
17
+ }
18
+ },
19
+ success: {
20
+ bg: 'green.80',
21
+ iconProps: {
22
+ animation: 'fadeDown',
23
+ icon: 'falCheckCircle'
24
+ }
25
+ }
26
+ };
@@ -0,0 +1,3 @@
1
+ import { IconDefinition } from '../../types';
2
+ declare const _default: IconDefinition;
3
+ export default _default;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ /* eslint-disable */
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.default = {
5
+ details: [512, 512, [], '', ['M478.71 364.58zm-22 6.11l-27.83-15.9a15.92 15.92 0 0 1-6.94-19.2A184 184 0 1 1 256 72c5.89 0 11.71.29 17.46.83-.74-.07-1.48-.15-2.23-.21-8.49-.69-15.23-7.31-15.23-15.83v-32a16 16 0 0 1 15.34-16C266.24 8.46 261.18 8 256 8 119 8 8 119 8 256s111 248 248 248c98 0 182.42-56.95 222.71-139.42-4.13 7.86-14.23 10.55-22 6.11z', 'M271.23 72.62c-8.49-.69-15.23-7.31-15.23-15.83V24.73c0-9.11 7.67-16.78 16.77-16.17C401.92 17.18 504 124.67 504 256a246 246 0 0 1-25 108.24c-4 8.17-14.37 11-22.26 6.45l-27.84-15.9c-7.41-4.23-9.83-13.35-6.2-21.07A182.53 182.53 0 0 0 440 256c0-96.49-74.27-175.63-168.77-183.38z']],
6
+ name: 'fadSpinnerThird'
7
+ };
@@ -1 +1 @@
1
- export declare type BaseIcon = 'cuiCheckboxIndeterminate' | 'cuiCheckboxSelected' | 'cuiCheckboxUnselected' | 'cuiRadioSelected' | 'cuiRadioUnselected' | 'culCovid' | 'culDeepSearch' | 'culDotsMenu' | 'culGlobePlus' | 'culListDense' | 'culMapMarkerStar' | 'culPlusThin' | 'culScreenshot' | 'culScreenshotAlt' | 'culShortcut' | 'culTimesThin' | 'culTransformer' | 'culUserTransfer' | 'culVessel' | 'culVesselGroup' | 'cusCheckboxSelected' | 'cusDotFull' | 'cusDotFullAlt' | 'cusDotsMenu' | 'cusRadio' | 'cusSquareMinus' | 'cusTransformer' | 'cusVessel' | 'fabApplePay' | 'fabBluetooth' | 'fabBtc' | 'fabCcAmazonPay' | 'fabCcAmex' | 'fabCcApplePay' | 'fabCcDinersClub' | 'fabCcMastercard' | 'fabCcPaypal' | 'fabCcVisa' | 'fabDhl' | 'fabEbay' | 'fabFacebook' | 'fabFedex' | 'fabFirefox' | 'fabGoogle' | 'fabGoogleDrive' | 'fabLinkedinIn' | 'fabMedium' | 'fabOsi' | 'fabSlack' | 'fabTwitter' | 'fabUps' | 'falAddressBook' | 'falAddressCard' | 'falAnalytics' | 'falAngleDoubleDown' | 'falAngleDoubleLeft' | 'falAngleDoubleRight' | 'falAngleDoubleUp' | 'falAngleDown' | 'falAngleLeft' | 'falAngleRight' | 'falAngleUp' | 'falArrowAltDown' | 'falArrowAltLeft' | 'falArrowAltRight' | 'falArrowAltUp' | 'falArrowCircleDown' | 'falArrowCircleLeft' | 'falArrowCircleRight' | 'falArrowCircleUp' | 'falArrowDown' | 'falArrowFromBottom' | 'falArrowFromLeft' | 'falArrowFromRight' | 'falArrowFromTop' | 'falArrowLeft' | 'falArrowRight' | 'falArrowToBottom' | 'falArrowToLeft' | 'falArrowToRight' | 'falArrowToTop' | 'falArrowUp' | 'falArrows' | 'falAward' | 'falBan' | 'falBell' | 'falBookOpen' | 'falBroadcastTower' | 'falBuilding' | 'falBullseye' | 'falCalendar' | 'falCalendarAlt' | 'falCamera' | 'falCaretDown' | 'falCaretLeft' | 'falCaretRight' | 'falCaretUp' | 'falCauldron' | 'falChartArea' | 'falChartBar' | 'falChartLineDown' | 'falChartLine' | 'falChartNetwork' | 'falChartPie' | 'falChartPieAlt' | 'falChartScatter' | 'falCheckCircle' | 'falCheckSquare' | 'falCheck' | 'falChevronCircleDown' | 'falChevronCircleLeft' | 'falChevronCircleRight' | 'falChevronCircleUp' | 'falChevronDoubleDown' | 'falChevronDoubleLeft' | 'falChevronDoubleRight' | 'falChevronDoubleUp' | 'falChevronDown' | 'falChevronLeft' | 'falChevronRight' | 'falChevronUp' | 'falCircle' | 'falCloudShowersHeavy' | 'falCloudSnow' | 'falCloudSunRain' | 'falCloudSun' | 'falCloudUpload' | 'falCloud' | 'falCode' | 'falCog' | 'falCogs' | 'falComment' | 'falCommentAlt' | 'falCompressAlt' | 'falCopy' | 'falCreditCard' | 'falDatabase' | 'falDotCircle' | 'falDownload' | 'falEdit' | 'falEllipsisH' | 'falEllipsisV' | 'falEnvelope' | 'falExchange' | 'falExclamationCircle' | 'falExclamationTriangle' | 'falExpandAlt' | 'falExternalLink' | 'falEye' | 'falEyeSlash' | 'falFile' | 'falFilePdf' | 'falFileAlt' | 'falFileArchive' | 'falFileAudio' | 'falFileCertificate' | 'falFileChartLine' | 'falFileChartPie' | 'falFileCheck' | 'falFileCode' | 'falFileCsv' | 'falFileEdit' | 'falFileExcel' | 'falFileImage' | 'falFilePlus' | 'falFilePowerpoint' | 'falFileSpreadsheet' | 'falFileVideo' | 'falFileWord' | 'falFilter' | 'falFlag' | 'falFolderOpen' | 'falFolderPlus' | 'falFolder' | 'falFolders' | 'falGlassesAlt' | 'falGlobe' | 'falHome' | 'falHourglass' | 'falImage' | 'falInfoCircle' | 'falKey' | 'falLayerPlus' | 'falLink' | 'falList' | 'falLockAlt' | 'falLongArrowDown' | 'falLongArrowLeft' | 'falLongArrowRight' | 'falLongArrowUp' | 'falMapMarked' | 'falMapMarkedAlt' | 'falMapMarkerAlt' | 'falMapMarkerAltSlash' | 'falMapMarkerCheck' | 'falMapMarkerExclamation' | 'falMapMarker' | 'falMap' | 'falMinus' | 'falPause' | 'falPauseCircle' | 'falPen' | 'falPlay' | 'falPlayCircle' | 'falPlug' | 'falPlusSquare' | 'falPlus' | 'falPlusCircle' | 'falPrint' | 'falPuzzlePiece' | 'falReceipt' | 'falRedo' | 'falSave' | 'falSearchPlus' | 'falSearch' | 'falServer' | 'falShareAll' | 'falShare' | 'falShareAlt' | 'falShieldAlt' | 'falShieldCheck' | 'falShip' | 'falShoppingBasket' | 'falSignIn' | 'falSignInAlt' | 'falSignOut' | 'falSignOutAlt' | 'falSlidersV' | 'falSnowBlowing' | 'falSnowflake' | 'falSolarPanel' | 'falSort' | 'falSpinner' | 'falSquare' | 'falStepForward' | 'falStop' | 'falStopCircle' | 'falStopwatch' | 'falSuitcase' | 'falSun' | 'falSync' | 'falTachometer' | 'falTemperatureHigh' | 'falThLarge' | 'falThList' | 'falTh' | 'falTimesCircle' | 'falTimes' | 'falToggleOff' | 'falToggleOn' | 'falTrashAlt' | 'falUnlockAlt' | 'falUserChart' | 'falUserCircle' | 'falUserCog' | 'falUserEdit' | 'falUserFriends' | 'falUserPlus' | 'falUserShield' | 'falUserTimes' | 'falUser' | 'falUsersClass' | 'falUsers' | 'falWater' | 'falWindTurbine' | 'falWind' | 'falWrench' | 'fasCaretDown' | 'fasCaretLeft' | 'fasCaretRight' | 'fasCaretUp' | 'fasDiamond' | 'fasFolder' | 'fasMapMarkerAlt' | 'fasMapMarkerExclamation' | 'fasQuoteLeft' | 'fasQuoteRight' | 'fasSolarPanel' | 'fasSort' | 'fasStar' | 'fasWindTurbine';
1
+ export declare type BaseIcon = 'cuiCheckboxIndeterminate' | 'cuiCheckboxSelected' | 'cuiCheckboxUnselected' | 'cuiRadioSelected' | 'cuiRadioUnselected' | 'culCovid' | 'culDeepSearch' | 'culDotsMenu' | 'culGlobePlus' | 'culListDense' | 'culMapMarkerStar' | 'culPlusThin' | 'culScreenshot' | 'culScreenshotAlt' | 'culShortcut' | 'culTimesThin' | 'culTransformer' | 'culUserTransfer' | 'culVessel' | 'culVesselGroup' | 'cusCheckboxSelected' | 'cusDotFull' | 'cusDotFullAlt' | 'cusDotsMenu' | 'cusRadio' | 'cusSquareMinus' | 'cusTransformer' | 'cusVessel' | 'fabApplePay' | 'fabBluetooth' | 'fabBtc' | 'fabCcAmazonPay' | 'fabCcAmex' | 'fabCcApplePay' | 'fabCcDinersClub' | 'fabCcMastercard' | 'fabCcPaypal' | 'fabCcVisa' | 'fabDhl' | 'fabEbay' | 'fabFacebook' | 'fabFedex' | 'fabFirefox' | 'fabGoogle' | 'fabGoogleDrive' | 'fabLinkedinIn' | 'fabMedium' | 'fabOsi' | 'fabSlack' | 'fabTwitter' | 'fabUps' | 'fadSpinnerThird' | 'falAddressBook' | 'falAddressCard' | 'falAnalytics' | 'falAngleDoubleDown' | 'falAngleDoubleLeft' | 'falAngleDoubleRight' | 'falAngleDoubleUp' | 'falAngleDown' | 'falAngleLeft' | 'falAngleRight' | 'falAngleUp' | 'falArrowAltDown' | 'falArrowAltLeft' | 'falArrowAltRight' | 'falArrowAltUp' | 'falArrowCircleDown' | 'falArrowCircleLeft' | 'falArrowCircleRight' | 'falArrowCircleUp' | 'falArrowDown' | 'falArrowFromBottom' | 'falArrowFromLeft' | 'falArrowFromRight' | 'falArrowFromTop' | 'falArrowLeft' | 'falArrowRight' | 'falArrowToBottom' | 'falArrowToLeft' | 'falArrowToRight' | 'falArrowToTop' | 'falArrowUp' | 'falArrows' | 'falAward' | 'falBan' | 'falBell' | 'falBookOpen' | 'falBroadcastTower' | 'falBuilding' | 'falBullseye' | 'falCalendar' | 'falCalendarAlt' | 'falCamera' | 'falCaretDown' | 'falCaretLeft' | 'falCaretRight' | 'falCaretUp' | 'falCauldron' | 'falChartArea' | 'falChartBar' | 'falChartLineDown' | 'falChartLine' | 'falChartNetwork' | 'falChartPie' | 'falChartPieAlt' | 'falChartScatter' | 'falCheckCircle' | 'falCheckSquare' | 'falCheck' | 'falChevronCircleDown' | 'falChevronCircleLeft' | 'falChevronCircleRight' | 'falChevronCircleUp' | 'falChevronDoubleDown' | 'falChevronDoubleLeft' | 'falChevronDoubleRight' | 'falChevronDoubleUp' | 'falChevronDown' | 'falChevronLeft' | 'falChevronRight' | 'falChevronUp' | 'falCircle' | 'falCloudShowersHeavy' | 'falCloudSnow' | 'falCloudSunRain' | 'falCloudSun' | 'falCloudUpload' | 'falCloud' | 'falCode' | 'falCog' | 'falCogs' | 'falComment' | 'falCommentAlt' | 'falCompressAlt' | 'falCopy' | 'falCreditCard' | 'falDatabase' | 'falDotCircle' | 'falDownload' | 'falEdit' | 'falEllipsisH' | 'falEllipsisV' | 'falEnvelope' | 'falExchange' | 'falExclamationCircle' | 'falExclamationTriangle' | 'falExpandAlt' | 'falExternalLink' | 'falEye' | 'falEyeSlash' | 'falFile' | 'falFilePdf' | 'falFileAlt' | 'falFileArchive' | 'falFileAudio' | 'falFileCertificate' | 'falFileChartLine' | 'falFileChartPie' | 'falFileCheck' | 'falFileCode' | 'falFileCsv' | 'falFileEdit' | 'falFileExcel' | 'falFileImage' | 'falFilePlus' | 'falFilePowerpoint' | 'falFileSpreadsheet' | 'falFileVideo' | 'falFileWord' | 'falFilter' | 'falFlag' | 'falFolderOpen' | 'falFolderPlus' | 'falFolder' | 'falFolders' | 'falGlassesAlt' | 'falGlobe' | 'falHome' | 'falHourglass' | 'falImage' | 'falInfoCircle' | 'falKey' | 'falLayerPlus' | 'falLink' | 'falList' | 'falLockAlt' | 'falLongArrowDown' | 'falLongArrowLeft' | 'falLongArrowRight' | 'falLongArrowUp' | 'falMapMarked' | 'falMapMarkedAlt' | 'falMapMarkerAlt' | 'falMapMarkerAltSlash' | 'falMapMarkerCheck' | 'falMapMarkerExclamation' | 'falMapMarker' | 'falMap' | 'falMinus' | 'falPause' | 'falPauseCircle' | 'falPen' | 'falPlay' | 'falPlayCircle' | 'falPlug' | 'falPlusSquare' | 'falPlus' | 'falPlusCircle' | 'falPrint' | 'falPuzzlePiece' | 'falReceipt' | 'falRedo' | 'falSave' | 'falSearchPlus' | 'falSearch' | 'falServer' | 'falShareAll' | 'falShare' | 'falShareAlt' | 'falShieldAlt' | 'falShieldCheck' | 'falShip' | 'falShoppingBasket' | 'falSignIn' | 'falSignInAlt' | 'falSignOut' | 'falSignOutAlt' | 'falSlidersV' | 'falSnowBlowing' | 'falSnowflake' | 'falSolarPanel' | 'falSort' | 'falSpinner' | 'falSquare' | 'falStepForward' | 'falStop' | 'falStopCircle' | 'falStopwatch' | 'falSuitcase' | 'falSun' | 'falSync' | 'falTachometer' | 'falTemperatureHigh' | 'falThLarge' | 'falThList' | 'falTh' | 'falTimesCircle' | 'falTimes' | 'falToggleOff' | 'falToggleOn' | 'falTrashAlt' | 'falUnlockAlt' | 'falUserChart' | 'falUserCircle' | 'falUserCog' | 'falUserEdit' | 'falUserFriends' | 'falUserPlus' | 'falUserShield' | 'falUserTimes' | 'falUser' | 'falUsersClass' | 'falUsers' | 'falWater' | 'falWindTurbine' | 'falWind' | 'falWrench' | 'fasCaretDown' | 'fasCaretLeft' | 'fasCaretRight' | 'fasCaretUp' | 'fasDiamond' | 'fasFolder' | 'fasMapMarkerAlt' | 'fasMapMarkerExclamation' | 'fasQuoteLeft' | 'fasQuoteRight' | 'fasSolarPanel' | 'fasSort' | 'fasStar' | 'fasWindTurbine';
package/icons/consts.js CHANGED
@@ -9,6 +9,7 @@ var cuiCheckboxSelected_1 = __importDefault(require("./baseIcons/cui/cuiCheckbox
9
9
  var cuiCheckboxUnselected_1 = __importDefault(require("./baseIcons/cui/cuiCheckboxUnselected"));
10
10
  var cuiRadioSelected_1 = __importDefault(require("./baseIcons/cui/cuiRadioSelected"));
11
11
  var cuiRadioUnselected_1 = __importDefault(require("./baseIcons/cui/cuiRadioUnselected"));
12
+ var fadSpinnerThird_1 = __importDefault(require("./baseIcons/fad/fadSpinnerThird"));
12
13
  var falCheck_1 = __importDefault(require("./baseIcons/fal/falCheck"));
13
14
  var falCheckCircle_1 = __importDefault(require("./baseIcons/fal/falCheckCircle"));
14
15
  var falEllipsisH_1 = __importDefault(require("./baseIcons/fal/falEllipsisH"));
@@ -30,6 +31,7 @@ exports.defaultIcons = {
30
31
  cuiCheckboxUnselected: cuiCheckboxUnselected_1.default,
31
32
  cuiRadioSelected: cuiRadioSelected_1.default,
32
33
  cuiRadioUnselected: cuiRadioUnselected_1.default,
34
+ fadSpinnerThird: fadSpinnerThird_1.default,
33
35
  falCheck: falCheck_1.default,
34
36
  falCheckCircle: falCheckCircle_1.default,
35
37
  falEllipsisH: falEllipsisH_1.default,
package/input/consts.js CHANGED
@@ -10,20 +10,26 @@ exports.inputLengths = {
10
10
  xl: 480
11
11
  };
12
12
  exports.inputStateMapping = {
13
- default: {
14
- colorScheme: 'grey',
15
- iconRight: ''
16
- },
17
13
  error: {
18
14
  colorScheme: 'red',
19
- iconRight: 'falExclamationTriangle'
15
+ iconProps: {
16
+ color: 'red.80',
17
+ icon: 'falExclamationTriangle'
18
+ }
20
19
  },
21
20
  loading: {
22
21
  colorScheme: 'grey',
23
- iconRight: 'falSpinner'
22
+ iconProps: {
23
+ animation: 'vui-spin 0.6s linear infinite',
24
+ fill: ['blue.20', 'blue.50'],
25
+ icon: 'fadSpinnerThird'
26
+ }
24
27
  },
25
28
  success: {
26
29
  colorScheme: 'green',
27
- iconRight: 'falCheck'
30
+ iconProps: {
31
+ color: 'green.80',
32
+ icon: 'falCheck'
33
+ }
28
34
  }
29
35
  };
@@ -0,0 +1,2 @@
1
+ import { InputProps } from './input.types';
2
+ export declare function getInitialCount(props: InputProps): number;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getInitialCount = void 0;
4
+ function getInitialCount(props) {
5
+ var _a, _b;
6
+ var defaultValue = props.defaultValue, value = props.value;
7
+ return (_b = (_a = defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.toString().length) !== null && _a !== void 0 ? _a : value === null || value === void 0 ? void 0 : value.toString().length) !== null && _b !== void 0 ? _b : 0;
8
+ }
9
+ exports.getInitialCount = getInitialCount;
package/input/input.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { InputInputStyleProps, InputProps } from './input.types';
1
+ import { InputProps } from './input.types';
2
2
  import { SystemProps } from '../system';
3
- export declare const InputInput: import("styled-components").StyledComponent<"input", import("styled-components").DefaultTheme, InputInputStyleProps, never>;
3
+ export declare const InputInput: import("styled-components").StyledComponent<"input", import("styled-components").DefaultTheme, SystemProps, never>;
4
4
  export declare const InputBase: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, SystemProps, never>;
5
5
  export declare const Input: import("../core").VuiComponent<"div", InputProps>;
6
6
  export default Input;
package/input/input.js CHANGED
@@ -14,6 +14,25 @@ var __assign = (this && this.__assign) || function () {
14
14
  };
15
15
  return __assign.apply(this, arguments);
16
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
+ };
17
36
  var __rest = (this && this.__rest) || function (s, e) {
18
37
  var t = {};
19
38
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
@@ -25,39 +44,68 @@ var __rest = (this && this.__rest) || function (s, e) {
25
44
  }
26
45
  return t;
27
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
+ };
28
63
  var __importDefault = (this && this.__importDefault) || function (mod) {
29
64
  return (mod && mod.__esModule) ? mod : { "default": mod };
30
65
  };
31
66
  Object.defineProperty(exports, "__esModule", { value: true });
32
67
  exports.Input = exports.InputBase = exports.InputInput = void 0;
33
- var styled_components_1 = require("@xstyled/styled-components");
34
- var react_1 = __importDefault(require("react"));
35
- var styled_components_2 = __importDefault(require("styled-components"));
68
+ var react_1 = __importStar(require("react"));
69
+ var styled_components_1 = __importDefault(require("styled-components"));
36
70
  var consts_1 = require("./consts");
71
+ var helpers_1 = require("./helpers");
37
72
  var core_1 = require("../core");
38
73
  var icon_1 = __importDefault(require("../icon"));
39
74
  var system_1 = require("../system");
75
+ var t_1 = __importDefault(require("../t"));
40
76
  var utils_1 = require("../utils");
41
- exports.InputInput = styled_components_2.default.input(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n\talign-self: stretch;\n\tbackground-color: transparent;\n\tborder: none;\n\tflex: 1;\n\tmargin: 0 8px;\n\tmin-width: 0;\n\toutline: none;\n\tpadding: 0;\n\n\t:disabled,\n\t:disabled::placeholder {\n\t\tcolor: var(--vui-colors-disabled-font);\n\t\tcursor: not-allowed;\n\t}\n\n\t", "\n"], ["\n\talign-self: stretch;\n\tbackground-color: transparent;\n\tborder: none;\n\tflex: 1;\n\tmargin: 0 8px;\n\tmin-width: 0;\n\toutline: none;\n\tpadding: 0;\n\n\t:disabled,\n\t:disabled::placeholder {\n\t\tcolor: var(--vui-colors-disabled-font);\n\t\tcursor: not-allowed;\n\t}\n\n\t", "\n"])), styled_components_1.compose(styled_components_1.color, styled_components_1.fontSize));
42
- exports.InputBase = styled_components_2.default.div.withConfig(core_1.forwardPropConfig(system_1.system))(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n\talign-items: center;\n\tborder-width: 1px;\n\tdisplay: flex;\n\toutline: none;\n\twidth: 100%;\n\n\t&.disabled {\n\t\tbackground-color: var(--vui-colors-disabled-bg);\n\t\tcolor: var(--vui-colors-disabled-font);\n\t\tcursor: not-allowed;\n\t}\n\n\t", "\n"], ["\n\talign-items: center;\n\tborder-width: 1px;\n\tdisplay: flex;\n\toutline: none;\n\twidth: 100%;\n\n\t&.disabled {\n\t\tbackground-color: var(--vui-colors-disabled-bg);\n\t\tcolor: var(--vui-colors-disabled-font);\n\t\tcursor: not-allowed;\n\t}\n\n\t", "\n"])), system_1.system);
77
+ exports.InputInput = styled_components_1.default.input.withConfig(core_1.forwardPropConfig(system_1.system))(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n\talign-self: stretch;\n\tbackground-color: transparent;\n\tborder: none;\n\tflex: 1;\n\tmargin: 0 8px;\n\tmin-width: 0;\n\toutline: none;\n\tpadding: 0;\n\n\t:disabled,\n\t:disabled::placeholder {\n\t\tcolor: var(--vui-colors-disabled-font);\n\t\tcursor: not-allowed;\n\t}\n\n\t", "\n"], ["\n\talign-self: stretch;\n\tbackground-color: transparent;\n\tborder: none;\n\tflex: 1;\n\tmargin: 0 8px;\n\tmin-width: 0;\n\toutline: none;\n\tpadding: 0;\n\n\t:disabled,\n\t:disabled::placeholder {\n\t\tcolor: var(--vui-colors-disabled-font);\n\t\tcursor: not-allowed;\n\t}\n\n\t", "\n"])), system_1.system);
78
+ exports.InputBase = styled_components_1.default.div.withConfig(core_1.forwardPropConfig(system_1.system))(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n\talign-items: center;\n\tborder-width: 1px;\n\tdisplay: flex;\n\toutline: none;\n\tposition: relative;\n\twidth: 100%;\n\n\t&.disabled {\n\t\tbackground-color: var(--vui-colors-disabled-bg);\n\t\tcolor: var(--vui-colors-disabled-font);\n\t\tcursor: not-allowed;\n\t}\n\n\t", "\n"], ["\n\talign-items: center;\n\tborder-width: 1px;\n\tdisplay: flex;\n\toutline: none;\n\tposition: relative;\n\twidth: 100%;\n\n\t&.disabled {\n\t\tbackground-color: var(--vui-colors-disabled-bg);\n\t\tcolor: var(--vui-colors-disabled-font);\n\t\tcursor: not-allowed;\n\t}\n\n\t", "\n"])), system_1.system);
43
79
  exports.Input = core_1.vui(function (props, ref) {
44
- var _a;
45
- var _b = core_1.omitThemingProps(props), autoComplete = _b.autoComplete, autoFocus = _b.autoFocus, className = _b.className, colorSchemeProp = _b.colorScheme, defaultValue = _b.defaultValue, disabled = _b.disabled, iconLeft = _b.iconLeft, iconRightProp = _b.iconRight, _c = _b.inputProps, inputProps = _c === void 0 ? {} : _c, inputRef = _b.inputRef, itemLeft = _b.itemLeft, itemRight = _b.itemRight, _d = _b.length, length = _d === void 0 ? 'fluid' : _d, name = _b.name, onBlur = _b.onBlur, onChange = _b.onChange, onFocus = _b.onFocus, placeholder = _b.placeholder, readOnly = _b.readOnly, required = _b.required, _e = _b.state, state = _e === void 0 ? 'default' : _e, stateMapping = _b.stateMapping, _f = _b.type, type = _f === void 0 ? 'text' : _f, value = _b.value, rest = __rest(_b, ["autoComplete", "autoFocus", "className", "colorScheme", "defaultValue", "disabled", "iconLeft", "iconRight", "inputProps", "inputRef", "itemLeft", "itemRight", "length", "name", "onBlur", "onChange", "onFocus", "placeholder", "readOnly", "required", "state", "stateMapping", "type", "value"]);
80
+ var _a, _b;
81
+ var _c = __read(react_1.useState(helpers_1.getInitialCount(props)), 2), count = _c[0], setCount = _c[1];
82
+ var _d = core_1.omitThemingProps(props), autoComplete = _d.autoComplete, autoFocus = _d.autoFocus, className = _d.className, colorSchemeProp = _d.colorScheme, defaultValue = _d.defaultValue, disabled = _d.disabled, iconLeft = _d.iconLeft, iconRight = _d.iconRight, _e = _d.inputProps, inputProps = _e === void 0 ? {} : _e, inputRef = _d.inputRef, isInvalid = _d.isInvalid, itemLeft = _d.itemLeft, itemRight = _d.itemRight, _f = _d.length, length = _f === void 0 ? 'fluid' : _f, maxLength = _d.maxLength, name = _d.name, onBlur = _d.onBlur, onChangeProp = _d.onChange, onFocus = _d.onFocus, placeholder = _d.placeholder, readOnly = _d.readOnly, required = _d.required, showCount = _d.showCount, _g = _d.state, state = _g === void 0 ? '' : _g, stateMapping = _d.stateMapping, _h = _d.type, type = _h === void 0 ? 'text' : _h, value = _d.value, rest = __rest(_d, ["autoComplete", "autoFocus", "className", "colorScheme", "defaultValue", "disabled", "iconLeft", "iconRight", "inputProps", "inputRef", "isInvalid", "itemLeft", "itemRight", "length", "maxLength", "name", "onBlur", "onChange", "onFocus", "placeholder", "readOnly", "required", "showCount", "state", "stateMapping", "type", "value"]);
46
83
  var states = __assign(__assign({}, consts_1.inputStateMapping), stateMapping);
47
- var _g = (_a = states[state]) !== null && _a !== void 0 ? _a : {}, _h = _g.colorScheme, colorScheme = _h === void 0 ? colorSchemeProp : _h, _j = _g.iconRight, iconRight = _j === void 0 ? iconRightProp : _j;
48
- var _k = core_1.useStyleConfig('Input', __assign({ colorScheme: colorScheme }, props)), borderColor = _k.borderColor, focusWithinRingColor = _k.focusWithinRingColor, fontSize = _k.fontSize, iconColorProp = _k.iconColor, iconSize = _k.iconSize, styles = __rest(_k, ["borderColor", "focusWithinRingColor", "fontSize", "iconColor", "iconSize"]);
49
- var iconColor = !disabled ? iconColorProp : 'grey.50';
84
+ var _j = (_a = states[state]) !== null && _a !== void 0 ? _a : {}, stateColorScheme = _j.colorScheme, stateIconProps = _j.iconProps;
85
+ var stateProps = utils_1.filterUndefined({
86
+ colorScheme: (_b = colorSchemeProp !== null && colorSchemeProp !== void 0 ? colorSchemeProp : (isInvalid ? 'red' : undefined)) !== null && _b !== void 0 ? _b : stateColorScheme
87
+ });
88
+ var _k = core_1.useStyleConfig('Input', __assign(__assign({}, stateProps), props)), fontSize = _k.fontSize, iconSize = _k.iconSize, styles = __rest(_k, ["fontSize", "iconSize"]);
89
+ function onChange(e) {
90
+ setCount(e.target.value.length);
91
+ onChangeProp === null || onChangeProp === void 0 ? void 0 : onChangeProp(e);
92
+ }
93
+ var iconColor = !disabled ? 'blue.80' : 'grey.50';
94
+ // const iconRight = iconRightProp ?? states[state]?.iconRight
50
95
  var aliasedProps = utils_1.filterUndefined({
51
96
  bg: readOnly ? 'grey.20' : undefined,
97
+ focusWithinBorderColor: !readOnly ? 'transparent' : undefined,
98
+ focusWithinRingColor: readOnly ? 'transparent' : undefined,
52
99
  maxW: consts_1.inputLengths[length]
53
100
  });
54
- return (react_1.default.createElement(exports.InputBase, __assign({ borderColor: !disabled ? borderColor : 'transparent', borderRadius: "md", className: utils_1.cs('vui-input', disabled && 'disabled', className), focusWithinBorderColor: readOnly ? borderColor : 'transparent', focusWithinRingColor: !readOnly ? focusWithinRingColor : 'transparent', px: 1, ref: ref, transitionDuration: "fast" }, styles, aliasedProps, rest), itemLeft !== null && itemLeft !== void 0 ? itemLeft : (iconLeft && react_1.default.createElement(icon_1.default, { color: iconColor, icon: iconLeft, size: iconSize })),
101
+ return (react_1.default.createElement(exports.InputBase, __assign({ borderRadius: "md", className: utils_1.cs('vui-input', disabled && 'disabled', className), px: 1, ref: ref, transitionDuration: "fast" }, styles, aliasedProps, rest), itemLeft !== null && itemLeft !== void 0 ? itemLeft : (iconLeft && react_1.default.createElement(icon_1.default, { color: iconColor, icon: iconLeft, size: iconSize })),
55
102
  react_1.default.createElement(exports.InputInput, __assign({ className: "vui-inputInput", placeholderColor: "grey.60", ref: inputRef }, {
56
103
  autoComplete: autoComplete,
57
104
  autoFocus: autoFocus,
58
105
  defaultValue: defaultValue,
59
106
  disabled: disabled,
60
107
  fontSize: fontSize,
108
+ maxLength: maxLength,
61
109
  name: name,
62
110
  onBlur: onBlur,
63
111
  onChange: onChange,
@@ -67,7 +115,12 @@ exports.Input = core_1.vui(function (props, ref) {
67
115
  required: required,
68
116
  type: type,
69
117
  value: value
70
- }, inputProps)), itemRight !== null && itemRight !== void 0 ? itemRight : (iconRight && (react_1.default.createElement(icon_1.default, { animation: state === 'loading' ? 'spin' : undefined, color: iconColor, icon: iconRight, size: iconSize })))));
118
+ }, inputProps)), itemRight !== null && itemRight !== void 0 ? itemRight : (iconRight && react_1.default.createElement(icon_1.default, { color: iconColor, icon: iconRight, size: iconSize })),
119
+ state && react_1.default.createElement(icon_1.default, __assign({ size: iconSize }, stateIconProps)),
120
+ showCount && (react_1.default.createElement(t_1.default, { color: "grey.80", position: "absolute", right: 0, size: "sm", top: "calc(100% + 2px)" },
121
+ count,
122
+ " / ",
123
+ maxLength))));
71
124
  });
72
125
  exports.Input.displayName = 'Input';
73
126
  exports.default = exports.Input;
@@ -1,26 +1,25 @@
1
1
  /// <reference types="react" />
2
2
  import { inputLengths } from './consts';
3
- import { ChangeEventHandler, FocusEventHandler } from '../core';
4
- import { IconProp } from '../icon';
5
- import { ColorProps, FontSizeProps, SystemProps } from '../system';
3
+ import { ChangeEventHandler, FocusEventHandler, PropsOf } from '../core';
4
+ import { IconProp, IconProps } from '../icon';
5
+ import { SystemProps } from '../system';
6
6
  import { ThemingProps } from '../theme';
7
- export interface InputInputProps extends InputInputStyleProps {
8
- }
9
- export interface InputInputStyleProps extends ColorProps, FontSizeProps {
10
- }
11
7
  export declare type InputLength = keyof typeof inputLengths;
12
8
  export interface InputProps extends SystemProps, ThemingProps<'Input'> {
13
9
  autoComplete?: string;
14
10
  autoFocus?: boolean;
15
11
  colorScheme?: 'green' | 'grey' | 'red';
12
+ defaultValue?: number | string;
16
13
  disabled?: boolean;
17
14
  iconLeft?: IconProp;
18
15
  iconRight?: IconProp;
19
- inputProps?: InputInputProps;
16
+ inputProps?: PropsOf<'input'>;
20
17
  inputRef?: React.MutableRefObject<HTMLInputElement | null> | null;
18
+ isInvalid?: boolean;
21
19
  itemLeft?: React.ReactNode;
22
20
  itemRight?: React.ReactNode;
23
21
  length?: InputLength;
22
+ maxLength?: number;
24
23
  name?: string;
25
24
  onBlur?: FocusEventHandler;
26
25
  onChange?: ChangeEventHandler;
@@ -28,6 +27,7 @@ export interface InputProps extends SystemProps, ThemingProps<'Input'> {
28
27
  placeholder?: string;
29
28
  readOnly?: boolean;
30
29
  required?: boolean;
30
+ showCount?: boolean;
31
31
  state?: InputState;
32
32
  stateMapping?: InputStateMapping;
33
33
  type?: string;
@@ -36,5 +36,5 @@ export interface InputProps extends SystemProps, ThemingProps<'Input'> {
36
36
  export declare type InputState = 'default' | 'error' | 'loading' | 'success';
37
37
  export declare type InputStateMapping = Record<string, {
38
38
  colorScheme?: InputProps['colorScheme'];
39
- iconRight: InputProps['iconRight'];
39
+ iconProps: IconProps;
40
40
  }>;
package/input/theme.d.ts CHANGED
@@ -3,7 +3,6 @@ declare function variantDefault(props: Dict): {
3
3
  borderColor: string;
4
4
  focusWithinRing: number;
5
5
  focusWithinRingColor: string;
6
- iconColor: string;
7
6
  };
8
7
  declare const _default: {
9
8
  defaultProps: {
package/input/theme.js CHANGED
@@ -5,13 +5,11 @@ function variantDefault(props) {
5
5
  var styles = {
6
6
  borderColor: c + ".80",
7
7
  focusWithinRing: 2,
8
- focusWithinRingColor: c + ".80",
9
- iconColor: c + ".80"
8
+ focusWithinRingColor: c + ".80"
10
9
  };
11
10
  if (c === 'grey') {
12
11
  styles.borderColor = c + ".60";
13
12
  styles.focusWithinRingColor = 'blue.50';
14
- styles.iconColor = 'blue.80';
15
13
  }
16
14
  return styles;
17
15
  }
@@ -22,7 +20,7 @@ var defaultProps = {
22
20
  };
23
21
  var sizes = {
24
22
  xs: {
25
- fontSize: 'xs',
23
+ fontSize: 'sm',
26
24
  h: 24,
27
25
  iconSize: 'xs'
28
26
  },
package/label/label.js CHANGED
@@ -39,7 +39,7 @@ var utils_1 = require("../utils");
39
39
  var Text = styled_components_1.default.span(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n\t", "\n"], ["\n\t", "\n"])), system_1.isTruncated);
40
40
  exports.LabelBase = styled_components_1.default.span.withConfig(core_1.forwardPropConfig(system_1.system))(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n\talign-items: center;\n\tdisplay: flex;\n\tjustify-content: center;\n\tline-height: normal;\n\tmin-width: 0px;\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: flex;\n\tjustify-content: center;\n\tline-height: normal;\n\tmin-width: 0px;\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);
41
41
  exports.Label = core_1.vui(function (props, ref) {
42
- var _a = core_1.omitThemingProps(props), casing = _a.casing, children = _a.children, className = _a.className, icon = _a.icon, iconLeft = _a.iconLeft, iconRight = _a.iconRight, isElevated = _a.isElevated, isFullWidth = _a.isFullWidth, _b = _a.isInteractive, isInteractive = _b === void 0 ? props.onClick !== undefined : _b, isLoading = _a.isLoading, isRound = _a.isRound, isSplit = _a.isSplit, _c = _a.isTruncated, isTruncated = _c === void 0 ? true : _c, itemLeft = _a.itemLeft, itemRight = _a.itemRight, text = _a.text, weight = _a.weight, rest = __rest(_a, ["casing", "children", "className", "icon", "iconLeft", "iconRight", "isElevated", "isFullWidth", "isInteractive", "isLoading", "isRound", "isSplit", "isTruncated", "itemLeft", "itemRight", "text", "weight"]);
42
+ var _a = core_1.omitThemingProps(props), casing = _a.casing, children = _a.children, className = _a.className, icon = _a.icon, iconLeft = _a.iconLeft, iconRight = _a.iconRight, isElevated = _a.isElevated, isFullWidth = _a.isFullWidth, _b = _a.isInteractive, isInteractive = _b === void 0 ? props.onClick !== undefined : _b, isRound = _a.isRound, isSplit = _a.isSplit, _c = _a.isTruncated, isTruncated = _c === void 0 ? true : _c, itemLeft = _a.itemLeft, itemRight = _a.itemRight, text = _a.text, weight = _a.weight, rest = __rest(_a, ["casing", "children", "className", "icon", "iconLeft", "iconRight", "isElevated", "isFullWidth", "isInteractive", "isRound", "isSplit", "isTruncated", "itemLeft", "itemRight", "text", "weight"]);
43
43
  var _d = core_1.useStyleConfig('Label', props), activeBg = _d.activeBg, h = _d.h, hoverBg = _d.hoverBg, _e = _d.iconSize, iconSize = _e === void 0 ? 'md' : _e, _f = _d.spaceX, spaceXBase = _f === void 0 ? 0 : _f, styles = __rest(_d, ["activeBg", "h", "hoverBg", "iconSize", "spaceX"]);
44
44
  var spaceX = spaceXBase / 8;
45
45
  var spaceXText = (spaceXBase + 4) / 8;
@@ -60,13 +60,11 @@ exports.Label = core_1.vui(function (props, ref) {
60
60
  borderRadius: isRound ? h / 2 : undefined,
61
61
  boxShadow: isElevated ? 2 : undefined,
62
62
  fontWeight: weight,
63
- pointerEvents: isLoading ? 'none' : undefined,
64
63
  textTransform: casing,
65
64
  w: isFullWidth ? '100%' : undefined
66
65
  });
67
66
  return (react_1.default.createElement(exports.LabelBase, __assign({ borderRadius: "md", className: utils_1.cs('vui-label', className), fontWeight: "medium", h: h, pl: pl, pr: pr, ref: ref, transitionDuration: "fast" }, styles, interactiveProps, aliasedProps, rest), icon ? (react_1.default.createElement(icon_1.default, { icon: icon, size: iconSize })) : (react_1.default.createElement(react_1.default.Fragment, null, itemLeft !== null && itemLeft !== void 0 ? itemLeft : (iconLeft && react_1.default.createElement(icon_1.default, { icon: iconLeft, mr: spaceX, size: iconSize })),
68
- react_1.default.createElement(Text, { isTruncated: isTruncated }, children !== null && children !== void 0 ? children : text), itemRight !== null && itemRight !== void 0 ? itemRight : (iconRight && react_1.default.createElement(icon_1.default, { icon: iconRight, ml: iconRightMl, size: iconSize })),
69
- isLoading && react_1.default.createElement(icon_1.default, { animation: "spin", icon: "falSpinner", ml: iconRightMl, size: iconSize })))));
67
+ react_1.default.createElement(Text, { isTruncated: isTruncated }, children !== null && children !== void 0 ? children : text), itemRight !== null && itemRight !== void 0 ? itemRight : (iconRight && react_1.default.createElement(icon_1.default, { icon: iconRight, ml: iconRightMl, size: iconSize }))))));
70
68
  });
71
69
  exports.Label.displayName = 'Label';
72
70
  exports.default = exports.Label;
@@ -11,7 +11,6 @@ export interface LabelProps extends SystemProps, ThemingProps<'Label'> {
11
11
  isElevated?: boolean;
12
12
  isFullWidth?: boolean;
13
13
  isInteractive?: boolean;
14
- isLoading?: boolean;
15
14
  isRound?: boolean;
16
15
  isSplit?: boolean;
17
16
  itemLeft?: React.ReactNode;
package/link/link.js CHANGED
@@ -37,14 +37,14 @@ var system_1 = require("../system");
37
37
  var utils_1 = require("../utils");
38
38
  exports.LinkBase = styled_components_1.default.a.withConfig(core_1.forwardPropConfig(system_1.system))(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n\talign-items: center;\n\tcursor: pointer;\n\tdisplay: inline-flex;\n\toutline: none;\n\ttext-decoration: none;\n\twidth: fit-content;\n\n\t", "\n"], ["\n\talign-items: center;\n\tcursor: pointer;\n\tdisplay: inline-flex;\n\toutline: none;\n\ttext-decoration: none;\n\twidth: fit-content;\n\n\t", "\n"])), system_1.system);
39
39
  exports.Link = core_1.vui(function (props, ref) {
40
- var _a = core_1.omitThemingProps(props), children = _a.children, className = _a.className, decoration = _a.decoration, _b = _a.hoverDecoration, hoverDecoration = _b === void 0 ? 'underline' : _b, isExternal = _a.isExternal, text = _a.text, weight = _a.weight, rest = __rest(_a, ["children", "className", "decoration", "hoverDecoration", "isExternal", "text", "weight"]);
40
+ var _a = core_1.omitThemingProps(props), children = _a.children, className = _a.className, decoration = _a.decoration, _b = _a.hoverDecoration, hoverDecoration = _b === void 0 ? 'underline' : _b, isExternal = _a.isExternal, isUnderlined = _a.isUnderlined, text = _a.text, weight = _a.weight, rest = __rest(_a, ["children", "className", "decoration", "hoverDecoration", "isExternal", "isUnderlined", "text", "weight"]);
41
41
  var styles = core_1.useStyleConfig('Link', props);
42
42
  var aliasedProps = utils_1.filterUndefined({
43
43
  fontWeight: weight,
44
44
  hoverTextDecoration: hoverDecoration,
45
45
  rel: isExternal ? 'noopener' : undefined,
46
46
  target: isExternal ? '_blank' : undefined,
47
- textDecoration: decoration
47
+ textDecoration: decoration !== null && decoration !== void 0 ? decoration : (isUnderlined ? 'underline' : undefined)
48
48
  });
49
49
  return (react_1.default.createElement(exports.LinkBase, __assign({ borderRadius: "sm", className: utils_1.cs('vui-link', className), focusRing: 2, ref: ref, transitionDuration: "instant" }, styles, aliasedProps, rest), children !== null && children !== void 0 ? children : text));
50
50
  });
@@ -1,10 +1,11 @@
1
1
  import { SystemProps, TypographyProps } from '../system';
2
2
  import { ThemingProps } from '../theme';
3
3
  export interface LinkProps extends SystemProps, ThemingProps<'Link'> {
4
- colorScheme?: 'blue' | 'prussian';
4
+ colorScheme?: 'blue' | 'white';
5
5
  decoration?: TypographyProps['textDecoration'];
6
6
  hoverDecoration?: TypographyProps['textDecoration'];
7
7
  isExternal?: boolean;
8
+ isUnderlined?: boolean;
8
9
  text?: number | string;
9
10
  weight?: TypographyProps['fontWeight'];
10
11
  }
package/link/theme.d.ts CHANGED
@@ -3,6 +3,10 @@ declare function variantDefault(props: Dict): {
3
3
  color: string;
4
4
  hoverColor: string;
5
5
  };
6
+ declare function variantLight(props: Dict): {
7
+ color: string;
8
+ hoverColor: string;
9
+ };
6
10
  declare const _default: {
7
11
  defaultProps: {
8
12
  colorScheme: string;
@@ -25,6 +29,7 @@ declare const _default: {
25
29
  };
26
30
  variants: {
27
31
  default: typeof variantDefault;
32
+ light: typeof variantLight;
28
33
  };
29
34
  };
30
35
  export default _default;
package/link/theme.js CHANGED
@@ -6,6 +6,18 @@ function variantDefault(props) {
6
6
  color: c + ".80",
7
7
  hoverColor: c + ".60"
8
8
  };
9
+ if (c === 'white') {
10
+ styles.color = 'white';
11
+ styles.hoverColor = 'white';
12
+ }
13
+ return styles;
14
+ }
15
+ function variantLight(props) {
16
+ var c = props.colorScheme;
17
+ var styles = {
18
+ color: c + ".60",
19
+ hoverColor: c + ".40"
20
+ };
9
21
  return styles;
10
22
  }
11
23
  var defaultProps = {
@@ -28,7 +40,8 @@ var sizes = {
28
40
  }
29
41
  };
30
42
  var variants = {
31
- default: variantDefault
43
+ default: variantDefault,
44
+ light: variantLight
32
45
  };
33
46
  exports.default = {
34
47
  defaultProps: defaultProps,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veracity/vui",
3
- "version": "0.0.10",
3
+ "version": "0.0.11",
4
4
  "description": "Veracity UI components library based on Styled Components and @xstyled",
5
5
  "main": "index.js",
6
6
  "author": "Veracity",
package/svg/svg.js CHANGED
@@ -108,11 +108,10 @@ var helpers_1 = require("./helpers");
108
108
  var core_1 = require("../core");
109
109
  var system_1 = require("../system");
110
110
  var utils_1 = require("../utils");
111
- exports.SvgBase = styled_components_1.default.svg.withConfig(core_1.forwardPropConfig(system_1.system))(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n\t", "\n"], ["\n\t", "\n"])), system_1.system);
112
- exports.Svg = core_1.vui(function (_a, ref) {
113
- var children = _a.children, className = _a.className, src = _a.src, rest = __rest(_a, ["children", "className", "src"]);
114
- var _b = __read(react_1.useState(helpers_1.initState()), 2), state = _b[0], setState = _b[1];
115
- var _c = state.content, content = _c === void 0 ? '' : _c, _d = state.svgAttributes, svgAttributes = _d === void 0 ? {} : _d;
111
+ exports.SvgBase = styled_components_1.default.svg.withConfig(core_1.forwardPropConfig(system_1.system))(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n\t& > path:nth-child(1) {\n\t\tfill: ", ";\n\t}\n\n\t& > path:nth-child(2) {\n\t\tfill: ", ";\n\t}\n\n\t", "\n"], ["\n\t& > path:nth-child(1) {\n\t\tfill: ", ";\n\t}\n\n\t& > path:nth-child(2) {\n\t\tfill: ", ";\n\t}\n\n\t", "\n"])), function (p) { var _a, _b, _c; return core_1.th.color((_c = (_b = (_a = p.fill) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : p.fill) !== null && _c !== void 0 ? _c : '')(p); }, function (p) { var _a, _b, _c; return core_1.th.color((_c = (_b = (_a = p.fill) === null || _a === void 0 ? void 0 : _a[1]) !== null && _b !== void 0 ? _b : p.fill) !== null && _c !== void 0 ? _c : '')(p); }, system_1.system);
112
+ exports.Svg = core_1.vui(function (props, ref) {
113
+ var children = props.children, className = props.className, src = props.src, rest = __rest(props, ["children", "className", "src"]);
114
+ var _a = __read(react_1.useState(helpers_1.initState()), 2), state = _a[0], setState = _a[1];
116
115
  var isMountedRef = react_1.useRef(false);
117
116
  var srcRef = react_1.useRef(src);
118
117
  react_1.useEffect(function () {
@@ -156,7 +155,9 @@ exports.Svg = core_1.vui(function (_a, ref) {
156
155
  }
157
156
  src && loadSvg(src);
158
157
  }, [src]);
158
+ var _b = state.content, content = _b === void 0 ? '' : _b, _c = state.svgAttributes, svgAttributes = _c === void 0 ? {} : _c;
159
159
  var innerHTML = !children ? { __html: content } : undefined;
160
+ // const pathFill = Array.isArray(fill) ? fill : [fill]
160
161
  return (react_1.default.createElement(exports.SvgBase, __assign({ className: utils_1.cs('vui-svg', className), dangerouslySetInnerHTML: innerHTML, ref: ref, xmlns: "http://www.w3.org/2000/svg" }, svgAttributes, rest), children));
161
162
  });
162
163
  exports.Svg.displayName = 'Svg';
@@ -1,6 +1,7 @@
1
- import { SystemProps } from '../system';
1
+ import { ColorGetter, SystemProps } from '../system';
2
2
  import { Dict } from '../utils';
3
3
  export interface SvgProps extends SystemProps {
4
+ fill?: ColorGetter | ColorGetter[];
4
5
  src?: string;
5
6
  }
6
7
  export interface SvgState {
@@ -0,0 +1,2 @@
1
+ import { TextareaProps } from './textarea.types';
2
+ export declare function getInitialCount(props: TextareaProps): number;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getInitialCount = void 0;
4
+ function getInitialCount(props) {
5
+ var _a, _b;
6
+ var defaultValue = props.defaultValue, value = props.value;
7
+ return (_b = (_a = defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.toString().length) !== null && _a !== void 0 ? _a : value === null || value === void 0 ? void 0 : value.toString().length) !== null && _b !== void 0 ? _b : 0;
8
+ }
9
+ exports.getInitialCount = getInitialCount;
@@ -1,5 +1,6 @@
1
1
  import { TextareaProps } from './textarea.types';
2
2
  import { SystemProps } from '../system';
3
- export declare const TextareaBase: import("styled-components").StyledComponent<"textarea", import("styled-components").DefaultTheme, SystemProps, never>;
4
- export declare const Textarea: import("../core").VuiComponent<"textarea", TextareaProps>;
3
+ export declare const TextareaTextarea: import("styled-components").StyledComponent<"textarea", import("styled-components").DefaultTheme, SystemProps, never>;
4
+ export declare const TextareaBase: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, SystemProps, never>;
5
+ export declare const Textarea: import("../core").VuiComponent<"div", TextareaProps>;
5
6
  export default Textarea;
@@ -14,6 +14,25 @@ var __assign = (this && this.__assign) || function () {
14
14
  };
15
15
  return __assign.apply(this, arguments);
16
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
+ };
17
36
  var __rest = (this && this.__rest) || function (s, e) {
18
37
  var t = {};
19
38
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
@@ -25,22 +44,73 @@ var __rest = (this && this.__rest) || function (s, e) {
25
44
  }
26
45
  return t;
27
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
+ };
28
63
  var __importDefault = (this && this.__importDefault) || function (mod) {
29
64
  return (mod && mod.__esModule) ? mod : { "default": mod };
30
65
  };
31
66
  Object.defineProperty(exports, "__esModule", { value: true });
32
- exports.Textarea = exports.TextareaBase = void 0;
33
- var react_1 = __importDefault(require("react"));
67
+ exports.Textarea = exports.TextareaBase = exports.TextareaTextarea = void 0;
68
+ var react_1 = __importStar(require("react"));
34
69
  var styled_components_1 = __importDefault(require("styled-components"));
70
+ var helpers_1 = require("./helpers");
35
71
  var core_1 = require("../core");
36
72
  var system_1 = require("../system");
73
+ var t_1 = __importDefault(require("../t"));
37
74
  var utils_1 = require("../utils");
38
- exports.TextareaBase = styled_components_1.default.textarea.withConfig(core_1.forwardPropConfig(system_1.system))(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n\tborder-width: 1px;\n\tmin-height: 80px;\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:focus {\n\t\tborder-color: transparent;\n\t}\n\n\t", "\n"], ["\n\tborder-width: 1px;\n\tmin-height: 80px;\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:focus {\n\t\tborder-color: transparent;\n\t}\n\n\t", "\n"])), system_1.system);
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);
39
77
  exports.Textarea = core_1.vui(function (props, ref) {
40
- var _a = core_1.omitThemingProps(props), className = _a.className, rest = __rest(_a, ["className"]);
41
- var styles = core_1.useStyleConfig('Textarea', props);
42
- return (react_1.default.createElement(exports.TextareaBase, __assign({ borderRadius: "md", className: utils_1.cs('vui-textarea', className), p: 1, placeholderColor: "grey.60", ref: ref, transitionDuration: "fast" }, styles, rest)));
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, 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", "isInvalid", "maxLength", "name", "onBlur", "onChange", "onFocus", "placeholder", "readOnly", "required", "resize", "showCount", "textareaProps", "textareaRef", "value"]);
80
+ var colorProps = utils_1.filterUndefined({
81
+ colorScheme: colorSchemeProp !== null && colorSchemeProp !== void 0 ? colorSchemeProp : (isInvalid ? 'red' : undefined)
82
+ });
83
+ var styles = core_1.useStyleConfig('Textarea', __assign(__assign({}, colorProps), props));
84
+ function onChange(e) {
85
+ setCount(e.target.value.length);
86
+ onChangeProp === null || onChangeProp === void 0 ? void 0 : onChangeProp(e);
87
+ }
88
+ var aliasedProps = utils_1.filterUndefined({
89
+ bg: readOnly ? 'grey.20' : undefined,
90
+ focusBorderColor: !readOnly ? 'transparent' : undefined,
91
+ focusRing: readOnly ? 0 : undefined
92
+ });
93
+ return (react_1.default.createElement(exports.TextareaBase, __assign({ className: utils_1.cs('vui-textarea', className), ref: ref }, styles.container, rest),
94
+ react_1.default.createElement(exports.TextareaTextarea, __assign({ borderRadius: "md", className: "vui-textareaTextarea", p: 1, placeholderColor: "grey.60", ref: textareaRef, transitionDuration: "fast" }, {
95
+ autoFocus: autoFocus,
96
+ defaultValue: defaultValue,
97
+ disabled: disabled,
98
+ maxLength: maxLength,
99
+ name: name,
100
+ onBlur: onBlur,
101
+ onChange: onChange,
102
+ onFocus: onFocus,
103
+ placeholder: placeholder,
104
+ readOnly: readOnly,
105
+ required: required,
106
+ resize: resize,
107
+ value: value
108
+ }, styles.textarea, aliasedProps, textareaProps)),
109
+ showCount && (react_1.default.createElement(t_1.default, { color: "grey.80", position: "absolute", right: 0, size: "sm", top: "calc(100% + 2px)" },
110
+ count,
111
+ " / ",
112
+ maxLength))));
43
113
  });
44
114
  exports.Textarea.displayName = 'Textarea';
45
115
  exports.default = exports.Textarea;
46
- var templateObject_1;
116
+ var templateObject_1, templateObject_2;
@@ -1,5 +1,25 @@
1
+ /// <reference types="react" />
2
+ import { ChangeEventHandler, FocusEventHandler, PropsOf } from '../core';
1
3
  import { SystemProps } from '../system';
2
4
  import { ThemingProps } from '../theme';
3
5
  export interface TextareaProps extends SystemProps, ThemingProps<'Textarea'> {
6
+ autoFocus?: boolean;
4
7
  colorScheme?: 'green' | 'grey' | 'red';
8
+ cols?: number;
9
+ defaultValue?: number | string;
10
+ disabled?: boolean;
11
+ isInvalid?: boolean;
12
+ maxLength?: number;
13
+ name?: string;
14
+ onBlur?: FocusEventHandler<HTMLTextAreaElement>;
15
+ onChange?: ChangeEventHandler<HTMLTextAreaElement>;
16
+ onFocus?: FocusEventHandler<HTMLTextAreaElement>;
17
+ placeholder?: string;
18
+ readOnly?: boolean;
19
+ required?: boolean;
20
+ rows?: number;
21
+ showCount?: boolean;
22
+ textareaProps?: PropsOf<'textarea', SystemProps>;
23
+ textareaRef?: React.MutableRefObject<HTMLTextAreaElement | null> | null;
24
+ value?: number | string;
5
25
  }
@@ -1,14 +1,18 @@
1
1
  import { Dict } from '../utils';
2
2
  declare function variantDefault(props: Dict): {
3
- borderColor: string;
4
- focusRing: number;
5
- focusRingColor: string;
3
+ container: {};
4
+ textarea: {
5
+ borderColor: string;
6
+ focusRing: number;
7
+ focusRingColor: string;
8
+ };
6
9
  };
7
10
  declare const _default: {
8
11
  defaultProps: {
9
12
  colorScheme: string;
10
13
  variant: string;
11
14
  };
15
+ parts: string[];
12
16
  sizes: {};
13
17
  variants: {
14
18
  default: typeof variantDefault;
package/textarea/theme.js CHANGED
@@ -2,27 +2,30 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  function variantDefault(props) {
4
4
  var c = props.colorScheme;
5
- var styles = {
5
+ var container = {};
6
+ var textarea = {
6
7
  borderColor: c + ".80",
7
8
  focusRing: 2,
8
9
  focusRingColor: c + ".80"
9
10
  };
10
11
  if (c === 'grey') {
11
- styles.borderColor = c + ".60";
12
- styles.focusRingColor = 'blue.50';
12
+ textarea.borderColor = c + ".60";
13
+ textarea.focusRingColor = 'blue.50';
13
14
  }
14
- return styles;
15
+ return { container: container, textarea: textarea };
15
16
  }
16
17
  var defaultProps = {
17
18
  colorScheme: 'grey',
18
19
  variant: 'default'
19
20
  };
21
+ var parts = ['container', 'textarea'];
20
22
  var sizes = {};
21
23
  var variants = {
22
24
  default: variantDefault
23
25
  };
24
26
  exports.default = {
25
27
  defaultProps: defaultProps,
28
+ parts: parts,
26
29
  sizes: sizes,
27
30
  variants: variants
28
31
  };
@@ -308,7 +308,6 @@ declare const _default: {
308
308
  borderColor: string;
309
309
  focusWithinRing: number;
310
310
  focusWithinRingColor: string;
311
- iconColor: string;
312
311
  };
313
312
  };
314
313
  };
@@ -392,6 +391,10 @@ declare const _default: {
392
391
  color: string;
393
392
  hoverColor: string;
394
393
  };
394
+ light: (props: import("..").Dict<any>) => {
395
+ color: string;
396
+ hoverColor: string;
397
+ };
395
398
  };
396
399
  };
397
400
  List: {
@@ -745,12 +748,16 @@ declare const _default: {
745
748
  colorScheme: string;
746
749
  variant: string;
747
750
  };
751
+ parts: string[];
748
752
  sizes: {};
749
753
  variants: {
750
754
  default: (props: import("..").Dict<any>) => {
751
- borderColor: string;
752
- focusRing: number;
753
- focusRingColor: string;
755
+ container: {};
756
+ textarea: {
757
+ borderColor: string;
758
+ focusRing: number;
759
+ focusRingColor: string;
760
+ };
754
761
  };
755
762
  };
756
763
  };
@@ -459,7 +459,6 @@ declare const defaultTheme: {
459
459
  borderColor: string;
460
460
  focusWithinRing: number;
461
461
  focusWithinRingColor: string;
462
- iconColor: string;
463
462
  };
464
463
  };
465
464
  };
@@ -543,6 +542,10 @@ declare const defaultTheme: {
543
542
  color: string;
544
543
  hoverColor: string;
545
544
  };
545
+ light: (props: import("..").Dict<any>) => {
546
+ color: string;
547
+ hoverColor: string;
548
+ };
546
549
  };
547
550
  };
548
551
  List: {
@@ -896,12 +899,16 @@ declare const defaultTheme: {
896
899
  colorScheme: string;
897
900
  variant: string;
898
901
  };
902
+ parts: string[];
899
903
  sizes: {};
900
904
  variants: {
901
905
  default: (props: import("..").Dict<any>) => {
902
- borderColor: string;
903
- focusRing: number;
904
- focusRingColor: string;
906
+ container: {};
907
+ textarea: {
908
+ borderColor: string;
909
+ focusRing: number;
910
+ focusRingColor: string;
911
+ };
905
912
  };
906
913
  };
907
914
  };
@@ -2,12 +2,12 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.default = {
4
4
  bounce: 'vui-bounce 1s infinite',
5
- fadeDown: 'vui-fadeDown 0.3s ease-in-out',
6
- fadeIn: 'vui-fadeIn 0.3s ease-in-out',
7
- fadeLeft: 'vui-fadeLeft 0.3s ease-in-out',
8
- fadeOut: 'vui-fadeOut 0.3s ease-in-out',
9
- fadeRight: 'vui-fadeRight 0.3s ease-in-out',
10
- fadeUp: 'vui-fadeUp 0.3s ease-in-out',
5
+ fadeDown: 'vui-fadeDown 0.2s ease-in-out',
6
+ fadeIn: 'vui-fadeIn 0.2s ease-in-out',
7
+ fadeLeft: 'vui-fadeLeft 0.2s ease-in-out',
8
+ fadeOut: 'vui-fadeOut 0.2s ease-in-out',
9
+ fadeRight: 'vui-fadeRight 0.2s ease-in-out',
10
+ fadeUp: 'vui-fadeUp 0.2s ease-in-out',
11
11
  pulse: 'vui-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite',
12
12
  spin: 'vui-spin 1s linear infinite'
13
13
  };