@veracity/vui 0.3.2 → 0.5.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/avatar/avatar.js +1 -1
- package/button/button.d.ts +15 -1
- package/button/button.js +3 -3
- package/button/button.types.d.ts +4 -4
- package/button/consts.js +2 -2
- package/button/theme.d.ts +2 -0
- package/button/theme.js +3 -2
- package/buttonGroup/buttonGroup.d.ts +1 -1
- package/buttonGroup/buttonGroup.js +1 -1
- package/buttonGroup/helpers.js +3 -1
- package/checkbox/checkbox.d.ts +1 -1
- package/core/consts.d.ts +7 -0
- package/core/consts.js +8 -1
- package/core/index.d.ts +1 -0
- package/core/index.js +1 -0
- package/core/links.d.ts +20 -0
- package/core/links.js +173 -0
- package/dialog/consts.d.ts +3 -0
- package/dialog/consts.js +30 -0
- package/dialog/context.d.ts +4 -0
- package/dialog/context.js +23 -0
- package/dialog/dialog.d.ts +26 -0
- package/dialog/dialog.js +122 -0
- package/dialog/dialog.types.d.ts +47 -0
- package/dialog/dialogBody.d.ts +9 -0
- package/dialog/dialogBody.js +85 -0
- package/dialog/dialogCancelButton.d.ts +4 -0
- package/dialog/dialogCancelButton.js +30 -0
- package/dialog/dialogCloseButton.d.ts +4 -0
- package/dialog/dialogCloseButton.js +30 -0
- package/dialog/dialogFooter.d.ts +4 -0
- package/dialog/dialogFooter.js +45 -0
- package/dialog/dialogHeader.d.ts +4 -0
- package/dialog/dialogHeader.js +53 -0
- package/dialog/dialogIcon.d.ts +4 -0
- package/dialog/dialogIcon.js +32 -0
- package/dialog/dialogSubmitButton.d.ts +4 -0
- package/dialog/dialogSubmitButton.js +28 -0
- package/dialog/dialogTitle.d.ts +4 -0
- package/dialog/dialogTitle.js +30 -0
- package/dialog/index.d.ts +13 -0
- package/dialog/index.js +30 -0
- package/dialog/theme.d.ts +22 -0
- package/dialog/theme.js +28 -0
- package/footer/context.d.ts +4 -0
- package/footer/context.js +23 -0
- package/footer/footer.d.ts +2 -0
- package/footer/footer.js +11 -29
- package/footer/footer.types.d.ts +19 -16
- package/footer/footerColumn.d.ts +2 -218
- package/footer/footerColumn.js +16 -2
- package/footer/footerContent.d.ts +3 -0
- package/footer/footerContent.js +28 -0
- package/footer/footerHeading.js +2 -1
- package/footer/footerLink.js +2 -1
- package/footer/footerRow.js +2 -1
- package/footer/footerSection.js +4 -3
- package/footer/footerTrademark.d.ts +3 -5
- package/footer/footerTrademark.js +23 -6
- package/footer/helpers.d.ts +7 -10
- package/footer/helpers.js +91 -33
- package/footer/index.d.ts +1 -1
- package/footer/index.js +1 -1
- package/footer/theme.js +1 -1
- package/grid/grid.d.ts +5 -0
- package/{header/headerLink.js → grid/grid.js} +17 -13
- package/grid/grid.types.d.ts +3 -0
- package/grid/grid.types.js +2 -0
- package/grid/index.d.ts +3 -0
- package/grid/index.js +20 -0
- package/grid/theme.d.ts +7 -0
- package/grid/theme.js +12 -0
- package/header/context.d.ts +2 -2
- package/header/context.js +3 -3
- package/header/header.d.ts +11 -10
- package/header/header.js +36 -21
- package/header/header.types.d.ts +54 -39
- package/header/headerAccount.d.ts +8 -0
- package/header/{headerProfile.js → headerAccount.js} +32 -45
- package/header/headerAccount.types.d.ts +35 -0
- package/header/headerAccount.types.js +2 -0
- package/header/headerAccountUserInfo.d.ts +4 -0
- package/header/headerAccountUserInfo.js +46 -0
- package/header/headerContent.d.ts +2 -3
- package/header/headerContent.js +3 -3
- package/header/headerCreateAccount.js +8 -5
- package/header/headerDivider.js +2 -2
- package/header/headerLinkItem.d.ts +4 -0
- package/header/headerLinkItem.js +53 -0
- package/header/headerLogo.js +8 -10
- package/header/headerMainLinks.d.ts +4 -0
- package/header/{headerLinks.js → headerMainLinks.js} +10 -7
- package/header/headerMobileContent.js +4 -3
- package/header/headerMobileToggle.d.ts +2 -2
- package/header/headerMobileToggle.js +6 -7
- package/header/headerNotifications.js +8 -8
- package/header/headerServices.d.ts +5 -1
- package/header/headerServices.js +23 -14
- package/header/headerServicesMessage.d.ts +4 -0
- package/header/headerServicesMessage.js +49 -0
- package/header/headerSignIn.js +5 -3
- package/header/helpers.d.ts +8 -0
- package/header/helpers.js +115 -0
- package/header/index.d.ts +8 -3
- package/header/index.js +8 -3
- package/header/loggedInHeader.d.ts +1 -1
- package/header/loggedInHeader.js +16 -12
- package/header/loggedOutHeader.js +15 -12
- package/header/theme.d.ts +62 -7
- package/header/theme.js +53 -12
- package/icons/baseIcons/fas/fasCalendarAlt.js +1 -1
- package/index.d.ts +4 -0
- package/index.js +4 -0
- package/input/consts.js +2 -2
- package/input/input.js +1 -1
- package/input/input.types.d.ts +3 -3
- package/link/link.types.d.ts +4 -4
- package/link/linkText.js +1 -1
- package/list/listHeading.js +1 -1
- package/list/listItem.js +2 -2
- package/list/theme.d.ts +2 -4
- package/list/theme.js +2 -4
- package/menu/menuItem.js +7 -22
- package/menu/menuList.js +1 -1
- package/modal/ModalBackdrop.d.ts +4 -0
- package/modal/ModalBackdrop.js +37 -0
- package/modal/ModalContent.d.ts +4 -0
- package/modal/ModalContent.js +38 -0
- package/modal/context.d.ts +4 -0
- package/modal/context.js +23 -0
- package/modal/focusLock.d.ts +9 -0
- package/modal/focusLock.js +47 -0
- package/modal/focusLock.types.d.ts +28 -0
- package/modal/focusLock.types.js +2 -0
- package/modal/index.d.ts +9 -0
- package/modal/index.js +26 -0
- package/modal/modal.d.ts +15 -0
- package/modal/modal.js +113 -0
- package/modal/modal.types.d.ts +46 -0
- package/modal/modal.types.js +2 -0
- package/modal/modalManager.d.ts +12 -0
- package/modal/modalManager.js +33 -0
- package/modal/theme.d.ts +8 -0
- package/modal/theme.js +14 -0
- package/notification/consts.js +2 -2
- package/notification/notification.types.d.ts +1 -2
- package/notification/theme.js +1 -1
- package/package.json +3 -1
- package/popover/popover.d.ts +1 -1
- package/popover/popover.js +5 -4
- package/popover/popoverContent.js +1 -1
- package/popover/popoverTrigger.js +7 -2
- package/popover/usePopover.js +7 -9
- package/popover/usePopover.types.d.ts +1 -1
- package/portal/index.d.ts +3 -0
- package/portal/index.js +20 -0
- package/portal/portal.d.ts +5 -0
- package/portal/portal.js +56 -0
- package/portal/portal.types.d.ts +7 -0
- package/portal/portal.types.js +2 -0
- package/radio/radio.d.ts +1 -1
- package/radio/radioGroup.js +1 -1
- package/svg/svg.js +9 -7
- package/svg/svg.types.d.ts +2 -2
- package/system/custom.d.ts +0 -4
- package/system/custom.js +1 -15
- package/system/effects.d.ts +4 -4
- package/system/grids.d.ts +5 -3
- package/system/system.d.ts +2 -2
- package/system/system.js +1 -1
- package/system/transitions.d.ts +1 -1
- package/tag/tag.js +1 -2
- package/tag/tag.types.d.ts +3 -4
- package/tag/theme.d.ts +1 -0
- package/tag/theme.js +2 -1
- package/textarea/textarea.js +2 -2
- package/theme/components.d.ts +101 -11
- package/theme/components.js +48 -42
- package/theme/defaultTheme.d.ts +130 -12
- package/theme/foundations/gridTemplateColumns.d.ts +15 -0
- package/theme/foundations/gridTemplateColumns.js +16 -0
- package/theme/foundations/gridTemplateRows.d.ts +9 -0
- package/theme/foundations/gridTemplateRows.js +10 -0
- package/theme/foundations/index.d.ts +29 -1
- package/theme/foundations/index.js +6 -0
- package/theme/foundations/timingFunctions.d.ts +2 -0
- package/theme/foundations/timingFunctions.js +3 -0
- package/theme/foundations/zIndices.d.ts +6 -1
- package/theme/foundations/zIndices.js +6 -1
- package/theme/types.d.ts +9 -1
- package/utils/assertion.d.ts +2 -0
- package/utils/assertion.js +6 -1
- package/utils/function.d.ts +4 -0
- package/utils/function.js +19 -1
- package/utils/index.d.ts +1 -0
- package/utils/index.js +1 -0
- package/utils/number.d.ts +2 -0
- package/utils/number.js +10 -0
- package/utils/object.js +9 -17
- package/utils/react.d.ts +12 -5
- package/utils/react.js +69 -9
- package/utils/types.d.ts +4 -2
- package/footer/consts.d.ts +0 -72
- package/footer/consts.js +0 -132
- package/header/headerLink.d.ts +0 -4
- package/header/headerLinks.d.ts +0 -4
- package/header/headerProfile.d.ts +0 -4
- package/header/headerProfile.types.d.ts +0 -35
- /package/{header/headerProfile.types.js → dialog/dialog.types.js} +0 -0
package/modal/modal.js
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
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 __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
16
|
+
}) : (function(o, m, k, k2) {
|
|
17
|
+
if (k2 === undefined) k2 = k;
|
|
18
|
+
o[k2] = m[k];
|
|
19
|
+
}));
|
|
20
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
21
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
22
|
+
}) : function(o, v) {
|
|
23
|
+
o["default"] = v;
|
|
24
|
+
});
|
|
25
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
26
|
+
if (mod && mod.__esModule) return mod;
|
|
27
|
+
var result = {};
|
|
28
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
29
|
+
__setModuleDefault(result, mod);
|
|
30
|
+
return result;
|
|
31
|
+
};
|
|
32
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
33
|
+
var t = {};
|
|
34
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
35
|
+
t[p] = s[p];
|
|
36
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
37
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
38
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
39
|
+
t[p[i]] = s[p[i]];
|
|
40
|
+
}
|
|
41
|
+
return t;
|
|
42
|
+
};
|
|
43
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
44
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
45
|
+
};
|
|
46
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
47
|
+
exports.Modal = void 0;
|
|
48
|
+
var react_1 = __importStar(require("react"));
|
|
49
|
+
var react_remove_scroll_1 = require("react-remove-scroll");
|
|
50
|
+
var box_1 = __importDefault(require("../box"));
|
|
51
|
+
var core_1 = require("../core");
|
|
52
|
+
var portal_1 = __importDefault(require("../portal"));
|
|
53
|
+
var utils_1 = require("../utils");
|
|
54
|
+
var context_1 = require("./context");
|
|
55
|
+
var focusLock_1 = __importDefault(require("./focusLock"));
|
|
56
|
+
var ModalBackdrop_1 = __importDefault(require("./ModalBackdrop"));
|
|
57
|
+
var ModalContent_1 = __importDefault(require("./ModalContent"));
|
|
58
|
+
var modalManager_1 = require("./modalManager");
|
|
59
|
+
/**
|
|
60
|
+
* Displays provided content on top of a dark backdrop element with fixed position.
|
|
61
|
+
* By default uses Portal for content and closes when clicking backdrop or pressing 'Escape'.
|
|
62
|
+
* Uses focus and scroll lock to achieve proper accessibility.
|
|
63
|
+
* More about accessibility: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/dialog_role
|
|
64
|
+
*/
|
|
65
|
+
exports.Modal = (0, core_1.vui)(function (props, ref) {
|
|
66
|
+
var _a, _b;
|
|
67
|
+
var allowPinchZoom = props.allowPinchZoom, children = props.children, className = props.className, contentProps = props.contentProps, disableAutoFocus = props.disableAutoFocus, disableBackdropClose = props.disableBackdropClose, disableEscClose = props.disableEscClose, disablePortal = props.disablePortal, disableReturnFocus = props.disableReturnFocus, disableScrollLock = props.disableScrollLock, disableTrapFocus = props.disableTrapFocus, finalFocusRef = props.finalFocusRef, hideBackdrop = props.hideBackdrop, initialFocusRef = props.initialFocusRef, isOpen = props.isOpen, onBackdropClickProp = props.onBackdropClick, onClose = props.onClose, onEsc = props.onEsc, preserveScrollBar = props.preserveScrollBar, size = props.size, variant = props.variant, rest = __rest(props, ["allowPinchZoom", "children", "className", "contentProps", "disableAutoFocus", "disableBackdropClose", "disableEscClose", "disablePortal", "disableReturnFocus", "disableScrollLock", "disableTrapFocus", "finalFocusRef", "hideBackdrop", "initialFocusRef", "isOpen", "onBackdropClick", "onClose", "onEsc", "preserveScrollBar", "size", "variant"]);
|
|
68
|
+
var modalRef = (0, react_1.useRef)(null);
|
|
69
|
+
var mouseDownTarget = (0, react_1.useRef)(null);
|
|
70
|
+
(0, modalManager_1.useModalManager)(modalRef, isOpen);
|
|
71
|
+
if (!isOpen)
|
|
72
|
+
return null;
|
|
73
|
+
var onBackdropClick = function (e) {
|
|
74
|
+
e.stopPropagation();
|
|
75
|
+
// Avoid closing modal when click starts inside the content and is released outside
|
|
76
|
+
if (mouseDownTarget.current !== e.target)
|
|
77
|
+
return;
|
|
78
|
+
if (!modalManager_1.manager.isTopModal(modalRef))
|
|
79
|
+
return;
|
|
80
|
+
!disableBackdropClose && (onClose === null || onClose === void 0 ? void 0 : onClose());
|
|
81
|
+
onBackdropClickProp === null || onBackdropClickProp === void 0 ? void 0 : onBackdropClickProp(e);
|
|
82
|
+
};
|
|
83
|
+
var onKeyDown = function (e) {
|
|
84
|
+
if (e.key === 'Escape') {
|
|
85
|
+
e.stopPropagation();
|
|
86
|
+
!disableEscClose && (onClose === null || onClose === void 0 ? void 0 : onClose());
|
|
87
|
+
onEsc === null || onEsc === void 0 ? void 0 : onEsc();
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
var onMouseDown = function (e) {
|
|
91
|
+
mouseDownTarget.current = e.target;
|
|
92
|
+
};
|
|
93
|
+
var childProps = {
|
|
94
|
+
onClick: function (e) {
|
|
95
|
+
var _a, _b;
|
|
96
|
+
e.stopPropagation();
|
|
97
|
+
(_b = (_a = children === null || children === void 0 ? void 0 : children.props) === null || _a === void 0 ? void 0 : _a.onClick) === null || _b === void 0 ? void 0 : _b.call(_a, e);
|
|
98
|
+
},
|
|
99
|
+
tabIndex: (_b = (_a = children === null || children === void 0 ? void 0 : children.props) === null || _a === void 0 ? void 0 : _a.tabIndex) !== null && _b !== void 0 ? _b : -1
|
|
100
|
+
};
|
|
101
|
+
var context = { isOpen: isOpen, onBackdropClick: onBackdropClick, onClose: onClose, size: size, variant: variant };
|
|
102
|
+
return (react_1.default.createElement(context_1.ModalProvider, { value: context },
|
|
103
|
+
react_1.default.createElement(portal_1.default, { disablePortal: disablePortal },
|
|
104
|
+
react_1.default.createElement(box_1.default, __assign({ className: (0, utils_1.cs)('vui-modal', className), ref: (0, utils_1.mergeRefs)(ref, modalRef) }, rest, { onKeyDown: (0, utils_1.callAll)(props.onKeyDown, onKeyDown), onMouseDown: (0, utils_1.callAll)(props.onMouseDown, onMouseDown) }),
|
|
105
|
+
!hideBackdrop && react_1.default.createElement(ModalBackdrop_1.default, null),
|
|
106
|
+
react_1.default.createElement(focusLock_1.default, { autoFocus: !disableAutoFocus, finalFocusRef: finalFocusRef, initialFocusRef: initialFocusRef, isDisabled: disableTrapFocus, returnFocus: !disableReturnFocus },
|
|
107
|
+
react_1.default.createElement(react_remove_scroll_1.RemoveScroll, { allowPinchZoom: allowPinchZoom, enabled: !disableScrollLock, forwardProps: true, removeScrollBar: !preserveScrollBar },
|
|
108
|
+
react_1.default.createElement(ModalContent_1.default, __assign({}, contentProps), (0, react_1.cloneElement)(children, childProps))))))));
|
|
109
|
+
});
|
|
110
|
+
exports.Modal.displayName = 'Modal';
|
|
111
|
+
exports.Modal.Backdrop = ModalBackdrop_1.default;
|
|
112
|
+
exports.Modal.Content = ModalContent_1.default;
|
|
113
|
+
exports.default = exports.Modal;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { SystemProps } from '../system';
|
|
3
|
+
import { ThemingProps } from '../theme';
|
|
4
|
+
import { MouseEvent } from '../utils';
|
|
5
|
+
import { FocusableElement } from './focusLock.types';
|
|
6
|
+
export declare type ModalBackdropProps = SystemProps;
|
|
7
|
+
export declare type ModalContentProps = SystemProps;
|
|
8
|
+
export declare type ModalContext = Pick<ModalProps, 'isOpen' | 'onBackdropClick' | 'onClose' | 'size' | 'variant'>;
|
|
9
|
+
export declare type ModalProps = SystemProps & ThemingProps<'Modal'> & {
|
|
10
|
+
/** Handle zoom/pinch gestures on iOS devices when scroll locking is enabled. */
|
|
11
|
+
allowPinchZoom?: boolean;
|
|
12
|
+
/** A single child content element. */
|
|
13
|
+
children: React.ReactElement;
|
|
14
|
+
/** Props passed to internal ModalContent component. */
|
|
15
|
+
contentProps?: ModalContentProps;
|
|
16
|
+
/** It won't auto-focus the first focuable element within the 'children' once FocusLock mounts. */
|
|
17
|
+
disableAutoFocus?: boolean;
|
|
18
|
+
/** Clicking Backdrop element will not trigger 'onClose'. */
|
|
19
|
+
disableBackdropClose?: boolean;
|
|
20
|
+
/** Pressing 'Escape' will not trigger 'onClose'. */
|
|
21
|
+
disableEscClose?: boolean;
|
|
22
|
+
/** The children will be under the DOM hierarchy of the parent component. */
|
|
23
|
+
disablePortal?: boolean;
|
|
24
|
+
/** Focus won't be returned to the element that triggered the FocusLock once it unmounts. */
|
|
25
|
+
disableReturnFocus?: boolean;
|
|
26
|
+
/** Allows scrolling to happen on the content beneath the Modal. */
|
|
27
|
+
disableScrollLock?: boolean;
|
|
28
|
+
/** Disables FocusLock mechanism and allows focusing elements outside the Modal. */
|
|
29
|
+
disableTrapFocus?: boolean;
|
|
30
|
+
/** 'ref' of the element to return focus to when FocusLock unmounts. */
|
|
31
|
+
finalFocusRef?: React.RefObject<FocusableElement>;
|
|
32
|
+
/** Hides the dark backdrop element that is normally displayed beneath modal content. */
|
|
33
|
+
hideBackdrop?: boolean;
|
|
34
|
+
/** 'ref' of the element to receive focus initially when FocusLock mounts. */
|
|
35
|
+
initialFocusRef?: React.RefObject<FocusableElement>;
|
|
36
|
+
/** Displays the modal with its content on top of a backdrop. */
|
|
37
|
+
isOpen?: boolean;
|
|
38
|
+
/** Callback triggered when the backdrop element is clicked. Defaults to onClose. */
|
|
39
|
+
onBackdropClick?: (e: MouseEvent) => void;
|
|
40
|
+
/** Callback triggered to close the modal. */
|
|
41
|
+
onClose?: () => void;
|
|
42
|
+
/** Callback triggered when pressing 'Escape' key. Defaults to onClose. */
|
|
43
|
+
onEsc?: () => void;
|
|
44
|
+
/** Test this prop on Windows scrollbars */
|
|
45
|
+
preserveScrollBar?: boolean;
|
|
46
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Ref } from 'react';
|
|
2
|
+
/** State management for nested modals. */
|
|
3
|
+
declare class ModalManager {
|
|
4
|
+
modals: any[];
|
|
5
|
+
add: (modal: any) => void;
|
|
6
|
+
remove: (modal: any) => void;
|
|
7
|
+
isTopModal: (modal: any) => boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare const manager: ModalManager;
|
|
10
|
+
/** Refs of new modals will be automatically added/removed from the state when rendering. */
|
|
11
|
+
export declare function useModalManager(ref: Ref<any>, isOpen?: boolean): void;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useModalManager = exports.manager = void 0;
|
|
4
|
+
var react_1 = require("react");
|
|
5
|
+
/** State management for nested modals. */
|
|
6
|
+
var ModalManager = /** @class */ (function () {
|
|
7
|
+
function ModalManager() {
|
|
8
|
+
var _this = this;
|
|
9
|
+
this.modals = [];
|
|
10
|
+
this.add = function (modal) {
|
|
11
|
+
_this.modals.push(modal);
|
|
12
|
+
};
|
|
13
|
+
this.remove = function (modal) {
|
|
14
|
+
_this.modals = _this.modals.filter(function (m) { return m !== modal; });
|
|
15
|
+
};
|
|
16
|
+
this.isTopModal = function (modal) {
|
|
17
|
+
var topmostModal = _this.modals[_this.modals.length - 1];
|
|
18
|
+
return topmostModal === modal;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
return ModalManager;
|
|
22
|
+
}());
|
|
23
|
+
exports.manager = new ModalManager();
|
|
24
|
+
/** Refs of new modals will be automatically added/removed from the state when rendering. */
|
|
25
|
+
function useModalManager(ref, isOpen) {
|
|
26
|
+
(0, react_1.useEffect)(function () {
|
|
27
|
+
isOpen && exports.manager.add(ref);
|
|
28
|
+
return function () {
|
|
29
|
+
exports.manager.remove(ref);
|
|
30
|
+
};
|
|
31
|
+
}, [isOpen, ref]);
|
|
32
|
+
}
|
|
33
|
+
exports.useModalManager = useModalManager;
|
package/modal/theme.d.ts
ADDED
package/modal/theme.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var baseStyle = {};
|
|
4
|
+
var defaultProps = {};
|
|
5
|
+
var parts = ['container', 'backdrop', 'content'];
|
|
6
|
+
var sizes = {};
|
|
7
|
+
var variants = {};
|
|
8
|
+
exports.default = {
|
|
9
|
+
baseStyle: baseStyle,
|
|
10
|
+
defaultProps: defaultProps,
|
|
11
|
+
parts: parts,
|
|
12
|
+
sizes: sizes,
|
|
13
|
+
variants: variants
|
|
14
|
+
};
|
package/notification/consts.js
CHANGED
|
@@ -18,8 +18,8 @@ exports.notificationStatusMapping = {
|
|
|
18
18
|
colorScheme: 'blue',
|
|
19
19
|
iconProps: {
|
|
20
20
|
animation: 'vui-spin 0.6s linear infinite',
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
name: 'fadSpinnerThird',
|
|
22
|
+
pathFill: ['blue.40', 'blue.60']
|
|
23
23
|
}
|
|
24
24
|
},
|
|
25
25
|
success: {
|
|
@@ -2,14 +2,13 @@ import { ReactNode } from 'react';
|
|
|
2
2
|
import { BoxProps } from '../box';
|
|
3
3
|
import { IconProp, IconProps } from '../icon';
|
|
4
4
|
import { ThemingProps } from '../theme';
|
|
5
|
-
import { AnyElement } from '../utils';
|
|
6
5
|
export declare type NotificationProps = Omit<BoxProps, 'size' | 'variant'> & ThemingProps<'Notification'> & {
|
|
7
6
|
/** Socket displaying a button on the right. */
|
|
8
7
|
action?: ReactNode;
|
|
9
8
|
/** Available theme colors for this component. @default blue */
|
|
10
9
|
colorScheme?: 'blue' | 'green' | 'red' | 'yellow';
|
|
11
10
|
/** Socket displaying an icon on the left. */
|
|
12
|
-
icon?: IconProp |
|
|
11
|
+
icon?: IconProp | JSX.Element;
|
|
13
12
|
/** If provided, displays a close button with this function as onClick. */
|
|
14
13
|
onClose?: () => void;
|
|
15
14
|
/** Modifies Notification style and content based on the given status. */
|
package/notification/theme.js
CHANGED
|
@@ -28,7 +28,7 @@ var defaultProps = {
|
|
|
28
28
|
colorScheme: 'blue',
|
|
29
29
|
variant: 'subtle'
|
|
30
30
|
};
|
|
31
|
-
var parts = ['container', 'button', 'icon', '
|
|
31
|
+
var parts = ['container', 'button', 'icon', 'text', 'title'];
|
|
32
32
|
var sizes = {};
|
|
33
33
|
var variants = {
|
|
34
34
|
subtle: variantSubtle
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@veracity/vui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Veracity UI React components library based on Styled Components and @xstyled",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"author": "Veracity",
|
|
@@ -18,6 +18,8 @@
|
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@types/styled-components": "^5.1.15",
|
|
20
20
|
"@xstyled/styled-components": "^2.4.1",
|
|
21
|
+
"react-focus-lock": "^2.7.1",
|
|
22
|
+
"react-remove-scroll": "^2.4.3",
|
|
21
23
|
"styled-components": "^5.3.1",
|
|
22
24
|
"tippy.js": "^6.3.7"
|
|
23
25
|
},
|
package/popover/popover.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { PopoverProps } from './popover.types';
|
|
|
4
4
|
* Uses 'usePopover' hook to expose relevant data to its children parts.
|
|
5
5
|
* By default, renders provided content only when popover is opened (lazy).
|
|
6
6
|
*/
|
|
7
|
-
declare function Popover(
|
|
7
|
+
declare function Popover(props: PopoverProps): JSX.Element;
|
|
8
8
|
declare namespace Popover {
|
|
9
9
|
var Content: import("..").VuiComponent<"div", import("..").BoxProps>;
|
|
10
10
|
var Trigger: import("..").VuiComponent<"button", import("..").SystemProps>;
|
package/popover/popover.js
CHANGED
|
@@ -35,11 +35,12 @@ var usePopover_1 = __importDefault(require("./usePopover"));
|
|
|
35
35
|
* Uses 'usePopover' hook to expose relevant data to its children parts.
|
|
36
36
|
* By default, renders provided content only when popover is opened (lazy).
|
|
37
37
|
*/
|
|
38
|
-
function Popover(
|
|
39
|
-
var children =
|
|
40
|
-
var popoverProps = (0, usePopover_1.default)(
|
|
38
|
+
function Popover(props) {
|
|
39
|
+
var children = props.children, _a = props.isLazy, isLazy = _a === void 0 ? true : _a, rest = __rest(props, ["children", "isLazy"]);
|
|
40
|
+
var popoverProps = (0, usePopover_1.default)(rest);
|
|
41
41
|
var close = popoverProps.close, isOpen = popoverProps.isOpen, open = popoverProps.open;
|
|
42
|
-
|
|
42
|
+
var context = (0, utils_1.filterUndefined)(__assign({ isLazy: isLazy }, popoverProps));
|
|
43
|
+
return react_1.default.createElement(context_1.PopoverProvider, { value: context }, (0, utils_1.runIfFn)(children, { close: close, isOpen: isOpen, open: open }));
|
|
43
44
|
}
|
|
44
45
|
exports.default = Popover;
|
|
45
46
|
Popover.Content = popoverContent_1.default;
|
|
@@ -42,7 +42,7 @@ exports.PopoverContent = (0, core_1.vui)(function (props, ref) {
|
|
|
42
42
|
return (
|
|
43
43
|
// Wrapping div prevents an error thrown when conditionally unmounting this component
|
|
44
44
|
react_1.default.createElement("div", null,
|
|
45
|
-
react_1.default.createElement(box_1.default, __assign({ bg: "white", borderRadius: "md", boxShadow: "2", className: "vui-popoverContent", overflowY: "
|
|
45
|
+
react_1.default.createElement(box_1.default, __assign({ bg: "white", borderRadius: "md", boxShadow: "2", className: "vui-popoverContent", overflowY: "auto", ref: (0, utils_1.mergeRefs)(setPopper, ref) }, styles.content, rest), shouldRenderChildren ? children : null)));
|
|
46
46
|
});
|
|
47
47
|
exports.PopoverContent.displayName = 'PopoverContent';
|
|
48
48
|
exports.default = exports.PopoverContent;
|
|
@@ -40,9 +40,14 @@ exports.PopoverTrigger = (0, core_1.vui)(function (props, ref) {
|
|
|
40
40
|
var _b = (_a = (0, context_1.usePopoverContext)()) !== null && _a !== void 0 ? _a : {}, setReference = _b.setReference, popoverProps = __rest(_b, ["setReference"]);
|
|
41
41
|
var styles = (0, core_1.useStyleConfig)('Popover', __assign(__assign({}, popoverProps), props));
|
|
42
42
|
// @ts-ignore - TS incorrectly doesn't recognize 'as' prop
|
|
43
|
-
var As = props.as, rest = __rest(props, ["as"]);
|
|
43
|
+
var As = props.as, onClickProp = props.onClick, rest = __rest(props, ["as", "onClick"]);
|
|
44
44
|
var Element = As || core_1.v.button;
|
|
45
|
-
|
|
45
|
+
var onClick = function (e) {
|
|
46
|
+
// Avoids triggering parent's onClick, like when inside a ListItem
|
|
47
|
+
e.stopPropagation();
|
|
48
|
+
onClickProp === null || onClickProp === void 0 ? void 0 : onClickProp(e);
|
|
49
|
+
};
|
|
50
|
+
return (react_1.default.createElement(Element, __assign({ className: "vui-popoverTrigger", onClick: onClick, ref: (0, utils_1.mergeRefs)(setReference, ref) }, styles.trigger, rest)));
|
|
46
51
|
});
|
|
47
52
|
exports.PopoverTrigger.displayName = 'PopoverTrigger';
|
|
48
53
|
exports.default = exports.PopoverTrigger;
|
package/popover/usePopover.js
CHANGED
|
@@ -63,33 +63,31 @@ function usePopover(props) {
|
|
|
63
63
|
if (props === void 0) { props = {}; }
|
|
64
64
|
var _a = props.closeOnBlur, closeOnBlur = _a === void 0 ? true : _a, _b = props.closeOnEsc, closeOnEsc = _b === void 0 ? true : _b, _c = props.defaultIsOpen, defaultIsOpen = _c === void 0 ? false : _c,
|
|
65
65
|
// disablePortal,
|
|
66
|
-
isOpenProp = props.isOpen, matchWidth = props.matchWidth, offset = props.offset,
|
|
66
|
+
isOpenProp = props.isOpen, matchWidth = props.matchWidth, offset = props.offset, onCloseProp = props.onClose, onOpenProp = props.onOpen, options = props.options, _d = props.placement, placement = _d === void 0 ? 'bottom-start' : _d, _e = props.trigger, trigger = _e === void 0 ? 'click' : _e;
|
|
67
67
|
var _f = __read((0, react_1.useState)(isOpenProp !== null && isOpenProp !== void 0 ? isOpenProp : defaultIsOpen), 2), isOpen = _f[0], setIsOpen = _f[1];
|
|
68
68
|
var _g = __read((0, react_1.useState)(null), 2), instance = _g[0], setInstance = _g[1];
|
|
69
69
|
var _h = __read((0, react_1.useState)(null), 2), reference = _h[0], setReference = _h[1];
|
|
70
70
|
var _j = __read((0, react_1.useState)(null), 2), popper = _j[0], setPopper = _j[1];
|
|
71
71
|
var close = (0, react_1.useCallback)(function () { return instance === null || instance === void 0 ? void 0 : instance.hide(); }, [instance]);
|
|
72
|
-
var
|
|
73
|
-
var
|
|
72
|
+
var onClose = (0, utils_1.useCallbackRef)(onCloseProp);
|
|
73
|
+
var onOpen = (0, utils_1.useCallbackRef)(onOpenProp);
|
|
74
74
|
var open = (0, react_1.useCallback)(function () { return instance === null || instance === void 0 ? void 0 : instance.show(); }, [instance]);
|
|
75
75
|
var isControlled = isOpenProp !== undefined;
|
|
76
76
|
var tippyOptions = (0, react_1.useMemo)(function () {
|
|
77
77
|
var _a, _b;
|
|
78
78
|
var _c = options !== null && options !== void 0 ? options : {}, optionsOffset = _c.offset, onHidden = _c.onHidden, onHide = _c.onHide, onShow = _c.onShow, _d = _c.plugins, plugins = _d === void 0 ? [] : _d, _e = _c.popperOptions, popperOptions = _e === void 0 ? {} : _e, otherOptions = __rest(_c, ["offset", "onHidden", "onHide", "onShow", "plugins", "popperOptions"]);
|
|
79
|
-
return __assign({ arrow: false, duration: [200, 150], hideOnClick: !isControlled ? closeOnBlur : false, interactive: true, maxWidth: 'none', offset: (_a = optionsOffset !== null && optionsOffset !== void 0 ? optionsOffset : offset) !== null && _a !== void 0 ? _a : [0,
|
|
79
|
+
return __assign({ arrow: false, duration: [200, 150], hideOnClick: !isControlled ? closeOnBlur : false, interactive: true, maxWidth: 'none', offset: (_a = optionsOffset !== null && optionsOffset !== void 0 ? optionsOffset : offset) !== null && _a !== void 0 ? _a : [0, 4], onHidden: function (instance) {
|
|
80
80
|
setIsOpen(false);
|
|
81
81
|
onHidden === null || onHidden === void 0 ? void 0 : onHidden(instance);
|
|
82
82
|
}, onHide: function (instance) {
|
|
83
|
-
|
|
84
|
-
(_a = onCloseRef.current) === null || _a === void 0 ? void 0 : _a.call(onCloseRef, instance);
|
|
83
|
+
onClose(instance);
|
|
85
84
|
onHide === null || onHide === void 0 ? void 0 : onHide(instance);
|
|
86
85
|
}, onShow: function (instance) {
|
|
87
|
-
var _a;
|
|
88
86
|
setIsOpen(true);
|
|
89
|
-
(
|
|
87
|
+
onOpen(instance);
|
|
90
88
|
onShow === null || onShow === void 0 ? void 0 : onShow(instance);
|
|
91
89
|
}, placement: placement, plugins: __spreadArray(__spreadArray([], __read((!isControlled && closeOnEsc ? [consts_1.closeOnEscPlugin] : [])), false), __read(plugins), false), popperOptions: __assign(__assign({}, popperOptions), { modifiers: __spreadArray([__assign(__assign({}, consts_1.matchWidthModifier), { enabled: !!matchWidth })], __read(((_b = popperOptions.modifiers) !== null && _b !== void 0 ? _b : [])), false) }), showOnCreate: defaultIsOpen, trigger: !isControlled ? trigger : 'manual' }, otherOptions);
|
|
92
|
-
}, [closeOnBlur, closeOnEsc, placement, trigger]);
|
|
90
|
+
}, [closeOnBlur, closeOnEsc, offset, options, placement, trigger]);
|
|
93
91
|
// Create a new Tippy instance
|
|
94
92
|
(0, react_1.useEffect)(function () {
|
|
95
93
|
if (popper !== null && reference !== null) {
|
|
@@ -19,7 +19,7 @@ export declare type UsePopoverProps = {
|
|
|
19
19
|
/** Invoked once content begins to show. */
|
|
20
20
|
onOpen?: (instance: Instance<TippyProps>) => void;
|
|
21
21
|
/** Object with any Tippy props. */
|
|
22
|
-
options?: TippyProps
|
|
22
|
+
options?: Partial<TippyProps>;
|
|
23
23
|
/** Preferred placement of the content. Might be flipped if needs more space. */
|
|
24
24
|
placement?: Placement;
|
|
25
25
|
/** Determintes the events that cause the content to show. */
|
package/portal/index.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
13
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
14
|
+
};
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.default = void 0;
|
|
17
|
+
__exportStar(require("./portal"), exports);
|
|
18
|
+
var portal_1 = require("./portal");
|
|
19
|
+
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(portal_1).default; } });
|
|
20
|
+
__exportStar(require("./portal.types"), exports);
|
package/portal/portal.js
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
22
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
23
|
+
if (!m) return o;
|
|
24
|
+
var i = m.call(o), r, ar = [], e;
|
|
25
|
+
try {
|
|
26
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
27
|
+
}
|
|
28
|
+
catch (error) { e = { error: error }; }
|
|
29
|
+
finally {
|
|
30
|
+
try {
|
|
31
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
32
|
+
}
|
|
33
|
+
finally { if (e) throw e.error; }
|
|
34
|
+
}
|
|
35
|
+
return ar;
|
|
36
|
+
};
|
|
37
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
+
exports.Portal = void 0;
|
|
39
|
+
var react_1 = __importStar(require("react"));
|
|
40
|
+
var react_dom_1 = require("react-dom");
|
|
41
|
+
/** Provided children are portaled to document.body or custom container. */
|
|
42
|
+
var Portal = function (props) {
|
|
43
|
+
var children = props.children, containerRef = props.containerRef, disablePortal = props.disablePortal;
|
|
44
|
+
var _a = __read((0, react_1.useState)(), 2), mountNode = _a[0], setMountNode = _a[1];
|
|
45
|
+
(0, react_1.useEffect)(function () {
|
|
46
|
+
var _a;
|
|
47
|
+
if (!disablePortal) {
|
|
48
|
+
setMountNode((_a = containerRef === null || containerRef === void 0 ? void 0 : containerRef.current) !== null && _a !== void 0 ? _a : document.body);
|
|
49
|
+
}
|
|
50
|
+
}, [disablePortal]);
|
|
51
|
+
if (disablePortal)
|
|
52
|
+
return react_1.default.createElement(react_1.default.Fragment, null, children);
|
|
53
|
+
return mountNode ? (0, react_dom_1.createPortal)(children, mountNode) : react_1.default.createElement(react_1.default.Fragment, null, mountNode);
|
|
54
|
+
};
|
|
55
|
+
exports.Portal = Portal;
|
|
56
|
+
exports.default = exports.Portal;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
export declare type PortalProps = {
|
|
3
|
+
/** Ref of a custom container that will be used instead of document.body. */
|
|
4
|
+
containerRef?: RefObject<HTMLElement | null>;
|
|
5
|
+
/** Content will be rendered as usual, without portaling. */
|
|
6
|
+
disablePortal?: boolean;
|
|
7
|
+
};
|
package/radio/radio.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RadioProps, RadioStyleProps } from './radio.types';
|
|
2
|
-
export declare const RadioBase: import("styled-components").StyledComponent<"label", import("styled-components").DefaultTheme, import("..").AnimationProps & import("..").BackgroundColorProps & import("..").BorderProps & import("..").BorderTopProps & import("..").BorderRightProps & import("..").BorderBottomProps & import("..").BorderLeftProps & import("..").BorderColorProps & import("..").BorderTopColorProps & import("..").BorderRightColorProps & import("..").BorderBottomColorProps & import("..").BorderLeftColorProps & import("..").BorderWidthProps & import("..").BorderTopWidthProps & import("..").BorderRightWidthProps & import("..").BorderBottomWidthProps & import("..").BorderLeftWidthProps & import("..").BorderStyleProps & import("..").BorderRadiusProps & import("..").OutlineProps & import("..").OutlineColorProps & import("..").OutlineWidthProps & import("..").OutlineStyleProps & import("..").DivideXProps & import("..").DivideYProps & import("..").DivideXReverseProps & import("..").DivideYReverseProps & import("..").DivideColorProps & import("..").DivideStyleProps & import("..").RingProps & import("..").RingColorProps & import("..").OpacityProps & import("..").BoxShadowProps & import("..").TextShadowProps & import("..").DisplayProps & import("..").AlignItemsProps & import("..").AlignContentProps & import("..").JustifyContentProps & import("..").JustifyItemsProps & import("..").FlexWrapProps & import("..").FlexGrowProps & import("..").FlexShrinkProps & import("..").FlexBasisProps & import("..").FlexDirectionProps & import("..").FlexProps & import("..").JustifySelfProps & import("..").AlignSelfProps & import("..").OrderProps & import("../system/flexboxGrids").RowProps & import("../system/flexboxGrids").ColProps & import("../system/grids").GapProps & import("../system/grids").ColumnGapProps & import("../system/grids").RowGapProps & import("../system/grids").GridColumnProps & import("../system/grids").GridRowProps & import("../system/grids").GridAutoFlowProps & import("../system/grids").GridAutoColumnsProps & import("../system/grids").GridAutoRowsProps & import("../system/grids").GridTemplateColumnsProps & import("../system/grids").GridTemplateRowsProps & import("../system/grids").GridTemplateAreasProps & import("../system/grids").GridAreaProps & import("..").AppearanceProps & import("..").CursorProps & import("..").PointerEventsProps & import("..").ResizeProps & import("..").UserSelectProps & import("..").IsTruncatedProps & import("..").FloatProps & import("..").BoxSizingProps & import("..").OverflowProps & import("..").OverflowXProps & import("..").OverflowYProps & import("..").PositionProps & import("..").ZIndexProps & import("..").TopProps & import("..").RightProps & import("..").BottomProps & import("..").LeftProps & import("..").VisibilityProps & import("..").OverscrollBehaviorProps & import("..").ObjectFitProps & import("..").MaxLinesProps & import("..").WidthProps & import("..").HeightProps & import("..").MaxWidthProps & import("..").MaxHeightProps & import("..").MinWidthProps & import("..").MinHeightProps & import("..").MarginProps & import("..").MarginTopProps & import("..").MarginRightProps & import("..").MarginBottomProps & import("..").MarginLeftProps & import("..").MarginXProps & import("..").MarginYProps & import("..").PaddingProps & import("..").PaddingTopProps & import("..").PaddingRightProps & import("..").PaddingBottomProps & import("..").PaddingLeftProps & import("..").PaddingXProps & import("..").PaddingYProps & import("..").SpaceXProps & import("..").SpaceYProps & import("..").SpaceXReverseProps & import("..").SpaceYReverseProps & import("
|
|
2
|
+
export declare const RadioBase: import("styled-components").StyledComponent<"label", import("styled-components").DefaultTheme, import("..").AnimationProps & import("..").BackgroundColorProps & import("..").BorderProps & import("..").BorderTopProps & import("..").BorderRightProps & import("..").BorderBottomProps & import("..").BorderLeftProps & import("..").BorderColorProps & import("..").BorderTopColorProps & import("..").BorderRightColorProps & import("..").BorderBottomColorProps & import("..").BorderLeftColorProps & import("..").BorderWidthProps & import("..").BorderTopWidthProps & import("..").BorderRightWidthProps & import("..").BorderBottomWidthProps & import("..").BorderLeftWidthProps & import("..").BorderStyleProps & import("..").BorderRadiusProps & import("..").OutlineProps & import("..").OutlineColorProps & import("..").OutlineWidthProps & import("..").OutlineStyleProps & import("..").DivideXProps & import("..").DivideYProps & import("..").DivideXReverseProps & import("..").DivideYReverseProps & import("..").DivideColorProps & import("..").DivideStyleProps & import("..").RingProps & import("..").RingColorProps & import("..").OpacityProps & import("..").BoxShadowProps & import("..").TextShadowProps & import("..").DisplayProps & import("..").AlignItemsProps & import("..").AlignContentProps & import("..").JustifyContentProps & import("..").JustifyItemsProps & import("..").FlexWrapProps & import("..").FlexGrowProps & import("..").FlexShrinkProps & import("..").FlexBasisProps & import("..").FlexDirectionProps & import("..").FlexProps & import("..").JustifySelfProps & import("..").AlignSelfProps & import("..").OrderProps & import("../system/flexboxGrids").RowProps & import("../system/flexboxGrids").ColProps & import("../system/grids").GapProps & import("../system/grids").ColumnGapProps & import("../system/grids").RowGapProps & import("../system/grids").GridColumnProps & import("../system/grids").GridRowProps & import("../system/grids").GridAutoFlowProps & import("../system/grids").GridAutoColumnsProps & import("../system/grids").GridAutoRowsProps & import("../system/grids").GridTemplateColumnsProps & import("../system/grids").GridTemplateRowsProps & import("../system/grids").GridTemplateAreasProps & import("../system/grids").GridAreaProps & import("..").AppearanceProps & import("..").CursorProps & import("..").PointerEventsProps & import("..").ResizeProps & import("..").UserSelectProps & import("..").IsTruncatedProps & import("..").FloatProps & import("..").BoxSizingProps & import("..").OverflowProps & import("..").OverflowXProps & import("..").OverflowYProps & import("..").PositionProps & import("..").ZIndexProps & import("..").TopProps & import("..").RightProps & import("..").BottomProps & import("..").LeftProps & import("..").VisibilityProps & import("..").OverscrollBehaviorProps & import("..").ObjectFitProps & import("..").MaxLinesProps & import("..").WidthProps & import("..").HeightProps & import("..").MaxWidthProps & import("..").MaxHeightProps & import("..").MinWidthProps & import("..").MinHeightProps & import("..").MarginProps & import("..").MarginTopProps & import("..").MarginRightProps & import("..").MarginBottomProps & import("..").MarginLeftProps & import("..").MarginXProps & import("..").MarginYProps & import("..").PaddingProps & import("..").PaddingTopProps & import("..").PaddingRightProps & import("..").PaddingBottomProps & import("..").PaddingLeftProps & import("..").PaddingXProps & import("..").PaddingYProps & import("..").SpaceXProps & import("..").SpaceYProps & import("..").SpaceXReverseProps & import("..").SpaceYReverseProps & import("../system/tables").BorderCollapseProps & import("../system/tables").TableLayoutProps & import("..").TransformProps & import("..").TransformOriginProps & import("..").TranslateXProps & import("..").TranslateYProps & import("..").RotateProps & import("..").SkewXProps & import("..").SkewYProps & import("..").ScaleProps & import("..").ScaleXProps & import("..").ScaleYProps & import("..").TransitionProps & import("..").TransitionPropertyProps & import("..").TransitionDurationProps & import("..").TransitionTimingFunctionProps & import("..").TransitionDelayProps & import("..").FontFamilyProps & import("..").FontSizeProps & import("..").FontStyleProps & import("..").FontWeightProps & import("..").LineHeightProps & import("..").ColorProps & import("..").TextTransformProps & import("..").TextDecorationProps & import("..").TextAlignProps & import("..").VerticalAlignProps & import("..").LetterSpacingProps & import("..").WhiteSpaceProps & import("..").TextOverflowProps & import("..").ListStyleTypeProps & import("..").ListStylePositionProps & import("..").WordBreakProps & RadioStyleProps, never>;
|
|
3
3
|
/**
|
|
4
4
|
* Allows selection of a single choice from a set of items. Handles controlled and uncontrolled modes.
|
|
5
5
|
* Uses icons to display itself in different states.
|
package/radio/radioGroup.js
CHANGED
|
@@ -66,7 +66,7 @@ var react_1 = __importStar(require("react"));
|
|
|
66
66
|
var core_1 = require("../core");
|
|
67
67
|
var utils_1 = require("../utils");
|
|
68
68
|
var context_1 = require("./context");
|
|
69
|
-
exports.RadioGroupBase = core_1.styled.divBox(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n\tdisplay: flex;\n\tflex-direction: column;\n"], ["\n\tdisplay: flex;\n\tflex-direction: column;\n"
|
|
69
|
+
exports.RadioGroupBase = core_1.styled.divBox(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 1;\n"], ["\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 1;\n"
|
|
70
70
|
/**
|
|
71
71
|
* Organizes layout and display of multiple radio buttons as a row or column.
|
|
72
72
|
* Exposes some props to the children via context.
|
package/svg/svg.js
CHANGED
|
@@ -106,13 +106,15 @@ var core_1 = require("../core");
|
|
|
106
106
|
var utils_1 = require("../utils");
|
|
107
107
|
var cache_1 = __importDefault(require("./cache"));
|
|
108
108
|
var helpers_1 = require("./helpers");
|
|
109
|
-
exports.SvgBase = core_1.styled.svgBox(
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
109
|
+
exports.SvgBase = core_1.styled.svgBox(function (_a) {
|
|
110
|
+
var pathFill = _a.pathFill;
|
|
111
|
+
return (0, core_1.css)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n\t\t", "\n\t"], ["\n\t\t", "\n\t"])), pathFill !== undefined &&
|
|
112
|
+
(Array.isArray(pathFill)
|
|
113
|
+
? pathFill
|
|
114
|
+
.map(function (fill, index) { return "\n\t\t\t\t\t& > path:nth-child(" + (index + 1) + ") {\n\t\t\t\t\t\tfill: " + fill + ";\n\t\t\t\t\t}\n\t\t\t\t"; })
|
|
115
|
+
.join()
|
|
116
|
+
: "\n\t\t\t\t& > path {\n\t\t\t\t\tfill: " + pathFill + ";\n\t\t\t\t}\n\t\t\t"));
|
|
117
|
+
});
|
|
116
118
|
/**
|
|
117
119
|
* Displays an svg element based on provided children or 'src' prop.
|
|
118
120
|
* When using src, it loads the content from the given URL and saves in in cache.
|
package/svg/svg.types.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ColorGetter, SystemProps } from '../system';
|
|
2
2
|
import { Dict } from '../utils';
|
|
3
3
|
export declare type SvgProps = SystemProps & {
|
|
4
|
-
/**
|
|
5
|
-
|
|
4
|
+
/** If string, adds fill color to all paths. If array, adds fill color to consecutive path elements. */
|
|
5
|
+
pathFill?: ColorGetter | ColorGetter[];
|
|
6
6
|
/** If provided, loads an svg file from this URL and displays parsed content. */
|
|
7
7
|
src?: string;
|
|
8
8
|
};
|
package/system/custom.d.ts
CHANGED
|
@@ -8,10 +8,6 @@ export declare type MaxLinesProps = {
|
|
|
8
8
|
};
|
|
9
9
|
/** Provides styling to truncate multi-line text. */
|
|
10
10
|
export declare const maxLines: import("@xstyled/styled-components").StyleGenerator;
|
|
11
|
-
export declare type SpaceAroundProps = {
|
|
12
|
-
spaceAround?: number | string;
|
|
13
|
-
};
|
|
14
|
-
export declare const spaceAround: import("@xstyled/styled-components").StyleGenerator;
|
|
15
11
|
export declare type WordBreakProps = {
|
|
16
12
|
wordBreak?: 'normal' | 'break-all' | 'keep-all' | 'break-word';
|
|
17
13
|
};
|