@veracity/vui 0.1.0 → 0.2.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/checkbox/checkbox.js +2 -2
- package/core/utils.js +1 -1
- package/divider/divider.types.d.ts +1 -0
- package/image/image.types.d.ts +1 -0
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/input/input.js +2 -1
- package/notification/consts.d.ts +2 -0
- package/{alert → notification}/consts.js +7 -7
- package/notification/context.d.ts +4 -0
- package/{alert → notification}/context.js +4 -4
- package/notification/index.d.ts +8 -0
- package/{alert → notification}/index.js +8 -8
- package/notification/notification.d.ts +13 -0
- package/{alert/alert.js → notification/notification.js} +19 -19
- package/notification/notification.types.d.ts +20 -0
- package/notification/notificationButton.d.ts +3 -0
- package/{alert/alertButton.js → notification/notificationButton.js} +8 -8
- package/notification/notificationIcon.d.ts +3 -0
- package/{alert/alertIcon.js → notification/notificationIcon.js} +9 -9
- package/notification/notificationText.d.ts +3 -0
- package/{alert/alertText.js → notification/notificationText.js} +8 -8
- package/notification/notificationTitle.d.ts +3 -0
- package/{alert/alertTitle.js → notification/notificationTitle.js} +8 -8
- package/{alert → notification}/theme.d.ts +0 -17
- package/{alert → notification}/theme.js +0 -23
- package/package.json +2 -3
- package/radio/radio.js +2 -2
- package/skeleton/skeleton.types.d.ts +1 -0
- package/spinner/spinner.types.d.ts +1 -0
- package/svg/cache.js +1 -5
- package/svg/svg.js +2 -3
- package/switch/switch.js +2 -2
- package/switch/switchButton.js +4 -4
- package/textarea/textarea.js +2 -1
- package/textarea/textarea.types.d.ts +1 -0
- package/theme/components.d.ts +28 -44
- package/theme/components.js +26 -26
- package/theme/defaultTheme.d.ts +28 -44
- package/utils/assertion.d.ts +1 -1
- package/utils/object.d.ts +1 -12
- package/utils/object.js +1 -26
- package/alert/alert.d.ts +0 -13
- package/alert/alert.types.d.ts +0 -20
- package/alert/alertButton.d.ts +0 -3
- package/alert/alertIcon.d.ts +0 -3
- package/alert/alertText.d.ts +0 -3
- package/alert/alertTitle.d.ts +0 -3
- package/alert/consts.d.ts +0 -2
- package/alert/context.d.ts +0 -4
- package/alert/index.d.ts +0 -8
- /package/{alert/alert.types.js → notification/notification.types.js} +0 -0
package/checkbox/checkbox.js
CHANGED
|
@@ -79,7 +79,7 @@ exports.CheckboxControl = styled_components_1.default.span.withConfig(core_1.for
|
|
|
79
79
|
exports.Checkbox = core_1.vui(function (props, ref) {
|
|
80
80
|
var checkboxGroupProps = context_1.useCheckboxGroup();
|
|
81
81
|
var mergedProps = __assign(__assign({}, checkboxGroupProps), props);
|
|
82
|
-
var _a = core_1.omitThemingProps(mergedProps), checked = _a.checked, children = _a.children, className = _a.className, defaultChecked = _a.defaultChecked, disabled = _a.disabled, _b = _a.icon, iconProp = _b === void 0 ? 'cuiCheckboxUnselected' : _b, _c = _a.iconChecked, iconChecked = _c === void 0 ? 'cuiCheckboxSelected' : _c, _d = _a.iconIndeterminate, iconIndeterminate = _d === void 0 ? 'cuiCheckboxIndeterminate' : _d, inputProps = _a.inputProps, inputRef = _a.inputRef, isIndeterminate = _a.isIndeterminate, label = _a.label, name = _a.name, onChange = _a.onChange, required = _a.required, value = _a.value, rest = __rest(_a, ["checked", "children", "className", "defaultChecked", "disabled", "icon", "iconChecked", "iconIndeterminate", "inputProps", "inputRef", "isIndeterminate", "label", "name", "onChange", "required", "value"]);
|
|
82
|
+
var _a = core_1.omitThemingProps(mergedProps), checked = _a.checked, children = _a.children, className = _a.className, defaultChecked = _a.defaultChecked, disabled = _a.disabled, _b = _a.icon, iconProp = _b === void 0 ? 'cuiCheckboxUnselected' : _b, _c = _a.iconChecked, iconChecked = _c === void 0 ? 'cuiCheckboxSelected' : _c, _d = _a.iconIndeterminate, iconIndeterminate = _d === void 0 ? 'cuiCheckboxIndeterminate' : _d, id = _a.id, inputProps = _a.inputProps, inputRef = _a.inputRef, isIndeterminate = _a.isIndeterminate, label = _a.label, name = _a.name, onChange = _a.onChange, required = _a.required, value = _a.value, rest = __rest(_a, ["checked", "children", "className", "defaultChecked", "disabled", "icon", "iconChecked", "iconIndeterminate", "id", "inputProps", "inputRef", "isIndeterminate", "label", "name", "onChange", "required", "value"]);
|
|
83
83
|
var _e = __read(react_1.useState(defaultChecked), 2), isChecked = _e[0], setIsChecked = _e[1];
|
|
84
84
|
var styles = core_1.useStyleConfig('Checkbox', mergedProps);
|
|
85
85
|
var _f = styles.control, controlColor = _f.color, hoverColor = _f.hoverColor, controlStyles = __rest(_f, ["color", "hoverColor"]);
|
|
@@ -97,7 +97,7 @@ exports.Checkbox = core_1.vui(function (props, ref) {
|
|
|
97
97
|
}
|
|
98
98
|
return (react_1.default.createElement(exports.CheckboxBase, __assign({ className: utils_1.cs('vui-checkbox', disabled && 'disabled', className), controlHoverColor: controlHoverColor, ref: ref }, styles.container, rest),
|
|
99
99
|
react_1.default.createElement(exports.CheckboxControl, __assign({ borderRadius: "sm", className: "vui-checkboxControl", color: color, focusWithinRing: 3, mr: controlMr, transitionDuration: "fast" }, controlStyles),
|
|
100
|
-
react_1.default.createElement(exports.CheckboxInput, __assign({ className: "vui-checkboxInput", onChange: handleOnChange, ref: inputRef, type: "checkbox" }, { checked: checked, defaultChecked: defaultChecked, disabled: disabled, name: name, required: required, value: value }, inputProps)),
|
|
100
|
+
react_1.default.createElement(exports.CheckboxInput, __assign({ className: "vui-checkboxInput", onChange: handleOnChange, ref: inputRef, type: "checkbox" }, { checked: checked, defaultChecked: defaultChecked, disabled: disabled, id: id, name: name, required: required, value: value }, inputProps)),
|
|
101
101
|
react_1.default.createElement(icon_1.default, { className: "vui-checkboxIcon", h: "100%", name: icon, w: "100%" })), children !== null && children !== void 0 ? children : (label && (react_1.default.createElement(t_1.default, __assign({ className: "vui-checkboxLabel", lineHeight: "normal" }, styles.label), label)))));
|
|
102
102
|
});
|
|
103
103
|
exports.Checkbox.displayName = 'Checkbox';
|
package/core/utils.js
CHANGED
|
@@ -157,7 +157,7 @@ function useStyleConfig(component, props) {
|
|
|
157
157
|
var _a;
|
|
158
158
|
if (props === void 0) { props = {}; }
|
|
159
159
|
var theme = useTheme();
|
|
160
|
-
var _b = (_a = theme.components[component]) !== null && _a !== void 0 ? _a : {}, defaultProps = _b.defaultProps, _c = _b.parts, parts = _c === void 0 ? [] : _c, sizes = _b.sizes, variants = _b.variants;
|
|
160
|
+
var _b = (_a = theme === null || theme === void 0 ? void 0 : theme.components[component]) !== null && _a !== void 0 ? _a : {}, defaultProps = _b.defaultProps, _c = _b.parts, parts = _c === void 0 ? [] : _c, sizes = _b.sizes, variants = _b.variants;
|
|
161
161
|
var mergedProps = __assign(__assign({}, defaultProps), props);
|
|
162
162
|
var colorScheme = mergedProps.colorScheme, size = mergedProps.size, variant = mergedProps.variant;
|
|
163
163
|
return react_1.useMemo(function () {
|
package/image/image.types.d.ts
CHANGED
package/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export * from './alert';
|
|
2
1
|
export * from './avatar';
|
|
3
2
|
export * from './box';
|
|
4
3
|
export * from './button';
|
|
@@ -14,6 +13,7 @@ export * from './image';
|
|
|
14
13
|
export * from './input';
|
|
15
14
|
export * from './link';
|
|
16
15
|
export * from './list';
|
|
16
|
+
export * from './notification';
|
|
17
17
|
export * from './p';
|
|
18
18
|
export * from './panel';
|
|
19
19
|
export * from './radio';
|
package/index.js
CHANGED
|
@@ -10,7 +10,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
10
10
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
__exportStar(require("./alert"), exports);
|
|
14
13
|
__exportStar(require("./avatar"), exports);
|
|
15
14
|
__exportStar(require("./box"), exports);
|
|
16
15
|
__exportStar(require("./button"), exports);
|
|
@@ -26,6 +25,7 @@ __exportStar(require("./image"), exports);
|
|
|
26
25
|
__exportStar(require("./input"), exports);
|
|
27
26
|
__exportStar(require("./link"), exports);
|
|
28
27
|
__exportStar(require("./list"), exports);
|
|
28
|
+
__exportStar(require("./notification"), exports);
|
|
29
29
|
__exportStar(require("./p"), exports);
|
|
30
30
|
__exportStar(require("./panel"), exports);
|
|
31
31
|
__exportStar(require("./radio"), exports);
|
package/input/input.js
CHANGED
|
@@ -80,7 +80,7 @@ exports.InputBase = styled_components_1.default.div.withConfig(core_1.forwardPro
|
|
|
80
80
|
exports.Input = core_1.vui(function (props, ref) {
|
|
81
81
|
var _a, _b, _c, _d;
|
|
82
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
|
+
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, id = props.id, 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", "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"]);
|
|
84
84
|
var states = __assign(__assign({}, consts_1.inputStateMapping), stateMapping);
|
|
85
85
|
var computedColorScheme = utils_1.filterUndefined({
|
|
86
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
|
|
@@ -109,6 +109,7 @@ exports.Input = core_1.vui(function (props, ref) {
|
|
|
109
109
|
autoFocus: autoFocus,
|
|
110
110
|
defaultValue: defaultValue,
|
|
111
111
|
disabled: disabled,
|
|
112
|
+
id: id,
|
|
112
113
|
max: max,
|
|
113
114
|
maxLength: maxLength,
|
|
114
115
|
min: min,
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.
|
|
3
|
+
exports.notificationStatusMapping = void 0;
|
|
4
|
+
exports.notificationStatusMapping = {
|
|
5
5
|
error: {
|
|
6
6
|
colorScheme: 'red',
|
|
7
7
|
iconProps: {
|
|
8
|
-
|
|
8
|
+
name: 'falTimesCircle'
|
|
9
9
|
}
|
|
10
10
|
},
|
|
11
11
|
info: {
|
|
12
12
|
colorScheme: 'blue',
|
|
13
13
|
iconProps: {
|
|
14
|
-
|
|
14
|
+
name: 'falInfoCircle'
|
|
15
15
|
}
|
|
16
16
|
},
|
|
17
17
|
loading: {
|
|
@@ -19,19 +19,19 @@ exports.alertStatusMapping = {
|
|
|
19
19
|
iconProps: {
|
|
20
20
|
animation: 'vui-spin 0.6s linear infinite',
|
|
21
21
|
fill: ['blue.40', 'blue.60'],
|
|
22
|
-
|
|
22
|
+
name: 'fadSpinnerThird'
|
|
23
23
|
}
|
|
24
24
|
},
|
|
25
25
|
success: {
|
|
26
26
|
colorScheme: 'green',
|
|
27
27
|
iconProps: {
|
|
28
|
-
|
|
28
|
+
name: 'falCheckCircle'
|
|
29
29
|
}
|
|
30
30
|
},
|
|
31
31
|
warning: {
|
|
32
32
|
colorScheme: 'yellow',
|
|
33
33
|
iconProps: {
|
|
34
|
-
|
|
34
|
+
name: 'falExclamationCircle'
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { NotificationProps } from './notification.types';
|
|
3
|
+
declare const NotificationProvider: import("react").Provider<Partial<NotificationProps>>, useNotification: () => Partial<NotificationProps>;
|
|
4
|
+
export { NotificationProvider, useNotification };
|
|
@@ -16,8 +16,8 @@ var __read = (this && this.__read) || function (o, n) {
|
|
|
16
16
|
return ar;
|
|
17
17
|
};
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
-
exports.
|
|
19
|
+
exports.useNotification = exports.NotificationProvider = void 0;
|
|
20
20
|
var core_1 = require("../core");
|
|
21
|
-
var _a = __read(core_1.createContext({ isOptional: true }), 2),
|
|
22
|
-
exports.
|
|
23
|
-
exports.
|
|
21
|
+
var _a = __read(core_1.createContext({ isOptional: true }), 2), NotificationProvider = _a[0], useNotification = _a[1];
|
|
22
|
+
exports.NotificationProvider = NotificationProvider;
|
|
23
|
+
exports.useNotification = useNotification;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from './notification';
|
|
2
|
+
export * from './notification.types';
|
|
3
|
+
export * from './notificationButton';
|
|
4
|
+
export * from './notificationIcon';
|
|
5
|
+
export * from './notificationText';
|
|
6
|
+
export * from './notificationTitle';
|
|
7
|
+
export * from './context';
|
|
8
|
+
export { default } from './notification';
|
|
@@ -14,12 +14,12 @@ 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
|
-
__exportStar(require("./
|
|
20
|
-
__exportStar(require("./
|
|
21
|
-
__exportStar(require("./
|
|
22
|
-
__exportStar(require("./
|
|
17
|
+
__exportStar(require("./notification"), exports);
|
|
18
|
+
__exportStar(require("./notification.types"), exports);
|
|
19
|
+
__exportStar(require("./notificationButton"), exports);
|
|
20
|
+
__exportStar(require("./notificationIcon"), exports);
|
|
21
|
+
__exportStar(require("./notificationText"), exports);
|
|
22
|
+
__exportStar(require("./notificationTitle"), exports);
|
|
23
23
|
__exportStar(require("./context"), exports);
|
|
24
|
-
var
|
|
25
|
-
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(
|
|
24
|
+
var notification_1 = require("./notification");
|
|
25
|
+
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(notification_1).default; } });
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { NotificationProps } from './notification.types';
|
|
2
|
+
import NotificationButton from './notificationButton';
|
|
3
|
+
import NotificationIcon from './notificationIcon';
|
|
4
|
+
import NotificationText from './notificationText';
|
|
5
|
+
import NotificationTitle from './notificationTitle';
|
|
6
|
+
import { VuiComponent } from '../core';
|
|
7
|
+
export declare const Notification: VuiComponent<"div", NotificationProps> & {
|
|
8
|
+
Button: typeof NotificationButton;
|
|
9
|
+
Icon: typeof NotificationIcon;
|
|
10
|
+
Text: typeof NotificationText;
|
|
11
|
+
Title: typeof NotificationTitle;
|
|
12
|
+
};
|
|
13
|
+
export default Notification;
|
|
@@ -44,23 +44,23 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
44
44
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
45
45
|
};
|
|
46
46
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
47
|
-
exports.
|
|
47
|
+
exports.Notification = void 0;
|
|
48
48
|
var react_1 = __importStar(require("react"));
|
|
49
|
-
var alertButton_1 = __importDefault(require("./alertButton"));
|
|
50
|
-
var alertIcon_1 = __importDefault(require("./alertIcon"));
|
|
51
|
-
var alertText_1 = __importDefault(require("./alertText"));
|
|
52
|
-
var alertTitle_1 = __importDefault(require("./alertTitle"));
|
|
53
49
|
var consts_1 = require("./consts");
|
|
54
50
|
var context_1 = require("./context");
|
|
51
|
+
var notificationButton_1 = __importDefault(require("./notificationButton"));
|
|
52
|
+
var notificationIcon_1 = __importDefault(require("./notificationIcon"));
|
|
53
|
+
var notificationText_1 = __importDefault(require("./notificationText"));
|
|
54
|
+
var notificationTitle_1 = __importDefault(require("./notificationTitle"));
|
|
55
55
|
var box_1 = __importDefault(require("../box"));
|
|
56
56
|
var core_1 = require("../core");
|
|
57
57
|
var utils_1 = require("../utils");
|
|
58
|
-
exports.
|
|
58
|
+
exports.Notification = core_1.vui(function (props, ref) {
|
|
59
59
|
var _a, _b, _c;
|
|
60
60
|
var action = props.action, children = props.children, className = props.className, _d = props.colorScheme, colorSchemeProp = _d === void 0 ? 'blue' : _d, icon = props.icon, onClose = props.onClose, size = props.size, _e = props.status, status = _e === void 0 ? '' : _e, statusMapping = props.statusMapping, text = props.text, title = props.title, variant = props.variant, rest = __rest(props, ["action", "children", "className", "colorScheme", "icon", "onClose", "size", "status", "statusMapping", "text", "title", "variant"]);
|
|
61
|
-
var statuses = __assign(__assign({}, consts_1.
|
|
61
|
+
var statuses = __assign(__assign({}, consts_1.notificationStatusMapping), statusMapping);
|
|
62
62
|
var _f = ((_a = statuses[status]) !== null && _a !== void 0 ? _a : {}).colorScheme, colorScheme = _f === void 0 ? colorSchemeProp : _f;
|
|
63
|
-
var styles = core_1.useStyleConfig('
|
|
63
|
+
var styles = core_1.useStyleConfig('Notification', __assign({ colorScheme: colorScheme }, props));
|
|
64
64
|
var iconName = utils_1.isString(icon) ? icon : (_c = (_b = statuses[status]) === null || _b === void 0 ? void 0 : _b.iconProps) === null || _c === void 0 ? void 0 : _c.name;
|
|
65
65
|
var context = react_1.useMemo(function () { return utils_1.filterUndefined({ colorScheme: colorScheme, size: size, status: status, variant: variant }); }, [
|
|
66
66
|
colorScheme,
|
|
@@ -68,18 +68,18 @@ exports.Alert = core_1.vui(function (props, ref) {
|
|
|
68
68
|
status,
|
|
69
69
|
variant
|
|
70
70
|
]);
|
|
71
|
-
return (react_1.default.createElement(context_1.
|
|
72
|
-
react_1.default.createElement(box_1.default, __assign({ borderRadius: "md", className: utils_1.cs('vui-
|
|
73
|
-
iconName ? react_1.default.createElement(
|
|
74
|
-
utils_1.isReactText(title) ? react_1.default.createElement(
|
|
71
|
+
return (react_1.default.createElement(context_1.NotificationProvider, { value: context },
|
|
72
|
+
react_1.default.createElement(box_1.default, __assign({ borderRadius: "md", className: utils_1.cs('vui-notification', className), px: 1.5, py: 1, ref: ref, w: "fit-content" }, styles.container, rest),
|
|
73
|
+
iconName ? react_1.default.createElement(notificationIcon_1.default, { name: iconName }) : icon, children !== null && children !== void 0 ? children : (react_1.default.createElement(notificationText_1.default, null,
|
|
74
|
+
utils_1.isReactText(title) ? react_1.default.createElement(notificationTitle_1.default, { text: title }) : title,
|
|
75
75
|
" ",
|
|
76
76
|
text)),
|
|
77
77
|
action,
|
|
78
|
-
onClose && react_1.default.createElement(
|
|
78
|
+
onClose && react_1.default.createElement(notificationButton_1.default, { icon: "falTimes", onClick: onClose }))));
|
|
79
79
|
});
|
|
80
|
-
exports.
|
|
81
|
-
exports.
|
|
82
|
-
exports.
|
|
83
|
-
exports.
|
|
84
|
-
exports.
|
|
85
|
-
exports.default = exports.
|
|
80
|
+
exports.Notification.displayName = 'Notification';
|
|
81
|
+
exports.Notification.Button = notificationButton_1.default;
|
|
82
|
+
exports.Notification.Icon = notificationIcon_1.default;
|
|
83
|
+
exports.Notification.Text = notificationText_1.default;
|
|
84
|
+
exports.Notification.Title = notificationTitle_1.default;
|
|
85
|
+
exports.default = exports.Notification;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { BoxProps } from '../box';
|
|
3
|
+
import { IconProp, IconProps } from '../icon';
|
|
4
|
+
import { ThemingProps } from '../theme';
|
|
5
|
+
import { AnyElement } from '../utils';
|
|
6
|
+
export interface NotificationProps extends Omit<BoxProps, 'size' | 'variant'>, ThemingProps<'Notification'> {
|
|
7
|
+
action?: ReactNode;
|
|
8
|
+
colorScheme?: 'blue' | 'green' | 'red' | 'yellow';
|
|
9
|
+
icon?: IconProp | AnyElement;
|
|
10
|
+
onClose?: () => void;
|
|
11
|
+
status?: NotificationStatus;
|
|
12
|
+
statusMapping?: NotificationStatusMapping;
|
|
13
|
+
text?: ReactNode;
|
|
14
|
+
title?: ReactNode;
|
|
15
|
+
}
|
|
16
|
+
export declare type NotificationStatus = 'error' | 'info' | 'loading' | 'success' | 'warning';
|
|
17
|
+
export declare type NotificationStatusMapping = Record<string, {
|
|
18
|
+
colorScheme?: NotificationProps['colorScheme'];
|
|
19
|
+
iconProps: IconProps;
|
|
20
|
+
}>;
|
|
@@ -14,17 +14,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.
|
|
17
|
+
exports.NotificationButton = void 0;
|
|
18
18
|
var react_1 = __importDefault(require("react"));
|
|
19
19
|
var context_1 = require("./context");
|
|
20
20
|
var core_1 = require("../core");
|
|
21
21
|
var button_1 = __importDefault(require("../button"));
|
|
22
|
-
exports.
|
|
22
|
+
exports.NotificationButton = core_1.vui(function (props, ref) {
|
|
23
23
|
var _a;
|
|
24
|
-
var
|
|
25
|
-
var mergedProps = __assign(__assign({},
|
|
26
|
-
var styles = core_1.useStyleConfig('
|
|
27
|
-
return (react_1.default.createElement(button_1.default, __assign({ className: "vui-
|
|
24
|
+
var notificationProps = (_a = context_1.useNotification()) !== null && _a !== void 0 ? _a : {};
|
|
25
|
+
var mergedProps = __assign(__assign({}, notificationProps), props);
|
|
26
|
+
var styles = core_1.useStyleConfig('Notification', mergedProps);
|
|
27
|
+
return (react_1.default.createElement(button_1.default, __assign({ className: "vui-notificationButton", colorScheme: mergedProps.colorScheme, ml: 1, mr: -0.5, ref: ref, size: "sm" }, styles.button, props)));
|
|
28
28
|
});
|
|
29
|
-
exports.
|
|
30
|
-
exports.default = exports.
|
|
29
|
+
exports.NotificationButton.displayName = 'NotificationButton';
|
|
30
|
+
exports.default = exports.NotificationButton;
|
|
@@ -14,20 +14,20 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.
|
|
17
|
+
exports.NotificationIcon = void 0;
|
|
18
18
|
var react_1 = __importDefault(require("react"));
|
|
19
19
|
var consts_1 = require("./consts");
|
|
20
20
|
var context_1 = require("./context");
|
|
21
21
|
var core_1 = require("../core");
|
|
22
22
|
var icon_1 = __importDefault(require("../icon"));
|
|
23
|
-
exports.
|
|
23
|
+
exports.NotificationIcon = core_1.vui(function (props, ref) {
|
|
24
24
|
var _a, _b;
|
|
25
|
-
var
|
|
26
|
-
var mergedProps = __assign(__assign({},
|
|
27
|
-
var styles = core_1.useStyleConfig('
|
|
25
|
+
var notificationProps = (_a = context_1.useNotification()) !== null && _a !== void 0 ? _a : {};
|
|
26
|
+
var mergedProps = __assign(__assign({}, notificationProps), props);
|
|
27
|
+
var styles = core_1.useStyleConfig('Notification', mergedProps);
|
|
28
28
|
var _c = mergedProps.status, status = _c === void 0 ? '' : _c;
|
|
29
|
-
var iconProps = ((_b = consts_1.
|
|
30
|
-
return (react_1.default.createElement(icon_1.default, __assign({ className: "vui-
|
|
29
|
+
var iconProps = ((_b = consts_1.notificationStatusMapping[status]) !== null && _b !== void 0 ? _b : {}).iconProps;
|
|
30
|
+
return (react_1.default.createElement(icon_1.default, __assign({ className: "vui-notificationIcon", mr: 1, my: 0.5, ref: ref, size: "md" }, styles.icon, iconProps, props)));
|
|
31
31
|
});
|
|
32
|
-
exports.
|
|
33
|
-
exports.default = exports.
|
|
32
|
+
exports.NotificationIcon.displayName = 'NotificationIcon';
|
|
33
|
+
exports.default = exports.NotificationIcon;
|
|
@@ -14,17 +14,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.
|
|
17
|
+
exports.NotificationText = void 0;
|
|
18
18
|
var react_1 = __importDefault(require("react"));
|
|
19
19
|
var context_1 = require("./context");
|
|
20
20
|
var core_1 = require("../core");
|
|
21
21
|
var t_1 = __importDefault(require("../t"));
|
|
22
|
-
exports.
|
|
22
|
+
exports.NotificationText = core_1.vui(function (props, ref) {
|
|
23
23
|
var _a;
|
|
24
|
-
var
|
|
25
|
-
var mergedProps = __assign(__assign({},
|
|
26
|
-
var styles = core_1.useStyleConfig('
|
|
27
|
-
return (react_1.default.createElement(t_1.default, __assign({ className: "vui-
|
|
24
|
+
var notificationProps = (_a = context_1.useNotification()) !== null && _a !== void 0 ? _a : {};
|
|
25
|
+
var mergedProps = __assign(__assign({}, notificationProps), props);
|
|
26
|
+
var styles = core_1.useStyleConfig('Notification', mergedProps);
|
|
27
|
+
return (react_1.default.createElement(t_1.default, __assign({ className: "vui-notificationText", flex: "1", lineHeight: "24px", minW: 0, py: 0.5, ref: ref }, styles.text, props)));
|
|
28
28
|
});
|
|
29
|
-
exports.
|
|
30
|
-
exports.default = exports.
|
|
29
|
+
exports.NotificationText.displayName = 'NotificationText';
|
|
30
|
+
exports.default = exports.NotificationText;
|
|
@@ -14,17 +14,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.
|
|
17
|
+
exports.NotificationTitle = void 0;
|
|
18
18
|
var react_1 = __importDefault(require("react"));
|
|
19
19
|
var context_1 = require("./context");
|
|
20
20
|
var core_1 = require("../core");
|
|
21
21
|
var heading_1 = require("../heading");
|
|
22
|
-
exports.
|
|
22
|
+
exports.NotificationTitle = core_1.vui(function (props, ref) {
|
|
23
23
|
var _a;
|
|
24
|
-
var
|
|
25
|
-
var mergedProps = __assign(__assign({},
|
|
26
|
-
var styles = core_1.useStyleConfig('
|
|
27
|
-
return react_1.default.createElement(heading_1.H6, __assign({ className: "vui-
|
|
24
|
+
var notificationProps = (_a = context_1.useNotification()) !== null && _a !== void 0 ? _a : {};
|
|
25
|
+
var mergedProps = __assign(__assign({}, notificationProps), props);
|
|
26
|
+
var styles = core_1.useStyleConfig('Notification', mergedProps);
|
|
27
|
+
return react_1.default.createElement(heading_1.H6, __assign({ className: "vui-notificationTitle", display: "inline-flex", ref: ref }, styles.title, props));
|
|
28
28
|
});
|
|
29
|
-
exports.
|
|
30
|
-
exports.default = exports.
|
|
29
|
+
exports.NotificationTitle.displayName = 'NotificationTitle';
|
|
30
|
+
exports.default = exports.NotificationTitle;
|
|
@@ -1,20 +1,4 @@
|
|
|
1
1
|
import { Dict } from '../utils';
|
|
2
|
-
declare function variantSolid(props: Dict): {
|
|
3
|
-
container: {
|
|
4
|
-
bg: string;
|
|
5
|
-
color: string;
|
|
6
|
-
};
|
|
7
|
-
button: {
|
|
8
|
-
bg: string;
|
|
9
|
-
borderColor: string;
|
|
10
|
-
hoverBg: string;
|
|
11
|
-
hoverBorderColor: string;
|
|
12
|
-
};
|
|
13
|
-
icon: {};
|
|
14
|
-
message: {};
|
|
15
|
-
text: {};
|
|
16
|
-
title: {};
|
|
17
|
-
};
|
|
18
2
|
declare function variantSubtle(props: Dict): {
|
|
19
3
|
container: {
|
|
20
4
|
bg: string;
|
|
@@ -41,7 +25,6 @@ declare const _default: {
|
|
|
41
25
|
parts: string[];
|
|
42
26
|
sizes: {};
|
|
43
27
|
variants: {
|
|
44
|
-
solid: typeof variantSolid;
|
|
45
28
|
subtle: typeof variantSubtle;
|
|
46
29
|
};
|
|
47
30
|
};
|
|
@@ -1,23 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
function variantSolid(props) {
|
|
4
|
-
var c = props.colorScheme;
|
|
5
|
-
var container = {
|
|
6
|
-
bg: c + ".70",
|
|
7
|
-
color: 'white'
|
|
8
|
-
};
|
|
9
|
-
var button = {
|
|
10
|
-
bg: c + ".70",
|
|
11
|
-
borderColor: c + ".70",
|
|
12
|
-
hoverBg: c + ".80",
|
|
13
|
-
hoverBorderColor: c + ".80"
|
|
14
|
-
};
|
|
15
|
-
var icon = {};
|
|
16
|
-
var message = {};
|
|
17
|
-
var text = {};
|
|
18
|
-
var title = {};
|
|
19
|
-
return { container: container, button: button, icon: icon, message: message, text: text, title: title };
|
|
20
|
-
}
|
|
21
3
|
function variantSubtle(props) {
|
|
22
4
|
var c = props.colorScheme;
|
|
23
5
|
var container = {
|
|
@@ -36,10 +18,6 @@ function variantSubtle(props) {
|
|
|
36
18
|
var message = {};
|
|
37
19
|
var text = {};
|
|
38
20
|
var title = {};
|
|
39
|
-
if (c === 'grey') {
|
|
40
|
-
container.color = 'prussian.80';
|
|
41
|
-
button.color = 'prussian.80';
|
|
42
|
-
}
|
|
43
21
|
if (c === 'yellow') {
|
|
44
22
|
container.color = 'yellow.100';
|
|
45
23
|
button.color = 'yellow.100';
|
|
@@ -53,7 +31,6 @@ var defaultProps = {
|
|
|
53
31
|
var parts = ['container', 'button', 'icon', 'message', 'text', 'title'];
|
|
54
32
|
var sizes = {};
|
|
55
33
|
var variants = {
|
|
56
|
-
solid: variantSolid,
|
|
57
34
|
subtle: variantSubtle
|
|
58
35
|
};
|
|
59
36
|
exports.default = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@veracity/vui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Veracity UI React components library based on Styled Components and @xstyled",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"author": "Veracity",
|
|
@@ -17,8 +17,7 @@
|
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@xstyled/styled-components": "^2.4.1",
|
|
20
|
-
"
|
|
21
|
-
"styled-components": "^5.2.1"
|
|
20
|
+
"styled-components": "^5.3.1"
|
|
22
21
|
},
|
|
23
22
|
"peerDependencies": {
|
|
24
23
|
"react": "^17.0.1",
|
package/radio/radio.js
CHANGED
|
@@ -45,7 +45,7 @@ exports.Radio = core_1.vui(function (props, ref) {
|
|
|
45
45
|
var _a;
|
|
46
46
|
var _b = (_a = context_1.useRadioGroup()) !== null && _a !== void 0 ? _a : {}, groupOnChange = _b.onChange, groupValue = _b.value, radioGroupProps = __rest(_b, ["onChange", "value"]);
|
|
47
47
|
var mergedProps = __assign(__assign({}, radioGroupProps), props);
|
|
48
|
-
var _c = core_1.omitThemingProps(mergedProps), _d = _c.checked, checked = _d === void 0 ? groupValue !== undefined ? props.value === groupValue : undefined : _d, children = _c.children, className = _c.className, defaultChecked = _c.defaultChecked, disabled = _c.disabled, _e = _c.icon, iconProp = _e === void 0 ? 'cuiRadioUnselected' : _e, _f = _c.iconChecked, iconChecked = _f === void 0 ? 'cuiRadioSelected' : _f, inputProps = _c.inputProps, inputRef = _c.inputRef, label = _c.label, name = _c.name, onChange = _c.onChange, required = _c.required, value = _c.value, rest = __rest(_c, ["checked", "children", "className", "defaultChecked", "disabled", "icon", "iconChecked", "inputProps", "inputRef", "label", "name", "onChange", "required", "value"]);
|
|
48
|
+
var _c = core_1.omitThemingProps(mergedProps), _d = _c.checked, checked = _d === void 0 ? groupValue !== undefined ? props.value === groupValue : undefined : _d, children = _c.children, className = _c.className, defaultChecked = _c.defaultChecked, disabled = _c.disabled, _e = _c.icon, iconProp = _e === void 0 ? 'cuiRadioUnselected' : _e, _f = _c.iconChecked, iconChecked = _f === void 0 ? 'cuiRadioSelected' : _f, id = _c.id, inputProps = _c.inputProps, inputRef = _c.inputRef, label = _c.label, name = _c.name, onChange = _c.onChange, required = _c.required, value = _c.value, rest = __rest(_c, ["checked", "children", "className", "defaultChecked", "disabled", "icon", "iconChecked", "id", "inputProps", "inputRef", "label", "name", "onChange", "required", "value"]);
|
|
49
49
|
var styles = core_1.useStyleConfig('Radio', mergedProps);
|
|
50
50
|
var _g = styles.control, controlColor = _g.color, hoverColor = _g.hoverColor, controlStyles = __rest(_g, ["color", "hoverColor"]);
|
|
51
51
|
var icon = checked ? iconChecked : iconProp;
|
|
@@ -58,7 +58,7 @@ exports.Radio = core_1.vui(function (props, ref) {
|
|
|
58
58
|
}
|
|
59
59
|
return (react_1.default.createElement(exports.RadioBase, __assign({ className: utils_1.cs('vui-radio', disabled && 'disabled', className), controlHoverColor: controlHoverColor, ref: ref }, styles.container, rest),
|
|
60
60
|
react_1.default.createElement(exports.RadioControl, __assign({ borderRadius: "50%", className: "vui-radioControl", color: color, focusWithinRing: 3, mr: controlMr, transitionDuration: "fast" }, controlStyles),
|
|
61
|
-
react_1.default.createElement(exports.RadioInput, __assign({ className: "vui-radioInput", onChange: handleOnChange, ref: inputRef, type: "radio" }, { checked: checked, defaultChecked: defaultChecked, disabled: disabled, name: name, required: required, value: value }, inputProps)),
|
|
61
|
+
react_1.default.createElement(exports.RadioInput, __assign({ className: "vui-radioInput", onChange: handleOnChange, ref: inputRef, type: "radio" }, { checked: checked, defaultChecked: defaultChecked, disabled: disabled, id: id, name: name, required: required, value: value }, inputProps)),
|
|
62
62
|
react_1.default.createElement(icon_1.default, { className: "vui-radioIcon", h: "100%", name: icon, w: "100%" })), children !== null && children !== void 0 ? children : (label && (react_1.default.createElement(t_1.default, __assign({ className: "vui-radioLabel", lineHeight: "normal" }, styles.label), label)))));
|
|
63
63
|
});
|
|
64
64
|
exports.Radio.displayName = 'Radio';
|
|
@@ -5,6 +5,7 @@ export interface SpinnerCircleStyleProps extends SystemProps {
|
|
|
5
5
|
speed?: string;
|
|
6
6
|
}
|
|
7
7
|
export interface SpinnerProps extends Omit<BoxProps, 'size' | 'variant'>, Omit<ThemingProps<'Spinner'>, 'size'> {
|
|
8
|
+
children?: never;
|
|
8
9
|
colorScheme?: 'blue' | 'grey' | 'prussian';
|
|
9
10
|
emptyColor?: string;
|
|
10
11
|
speed?: string;
|
package/svg/cache.js
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
var axios_1 = __importDefault(require("axios"));
|
|
7
3
|
/**
|
|
8
4
|
* Provides svg caching functionality to avoid redundant XHR requests.
|
|
9
5
|
* When the retrieved item doesn't exist in cache yet, a request is sent
|
|
@@ -20,7 +16,7 @@ var Cache = /** @class */ (function () {
|
|
|
20
16
|
this.get = function (src) {
|
|
21
17
|
var item = _this.cache.get(src);
|
|
22
18
|
if (!item) {
|
|
23
|
-
var promise =
|
|
19
|
+
var promise = fetch(src).then(function (res) { return res.text(); });
|
|
24
20
|
_this.add(src, promise);
|
|
25
21
|
return promise;
|
|
26
22
|
}
|
package/svg/svg.js
CHANGED
|
@@ -114,6 +114,8 @@ exports.Svg = core_1.vui(function (props, ref) {
|
|
|
114
114
|
var _a = __read(react_1.useState(helpers_1.initState()), 2), state = _a[0], setState = _a[1];
|
|
115
115
|
var isMountedRef = react_1.useRef(false);
|
|
116
116
|
var srcRef = react_1.useRef(src);
|
|
117
|
+
var _b = state.content, content = _b === void 0 ? '' : _b, _c = state.svgAttributes, svgAttributes = _c === void 0 ? {} : _c;
|
|
118
|
+
var innerHTML = !children ? { __html: content } : undefined;
|
|
117
119
|
react_1.useEffect(function () {
|
|
118
120
|
isMountedRef.current = true;
|
|
119
121
|
return function () {
|
|
@@ -155,9 +157,6 @@ exports.Svg = core_1.vui(function (props, ref) {
|
|
|
155
157
|
}
|
|
156
158
|
src && loadSvg(src);
|
|
157
159
|
}, [src]);
|
|
158
|
-
var _b = state.content, content = _b === void 0 ? '' : _b, _c = state.svgAttributes, svgAttributes = _c === void 0 ? {} : _c;
|
|
159
|
-
var innerHTML = !children ? { __html: content } : undefined;
|
|
160
|
-
// const pathFill = Array.isArray(fill) ? fill : [fill]
|
|
161
160
|
return (react_1.default.createElement(exports.SvgBase, __assign({ className: utils_1.cs('vui-svg', className), dangerouslySetInnerHTML: innerHTML, ref: ref, xmlns: "http://www.w3.org/2000/svg" }, svgAttributes, rest), children));
|
|
162
161
|
});
|
|
163
162
|
exports.Svg.displayName = 'Svg';
|
package/switch/switch.js
CHANGED
|
@@ -77,7 +77,7 @@ var utils_1 = require("../utils");
|
|
|
77
77
|
exports.SwitchBase = styled_components_1.default.label.withConfig(core_1.forwardPropConfig(system_1.system))(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n\talign-items: center;\n\tcursor: pointer;\n\tdisplay: inline-flex;\n\tline-height: normal;\n\twidth: fit-content;\n\n\t&[data-disabled='true'] {\n\t\tcursor: not-allowed;\n\n\t\t", " {\n\t\t\tcolor: var(--vui-colors-disabled-font);\n\t\t}\n\t}\n\n\t", "\n"], ["\n\talign-items: center;\n\tcursor: pointer;\n\tdisplay: inline-flex;\n\tline-height: normal;\n\twidth: fit-content;\n\n\t&[data-disabled='true'] {\n\t\tcursor: not-allowed;\n\n\t\t", " {\n\t\t\tcolor: var(--vui-colors-disabled-font);\n\t\t}\n\t}\n\n\t", "\n"])), t_1.TBase, system_1.system);
|
|
78
78
|
exports.Switch = core_1.vui(function (props, ref) {
|
|
79
79
|
var _a;
|
|
80
|
-
var button = props.button, checked = props.checked, children = props.children, className = props.className, colorScheme = props.colorScheme, defaultChecked = props.defaultChecked, disabled = props.disabled, innerLabelOff = props.innerLabelOff, innerLabelOn = props.innerLabelOn, inputRef = props.inputRef, labelLeft = props.labelLeft, labelRight = props.labelRight, name = props.name, onBlur = props.onBlur, onChange = props.onChange, onFocus = props.onFocus, required = props.required, size = props.size, value = props.value, variant = props.variant, rest = __rest(props, ["button", "checked", "children", "className", "colorScheme", "defaultChecked", "disabled", "innerLabelOff", "innerLabelOn", "inputRef", "labelLeft", "labelRight", "name", "onBlur", "onChange", "onFocus", "required", "size", "value", "variant"]);
|
|
80
|
+
var button = props.button, checked = props.checked, children = props.children, className = props.className, colorScheme = props.colorScheme, defaultChecked = props.defaultChecked, disabled = props.disabled, id = props.id, innerLabelOff = props.innerLabelOff, innerLabelOn = props.innerLabelOn, inputRef = props.inputRef, labelLeft = props.labelLeft, labelRight = props.labelRight, name = props.name, onBlur = props.onBlur, onChange = props.onChange, onFocus = props.onFocus, required = props.required, size = props.size, value = props.value, variant = props.variant, rest = __rest(props, ["button", "checked", "children", "className", "colorScheme", "defaultChecked", "disabled", "id", "innerLabelOff", "innerLabelOn", "inputRef", "labelLeft", "labelRight", "name", "onBlur", "onChange", "onFocus", "required", "size", "value", "variant"]);
|
|
81
81
|
var _b = __read(react_1.useState(defaultChecked), 2), isChecked = _b[0], setIsChecked = _b[1];
|
|
82
82
|
var styles = core_1.useStyleConfig('Switch', props);
|
|
83
83
|
react_1.useEffect(function () {
|
|
@@ -122,7 +122,7 @@ exports.Switch = core_1.vui(function (props, ref) {
|
|
|
122
122
|
});
|
|
123
123
|
return (react_1.default.createElement(context_1.SwitchProvider, { value: context },
|
|
124
124
|
react_1.default.createElement(exports.SwitchBase, __assign({ className: utils_1.cs('vui-switch', className), ref: ref }, styles.container, aliasedProps, rest),
|
|
125
|
-
utils_1.isReactText(labelLeft) ? react_1.default.createElement(switchLabel_1.SwitchLabel, { mr: 1, text: labelLeft }) : labelLeft, (_a = children !== null && children !== void 0 ? children : button) !== null && _a !== void 0 ? _a : react_1.default.createElement(switchButton_1.SwitchButton, __assign({}, { innerLabelOff: innerLabelOff, innerLabelOn: innerLabelOn, inputRef: inputRef })),
|
|
125
|
+
utils_1.isReactText(labelLeft) ? react_1.default.createElement(switchLabel_1.SwitchLabel, { mr: 1, text: labelLeft }) : labelLeft, (_a = children !== null && children !== void 0 ? children : button) !== null && _a !== void 0 ? _a : react_1.default.createElement(switchButton_1.SwitchButton, __assign({}, { id: id, innerLabelOff: innerLabelOff, innerLabelOn: innerLabelOn, inputRef: inputRef })),
|
|
126
126
|
utils_1.isReactText(labelRight) ? react_1.default.createElement(switchLabel_1.SwitchLabel, { ml: 1, text: labelRight }) : labelRight)));
|
|
127
127
|
});
|
|
128
128
|
exports.Switch.displayName = 'Switch';
|
package/switch/switchButton.js
CHANGED
|
@@ -74,12 +74,12 @@ var utils_1 = require("../utils");
|
|
|
74
74
|
exports.SwitchInput = styled_components_1.default.input.withConfig(core_1.forwardPropConfig(system_1.system))(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n\tcursor: inherit;\n\theight: calc(100% + 10px);\n\tleft: -5px;\n\tmargin: 0;\n\topacity: 0;\n\tpadding: 0;\n\tposition: absolute;\n\ttop: -5px;\n\twidth: calc(100% + 10px);\n\tz-index: 1;\n\n\t", "\n"], ["\n\tcursor: inherit;\n\theight: calc(100% + 10px);\n\tleft: -5px;\n\tmargin: 0;\n\topacity: 0;\n\tpadding: 0;\n\tposition: absolute;\n\ttop: -5px;\n\twidth: calc(100% + 10px);\n\tz-index: 1;\n\n\t", "\n"])), system_1.system);
|
|
75
75
|
exports.SwitchThumb = styled_components_1.default.span.withConfig(core_1.forwardPropConfig(system_1.system))(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n\tdisplay: inline-flex;\n\tflex-shrink: 0;\n\tposition: absolute;\n\n\t", "\n"], ["\n\tdisplay: inline-flex;\n\tflex-shrink: 0;\n\tposition: absolute;\n\n\t", "\n"])), system_1.system);
|
|
76
76
|
exports.SwitchTrack = styled_components_1.default.span.withConfig(core_1.forwardPropConfig(system_1.system))(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n\talign-items: center;\n\tdisplay: inline-flex;\n\tflex: 1;\n\tposition: relative;\n\n\t", "\n"], ["\n\talign-items: center;\n\tdisplay: inline-flex;\n\tflex: 1;\n\tposition: relative;\n\n\t", "\n"])), system_1.system);
|
|
77
|
-
exports.SwitchButtonBase = styled_components_1.default.span.withConfig(core_1.forwardPropConfig(system_1.system))(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n\tcolor: white;\n\tcursor: pointer;\n\tdisplay: inline-flex;\n\tflex-shrink: 0;\n\tposition: relative;\n\n\t&[data-disabled='true'] {\n\t\tcursor: not-allowed;\n\n\t\t", " {\n\t\t\tborder-color: var(--vui-colors-disabled-border);\n\t\t\tbackground-color: var(--vui-colors-disabled-font);\n\t\t}\n\n\t\t", " {\n\t\t\tbackground-color: var(--vui-colors-disabled-bg);\n\t\t}\n\t}\n\n\t", "\n"], ["\n\tcolor: white;\n\tcursor: pointer;\n\tdisplay: inline-flex;\n\tflex-shrink: 0;\n\tposition: relative;\n\n\t&[data-disabled='true'] {\n\t\tcursor: not-allowed;\n\n\t\t", " {\n\t\t\tborder-color: var(--vui-colors-disabled-border);\n\t\t\tbackground-color: var(--vui-colors-disabled-font);\n\t\t}\n\n\t\t", " {\n\t\t\tbackground-color: var(--vui-colors-disabled-bg);\n\t\t}\n\t}\n\n\t", "\n"])), exports.SwitchThumb, exports.SwitchTrack, system_1.system);
|
|
77
|
+
exports.SwitchButtonBase = styled_components_1.default.span.withConfig(core_1.forwardPropConfig(system_1.system))(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n\tcolor: white;\n\tcursor: pointer;\n\tdisplay: inline-flex;\n\tflex-shrink: 0;\n\tposition: relative;\n\n\t&[data-disabled='true'] {\n\t\tcursor: not-allowed;\n\n\t\t", " {\n\t\t\tborder-color: var(--vui-colors-disabled-border);\n\t\t\tbackground-color: var(--vui-colors-disabled-font);\n\t\t}\n\n\t\t", " {\n\t\t\t--x-ring-color: var(--vui-colors-disabled-border);\n\t\t\tbackground-color: var(--vui-colors-disabled-bg);\n\t\t}\n\t}\n\n\t", "\n"], ["\n\tcolor: white;\n\tcursor: pointer;\n\tdisplay: inline-flex;\n\tflex-shrink: 0;\n\tposition: relative;\n\n\t&[data-disabled='true'] {\n\t\tcursor: not-allowed;\n\n\t\t", " {\n\t\t\tborder-color: var(--vui-colors-disabled-border);\n\t\t\tbackground-color: var(--vui-colors-disabled-font);\n\t\t}\n\n\t\t", " {\n\t\t\t--x-ring-color: var(--vui-colors-disabled-border);\n\t\t\tbackground-color: var(--vui-colors-disabled-bg);\n\t\t}\n\t}\n\n\t", "\n"])), exports.SwitchThumb, exports.SwitchTrack, system_1.system);
|
|
78
78
|
exports.SwitchButton = core_1.vui(function (props, ref) {
|
|
79
79
|
var _a;
|
|
80
80
|
var _b = (_a = context_1.useSwitch()) !== null && _a !== void 0 ? _a : {}, switchIsChecked = _b.isChecked, switchProps = __rest(_b, ["isChecked"]);
|
|
81
81
|
var mergedProps = __assign(__assign({}, switchProps), props);
|
|
82
|
-
var _c = core_1.omitThemingProps(mergedProps), checked = _c.checked, className = _c.className, defaultChecked = _c.defaultChecked, disabled = _c.disabled, innerLabelOff = _c.innerLabelOff, innerLabelOn = _c.innerLabelOn, inputProps = _c.inputProps, inputRef = _c.inputRef, name = _c.name, onBlur = _c.onBlur, onChange = _c.onChange, onFocus = _c.onFocus, required = _c.required, value = _c.value, rest = __rest(_c, ["checked", "className", "defaultChecked", "disabled", "innerLabelOff", "innerLabelOn", "inputProps", "inputRef", "name", "onBlur", "onChange", "onFocus", "required", "value"]);
|
|
82
|
+
var _c = core_1.omitThemingProps(mergedProps), checked = _c.checked, className = _c.className, defaultChecked = _c.defaultChecked, disabled = _c.disabled, id = _c.id, innerLabelOff = _c.innerLabelOff, innerLabelOn = _c.innerLabelOn, inputProps = _c.inputProps, inputRef = _c.inputRef, name = _c.name, onBlur = _c.onBlur, onChange = _c.onChange, onFocus = _c.onFocus, required = _c.required, value = _c.value, rest = __rest(_c, ["checked", "className", "defaultChecked", "disabled", "id", "innerLabelOff", "innerLabelOn", "inputProps", "inputRef", "name", "onBlur", "onChange", "onFocus", "required", "value"]);
|
|
83
83
|
var _d = __read(react_1.useState(defaultChecked), 2), isChecked = _d[0], setIsChecked = _d[1];
|
|
84
84
|
var _e = __read(react_1.useState(false), 2), isFocused = _e[0], setIsFocused = _e[1];
|
|
85
85
|
var styles = core_1.useStyleConfig('Switch', mergedProps);
|
|
@@ -118,10 +118,10 @@ exports.SwitchButton = core_1.vui(function (props, ref) {
|
|
|
118
118
|
bg: isChecked ? trackStyles.bg : 'grey.50',
|
|
119
119
|
pl: isChecked ? 1 : labelOffset,
|
|
120
120
|
pr: isChecked ? labelOffset : 1,
|
|
121
|
-
ring: isFocused ? trackStyles.ring : 0
|
|
121
|
+
ring: isFocused ? trackStyles.ring : disabled ? 1 : 0
|
|
122
122
|
});
|
|
123
123
|
return (react_1.default.createElement(exports.SwitchButtonBase, __assign({ className: utils_1.cs('vui-switchButton', className), ref: ref }, buttonStyles, buttonAliasedProps, rest),
|
|
124
|
-
react_1.default.createElement(exports.SwitchInput, __assign({ className: "vui-switchInput", onBlur: handleOnBlur, onChange: handleOnChange, onFocus: handleOnFocus, ref: inputRef, type: "checkbox" }, { checked: checked, defaultChecked: defaultChecked, disabled: disabled, name: name, required: required, value: value }, inputProps)),
|
|
124
|
+
react_1.default.createElement(exports.SwitchInput, __assign({ className: "vui-switchInput", onBlur: handleOnBlur, onChange: handleOnChange, onFocus: handleOnFocus, ref: inputRef, type: "checkbox" }, { checked: checked, defaultChecked: defaultChecked, disabled: disabled, id: id, name: name, required: required, value: value }, inputProps)),
|
|
125
125
|
react_1.default.createElement(exports.SwitchTrack, __assign({ borderRadius: "round", className: "vui-switchTrack", transitionDuration: "fast" }, trackStyles, trackAliasedProps),
|
|
126
126
|
!isChecked && innerLabelOff,
|
|
127
127
|
react_1.default.createElement(exports.SwitchThumb, __assign({ borderRadius: "round", className: "vui-switchThumb", transitionDuration: "fast" }, thumbStyles, thumbAliasedProps)),
|
package/textarea/textarea.js
CHANGED
|
@@ -76,7 +76,7 @@ exports.TextareaTextarea = styled_components_1.default.textarea.withConfig(core_
|
|
|
76
76
|
exports.TextareaBase = styled_components_1.default.div.withConfig(core_1.forwardPropConfig(system_1.system))(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n\tdisplay: flex;\n\tflex-direction: column;\n\tmin-height: 80px;\n\tposition: relative;\n\twidth: 100%;\n\n\t", "\n"], ["\n\tdisplay: flex;\n\tflex-direction: column;\n\tmin-height: 80px;\n\tposition: relative;\n\twidth: 100%;\n\n\t", "\n"])), system_1.system);
|
|
77
77
|
exports.Textarea = core_1.vui(function (props, ref) {
|
|
78
78
|
var _a = __read(react_1.useState(helpers_1.getInitialCount(props)), 2), count = _a[0], setCount = _a[1];
|
|
79
|
-
var _b = core_1.omitThemingProps(props), autoFocus = _b.autoFocus, className = _b.className, colorSchemeProp = _b.colorScheme, defaultValue = _b.defaultValue, disabled = _b.disabled, isInvalid = _b.isInvalid, maxLength = _b.maxLength, name = _b.name, onBlur = _b.onBlur, onChangeProp = _b.onChange, onFocus = _b.onFocus, placeholder = _b.placeholder, readOnly = _b.readOnly, required = _b.required, resize = _b.resize, showCount = _b.showCount, _c = _b.textareaProps, textareaProps = _c === void 0 ? {} : _c, textareaRef = _b.textareaRef, value = _b.value, rest = __rest(_b, ["autoFocus", "className", "colorScheme", "defaultValue", "disabled", "isInvalid", "maxLength", "name", "onBlur", "onChange", "onFocus", "placeholder", "readOnly", "required", "resize", "showCount", "textareaProps", "textareaRef", "value"]);
|
|
79
|
+
var _b = core_1.omitThemingProps(props), autoFocus = _b.autoFocus, className = _b.className, colorSchemeProp = _b.colorScheme, defaultValue = _b.defaultValue, disabled = _b.disabled, id = _b.id, isInvalid = _b.isInvalid, maxLength = _b.maxLength, name = _b.name, onBlur = _b.onBlur, onChangeProp = _b.onChange, onFocus = _b.onFocus, placeholder = _b.placeholder, readOnly = _b.readOnly, required = _b.required, resize = _b.resize, showCount = _b.showCount, _c = _b.textareaProps, textareaProps = _c === void 0 ? {} : _c, textareaRef = _b.textareaRef, value = _b.value, rest = __rest(_b, ["autoFocus", "className", "colorScheme", "defaultValue", "disabled", "id", "isInvalid", "maxLength", "name", "onBlur", "onChange", "onFocus", "placeholder", "readOnly", "required", "resize", "showCount", "textareaProps", "textareaRef", "value"]);
|
|
80
80
|
var colorProps = utils_1.filterUndefined({
|
|
81
81
|
colorScheme: colorSchemeProp !== null && colorSchemeProp !== void 0 ? colorSchemeProp : (isInvalid ? 'red' : undefined)
|
|
82
82
|
});
|
|
@@ -95,6 +95,7 @@ exports.Textarea = core_1.vui(function (props, ref) {
|
|
|
95
95
|
autoFocus: autoFocus,
|
|
96
96
|
defaultValue: defaultValue,
|
|
97
97
|
disabled: disabled,
|
|
98
|
+
id: id,
|
|
98
99
|
maxLength: maxLength,
|
|
99
100
|
name: name,
|
|
100
101
|
onBlur: onBlur,
|
|
@@ -4,6 +4,7 @@ import { SystemProps } from '../system';
|
|
|
4
4
|
import { ThemingProps } from '../theme';
|
|
5
5
|
export interface TextareaProps extends SystemProps, ThemingProps<'Textarea'> {
|
|
6
6
|
autoFocus?: boolean;
|
|
7
|
+
children?: never;
|
|
7
8
|
colorScheme?: 'green' | 'grey' | 'red';
|
|
8
9
|
cols?: number;
|
|
9
10
|
defaultValue?: number | string;
|
package/theme/components.d.ts
CHANGED
|
@@ -1,48 +1,4 @@
|
|
|
1
1
|
declare const _default: {
|
|
2
|
-
Alert: {
|
|
3
|
-
defaultProps: {
|
|
4
|
-
colorScheme: string;
|
|
5
|
-
variant: string;
|
|
6
|
-
};
|
|
7
|
-
parts: string[];
|
|
8
|
-
sizes: {};
|
|
9
|
-
variants: {
|
|
10
|
-
solid: (props: import("..").Dict<any>) => {
|
|
11
|
-
container: {
|
|
12
|
-
bg: string;
|
|
13
|
-
color: string;
|
|
14
|
-
};
|
|
15
|
-
button: {
|
|
16
|
-
bg: string;
|
|
17
|
-
borderColor: string;
|
|
18
|
-
hoverBg: string;
|
|
19
|
-
hoverBorderColor: string;
|
|
20
|
-
};
|
|
21
|
-
icon: {};
|
|
22
|
-
message: {};
|
|
23
|
-
text: {};
|
|
24
|
-
title: {};
|
|
25
|
-
};
|
|
26
|
-
subtle: (props: import("..").Dict<any>) => {
|
|
27
|
-
container: {
|
|
28
|
-
bg: string;
|
|
29
|
-
borderColor: string;
|
|
30
|
-
borderWidth: number;
|
|
31
|
-
color: string;
|
|
32
|
-
};
|
|
33
|
-
button: {
|
|
34
|
-
color: string;
|
|
35
|
-
hoverBg: string;
|
|
36
|
-
activeBg: string;
|
|
37
|
-
variant: string;
|
|
38
|
-
};
|
|
39
|
-
icon: {};
|
|
40
|
-
message: {};
|
|
41
|
-
text: {};
|
|
42
|
-
title: {};
|
|
43
|
-
};
|
|
44
|
-
};
|
|
45
|
-
};
|
|
46
2
|
Avatar: {
|
|
47
3
|
defaultProps: {
|
|
48
4
|
colorScheme: string;
|
|
@@ -508,6 +464,34 @@ declare const _default: {
|
|
|
508
464
|
};
|
|
509
465
|
};
|
|
510
466
|
};
|
|
467
|
+
Notification: {
|
|
468
|
+
defaultProps: {
|
|
469
|
+
colorScheme: string;
|
|
470
|
+
variant: string;
|
|
471
|
+
};
|
|
472
|
+
parts: string[];
|
|
473
|
+
sizes: {};
|
|
474
|
+
variants: {
|
|
475
|
+
subtle: (props: import("..").Dict<any>) => {
|
|
476
|
+
container: {
|
|
477
|
+
bg: string;
|
|
478
|
+
borderColor: string;
|
|
479
|
+
borderWidth: number;
|
|
480
|
+
color: string;
|
|
481
|
+
};
|
|
482
|
+
button: {
|
|
483
|
+
color: string;
|
|
484
|
+
hoverBg: string;
|
|
485
|
+
activeBg: string;
|
|
486
|
+
variant: string;
|
|
487
|
+
};
|
|
488
|
+
icon: {};
|
|
489
|
+
message: {};
|
|
490
|
+
text: {};
|
|
491
|
+
title: {};
|
|
492
|
+
};
|
|
493
|
+
};
|
|
494
|
+
};
|
|
511
495
|
P: {
|
|
512
496
|
defaultProps: {
|
|
513
497
|
size: string;
|
package/theme/components.js
CHANGED
|
@@ -3,19 +3,19 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
var theme_1 = __importDefault(require("../
|
|
7
|
-
var theme_2 = __importDefault(require("../
|
|
8
|
-
var theme_3 = __importDefault(require("../
|
|
9
|
-
var theme_4 = __importDefault(require("../
|
|
10
|
-
var theme_5 = __importDefault(require("../
|
|
11
|
-
var theme_6 = __importDefault(require("../
|
|
12
|
-
var theme_7 = __importDefault(require("../
|
|
13
|
-
var theme_8 = __importDefault(require("../
|
|
14
|
-
var theme_9 = __importDefault(require("../
|
|
15
|
-
var theme_10 = __importDefault(require("../
|
|
16
|
-
var theme_11 = __importDefault(require("../
|
|
17
|
-
var theme_12 = __importDefault(require("../
|
|
18
|
-
var theme_13 = __importDefault(require("../
|
|
6
|
+
var theme_1 = __importDefault(require("../avatar/theme"));
|
|
7
|
+
var theme_2 = __importDefault(require("../box/theme"));
|
|
8
|
+
var theme_3 = __importDefault(require("../button/theme"));
|
|
9
|
+
var theme_4 = __importDefault(require("../card/theme"));
|
|
10
|
+
var theme_5 = __importDefault(require("../checkbox/theme"));
|
|
11
|
+
var theme_6 = __importDefault(require("../divider/theme"));
|
|
12
|
+
var theme_7 = __importDefault(require("../heading/theme"));
|
|
13
|
+
var theme_8 = __importDefault(require("../icon/theme"));
|
|
14
|
+
var theme_9 = __importDefault(require("../image/theme"));
|
|
15
|
+
var theme_10 = __importDefault(require("../input/theme"));
|
|
16
|
+
var theme_11 = __importDefault(require("../link/theme"));
|
|
17
|
+
var theme_12 = __importDefault(require("../list/theme"));
|
|
18
|
+
var theme_13 = __importDefault(require("../notification/theme"));
|
|
19
19
|
var theme_14 = __importDefault(require("../p/theme"));
|
|
20
20
|
var theme_15 = __importDefault(require("../panel/theme"));
|
|
21
21
|
var theme_16 = __importDefault(require("../radio/theme"));
|
|
@@ -26,19 +26,19 @@ var theme_20 = __importDefault(require("../t/theme"));
|
|
|
26
26
|
var theme_21 = __importDefault(require("../tag/theme"));
|
|
27
27
|
var theme_22 = __importDefault(require("../textarea/theme"));
|
|
28
28
|
exports.default = {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
29
|
+
Avatar: theme_1.default,
|
|
30
|
+
Box: theme_2.default,
|
|
31
|
+
Button: theme_3.default,
|
|
32
|
+
Card: theme_4.default,
|
|
33
|
+
Checkbox: theme_5.default,
|
|
34
|
+
Divider: theme_6.default,
|
|
35
|
+
Heading: theme_7.default,
|
|
36
|
+
Icon: theme_8.default,
|
|
37
|
+
Image: theme_9.default,
|
|
38
|
+
Input: theme_10.default,
|
|
39
|
+
Link: theme_11.default,
|
|
40
|
+
List: theme_12.default,
|
|
41
|
+
Notification: theme_13.default,
|
|
42
42
|
P: theme_14.default,
|
|
43
43
|
Panel: theme_15.default,
|
|
44
44
|
Radio: theme_16.default,
|
package/theme/defaultTheme.d.ts
CHANGED
|
@@ -161,50 +161,6 @@ declare const defaultTheme: {
|
|
|
161
161
|
transitions: {};
|
|
162
162
|
zIndices: {};
|
|
163
163
|
components: {
|
|
164
|
-
Alert: {
|
|
165
|
-
defaultProps: {
|
|
166
|
-
colorScheme: string;
|
|
167
|
-
variant: string;
|
|
168
|
-
};
|
|
169
|
-
parts: string[];
|
|
170
|
-
sizes: {};
|
|
171
|
-
variants: {
|
|
172
|
-
solid: (props: import("..").Dict<any>) => {
|
|
173
|
-
container: {
|
|
174
|
-
bg: string;
|
|
175
|
-
color: string;
|
|
176
|
-
};
|
|
177
|
-
button: {
|
|
178
|
-
bg: string;
|
|
179
|
-
borderColor: string;
|
|
180
|
-
hoverBg: string;
|
|
181
|
-
hoverBorderColor: string;
|
|
182
|
-
};
|
|
183
|
-
icon: {};
|
|
184
|
-
message: {};
|
|
185
|
-
text: {};
|
|
186
|
-
title: {};
|
|
187
|
-
};
|
|
188
|
-
subtle: (props: import("..").Dict<any>) => {
|
|
189
|
-
container: {
|
|
190
|
-
bg: string;
|
|
191
|
-
borderColor: string;
|
|
192
|
-
borderWidth: number;
|
|
193
|
-
color: string;
|
|
194
|
-
};
|
|
195
|
-
button: {
|
|
196
|
-
color: string;
|
|
197
|
-
hoverBg: string;
|
|
198
|
-
activeBg: string;
|
|
199
|
-
variant: string;
|
|
200
|
-
};
|
|
201
|
-
icon: {};
|
|
202
|
-
message: {};
|
|
203
|
-
text: {};
|
|
204
|
-
title: {};
|
|
205
|
-
};
|
|
206
|
-
};
|
|
207
|
-
};
|
|
208
164
|
Avatar: {
|
|
209
165
|
defaultProps: {
|
|
210
166
|
colorScheme: string;
|
|
@@ -670,6 +626,34 @@ declare const defaultTheme: {
|
|
|
670
626
|
};
|
|
671
627
|
};
|
|
672
628
|
};
|
|
629
|
+
Notification: {
|
|
630
|
+
defaultProps: {
|
|
631
|
+
colorScheme: string;
|
|
632
|
+
variant: string;
|
|
633
|
+
};
|
|
634
|
+
parts: string[];
|
|
635
|
+
sizes: {};
|
|
636
|
+
variants: {
|
|
637
|
+
subtle: (props: import("..").Dict<any>) => {
|
|
638
|
+
container: {
|
|
639
|
+
bg: string;
|
|
640
|
+
borderColor: string;
|
|
641
|
+
borderWidth: number;
|
|
642
|
+
color: string;
|
|
643
|
+
};
|
|
644
|
+
button: {
|
|
645
|
+
color: string;
|
|
646
|
+
hoverBg: string;
|
|
647
|
+
activeBg: string;
|
|
648
|
+
variant: string;
|
|
649
|
+
};
|
|
650
|
+
icon: {};
|
|
651
|
+
message: {};
|
|
652
|
+
text: {};
|
|
653
|
+
title: {};
|
|
654
|
+
};
|
|
655
|
+
};
|
|
656
|
+
};
|
|
673
657
|
P: {
|
|
674
658
|
defaultProps: {
|
|
675
659
|
size: string;
|
package/utils/assertion.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { Dict } from './types';
|
|
3
3
|
/** Is value an array. */
|
|
4
|
-
export declare function isArray<T>(value: any): value is
|
|
4
|
+
export declare function isArray<T>(value: any): value is T[];
|
|
5
5
|
/** Is value a function. */
|
|
6
6
|
export declare function isFunction<T>(value: any): value is T;
|
|
7
7
|
/** Is value a number. */
|
package/utils/object.d.ts
CHANGED
|
@@ -1,13 +1,6 @@
|
|
|
1
1
|
import { Dict } from './types';
|
|
2
2
|
/** Removes keys from an object if their value is undefined. */
|
|
3
3
|
export declare const filterUndefined: (object: Dict) => Dict<any>;
|
|
4
|
-
/**
|
|
5
|
-
* Recursively retrieves a nested property of a given object
|
|
6
|
-
* @param object
|
|
7
|
-
* @param path string, such as: 'user.name', or array ['user', 'name']
|
|
8
|
-
* @param separator used when path is a string to split individual keys
|
|
9
|
-
*/
|
|
10
|
-
export declare function get(object: Dict, path: string | string[], separator?: string): any | undefined;
|
|
11
4
|
/**
|
|
12
5
|
* Recursively deep merges two objects in an immutable fashion, following these rules:
|
|
13
6
|
* - Key exists in target and both keys are objects => merge
|
|
@@ -15,11 +8,7 @@ export declare function get(object: Dict, path: string | string[], separator?: s
|
|
|
15
8
|
* - Key isn't an object, an array or doesn't exist in target => override
|
|
16
9
|
*/
|
|
17
10
|
export declare function merge<Target extends Dict, Source extends Dict>(target: Target, source: Source): Target & Source;
|
|
18
|
-
declare type FilterFn<T> = (value: any, key: string, object: T) => boolean;
|
|
19
11
|
/**
|
|
20
12
|
* Returns the items of an object that meet the condition specified in a callback function.
|
|
21
13
|
*/
|
|
22
|
-
export declare function objectFilter<T extends Dict>(object: T, fn:
|
|
23
|
-
/** Removes given keys from an object. */
|
|
24
|
-
export declare function omit<T extends Dict, K extends keyof T>(object: T, keys: K[]): Omit<T, K>;
|
|
25
|
-
export {};
|
|
14
|
+
export declare function objectFilter<T extends Dict>(object: T, fn: (value: any, key: string, object: T) => boolean): Dict<any>;
|
package/utils/object.js
CHANGED
|
@@ -11,25 +11,11 @@ var __assign = (this && this.__assign) || function () {
|
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.
|
|
14
|
+
exports.objectFilter = exports.merge = exports.filterUndefined = void 0;
|
|
15
15
|
var assertion_1 = require("./assertion");
|
|
16
16
|
/** Removes keys from an object if their value is undefined. */
|
|
17
17
|
var filterUndefined = function (object) { return objectFilter(object, function (val) { return val !== null && val !== undefined; }); };
|
|
18
18
|
exports.filterUndefined = filterUndefined;
|
|
19
|
-
/**
|
|
20
|
-
* Recursively retrieves a nested property of a given object
|
|
21
|
-
* @param object
|
|
22
|
-
* @param path string, such as: 'user.name', or array ['user', 'name']
|
|
23
|
-
* @param separator used when path is a string to split individual keys
|
|
24
|
-
*/
|
|
25
|
-
function get(object, path, separator) {
|
|
26
|
-
if (separator === void 0) { separator = '.'; }
|
|
27
|
-
if (!assertion_1.isObject(object))
|
|
28
|
-
return;
|
|
29
|
-
var keys = Array.isArray(path) ? path : path.split(separator);
|
|
30
|
-
return keys.reduce(function (obj, property) { return obj === null || obj === void 0 ? void 0 : obj[property]; }, object);
|
|
31
|
-
}
|
|
32
|
-
exports.get = get;
|
|
33
19
|
/**
|
|
34
20
|
* Recursively deep merges two objects in an immutable fashion, following these rules:
|
|
35
21
|
* - Key exists in target and both keys are objects => merge
|
|
@@ -72,14 +58,3 @@ function objectFilter(object, fn) {
|
|
|
72
58
|
return result;
|
|
73
59
|
}
|
|
74
60
|
exports.objectFilter = objectFilter;
|
|
75
|
-
/** Removes given keys from an object. */
|
|
76
|
-
function omit(object, keys) {
|
|
77
|
-
var result = {};
|
|
78
|
-
Object.keys(object).forEach(function (key) {
|
|
79
|
-
if (keys.includes(key))
|
|
80
|
-
return;
|
|
81
|
-
result[key] = object[key];
|
|
82
|
-
});
|
|
83
|
-
return result;
|
|
84
|
-
}
|
|
85
|
-
exports.omit = omit;
|
package/alert/alert.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { AlertProps } from './alert.types';
|
|
2
|
-
import AlertButton from './alertButton';
|
|
3
|
-
import AlertIcon from './alertIcon';
|
|
4
|
-
import AlertText from './alertText';
|
|
5
|
-
import AlertTitle from './alertTitle';
|
|
6
|
-
import { VuiComponent } from '../core';
|
|
7
|
-
export declare const Alert: VuiComponent<"div", AlertProps> & {
|
|
8
|
-
Button: typeof AlertButton;
|
|
9
|
-
Icon: typeof AlertIcon;
|
|
10
|
-
Text: typeof AlertText;
|
|
11
|
-
Title: typeof AlertTitle;
|
|
12
|
-
};
|
|
13
|
-
export default Alert;
|
package/alert/alert.types.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
import { BoxProps } from '../box';
|
|
3
|
-
import { IconProp, IconProps } from '../icon';
|
|
4
|
-
import { ThemingProps } from '../theme';
|
|
5
|
-
import { AnyElement } from '../utils';
|
|
6
|
-
export interface AlertProps extends Omit<BoxProps, 'size' | 'variant'>, ThemingProps<'Alert'> {
|
|
7
|
-
action?: ReactNode;
|
|
8
|
-
colorScheme?: 'blue' | 'green' | 'grey' | 'prussian' | 'red' | 'yellow';
|
|
9
|
-
icon?: IconProp | AnyElement;
|
|
10
|
-
onClose?: () => void;
|
|
11
|
-
status?: AlertStatus;
|
|
12
|
-
statusMapping?: AlertStatusMapping;
|
|
13
|
-
text?: ReactNode;
|
|
14
|
-
title?: ReactNode;
|
|
15
|
-
}
|
|
16
|
-
export declare type AlertStatus = 'error' | 'info' | 'loading' | 'success' | 'warning';
|
|
17
|
-
export declare type AlertStatusMapping = Record<string, {
|
|
18
|
-
colorScheme?: AlertProps['colorScheme'];
|
|
19
|
-
iconProps: IconProps;
|
|
20
|
-
}>;
|
package/alert/alertButton.d.ts
DELETED
package/alert/alertIcon.d.ts
DELETED
package/alert/alertText.d.ts
DELETED
package/alert/alertTitle.d.ts
DELETED
package/alert/consts.d.ts
DELETED
package/alert/context.d.ts
DELETED
package/alert/index.d.ts
DELETED
|
File without changes
|