@veracity/vui 0.2.0 → 0.2.2
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/avatar/theme.d.ts +5 -9
- package/avatar/theme.js +5 -18
- 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 +1 -6
- package/buttonGroup/buttonGroup.js +5 -10
- package/buttonGroup/context.js +1 -1
- package/card/card.js +4 -4
- package/checkbox/checkbox.js +13 -12
- package/checkbox/checkbox.types.d.ts +1 -1
- package/checkbox/checkboxGroup.js +7 -7
- package/checkbox/checkboxGroup.types.d.ts +2 -2
- package/checkbox/context.js +1 -1
- package/checkbox/theme.js +5 -2
- package/core/globalStyle.js +6 -8
- package/core/index.d.ts +1 -2
- package/core/index.js +2 -5
- package/core/resetCSS.js +2 -2
- package/core/styled.d.ts +192 -4
- package/core/styled.js +55 -13
- package/core/types/component.d.ts +2 -7
- package/core/types/index.d.ts +0 -2
- package/core/types/index.js +0 -2
- package/core/utils.d.ts +2 -2
- package/core/utils.js +13 -12
- package/divider/divider.js +6 -6
- package/heading/heading.js +6 -6
- package/heading/headings.js +6 -6
- package/icon/icon.js +6 -6
- package/icon/icon.types.d.ts +1 -2
- package/icons/library.js +9 -5
- package/icons/types.d.ts +1 -1
- package/image/image.js +4 -4
- package/input/context.js +1 -1
- package/input/input.js +11 -16
- package/input/input.types.d.ts +1 -2
- package/input/inputIcon.js +3 -3
- package/input/inputInput.js +4 -4
- package/link/context.d.ts +4 -0
- package/link/context.js +23 -0
- package/link/index.d.ts +2 -0
- package/link/index.js +2 -0
- package/link/link.d.ts +7 -1
- package/link/link.js +35 -7
- package/link/link.types.d.ts +5 -0
- package/link/linkIcon.d.ts +3 -0
- package/link/linkIcon.js +30 -0
- package/link/linkText.d.ts +3 -0
- package/link/linkText.js +30 -0
- package/link/theme.d.ts +27 -10
- package/link/theme.js +26 -12
- package/list/context.js +1 -1
- package/list/index.d.ts +1 -0
- package/list/index.js +1 -0
- package/list/list.d.ts +2 -0
- package/list/list.js +8 -11
- package/list/listDivider.d.ts +3 -0
- package/list/listDivider.js +30 -0
- package/list/listHeading.js +4 -4
- package/list/listIcon.js +3 -3
- package/list/listItem.js +8 -8
- package/list/listText.js +3 -3
- package/list/theme.d.ts +0 -16
- package/list/theme.js +6 -22
- package/notification/context.js +1 -1
- package/notification/notification.js +6 -11
- package/notification/notificationButton.js +3 -3
- package/notification/notificationIcon.js +3 -3
- package/notification/notificationText.js +3 -3
- package/notification/notificationTitle.js +3 -3
- package/p/p.js +6 -6
- package/package.json +1 -1
- package/panel/panel.js +4 -4
- package/radio/context.js +1 -1
- package/radio/radio.js +58 -13
- package/radio/radio.types.d.ts +1 -1
- package/radio/radioGroup.js +24 -17
- package/radio/radioGroup.types.d.ts +2 -2
- package/radio/theme.js +5 -2
- package/skeleton/skeleton.js +6 -6
- package/spinner/spinner.js +5 -5
- package/svg/svg.js +12 -12
- package/switch/context.js +1 -1
- package/switch/switch.js +12 -50
- package/switch/switch.types.d.ts +3 -3
- package/switch/switchButton.js +19 -21
- package/switch/switchLabel.js +3 -3
- package/switch/theme.d.ts +0 -5
- package/switch/theme.js +4 -9
- package/system/custom.d.ts +7 -20
- package/system/custom.js +19 -25
- package/system/system.d.ts +4 -3
- package/system/system.js +2 -2
- package/system/tables.d.ts +14 -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 +16 -13
- package/tag/tag.types.d.ts +2 -0
- package/tag/tagButton.d.ts +3 -0
- package/tag/tagButton.js +41 -0
- 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 +9 -9
- package/textarea/textarea.types.d.ts +1 -1
- package/theme/components.d.ts +58 -39
- package/theme/defaultTheme.d.ts +59 -39
- package/theme/foundations/index.d.ts +1 -0
- package/theme/foundations/shadows.js +2 -2
- package/theme/foundations/transformers.d.ts +1 -0
- package/theme/foundations/transformers.js +26 -0
- package/theme/index.d.ts +16 -0
- package/theme/index.js +33 -1
- package/utils/assertion.js +1 -2
- package/utils/function.js +9 -5
- package/utils/object.d.ts +4 -1
- package/utils/object.js +27 -28
- package/utils/types.d.ts +23 -1
- package/core/types/events.d.ts +0 -17
- package/core/types/styled.d.ts +0 -11
- package/core/types/styled.js +0 -2
- package/core/v.d.ts +0 -182
- package/core/v.js +0 -6
- /package/{core/types/events.js → system/tables.js} +0 -0
package/list/index.js
CHANGED
|
@@ -17,6 +17,7 @@ exports.default = void 0;
|
|
|
17
17
|
__exportStar(require("./context"), exports);
|
|
18
18
|
__exportStar(require("./list"), exports);
|
|
19
19
|
__exportStar(require("./list.types"), exports);
|
|
20
|
+
__exportStar(require("./listDivider"), exports);
|
|
20
21
|
__exportStar(require("./listHeading"), exports);
|
|
21
22
|
__exportStar(require("./listIcon"), exports);
|
|
22
23
|
__exportStar(require("./listItem"), exports);
|
package/list/list.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ListProps } from './list.types';
|
|
2
|
+
import ListDivider from './listDivider';
|
|
2
3
|
import ListHeading from './listHeading';
|
|
3
4
|
import ListIcon from './listIcon';
|
|
4
5
|
import ListItem from './listItem';
|
|
@@ -7,6 +8,7 @@ import { VuiComponent } from '../core';
|
|
|
7
8
|
import { SystemProps } from '../system';
|
|
8
9
|
export declare const ListBase: import("styled-components").StyledComponent<"ul", import("styled-components").DefaultTheme, SystemProps, never>;
|
|
9
10
|
export declare const List: VuiComponent<"ul", ListProps> & {
|
|
11
|
+
Divider: typeof ListDivider;
|
|
10
12
|
Heading: typeof ListHeading;
|
|
11
13
|
Icon: typeof ListIcon;
|
|
12
14
|
Item: typeof ListItem;
|
package/list/list.js
CHANGED
|
@@ -52,6 +52,7 @@ exports.List = exports.ListBase = void 0;
|
|
|
52
52
|
var react_1 = __importStar(require("react"));
|
|
53
53
|
var styled_components_1 = __importDefault(require("styled-components"));
|
|
54
54
|
var context_1 = require("./context");
|
|
55
|
+
var listDivider_1 = __importDefault(require("./listDivider"));
|
|
55
56
|
var listHeading_1 = __importDefault(require("./listHeading"));
|
|
56
57
|
var listIcon_1 = __importDefault(require("./listIcon"));
|
|
57
58
|
var listItem_1 = __importDefault(require("./listItem"));
|
|
@@ -59,22 +60,18 @@ var listText_1 = __importDefault(require("./listText"));
|
|
|
59
60
|
var core_1 = require("../core");
|
|
60
61
|
var system_1 = require("../system");
|
|
61
62
|
var utils_1 = require("../utils");
|
|
62
|
-
exports.ListBase = styled_components_1.default.ul.withConfig(core_1.forwardPropConfig(system_1.system))(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n\t", "\n"], ["\n\t", "\n"])), system_1.system);
|
|
63
|
-
exports.List = core_1.vui(function (props, ref) {
|
|
63
|
+
exports.ListBase = styled_components_1.default.ul.withConfig((0, core_1.forwardPropConfig)(system_1.system))(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n\t", "\n"], ["\n\t", "\n"])), system_1.system);
|
|
64
|
+
exports.List = (0, core_1.vui)(function (props, ref) {
|
|
64
65
|
var children = props.children, className = props.className, colorScheme = props.colorScheme, heading = props.heading, isInteractive = props.isInteractive, size = props.size, variant = props.variant, rest = __rest(props, ["children", "className", "colorScheme", "heading", "isInteractive", "size", "variant"]);
|
|
65
|
-
var styles = core_1.useStyleConfig('List', props);
|
|
66
|
-
var context = react_1.useMemo(function () { return utils_1.filterUndefined({ colorScheme: colorScheme, isInteractive: isInteractive, size: size,
|
|
67
|
-
colorScheme,
|
|
68
|
-
isInteractive,
|
|
69
|
-
size,
|
|
70
|
-
variant
|
|
71
|
-
]);
|
|
66
|
+
var styles = (0, core_1.useStyleConfig)('List', props);
|
|
67
|
+
var context = (0, react_1.useMemo)(function () { return (0, utils_1.filterUndefined)({ colorScheme: colorScheme, isInteractive: isInteractive, size: size, variant: variant }); }, [colorScheme, isInteractive, size, variant]);
|
|
72
68
|
return (react_1.default.createElement(context_1.ListProvider, { value: context },
|
|
73
|
-
react_1.default.createElement(exports.ListBase, __assign({ className: utils_1.cs('vui-list', className), ref: ref }, styles.container, rest),
|
|
74
|
-
utils_1.isReactText(heading) ? react_1.default.createElement(listHeading_1.default, { text: heading }) : heading,
|
|
69
|
+
react_1.default.createElement(exports.ListBase, __assign({ className: (0, utils_1.cs)('vui-list', className), ref: ref }, styles.container, rest),
|
|
70
|
+
(0, utils_1.isReactText)(heading) ? react_1.default.createElement(listHeading_1.default, { text: heading }) : heading,
|
|
75
71
|
children)));
|
|
76
72
|
});
|
|
77
73
|
exports.List.displayName = 'List';
|
|
74
|
+
exports.List.Divider = listDivider_1.default;
|
|
78
75
|
exports.List.Heading = listHeading_1.default;
|
|
79
76
|
exports.List.Icon = listIcon_1.default;
|
|
80
77
|
exports.List.Item = listItem_1.default;
|
|
@@ -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.ListDivider = void 0;
|
|
18
|
+
var react_1 = __importDefault(require("react"));
|
|
19
|
+
var context_1 = require("./context");
|
|
20
|
+
var core_1 = require("../core");
|
|
21
|
+
var divider_1 = __importDefault(require("../divider"));
|
|
22
|
+
exports.ListDivider = (0, core_1.vui)(function (props, ref) {
|
|
23
|
+
var _a;
|
|
24
|
+
var listProps = (_a = (0, context_1.useList)()) !== null && _a !== void 0 ? _a : {};
|
|
25
|
+
var mergedProps = __assign(__assign({}, listProps), props);
|
|
26
|
+
var styles = (0, core_1.useStyleConfig)('List', mergedProps);
|
|
27
|
+
return react_1.default.createElement(divider_1.default, __assign({ className: "vui-listDivider", ref: ref }, styles.divider, props));
|
|
28
|
+
});
|
|
29
|
+
exports.ListDivider.displayName = 'ListDivider';
|
|
30
|
+
exports.default = exports.ListDivider;
|
package/list/listHeading.js
CHANGED
|
@@ -19,12 +19,12 @@ 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 = require("../t");
|
|
22
|
-
exports.ListHeading = core_1.vui(function (props, ref) {
|
|
22
|
+
exports.ListHeading = (0, core_1.vui)(function (props, ref) {
|
|
23
23
|
var _a;
|
|
24
|
-
var listProps = (_a = context_1.useList()) !== null && _a !== void 0 ? _a : {};
|
|
24
|
+
var listProps = (_a = (0, context_1.useList)()) !== null && _a !== void 0 ? _a : {};
|
|
25
25
|
var mergedProps = __assign(__assign({}, listProps), props);
|
|
26
|
-
var styles = core_1.useStyleConfig('List', mergedProps);
|
|
27
|
-
return (react_1.default.createElement(t_1.T, __assign({ className: "vui-listHeading",
|
|
26
|
+
var styles = (0, core_1.useStyleConfig)('List', mergedProps);
|
|
27
|
+
return (react_1.default.createElement(t_1.T, __assign({ className: "vui-listHeading", display: "inline-block", p: 1, ref: ref, weight: "demi" }, styles.heading, props)));
|
|
28
28
|
});
|
|
29
29
|
exports.ListHeading.displayName = 'ListHeading';
|
|
30
30
|
exports.default = exports.ListHeading;
|
package/list/listIcon.js
CHANGED
|
@@ -19,11 +19,11 @@ var react_1 = __importDefault(require("react"));
|
|
|
19
19
|
var context_1 = require("./context");
|
|
20
20
|
var core_1 = require("../core");
|
|
21
21
|
var icon_1 = __importDefault(require("../icon"));
|
|
22
|
-
exports.ListIcon = core_1.vui(function (props, ref) {
|
|
22
|
+
exports.ListIcon = (0, core_1.vui)(function (props, ref) {
|
|
23
23
|
var _a;
|
|
24
|
-
var listProps = (_a = context_1.useList()) !== null && _a !== void 0 ? _a : {};
|
|
24
|
+
var listProps = (_a = (0, context_1.useList)()) !== null && _a !== void 0 ? _a : {};
|
|
25
25
|
var mergedProps = __assign(__assign({}, listProps), props);
|
|
26
|
-
var styles = core_1.useStyleConfig('List', mergedProps);
|
|
26
|
+
var styles = (0, core_1.useStyleConfig)('List', mergedProps);
|
|
27
27
|
return react_1.default.createElement(icon_1.default, __assign({ className: "vui-listIcon", ref: ref }, styles.icon, props));
|
|
28
28
|
});
|
|
29
29
|
exports.ListIcon.displayName = 'ListIcon';
|
package/list/listItem.js
CHANGED
|
@@ -38,12 +38,12 @@ var listText_1 = __importDefault(require("./listText"));
|
|
|
38
38
|
var core_1 = require("../core");
|
|
39
39
|
var system_1 = require("../system");
|
|
40
40
|
var utils_1 = require("../utils");
|
|
41
|
-
exports.ListItemBase = styled_components_1.default.li.withConfig(core_1.forwardPropConfig(system_1.system))(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n\tdisplay: flex;\n\tline-height: normal;\n\tmargin-bottom: 1px;\n\toutline: none;\n\n\t&[data-disabled='true'] {\n\t\tbackground-color: var(--vui-colors-disabled-bg);\n\t\tcolor: var(--vui-colors-disabled-font);\n\t\tcursor: not-allowed;\n\t\tuser-select: none;\n\t}\n\n\t", "\n"], ["\n\tdisplay: flex;\n\tline-height: normal;\n\tmargin-bottom: 1px;\n\toutline: none;\n\n\t&[data-disabled='true'] {\n\t\tbackground-color: var(--vui-colors-disabled-bg);\n\t\tcolor: var(--vui-colors-disabled-font);\n\t\tcursor: not-allowed;\n\t\tuser-select: none;\n\t}\n\n\t", "\n"])), system_1.system);
|
|
42
|
-
exports.ListItem = core_1.vui(function (props, ref) {
|
|
43
|
-
var listProps = context_1.useList();
|
|
41
|
+
exports.ListItemBase = styled_components_1.default.li.withConfig((0, core_1.forwardPropConfig)(system_1.system))(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n\tdisplay: flex;\n\tline-height: normal;\n\tmargin-bottom: 1px;\n\toutline: none;\n\n\t&[data-disabled='true'] {\n\t\tbackground-color: var(--vui-colors-disabled-bg);\n\t\tcolor: var(--vui-colors-disabled-font);\n\t\tcursor: not-allowed;\n\t\tuser-select: none;\n\t}\n\n\t", "\n"], ["\n\tdisplay: flex;\n\tline-height: normal;\n\tmargin-bottom: 1px;\n\toutline: none;\n\n\t&[data-disabled='true'] {\n\t\tbackground-color: var(--vui-colors-disabled-bg);\n\t\tcolor: var(--vui-colors-disabled-font);\n\t\tcursor: not-allowed;\n\t\tuser-select: none;\n\t}\n\n\t", "\n"])), system_1.system);
|
|
42
|
+
exports.ListItem = (0, core_1.vui)(function (props, ref) {
|
|
43
|
+
var listProps = (0, context_1.useList)();
|
|
44
44
|
var mergedProps = __assign(__assign({}, listProps), props);
|
|
45
45
|
var children = mergedProps.children, center = mergedProps.center, centerH = mergedProps.centerH, _a = mergedProps.centerV, centerV = _a === void 0 ? true : _a, className = mergedProps.className, column = mergedProps.column, disabled = mergedProps.disabled, iconLeft = mergedProps.iconLeft, iconRight = mergedProps.iconRight, _b = mergedProps.isInteractive, isInteractive = _b === void 0 ? props.onClick !== undefined : _b, isSelected = mergedProps.isSelected, isTruncated = mergedProps.isTruncated, itemLeft = mergedProps.itemLeft, itemRight = mergedProps.itemRight, onClick = mergedProps.onClick, text = mergedProps.text, rest = __rest(mergedProps, ["children", "center", "centerH", "centerV", "className", "column", "disabled", "iconLeft", "iconRight", "isInteractive", "isSelected", "isTruncated", "itemLeft", "itemRight", "onClick", "text"]);
|
|
46
|
-
var styles = core_1.useStyleConfig('List', mergedProps);
|
|
46
|
+
var styles = (0, core_1.useStyleConfig)('List', mergedProps);
|
|
47
47
|
var _c = styles.item, activeBg = _c.activeBg, hoverBg = _c.hoverBg, itemStyles = __rest(_c, ["activeBg", "hoverBg"]);
|
|
48
48
|
var alignItems = (center || (column ? centerH : centerV)) && 'center';
|
|
49
49
|
var flexDirection = column && 'column';
|
|
@@ -58,17 +58,17 @@ exports.ListItem = core_1.vui(function (props, ref) {
|
|
|
58
58
|
userSelect: 'none'
|
|
59
59
|
}
|
|
60
60
|
: {};
|
|
61
|
-
var aliasedProps = utils_1.filterUndefined({
|
|
61
|
+
var aliasedProps = (0, utils_1.filterUndefined)({
|
|
62
62
|
alignItems: alignItems,
|
|
63
63
|
bg: isSelected ? hoverBg : undefined,
|
|
64
64
|
'data-disabled': disabled,
|
|
65
65
|
flexDirection: flexDirection,
|
|
66
66
|
justifyContent: justifyContent
|
|
67
67
|
});
|
|
68
|
-
return (react_1.default.createElement(exports.ListItemBase, __assign({ className: utils_1.cs('vui-listItem', className), onClick: !disabled ? onClick : undefined, px: 1, ref: ref, transitionDuration: "fast" }, itemStyles, interactiveProps, aliasedProps, rest),
|
|
68
|
+
return (react_1.default.createElement(exports.ListItemBase, __assign({ className: (0, utils_1.cs)('vui-listItem', className), onClick: !disabled ? onClick : undefined, px: 1, ref: ref, transitionDuration: "fast" }, itemStyles, interactiveProps, aliasedProps, rest),
|
|
69
69
|
itemLeft,
|
|
70
|
-
utils_1.isString(iconLeft) ? react_1.default.createElement(listIcon_1.default, { mr: 1, name: iconLeft }) : iconLeft, children !== null && children !== void 0 ? children : (utils_1.isReactText(text) ? react_1.default.createElement(listText_1.default, { isTruncated: isTruncated, text: text }) : text),
|
|
71
|
-
utils_1.isString(iconRight) ? react_1.default.createElement(listIcon_1.default, { ml: "auto", name: iconRight }) : iconRight,
|
|
70
|
+
(0, utils_1.isString)(iconLeft) ? react_1.default.createElement(listIcon_1.default, { mr: 1, name: iconLeft }) : iconLeft, children !== null && children !== void 0 ? children : ((0, utils_1.isReactText)(text) ? react_1.default.createElement(listText_1.default, { isTruncated: isTruncated, text: text }) : text),
|
|
71
|
+
(0, utils_1.isString)(iconRight) ? react_1.default.createElement(listIcon_1.default, { ml: "auto", name: iconRight }) : iconRight,
|
|
72
72
|
itemRight));
|
|
73
73
|
});
|
|
74
74
|
exports.ListItem.displayName = 'ListItem';
|
package/list/listText.js
CHANGED
|
@@ -19,11 +19,11 @@ 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.ListText = core_1.vui(function (props, ref) {
|
|
22
|
+
exports.ListText = (0, core_1.vui)(function (props, ref) {
|
|
23
23
|
var _a;
|
|
24
|
-
var listProps = (_a = context_1.useList()) !== null && _a !== void 0 ? _a : {};
|
|
24
|
+
var listProps = (_a = (0, context_1.useList)()) !== null && _a !== void 0 ? _a : {};
|
|
25
25
|
var mergedProps = __assign(__assign({}, listProps), props);
|
|
26
|
-
var styles = core_1.useStyleConfig('List', mergedProps);
|
|
26
|
+
var styles = (0, core_1.useStyleConfig)('List', mergedProps);
|
|
27
27
|
return react_1.default.createElement(t_1.default, __assign({ className: "vui-listText", fontSize: "inherit", ref: ref }, styles.text, props));
|
|
28
28
|
});
|
|
29
29
|
exports.ListText.displayName = 'ListText';
|
package/list/theme.d.ts
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import { Dict } from '../utils';
|
|
2
2
|
declare function variantDefault(props: Dict): {
|
|
3
|
-
container: {};
|
|
4
|
-
heading: {};
|
|
5
|
-
icon: {};
|
|
6
3
|
item: Dict<any>;
|
|
7
|
-
text: {};
|
|
8
4
|
};
|
|
9
5
|
declare const _default: {
|
|
10
6
|
defaultProps: {
|
|
@@ -15,8 +11,6 @@ declare const _default: {
|
|
|
15
11
|
parts: string[];
|
|
16
12
|
sizes: {
|
|
17
13
|
sm: {
|
|
18
|
-
container: {};
|
|
19
|
-
heading: {};
|
|
20
14
|
icon: {
|
|
21
15
|
size: string;
|
|
22
16
|
};
|
|
@@ -24,11 +18,8 @@ declare const _default: {
|
|
|
24
18
|
fontSize: string;
|
|
25
19
|
h: number;
|
|
26
20
|
};
|
|
27
|
-
text: {};
|
|
28
21
|
};
|
|
29
22
|
md: {
|
|
30
|
-
container: {};
|
|
31
|
-
heading: {};
|
|
32
23
|
icon: {
|
|
33
24
|
size: string;
|
|
34
25
|
};
|
|
@@ -36,11 +27,8 @@ declare const _default: {
|
|
|
36
27
|
fontSize: string;
|
|
37
28
|
h: number;
|
|
38
29
|
};
|
|
39
|
-
text: {};
|
|
40
30
|
};
|
|
41
31
|
lg: {
|
|
42
|
-
container: {};
|
|
43
|
-
heading: {};
|
|
44
32
|
item: {
|
|
45
33
|
fontSize: string;
|
|
46
34
|
h: number;
|
|
@@ -48,11 +36,8 @@ declare const _default: {
|
|
|
48
36
|
icon: {
|
|
49
37
|
size: string;
|
|
50
38
|
};
|
|
51
|
-
text: {};
|
|
52
39
|
};
|
|
53
40
|
xl: {
|
|
54
|
-
container: {};
|
|
55
|
-
heading: {};
|
|
56
41
|
item: {
|
|
57
42
|
fontSize: string;
|
|
58
43
|
h: number;
|
|
@@ -60,7 +45,6 @@ declare const _default: {
|
|
|
60
45
|
icon: {
|
|
61
46
|
scale: number;
|
|
62
47
|
};
|
|
63
|
-
text: {};
|
|
64
48
|
};
|
|
65
49
|
};
|
|
66
50
|
variants: {
|
package/list/theme.js
CHANGED
|
@@ -7,66 +7,50 @@ function variantDefault(props) {
|
|
|
7
7
|
borderRadius: 'md',
|
|
8
8
|
hoverBg: c + ".20"
|
|
9
9
|
};
|
|
10
|
-
|
|
11
|
-
var heading = {};
|
|
12
|
-
var icon = {};
|
|
13
|
-
var text = {};
|
|
14
|
-
return { container: container, heading: heading, icon: icon, item: item, text: text };
|
|
10
|
+
return { item: item };
|
|
15
11
|
}
|
|
16
12
|
var defaultProps = {
|
|
17
13
|
colorScheme: 'blue',
|
|
18
14
|
size: 'md',
|
|
19
15
|
variant: 'default'
|
|
20
16
|
};
|
|
21
|
-
var parts = ['container', 'heading', 'icon', 'item', 'text'];
|
|
17
|
+
var parts = ['container', 'divider', 'heading', 'icon', 'item', 'text'];
|
|
22
18
|
var sizes = {
|
|
23
19
|
sm: {
|
|
24
|
-
container: {},
|
|
25
|
-
heading: {},
|
|
26
20
|
icon: {
|
|
27
21
|
size: 'sm'
|
|
28
22
|
},
|
|
29
23
|
item: {
|
|
30
24
|
fontSize: 'md',
|
|
31
25
|
h: 32
|
|
32
|
-
}
|
|
33
|
-
text: {}
|
|
26
|
+
}
|
|
34
27
|
},
|
|
35
28
|
md: {
|
|
36
|
-
container: {},
|
|
37
|
-
heading: {},
|
|
38
29
|
icon: {
|
|
39
30
|
size: 'md'
|
|
40
31
|
},
|
|
41
32
|
item: {
|
|
42
33
|
fontSize: 'md',
|
|
43
34
|
h: 40
|
|
44
|
-
}
|
|
45
|
-
text: {}
|
|
35
|
+
}
|
|
46
36
|
},
|
|
47
37
|
lg: {
|
|
48
|
-
container: {},
|
|
49
|
-
heading: {},
|
|
50
38
|
item: {
|
|
51
39
|
fontSize: 'md',
|
|
52
40
|
h: 48
|
|
53
41
|
},
|
|
54
42
|
icon: {
|
|
55
43
|
size: 'lg'
|
|
56
|
-
}
|
|
57
|
-
text: {}
|
|
44
|
+
}
|
|
58
45
|
},
|
|
59
46
|
xl: {
|
|
60
|
-
container: {},
|
|
61
|
-
heading: {},
|
|
62
47
|
item: {
|
|
63
48
|
fontSize: 'lg',
|
|
64
49
|
h: 56
|
|
65
50
|
},
|
|
66
51
|
icon: {
|
|
67
52
|
scale: 2
|
|
68
|
-
}
|
|
69
|
-
text: {}
|
|
53
|
+
}
|
|
70
54
|
}
|
|
71
55
|
};
|
|
72
56
|
var variants = {
|
package/notification/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.useNotification = exports.NotificationProvider = void 0;
|
|
20
20
|
var core_1 = require("../core");
|
|
21
|
-
var _a = __read(core_1.createContext({ isOptional: true }), 2), NotificationProvider = _a[0], useNotification = _a[1];
|
|
21
|
+
var _a = __read((0, core_1.createContext)({ isOptional: true }), 2), NotificationProvider = _a[0], useNotification = _a[1];
|
|
22
22
|
exports.NotificationProvider = NotificationProvider;
|
|
23
23
|
exports.useNotification = useNotification;
|
|
@@ -55,23 +55,18 @@ 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.Notification = core_1.vui(function (props, ref) {
|
|
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
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('Notification', __assign({ colorScheme: colorScheme }, props));
|
|
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
|
-
colorScheme,
|
|
67
|
-
size,
|
|
68
|
-
status,
|
|
69
|
-
variant
|
|
70
|
-
]);
|
|
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]);
|
|
71
66
|
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),
|
|
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),
|
|
73
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,
|
|
74
|
-
utils_1.isReactText(title) ? react_1.default.createElement(notificationTitle_1.default, { text: title }) : title,
|
|
69
|
+
(0, utils_1.isReactText)(title) ? react_1.default.createElement(notificationTitle_1.default, { text: title }) : title,
|
|
75
70
|
" ",
|
|
76
71
|
text)),
|
|
77
72
|
action,
|
|
@@ -19,11 +19,11 @@ 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.NotificationButton = core_1.vui(function (props, ref) {
|
|
22
|
+
exports.NotificationButton = (0, core_1.vui)(function (props, ref) {
|
|
23
23
|
var _a;
|
|
24
|
-
var notificationProps = (_a = context_1.useNotification()) !== null && _a !== void 0 ? _a : {};
|
|
24
|
+
var notificationProps = (_a = (0, context_1.useNotification)()) !== null && _a !== void 0 ? _a : {};
|
|
25
25
|
var mergedProps = __assign(__assign({}, notificationProps), props);
|
|
26
|
-
var styles = core_1.useStyleConfig('Notification', mergedProps);
|
|
26
|
+
var styles = (0, core_1.useStyleConfig)('Notification', mergedProps);
|
|
27
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
29
|
exports.NotificationButton.displayName = 'NotificationButton';
|
|
@@ -20,11 +20,11 @@ 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.NotificationIcon = core_1.vui(function (props, ref) {
|
|
23
|
+
exports.NotificationIcon = (0, core_1.vui)(function (props, ref) {
|
|
24
24
|
var _a, _b;
|
|
25
|
-
var notificationProps = (_a = context_1.useNotification()) !== null && _a !== void 0 ? _a : {};
|
|
25
|
+
var notificationProps = (_a = (0, context_1.useNotification)()) !== null && _a !== void 0 ? _a : {};
|
|
26
26
|
var mergedProps = __assign(__assign({}, notificationProps), props);
|
|
27
|
-
var styles = core_1.useStyleConfig('Notification', mergedProps);
|
|
27
|
+
var styles = (0, core_1.useStyleConfig)('Notification', mergedProps);
|
|
28
28
|
var _c = mergedProps.status, status = _c === void 0 ? '' : _c;
|
|
29
29
|
var iconProps = ((_b = consts_1.notificationStatusMapping[status]) !== null && _b !== void 0 ? _b : {}).iconProps;
|
|
30
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)));
|
|
@@ -19,11 +19,11 @@ 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.NotificationText = core_1.vui(function (props, ref) {
|
|
22
|
+
exports.NotificationText = (0, core_1.vui)(function (props, ref) {
|
|
23
23
|
var _a;
|
|
24
|
-
var notificationProps = (_a = context_1.useNotification()) !== null && _a !== void 0 ? _a : {};
|
|
24
|
+
var notificationProps = (_a = (0, context_1.useNotification)()) !== null && _a !== void 0 ? _a : {};
|
|
25
25
|
var mergedProps = __assign(__assign({}, notificationProps), props);
|
|
26
|
-
var styles = core_1.useStyleConfig('Notification', mergedProps);
|
|
26
|
+
var styles = (0, core_1.useStyleConfig)('Notification', mergedProps);
|
|
27
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
29
|
exports.NotificationText.displayName = 'NotificationText';
|
|
@@ -19,11 +19,11 @@ 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.NotificationTitle = core_1.vui(function (props, ref) {
|
|
22
|
+
exports.NotificationTitle = (0, core_1.vui)(function (props, ref) {
|
|
23
23
|
var _a;
|
|
24
|
-
var notificationProps = (_a = context_1.useNotification()) !== null && _a !== void 0 ? _a : {};
|
|
24
|
+
var notificationProps = (_a = (0, context_1.useNotification)()) !== null && _a !== void 0 ? _a : {};
|
|
25
25
|
var mergedProps = __assign(__assign({}, notificationProps), props);
|
|
26
|
-
var styles = core_1.useStyleConfig('Notification', mergedProps);
|
|
26
|
+
var styles = (0, core_1.useStyleConfig)('Notification', mergedProps);
|
|
27
27
|
return react_1.default.createElement(heading_1.H6, __assign({ className: "vui-notificationTitle", display: "inline-flex", ref: ref }, styles.title, props));
|
|
28
28
|
});
|
|
29
29
|
exports.NotificationTitle.displayName = 'NotificationTitle';
|
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
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,24 +74,34 @@ 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
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)))));
|
package/radio/radio.types.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { HTMLAttributes } from 'react';
|
|
2
|
-
import { ChangeEventHandler, FocusEventHandler } from '../core';
|
|
3
2
|
import { IconProp } from '../icon';
|
|
4
3
|
import { SystemProps } from '../system';
|
|
5
4
|
import { ThemingProps } from '../theme';
|
|
5
|
+
import { ChangeEventHandler, FocusEventHandler } from '../utils';
|
|
6
6
|
export interface RadioProps extends SystemProps, ThemingProps<'Radio'> {
|
|
7
7
|
checked?: boolean;
|
|
8
8
|
colorScheme?: 'blue' | 'prussian';
|