@veracity/vui 0.3.0 → 0.3.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.d.ts +2 -2
- package/avatar/avatar.js +9 -29
- package/avatar/avatar.types.d.ts +9 -2
- package/avatar/helpers.d.ts +2 -0
- package/avatar/helpers.js +26 -0
- package/avatar/index.d.ts +1 -1
- package/avatar/index.js +1 -1
- package/avatar/theme.d.ts +1 -0
- package/avatar/theme.js +7 -0
- package/box/box.d.ts +2 -2
- package/box/box.js +9 -8
- package/box/box.types.d.ts +13 -2
- package/box/index.d.ts +1 -1
- package/box/index.js +1 -1
- package/box/theme.d.ts +1 -0
- package/box/theme.js +2 -0
- package/button/button.d.ts +7 -3
- package/button/button.js +24 -14
- package/button/button.types.d.ts +12 -30
- package/button/buttonIcon.d.ts +1 -0
- package/button/buttonIcon.js +3 -5
- package/button/buttonText.d.ts +1 -0
- package/button/buttonText.js +3 -5
- package/button/buttons.js +1 -1
- package/button/index.d.ts +2 -2
- package/button/index.js +3 -3
- package/button/theme.d.ts +1 -0
- package/button/theme.js +5 -3
- package/buttonGroup/buttonGroup.d.ts +5 -2
- package/buttonGroup/buttonGroup.js +12 -8
- package/buttonGroup/buttonGroup.types.d.ts +4 -2
- package/buttonGroup/helpers.d.ts +1 -1
- package/buttonGroup/helpers.js +1 -1
- package/buttonGroup/index.d.ts +1 -1
- package/buttonGroup/index.js +2 -2
- package/card/card.d.ts +4 -0
- package/card/card.js +8 -0
- package/card/card.types.d.ts +3 -2
- package/card/index.d.ts +1 -1
- package/card/index.js +1 -1
- package/card/theme.d.ts +1 -0
- package/card/theme.js +2 -0
- package/checkbox/checkbox.d.ts +5 -4
- package/checkbox/checkbox.js +20 -10
- package/checkbox/checkbox.types.d.ts +21 -4
- package/checkbox/checkboxGroup.d.ts +5 -2
- package/checkbox/checkboxGroup.js +11 -7
- package/checkbox/checkboxGroup.types.d.ts +9 -2
- package/checkbox/index.d.ts +1 -1
- package/checkbox/index.js +2 -2
- package/checkbox/theme.d.ts +1 -0
- package/checkbox/theme.js +2 -0
- package/core/index.d.ts +4 -5
- package/core/index.js +4 -12
- package/core/media.d.ts +38 -0
- package/core/media.js +79 -0
- package/core/styled.d.ts +3 -0
- package/core/styled.js +21 -3
- package/core/theme.d.ts +41 -0
- package/core/theme.js +94 -0
- package/core/vui.d.ts +31 -0
- package/core/vui.js +20 -0
- package/core/vuiProvider/fontFaces.js +4 -0
- package/core/{globalStyle.d.ts → vuiProvider/globalStyle.d.ts} +7 -0
- package/core/{globalStyle.js → vuiProvider/globalStyle.js} +17 -9
- package/core/vuiProvider/index.d.ts +5 -0
- package/{styles → core/vuiProvider}/index.js +8 -2
- package/core/vuiProvider/resetCSS.d.ts +3 -0
- package/core/{resetCSS.js → vuiProvider/resetCSS.js} +2 -1
- package/core/vuiProvider/vuiProvider.d.ts +13 -0
- package/core/{vuiProvider.js → vuiProvider/vuiProvider.js} +4 -1
- package/divider/divider.d.ts +2 -2
- package/divider/divider.js +5 -4
- package/divider/divider.types.d.ts +5 -2
- package/divider/index.d.ts +1 -1
- package/divider/index.js +1 -1
- package/divider/theme.d.ts +1 -0
- package/divider/theme.js +2 -0
- package/footer/consts.d.ts +3 -0
- package/footer/consts.js +3 -0
- package/footer/footer.d.ts +3 -1
- package/footer/footer.js +21 -10
- package/footer/footer.types.d.ts +5 -0
- package/footer/footerColumn.d.ts +122 -121
- package/footer/footerColumn.js +1 -0
- package/footer/footerHeading.d.ts +1 -0
- package/footer/footerHeading.js +1 -0
- package/footer/footerLink.d.ts +1 -0
- package/footer/footerLink.js +1 -0
- package/footer/footerRow.d.ts +1 -0
- package/footer/footerRow.js +1 -0
- package/footer/footerSection.d.ts +1 -0
- package/footer/footerSection.js +2 -1
- package/footer/footerTrademark.d.ts +1 -0
- package/footer/footerTrademark.js +1 -0
- package/footer/index.d.ts +2 -1
- package/footer/index.js +2 -2
- package/footer/theme.d.ts +1 -0
- package/footer/theme.js +2 -0
- package/header/context.d.ts +4 -0
- package/header/context.js +23 -0
- package/header/header.d.ts +34 -0
- package/header/header.js +118 -0
- package/header/header.types.d.ts +84 -0
- package/header/headerContent.d.ts +4 -0
- package/header/headerContent.js +28 -0
- package/header/headerCreateAccount.d.ts +4 -0
- package/header/headerCreateAccount.js +44 -0
- package/header/headerDivider.d.ts +4 -0
- package/header/headerDivider.js +28 -0
- package/header/headerLink.d.ts +4 -0
- package/header/headerLink.js +43 -0
- package/header/headerLinks.d.ts +4 -0
- package/header/headerLinks.js +41 -0
- package/header/headerLogo.d.ts +4 -0
- package/header/headerLogo.js +48 -0
- package/header/headerMobileContent.d.ts +4 -0
- package/header/headerMobileContent.js +30 -0
- package/header/headerMobileToggle.d.ts +4 -0
- package/header/headerMobileToggle.js +34 -0
- package/header/headerNotifications.d.ts +4 -0
- package/header/headerNotifications.js +52 -0
- package/header/headerProfile.d.ts +4 -0
- package/header/headerProfile.js +101 -0
- package/header/headerProfile.types.d.ts +35 -0
- package/header/headerServices.d.ts +4 -0
- package/header/headerServices.js +51 -0
- package/header/headerSignIn.d.ts +4 -0
- package/header/headerSignIn.js +40 -0
- package/header/index.d.ts +17 -0
- package/header/index.js +34 -0
- package/header/loggedInHeader.d.ts +4 -0
- package/header/loggedInHeader.js +53 -0
- package/header/loggedOutHeader.d.ts +4 -0
- package/header/loggedOutHeader.js +54 -0
- package/header/theme.d.ts +32 -0
- package/header/theme.js +52 -0
- package/heading/heading.d.ts +2 -2
- package/heading/heading.js +5 -4
- package/heading/heading.types.d.ts +7 -2
- package/heading/headings.js +1 -1
- package/heading/index.d.ts +1 -1
- package/heading/index.js +2 -2
- package/heading/theme.d.ts +1 -0
- package/heading/theme.js +2 -0
- package/icon/helpers.js +2 -2
- package/icon/icon.d.ts +1 -0
- package/icon/icon.js +2 -2
- package/icon/icon.types.d.ts +7 -4
- package/icon/index.d.ts +1 -1
- package/icon/index.js +1 -1
- package/icon/theme.d.ts +1 -0
- package/icon/theme.js +2 -0
- package/icons/baseIcons/fal/falFileInvoiceDollar.d.ts +3 -0
- package/icons/baseIcons/fal/falFileInvoiceDollar.js +7 -0
- package/icons/baseIcons/icons.d.ts +1 -0
- package/icons/baseIcons/icons.js +5 -3
- package/icons/baseIcons/types.d.ts +1 -1
- package/icons/cache.d.ts +15 -0
- package/icons/{library.js → cache.js} +10 -6
- package/icons/index.d.ts +1 -1
- package/icons/index.js +3 -3
- package/icons/types.d.ts +10 -3
- package/image/image.d.ts +2 -0
- package/image/image.js +11 -2
- package/image/image.types.d.ts +3 -2
- package/image/index.d.ts +1 -1
- package/image/index.js +1 -1
- package/image/theme.d.ts +1 -0
- package/image/theme.js +2 -0
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/input/helpers.d.ts +1 -0
- package/input/helpers.js +1 -0
- package/input/index.d.ts +1 -1
- package/input/index.js +2 -2
- package/input/input.d.ts +7 -3
- package/input/input.js +17 -7
- package/input/input.types.d.ts +33 -4
- package/input/inputIcon.d.ts +1 -0
- package/input/inputIcon.js +2 -1
- package/input/inputInput.d.ts +2 -2
- package/input/inputInput.js +10 -5
- package/input/theme.d.ts +1 -0
- package/input/theme.js +2 -0
- package/link/index.d.ts +1 -1
- package/link/index.js +2 -2
- package/link/link.d.ts +6 -3
- package/link/link.js +15 -9
- package/link/link.types.d.ts +12 -4
- package/link/linkIcon.d.ts +1 -0
- package/link/linkIcon.js +3 -5
- package/link/linkText.d.ts +1 -0
- package/link/linkText.js +3 -5
- package/link/theme.d.ts +6 -0
- package/link/theme.js +9 -1
- package/list/index.d.ts +1 -1
- package/list/index.js +2 -2
- package/list/list.d.ts +3 -3
- package/list/list.js +13 -8
- package/list/list.types.d.ts +29 -8
- package/list/listDivider.d.ts +1 -0
- package/list/listDivider.js +3 -5
- package/list/listHeading.d.ts +1 -0
- package/list/listHeading.js +4 -6
- package/list/listIcon.d.ts +1 -0
- package/list/listIcon.js +3 -5
- package/list/listItem.d.ts +5 -2
- package/list/listItem.js +52 -19
- package/list/listText.d.ts +1 -0
- package/list/listText.js +3 -5
- package/list/theme.d.ts +1 -0
- package/list/theme.js +5 -2
- package/menu/menu.d.ts +1 -0
- package/menu/menu.js +1 -0
- package/menu/menu.types.d.ts +3 -0
- package/menu/menuButton.d.ts +1 -0
- package/menu/menuButton.js +3 -4
- package/menu/menuItem.d.ts +1 -0
- package/menu/menuItem.js +2 -1
- package/menu/menuList.d.ts +1 -0
- package/menu/menuList.js +3 -4
- package/menu/theme.d.ts +16 -2
- package/menu/theme.js +18 -3
- package/notification/index.d.ts +2 -2
- package/notification/index.js +3 -3
- package/notification/notification.d.ts +5 -1
- package/notification/notification.js +12 -27
- package/notification/notification.types.d.ts +10 -2
- package/notification/notificationButton.d.ts +1 -0
- package/notification/notificationButton.js +4 -5
- package/notification/notificationIcon.d.ts +1 -0
- package/notification/notificationIcon.js +7 -7
- package/notification/notificationText.d.ts +1 -0
- package/notification/notificationText.js +3 -5
- package/notification/notificationTitle.d.ts +1 -0
- package/notification/notificationTitle.js +3 -5
- package/notification/theme.d.ts +1 -0
- package/notification/theme.js +2 -0
- package/p/index.d.ts +1 -1
- package/p/index.js +1 -1
- package/p/p.d.ts +2 -2
- package/p/p.js +5 -4
- package/p/p.types.d.ts +7 -2
- package/p/theme.d.ts +1 -0
- package/p/theme.js +2 -0
- package/package.json +1 -1
- package/panel/index.d.ts +1 -1
- package/panel/index.js +1 -1
- package/panel/panel.d.ts +4 -0
- package/panel/panel.js +4 -0
- package/panel/panel.types.d.ts +1 -2
- package/panel/theme.d.ts +1 -0
- package/panel/theme.js +2 -0
- package/popover/consts.d.ts +6 -0
- package/popover/consts.js +42 -0
- package/popover/index.d.ts +2 -1
- package/popover/index.js +4 -2
- package/popover/popover.d.ts +5 -2
- package/popover/popover.js +16 -2
- package/popover/popover.types.d.ts +4 -1
- package/popover/popoverContent.d.ts +2 -1
- package/popover/popoverContent.js +6 -1
- package/popover/popoverStyle.js +9 -0
- package/popover/popoverTrigger.d.ts +4 -0
- package/popover/popoverTrigger.js +4 -0
- package/popover/theme.d.ts +1 -0
- package/popover/theme.js +2 -0
- package/popover/usePopover.d.ts +5 -0
- package/popover/usePopover.js +21 -11
- package/popover/usePopover.types.d.ts +17 -6
- package/radio/index.d.ts +1 -1
- package/radio/index.js +2 -2
- package/radio/radio.d.ts +5 -4
- package/radio/radio.js +20 -10
- package/radio/radio.types.d.ts +19 -4
- package/radio/radioGroup.d.ts +5 -2
- package/radio/radioGroup.js +11 -7
- package/radio/radioGroup.types.d.ts +10 -2
- package/radio/theme.d.ts +1 -0
- package/radio/theme.js +2 -0
- package/skeleton/index.d.ts +1 -1
- package/skeleton/index.js +1 -1
- package/skeleton/skeleton.d.ts +2 -2
- package/skeleton/skeleton.js +4 -3
- package/skeleton/skeleton.types.d.ts +5 -2
- package/skeleton/theme.d.ts +1 -0
- package/skeleton/theme.js +2 -0
- package/spinner/index.d.ts +1 -1
- package/spinner/index.js +1 -1
- package/spinner/spinner.d.ts +6 -2
- package/spinner/spinner.js +12 -5
- package/spinner/spinner.types.d.ts +10 -6
- package/spinner/theme.d.ts +1 -0
- package/spinner/theme.js +2 -0
- package/svg/helpers.d.ts +1 -1
- package/svg/index.d.ts +1 -1
- package/svg/index.js +1 -1
- package/svg/svg.d.ts +6 -1
- package/svg/svg.js +14 -5
- package/svg/svg.types.d.ts +6 -4
- package/switch/context.d.ts +2 -2
- package/switch/index.d.ts +1 -1
- package/switch/index.js +2 -2
- package/switch/switch.d.ts +6 -3
- package/switch/switch.js +15 -12
- package/switch/switch.types.d.ts +37 -4
- package/switch/switchButton.d.ts +5 -5
- package/switch/switchButton.js +34 -26
- package/switch/switchLabel.d.ts +1 -0
- package/switch/switchLabel.js +3 -5
- package/switch/theme.d.ts +1 -0
- package/switch/theme.js +2 -0
- package/system/animations.d.ts +3 -4
- package/system/backgrounds.d.ts +4 -5
- package/system/borders.d.ts +60 -61
- package/system/custom.d.ts +4 -4
- package/system/effects.d.ts +7 -8
- package/system/flexboxGrids.d.ts +5 -6
- package/system/flexboxes.d.ts +28 -29
- package/system/grids.d.ts +25 -26
- package/system/index.d.ts +0 -1
- package/system/index.js +0 -6
- package/system/interactivity.d.ts +11 -12
- package/system/layout.d.ts +31 -32
- package/system/sizing.d.ts +13 -14
- package/system/space.d.ts +37 -38
- package/system/system.d.ts +4 -5
- package/system/system.js +3 -1
- package/system/tables.d.ts +5 -6
- package/system/transforms.d.ts +22 -23
- package/system/transitions.d.ts +11 -12
- package/system/typography.d.ts +33 -34
- package/t/index.d.ts +1 -1
- package/t/index.js +1 -1
- package/t/t.d.ts +2 -2
- package/t/t.js +5 -4
- package/t/t.types.d.ts +8 -2
- package/t/theme.d.ts +1 -0
- package/t/theme.js +2 -0
- package/tag/index.d.ts +1 -1
- package/tag/index.js +2 -2
- package/tag/tag.d.ts +6 -3
- package/tag/tag.js +14 -7
- package/tag/tag.types.d.ts +16 -2
- package/tag/tagButton.d.ts +1 -0
- package/tag/tagButton.js +4 -16
- package/tag/tagIcon.d.ts +1 -0
- package/tag/tagIcon.js +3 -5
- package/tag/tagText.d.ts +1 -0
- package/tag/tagText.js +3 -5
- package/tag/theme.d.ts +1 -0
- package/tag/theme.js +8 -0
- package/textarea/helpers.d.ts +1 -0
- package/textarea/helpers.js +1 -0
- package/textarea/index.d.ts +1 -1
- package/textarea/index.js +1 -1
- package/textarea/textarea.d.ts +5 -3
- package/textarea/textarea.js +23 -10
- package/textarea/textarea.types.d.ts +22 -2
- package/textarea/theme.d.ts +1 -0
- package/textarea/theme.js +2 -0
- package/theme/components.d.ts +76 -2
- package/theme/components.js +38 -36
- package/theme/defaultTheme.d.ts +81 -2
- package/theme/foundations/colors.d.ts +10 -0
- package/theme/foundations/colors.js +8 -2
- package/theme/foundations/index.d.ts +5 -0
- package/theme/foundations/shadows.js +3 -3
- package/theme/foundations/transformers.js +3 -2
- package/theme/index.d.ts +1 -3
- package/theme/index.js +4 -5
- package/theme/types.d.ts +3 -2
- package/utils/assertion.d.ts +5 -5
- package/utils/assertion.js +8 -4
- package/utils/object.d.ts +2 -2
- package/utils/object.js +3 -1
- package/utils/styles.d.ts +2 -2
- package/utils/styles.js +4 -4
- package/utils/types.d.ts +8 -3
- package/core/types/component.d.ts +0 -25
- package/core/types/index.d.ts +0 -2
- package/core/types/index.js +0 -14
- package/core/types/themeGet.d.ts +0 -24
- package/core/utils.d.ts +0 -56
- package/core/utils.js +0 -194
- package/core/vuiProvider.d.ts +0 -20
- package/icons/library.d.ts +0 -11
- package/popover/plugins.d.ts +0 -3
- package/popover/plugins.js +0 -24
- package/styles/fontFaces.js +0 -4
- package/styles/helpers.d.ts +0 -4
- package/styles/helpers.js +0 -8
- package/styles/index.d.ts +0 -3
- /package/{styles → core/vuiProvider}/animations.d.ts +0 -0
- /package/{styles → core/vuiProvider}/animations.js +0 -0
- /package/{styles → core/vuiProvider}/fontFaces.d.ts +0 -0
- /package/{core/types/component.js → header/header.types.js} +0 -0
- /package/{core/types/themeGet.js → header/headerProfile.types.js} +0 -0
- /package/{core/resetCSS.d.ts → popover/popoverStyle.d.ts} +0 -0
package/skeleton/index.d.ts
CHANGED
package/skeleton/index.js
CHANGED
|
@@ -15,6 +15,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
16
|
exports.default = void 0;
|
|
17
17
|
__exportStar(require("./skeleton"), exports);
|
|
18
|
-
__exportStar(require("./skeleton.types"), exports);
|
|
19
18
|
var skeleton_1 = require("./skeleton");
|
|
20
19
|
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(skeleton_1).default; } });
|
|
20
|
+
__exportStar(require("./skeleton.types"), exports);
|
package/skeleton/skeleton.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SkeletonProps } from './skeleton.types';
|
|
2
|
-
import
|
|
3
|
-
|
|
2
|
+
export declare const SkeletonBase: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, import("..").SystemProps, never>;
|
|
3
|
+
/** Displays one or more animated skeleton elements to signify loading content. */
|
|
4
4
|
export declare const Skeleton: import("../core").VuiComponent<"div", SkeletonProps>;
|
|
5
5
|
export default Skeleton;
|
package/skeleton/skeleton.js
CHANGED
|
@@ -31,11 +31,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
31
31
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
32
|
exports.Skeleton = exports.SkeletonBase = void 0;
|
|
33
33
|
var react_1 = __importDefault(require("react"));
|
|
34
|
-
var styled_components_1 = __importDefault(require("styled-components"));
|
|
35
34
|
var core_1 = require("../core");
|
|
36
|
-
var system_1 = require("../system");
|
|
37
35
|
var utils_1 = require("../utils");
|
|
38
|
-
exports.SkeletonBase =
|
|
36
|
+
exports.SkeletonBase = core_1.styled.divBox(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n\tanimation: vui-pulse 1.5s ease-in-out 0.5s infinite;\n"], ["\n\tanimation: vui-pulse 1.5s ease-in-out 0.5s infinite;\n"
|
|
37
|
+
/** Displays one or more animated skeleton elements to signify loading content. */
|
|
38
|
+
])));
|
|
39
|
+
/** Displays one or more animated skeleton elements to signify loading content. */
|
|
39
40
|
exports.Skeleton = (0, core_1.vui)(function (props, ref) {
|
|
40
41
|
var _a = (0, core_1.omitThemingProps)(props), className = _a.className, _b = _a.repeat, repeat = _b === void 0 ? 1 : _b, rest = __rest(_a, ["className", "repeat"]);
|
|
41
42
|
var styles = (0, core_1.useStyleConfig)('Skeleton', props);
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { SystemProps } from '../system';
|
|
2
2
|
import { ThemingProps } from '../theme';
|
|
3
|
-
export
|
|
3
|
+
export declare type SkeletonProps = SystemProps & ThemingProps<'Skeleton'> & {
|
|
4
|
+
/** Children are disabled for this component. */
|
|
4
5
|
children?: never;
|
|
6
|
+
/** Available theme colors for this component. @default blue */
|
|
5
7
|
colorScheme?: 'blue' | 'grey';
|
|
8
|
+
/** Displays given amount of skeleton elements. */
|
|
6
9
|
repeat?: number;
|
|
7
|
-
}
|
|
10
|
+
};
|
package/skeleton/theme.d.ts
CHANGED
package/skeleton/theme.js
CHANGED
|
@@ -17,6 +17,7 @@ function variantRectangle(props) {
|
|
|
17
17
|
};
|
|
18
18
|
return styles;
|
|
19
19
|
}
|
|
20
|
+
var baseStyle = {};
|
|
20
21
|
var defaultProps = {
|
|
21
22
|
colorScheme: 'blue',
|
|
22
23
|
size: 'md',
|
|
@@ -41,6 +42,7 @@ var variants = {
|
|
|
41
42
|
rect: variantRectangle
|
|
42
43
|
};
|
|
43
44
|
exports.default = {
|
|
45
|
+
baseStyle: baseStyle,
|
|
44
46
|
defaultProps: defaultProps,
|
|
45
47
|
sizes: sizes,
|
|
46
48
|
variants: variants
|
package/spinner/index.d.ts
CHANGED
package/spinner/index.js
CHANGED
|
@@ -15,6 +15,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
16
|
exports.default = void 0;
|
|
17
17
|
__exportStar(require("./spinner"), exports);
|
|
18
|
-
__exportStar(require("./spinner.types"), exports);
|
|
19
18
|
var spinner_1 = require("./spinner");
|
|
20
19
|
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(spinner_1).default; } });
|
|
20
|
+
__exportStar(require("./spinner.types"), exports);
|
package/spinner/spinner.d.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const SpinnerCircle: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme,
|
|
1
|
+
import { SpinnerProps } from './spinner.types';
|
|
2
|
+
export declare const SpinnerCircle: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, import("..").SystemProps, never>;
|
|
3
|
+
/**
|
|
4
|
+
* Displays a spinning circular element with optional text to signify loading content.
|
|
5
|
+
* Handles different positioning scenarios, speeds and coloring of the circle.
|
|
6
|
+
*/
|
|
3
7
|
export declare const Spinner: import("../core").VuiComponent<"div", SpinnerProps>;
|
|
4
8
|
export default Spinner;
|
package/spinner/spinner.js
CHANGED
|
@@ -31,14 +31,21 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
31
31
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
32
|
exports.Spinner = exports.SpinnerCircle = void 0;
|
|
33
33
|
var react_1 = __importDefault(require("react"));
|
|
34
|
-
var styled_components_1 = __importDefault(require("styled-components"));
|
|
35
|
-
var consts_1 = require("./consts");
|
|
36
34
|
var box_1 = __importDefault(require("../box"));
|
|
37
35
|
var core_1 = require("../core");
|
|
38
|
-
var system_1 = require("../system");
|
|
39
36
|
var t_1 = __importDefault(require("../t"));
|
|
40
37
|
var utils_1 = require("../utils");
|
|
41
|
-
|
|
38
|
+
var consts_1 = require("./consts");
|
|
39
|
+
exports.SpinnerCircle = core_1.styled.divBox(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n\tborder-radius: round;\n\tdisplay: flex;\n\tflex-shrink: 0;\n"], ["\n\tborder-radius: round;\n\tdisplay: flex;\n\tflex-shrink: 0;\n"
|
|
40
|
+
/**
|
|
41
|
+
* Displays a spinning circular element with optional text to signify loading content.
|
|
42
|
+
* Handles different positioning scenarios, speeds and coloring of the circle.
|
|
43
|
+
*/
|
|
44
|
+
])));
|
|
45
|
+
/**
|
|
46
|
+
* Displays a spinning circular element with optional text to signify loading content.
|
|
47
|
+
* Handles different positioning scenarios, speeds and coloring of the circle.
|
|
48
|
+
*/
|
|
42
49
|
exports.Spinner = (0, core_1.vui)(function (props, ref) {
|
|
43
50
|
var _a;
|
|
44
51
|
var className = props.className, emptyColor = props.emptyColor, size = props.size, _b = props.speed, speedProp = _b === void 0 ? 'normal' : _b, text = props.text, _c = props.textPosition, textPosition = _c === void 0 ? 'bottom' : _c, thickness = props.thickness, rest = __rest(props, ["className", "emptyColor", "size", "speed", "text", "textPosition", "thickness"]);
|
|
@@ -53,7 +60,7 @@ exports.Spinner = (0, core_1.vui)(function (props, ref) {
|
|
|
53
60
|
w: isCustomSize ? size : undefined
|
|
54
61
|
});
|
|
55
62
|
return (react_1.default.createElement(box_1.default, __assign({ center: true, className: (0, utils_1.cs)('vui-spinner', className), ref: ref, transitionDuration: "fast" }, styles.container, positionProps.container, rest),
|
|
56
|
-
react_1.default.createElement(exports.SpinnerCircle, __assign({ animation: "spin"
|
|
63
|
+
react_1.default.createElement(exports.SpinnerCircle, __assign({ animation: "vui-spin " + speed + " linear infinite", className: "vui-spinnerCircle" }, styles.circle, positionProps.circle, circleProps)),
|
|
57
64
|
text && (react_1.default.createElement(t_1.default, __assign({ className: "vui-spinnerText" }, styles.text), text))));
|
|
58
65
|
});
|
|
59
66
|
exports.Spinner.displayName = 'Spinner';
|
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
import { BoxProps } from '../box';
|
|
2
|
-
import { SystemProps } from '../system';
|
|
3
2
|
import { ThemingProps } from '../theme';
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
export interface SpinnerProps extends Omit<BoxProps, 'size' | 'variant'>, Omit<ThemingProps<'Spinner'>, 'size'> {
|
|
3
|
+
export declare type SpinnerProps = Omit<BoxProps, 'size' | 'variant'> & Omit<ThemingProps<'Spinner'>, 'size'> & {
|
|
4
|
+
/** Children are disabled for this component. */
|
|
8
5
|
children?: never;
|
|
6
|
+
/** Available theme colors for this component. @default blue */
|
|
9
7
|
colorScheme?: 'blue' | 'grey' | 'prussian';
|
|
8
|
+
/** Color of the 'empty' part of the circle. */
|
|
10
9
|
emptyColor?: string;
|
|
10
|
+
/** Amount of time needed to make a full rotation. */
|
|
11
11
|
speed?: string;
|
|
12
|
+
/** Theme size or a number defining height and width. */
|
|
12
13
|
size?: ThemingProps<'Spinner'>['size'] | number;
|
|
14
|
+
/** Displays given text next to the spinner. */
|
|
13
15
|
text?: string;
|
|
16
|
+
/** Text placement relative to the spinner. */
|
|
14
17
|
textPosition?: 'bottom' | 'left' | 'right' | 'top';
|
|
18
|
+
/** Thickness of the spinner circle in pixels. */
|
|
15
19
|
thickness?: number;
|
|
16
|
-
}
|
|
20
|
+
};
|
package/spinner/theme.d.ts
CHANGED
package/spinner/theme.js
CHANGED
|
@@ -12,6 +12,7 @@ function variantDefault(props) {
|
|
|
12
12
|
var text = {};
|
|
13
13
|
return { container: container, circle: circle, text: text };
|
|
14
14
|
}
|
|
15
|
+
var baseStyle = {};
|
|
15
16
|
var defaultProps = {
|
|
16
17
|
colorScheme: 'blue',
|
|
17
18
|
size: 'page',
|
|
@@ -66,6 +67,7 @@ var variants = {
|
|
|
66
67
|
default: variantDefault
|
|
67
68
|
};
|
|
68
69
|
exports.default = {
|
|
70
|
+
baseStyle: baseStyle,
|
|
69
71
|
defaultProps: defaultProps,
|
|
70
72
|
parts: parts,
|
|
71
73
|
sizes: sizes,
|
package/svg/helpers.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { SvgState } from './svg.types';
|
|
2
1
|
import { Dict } from '../utils';
|
|
2
|
+
import { SvgState } from './svg.types';
|
|
3
3
|
/** Returns an object with given element's HTML attributes. */
|
|
4
4
|
export declare function getAttributes(element?: Element): Dict<string>;
|
|
5
5
|
/** Returns content of the SVG HTML string by stripping the svg tag. */
|
package/svg/index.d.ts
CHANGED
package/svg/index.js
CHANGED
|
@@ -15,6 +15,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
16
|
exports.default = void 0;
|
|
17
17
|
__exportStar(require("./svg"), exports);
|
|
18
|
-
__exportStar(require("./svg.types"), exports);
|
|
19
18
|
var svg_1 = require("./svg");
|
|
20
19
|
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(svg_1).default; } });
|
|
20
|
+
__exportStar(require("./svg.types"), exports);
|
package/svg/svg.d.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
import { SvgProps } from './svg.types';
|
|
2
1
|
import { VuiComponent } from '../core';
|
|
2
|
+
import { SvgProps } from './svg.types';
|
|
3
3
|
export declare const SvgBase: VuiComponent<'svg', SvgProps>;
|
|
4
|
+
/**
|
|
5
|
+
* Displays an svg element based on provided children or 'src' prop.
|
|
6
|
+
* When using src, it loads the content from the given URL and saves in in cache.
|
|
7
|
+
* Then, renders the svg by parsing loaded content (Review potential for XSS due to innerHTML).
|
|
8
|
+
*/
|
|
4
9
|
export declare const Svg: VuiComponent<"svg", SvgProps>;
|
|
5
10
|
export default Svg;
|
package/svg/svg.js
CHANGED
|
@@ -102,13 +102,22 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
102
102
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
103
103
|
exports.Svg = exports.SvgBase = void 0;
|
|
104
104
|
var react_1 = __importStar(require("react"));
|
|
105
|
-
var styled_components_1 = __importDefault(require("styled-components"));
|
|
106
|
-
var cache_1 = __importDefault(require("./cache"));
|
|
107
|
-
var helpers_1 = require("./helpers");
|
|
108
105
|
var core_1 = require("../core");
|
|
109
|
-
var system_1 = require("../system");
|
|
110
106
|
var utils_1 = require("../utils");
|
|
111
|
-
|
|
107
|
+
var cache_1 = __importDefault(require("./cache"));
|
|
108
|
+
var helpers_1 = require("./helpers");
|
|
109
|
+
exports.SvgBase = core_1.styled.svgBox(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n\t& > path:nth-child(1) {\n\t\tfill: ", ";\n\t}\n\n\t& > path:nth-child(2) {\n\t\tfill: ", ";\n\t}\n"], ["\n\t& > path:nth-child(1) {\n\t\tfill: ", ";\n\t}\n\n\t& > path:nth-child(2) {\n\t\tfill: ", ";\n\t}\n"
|
|
110
|
+
/**
|
|
111
|
+
* Displays an svg element based on provided children or 'src' prop.
|
|
112
|
+
* When using src, it loads the content from the given URL and saves in in cache.
|
|
113
|
+
* Then, renders the svg by parsing loaded content (Review potential for XSS due to innerHTML).
|
|
114
|
+
*/
|
|
115
|
+
])), function (p) { var _a, _b, _c; return core_1.th.color((_c = (_b = (_a = p.fill) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : p.fill) !== null && _c !== void 0 ? _c : '')(p); }, function (p) { var _a, _b, _c; return core_1.th.color((_c = (_b = (_a = p.fill) === null || _a === void 0 ? void 0 : _a[1]) !== null && _b !== void 0 ? _b : p.fill) !== null && _c !== void 0 ? _c : '')(p); });
|
|
116
|
+
/**
|
|
117
|
+
* Displays an svg element based on provided children or 'src' prop.
|
|
118
|
+
* When using src, it loads the content from the given URL and saves in in cache.
|
|
119
|
+
* Then, renders the svg by parsing loaded content (Review potential for XSS due to innerHTML).
|
|
120
|
+
*/
|
|
112
121
|
exports.Svg = (0, core_1.vui)(function (props, ref) {
|
|
113
122
|
var children = props.children, className = props.className, src = props.src, rest = __rest(props, ["children", "className", "src"]);
|
|
114
123
|
var _a = __read((0, react_1.useState)((0, helpers_1.initState)()), 2), state = _a[0], setState = _a[1];
|
package/svg/svg.types.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { ColorGetter, SystemProps } from '../system';
|
|
2
2
|
import { Dict } from '../utils';
|
|
3
|
-
export
|
|
3
|
+
export declare type SvgProps = SystemProps & {
|
|
4
|
+
/** Color or aray of colors used for first and second path elements. */
|
|
4
5
|
fill?: ColorGetter | ColorGetter[];
|
|
6
|
+
/** If provided, loads an svg file from this URL and displays parsed content. */
|
|
5
7
|
src?: string;
|
|
6
|
-
}
|
|
7
|
-
export
|
|
8
|
+
};
|
|
9
|
+
export declare type SvgState = {
|
|
8
10
|
content?: string;
|
|
9
11
|
svgAttributes: Dict<string>;
|
|
10
|
-
}
|
|
12
|
+
};
|
package/switch/context.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
3
|
-
declare const SwitchProvider: import("react").Provider<
|
|
2
|
+
import { SwitchContext } from './switch.types';
|
|
3
|
+
declare const SwitchProvider: import("react").Provider<SwitchContext>, useSwitch: () => SwitchContext;
|
|
4
4
|
export { SwitchProvider, useSwitch };
|
package/switch/index.d.ts
CHANGED
package/switch/index.js
CHANGED
|
@@ -15,9 +15,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
16
|
exports.default = void 0;
|
|
17
17
|
__exportStar(require("./context"), exports);
|
|
18
|
+
var switch_1 = require("./switch");
|
|
19
|
+
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(switch_1).default; } });
|
|
18
20
|
__exportStar(require("./switch"), exports);
|
|
19
21
|
__exportStar(require("./switch.types"), exports);
|
|
20
22
|
__exportStar(require("./switchButton"), exports);
|
|
21
23
|
__exportStar(require("./switchLabel"), exports);
|
|
22
|
-
var switch_1 = require("./switch");
|
|
23
|
-
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(switch_1).default; } });
|
package/switch/switch.d.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
import { VuiComponent } from '../core';
|
|
1
2
|
import { SwitchProps } from './switch.types';
|
|
2
3
|
import { SwitchButton } from './switchButton';
|
|
3
4
|
import { SwitchLabel } from './switchLabel';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
export declare const SwitchBase: import("styled-components").StyledComponent<"label", import("styled-components").DefaultTheme, import("..").SystemProps, never>;
|
|
6
|
+
/**
|
|
7
|
+
* Displays a toggle button with supporting text. Allows passing custom elements as side labels and inner labels.
|
|
8
|
+
* Forwards many relevant props to the innner input element. Exposes some props to the children via context.
|
|
9
|
+
*/
|
|
7
10
|
export declare const Switch: VuiComponent<"label", SwitchProps> & {
|
|
8
11
|
Button: typeof SwitchButton;
|
|
9
12
|
Label: typeof SwitchLabel;
|
package/switch/switch.js
CHANGED
|
@@ -44,24 +44,27 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
44
44
|
}
|
|
45
45
|
return t;
|
|
46
46
|
};
|
|
47
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
48
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
49
|
-
};
|
|
50
47
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
51
48
|
exports.Switch = exports.SwitchBase = void 0;
|
|
52
49
|
var react_1 = __importStar(require("react"));
|
|
53
|
-
var
|
|
50
|
+
var core_1 = require("../core");
|
|
51
|
+
var utils_1 = require("../utils");
|
|
54
52
|
var context_1 = require("./context");
|
|
55
53
|
var switchButton_1 = require("./switchButton");
|
|
56
54
|
var switchLabel_1 = require("./switchLabel");
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
55
|
+
exports.SwitchBase = core_1.styled.labelBox(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n\talign-items: center;\n\tcursor: pointer;\n\tdisplay: inline-flex;\n\tline-height: normal;\n\twidth: fit-content;\n\n\t&[aria-disabled='true'] {\n\t\tcursor: not-allowed;\n\n\t\t.vui-switchLabel {\n\t\t\tcolor: disabled.color;\n\t\t}\n\t}\n"], ["\n\talign-items: center;\n\tcursor: pointer;\n\tdisplay: inline-flex;\n\tline-height: normal;\n\twidth: fit-content;\n\n\t&[aria-disabled='true'] {\n\t\tcursor: not-allowed;\n\n\t\t.vui-switchLabel {\n\t\t\tcolor: disabled.color;\n\t\t}\n\t}\n"
|
|
56
|
+
/**
|
|
57
|
+
* Displays a toggle button with supporting text. Allows passing custom elements as side labels and inner labels.
|
|
58
|
+
* Forwards many relevant props to the innner input element. Exposes some props to the children via context.
|
|
59
|
+
*/
|
|
60
|
+
])));
|
|
61
|
+
/**
|
|
62
|
+
* Displays a toggle button with supporting text. Allows passing custom elements as side labels and inner labels.
|
|
63
|
+
* Forwards many relevant props to the innner input element. Exposes some props to the children via context.
|
|
64
|
+
*/
|
|
62
65
|
exports.Switch = (0, core_1.vui)(function (props, ref) {
|
|
63
66
|
var _a;
|
|
64
|
-
var button = props.button, checked = props.checked, children = props.children, className = props.className, colorScheme = props.colorScheme, defaultChecked = props.defaultChecked, disabled = props.disabled, id = props.id, innerLabelOff = props.innerLabelOff, innerLabelOn = props.innerLabelOn, inputRef = props.inputRef, labelLeft = props.labelLeft, labelRight = props.labelRight, name = props.name, onBlur = props.onBlur, onChange = props.onChange, onFocus = props.onFocus, required = props.required, size = props.size, value = props.value, variant = props.variant, rest = __rest(props, ["button", "checked", "children", "className", "colorScheme", "defaultChecked", "disabled", "id", "innerLabelOff", "innerLabelOn", "inputRef", "labelLeft", "labelRight", "name", "onBlur", "onChange", "onFocus", "required", "size", "value", "variant"]);
|
|
67
|
+
var button = props.button, checked = props.checked, children = props.children, className = props.className, colorScheme = props.colorScheme, defaultChecked = props.defaultChecked, disabled = props.disabled, id = props.id, innerLabelOff = props.innerLabelOff, innerLabelOn = props.innerLabelOn, inputProps = props.inputProps, inputRef = props.inputRef, labelLeft = props.labelLeft, labelRight = props.labelRight, name = props.name, onBlur = props.onBlur, onChange = props.onChange, onFocus = props.onFocus, required = props.required, size = props.size, value = props.value, variant = props.variant, rest = __rest(props, ["button", "checked", "children", "className", "colorScheme", "defaultChecked", "disabled", "id", "innerLabelOff", "innerLabelOn", "inputProps", "inputRef", "labelLeft", "labelRight", "name", "onBlur", "onChange", "onFocus", "required", "size", "value", "variant"]);
|
|
65
68
|
var styles = (0, core_1.useStyleConfig)('Switch', props);
|
|
66
69
|
var context = (0, react_1.useMemo)(function () {
|
|
67
70
|
return (0, utils_1.filterUndefined)({
|
|
@@ -80,11 +83,11 @@ exports.Switch = (0, core_1.vui)(function (props, ref) {
|
|
|
80
83
|
});
|
|
81
84
|
}, [checked, colorScheme, defaultChecked, disabled, name, onBlur, onChange, onFocus, required, size, value, variant]);
|
|
82
85
|
var aliasedProps = (0, utils_1.filterUndefined)({
|
|
83
|
-
'
|
|
86
|
+
'aria-disabled': disabled
|
|
84
87
|
});
|
|
85
88
|
return (react_1.default.createElement(context_1.SwitchProvider, { value: context },
|
|
86
89
|
react_1.default.createElement(exports.SwitchBase, __assign({ className: (0, utils_1.cs)('vui-switch', className), ref: ref }, styles.container, aliasedProps, rest),
|
|
87
|
-
(0, utils_1.isReactText)(labelLeft) ? react_1.default.createElement(switchLabel_1.SwitchLabel, { mr: 1, text: labelLeft }) : labelLeft, (_a = children !== null && children !== void 0 ? children : button) !== null && _a !== void 0 ? _a : react_1.default.createElement(switchButton_1.SwitchButton, __assign({}, { id: id, innerLabelOff: innerLabelOff, innerLabelOn: innerLabelOn, inputRef: inputRef })),
|
|
90
|
+
(0, utils_1.isReactText)(labelLeft) ? react_1.default.createElement(switchLabel_1.SwitchLabel, { mr: 1, text: labelLeft }) : labelLeft, (_a = children !== null && children !== void 0 ? children : button) !== null && _a !== void 0 ? _a : react_1.default.createElement(switchButton_1.SwitchButton, __assign({}, { id: id, innerLabelOff: innerLabelOff, innerLabelOn: innerLabelOn, inputProps: inputProps, inputRef: inputRef })),
|
|
88
91
|
(0, utils_1.isReactText)(labelRight) ? react_1.default.createElement(switchLabel_1.SwitchLabel, { ml: 1, text: labelRight }) : labelRight)));
|
|
89
92
|
});
|
|
90
93
|
exports.Switch.displayName = 'Switch';
|
package/switch/switch.types.d.ts
CHANGED
|
@@ -2,35 +2,68 @@ import { ReactNode, ReactText } from 'react';
|
|
|
2
2
|
import { SystemProps } from '../system';
|
|
3
3
|
import { ThemingProps } from '../theme';
|
|
4
4
|
import { ChangeEventHandler, FocusEventHandler, PropsOf } from '../utils';
|
|
5
|
-
export
|
|
5
|
+
export declare type SwitchButtonProps = SystemProps & ThemingProps<'Switch'> & {
|
|
6
|
+
/** Provides value to switch in controlled mode. */
|
|
6
7
|
checked?: boolean;
|
|
8
|
+
/** Available theme colors for this component. */
|
|
7
9
|
colorScheme?: 'blue' | 'green' | 'prussian';
|
|
10
|
+
/** Disables switch and related elements with the right styling. */
|
|
8
11
|
disabled?: boolean;
|
|
12
|
+
/** Displays custom content to the left of switch thumb. */
|
|
9
13
|
innerLabelOff?: ReactNode;
|
|
14
|
+
/** Displays custom content to the right of switch thumb. */
|
|
10
15
|
innerLabelOn?: ReactNode;
|
|
16
|
+
/** Props object passed to the inner input element. */
|
|
11
17
|
inputProps?: PropsOf<'input', SystemProps>;
|
|
18
|
+
/** Ref passed to the inner input element. */
|
|
12
19
|
inputRef?: React.MutableRefObject<HTMLInputElement | null> | null;
|
|
20
|
+
/** Passed to the inner input. */
|
|
13
21
|
name?: string;
|
|
22
|
+
/** Passed to the inner input. */
|
|
14
23
|
onBlur?: FocusEventHandler;
|
|
24
|
+
/** Passed to the inner input. */
|
|
15
25
|
onChange?: ChangeEventHandler;
|
|
26
|
+
/** Passed to the inner input. */
|
|
16
27
|
onFocus?: FocusEventHandler;
|
|
28
|
+
/** Passed to the inner input. */
|
|
17
29
|
required?: boolean;
|
|
30
|
+
/** Passed to the inner input. */
|
|
18
31
|
value?: number | string;
|
|
19
|
-
}
|
|
20
|
-
export
|
|
32
|
+
};
|
|
33
|
+
export declare type SwitchContext = Pick<SwitchProps, 'checked' | 'colorScheme' | 'disabled' | 'name' | 'onBlur' | 'onChange' | 'onFocus' | 'required' | 'size' | 'value' | 'variant'> & {
|
|
34
|
+
defaultChecked?: boolean;
|
|
35
|
+
};
|
|
36
|
+
export declare type SwitchProps = SystemProps & ThemingProps<'Switch'> & {
|
|
37
|
+
/** Socket displaying a custom toggle button component. */
|
|
21
38
|
button?: ReactNode;
|
|
39
|
+
/** Provides value to switch button in controlled mode. */
|
|
22
40
|
checked?: boolean;
|
|
41
|
+
/** Available theme colors for this component. @default blue */
|
|
23
42
|
colorScheme?: 'blue' | 'green' | 'prussian';
|
|
43
|
+
/** Disables switch and related elements with the right styling. */
|
|
24
44
|
disabled?: boolean;
|
|
45
|
+
/** Displays custom content to the left of switch thumb. */
|
|
25
46
|
innerLabelOff?: ReactNode;
|
|
47
|
+
/** Displays custom content to the right of switch thumb. */
|
|
26
48
|
innerLabelOn?: ReactNode;
|
|
49
|
+
/** Props object passed to the inner input element. */
|
|
50
|
+
inputProps?: PropsOf<'input', SystemProps>;
|
|
51
|
+
/** Ref passed to the inner input element. */
|
|
27
52
|
inputRef?: React.MutableRefObject<HTMLInputElement | null> | null;
|
|
53
|
+
/** Socket displaying content on the left. */
|
|
28
54
|
labelLeft?: ReactNode;
|
|
55
|
+
/** Socket displaying content on the right. */
|
|
29
56
|
labelRight?: ReactNode;
|
|
57
|
+
/** Passed to the inner input. */
|
|
30
58
|
name?: string;
|
|
59
|
+
/** Passed to the inner input. */
|
|
31
60
|
onBlur?: FocusEventHandler;
|
|
61
|
+
/** Passed to the inner input. */
|
|
32
62
|
onChange?: ChangeEventHandler;
|
|
63
|
+
/** Passed to the inner input. */
|
|
33
64
|
onFocus?: FocusEventHandler;
|
|
65
|
+
/** Passed to the inner input. */
|
|
34
66
|
required?: boolean;
|
|
67
|
+
/** Passed to the inner input. */
|
|
35
68
|
value?: ReactText;
|
|
36
|
-
}
|
|
69
|
+
};
|
package/switch/switchButton.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { SwitchButtonProps } from './switch.types';
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
export declare const SwitchButtonBase: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme, import("..").SystemProps, never>;
|
|
3
|
+
/**
|
|
4
|
+
* Controls the logic and visuals of multiple inner parts, such as input, track or thumb elements.
|
|
5
|
+
* Handles controlled and uncontrolled modes.
|
|
6
|
+
*/
|
|
7
7
|
export declare const SwitchButton: import("../core").VuiComponent<"span", SwitchButtonProps>;
|
|
8
8
|
export default SwitchButton;
|
package/switch/switchButton.js
CHANGED
|
@@ -60,31 +60,39 @@ var __read = (this && this.__read) || function (o, n) {
|
|
|
60
60
|
}
|
|
61
61
|
return ar;
|
|
62
62
|
};
|
|
63
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
64
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
65
|
-
};
|
|
66
63
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
67
|
-
exports.SwitchButton = exports.SwitchButtonBase =
|
|
64
|
+
exports.SwitchButton = exports.SwitchButtonBase = void 0;
|
|
68
65
|
var react_1 = __importStar(require("react"));
|
|
69
|
-
var styled_components_1 = __importDefault(require("styled-components"));
|
|
70
|
-
var context_1 = require("./context");
|
|
71
66
|
var core_1 = require("../core");
|
|
72
|
-
var system_1 = require("../system");
|
|
73
67
|
var utils_1 = require("../utils");
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
68
|
+
var context_1 = require("./context");
|
|
69
|
+
var SwitchInput = core_1.styled.inputBox(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n\tcursor: inherit;\n\theight: calc(100% + 10px);\n\tleft: -5px;\n\tmargin: 0;\n\topacity: 0;\n\tpadding: 0;\n\tposition: absolute;\n\ttop: -5px;\n\twidth: calc(100% + 10px);\n\tz-index: 1;\n"], ["\n\tcursor: inherit;\n\theight: calc(100% + 10px);\n\tleft: -5px;\n\tmargin: 0;\n\topacity: 0;\n\tpadding: 0;\n\tposition: absolute;\n\ttop: -5px;\n\twidth: calc(100% + 10px);\n\tz-index: 1;\n"
|
|
70
|
+
/** Circular element that moves along the track when toggled. */
|
|
71
|
+
])));
|
|
72
|
+
/** Circular element that moves along the track when toggled. */
|
|
73
|
+
var SwitchThumb = core_1.styled.spanBox(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n\tborder-radius: round;\n\tdisplay: inline-flex;\n\tflex-shrink: 0;\n\tposition: absolute;\n\ttransition-duration: fast;\n"], ["\n\tborder-radius: round;\n\tdisplay: inline-flex;\n\tflex-shrink: 0;\n\tposition: absolute;\n\ttransition-duration: fast;\n"
|
|
74
|
+
/** Track element along which the thumb moves when toggled. */
|
|
75
|
+
])));
|
|
76
|
+
/** Track element along which the thumb moves when toggled. */
|
|
77
|
+
var SwitchTrack = core_1.styled.spanBox(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n\talign-items: center;\n\tborder-radius: round;\n\tdisplay: inline-flex;\n\tflex: 1;\n\tposition: relative;\n\ttransition-duration: fast;\n"], ["\n\talign-items: center;\n\tborder-radius: round;\n\tdisplay: inline-flex;\n\tflex: 1;\n\tposition: relative;\n\ttransition-duration: fast;\n"])));
|
|
78
|
+
exports.SwitchButtonBase = core_1.styled.spanBox(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n\tcolor: white;\n\tcursor: pointer;\n\tdisplay: inline-flex;\n\tflex-shrink: 0;\n\tposition: relative;\n\n\t&[aria-disabled='true'] {\n\t\tcursor: not-allowed;\n\n\t\t.vui-switchThumb {\n\t\t\tbackground-color: disabled.color;\n\t\t}\n\n\t\t.vui-switchTrack {\n\t\t\t// Using ring instead of border when disabled, because it's easier\n\t\t\t--x-ring-color: var(--vui-colors-disabled-border);\n\t\t\tbackground-color: disabled.bg;\n\t\t}\n\t}\n"], ["\n\tcolor: white;\n\tcursor: pointer;\n\tdisplay: inline-flex;\n\tflex-shrink: 0;\n\tposition: relative;\n\n\t&[aria-disabled='true'] {\n\t\tcursor: not-allowed;\n\n\t\t.vui-switchThumb {\n\t\t\tbackground-color: disabled.color;\n\t\t}\n\n\t\t.vui-switchTrack {\n\t\t\t// Using ring instead of border when disabled, because it's easier\n\t\t\t--x-ring-color: var(--vui-colors-disabled-border);\n\t\t\tbackground-color: disabled.bg;\n\t\t}\n\t}\n"
|
|
79
|
+
/**
|
|
80
|
+
* Controls the logic and visuals of multiple inner parts, such as input, track or thumb elements.
|
|
81
|
+
* Handles controlled and uncontrolled modes.
|
|
82
|
+
*/
|
|
83
|
+
])));
|
|
84
|
+
/**
|
|
85
|
+
* Controls the logic and visuals of multiple inner parts, such as input, track or thumb elements.
|
|
86
|
+
* Handles controlled and uncontrolled modes.
|
|
87
|
+
*/
|
|
78
88
|
exports.SwitchButton = (0, core_1.vui)(function (props, ref) {
|
|
79
|
-
var
|
|
80
|
-
var
|
|
81
|
-
var mergedProps = __assign(__assign({}, switchProps), props);
|
|
82
|
-
var _b = (0, core_1.omitThemingProps)(mergedProps), checked = _b.checked, className = _b.className, defaultChecked = _b.defaultChecked, disabled = _b.disabled, id = _b.id, innerLabelOff = _b.innerLabelOff, innerLabelOn = _b.innerLabelOn, inputProps = _b.inputProps, inputRef = _b.inputRef, name = _b.name, onBlur = _b.onBlur, onChange = _b.onChange, onFocus = _b.onFocus, required = _b.required, value = _b.value, rest = __rest(_b, ["checked", "className", "defaultChecked", "disabled", "id", "innerLabelOff", "innerLabelOn", "inputProps", "inputRef", "name", "onBlur", "onChange", "onFocus", "required", "value"]);
|
|
89
|
+
var mergedProps = __assign(__assign({}, (0, context_1.useSwitch)()), props);
|
|
90
|
+
var _a = (0, core_1.omitThemingProps)(mergedProps), checked = _a.checked, className = _a.className, defaultChecked = _a.defaultChecked, disabled = _a.disabled, id = _a.id, innerLabelOff = _a.innerLabelOff, innerLabelOn = _a.innerLabelOn, inputProps = _a.inputProps, inputRef = _a.inputRef, name = _a.name, onBlur = _a.onBlur, onChange = _a.onChange, onFocus = _a.onFocus, required = _a.required, value = _a.value, rest = __rest(_a, ["checked", "className", "defaultChecked", "disabled", "id", "innerLabelOff", "innerLabelOn", "inputProps", "inputRef", "name", "onBlur", "onChange", "onFocus", "required", "value"]);
|
|
83
91
|
var isControlled = (0, react_1.useRef)(checked !== undefined).current;
|
|
84
|
-
var
|
|
85
|
-
var
|
|
92
|
+
var _b = __read((0, react_1.useState)(checked !== null && checked !== void 0 ? checked : defaultChecked), 2), isChecked = _b[0], setIsChecked = _b[1];
|
|
93
|
+
var _c = __read((0, react_1.useState)(false), 2), isFocused = _c[0], setIsFocused = _c[1];
|
|
86
94
|
var styles = (0, core_1.useStyleConfig)('Switch', mergedProps);
|
|
87
|
-
var
|
|
95
|
+
var _d = styles.button, thumbStyles = _d.thumb, trackStyles = _d.track, buttonStyles = __rest(_d, ["thumb", "track"]);
|
|
88
96
|
(0, react_1.useEffect)(function () {
|
|
89
97
|
isControlled && setIsChecked(checked);
|
|
90
98
|
}, [checked, isControlled]);
|
|
@@ -103,9 +111,9 @@ exports.SwitchButton = (0, core_1.vui)(function (props, ref) {
|
|
|
103
111
|
var hDiff = (thumbStyles.h - trackStyles.h) / 2;
|
|
104
112
|
var thumbOffset = "calc(100% - " + Math.abs(hDiff - thumbStyles.h) + "px)";
|
|
105
113
|
var labelOffset = thumbStyles.h - hDiff + 4 + "px";
|
|
106
|
-
var
|
|
107
|
-
'
|
|
108
|
-
'
|
|
114
|
+
var aliasedProps = (0, utils_1.filterUndefined)({
|
|
115
|
+
'aria-checked': isChecked ? true : false,
|
|
116
|
+
'aria-disabled': disabled,
|
|
109
117
|
'data-focused': isFocused ? true : false
|
|
110
118
|
});
|
|
111
119
|
var thumbAliasedProps = (0, utils_1.filterUndefined)({
|
|
@@ -116,13 +124,13 @@ exports.SwitchButton = (0, core_1.vui)(function (props, ref) {
|
|
|
116
124
|
bg: isChecked ? trackStyles.bg : 'grey.50',
|
|
117
125
|
pl: isChecked ? 1 : labelOffset,
|
|
118
126
|
pr: isChecked ? labelOffset : 1,
|
|
119
|
-
ring: isFocused ? trackStyles.ring :
|
|
127
|
+
ring: !disabled ? (isFocused ? trackStyles.ring : 0) : 1
|
|
120
128
|
});
|
|
121
|
-
return (react_1.default.createElement(exports.SwitchButtonBase, __assign({ className: (0, utils_1.cs)('vui-switchButton', className), ref: ref }, buttonStyles,
|
|
122
|
-
react_1.default.createElement(
|
|
123
|
-
react_1.default.createElement(
|
|
129
|
+
return (react_1.default.createElement(exports.SwitchButtonBase, __assign({ className: (0, utils_1.cs)('vui-switchButton', className), ref: ref }, buttonStyles, aliasedProps, rest),
|
|
130
|
+
react_1.default.createElement(SwitchInput, __assign({ className: "vui-switchInput", onBlur: handleOnBlur, onChange: handleOnChange, onFocus: handleOnFocus, ref: inputRef, type: "checkbox" }, { checked: checked, defaultChecked: defaultChecked, disabled: disabled, id: id, name: name, required: required, value: value }, inputProps)),
|
|
131
|
+
react_1.default.createElement(SwitchTrack, __assign({ className: "vui-switchTrack" }, trackStyles, trackAliasedProps),
|
|
124
132
|
!isChecked && innerLabelOff,
|
|
125
|
-
react_1.default.createElement(
|
|
133
|
+
react_1.default.createElement(SwitchThumb, __assign({ className: "vui-switchThumb" }, thumbStyles, thumbAliasedProps)),
|
|
126
134
|
isChecked && innerLabelOn)));
|
|
127
135
|
});
|
|
128
136
|
exports.SwitchButton.displayName = 'SwitchButton';
|
package/switch/switchLabel.d.ts
CHANGED
package/switch/switchLabel.js
CHANGED
|
@@ -16,14 +16,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.SwitchLabel = void 0;
|
|
18
18
|
var react_1 = __importDefault(require("react"));
|
|
19
|
-
var context_1 = require("./context");
|
|
20
19
|
var core_1 = require("../core");
|
|
21
20
|
var t_1 = __importDefault(require("../t"));
|
|
21
|
+
var context_1 = require("./context");
|
|
22
|
+
/** Displays label text within the Switch component. */
|
|
22
23
|
exports.SwitchLabel = (0, core_1.vui)(function (props, ref) {
|
|
23
|
-
var
|
|
24
|
-
var switchProps = (_a = (0, context_1.useSwitch)()) !== null && _a !== void 0 ? _a : {};
|
|
25
|
-
var mergedProps = __assign(__assign({}, switchProps), props);
|
|
26
|
-
var styles = (0, core_1.useStyleConfig)('Switch', mergedProps);
|
|
24
|
+
var styles = (0, core_1.useStyleConfig)('Switch', __assign(__assign({}, (0, context_1.useSwitch)()), props));
|
|
27
25
|
return react_1.default.createElement(t_1.default, __assign({ className: "vui-switchLabel", display: "flex", ref: ref }, styles.label, props));
|
|
28
26
|
});
|
|
29
27
|
exports.SwitchLabel.displayName = 'SwitchLabel';
|