@veracity/vui 1.5.0-beta.1 → 1.5.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/dist/cjs/buttonGroup/buttonGroup.d.ts.map +1 -1
  2. package/dist/cjs/buttonGroup/buttonGroup.js +4 -0
  3. package/dist/cjs/input/consts.d.ts +3 -0
  4. package/dist/cjs/input/consts.d.ts.map +1 -1
  5. package/dist/cjs/input/consts.js +4 -1
  6. package/dist/cjs/input/helpText.d.ts +5 -0
  7. package/dist/cjs/input/helpText.d.ts.map +1 -0
  8. package/dist/cjs/input/helpText.js +36 -0
  9. package/dist/cjs/input/input.d.ts +2 -0
  10. package/dist/cjs/input/input.d.ts.map +1 -1
  11. package/dist/cjs/input/input.js +8 -4
  12. package/dist/cjs/input/input.types.d.ts +9 -1
  13. package/dist/cjs/input/input.types.d.ts.map +1 -1
  14. package/dist/cjs/list/listText.d.ts.map +1 -1
  15. package/dist/cjs/list/listText.js +1 -1
  16. package/dist/cjs/select/select.d.ts.map +1 -1
  17. package/dist/cjs/select/select.js +1 -1
  18. package/dist/cjs/select/select.types.d.ts +2 -0
  19. package/dist/cjs/select/select.types.d.ts.map +1 -1
  20. package/dist/cjs/select/selectButton.d.ts.map +1 -1
  21. package/dist/cjs/select/selectButton.js +1 -1
  22. package/dist/cjs/select/selectOption.d.ts.map +1 -1
  23. package/dist/cjs/select/selectOption.js +2 -2
  24. package/dist/cjs/utils/styles.d.ts +7 -0
  25. package/dist/cjs/utils/styles.d.ts.map +1 -1
  26. package/dist/cjs/utils/styles.js +10 -11
  27. package/dist/esm/buttonGroup/buttonGroup.d.ts.map +1 -1
  28. package/dist/esm/buttonGroup/buttonGroup.js +4 -0
  29. package/dist/esm/input/consts.d.ts +3 -0
  30. package/dist/esm/input/consts.d.ts.map +1 -1
  31. package/dist/esm/input/consts.js +3 -0
  32. package/dist/esm/input/helpText.d.ts +5 -0
  33. package/dist/esm/input/helpText.d.ts.map +1 -0
  34. package/dist/esm/input/helpText.js +19 -0
  35. package/dist/esm/input/input.d.ts +2 -0
  36. package/dist/esm/input/input.d.ts.map +1 -1
  37. package/dist/esm/input/input.js +9 -5
  38. package/dist/esm/input/input.types.d.ts +9 -1
  39. package/dist/esm/input/input.types.d.ts.map +1 -1
  40. package/dist/esm/list/listText.d.ts.map +1 -1
  41. package/dist/esm/list/listText.js +2 -2
  42. package/dist/esm/select/select.d.ts.map +1 -1
  43. package/dist/esm/select/select.js +2 -1
  44. package/dist/esm/select/select.types.d.ts +2 -0
  45. package/dist/esm/select/select.types.d.ts.map +1 -1
  46. package/dist/esm/select/selectButton.d.ts.map +1 -1
  47. package/dist/esm/select/selectButton.js +2 -2
  48. package/dist/esm/select/selectOption.d.ts.map +1 -1
  49. package/dist/esm/select/selectOption.js +3 -3
  50. package/dist/esm/utils/styles.d.ts +7 -0
  51. package/dist/esm/utils/styles.d.ts.map +1 -1
  52. package/dist/esm/utils/styles.js +9 -10
  53. package/package.json +1 -1
  54. package/src/buttonGroup/buttonGroup.tsx +4 -0
  55. package/src/input/consts.ts +4 -0
  56. package/src/input/helpText.tsx +36 -0
  57. package/src/input/input.tsx +18 -9
  58. package/src/input/input.types.ts +11 -0
  59. package/src/list/listText.tsx +11 -2
  60. package/src/select/select.tsx +2 -1
  61. package/src/select/select.types.ts +2 -0
  62. package/src/select/selectButton.tsx +6 -2
  63. package/src/select/selectOption.tsx +4 -2
  64. package/src/utils/styles.ts +12 -10
@@ -1 +1 @@
1
- {"version":3,"file":"buttonGroup.d.ts","sourceRoot":"","sources":["../../../src/buttonGroup/buttonGroup.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAItD,eAAO,MAAM,eAAe;;sBAA2D,MAAM;SAuC5F,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,WAAW,yDAiBtB,CAAA;AAEF,eAAe,WAAW,CAAA"}
1
+ {"version":3,"file":"buttonGroup.d.ts","sourceRoot":"","sources":["../../../src/buttonGroup/buttonGroup.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAItD,eAAO,MAAM,eAAe;;sBAA2D,MAAM;SA2C5F,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,WAAW,yDAiBtB,CAAA;AAEF,eAAe,WAAW,CAAA"}
@@ -75,6 +75,10 @@ exports.ButtonGroupBase = core_1.styled.divBox `
75
75
  border-color: ${p => core_1.th.color(p.innerBorderColor)};
76
76
  }
77
77
 
78
+ > *:disabled {
79
+ border-color: disabled.border;
80
+ }
81
+
78
82
  //
79
83
  > .${utils_1.activeClassName} {
80
84
  background-color: ${p => core_1.th.color(`${p.colorScheme}.${utils_1.activeItemShade}`)};
@@ -1,3 +1,6 @@
1
1
  import { InputStateMapping } from './input.types';
2
+ export declare const greyLightColor = "grey.10";
3
+ export declare const greyColor = "grey.80";
4
+ export declare const redColor = "red.80";
2
5
  export declare const inputStateMapping: InputStateMapping;
3
6
  //# sourceMappingURL=consts.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"consts.d.ts","sourceRoot":"","sources":["../../../src/input/consts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAEjD,eAAO,MAAM,iBAAiB,EAAE,iBAuB/B,CAAA"}
1
+ {"version":3,"file":"consts.d.ts","sourceRoot":"","sources":["../../../src/input/consts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAEjD,eAAO,MAAM,cAAc,YAAY,CAAA;AACvC,eAAO,MAAM,SAAS,YAAY,CAAA;AAClC,eAAO,MAAM,QAAQ,WAAW,CAAA;AAEhC,eAAO,MAAM,iBAAiB,EAAE,iBAuB/B,CAAA"}
@@ -1,6 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.inputStateMapping = void 0;
3
+ exports.inputStateMapping = exports.redColor = exports.greyColor = exports.greyLightColor = void 0;
4
+ exports.greyLightColor = 'grey.10';
5
+ exports.greyColor = 'grey.80';
6
+ exports.redColor = 'red.80';
4
7
  exports.inputStateMapping = {
5
8
  error: {
6
9
  colorScheme: 'red',
@@ -0,0 +1,5 @@
1
+ import { HelpTextProps } from './input.types';
2
+ /** Displaying help text bellow an input.. */
3
+ export declare const HelpText: import("../core").VuiComponent<"div", HelpTextProps>;
4
+ export default HelpText;
5
+ //# sourceMappingURL=helpText.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpText.d.ts","sourceRoot":"","sources":["../../../src/input/helpText.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAE7C,6CAA6C;AAC7C,eAAO,MAAM,QAAQ,sDAsBnB,CAAA;AAEF,eAAe,QAAQ,CAAA"}
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ var __rest = (this && this.__rest) || function (s, e) {
3
+ var t = {};
4
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
+ t[p] = s[p];
6
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
+ t[p[i]] = s[p[i]];
10
+ }
11
+ return t;
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.HelpText = void 0;
18
+ const react_1 = __importDefault(require("react"));
19
+ const core_1 = require("../core");
20
+ const icon_1 = __importDefault(require("../icon"));
21
+ const p_1 = __importDefault(require("../p"));
22
+ const utils_1 = require("../utils");
23
+ const consts_1 = require("./consts");
24
+ const context_1 = require("./context");
25
+ /** Displaying help text bellow an input.. */
26
+ exports.HelpText = (0, core_1.vui)((props, ref) => {
27
+ const { className, children, isError } = props, rest = __rest(props, ["className", "children", "isError"]);
28
+ const inputProps = (0, context_1.useInputContext)();
29
+ const mergedProps = Object.assign(Object.assign({}, inputProps), props);
30
+ const styles = (0, core_1.useStyleConfig)('Input', mergedProps);
31
+ const color = isError ? consts_1.redColor : consts_1.greyColor;
32
+ return (react_1.default.createElement(p_1.default, Object.assign({ className: (0, utils_1.cs)('vui-inputHelpText', className), color: color, display: "flex", py: 1, ref: ref }, styles.helpText, rest),
33
+ isError && react_1.default.createElement(icon_1.default, { mr: 1, name: "falExclamationTriangle", pathFill: consts_1.redColor, size: "sm" }),
34
+ children));
35
+ });
36
+ exports.default = exports.HelpText;
@@ -1,4 +1,5 @@
1
1
  import { VuiComponent } from '../core';
2
+ import HelpText from './helpText';
2
3
  import { InputProps } from './input.types';
3
4
  import InputIcon from './inputIcon';
4
5
  import InputInput from './inputInput';
@@ -11,6 +12,7 @@ export declare const InputBase: import("styled-components").StyledComponent<"div
11
12
  export declare const Input: VuiComponent<"div", InputProps> & {
12
13
  Icon: typeof InputIcon;
13
14
  Input: typeof InputInput;
15
+ HelpText: typeof HelpText;
14
16
  };
15
17
  export default Input;
16
18
  //# sourceMappingURL=input.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../../src/input/input.tsx"],"names":[],"mappings":"AAEA,OAAO,EAA+B,YAAY,EAAE,MAAM,SAAS,CAAA;AAMnE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,SAAS,MAAM,aAAa,CAAA;AACnC,OAAO,UAAU,MAAM,cAAc,CAAA;AAErC,eAAO,MAAM,SAAS,+HAiBrB,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,KAAK;UAkHV,gBAAgB;WACf,iBAAiB;CACzB,CAAA;AAKD,eAAe,KAAK,CAAA"}
1
+ {"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../../src/input/input.tsx"],"names":[],"mappings":"AAEA,OAAO,EAA+B,YAAY,EAAE,MAAM,SAAS,CAAA;AAMnE,OAAO,QAAQ,MAAM,YAAY,CAAA;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,SAAS,MAAM,aAAa,CAAA;AACnC,OAAO,UAAU,MAAM,cAAc,CAAA;AAErC,eAAO,MAAM,SAAS,+HAiBrB,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,KAAK;UAwHV,gBAAgB;WACf,iBAAiB;cACd,eAAe;CAC1B,CAAA;AAMD,eAAe,KAAK,CAAA"}
@@ -45,6 +45,7 @@ const utils_1 = require("../utils");
45
45
  const consts_1 = require("./consts");
46
46
  const context_1 = require("./context");
47
47
  const helpers_1 = require("./helpers");
48
+ const helpText_1 = __importDefault(require("./helpText"));
48
49
  const inputIcon_1 = __importDefault(require("./inputIcon"));
49
50
  const inputInput_1 = __importDefault(require("./inputInput"));
50
51
  exports.InputBase = core_1.styled.divBox `
@@ -73,7 +74,7 @@ exports.InputBase = core_1.styled.divBox `
73
74
  exports.Input = (0, core_1.vui)((props, ref) => {
74
75
  var _a, _b, _c, _d;
75
76
  const [count, setCount] = (0, react_1.useState)((0, helpers_1.getInitialCount)(props));
76
- const { autoComplete, autoFocus, children, className, colorScheme, defaultValue, disabled, iconLeft, iconRight, id, input, inputProps, inputRef, isInvalid, itemLeft, itemRight, max, maxLength, min, name, onBlur, onChange: onChangeProp, onFocus, pattern, placeholder, readOnly, required, showCount, size, state = '', stateMapping, step, type = 'text', value, variant } = props, rest = __rest(props, ["autoComplete", "autoFocus", "children", "className", "colorScheme", "defaultValue", "disabled", "iconLeft", "iconRight", "id", "input", "inputProps", "inputRef", "isInvalid", "itemLeft", "itemRight", "max", "maxLength", "min", "name", "onBlur", "onChange", "onFocus", "pattern", "placeholder", "readOnly", "required", "showCount", "size", "state", "stateMapping", "step", "type", "value", "variant"]);
77
+ const { autoComplete, autoFocus, children, className, colorScheme, defaultValue, disabled, errorText, iconLeft, iconRight, id, input, inputProps, inputRef, isInvalid, itemLeft, itemRight, helpText, max, maxLength, min, name, onBlur, onChange: onChangeProp, onFocus, pattern, placeholder, readOnly, required, showCount, size, state = '', stateMapping, step, type = 'text', value, variant } = props, rest = __rest(props, ["autoComplete", "autoFocus", "children", "className", "colorScheme", "defaultValue", "disabled", "errorText", "iconLeft", "iconRight", "id", "input", "inputProps", "inputRef", "isInvalid", "itemLeft", "itemRight", "helpText", "max", "maxLength", "min", "name", "onBlur", "onChange", "onFocus", "pattern", "placeholder", "readOnly", "required", "showCount", "size", "state", "stateMapping", "step", "type", "value", "variant"]);
77
78
  const states = Object.assign(Object.assign({}, consts_1.inputStateMapping), stateMapping);
78
79
  const computedColorScheme = (0, utils_1.filterUndefined)({
79
80
  colorScheme: (_a = colorScheme !== null && colorScheme !== void 0 ? colorScheme : (isInvalid ? 'red' : undefined)) !== null && _a !== void 0 ? _a : (_b = states[state]) === null || _b === void 0 ? void 0 : _b.colorScheme
@@ -86,7 +87,7 @@ exports.Input = (0, core_1.vui)((props, ref) => {
86
87
  }
87
88
  const aliasedProps = (0, utils_1.filterUndefined)({
88
89
  'aria-disabled': disabled,
89
- bg: readOnly ? 'grey.10' : undefined,
90
+ bg: readOnly ? consts_1.greyLightColor : undefined,
90
91
  focusWithinBorderColor: !readOnly ? 'transparent' : undefined,
91
92
  focusWithinRingColor: readOnly ? 'transparent' : undefined
92
93
  });
@@ -117,11 +118,14 @@ exports.Input = (0, core_1.vui)((props, ref) => {
117
118
  (0, utils_1.isString)(iconRight) ? react_1.default.createElement(inputIcon_1.default, { mr: 1, name: iconRight }) : iconRight,
118
119
  itemRight,
119
120
  state && react_1.default.createElement(inputIcon_1.default, Object.assign({ mr: 1 }, (_d = states[state]) === null || _d === void 0 ? void 0 : _d.iconProps)),
120
- showCount && (react_1.default.createElement(t_1.T, { className: "vui-inputCount", color: "grey.80", position: "absolute", right: 0, size: "sm", top: "calc(100% + 1px)" },
121
+ showCount && (react_1.default.createElement(t_1.T, { className: "vui-inputCount", color: consts_1.greyColor, position: "absolute", right: 0, size: "sm", top: "calc(100% + 1px)" },
121
122
  count,
122
123
  " / ",
123
- maxLength)))));
124
+ maxLength))),
125
+ !!helpText && react_1.default.createElement(helpText_1.default, null, helpText),
126
+ !!errorText && react_1.default.createElement(helpText_1.default, { isError: true }, errorText)));
124
127
  });
125
128
  exports.Input.Icon = inputIcon_1.default;
126
129
  exports.Input.Input = inputInput_1.default;
130
+ exports.Input.HelpText = helpText_1.default;
127
131
  exports.default = exports.Input;
@@ -1,5 +1,6 @@
1
- /// <reference types="react" />
1
+ import React from 'react';
2
2
  import { IconProp, IconProps } from '../icon';
3
+ import { PProps } from '../p';
3
4
  import { SystemProps } from '../system';
4
5
  import { ThemingProps } from '../theme';
5
6
  import { ChangeEventHandler, FocusEventHandler, PropsOf } from '../utils';
@@ -15,6 +16,8 @@ export declare type InputProps = SystemProps & ThemingProps<'Input'> & {
15
16
  defaultValue?: number | string;
16
17
  /** Passed to the inner input. */
17
18
  disabled?: boolean;
19
+ /** Socket displaying error text bellow an input. */
20
+ errorText?: string | React.ReactNode;
18
21
  /** Socket displaying an icon on the left. */
19
22
  iconLeft?: IconProp | JSX.Element;
20
23
  /** Socket displaying an icon on the right. */
@@ -31,6 +34,8 @@ export declare type InputProps = SystemProps & ThemingProps<'Input'> & {
31
34
  itemLeft?: React.ReactNode;
32
35
  /** Socket displaying a custom element on the right. */
33
36
  itemRight?: React.ReactNode;
37
+ /** Socket displaying help text bellow an input. */
38
+ helpText?: React.ReactNode | string;
34
39
  /** Passed to the inner input. */
35
40
  max?: number | string;
36
41
  /** Passed to the inner input. */
@@ -66,6 +71,9 @@ export declare type InputProps = SystemProps & ThemingProps<'Input'> & {
66
71
  /** Passed to the inner input. */
67
72
  value?: number | string;
68
73
  };
74
+ export declare type HelpTextProps = PProps & {
75
+ isError?: boolean;
76
+ };
69
77
  export declare type InputState = 'default' | 'error' | 'loading' | 'success';
70
78
  export declare type InputStateMapping = Record<string, {
71
79
  colorScheme?: InputProps['colorScheme'];
@@ -1 +1 @@
1
- {"version":3,"file":"input.types.d.ts","sourceRoot":"","sources":["../../../src/input/input.types.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AACvC,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAEzE,oBAAY,eAAe,GAAG,OAAO,CAAC,OAAO,EAAE,WAAW,CAAC,CAAA;AAE3D,oBAAY,UAAU,GAAG,WAAW,GAClC,YAAY,CAAC,OAAO,CAAC,GAAG;IACtB,iCAAiC;IACjC,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,iCAAiC;IACjC,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,+DAA+D;IAC/D,WAAW,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,KAAK,CAAA;IACtC,iCAAiC;IACjC,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IAC9B,iCAAiC;IACjC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,6CAA6C;IAC7C,QAAQ,CAAC,EAAE,QAAQ,GAAG,GAAG,CAAC,OAAO,CAAA;IACjC,8CAA8C;IAC9C,SAAS,CAAC,EAAE,QAAQ,GAAG,GAAG,CAAC,OAAO,CAAA;IAClC,+CAA+C;IAC/C,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACvB,8CAA8C;IAC9C,UAAU,CAAC,EAAE,eAAe,CAAA;IAC5B,qCAAqC;IACrC,QAAQ,CAAC,EAAE,KAAK,CAAC,gBAAgB,CAAC,gBAAgB,GAAG,IAAI,CAAC,GAAG,IAAI,CAAA;IACjE,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ACnB,iEAAiE;IACjE,KAAK,CAAC,EAAE,UAAU,CAAA;IAClB,8DAA8D;IAC9D,YAAY,CAAC,EAAE,iBAAiB,CAAA;IAChC,iCAAiC;IACjC,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACtB,iCAAiC;IACjC,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB,iCAAiC;IACjC,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;CACxB,CAAA;AAEH,oBAAY,aAAa,GAAG,MAAM,GAAG;IACnC,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,CAAA;AAED,oBAAY,UAAU,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS,CAAA;AAEpE,oBAAY,iBAAiB,GAAG,MAAM,CACpC,MAAM,EACN;IACE,WAAW,CAAC,EAAE,UAAU,CAAC,aAAa,CAAC,CAAA;IACvC,SAAS,EAAE,SAAS,CAAA;CACrB,CACF,CAAA;AAED,oBAAY,SAAS,GACjB,MAAM,GACN,gBAAgB,GAChB,OAAO,GACP,QAAQ,GACR,OAAO,GACP,QAAQ,GACR,UAAU,GACV,QAAQ,GACR,KAAK,GACL,MAAM,GACN,MAAM,GACN,KAAK,GACL,MAAM,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"listText.d.ts","sourceRoot":"","sources":["../../../src/list/listText.tsx"],"names":[],"mappings":"AAGA,OAAU,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAIhC,yCAAyC;AACzC,eAAO,MAAM,QAAQ,gDAKnB,CAAA;AAEF,eAAe,QAAQ,CAAA"}
1
+ {"version":3,"file":"listText.d.ts","sourceRoot":"","sources":["../../../src/list/listText.tsx"],"names":[],"mappings":"AAGA,OAAU,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAIhC,yCAAyC;AACzC,eAAO,MAAM,QAAQ,gDAcnB,CAAA;AAEF,eAAe,QAAQ,CAAA"}
@@ -24,6 +24,6 @@ const context_1 = require("./context");
24
24
  exports.ListText = (0, core_1.vui)((props, ref) => {
25
25
  const { className } = props, rest = __rest(props, ["className"]);
26
26
  const styles = (0, core_1.useStyleConfig)('List', (0, context_1.useListContext)());
27
- return react_1.default.createElement(t_1.default, Object.assign({ className: (0, utils_1.cs)('vui-listText', className), fontSize: "inherit", ref: ref }, styles.text, rest));
27
+ return (react_1.default.createElement(t_1.default, Object.assign({ className: (0, utils_1.cs)('vui-listText', className), fontSize: "inherit", ref: ref }, utils_1.ellipsisOverflow, styles.text, rest)));
28
28
  });
29
29
  exports.default = exports.ListText;
@@ -1 +1 @@
1
- {"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../../src/select/select.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAO5C;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,WAAW,eAoDxC;yBApDe,MAAM;;;;;;;;;AA2DtB,eAAe,MAAM,CAAA"}
1
+ {"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../../src/select/select.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAO5C;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,WAAW,eAqDxC;yBArDe,MAAM;;;;;;;;;AA4DtB,eAAe,MAAM,CAAA"}
@@ -49,7 +49,7 @@ function Select(props) {
49
49
  react_1.default.createElement(popover_1.Popover, Object.assign({ matchWidth: true }, rest),
50
50
  react_1.default.createElement(react_1.default.Fragment, null, selectButton !== null && selectButton !== void 0 ? selectButton : react_1.default.createElement(selectButton_1.default, null),
51
51
  react_1.default.createElement(selectContent_1.default, null,
52
- react_1.default.createElement(selectGroup_1.default, null, children !== null && children !== void 0 ? children : (_a = options === null || options === void 0 ? void 0 : options.map) === null || _a === void 0 ? void 0 : _a.call(options, option => react_1.default.createElement(selectOption_1.default, Object.assign({ key: option.value }, option)))))))));
52
+ react_1.default.createElement(selectGroup_1.default, null, children !== null && children !== void 0 ? children : (_a = options === null || options === void 0 ? void 0 : options.map) === null || _a === void 0 ? void 0 : _a.call(options, option => react_1.default.createElement(selectOption_1.default, Object.assign({ key: option.value, title: option.text }, option)))))))));
53
53
  }
54
54
  exports.Select = Select;
55
55
  Select.Button = selectButton_1.default;
@@ -36,6 +36,8 @@ export declare type SelectOptionData = {
36
36
  export declare type SelectOptionProps = ListItemProps & {
37
37
  /** Currently selected value. Can be a string/number or array of those when using 'isMultiple'. */
38
38
  value?: SelectValue;
39
+ /** Hover title text. */
40
+ title?: string;
39
41
  };
40
42
  export declare type SelectValue = number | string;
41
43
  //# sourceMappingURL=select.types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"select.types.d.ts","sourceRoot":"","sources":["../../../src/select/select.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEjC,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AACvC,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAClD,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AACvC,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAElD,oBAAY,iBAAiB,GAAG,WAAW,CAAA;AAE3C,oBAAY,kBAAkB,GAAG,mBAAmB,CAAA;AAEpD,oBAAY,aAAa,GAAG,IAAI,CAC9B,WAAW,EACX,UAAU,GAAG,WAAW,GAAG,YAAY,GAAG,MAAM,GAAG,SAAS,GAAG,aAAa,GAAG,UAAU,GAAG,MAAM,GAAG,SAAS,CAC/G,GACC,mBAAmB,CAAA;AAErB,oBAAY,gBAAgB,GAAG,SAAS,CAAA;AAExC,oBAAY,WAAW,GAAG,YAAY,CAAC,QAAQ,C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AAM,YAAY,2EAgDvB,CAAA;AAEF,eAAe,YAAY,CAAA"}
1
+ {"version":3,"file":"selectButton.d.ts","sourceRoot":"","sources":["../../../src/select/selectButton.tsx"],"names":[],"mappings":"AASA;;;;GAIG;AACH,eAAO,MAAM,YAAY,2EAoDvB,CAAA;AAEF,eAAe,YAAY,CAAA"}
@@ -73,6 +73,6 @@ exports.SelectButton = (0, core_1.vui)((props, ref) => {
73
73
  hoverBorderColor: 'red.80'
74
74
  }
75
75
  : {};
76
- return (react_1.default.createElement(popover_1.PopoverTrigger, Object.assign({ as: button_1.LineButton, bg: "white", className: (0, utils_1.cs)('vui-selectButton', className), colorScheme: "prussian", disabled: disabled, focusRing: 2, fontWeight: "regular", iconRight: react_1.default.createElement(button_1.default.Icon, { color: iconColor, ml: "auto", name: "falAngleDown" }), isFullWidth: true, px: 1, ref: ref, text: react_1.default.createElement(button_1.default.Text, { color: textColor }, text), userSelect: "text" }, styles.button, readOnlyProps, isInvalidProps, rest)));
76
+ return (react_1.default.createElement(popover_1.PopoverTrigger, Object.assign({ as: button_1.LineButton, bg: "white", className: (0, utils_1.cs)('vui-selectButton', className), colorScheme: "prussian", disabled: disabled, focusRing: 2, fontWeight: "regular", iconRight: react_1.default.createElement(button_1.default.Icon, { color: iconColor, ml: "auto", name: "falAngleDown" }), isFullWidth: true, px: 1, ref: ref, text: react_1.default.createElement(button_1.default.Text, Object.assign({ color: textColor }, utils_1.ellipsisOverflow), text), userSelect: "text" }, styles.button, readOnlyProps, isInvalidProps, rest)));
77
77
  });
78
78
  exports.default = exports.SelectButton;
@@ -1 +1 @@
1
- {"version":3,"file":"selectOption.d.ts","sourceRoot":"","sources":["../../../src/select/selectOption.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAElD;;;;GAIG;AACH,eAAO,MAAM,YAAY,yDA6CvB,CAAA;AAEF,eAAe,YAAY,CAAA"}
1
+ {"version":3,"file":"selectOption.d.ts","sourceRoot":"","sources":["../../../src/select/selectOption.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAElD;;;;GAIG;AACH,eAAO,MAAM,YAAY,yDA+CvB,CAAA;AAEF,eAAe,YAAY,CAAA"}
@@ -29,7 +29,7 @@ const context_1 = require("./context");
29
29
  */
30
30
  exports.SelectOption = (0, core_1.vui)((props, ref) => {
31
31
  var _a, _b;
32
- const { children, className, disabled, onClick: onClickProp, value: valueProp } = props, rest = __rest(props, ["children", "className", "disabled", "onClick", "value"]);
32
+ const { children, className, disabled, title, onClick: onClickProp, value: valueProp } = props, rest = __rest(props, ["children", "className", "disabled", "title", "onClick", "value"]);
33
33
  const { instance } = (_a = (0, popover_1.usePopoverContext)()) !== null && _a !== void 0 ? _a : {};
34
34
  const { isMultiple, name, onChange, value } = (_b = (0, context_1.useSelectContext)()) !== null && _b !== void 0 ? _b : {};
35
35
  const styles = (0, core_1.useStyleConfig)('Select', (0, context_1.useSelectContext)());
@@ -47,7 +47,7 @@ exports.SelectOption = (0, core_1.vui)((props, ref) => {
47
47
  onChange === null || onChange === void 0 ? void 0 : onChange(clonedEvent);
48
48
  !isMultiple && (instance === null || instance === void 0 ? void 0 : instance.hide());
49
49
  });
50
- return (react_1.default.createElement(list_1.ListItem, Object.assign({ className: (0, utils_1.cs)('vui-selectOption', className), disabled: disabled, isInteractive: true, isSelected: isSelected, onClick: onClick, ref: ref, value: valueProp }, styles.item, rest), children !== null && children !== void 0 ? children : (isMultiple && (react_1.default.createElement(react_1.default.Fragment, null,
50
+ return (react_1.default.createElement(list_1.ListItem, Object.assign({ className: (0, utils_1.cs)('vui-selectOption', className), disabled: disabled, isInteractive: true, isSelected: isSelected, onClick: onClick, ref: ref, title: title, value: valueProp }, styles.item, rest, utils_1.ellipsisOverflow), children !== null && children !== void 0 ? children : (isMultiple && (react_1.default.createElement(react_1.default.Fragment, null,
51
51
  react_1.default.createElement(checkbox_1.Checkbox, { checked: isSelected, disabled: disabled, mr: 1 }),
52
52
  react_1.default.createElement(list_1.List.Text, null, props.text))))));
53
53
  });
@@ -1,5 +1,12 @@
1
+ import { Property } from 'csstype';
1
2
  /** Concatenates individual className arguments and returns a single string. */
2
3
  export declare function cs(...classNames: any[]): string;
3
4
  /** Converts hex color value to rgb with optional alpha property. */
4
5
  export declare function hexToRGBA(hex: string, alpha?: number): string;
6
+ /** Styling to add ellipsis for long texts. */
7
+ export declare const ellipsisOverflow: {
8
+ overflow: string;
9
+ textOverflow: string;
10
+ whiteSpace: Property.WhiteSpace;
11
+ };
5
12
  //# sourceMappingURL=styles.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/utils/styles.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,wBAAgB,EAAE,CAAC,GAAG,UAAU,EAAE,GAAG,EAAE,UAEtC;AAED,oEAAoE;AACpE,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,UAuBpD"}
1
+ {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/utils/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAElC,+EAA+E;AAC/E,wBAAgB,EAAE,CAAC,GAAG,UAAU,EAAE,GAAG,EAAE,UAEtC;AAED,oEAAoE;AACpE,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,UAgBpD;AAED,8CAA8C;AAC9C,eAAO,MAAM,gBAAgB;;;;CAI5B,CAAA"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.hexToRGBA = exports.cs = void 0;
3
+ exports.ellipsisOverflow = exports.hexToRGBA = exports.cs = void 0;
4
4
  /** Concatenates individual className arguments and returns a single string. */
5
5
  function cs(...classNames) {
6
6
  return classNames.filter(Boolean).join(' ');
@@ -9,23 +9,22 @@ exports.cs = cs;
9
9
  /** Converts hex color value to rgb with optional alpha property. */
10
10
  function hexToRGBA(hex, alpha) {
11
11
  let hexStr = hex;
12
- if (hexStr.charAt(0) === '#') {
12
+ if (hexStr.charAt(0) === '#')
13
13
  hexStr = hexStr.slice(1);
14
- }
15
- if (hexStr.length < 4) {
14
+ if (hexStr.length < 4)
16
15
  hexStr = hexStr
17
16
  .split('')
18
17
  .map(char => char + char)
19
18
  .join('');
20
- }
21
19
  const r = parseInt(hexStr.slice(0, 2), 16);
22
20
  const g = parseInt(hexStr.slice(2, 4), 16);
23
21
  const b = parseInt(hexStr.slice(4, 6), 16);
24
- if (alpha !== undefined) {
25
- return `rgba(${r}, ${g}, ${b}, ${alpha})`;
26
- }
27
- else {
28
- return `rgb(${r}, ${g}, ${b})`;
29
- }
22
+ return alpha !== undefined ? `rgba(${r}, ${g}, ${b}, ${alpha})` : `rgb(${r}, ${g}, ${b})`;
30
23
  }
31
24
  exports.hexToRGBA = hexToRGBA;
25
+ /** Styling to add ellipsis for long texts. */
26
+ exports.ellipsisOverflow = {
27
+ overflow: 'hidden',
28
+ textOverflow: 'ellipsis',
29
+ whiteSpace: 'nowrap'
30
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"buttonGroup.d.ts","sourceRoot":"","sources":["../../../src/buttonGroup/buttonGroup.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAItD,eAAO,MAAM,eAAe;;sBAA2D,MAAM;SAuC5F,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,WAAW,yDAiBtB,CAAA;AAEF,eAAe,WAAW,CAAA"}
1
+ {"version":3,"file":"buttonGroup.d.ts","sourceRoot":"","sources":["../../../src/buttonGroup/buttonGroup.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAItD,eAAO,MAAM,eAAe;;sBAA2D,MAAM;SA2C5F,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,WAAW,yDAiBtB,CAAA;AAEF,eAAe,WAAW,CAAA"}
@@ -38,6 +38,10 @@ export const ButtonGroupBase = styled.divBox `
38
38
  border-color: ${p => th.color(p.innerBorderColor)};
39
39
  }
40
40
 
41
+ > *:disabled {
42
+ border-color: disabled.border;
43
+ }
44
+
41
45
  //
42
46
  > .${activeClassName} {
43
47
  background-color: ${p => th.color(`${p.colorScheme}.${activeItemShade}`)};
@@ -1,3 +1,6 @@
1
1
  import { InputStateMapping } from './input.types';
2
+ export declare const greyLightColor = "grey.10";
3
+ export declare const greyColor = "grey.80";
4
+ export declare const redColor = "red.80";
2
5
  export declare const inputStateMapping: InputStateMapping;
3
6
  //# sourceMappingURL=consts.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"consts.d.ts","sourceRoot":"","sources":["../../../src/input/consts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAEjD,eAAO,MAAM,iBAAiB,EAAE,iBAuB/B,CAAA"}
1
+ {"version":3,"file":"consts.d.ts","sourceRoot":"","sources":["../../../src/input/consts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAEjD,eAAO,MAAM,cAAc,YAAY,CAAA;AACvC,eAAO,MAAM,SAAS,YAAY,CAAA;AAClC,eAAO,MAAM,QAAQ,WAAW,CAAA;AAEhC,eAAO,MAAM,iBAAiB,EAAE,iBAuB/B,CAAA"}
@@ -1,3 +1,6 @@
1
+ export const greyLightColor = 'grey.10';
2
+ export const greyColor = 'grey.80';
3
+ export const redColor = 'red.80';
1
4
  export const inputStateMapping = {
2
5
  error: {
3
6
  colorScheme: 'red',
@@ -0,0 +1,5 @@
1
+ import { HelpTextProps } from './input.types';
2
+ /** Displaying help text bellow an input.. */
3
+ export declare const HelpText: import("../core").VuiComponent<"div", HelpTextProps>;
4
+ export default HelpText;
5
+ //# sourceMappingURL=helpText.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpText.d.ts","sourceRoot":"","sources":["../../../src/input/helpText.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAE7C,6CAA6C;AAC7C,eAAO,MAAM,QAAQ,sDAsBnB,CAAA;AAEF,eAAe,QAAQ,CAAA"}
@@ -0,0 +1,19 @@
1
+ import React from 'react';
2
+ import { useStyleConfig, vui } from '../core';
3
+ import Icon from '../icon';
4
+ import P from '../p';
5
+ import { cs } from '../utils';
6
+ import { greyColor, redColor } from './consts';
7
+ import { useInputContext } from './context';
8
+ /** Displaying help text bellow an input.. */
9
+ export const HelpText = vui((props, ref) => {
10
+ const { className, children, isError, ...rest } = props;
11
+ const inputProps = useInputContext();
12
+ const mergedProps = { ...inputProps, ...props };
13
+ const styles = useStyleConfig('Input', mergedProps);
14
+ const color = isError ? redColor : greyColor;
15
+ return (React.createElement(P, { className: cs('vui-inputHelpText', className), color: color, display: "flex", py: 1, ref: ref, ...styles.helpText, ...rest },
16
+ isError && React.createElement(Icon, { mr: 1, name: "falExclamationTriangle", pathFill: redColor, size: "sm" }),
17
+ children));
18
+ });
19
+ export default HelpText;
@@ -1,4 +1,5 @@
1
1
  import { VuiComponent } from '../core';
2
+ import HelpText from './helpText';
2
3
  import { InputProps } from './input.types';
3
4
  import InputIcon from './inputIcon';
4
5
  import InputInput from './inputInput';
@@ -11,6 +12,7 @@ export declare const InputBase: import("styled-components").StyledComponent<"div
11
12
  export declare const Input: VuiComponent<"div", InputProps> & {
12
13
  Icon: typeof InputIcon;
13
14
  Input: typeof InputInput;
15
+ HelpText: typeof HelpText;
14
16
  };
15
17
  export default Input;
16
18
  //# sourceMappingURL=input.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../../src/input/input.tsx"],"names":[],"mappings":"AAEA,OAAO,EAA+B,YAAY,EAAE,MAAM,SAAS,CAAA;AAMnE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,SAAS,MAAM,aAAa,CAAA;AACnC,OAAO,UAAU,MAAM,cAAc,CAAA;AAErC,eAAO,MAAM,SAAS,+HAiBrB,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,KAAK;UAkHV,gBAAgB;WACf,iBAAiB;CACzB,CAAA;AAKD,eAAe,KAAK,CAAA"}
1
+ {"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../../src/input/input.tsx"],"names":[],"mappings":"AAEA,OAAO,EAA+B,YAAY,EAAE,MAAM,SAAS,CAAA;AAMnE,OAAO,QAAQ,MAAM,YAAY,CAAA;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,SAAS,MAAM,aAAa,CAAA;AACnC,OAAO,UAAU,MAAM,cAAc,CAAA;AAErC,eAAO,MAAM,SAAS,+HAiBrB,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,KAAK;UAwHV,gBAAgB;WACf,iBAAiB;cACd,eAAe;CAC1B,CAAA;AAMD,eAAe,KAAK,CAAA"}
@@ -2,9 +2,10 @@ import React, { useMemo, useState } from 'react';
2
2
  import { styled, useStyleConfig, vui } from '../core';
3
3
  import { T } from '../t';
4
4
  import { cs, filterUndefined, isString } from '../utils';
5
- import { inputStateMapping } from './consts';
5
+ import { greyColor, greyLightColor, inputStateMapping } from './consts';
6
6
  import { InputProvider } from './context';
7
7
  import { getInitialCount } from './helpers';
8
+ import HelpText from './helpText';
8
9
  import InputIcon from './inputIcon';
9
10
  import InputInput from './inputInput';
10
11
  export const InputBase = styled.divBox `
@@ -32,7 +33,7 @@ export const InputBase = styled.divBox `
32
33
  */
33
34
  export const Input = vui((props, ref) => {
34
35
  const [count, setCount] = useState(getInitialCount(props));
35
- const { autoComplete, autoFocus, children, className, colorScheme, defaultValue, disabled, iconLeft, iconRight, id, input, inputProps, inputRef, isInvalid, itemLeft, itemRight, max, maxLength, min, name, onBlur, onChange: onChangeProp, onFocus, pattern, placeholder, readOnly, required, showCount, size, state = '', stateMapping, step, type = 'text', value, variant, ...rest } = props;
36
+ const { autoComplete, autoFocus, children, className, colorScheme, defaultValue, disabled, errorText, iconLeft, iconRight, id, input, inputProps, inputRef, isInvalid, itemLeft, itemRight, helpText, max, maxLength, min, name, onBlur, onChange: onChangeProp, onFocus, pattern, placeholder, readOnly, required, showCount, size, state = '', stateMapping, step, type = 'text', value, variant, ...rest } = props;
36
37
  const states = { ...inputStateMapping, ...stateMapping };
37
38
  const computedColorScheme = filterUndefined({
38
39
  colorScheme: colorScheme ?? (isInvalid ? 'red' : undefined) ?? states[state]?.colorScheme
@@ -45,7 +46,7 @@ export const Input = vui((props, ref) => {
45
46
  }
46
47
  const aliasedProps = filterUndefined({
47
48
  'aria-disabled': disabled,
48
- bg: readOnly ? 'grey.10' : undefined,
49
+ bg: readOnly ? greyLightColor : undefined,
49
50
  focusWithinBorderColor: !readOnly ? 'transparent' : undefined,
50
51
  focusWithinRingColor: readOnly ? 'transparent' : undefined
51
52
  });
@@ -77,11 +78,14 @@ export const Input = vui((props, ref) => {
77
78
  isString(iconRight) ? React.createElement(InputIcon, { mr: 1, name: iconRight }) : iconRight,
78
79
  itemRight,
79
80
  state && React.createElement(InputIcon, { mr: 1, ...states[state]?.iconProps }),
80
- showCount && (React.createElement(T, { className: "vui-inputCount", color: "grey.80", position: "absolute", right: 0, size: "sm", top: "calc(100% + 1px)" },
81
+ showCount && (React.createElement(T, { className: "vui-inputCount", color: greyColor, position: "absolute", right: 0, size: "sm", top: "calc(100% + 1px)" },
81
82
  count,
82
83
  " / ",
83
- maxLength)))));
84
+ maxLength))),
85
+ !!helpText && React.createElement(HelpText, null, helpText),
86
+ !!errorText && React.createElement(HelpText, { isError: true }, errorText)));
84
87
  });
85
88
  Input.Icon = InputIcon;
86
89
  Input.Input = InputInput;
90
+ Input.HelpText = HelpText;
87
91
  export default Input;
@@ -1,5 +1,6 @@
1
- /// <reference types="react" />
1
+ import React from 'react';
2
2
  import { IconProp, IconProps } from '../icon';
3
+ import { PProps } from '../p';
3
4
  import { SystemProps } from '../system';
4
5
  import { ThemingProps } from '../theme';
5
6
  import { ChangeEventHandler, FocusEventHandler, PropsOf } from '../utils';
@@ -15,6 +16,8 @@ export declare type InputProps = SystemProps & ThemingProps<'Input'> & {
15
16
  defaultValue?: number | string;
16
17
  /** Passed to the inner input. */
17
18
  disabled?: boolean;
19
+ /** Socket displaying error text bellow an input. */
20
+ errorText?: string | React.ReactNode;
18
21
  /** Socket displaying an icon on the left. */
19
22
  iconLeft?: IconProp | JSX.Element;
20
23
  /** Socket displaying an icon on the right. */
@@ -31,6 +34,8 @@ export declare type InputProps = SystemProps & ThemingProps<'Input'> & {
31
34
  itemLeft?: React.ReactNode;
32
35
  /** Socket displaying a custom element on the right. */
33
36
  itemRight?: React.ReactNode;
37
+ /** Socket displaying help text bellow an input. */
38
+ helpText?: React.ReactNode | string;
34
39
  /** Passed to the inner input. */
35
40
  max?: number | string;
36
41
  /** Passed to the inner input. */
@@ -66,6 +71,9 @@ export declare type InputProps = SystemProps & ThemingProps<'Input'> & {
66
71
  /** Passed to the inner input. */
67
72
  value?: number | string;
68
73
  };
74
+ export declare type HelpTextProps = PProps & {
75
+ isError?: boolean;
76
+ };
69
77
  export declare type InputState = 'default' | 'error' | 'loading' | 'success';
70
78
  export declare type InputStateMapping = Record<string, {
71
79
  colorScheme?: InputProps['colorScheme'];
@@ -1 +1 @@
1
- {"version":3,"file":"input.types.d.ts","sourceRoot":"","sources":["../../../src/input/input.types.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AACvC,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM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ACb,iCAAiC;IACjC,MAAM,CAAC,EAAE,iBAAiB,CAAA;IAC1B,iCAAiC;IACjC,QAAQ,CAAC,EAAE,kBAAkB,CAAA;IAC7B,iCAAiC;IACjC,OAAO,CAAC,EAAE,iBAAiB,CAAA;IAC3B,iCAAiC;IACjC,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,iCAAiC;IACjC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,iCAAiC;IACjC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,iCAAiC;IACjC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,8DAA8D;IAC9D,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,iEAAiE;IACjE,KAAK,CAAC,EAAE,UAAU,CAAA;IAClB,8DAA8D;IAC9D,YAAY,CAAC,EAAE,iBAAiB,CAAA;IAChC,iCAAiC;IACjC,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACtB,iCAAiC;IACjC,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB,iCAAiC;IACjC,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;CACxB,CAAA;AAEH,oBAAY,UAAU,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS,CAAA;AAEpE,oBAAY,iBAAiB,GAAG,MAAM,CACpC,MAAM,EACN;IACE,WAAW,CAAC,EAAE,UAAU,CAAC,aAAa,CAAC,CAAA;IACvC,SAAS,EAAE,SAAS,CAAA;CACrB,CACF,CAAA;AAED,oBAAY,SAAS,GACjB,MAAM,GACN,gBAAgB,GAChB,OAAO,GACP,QAAQ,GACR,OAAO,GACP,QAAQ,GACR,UAAU,GACV,QAAQ,GACR,KAAK,GACL,MAAM,GACN,MAAM,GACN,KAAK,GACL,MAAM,CAAA"}
1
+ {"version":3,"file":"input.types.d.ts","sourceRoot":"","sources":["../../../src/input/input.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAA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SAAS,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS,CAAA;AAEpE,oBAAY,iBAAiB,GAAG,MAAM,CACpC,MAAM,EACN;IACE,WAAW,CAAC,EAAE,UAAU,CAAC,aAAa,CAAC,CAAA;IACvC,SAAS,EAAE,SAAS,CAAA;CACrB,CACF,CAAA;AAED,oBAAY,SAAS,GACjB,MAAM,GACN,gBAAgB,GAChB,OAAO,GACP,QAAQ,GACR,OAAO,GACP,QAAQ,GACR,UAAU,GACV,QAAQ,GACR,KAAK,GACL,MAAM,GACN,MAAM,GACN,KAAK,GACL,MAAM,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"listText.d.ts","sourceRoot":"","sources":["../../../src/list/listText.tsx"],"names":[],"mappings":"AAGA,OAAU,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAIhC,yCAAyC;AACzC,eAAO,MAAM,QAAQ,gDAKnB,CAAA;AAEF,eAAe,QAAQ,CAAA"}
1
+ {"version":3,"file":"listText.d.ts","sourceRoot":"","sources":["../../../src/list/listText.tsx"],"names":[],"mappings":"AAGA,OAAU,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAIhC,yCAAyC;AACzC,eAAO,MAAM,QAAQ,gDAcnB,CAAA;AAEF,eAAe,QAAQ,CAAA"}
@@ -1,12 +1,12 @@
1
1
  import React from 'react';
2
2
  import { useStyleConfig, vui } from '../core';
3
3
  import T from '../t';
4
- import { cs } from '../utils';
4
+ import { cs, ellipsisOverflow } from '../utils';
5
5
  import { useListContext } from './context';
6
6
  /** Displays text within the ListItem. */
7
7
  export const ListText = vui((props, ref) => {
8
8
  const { className, ...rest } = props;
9
9
  const styles = useStyleConfig('List', useListContext());
10
- return React.createElement(T, { className: cs('vui-listText', className), fontSize: "inherit", ref: ref, ...styles.text, ...rest });
10
+ return (React.createElement(T, { className: cs('vui-listText', className), fontSize: "inherit", ref: ref, ...ellipsisOverflow, ...styles.text, ...rest }));
11
11
  });
12
12
  export default ListText;
@@ -1 +1 @@
1
- {"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../../src/select/select.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAO5C;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,WAAW,eAoDxC;yBApDe,MAAM;;;;;;;;;AA2DtB,eAAe,MAAM,CAAA"}
1
+ {"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../../src/select/select.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAO5C;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,WAAW,eAqDxC;yBArDe,MAAM;;;;;;;;;AA4DtB,eAAe,MAAM,CAAA"}
@@ -35,7 +35,8 @@ export function Select(props) {
35
35
  React.createElement(React.Fragment, null,
36
36
  selectButton ?? React.createElement(SelectButton, null),
37
37
  React.createElement(SelectContent, null,
38
- React.createElement(SelectGroup, null, children ?? options?.map?.(option => React.createElement(SelectOption, { key: option.value, ...option }))))))));
38
+ React.createElement(SelectGroup, null, children ??
39
+ options?.map?.(option => React.createElement(SelectOption, { key: option.value, title: option.text, ...option }))))))));
39
40
  }
40
41
  Select.Button = SelectButton;
41
42
  Select.Content = SelectContent;
@@ -36,6 +36,8 @@ export declare type SelectOptionData = {
36
36
  export declare type SelectOptionProps = ListItemProps & {
37
37
  /** Currently selected value. Can be a string/number or array of those when using 'isMultiple'. */
38
38
  value?: SelectValue;
39
+ /** Hover title text. */
40
+ title?: string;
39
41
  };
40
42
  export declare type SelectValue = number | string;
41
43
  //# sourceMappingURL=select.types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"select.types.d.ts","sourceRoot":"","sources":["../../../src/select/select.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEjC,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AACvC,OAAO,EA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yD;IACzD,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,iCAAiC;IACjC,YAAY,CAAC,EAAE,SAAS,CAAA;CACzB,CAAA;AAEH,oBAAY,gBAAgB,GAAG;IAC7B,uCAAuC;IACvC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,gCAAgC;IAChC,IAAI,EAAE,MAAM,CAAA;IACZ,+BAA+B;IAC/B,KAAK,EAAE,WAAW,CAAA;CACnB,CAAA;AAED,oBAAY,iBAAiB,GAAG,aAAa,GAAG;IAC9C,mGAAmG;IACnG,KAAK,CAAC,EAAE,WAAW,CAAA;IACnB,wBAAwB;IACxB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAA;AAED,oBAAY,WAAW,GAAG,MAAM,GAAG,MAAM,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"selectButton.d.ts","sourceRoot":"","sources":["../../../src/select/selectButton.tsx"],"names":[],"mappings":"AASA;;;;GAIG;AACH,eAAO,MAAM,YAAY,2EAgDvB,CAAA;AAEF,eAAe,YAAY,CAAA"}
1
+ {"version":3,"file":"selectButton.d.ts","sourceRoot":"","sources":["../../../src/select/selectButton.tsx"],"names":[],"mappings":"AASA;;;;GAIG;AACH,eAAO,MAAM,YAAY,2EAoDvB,CAAA;AAEF,eAAe,YAAY,CAAA"}
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import Button, { LineButton } from '../button';
3
3
  import { useStyleConfig, vui } from '../core';
4
4
  import { PopoverTrigger } from '../popover';
5
- import { cs } from '../utils';
5
+ import { cs, ellipsisOverflow } from '../utils';
6
6
  import { useSelectContext } from './context';
7
7
  /**
8
8
  * Displays a custom button component, which opens a popover on click.
@@ -32,6 +32,6 @@ export const SelectButton = vui((props, ref) => {
32
32
  hoverBorderColor: 'red.80'
33
33
  }
34
34
  : {};
35
- return (React.createElement(PopoverTrigger, { as: LineButton, bg: "white", className: cs('vui-selectButton', className), colorScheme: "prussian", disabled: disabled, focusRing: 2, fontWeight: "regular", iconRight: React.createElement(Button.Icon, { color: iconColor, ml: "auto", name: "falAngleDown" }), isFullWidth: true, px: 1, ref: ref, text: React.createElement(Button.Text, { color: textColor }, text), userSelect: "text", ...styles.button, ...readOnlyProps, ...isInvalidProps, ...rest }));
35
+ return (React.createElement(PopoverTrigger, { as: LineButton, bg: "white", className: cs('vui-selectButton', className), colorScheme: "prussian", disabled: disabled, focusRing: 2, fontWeight: "regular", iconRight: React.createElement(Button.Icon, { color: iconColor, ml: "auto", name: "falAngleDown" }), isFullWidth: true, px: 1, ref: ref, text: React.createElement(Button.Text, { color: textColor, ...ellipsisOverflow }, text), userSelect: "text", ...styles.button, ...readOnlyProps, ...isInvalidProps, ...rest }));
36
36
  });
37
37
  export default SelectButton;
@@ -1 +1 @@
1
- {"version":3,"file":"selectOption.d.ts","sourceRoot":"","sources":["../../../src/select/selectOption.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAElD;;;;GAIG;AACH,eAAO,MAAM,YAAY,yDA6CvB,CAAA;AAEF,eAAe,YAAY,CAAA"}
1
+ {"version":3,"file":"selectOption.d.ts","sourceRoot":"","sources":["../../../src/select/selectOption.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAElD;;;;GAIG;AACH,eAAO,MAAM,YAAY,yDA+CvB,CAAA;AAEF,eAAe,YAAY,CAAA"}
@@ -3,7 +3,7 @@ import { Checkbox } from '../checkbox';
3
3
  import { useStyleConfig, vui } from '../core';
4
4
  import { List, ListItem } from '../list';
5
5
  import { usePopoverContext } from '../popover';
6
- import { cs, useCallbackRef } from '../utils';
6
+ import { cs, ellipsisOverflow, useCallbackRef } from '../utils';
7
7
  import { useSelectContext } from './context';
8
8
  /**
9
9
  * Displays a select option as a list item. By default, closes popover when option is selected.
@@ -11,7 +11,7 @@ import { useSelectContext } from './context';
11
11
  * 'onChange' is triggered with a modified click event, which adds 'value' and 'name' properties.
12
12
  */
13
13
  export const SelectOption = vui((props, ref) => {
14
- const { children, className, disabled, onClick: onClickProp, value: valueProp, ...rest } = props;
14
+ const { children, className, disabled, title, onClick: onClickProp, value: valueProp, ...rest } = props;
15
15
  const { instance } = usePopoverContext() ?? {};
16
16
  const { isMultiple, name, onChange, value } = useSelectContext() ?? {};
17
17
  const styles = useStyleConfig('Select', useSelectContext());
@@ -29,7 +29,7 @@ export const SelectOption = vui((props, ref) => {
29
29
  onChange?.(clonedEvent);
30
30
  !isMultiple && instance?.hide();
31
31
  });
32
- return (React.createElement(ListItem, { className: cs('vui-selectOption', className), disabled: disabled, isInteractive: true, isSelected: isSelected, onClick: onClick, ref: ref, value: valueProp, ...styles.item, ...rest }, children ??
32
+ return (React.createElement(ListItem, { className: cs('vui-selectOption', className), disabled: disabled, isInteractive: true, isSelected: isSelected, onClick: onClick, ref: ref, title: title, value: valueProp, ...styles.item, ...rest, ...ellipsisOverflow }, children ??
33
33
  (isMultiple && (React.createElement(React.Fragment, null,
34
34
  React.createElement(Checkbox, { checked: isSelected, disabled: disabled, mr: 1 }),
35
35
  React.createElement(List.Text, null, props.text))))));
@@ -1,5 +1,12 @@
1
+ import { Property } from 'csstype';
1
2
  /** Concatenates individual className arguments and returns a single string. */
2
3
  export declare function cs(...classNames: any[]): string;
3
4
  /** Converts hex color value to rgb with optional alpha property. */
4
5
  export declare function hexToRGBA(hex: string, alpha?: number): string;
6
+ /** Styling to add ellipsis for long texts. */
7
+ export declare const ellipsisOverflow: {
8
+ overflow: string;
9
+ textOverflow: string;
10
+ whiteSpace: Property.WhiteSpace;
11
+ };
5
12
  //# sourceMappingURL=styles.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/utils/styles.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,wBAAgB,EAAE,CAAC,GAAG,UAAU,EAAE,GAAG,EAAE,UAEtC;AAED,oEAAoE;AACpE,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,UAuBpD"}
1
+ {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/utils/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAElC,+EAA+E;AAC/E,wBAAgB,EAAE,CAAC,GAAG,UAAU,EAAE,GAAG,EAAE,UAEtC;AAED,oEAAoE;AACpE,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,UAgBpD;AAED,8CAA8C;AAC9C,eAAO,MAAM,gBAAgB;;;;CAI5B,CAAA"}
@@ -5,22 +5,21 @@ export function cs(...classNames) {
5
5
  /** Converts hex color value to rgb with optional alpha property. */
6
6
  export function hexToRGBA(hex, alpha) {
7
7
  let hexStr = hex;
8
- if (hexStr.charAt(0) === '#') {
8
+ if (hexStr.charAt(0) === '#')
9
9
  hexStr = hexStr.slice(1);
10
- }
11
- if (hexStr.length < 4) {
10
+ if (hexStr.length < 4)
12
11
  hexStr = hexStr
13
12
  .split('')
14
13
  .map(char => char + char)
15
14
  .join('');
16
- }
17
15
  const r = parseInt(hexStr.slice(0, 2), 16);
18
16
  const g = parseInt(hexStr.slice(2, 4), 16);
19
17
  const b = parseInt(hexStr.slice(4, 6), 16);
20
- if (alpha !== undefined) {
21
- return `rgba(${r}, ${g}, ${b}, ${alpha})`;
22
- }
23
- else {
24
- return `rgb(${r}, ${g}, ${b})`;
25
- }
18
+ return alpha !== undefined ? `rgba(${r}, ${g}, ${b}, ${alpha})` : `rgb(${r}, ${g}, ${b})`;
26
19
  }
20
+ /** Styling to add ellipsis for long texts. */
21
+ export const ellipsisOverflow = {
22
+ overflow: 'hidden',
23
+ textOverflow: 'ellipsis',
24
+ whiteSpace: 'nowrap'
25
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veracity/vui",
3
- "version": "1.5.0-beta.1",
3
+ "version": "1.5.0-rc.0",
4
4
  "description": "Veracity UI is a React component library crafted for use within Veracity applications and pages. Based on Styled Components and @xstyled.",
5
5
  "module": "./dist/esm/index.js",
6
6
  "main": "./dist/cjs/index.js",
@@ -41,6 +41,10 @@ export const ButtonGroupBase = styled.divBox<{ colorScheme?: string; innerBorder
41
41
  border-color: ${p => th.color(p.innerBorderColor)};
42
42
  }
43
43
 
44
+ > *:disabled {
45
+ border-color: disabled.border;
46
+ }
47
+
44
48
  //
45
49
  > .${activeClassName} {
46
50
  background-color: ${p => th.color(`${p.colorScheme}.${activeItemShade}`)};
@@ -1,5 +1,9 @@
1
1
  import { InputStateMapping } from './input.types'
2
2
 
3
+ export const greyLightColor = 'grey.10'
4
+ export const greyColor = 'grey.80'
5
+ export const redColor = 'red.80'
6
+
3
7
  export const inputStateMapping: InputStateMapping = {
4
8
  error: {
5
9
  colorScheme: 'red',
@@ -0,0 +1,36 @@
1
+ import React from 'react'
2
+
3
+ import { useStyleConfig, vui } from '../core'
4
+ import Icon from '../icon'
5
+ import P from '../p'
6
+ import { cs } from '../utils'
7
+ import { greyColor, redColor } from './consts'
8
+ import { useInputContext } from './context'
9
+ import { HelpTextProps } from './input.types'
10
+
11
+ /** Displaying help text bellow an input.. */
12
+ export const HelpText = vui<'div', HelpTextProps>((props, ref) => {
13
+ const { className, children, isError, ...rest } = props
14
+ const inputProps = useInputContext()
15
+ const mergedProps = { ...inputProps, ...props }
16
+ const styles = useStyleConfig('Input', mergedProps)
17
+
18
+ const color = isError ? redColor : greyColor
19
+
20
+ return (
21
+ <P
22
+ className={cs('vui-inputHelpText', className)}
23
+ color={color}
24
+ display="flex"
25
+ py={1}
26
+ ref={ref}
27
+ {...styles.helpText}
28
+ {...rest}
29
+ >
30
+ {isError && <Icon mr={1} name="falExclamationTriangle" pathFill={redColor} size="sm" />}
31
+ {children}
32
+ </P>
33
+ )
34
+ })
35
+
36
+ export default HelpText
@@ -3,9 +3,10 @@ import React, { useMemo, useState } from 'react'
3
3
  import { styled, useStyleConfig, vui, VuiComponent } from '../core'
4
4
  import { T } from '../t'
5
5
  import { ChangeEvent, cs, filterUndefined, isString } from '../utils'
6
- import { inputStateMapping } from './consts'
6
+ import { greyColor, greyLightColor, inputStateMapping } from './consts'
7
7
  import { InputProvider } from './context'
8
8
  import { getInitialCount } from './helpers'
9
+ import HelpText from './helpText'
9
10
  import { InputProps } from './input.types'
10
11
  import InputIcon from './inputIcon'
11
12
  import InputInput from './inputInput'
@@ -44,6 +45,7 @@ export const Input = vui<'div', InputProps>((props, ref) => {
44
45
  colorScheme,
45
46
  defaultValue,
46
47
  disabled,
48
+ errorText,
47
49
  iconLeft,
48
50
  iconRight,
49
51
  id,
@@ -53,6 +55,7 @@ export const Input = vui<'div', InputProps>((props, ref) => {
53
55
  isInvalid,
54
56
  itemLeft,
55
57
  itemRight,
58
+ helpText,
56
59
  max,
57
60
  maxLength,
58
61
  min,
@@ -74,6 +77,7 @@ export const Input = vui<'div', InputProps>((props, ref) => {
74
77
  variant,
75
78
  ...rest
76
79
  } = props
80
+
77
81
  const states = { ...inputStateMapping, ...stateMapping }
78
82
  const computedColorScheme = filterUndefined({
79
83
  colorScheme: colorScheme ?? (isInvalid ? 'red' : undefined) ?? states[state]?.colorScheme
@@ -93,7 +97,7 @@ export const Input = vui<'div', InputProps>((props, ref) => {
93
97
 
94
98
  const aliasedProps = filterUndefined({
95
99
  'aria-disabled': disabled,
96
- bg: readOnly ? 'grey.10' : undefined,
100
+ bg: readOnly ? greyLightColor : undefined,
97
101
  focusWithinBorderColor: !readOnly ? 'transparent' : undefined,
98
102
  focusWithinRingColor: readOnly ? 'transparent' : undefined
99
103
  })
@@ -102,9 +106,7 @@ export const Input = vui<'div', InputProps>((props, ref) => {
102
106
  <InputProvider value={context}>
103
107
  <InputBase className={cs('vui-input', className)} ref={ref} {...styles.container} {...aliasedProps} {...rest}>
104
108
  {itemLeft}
105
-
106
109
  {isString(iconLeft) ? <InputIcon ml={1} name={iconLeft} /> : iconLeft}
107
-
108
110
  {children ?? input ?? (
109
111
  <InputInput
110
112
  ref={inputRef}
@@ -132,27 +134,34 @@ export const Input = vui<'div', InputProps>((props, ref) => {
132
134
  {...inputProps}
133
135
  />
134
136
  )}
135
-
136
137
  {isString(iconRight) ? <InputIcon mr={1} name={iconRight} /> : iconRight}
137
-
138
138
  {itemRight}
139
-
140
139
  {state && <InputIcon mr={1} {...states[state]?.iconProps} />}
141
-
142
140
  {showCount && (
143
- <T className="vui-inputCount" color="grey.80" position="absolute" right={0} size="sm" top="calc(100% + 1px)">
141
+ <T
142
+ className="vui-inputCount"
143
+ color={greyColor}
144
+ position="absolute"
145
+ right={0}
146
+ size="sm"
147
+ top="calc(100% + 1px)"
148
+ >
144
149
  {count} / {maxLength}
145
150
  </T>
146
151
  )}
147
152
  </InputBase>
153
+ {!!helpText && <HelpText>{helpText}</HelpText>}
154
+ {!!errorText && <HelpText isError>{errorText}</HelpText>}
148
155
  </InputProvider>
149
156
  )
150
157
  }) as VuiComponent<'div', InputProps> & {
151
158
  Icon: typeof InputIcon
152
159
  Input: typeof InputInput
160
+ HelpText: typeof HelpText
153
161
  }
154
162
 
155
163
  Input.Icon = InputIcon
156
164
  Input.Input = InputInput
165
+ Input.HelpText = HelpText
157
166
 
158
167
  export default Input
@@ -1,4 +1,7 @@
1
+ import React from 'react'
2
+
1
3
  import { IconProp, IconProps } from '../icon'
4
+ import { PProps } from '../p'
2
5
  import { SystemProps } from '../system'
3
6
  import { ThemingProps } from '../theme'
4
7
  import { ChangeEventHandler, FocusEventHandler, PropsOf } from '../utils'
@@ -17,6 +20,8 @@ export type InputProps = SystemProps &
17
20
  defaultValue?: number | string
18
21
  /** Passed to the inner input. */
19
22
  disabled?: boolean
23
+ /** Socket displaying error text bellow an input. */
24
+ errorText?: string | React.ReactNode
20
25
  /** Socket displaying an icon on the left. */
21
26
  iconLeft?: IconProp | JSX.Element
22
27
  /** Socket displaying an icon on the right. */
@@ -33,6 +38,8 @@ export type InputProps = SystemProps &
33
38
  itemLeft?: React.ReactNode
34
39
  /** Socket displaying a custom element on the right. */
35
40
  itemRight?: React.ReactNode
41
+ /** Socket displaying help text bellow an input. */
42
+ helpText?: React.ReactNode | string
36
43
  /** Passed to the inner input. */
37
44
  max?: number | string
38
45
  /** Passed to the inner input. */
@@ -69,6 +76,10 @@ export type InputProps = SystemProps &
69
76
  value?: number | string
70
77
  }
71
78
 
79
+ export type HelpTextProps = PProps & {
80
+ isError?: boolean
81
+ }
82
+
72
83
  export type InputState = 'default' | 'error' | 'loading' | 'success'
73
84
 
74
85
  export type InputStateMapping = Record<
@@ -2,7 +2,7 @@ import React from 'react'
2
2
 
3
3
  import { useStyleConfig, vui } from '../core'
4
4
  import T, { TProps } from '../t'
5
- import { cs } from '../utils'
5
+ import { cs, ellipsisOverflow } from '../utils'
6
6
  import { useListContext } from './context'
7
7
 
8
8
  /** Displays text within the ListItem. */
@@ -10,7 +10,16 @@ export const ListText = vui<'span', TProps>((props, ref) => {
10
10
  const { className, ...rest } = props
11
11
  const styles = useStyleConfig('List', useListContext())
12
12
 
13
- return <T className={cs('vui-listText', className)} fontSize="inherit" ref={ref} {...styles.text} {...rest} />
13
+ return (
14
+ <T
15
+ className={cs('vui-listText', className)}
16
+ fontSize="inherit"
17
+ ref={ref}
18
+ {...ellipsisOverflow}
19
+ {...styles.text}
20
+ {...rest}
21
+ />
22
+ )
14
23
  })
15
24
 
16
25
  export default ListText
@@ -60,7 +60,8 @@ export function Select(props: SelectProps) {
60
60
  {selectButton ?? <SelectButton />}
61
61
  <SelectContent>
62
62
  <SelectGroup>
63
- {children ?? options?.map?.(option => <SelectOption key={option.value} {...option} />)}
63
+ {children ??
64
+ options?.map?.(option => <SelectOption key={option.value} title={option.text} {...option} />)}
64
65
  </SelectGroup>
65
66
  </SelectContent>
66
67
  </>
@@ -50,6 +50,8 @@ export type SelectOptionData = {
50
50
  export type SelectOptionProps = ListItemProps & {
51
51
  /** Currently selected value. Can be a string/number or array of those when using 'isMultiple'. */
52
52
  value?: SelectValue
53
+ /** Hover title text. */
54
+ title?: string
53
55
  }
54
56
 
55
57
  export type SelectValue = number | string
@@ -3,7 +3,7 @@ import React from 'react'
3
3
  import Button, { LineButton } from '../button'
4
4
  import { useStyleConfig, vui } from '../core'
5
5
  import { PopoverTrigger } from '../popover'
6
- import { cs } from '../utils'
6
+ import { cs, ellipsisOverflow } from '../utils'
7
7
  import { useSelectContext } from './context'
8
8
  import { SelectButtonProps } from './select.types'
9
9
 
@@ -52,7 +52,11 @@ export const SelectButton = vui<'button', SelectButtonProps>((props, ref) => {
52
52
  isFullWidth
53
53
  px={1}
54
54
  ref={ref}
55
- text={<Button.Text color={textColor}>{text}</Button.Text>}
55
+ text={
56
+ <Button.Text color={textColor} {...ellipsisOverflow}>
57
+ {text}
58
+ </Button.Text>
59
+ }
56
60
  userSelect="text"
57
61
  {...styles.button}
58
62
  {...readOnlyProps}
@@ -4,7 +4,7 @@ import { Checkbox } from '../checkbox'
4
4
  import { useStyleConfig, vui } from '../core'
5
5
  import { List, ListItem } from '../list'
6
6
  import { usePopoverContext } from '../popover'
7
- import { cs, MouseEvent, useCallbackRef } from '../utils'
7
+ import { cs, ellipsisOverflow, MouseEvent, useCallbackRef } from '../utils'
8
8
  import { useSelectContext } from './context'
9
9
  import { SelectOptionProps } from './select.types'
10
10
 
@@ -14,7 +14,7 @@ import { SelectOptionProps } from './select.types'
14
14
  * 'onChange' is triggered with a modified click event, which adds 'value' and 'name' properties.
15
15
  */
16
16
  export const SelectOption = vui<'li', SelectOptionProps>((props, ref) => {
17
- const { children, className, disabled, onClick: onClickProp, value: valueProp, ...rest } = props
17
+ const { children, className, disabled, title, onClick: onClickProp, value: valueProp, ...rest } = props
18
18
  const { instance } = usePopoverContext() ?? {}
19
19
  const { isMultiple, name, onChange, value } = useSelectContext() ?? {}
20
20
  const styles = useStyleConfig('Select', useSelectContext())
@@ -45,9 +45,11 @@ export const SelectOption = vui<'li', SelectOptionProps>((props, ref) => {
45
45
  isSelected={isSelected}
46
46
  onClick={onClick}
47
47
  ref={ref}
48
+ title={title}
48
49
  value={valueProp}
49
50
  {...styles.item}
50
51
  {...rest}
52
+ {...ellipsisOverflow}
51
53
  >
52
54
  {children ??
53
55
  (isMultiple && (
@@ -1,3 +1,5 @@
1
+ import { Property } from 'csstype'
2
+
1
3
  /** Concatenates individual className arguments and returns a single string. */
2
4
  export function cs(...classNames: any[]) {
3
5
  return classNames.filter(Boolean).join(' ')
@@ -7,24 +9,24 @@ export function cs(...classNames: any[]) {
7
9
  export function hexToRGBA(hex: string, alpha?: number) {
8
10
  let hexStr = hex
9
11
 
10
- if (hexStr.charAt(0) === '#') {
11
- hexStr = hexStr.slice(1)
12
- }
12
+ if (hexStr.charAt(0) === '#') hexStr = hexStr.slice(1)
13
13
 
14
- if (hexStr.length < 4) {
14
+ if (hexStr.length < 4)
15
15
  hexStr = hexStr
16
16
  .split('')
17
17
  .map(char => char + char)
18
18
  .join('')
19
- }
20
19
 
21
20
  const r = parseInt(hexStr.slice(0, 2), 16)
22
21
  const g = parseInt(hexStr.slice(2, 4), 16)
23
22
  const b = parseInt(hexStr.slice(4, 6), 16)
24
23
 
25
- if (alpha !== undefined) {
26
- return `rgba(${r}, ${g}, ${b}, ${alpha})`
27
- } else {
28
- return `rgb(${r}, ${g}, ${b})`
29
- }
24
+ return alpha !== undefined ? `rgba(${r}, ${g}, ${b}, ${alpha})` : `rgb(${r}, ${g}, ${b})`
25
+ }
26
+
27
+ /** Styling to add ellipsis for long texts. */
28
+ export const ellipsisOverflow = {
29
+ overflow: 'hidden',
30
+ textOverflow: 'ellipsis',
31
+ whiteSpace: 'nowrap' as Property.WhiteSpace
30
32
  }