@veracity/vui 0.0.15 → 0.1.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.
- package/alert/alert.js +10 -10
- package/alert/alert.types.d.ts +3 -3
- package/alert/alertText.d.ts +2 -2
- package/alert/alertText.js +2 -2
- package/alert/alertTitle.d.ts +2 -2
- package/alert/alertTitle.js +2 -2
- package/alert/theme.d.ts +2 -0
- package/alert/theme.js +5 -3
- package/avatar/avatar.js +2 -2
- package/box/box.js +1 -1
- package/button/button.d.ts +7 -1
- package/button/button.js +56 -23
- package/button/button.types.d.ts +8 -6
- package/button/buttonIcon.d.ts +3 -0
- package/button/buttonIcon.js +30 -0
- package/button/buttonText.d.ts +3 -0
- package/button/buttonText.js +30 -0
- package/button/buttons.d.ts +4 -3
- package/button/buttons.js +4 -3
- package/button/consts.js +3 -2
- package/button/context.d.ts +2 -2
- package/button/context.js +4 -4
- package/button/index.d.ts +2 -2
- package/button/index.js +2 -2
- package/button/theme.d.ts +79 -41
- package/button/theme.js +85 -46
- package/{button → buttonGroup}/buttonGroup.d.ts +3 -1
- package/{button → buttonGroup}/buttonGroup.js +4 -2
- package/buttonGroup/context.d.ts +4 -0
- package/buttonGroup/context.js +23 -0
- package/buttonGroup/helpers.d.ts +3 -0
- package/buttonGroup/helpers.js +10 -0
- package/buttonGroup/index.d.ts +4 -0
- package/buttonGroup/index.js +21 -0
- package/card/card.d.ts +3 -0
- package/{tile/tile.js → card/card.js} +8 -7
- package/{tile/tile.types.d.ts → card/card.types.d.ts} +1 -1
- package/card/index.d.ts +3 -0
- package/{tile → card}/index.js +4 -4
- package/card/theme.d.ts +6 -0
- package/card/theme.js +10 -0
- package/checkbox/checkbox.js +2 -2
- package/checkbox/checkbox.types.d.ts +1 -1
- package/checkbox/checkboxGroup.types.d.ts +1 -1
- package/core/globalStyle.d.ts +4 -1
- package/core/globalStyle.js +7 -3
- package/core/index.d.ts +2 -0
- package/core/index.js +5 -1
- package/core/styled.d.ts +4 -0
- package/core/styled.js +80 -0
- package/core/types/component.d.ts +12 -12
- package/core/types/index.d.ts +1 -0
- package/core/types/index.js +1 -0
- package/core/types/styled.d.ts +11 -0
- package/core/utils.d.ts +2 -2
- package/core/utils.js +6 -6
- package/core/v.d.ts +182 -0
- package/core/v.js +6 -0
- package/core/vuiProvider.d.ts +13 -2
- package/core/vuiProvider.js +1 -1
- package/divider/divider.types.d.ts +0 -1
- package/heading/heading.types.d.ts +2 -1
- package/icon/helpers.d.ts +2 -3
- package/icon/helpers.js +6 -8
- package/icon/icon.js +3 -2
- package/icon/icon.types.d.ts +4 -2
- package/icons/library.js +1 -1
- package/icons/types.d.ts +1 -1
- package/image/image.d.ts +3 -0
- package/image/image.js +38 -0
- package/image/image.types.d.ts +4 -0
- package/image/index.d.ts +3 -0
- package/{label → image}/index.js +4 -4
- package/image/theme.d.ts +6 -0
- package/image/theme.js +10 -0
- package/index.d.ts +5 -2
- package/index.js +5 -2
- package/input/context.d.ts +4 -0
- package/input/context.js +23 -0
- package/input/index.d.ts +2 -0
- package/input/index.js +2 -0
- package/input/input.d.ts +7 -2
- package/input/input.js +32 -22
- package/input/input.types.d.ts +7 -3
- package/input/inputIcon.d.ts +3 -0
- package/input/inputIcon.js +30 -0
- package/input/inputInput.d.ts +5 -0
- package/input/inputInput.js +36 -0
- package/input/theme.d.ts +40 -15
- package/input/theme.js +40 -16
- package/list/index.d.ts +3 -1
- package/list/index.js +3 -1
- package/list/list.d.ts +2 -0
- package/list/list.js +3 -1
- package/list/list.types.d.ts +19 -1
- package/list/listHeading.d.ts +2 -2
- package/list/listHeading.js +2 -2
- package/list/listIcon.js +1 -1
- package/list/listItem.d.ts +1 -1
- package/list/listItem.js +8 -5
- package/list/listText.d.ts +3 -0
- package/list/listText.js +30 -0
- package/list/theme.d.ts +20 -6
- package/list/theme.js +26 -12
- package/package.json +1 -1
- package/panel/index.d.ts +3 -0
- package/panel/index.js +20 -0
- package/panel/panel.d.ts +3 -0
- package/panel/panel.js +39 -0
- package/panel/panel.types.d.ts +4 -0
- package/{tile → panel}/theme.d.ts +1 -8
- package/{tile → panel}/theme.js +4 -11
- package/radio/radio.js +2 -2
- package/radio/radio.types.d.ts +1 -1
- package/radio/radioGroup.types.d.ts +1 -1
- package/switch/index.d.ts +0 -1
- package/switch/index.js +0 -1
- package/switch/switch.js +6 -6
- package/switch/switch.types.d.ts +19 -4
- package/switch/switchButton.d.ts +2 -2
- package/switch/switchButton.js +15 -16
- package/switch/theme.d.ts +41 -46
- package/switch/theme.js +50 -72
- package/system/borders.d.ts +3 -1
- package/system/custom.d.ts +24 -7
- package/system/custom.js +33 -13
- package/system/system.d.ts +2 -2
- package/system/system.js +1 -1
- package/t/t.types.d.ts +2 -1
- package/tag/context.d.ts +4 -0
- package/tag/context.js +23 -0
- package/tag/index.d.ts +6 -0
- package/tag/index.js +23 -0
- package/tag/tag.d.ts +11 -0
- package/tag/tag.js +99 -0
- package/{label/label.types.d.ts → tag/tag.types.d.ts} +6 -7
- package/tag/tag.types.js +2 -0
- package/tag/tagIcon.d.ts +3 -0
- package/tag/tagIcon.js +30 -0
- package/tag/tagText.d.ts +3 -0
- package/tag/tagText.js +30 -0
- package/tag/theme.d.ts +65 -0
- package/tag/theme.js +78 -0
- package/theme/components.d.ts +265 -181
- package/theme/components.js +36 -32
- package/theme/defaultTheme.d.ts +265 -181
- package/utils/assertion.d.ts +14 -0
- package/utils/assertion.js +34 -0
- package/utils/index.d.ts +1 -0
- package/utils/index.js +1 -0
- package/utils/object.d.ts +4 -6
- package/utils/object.js +18 -26
- package/utils/types.d.ts +2 -0
- package/label/index.d.ts +0 -3
- package/label/label.d.ts +0 -5
- package/label/label.js +0 -71
- package/label/theme.d.ts +0 -61
- package/label/theme.js +0 -107
- package/list/listItem.types.d.ts +0 -16
- package/switch/switchButton.types.d.ts +0 -19
- package/tile/index.d.ts +0 -3
- package/tile/tile.d.ts +0 -3
- /package/{button → buttonGroup}/buttonGroup.types.d.ts +0 -0
- /package/{button → buttonGroup}/buttonGroup.types.js +0 -0
- /package/{label/label.types.js → card/card.types.js} +0 -0
- /package/{list/listItem.types.js → core/types/styled.js} +0 -0
- /package/{switch/switchButton.types.js → image/image.types.js} +0 -0
- /package/{tile/tile.types.js → panel/panel.types.js} +0 -0
package/icon/icon.js
CHANGED
|
@@ -32,9 +32,10 @@ var core_1 = require("../core");
|
|
|
32
32
|
var svg_1 = require("../svg");
|
|
33
33
|
var utils_1 = require("../utils");
|
|
34
34
|
exports.Icon = core_1.vui(function (props, ref) {
|
|
35
|
-
|
|
35
|
+
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */
|
|
36
|
+
var _a = core_1.omitThemingProps(props), className = _a.className, icon = _a.icon, _b = _a.name, name = _b === void 0 ? props.icon : _b, rotate = _a.rotate, scale = _a.scale, rest = __rest(_a, ["className", "icon", "name", "rotate", "scale"]);
|
|
36
37
|
var styles = core_1.useStyleConfig('Icon', props);
|
|
37
|
-
var
|
|
38
|
+
var _c = helpers_1.getIconDetails(name), customIcon = _c.customIcon, src = _c.src;
|
|
38
39
|
var scaledSize = scale ? 16 * scale : undefined;
|
|
39
40
|
var aliasedProps = utils_1.filterUndefined({
|
|
40
41
|
h: scaledSize,
|
package/icon/icon.types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { PropsOf } from '../core';
|
|
3
|
-
import {
|
|
3
|
+
import { VuiIcon } from '../icons';
|
|
4
4
|
import Svg, { SvgProps } from '../svg';
|
|
5
5
|
import { ThemingProps } from '../theme';
|
|
6
6
|
import { AnyString } from '../utils';
|
|
@@ -12,9 +12,11 @@ export interface GetIconDetailsResult {
|
|
|
12
12
|
};
|
|
13
13
|
src?: string;
|
|
14
14
|
}
|
|
15
|
-
export declare type IconProp = VuiIcon |
|
|
15
|
+
export declare type IconProp = VuiIcon | AnyString;
|
|
16
16
|
export interface IconProps extends SvgProps, ThemingProps<'Icon'> {
|
|
17
|
+
/** @deprecated use 'name' instead */
|
|
17
18
|
icon?: IconProp;
|
|
19
|
+
name?: IconProp;
|
|
18
20
|
rotate?: number;
|
|
19
21
|
scale?: number;
|
|
20
22
|
}
|
package/icons/library.js
CHANGED
package/icons/types.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { PropsOf } from '../core';
|
|
|
4
4
|
import Svg from '../svg';
|
|
5
5
|
export interface IconDefinition {
|
|
6
6
|
details: IconDetails;
|
|
7
|
-
name
|
|
7
|
+
name: string;
|
|
8
8
|
pathProps?: React.SVGProps<SVGPathElement> | React.SVGProps<SVGPathElement>[];
|
|
9
9
|
svgProps?: PropsOf<typeof Svg>;
|
|
10
10
|
}
|
package/image/image.d.ts
ADDED
package/image/image.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
+
var t = {};
|
|
15
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
+
t[p] = s[p];
|
|
17
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
+
t[p[i]] = s[p[i]];
|
|
21
|
+
}
|
|
22
|
+
return t;
|
|
23
|
+
};
|
|
24
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
25
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
26
|
+
};
|
|
27
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
+
exports.Image = void 0;
|
|
29
|
+
var react_1 = __importDefault(require("react"));
|
|
30
|
+
var core_1 = require("../core");
|
|
31
|
+
var utils_1 = require("../utils");
|
|
32
|
+
exports.Image = core_1.vui(function (props, ref) {
|
|
33
|
+
var _a = core_1.omitThemingProps(props), className = _a.className, rest = __rest(_a, ["className"]);
|
|
34
|
+
var styles = core_1.useStyleConfig('Image', props);
|
|
35
|
+
return react_1.default.createElement(core_1.v.img, __assign({ className: utils_1.cs('vui-image', className), ref: ref }, styles, rest));
|
|
36
|
+
});
|
|
37
|
+
exports.Image.displayName = 'Image';
|
|
38
|
+
exports.default = exports.Image;
|
package/image/index.d.ts
ADDED
package/{label → image}/index.js
RENAMED
|
@@ -14,7 +14,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
};
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
16
|
exports.default = void 0;
|
|
17
|
-
__exportStar(require("./
|
|
18
|
-
__exportStar(require("./
|
|
19
|
-
var
|
|
20
|
-
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(
|
|
17
|
+
__exportStar(require("./image"), exports);
|
|
18
|
+
__exportStar(require("./image.types"), exports);
|
|
19
|
+
var image_1 = require("./image");
|
|
20
|
+
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(image_1).default; } });
|
package/image/theme.d.ts
ADDED
package/image/theme.js
ADDED
package/index.d.ts
CHANGED
|
@@ -2,17 +2,20 @@ export * from './alert';
|
|
|
2
2
|
export * from './avatar';
|
|
3
3
|
export * from './box';
|
|
4
4
|
export * from './button';
|
|
5
|
+
export * from './buttonGroup';
|
|
6
|
+
export * from './card';
|
|
5
7
|
export * from './checkbox';
|
|
6
8
|
export * from './core';
|
|
7
9
|
export * from './divider';
|
|
8
10
|
export * from './heading';
|
|
9
11
|
export * from './icon';
|
|
10
12
|
export * from './icons';
|
|
13
|
+
export * from './image';
|
|
11
14
|
export * from './input';
|
|
12
|
-
export * from './label';
|
|
13
15
|
export * from './link';
|
|
14
16
|
export * from './list';
|
|
15
17
|
export * from './p';
|
|
18
|
+
export * from './panel';
|
|
16
19
|
export * from './radio';
|
|
17
20
|
export * from './skeleton';
|
|
18
21
|
export * from './spinner';
|
|
@@ -21,7 +24,7 @@ export * from './svg';
|
|
|
21
24
|
export * from './switch';
|
|
22
25
|
export * from './system';
|
|
23
26
|
export * from './t';
|
|
27
|
+
export * from './tag';
|
|
24
28
|
export * from './textarea';
|
|
25
29
|
export * from './theme';
|
|
26
|
-
export * from './tile';
|
|
27
30
|
export * from './utils';
|
package/index.js
CHANGED
|
@@ -14,17 +14,20 @@ __exportStar(require("./alert"), exports);
|
|
|
14
14
|
__exportStar(require("./avatar"), exports);
|
|
15
15
|
__exportStar(require("./box"), exports);
|
|
16
16
|
__exportStar(require("./button"), exports);
|
|
17
|
+
__exportStar(require("./buttonGroup"), exports);
|
|
18
|
+
__exportStar(require("./card"), exports);
|
|
17
19
|
__exportStar(require("./checkbox"), exports);
|
|
18
20
|
__exportStar(require("./core"), exports);
|
|
19
21
|
__exportStar(require("./divider"), exports);
|
|
20
22
|
__exportStar(require("./heading"), exports);
|
|
21
23
|
__exportStar(require("./icon"), exports);
|
|
22
24
|
__exportStar(require("./icons"), exports);
|
|
25
|
+
__exportStar(require("./image"), exports);
|
|
23
26
|
__exportStar(require("./input"), exports);
|
|
24
|
-
__exportStar(require("./label"), exports);
|
|
25
27
|
__exportStar(require("./link"), exports);
|
|
26
28
|
__exportStar(require("./list"), exports);
|
|
27
29
|
__exportStar(require("./p"), exports);
|
|
30
|
+
__exportStar(require("./panel"), exports);
|
|
28
31
|
__exportStar(require("./radio"), exports);
|
|
29
32
|
__exportStar(require("./skeleton"), exports);
|
|
30
33
|
__exportStar(require("./spinner"), exports);
|
|
@@ -33,7 +36,7 @@ __exportStar(require("./svg"), exports);
|
|
|
33
36
|
__exportStar(require("./switch"), exports);
|
|
34
37
|
__exportStar(require("./system"), exports);
|
|
35
38
|
__exportStar(require("./t"), exports);
|
|
39
|
+
__exportStar(require("./tag"), exports);
|
|
36
40
|
__exportStar(require("./textarea"), exports);
|
|
37
41
|
__exportStar(require("./theme"), exports);
|
|
38
|
-
__exportStar(require("./tile"), exports);
|
|
39
42
|
__exportStar(require("./utils"), exports);
|
package/input/context.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
3
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
4
|
+
if (!m) return o;
|
|
5
|
+
var i = m.call(o), r, ar = [], e;
|
|
6
|
+
try {
|
|
7
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
8
|
+
}
|
|
9
|
+
catch (error) { e = { error: error }; }
|
|
10
|
+
finally {
|
|
11
|
+
try {
|
|
12
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
13
|
+
}
|
|
14
|
+
finally { if (e) throw e.error; }
|
|
15
|
+
}
|
|
16
|
+
return ar;
|
|
17
|
+
};
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.useInput = exports.InputProvider = void 0;
|
|
20
|
+
var core_1 = require("../core");
|
|
21
|
+
var _a = __read(core_1.createContext({ isOptional: true }), 2), InputProvider = _a[0], useInput = _a[1];
|
|
22
|
+
exports.InputProvider = InputProvider;
|
|
23
|
+
exports.useInput = useInput;
|
package/input/index.d.ts
CHANGED
package/input/index.js
CHANGED
|
@@ -16,5 +16,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
16
16
|
exports.default = void 0;
|
|
17
17
|
__exportStar(require("./input"), exports);
|
|
18
18
|
__exportStar(require("./input.types"), exports);
|
|
19
|
+
__exportStar(require("./inputIcon"), exports);
|
|
20
|
+
__exportStar(require("./inputInput"), exports);
|
|
19
21
|
var input_1 = require("./input");
|
|
20
22
|
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(input_1).default; } });
|
package/input/input.d.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { InputProps } from './input.types';
|
|
2
|
+
import InputIcon from './inputIcon';
|
|
3
|
+
import InputInput from './inputInput';
|
|
4
|
+
import { VuiComponent } from '../core';
|
|
2
5
|
import { SystemProps } from '../system';
|
|
3
|
-
export declare const InputInput: import("styled-components").StyledComponent<"input", import("styled-components").DefaultTheme, SystemProps, never>;
|
|
4
6
|
export declare const InputBase: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, SystemProps, never>;
|
|
5
|
-
export declare const Input:
|
|
7
|
+
export declare const Input: VuiComponent<"div", InputProps> & {
|
|
8
|
+
Icon: typeof InputIcon;
|
|
9
|
+
Input: typeof InputInput;
|
|
10
|
+
};
|
|
6
11
|
export default Input;
|
package/input/input.js
CHANGED
|
@@ -64,45 +64,51 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
64
64
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
65
65
|
};
|
|
66
66
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
67
|
-
exports.Input = exports.InputBase =
|
|
67
|
+
exports.Input = exports.InputBase = void 0;
|
|
68
68
|
var react_1 = __importStar(require("react"));
|
|
69
69
|
var styled_components_1 = __importDefault(require("styled-components"));
|
|
70
70
|
var consts_1 = require("./consts");
|
|
71
|
+
var context_1 = require("./context");
|
|
71
72
|
var helpers_1 = require("./helpers");
|
|
73
|
+
var inputIcon_1 = __importDefault(require("./inputIcon"));
|
|
74
|
+
var inputInput_1 = __importDefault(require("./inputInput"));
|
|
72
75
|
var core_1 = require("../core");
|
|
73
|
-
var icon_1 = __importDefault(require("../icon"));
|
|
74
76
|
var system_1 = require("../system");
|
|
75
77
|
var t_1 = __importDefault(require("../t"));
|
|
76
78
|
var utils_1 = require("../utils");
|
|
77
|
-
exports.
|
|
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\tbackground-color: white;\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\tbackground-color: white;\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);
|
|
79
|
+
exports.InputBase = styled_components_1.default.div.withConfig(core_1.forwardPropConfig(system_1.system))(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n\talign-items: center;\n\tbackground-color: white;\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\tbackground-color: white;\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);
|
|
79
80
|
exports.Input = core_1.vui(function (props, ref) {
|
|
80
|
-
var _a, _b;
|
|
81
|
-
var
|
|
82
|
-
var
|
|
81
|
+
var _a, _b, _c, _d;
|
|
82
|
+
var _e = __read(react_1.useState(helpers_1.getInitialCount(props)), 2), count = _e[0], setCount = _e[1];
|
|
83
|
+
var autoComplete = props.autoComplete, autoFocus = props.autoFocus, children = props.children, className = props.className, colorScheme = props.colorScheme, defaultValue = props.defaultValue, disabled = props.disabled, iconLeft = props.iconLeft, iconRight = props.iconRight, input = props.input, inputProps = props.inputProps, inputRef = props.inputRef, isInvalid = props.isInvalid, itemLeft = props.itemLeft, itemRight = props.itemRight, max = props.max, maxLength = props.maxLength, min = props.min, name = props.name, onBlur = props.onBlur, onChangeProp = props.onChange, onFocus = props.onFocus, pattern = props.pattern, placeholder = props.placeholder, readOnly = props.readOnly, required = props.required, showCount = props.showCount, size = props.size, _f = props.state, state = _f === void 0 ? '' : _f, stateMapping = props.stateMapping, step = props.step, _g = props.type, type = _g === void 0 ? 'text' : _g, value = props.value, variant = props.variant, rest = __rest(props, ["autoComplete", "autoFocus", "children", "className", "colorScheme", "defaultValue", "disabled", "iconLeft", "iconRight", "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"]);
|
|
83
84
|
var states = __assign(__assign({}, consts_1.inputStateMapping), stateMapping);
|
|
84
|
-
var
|
|
85
|
-
|
|
86
|
-
colorScheme: (_b = colorSchemeProp !== null && colorSchemeProp !== void 0 ? colorSchemeProp : (isInvalid ? 'red' : undefined)) !== null && _b !== void 0 ? _b : stateColorScheme
|
|
85
|
+
var computedColorScheme = utils_1.filterUndefined({
|
|
86
|
+
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
|
|
87
87
|
});
|
|
88
|
-
var
|
|
88
|
+
var styles = core_1.useStyleConfig('Input', __assign(__assign({}, computedColorScheme), props));
|
|
89
|
+
var context = react_1.useMemo(function () { return utils_1.filterUndefined({ colorScheme: colorScheme, disabled: disabled, size: size, variant: variant }); }, [
|
|
90
|
+
colorScheme,
|
|
91
|
+
disabled,
|
|
92
|
+
size,
|
|
93
|
+
variant
|
|
94
|
+
]);
|
|
89
95
|
function onChange(e) {
|
|
90
96
|
setCount(e.target.value.length);
|
|
91
97
|
onChangeProp === null || onChangeProp === void 0 ? void 0 : onChangeProp(e);
|
|
92
98
|
}
|
|
93
|
-
var iconColor = !disabled ? 'blue.80' : 'grey.50';
|
|
94
99
|
var aliasedProps = utils_1.filterUndefined({
|
|
95
100
|
bg: readOnly ? 'grey.20' : undefined,
|
|
96
101
|
focusWithinBorderColor: !readOnly ? 'transparent' : undefined,
|
|
97
102
|
focusWithinRingColor: readOnly ? 'transparent' : undefined
|
|
98
103
|
});
|
|
99
|
-
return (react_1.default.createElement(
|
|
100
|
-
react_1.default.createElement(exports.
|
|
104
|
+
return (react_1.default.createElement(context_1.InputProvider, { value: context },
|
|
105
|
+
react_1.default.createElement(exports.InputBase, __assign({ borderRadius: "md", className: utils_1.cs('vui-input', disabled && 'disabled', className), ref: ref, transitionDuration: "fast" }, styles.container, aliasedProps, rest),
|
|
106
|
+
itemLeft,
|
|
107
|
+
utils_1.isString(iconLeft) ? react_1.default.createElement(inputIcon_1.default, { ml: 1, name: iconLeft }) : iconLeft, (_c = children !== null && children !== void 0 ? children : input) !== null && _c !== void 0 ? _c : (react_1.default.createElement(inputInput_1.default, __assign({ ref: inputRef }, {
|
|
101
108
|
autoComplete: autoComplete,
|
|
102
109
|
autoFocus: autoFocus,
|
|
103
110
|
defaultValue: defaultValue,
|
|
104
111
|
disabled: disabled,
|
|
105
|
-
fontSize: fontSize,
|
|
106
112
|
max: max,
|
|
107
113
|
maxLength: maxLength,
|
|
108
114
|
min: min,
|
|
@@ -117,13 +123,17 @@ exports.Input = core_1.vui(function (props, ref) {
|
|
|
117
123
|
step: step,
|
|
118
124
|
type: type,
|
|
119
125
|
value: value
|
|
120
|
-
}, inputProps))
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
"
|
|
125
|
-
|
|
126
|
+
}, inputProps))),
|
|
127
|
+
utils_1.isString(iconRight) ? react_1.default.createElement(inputIcon_1.default, { mr: 1, name: iconRight }) : iconRight,
|
|
128
|
+
itemRight,
|
|
129
|
+
state && react_1.default.createElement(inputIcon_1.default, __assign({ mr: 1 }, (_d = states[state]) === null || _d === void 0 ? void 0 : _d.iconProps)),
|
|
130
|
+
showCount && (react_1.default.createElement(t_1.default, { color: "grey.80", position: "absolute", right: 0, size: "sm", top: "calc(100% + 1px)" },
|
|
131
|
+
count,
|
|
132
|
+
" / ",
|
|
133
|
+
maxLength)))));
|
|
126
134
|
});
|
|
127
135
|
exports.Input.displayName = 'Input';
|
|
136
|
+
exports.Input.Icon = inputIcon_1.default;
|
|
137
|
+
exports.Input.Input = inputInput_1.default;
|
|
128
138
|
exports.default = exports.Input;
|
|
129
|
-
var templateObject_1
|
|
139
|
+
var templateObject_1;
|
package/input/input.types.d.ts
CHANGED
|
@@ -3,15 +3,19 @@ import { ChangeEventHandler, FocusEventHandler, PropsOf } from '../core';
|
|
|
3
3
|
import { IconProp, IconProps } from '../icon';
|
|
4
4
|
import { SystemProps } from '../system';
|
|
5
5
|
import { ThemingProps } from '../theme';
|
|
6
|
+
import { AnyElement } from '../utils';
|
|
7
|
+
export interface InputInputProps extends PropsOf<'input', SystemProps> {
|
|
8
|
+
}
|
|
6
9
|
export interface InputProps extends SystemProps, ThemingProps<'Input'> {
|
|
7
10
|
autoComplete?: string;
|
|
8
11
|
autoFocus?: boolean;
|
|
9
12
|
colorScheme?: 'green' | 'grey' | 'red';
|
|
10
13
|
defaultValue?: number | string;
|
|
11
14
|
disabled?: boolean;
|
|
12
|
-
iconLeft?: IconProp;
|
|
13
|
-
iconRight?: IconProp;
|
|
14
|
-
|
|
15
|
+
iconLeft?: IconProp | AnyElement;
|
|
16
|
+
iconRight?: IconProp | AnyElement;
|
|
17
|
+
input?: React.ReactNode;
|
|
18
|
+
inputProps?: InputInputProps;
|
|
15
19
|
inputRef?: React.MutableRefObject<HTMLInputElement | null> | null;
|
|
16
20
|
isInvalid?: boolean;
|
|
17
21
|
itemLeft?: React.ReactNode;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.InputIcon = void 0;
|
|
18
|
+
var react_1 = __importDefault(require("react"));
|
|
19
|
+
var context_1 = require("./context");
|
|
20
|
+
var core_1 = require("../core");
|
|
21
|
+
var icon_1 = __importDefault(require("../icon"));
|
|
22
|
+
exports.InputIcon = core_1.vui(function (props, ref) {
|
|
23
|
+
var inputProps = context_1.useInput();
|
|
24
|
+
var mergedProps = __assign(__assign({}, inputProps), props);
|
|
25
|
+
var styles = core_1.useStyleConfig('Input', mergedProps);
|
|
26
|
+
var color = !mergedProps.disabled ? 'blue.80' : 'grey.50';
|
|
27
|
+
return react_1.default.createElement(icon_1.default, __assign({ className: "vui-inputIcon", color: color, ref: ref }, styles.icon, props));
|
|
28
|
+
});
|
|
29
|
+
exports.InputIcon.displayName = 'InputIcon';
|
|
30
|
+
exports.default = exports.InputIcon;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { InputInputProps } from './input.types';
|
|
2
|
+
import { SystemProps } from '../system';
|
|
3
|
+
export declare const InputInputBase: import("styled-components").StyledComponent<"input", import("styled-components").DefaultTheme, SystemProps, never>;
|
|
4
|
+
export declare const InputInput: import("../core").VuiComponent<"input", InputInputProps>;
|
|
5
|
+
export default InputInput;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
3
|
+
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
4
|
+
return cooked;
|
|
5
|
+
};
|
|
6
|
+
var __assign = (this && this.__assign) || function () {
|
|
7
|
+
__assign = Object.assign || function(t) {
|
|
8
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
9
|
+
s = arguments[i];
|
|
10
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
11
|
+
t[p] = s[p];
|
|
12
|
+
}
|
|
13
|
+
return t;
|
|
14
|
+
};
|
|
15
|
+
return __assign.apply(this, arguments);
|
|
16
|
+
};
|
|
17
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
18
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
19
|
+
};
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.InputInput = exports.InputInputBase = void 0;
|
|
22
|
+
var react_1 = __importDefault(require("react"));
|
|
23
|
+
var styled_components_1 = __importDefault(require("styled-components"));
|
|
24
|
+
var context_1 = require("./context");
|
|
25
|
+
var core_1 = require("../core");
|
|
26
|
+
var system_1 = require("../system");
|
|
27
|
+
exports.InputInputBase = 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\tfont-size: inherit;\n\tmin-width: 0;\n\toutline: none;\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\tfont-size: inherit;\n\tmin-width: 0;\n\toutline: none;\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);
|
|
28
|
+
exports.InputInput = core_1.vui(function (props, ref) {
|
|
29
|
+
var inputProps = context_1.useInput();
|
|
30
|
+
var mergedProps = __assign(__assign({}, inputProps), props);
|
|
31
|
+
var styles = core_1.useStyleConfig('Input', mergedProps);
|
|
32
|
+
return (react_1.default.createElement(exports.InputInputBase, __assign({ borderRadius: "md", className: "vui-inputInput", placeholderColor: "grey.60", px: 1, ref: ref }, styles.input, props)));
|
|
33
|
+
});
|
|
34
|
+
exports.InputInput.displayName = 'InputInput';
|
|
35
|
+
exports.default = exports.InputInput;
|
|
36
|
+
var templateObject_1;
|
package/input/theme.d.ts
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { Dict } from '../utils';
|
|
2
2
|
declare function variantDefault(props: Dict): {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
container: {
|
|
4
|
+
borderColor: string;
|
|
5
|
+
focusWithinRing: number;
|
|
6
|
+
focusWithinRingColor: string;
|
|
7
|
+
};
|
|
8
|
+
icon: {};
|
|
9
|
+
input: {};
|
|
6
10
|
};
|
|
7
11
|
declare const _default: {
|
|
8
12
|
defaultProps: {
|
|
@@ -10,26 +14,47 @@ declare const _default: {
|
|
|
10
14
|
size: string;
|
|
11
15
|
variant: string;
|
|
12
16
|
};
|
|
17
|
+
parts: string[];
|
|
13
18
|
sizes: {
|
|
14
19
|
xs: {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
20
|
+
container: {
|
|
21
|
+
fontSize: string;
|
|
22
|
+
h: number;
|
|
23
|
+
};
|
|
24
|
+
icon: {
|
|
25
|
+
size: string;
|
|
26
|
+
};
|
|
27
|
+
input: {};
|
|
18
28
|
};
|
|
19
29
|
sm: {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
30
|
+
container: {
|
|
31
|
+
fontSize: string;
|
|
32
|
+
h: number;
|
|
33
|
+
};
|
|
34
|
+
icon: {
|
|
35
|
+
size: string;
|
|
36
|
+
};
|
|
37
|
+
input: {};
|
|
23
38
|
};
|
|
24
39
|
md: {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
40
|
+
container: {
|
|
41
|
+
fontSize: string;
|
|
42
|
+
h: number;
|
|
43
|
+
};
|
|
44
|
+
icon: {
|
|
45
|
+
size: string;
|
|
46
|
+
};
|
|
47
|
+
input: {};
|
|
28
48
|
};
|
|
29
49
|
lg: {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
50
|
+
container: {
|
|
51
|
+
fontSize: string;
|
|
52
|
+
h: number;
|
|
53
|
+
};
|
|
54
|
+
icon: {
|
|
55
|
+
size: string;
|
|
56
|
+
};
|
|
57
|
+
input: {};
|
|
33
58
|
};
|
|
34
59
|
};
|
|
35
60
|
variants: {
|