@veracity/vui 0.1.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/avatar/avatar.js +5 -5
- package/box/box.js +6 -6
- package/button/button.js +19 -23
- package/button/button.types.d.ts +33 -3
- package/button/buttonIcon.js +3 -3
- package/button/buttonText.js +3 -3
- package/button/buttons.js +8 -8
- package/button/context.js +1 -1
- package/button/theme.js +0 -6
- package/buttonGroup/buttonGroup.js +5 -10
- package/buttonGroup/context.js +1 -1
- package/card/card.js +4 -4
- package/checkbox/checkbox.js +13 -13
- package/checkbox/checkboxGroup.js +7 -7
- package/checkbox/checkboxGroup.types.d.ts +1 -1
- package/checkbox/context.js +1 -1
- package/checkbox/theme.js +5 -2
- package/core/globalStyle.js +2 -3
- package/core/resetCSS.js +1 -1
- package/core/styled.js +11 -7
- package/core/utils.js +10 -10
- package/core/v.js +1 -1
- package/divider/divider.js +6 -6
- package/divider/divider.types.d.ts +1 -0
- package/heading/heading.js +6 -6
- package/heading/headings.js +6 -6
- package/icon/icon.js +6 -6
- package/icons/library.js +9 -5
- package/image/image.js +4 -4
- package/image/image.types.d.ts +1 -0
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/input/context.js +1 -1
- package/input/input.js +13 -17
- package/input/inputIcon.js +3 -3
- package/input/inputInput.js +4 -4
- package/link/link.js +6 -6
- package/list/context.js +1 -1
- package/list/list.js +6 -11
- package/list/listHeading.js +3 -3
- package/list/listIcon.js +3 -3
- package/list/listItem.js +8 -8
- package/list/listText.js +3 -3
- 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} +21 -26
- package/notification/notification.types.d.ts +20 -0
- package/notification/notificationButton.d.ts +3 -0
- package/notification/notificationButton.js +30 -0
- 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/p/p.js +6 -6
- package/package.json +2 -3
- package/panel/panel.js +4 -4
- package/radio/context.js +1 -1
- package/radio/radio.js +59 -14
- package/radio/radioGroup.js +25 -17
- package/radio/radioGroup.types.d.ts +1 -1
- package/radio/theme.js +5 -2
- package/skeleton/skeleton.js +6 -6
- package/skeleton/skeleton.types.d.ts +1 -0
- package/spinner/spinner.js +5 -5
- package/spinner/spinner.types.d.ts +1 -0
- package/svg/cache.js +1 -5
- package/svg/svg.js +14 -15
- package/switch/context.js +1 -1
- package/switch/switch.js +13 -51
- package/switch/switch.types.d.ts +2 -2
- package/switch/switchButton.js +21 -23
- package/switch/switchLabel.js +3 -3
- package/system/custom.d.ts +11 -7
- package/system/custom.js +24 -13
- package/system/system.d.ts +4 -3
- package/system/system.js +2 -2
- package/system/tables.d.ts +14 -0
- package/system/tables.js +2 -0
- package/t/t.js +6 -6
- package/tag/context.js +1 -1
- package/tag/index.d.ts +1 -0
- package/tag/index.js +1 -0
- package/tag/tag.d.ts +2 -0
- package/tag/tag.js +14 -12
- package/tag/tag.types.d.ts +1 -0
- package/tag/tagButton.d.ts +3 -0
- package/{alert/alertButton.js → tag/tagButton.js} +9 -9
- package/tag/tagIcon.js +3 -3
- package/tag/tagText.js +3 -3
- package/tag/theme.d.ts +26 -0
- package/tag/theme.js +32 -3
- package/textarea/textarea.js +10 -9
- package/textarea/textarea.types.d.ts +1 -0
- package/theme/components.d.ts +54 -44
- package/theme/components.js +26 -26
- package/theme/defaultTheme.d.ts +54 -44
- package/theme/foundations/shadows.js +2 -2
- package/theme/index.d.ts +16 -0
- package/theme/index.js +33 -1
- package/utils/assertion.d.ts +1 -1
- package/utils/assertion.js +1 -2
- package/utils/function.js +9 -5
- package/utils/object.d.ts +1 -12
- package/utils/object.js +4 -29
- 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
|
@@ -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((0, 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,42 +44,37 @@ 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 = (0, 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('
|
|
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
|
-
var context = react_1.useMemo(function () { return utils_1.filterUndefined({ colorScheme: colorScheme, size: size, status: status, variant: variant }); }, [
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
]);
|
|
71
|
-
return (react_1.default.createElement(context_1.AlertProvider, { value: context },
|
|
72
|
-
react_1.default.createElement(box_1.default, __assign({ borderRadius: "md", className: utils_1.cs('vui-alert', className), px: 1.5, py: 1, ref: ref, w: "fit-content" }, styles.container, rest),
|
|
73
|
-
iconName ? react_1.default.createElement(alertIcon_1.default, { name: iconName }) : icon, children !== null && children !== void 0 ? children : (react_1.default.createElement(alertText_1.default, null,
|
|
74
|
-
utils_1.isReactText(title) ? react_1.default.createElement(alertTitle_1.default, { text: title }) : title,
|
|
63
|
+
var styles = (0, core_1.useStyleConfig)('Notification', __assign({ colorScheme: colorScheme }, props));
|
|
64
|
+
var iconName = (0, 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
|
+
var context = (0, react_1.useMemo)(function () { return (0, utils_1.filterUndefined)({ colorScheme: colorScheme, size: size, status: status, variant: variant }); }, [colorScheme, size, status, variant]);
|
|
66
|
+
return (react_1.default.createElement(context_1.NotificationProvider, { value: context },
|
|
67
|
+
react_1.default.createElement(box_1.default, __assign({ borderRadius: "md", className: (0, utils_1.cs)('vui-notification', className), px: 1.5, py: 1, ref: ref, w: "fit-content" }, styles.container, rest),
|
|
68
|
+
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,
|
|
69
|
+
(0, utils_1.isReactText)(title) ? react_1.default.createElement(notificationTitle_1.default, { text: title }) : title,
|
|
75
70
|
" ",
|
|
76
71
|
text)),
|
|
77
72
|
action,
|
|
78
|
-
onClose && react_1.default.createElement(
|
|
73
|
+
onClose && react_1.default.createElement(notificationButton_1.default, { icon: "falTimes", onClick: onClose }))));
|
|
79
74
|
});
|
|
80
|
-
exports.
|
|
81
|
-
exports.
|
|
82
|
-
exports.
|
|
83
|
-
exports.
|
|
84
|
-
exports.
|
|
85
|
-
exports.default = exports.
|
|
75
|
+
exports.Notification.displayName = 'Notification';
|
|
76
|
+
exports.Notification.Button = notificationButton_1.default;
|
|
77
|
+
exports.Notification.Icon = notificationIcon_1.default;
|
|
78
|
+
exports.Notification.Text = notificationText_1.default;
|
|
79
|
+
exports.Notification.Title = notificationTitle_1.default;
|
|
80
|
+
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
|
+
}>;
|
|
@@ -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.NotificationButton = void 0;
|
|
18
|
+
var react_1 = __importDefault(require("react"));
|
|
19
|
+
var context_1 = require("./context");
|
|
20
|
+
var core_1 = require("../core");
|
|
21
|
+
var button_1 = __importDefault(require("../button"));
|
|
22
|
+
exports.NotificationButton = (0, core_1.vui)(function (props, ref) {
|
|
23
|
+
var _a;
|
|
24
|
+
var notificationProps = (_a = (0, context_1.useNotification)()) !== null && _a !== void 0 ? _a : {};
|
|
25
|
+
var mergedProps = __assign(__assign({}, notificationProps), props);
|
|
26
|
+
var styles = (0, 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
|
+
});
|
|
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 = (0, 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 = (0, context_1.useNotification)()) !== null && _a !== void 0 ? _a : {};
|
|
26
|
+
var mergedProps = __assign(__assign({}, notificationProps), props);
|
|
27
|
+
var styles = (0, 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 = (0, 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 = (0, context_1.useNotification)()) !== null && _a !== void 0 ? _a : {};
|
|
25
|
+
var mergedProps = __assign(__assign({}, notificationProps), props);
|
|
26
|
+
var styles = (0, 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 = (0, 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 = (0, context_1.useNotification)()) !== null && _a !== void 0 ? _a : {};
|
|
25
|
+
var mergedProps = __assign(__assign({}, notificationProps), props);
|
|
26
|
+
var styles = (0, 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/p/p.js
CHANGED
|
@@ -35,17 +35,17 @@ var styled_components_1 = __importDefault(require("styled-components"));
|
|
|
35
35
|
var core_1 = require("../core");
|
|
36
36
|
var system_1 = require("../system");
|
|
37
37
|
var utils_1 = require("../utils");
|
|
38
|
-
exports.PBase = styled_components_1.default.p.withConfig(core_1.forwardPropConfig(system_1.system))(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n\t", "\n"], ["\n\t", "\n"])), system_1.system);
|
|
39
|
-
exports.P = core_1.vui(function (props, ref) {
|
|
40
|
-
var _a = core_1.omitThemingProps(props), align = _a.align, casing = _a.casing, children = _a.children, className = _a.className, decoration = _a.decoration, text = _a.text, weight = _a.weight, rest = __rest(_a, ["align", "casing", "children", "className", "decoration", "text", "weight"]);
|
|
41
|
-
var styles = core_1.useStyleConfig('P', props);
|
|
42
|
-
var aliasedProps = utils_1.filterUndefined({
|
|
38
|
+
exports.PBase = styled_components_1.default.p.withConfig((0, core_1.forwardPropConfig)(system_1.system))(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n\t", "\n"], ["\n\t", "\n"])), system_1.system);
|
|
39
|
+
exports.P = (0, core_1.vui)(function (props, ref) {
|
|
40
|
+
var _a = (0, core_1.omitThemingProps)(props), align = _a.align, casing = _a.casing, children = _a.children, className = _a.className, decoration = _a.decoration, text = _a.text, weight = _a.weight, rest = __rest(_a, ["align", "casing", "children", "className", "decoration", "text", "weight"]);
|
|
41
|
+
var styles = (0, core_1.useStyleConfig)('P', props);
|
|
42
|
+
var aliasedProps = (0, utils_1.filterUndefined)({
|
|
43
43
|
fontWeight: weight,
|
|
44
44
|
textAlign: align,
|
|
45
45
|
textDecoration: decoration,
|
|
46
46
|
textTransform: casing
|
|
47
47
|
});
|
|
48
|
-
return (react_1.default.createElement(exports.PBase, __assign({ className: utils_1.cs('vui-p', className), ref: ref, transitionDuration: "fast" }, styles, aliasedProps, rest), children !== null && children !== void 0 ? children : text));
|
|
48
|
+
return (react_1.default.createElement(exports.PBase, __assign({ className: (0, utils_1.cs)('vui-p', className), ref: ref, transitionDuration: "fast" }, styles, aliasedProps, rest), children !== null && children !== void 0 ? children : text));
|
|
49
49
|
});
|
|
50
50
|
exports.P.displayName = 'P';
|
|
51
51
|
exports.default = exports.P;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@veracity/vui",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
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/panel/panel.js
CHANGED
|
@@ -30,10 +30,10 @@ var react_1 = __importDefault(require("react"));
|
|
|
30
30
|
var box_1 = __importDefault(require("../box"));
|
|
31
31
|
var core_1 = require("../core");
|
|
32
32
|
var utils_1 = require("../utils");
|
|
33
|
-
exports.Panel = core_1.vui(function (props, ref) {
|
|
34
|
-
var _a = core_1.omitThemingProps(props), className = _a.className, rest = __rest(_a, ["className"]);
|
|
35
|
-
var styles = core_1.useStyleConfig('Panel', props);
|
|
36
|
-
return (react_1.default.createElement(box_1.default, __assign({ bg: "white", borderRadius: "md", className: utils_1.cs('vui-panel', className), p: 2, ref: ref }, styles, rest)));
|
|
33
|
+
exports.Panel = (0, core_1.vui)(function (props, ref) {
|
|
34
|
+
var _a = (0, core_1.omitThemingProps)(props), className = _a.className, rest = __rest(_a, ["className"]);
|
|
35
|
+
var styles = (0, core_1.useStyleConfig)('Panel', props);
|
|
36
|
+
return (react_1.default.createElement(box_1.default, __assign({ bg: "white", borderRadius: "md", className: (0, utils_1.cs)('vui-panel', className), p: 2, ref: ref }, styles, rest)));
|
|
37
37
|
});
|
|
38
38
|
exports.Panel.displayName = 'Panel';
|
|
39
39
|
exports.default = exports.Panel;
|
package/radio/context.js
CHANGED
|
@@ -18,6 +18,6 @@ var __read = (this && this.__read) || function (o, n) {
|
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
19
|
exports.useRadioGroup = exports.RadioGroupProvider = void 0;
|
|
20
20
|
var core_1 = require("../core");
|
|
21
|
-
var _a = __read(core_1.createContext({ isOptional: true }), 2), RadioGroupProvider = _a[0], useRadioGroup = _a[1];
|
|
21
|
+
var _a = __read((0, core_1.createContext)({ isOptional: true }), 2), RadioGroupProvider = _a[0], useRadioGroup = _a[1];
|
|
22
22
|
exports.RadioGroupProvider = RadioGroupProvider;
|
|
23
23
|
exports.useRadioGroup = useRadioGroup;
|
package/radio/radio.js
CHANGED
|
@@ -14,6 +14,25 @@ var __assign = (this && this.__assign) || function () {
|
|
|
14
14
|
};
|
|
15
15
|
return __assign.apply(this, arguments);
|
|
16
16
|
};
|
|
17
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
18
|
+
if (k2 === undefined) k2 = k;
|
|
19
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
20
|
+
}) : (function(o, m, k, k2) {
|
|
21
|
+
if (k2 === undefined) k2 = k;
|
|
22
|
+
o[k2] = m[k];
|
|
23
|
+
}));
|
|
24
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
25
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
26
|
+
}) : function(o, v) {
|
|
27
|
+
o["default"] = v;
|
|
28
|
+
});
|
|
29
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
30
|
+
if (mod && mod.__esModule) return mod;
|
|
31
|
+
var result = {};
|
|
32
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
33
|
+
__setModuleDefault(result, mod);
|
|
34
|
+
return result;
|
|
35
|
+
};
|
|
17
36
|
var __rest = (this && this.__rest) || function (s, e) {
|
|
18
37
|
var t = {};
|
|
19
38
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -25,12 +44,28 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
25
44
|
}
|
|
26
45
|
return t;
|
|
27
46
|
};
|
|
47
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
48
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
49
|
+
if (!m) return o;
|
|
50
|
+
var i = m.call(o), r, ar = [], e;
|
|
51
|
+
try {
|
|
52
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
53
|
+
}
|
|
54
|
+
catch (error) { e = { error: error }; }
|
|
55
|
+
finally {
|
|
56
|
+
try {
|
|
57
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
58
|
+
}
|
|
59
|
+
finally { if (e) throw e.error; }
|
|
60
|
+
}
|
|
61
|
+
return ar;
|
|
62
|
+
};
|
|
28
63
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
29
64
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
30
65
|
};
|
|
31
66
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
67
|
exports.Radio = exports.RadioControl = exports.RadioBase = exports.RadioInput = void 0;
|
|
33
|
-
var react_1 =
|
|
68
|
+
var react_1 = __importStar(require("react"));
|
|
34
69
|
var styled_components_1 = __importDefault(require("styled-components"));
|
|
35
70
|
var context_1 = require("./context");
|
|
36
71
|
var core_1 = require("../core");
|
|
@@ -39,26 +74,36 @@ var system_1 = require("../system");
|
|
|
39
74
|
var t_1 = __importDefault(require("../t"));
|
|
40
75
|
var utils_1 = require("../utils");
|
|
41
76
|
exports.RadioInput = styled_components_1.default.input(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n\tcursor: inherit;\n\theight: 100%;\n\tleft: 0;\n\tmargin: 0;\n\topacity: 0;\n\tpadding: 0;\n\tposition: absolute;\n\ttop: 0;\n\twidth: 100%;\n\tz-index: 1;\n"], ["\n\tcursor: inherit;\n\theight: 100%;\n\tleft: 0;\n\tmargin: 0;\n\topacity: 0;\n\tpadding: 0;\n\tposition: absolute;\n\ttop: 0;\n\twidth: 100%;\n\tz-index: 1;\n"])));
|
|
42
|
-
exports.RadioBase = styled_components_1.default.label.withConfig(core_1.forwardPropConfig(system_1.system))(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n\talign-items: center;\n\tcursor: pointer;\n\tdisplay: inline-flex;\n\twidth: fit-content;\n\n\t:hover .vui-radioControl {\n\t\tcolor: ", ";\n\t}\n\n\t&.disabled {\n\t\tcolor: var(--vui-colors-disabled-font);\n\t\tcursor: not-allowed;\n\n\t\t.vui-radioControl {\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\twidth: fit-content;\n\n\t:hover .vui-radioControl {\n\t\tcolor: ", ";\n\t}\n\n\t&.disabled {\n\t\tcolor: var(--vui-colors-disabled-font);\n\t\tcursor: not-allowed;\n\n\t\t.vui-radioControl {\n\t\t\tcolor: var(--vui-colors-disabled-font);\n\t\t}\n\t}\n\n\t", "\n"])), function (p) { return core_1.th.color(p.controlHoverColor)(p); }, system_1.system);
|
|
43
|
-
exports.RadioControl = styled_components_1.default.span.withConfig(core_1.forwardPropConfig(system_1.system))(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n\tdisplay: inline-flex;\n\tflex-shrink: 0;\n\tposition: relative;\n\n\t", "\n"], ["\n\tdisplay: inline-flex;\n\tflex-shrink: 0;\n\tposition: relative;\n\n\t", "\n"])), system_1.system);
|
|
44
|
-
exports.Radio = core_1.vui(function (props, ref) {
|
|
45
|
-
var _a;
|
|
46
|
-
var
|
|
77
|
+
exports.RadioBase = styled_components_1.default.label.withConfig((0, core_1.forwardPropConfig)(system_1.system))(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n\talign-items: center;\n\tcursor: pointer;\n\tdisplay: inline-flex;\n\twidth: fit-content;\n\n\t:hover .vui-radioControl {\n\t\tcolor: ", ";\n\t}\n\n\t&.disabled {\n\t\tcolor: var(--vui-colors-disabled-font);\n\t\tcursor: not-allowed;\n\n\t\t.vui-radioControl {\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\twidth: fit-content;\n\n\t:hover .vui-radioControl {\n\t\tcolor: ", ";\n\t}\n\n\t&.disabled {\n\t\tcolor: var(--vui-colors-disabled-font);\n\t\tcursor: not-allowed;\n\n\t\t.vui-radioControl {\n\t\t\tcolor: var(--vui-colors-disabled-font);\n\t\t}\n\t}\n\n\t", "\n"])), function (p) { return core_1.th.color(p.controlHoverColor)(p); }, system_1.system);
|
|
78
|
+
exports.RadioControl = styled_components_1.default.span.withConfig((0, core_1.forwardPropConfig)(system_1.system))(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n\tdisplay: inline-flex;\n\tflex-shrink: 0;\n\tposition: relative;\n\n\t", "\n"], ["\n\tdisplay: inline-flex;\n\tflex-shrink: 0;\n\tposition: relative;\n\n\t", "\n"])), system_1.system);
|
|
79
|
+
exports.Radio = (0, core_1.vui)(function (props, ref) {
|
|
80
|
+
var _a, _b;
|
|
81
|
+
var _c = (_a = (0, context_1.useRadioGroup)()) !== null && _a !== void 0 ? _a : {}, groupDefaultValue = _c.defaultValue, groupIsChecked = _c.isChecked, groupOnChange = _c.onChange, groupValue = _c.value, radioGroupProps = __rest(_c, ["defaultValue", "isChecked", "onChange", "value"]);
|
|
82
|
+
var defaultIsChecked = groupIsChecked !== undefined ? groupIsChecked === props.value : undefined;
|
|
47
83
|
var mergedProps = __assign(__assign({}, radioGroupProps), props);
|
|
48
|
-
var
|
|
49
|
-
var
|
|
50
|
-
var
|
|
51
|
-
var
|
|
84
|
+
var _d = (0, core_1.omitThemingProps)(mergedProps), _e = _d.checked, checked = _e === void 0 ? groupValue !== undefined ? props.value === groupValue : undefined : _e, children = _d.children, className = _d.className, _f = _d.defaultChecked, defaultChecked = _f === void 0 ? groupDefaultValue !== undefined ? props.value === groupDefaultValue : undefined : _f, disabled = _d.disabled, _g = _d.icon, iconProp = _g === void 0 ? 'cuiRadioUnselected' : _g, _h = _d.iconChecked, iconChecked = _h === void 0 ? 'cuiRadioSelected' : _h, id = _d.id, inputProps = _d.inputProps, inputRef = _d.inputRef, label = _d.label, name = _d.name, onChange = _d.onChange, required = _d.required, value = _d.value, rest = __rest(_d, ["checked", "children", "className", "defaultChecked", "disabled", "icon", "iconChecked", "id", "inputProps", "inputRef", "label", "name", "onChange", "required", "value"]);
|
|
85
|
+
var _j = __read((0, react_1.useState)((_b = defaultIsChecked !== null && defaultIsChecked !== void 0 ? defaultIsChecked : checked) !== null && _b !== void 0 ? _b : defaultChecked), 2), isChecked = _j[0], setIsChecked = _j[1];
|
|
86
|
+
var styles = (0, core_1.useStyleConfig)('Radio', mergedProps);
|
|
87
|
+
var _k = styles.control, controlColor = _k.color, hoverColor = _k.hoverColor, controlStyles = __rest(_k, ["color", "hoverColor"]);
|
|
88
|
+
var icon = isChecked ? iconChecked : iconProp;
|
|
52
89
|
var controlMr = children || label ? 1 : 0;
|
|
53
|
-
var color =
|
|
54
|
-
var controlHoverColor =
|
|
90
|
+
var color = isChecked ? controlColor : 'grey.60';
|
|
91
|
+
var controlHoverColor = isChecked ? hoverColor : 'grey.90';
|
|
92
|
+
(0, react_1.useEffect)(function () {
|
|
93
|
+
if (groupIsChecked !== undefined) {
|
|
94
|
+
setIsChecked(groupIsChecked === value);
|
|
95
|
+
}
|
|
96
|
+
else if (checked !== undefined) {
|
|
97
|
+
setIsChecked(checked);
|
|
98
|
+
}
|
|
99
|
+
}, [checked, groupIsChecked]);
|
|
55
100
|
function handleOnChange(e) {
|
|
56
101
|
groupOnChange === null || groupOnChange === void 0 ? void 0 : groupOnChange(e);
|
|
57
102
|
onChange === null || onChange === void 0 ? void 0 : onChange(e);
|
|
58
103
|
}
|
|
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),
|
|
104
|
+
return (react_1.default.createElement(exports.RadioBase, __assign({ className: (0, utils_1.cs)('vui-radio', disabled && 'disabled', className), controlHoverColor: controlHoverColor, ref: ref }, styles.container, rest),
|
|
60
105
|
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)),
|
|
106
|
+
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
107
|
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
108
|
});
|
|
64
109
|
exports.Radio.displayName = 'Radio';
|
package/radio/radioGroup.js
CHANGED
|
@@ -71,27 +71,35 @@ var context_1 = require("./context");
|
|
|
71
71
|
var core_1 = require("../core");
|
|
72
72
|
var system_1 = require("../system");
|
|
73
73
|
var utils_1 = require("../utils");
|
|
74
|
-
exports.RadioGroupBase = styled_components_1.default.div.withConfig(core_1.forwardPropConfig(system_1.system))(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n\tdisplay: flex;\n\tflex-direction: column;\n\n\t", "\n"], ["\n\tdisplay: flex;\n\tflex-direction: column;\n\n\t", "\n"])), system_1.system);
|
|
75
|
-
exports.RadioGroup = core_1.vui(function (props, ref) {
|
|
76
|
-
var className = props.className, colorScheme = props.colorScheme,
|
|
77
|
-
var
|
|
78
|
-
var
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
setValue(e.target.value);
|
|
74
|
+
exports.RadioGroupBase = styled_components_1.default.div.withConfig((0, core_1.forwardPropConfig)(system_1.system))(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n\tdisplay: flex;\n\tflex-direction: column;\n\n\t", "\n"], ["\n\tdisplay: flex;\n\tflex-direction: column;\n\n\t", "\n"])), system_1.system);
|
|
75
|
+
exports.RadioGroup = (0, core_1.vui)(function (props, ref) {
|
|
76
|
+
var className = props.className, colorScheme = props.colorScheme, defaultValue = props.defaultValue, disabled = props.disabled, isRow = props.isRow, name = props.name, onBlur = props.onBlur, onChange = props.onChange, onFocus = props.onFocus, size = props.size, value = props.value, variant = props.variant, rest = __rest(props, ["className", "colorScheme", "defaultValue", "disabled", "isRow", "name", "onBlur", "onChange", "onFocus", "size", "value", "variant"]);
|
|
77
|
+
var _a = __read((0, react_1.useState)(value !== null && value !== void 0 ? value : defaultValue), 2), isChecked = _a[0], setIsChecked = _a[1];
|
|
78
|
+
var handleOnChange = (0, react_1.useCallback)(function (e) {
|
|
79
|
+
console.log('group onchange', e.target.value);
|
|
80
|
+
setIsChecked(e.target.value);
|
|
82
81
|
onChange === null || onChange === void 0 ? void 0 : onChange(e);
|
|
83
82
|
}, [onChange]);
|
|
84
|
-
var
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
83
|
+
var context = (0, react_1.useMemo)(function () {
|
|
84
|
+
return (0, utils_1.filterUndefined)({
|
|
85
|
+
colorScheme: colorScheme,
|
|
86
|
+
defaultValue: defaultValue,
|
|
87
|
+
disabled: disabled,
|
|
88
|
+
isChecked: isChecked,
|
|
89
|
+
name: name,
|
|
90
|
+
onBlur: onBlur,
|
|
91
|
+
onChange: handleOnChange,
|
|
92
|
+
onFocus: onFocus,
|
|
93
|
+
size: size,
|
|
94
|
+
value: value,
|
|
95
|
+
variant: variant
|
|
96
|
+
});
|
|
97
|
+
}, [colorScheme, defaultValue, disabled, handleOnChange, isChecked, name, onBlur, onFocus, size, value, variant]);
|
|
98
|
+
var aliasedProps = (0, utils_1.filterUndefined)({
|
|
99
|
+
flexDirection: isRow ? 'row' : undefined
|
|
92
100
|
});
|
|
93
101
|
return (react_1.default.createElement(context_1.RadioGroupProvider, { value: context },
|
|
94
|
-
react_1.default.createElement(exports.RadioGroupBase, __assign({ className: utils_1.cs('vui-radioGroup', className), ref: ref }, aliasedProps, rest))));
|
|
102
|
+
react_1.default.createElement(exports.RadioGroupBase, __assign({ className: (0, utils_1.cs)('vui-radioGroup', className), ref: ref }, aliasedProps, rest))));
|
|
95
103
|
});
|
|
96
104
|
exports.RadioGroup.displayName = 'RadioGroup';
|
|
97
105
|
exports.default = exports.RadioGroup;
|
|
@@ -4,10 +4,10 @@ import { ThemingProps } from '../theme';
|
|
|
4
4
|
export interface RadioGroupProps extends SystemProps, ThemingProps<'Radio'> {
|
|
5
5
|
colorScheme?: 'blue' | 'prussian';
|
|
6
6
|
disabled?: boolean;
|
|
7
|
+
isRow?: boolean;
|
|
7
8
|
name?: string;
|
|
8
9
|
onBlur?: FocusEventHandler;
|
|
9
10
|
onChange?: ChangeEventHandler;
|
|
10
11
|
onFocus?: FocusEventHandler;
|
|
11
|
-
row?: boolean;
|
|
12
12
|
value?: number | string;
|
|
13
13
|
}
|