@veracity/vui 0.6.0 → 0.6.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/button/button.js +1 -1
- package/button/buttonIcon.js +15 -2
- package/button/buttonText.js +15 -2
- package/button/context.d.ts +2 -2
- package/button/context.js +3 -3
- package/buttonGroup/context.d.ts +2 -2
- package/buttonGroup/context.js +3 -3
- package/checkbox/checkbox.js +1 -1
- package/checkbox/context.d.ts +2 -2
- package/checkbox/context.js +3 -3
- package/core/links.js +39 -37
- package/dialog/dialogBody.js +13 -1
- package/dialog/dialogCancelButton.js +14 -1
- package/dialog/dialogCloseButton.js +14 -1
- package/dialog/dialogFooter.js +2 -2
- package/dialog/dialogHeader.js +2 -2
- package/dialog/dialogIcon.js +14 -1
- package/dialog/dialogSubmitButton.js +14 -1
- package/dialog/dialogTitle.js +14 -1
- package/footer/footerColumn.js +3 -2
- package/footer/footerContent.js +14 -1
- package/footer/footerHeading.js +14 -1
- package/footer/footerLink.js +14 -1
- package/footer/footerRow.js +14 -1
- package/footer/footerSection.js +2 -2
- package/footer/footerTrademark.js +3 -2
- package/header/headerAccount.js +5 -5
- package/header/headerAccount.types.d.ts +1 -1
- package/header/headerAccountUserInfo.js +5 -4
- package/header/headerContent.js +14 -1
- package/header/headerCreateAccount.js +3 -2
- package/header/headerDivider.js +14 -1
- package/header/headerLogo.js +3 -2
- package/header/headerMainLinks.js +3 -2
- package/header/headerMobileContent.js +13 -1
- package/header/headerMobileToggle.js +13 -1
- package/header/headerNotifications.js +3 -2
- package/header/headerServices.js +2 -2
- package/header/headerServicesMessage.js +3 -2
- package/header/headerSignIn.js +3 -2
- package/input/context.d.ts +2 -2
- package/input/context.js +3 -3
- package/input/input.js +1 -1
- package/input/inputIcon.js +15 -2
- package/input/inputInput.js +14 -2
- package/link/context.d.ts +2 -2
- package/link/context.js +3 -3
- package/link/linkIcon.js +15 -2
- package/link/linkText.js +15 -2
- package/list/context.d.ts +2 -2
- package/list/context.js +3 -3
- package/list/listDivider.js +15 -2
- package/list/listHeading.js +15 -2
- package/list/listIcon.js +15 -2
- package/list/listItem.js +3 -3
- package/list/listText.js +15 -2
- package/menu/menuButton.js +15 -2
- package/menu/menuItem.js +2 -2
- package/menu/menuList.js +4 -3
- package/modal/modalBackdrop.js +13 -1
- package/modal/modalContent.js +13 -1
- package/notification/context.d.ts +2 -2
- package/notification/context.js +3 -3
- package/notification/notificationButton.js +16 -3
- package/notification/notificationIcon.js +16 -3
- package/notification/notificationText.js +15 -2
- package/notification/notificationTitle.js +15 -2
- package/package.json +1 -1
- package/pagination/helpers.js +48 -12
- package/pagination/paginationButton.js +3 -2
- package/pagination/paginationEllipsis.js +3 -2
- package/pagination/paginationGoToPage.js +14 -1
- package/pagination/paginationNavigation.js +2 -2
- package/pagination/paginationPrevNext.js +3 -2
- package/pagination/paginationResults.js +3 -2
- package/popover/popoverContent.js +2 -2
- package/popover/popoverTrigger.js +3 -3
- package/radio/context.d.ts +2 -2
- package/radio/context.js +3 -3
- package/radio/radio.js +1 -1
- package/spinner/consts.d.ts +0 -12
- package/spinner/consts.js +4 -8
- package/spinner/spinner.js +2 -2
- package/switch/context.d.ts +2 -2
- package/switch/context.js +3 -3
- package/switch/switchButton.js +2 -2
- package/switch/switchLabel.js +15 -2
- package/tag/context.d.ts +2 -2
- package/tag/context.js +3 -3
- package/tag/tagButton.js +16 -3
- package/tag/tagIcon.js +15 -2
- package/tag/tagText.js +15 -2
- package/textarea/textarea.js +1 -1
- package/utils/react.d.ts +2 -2
- package/utils/react.js +3 -2
|
@@ -10,6 +10,17 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
};
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
+
var t = {};
|
|
15
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
+
t[p] = s[p];
|
|
17
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
+
t[p[i]] = s[p[i]];
|
|
21
|
+
}
|
|
22
|
+
return t;
|
|
23
|
+
};
|
|
13
24
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
25
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
26
|
};
|
|
@@ -20,9 +31,11 @@ var box_1 = __importDefault(require("../box"));
|
|
|
20
31
|
var core_1 = require("../core");
|
|
21
32
|
var input_1 = __importDefault(require("../input"));
|
|
22
33
|
var t_1 = __importDefault(require("../t"));
|
|
34
|
+
var utils_1 = require("../utils");
|
|
23
35
|
var context_1 = require("./context");
|
|
24
36
|
/** Displays a number input, which allows quickly jumping between pages. */
|
|
25
37
|
exports.PaginationGoToPage = (0, core_1.vui)(function (props, ref) {
|
|
38
|
+
var className = props.className, rest = __rest(props, ["className"]);
|
|
26
39
|
var _a = (0, context_1.usePaginationContext)(), onPageChange = _a.onPageChange, pageCount = _a.pageCount;
|
|
27
40
|
var styles = (0, core_1.useStyleConfig)('Pagination', (0, context_1.usePaginationContext)());
|
|
28
41
|
var onChange = function (e) {
|
|
@@ -31,7 +44,7 @@ exports.PaginationGoToPage = (0, core_1.vui)(function (props, ref) {
|
|
|
31
44
|
onPageChange(Math.floor(value));
|
|
32
45
|
}
|
|
33
46
|
};
|
|
34
|
-
return (react_1.default.createElement(box_1.default, __assign({ centerV: true, className:
|
|
47
|
+
return (react_1.default.createElement(box_1.default, __assign({ centerV: true, className: (0, utils_1.cs)('vui-paginationGoToPage', className), lineHeight: "normal", ref: ref }, styles.goToPage, rest),
|
|
35
48
|
react_1.default.createElement(t_1.default, { size: "sm", weight: "medium" }, "Go to"),
|
|
36
49
|
react_1.default.createElement(input_1.default, { max: pageCount, min: 1, mx: 1, onChange: onChange, size: "sm", type: "number", w: 56 }),
|
|
37
50
|
react_1.default.createElement(t_1.default, { size: "sm", weight: "medium" }, "Page")));
|
|
@@ -55,10 +55,10 @@ var paginationEllipsis_1 = __importDefault(require("./paginationEllipsis"));
|
|
|
55
55
|
var paginationPrevNext_1 = __importDefault(require("./paginationPrevNext"));
|
|
56
56
|
/** Displays a set of page navigation buttons. */
|
|
57
57
|
exports.PaginationNavigation = (0, core_1.vui)(function (props, ref) {
|
|
58
|
-
var children = props.children, rest = __rest(props, ["children"]);
|
|
58
|
+
var children = props.children, className = props.className, rest = __rest(props, ["children", "className"]);
|
|
59
59
|
var items = (0, context_1.usePaginationContext)().items;
|
|
60
60
|
var styles = (0, core_1.useStyleConfig)('Pagination', (0, context_1.usePaginationContext)());
|
|
61
|
-
return (react_1.default.createElement(box_1.default, __assign({ className:
|
|
61
|
+
return (react_1.default.createElement(box_1.default, __assign({ className: (0, utils_1.cs)('vui-paginationNavigation', className), gap: 1, ref: ref, wrap: true }, styles.navigation, rest), children !== null && children !== void 0 ? children : items.map(function (item) { return (react_1.default.createElement(react_1.Fragment, { key: item },
|
|
62
62
|
item === 'previous' && react_1.default.createElement(paginationPrevNext_1.default, { direction: "previous" }),
|
|
63
63
|
(0, utils_1.isNumber)(item) && react_1.default.createElement(paginationButton_1.default, { page: item }),
|
|
64
64
|
(0, utils_1.isString)(item) && item.includes('ellipsis') && react_1.default.createElement(paginationEllipsis_1.default, null),
|
|
@@ -29,10 +29,11 @@ exports.PaginationPrevNext = void 0;
|
|
|
29
29
|
var react_1 = __importDefault(require("react"));
|
|
30
30
|
var button_1 = __importDefault(require("../button"));
|
|
31
31
|
var core_1 = require("../core");
|
|
32
|
+
var utils_1 = require("../utils");
|
|
32
33
|
var context_1 = require("./context");
|
|
33
34
|
/** Displays a page navigation button, which navigates forward or backward. */
|
|
34
35
|
exports.PaginationPrevNext = (0, core_1.vui)(function (props, ref) {
|
|
35
|
-
var direction = props.direction, rest = __rest(props, ["direction"]);
|
|
36
|
+
var className = props.className, direction = props.direction, rest = __rest(props, ["className", "direction"]);
|
|
36
37
|
var _a = (0, context_1.usePaginationContext)(), onPageChange = _a.onPageChange, page = _a.page, pageCount = _a.pageCount;
|
|
37
38
|
var styles = (0, core_1.useStyleConfig)('Pagination', (0, context_1.usePaginationContext)());
|
|
38
39
|
var isPrev = direction === 'previous';
|
|
@@ -42,7 +43,7 @@ exports.PaginationPrevNext = (0, core_1.vui)(function (props, ref) {
|
|
|
42
43
|
icon: isPrev ? 'falAngleLeft' : 'falAngleRight',
|
|
43
44
|
onClick: function () { return onPageChange(page + pageChange); }
|
|
44
45
|
};
|
|
45
|
-
return (react_1.default.createElement(button_1.default, __assign({ className:
|
|
46
|
+
return (react_1.default.createElement(button_1.default, __assign({ className: (0, utils_1.cs)('vui-paginationPrevNext', className), minW: 0, ref: ref, size: "sm", variant: "text" }, styles.prevNext, directionProps, rest)));
|
|
46
47
|
});
|
|
47
48
|
exports.PaginationPrevNext.displayName = 'PaginationPrevNext';
|
|
48
49
|
exports.default = exports.PaginationPrevNext;
|
|
@@ -29,13 +29,14 @@ exports.PaginationResults = void 0;
|
|
|
29
29
|
var react_1 = __importDefault(require("react"));
|
|
30
30
|
var core_1 = require("../core");
|
|
31
31
|
var t_1 = __importDefault(require("../t"));
|
|
32
|
+
var utils_1 = require("../utils");
|
|
32
33
|
var context_1 = require("./context");
|
|
33
34
|
/** Displays an action button within the Pagination. */
|
|
34
35
|
exports.PaginationResults = (0, core_1.vui)(function (props, ref) {
|
|
35
|
-
var children = props.children, rest = __rest(props, ["children"]);
|
|
36
|
+
var children = props.children, className = props.className, rest = __rest(props, ["children", "className"]);
|
|
36
37
|
var _a = (0, context_1.usePaginationContext)(), count = _a.count, rangeEnd = _a.rangeEnd, rangeStart = _a.rangeStart;
|
|
37
38
|
var styles = (0, core_1.useStyleConfig)('Pagination', (0, context_1.usePaginationContext)());
|
|
38
|
-
return (react_1.default.createElement(t_1.default, __assign({ className:
|
|
39
|
+
return (react_1.default.createElement(t_1.default, __assign({ className: (0, utils_1.cs)('vui-paginationResults', className), color: "grey.80", ref: ref, size: "sm", weight: "medium" }, styles.results, rest), children !== null && children !== void 0 ? children : "Showing " + rangeStart + " to " + rangeEnd + " of " + count + " results."));
|
|
39
40
|
});
|
|
40
41
|
exports.PaginationResults.displayName = 'PaginationResults';
|
|
41
42
|
exports.default = exports.PaginationResults;
|
|
@@ -34,15 +34,15 @@ var context_1 = require("./context");
|
|
|
34
34
|
/** Displays provided content in an overlaying wrapper. */
|
|
35
35
|
exports.PopoverContent = (0, core_1.vui)(function (props, ref) {
|
|
36
36
|
var _a;
|
|
37
|
+
var children = props.children, className = props.className, rest = __rest(props, ["children", "className"]);
|
|
37
38
|
var popoverProps = (_a = (0, context_1.usePopoverContext)()) !== null && _a !== void 0 ? _a : {};
|
|
38
39
|
var isLazy = popoverProps.isLazy, isOpen = popoverProps.isOpen, setPopper = popoverProps.setPopper;
|
|
39
|
-
var children = props.children, rest = __rest(props, ["children"]);
|
|
40
40
|
var styles = (0, core_1.useStyleConfig)('Popover', __assign(__assign({}, popoverProps), props));
|
|
41
41
|
var shouldRenderChildren = isLazy ? isOpen : true;
|
|
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:
|
|
45
|
+
react_1.default.createElement(box_1.default, __assign({ bg: "white", borderRadius: "md", boxShadow: "2", className: (0, utils_1.cs)('vui-popoverContent', className), 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;
|
|
@@ -37,17 +37,17 @@ var context_1 = require("./context");
|
|
|
37
37
|
*/
|
|
38
38
|
exports.PopoverTrigger = (0, core_1.vui)(function (props, ref) {
|
|
39
39
|
var _a;
|
|
40
|
+
// @ts-ignore - TS incorrectly doesn't recognize 'as' prop
|
|
41
|
+
var As = props.as, className = props.className, onClickProp = props.onClick, rest = __rest(props, ["as", "className", "onClick"]);
|
|
40
42
|
var _b = (_a = (0, context_1.usePopoverContext)()) !== null && _a !== void 0 ? _a : {}, setReference = _b.setReference, popoverProps = __rest(_b, ["setReference"]);
|
|
41
43
|
var styles = (0, core_1.useStyleConfig)('Popover', __assign(__assign({}, popoverProps), props));
|
|
42
|
-
// @ts-ignore - TS incorrectly doesn't recognize 'as' prop
|
|
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
46
|
// Avoids triggering parent's onClick, like when inside a ListItem
|
|
47
47
|
e.stopPropagation();
|
|
48
48
|
onClickProp === null || onClickProp === void 0 ? void 0 : onClickProp(e);
|
|
49
49
|
};
|
|
50
|
-
return (react_1.default.createElement(Element, __assign({ className:
|
|
50
|
+
return (react_1.default.createElement(Element, __assign({ className: (0, utils_1.cs)('vui-popoverTrigger', className), onClick: onClick, ref: (0, utils_1.mergeRefs)(setReference, ref) }, styles.trigger, rest)));
|
|
51
51
|
});
|
|
52
52
|
exports.PopoverTrigger.displayName = 'PopoverTrigger';
|
|
53
53
|
exports.default = exports.PopoverTrigger;
|
package/radio/context.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { Dict } from '../utils';
|
|
3
|
-
declare const RadioGroupProvider: import("react").Provider<Dict<any>>,
|
|
4
|
-
export { RadioGroupProvider,
|
|
3
|
+
declare const RadioGroupProvider: import("react").Provider<Dict<any>>, useRadioGroupContext: () => Dict<any>;
|
|
4
|
+
export { RadioGroupProvider, useRadioGroupContext };
|
package/radio/context.js
CHANGED
|
@@ -16,8 +16,8 @@ var __read = (this && this.__read) || function (o, n) {
|
|
|
16
16
|
return ar;
|
|
17
17
|
};
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
-
exports.
|
|
19
|
+
exports.useRadioGroupContext = exports.RadioGroupProvider = void 0;
|
|
20
20
|
var utils_1 = require("../utils");
|
|
21
|
-
var _a = __read((0, utils_1.createContext)({ isOptional: true }), 2), RadioGroupProvider = _a[0],
|
|
21
|
+
var _a = __read((0, utils_1.createContext)({ isOptional: true }), 2), RadioGroupProvider = _a[0], useRadioGroupContext = _a[1];
|
|
22
22
|
exports.RadioGroupProvider = RadioGroupProvider;
|
|
23
|
-
exports.
|
|
23
|
+
exports.useRadioGroupContext = useRadioGroupContext;
|
package/radio/radio.js
CHANGED
|
@@ -85,7 +85,7 @@ exports.RadioBase = core_1.styled.labelBox(templateObject_3 || (templateObject_3
|
|
|
85
85
|
*/
|
|
86
86
|
exports.Radio = (0, core_1.vui)(function (props, ref) {
|
|
87
87
|
var _a, _b;
|
|
88
|
-
var _c = (_a = (0, context_1.
|
|
88
|
+
var _c = (_a = (0, context_1.useRadioGroupContext)()) !== null && _a !== void 0 ? _a : {}, groupDefaultValue = _c.defaultValue, groupIsChecked = _c.isChecked, groupOnChange = _c.onChange, groupValue = _c.value, radioGroupProps = __rest(_c, ["defaultValue", "isChecked", "onChange", "value"]);
|
|
89
89
|
var defaultIsChecked = groupIsChecked !== undefined ? groupIsChecked === props.value : undefined;
|
|
90
90
|
var mergedProps = __assign(__assign({}, radioGroupProps), props);
|
|
91
91
|
var _d = (0, core_1.omitThemingProps)(mergedProps), _e = _d.checked, checked = _e === void 0 ? groupValue !== undefined ? props.value === groupValue : undefined : _e, children = _d.children, className = _d.className, _f = _d.defaultChecked, defaultChecked = _f === void 0 ? groupDefaultValue !== undefined ? props.value === groupDefaultValue : undefined : _f, disabled = _d.disabled, _g = _d.icon, iconProp = _g === void 0 ? 'cuiRadioUnselected' : _g, _h = _d.iconChecked, iconChecked = _h === void 0 ? 'cuiRadioSelected' : _h, id = _d.id, inputProps = _d.inputProps, inputRef = _d.inputRef, label = _d.label, name = _d.name, onChange = _d.onChange, required = _d.required, value = _d.value, rest = __rest(_d, ["checked", "children", "className", "defaultChecked", "disabled", "icon", "iconChecked", "id", "inputProps", "inputRef", "label", "name", "onChange", "required", "value"]);
|
package/spinner/consts.d.ts
CHANGED
|
@@ -4,33 +4,21 @@ export declare const spinnerPositionMapping: {
|
|
|
4
4
|
container: {
|
|
5
5
|
flexDirection: string;
|
|
6
6
|
};
|
|
7
|
-
circle: {
|
|
8
|
-
mb: number;
|
|
9
|
-
};
|
|
10
7
|
};
|
|
11
8
|
left: {
|
|
12
9
|
container: {
|
|
13
10
|
flexDirection: string;
|
|
14
11
|
};
|
|
15
|
-
circle: {
|
|
16
|
-
ml: number;
|
|
17
|
-
};
|
|
18
12
|
};
|
|
19
13
|
right: {
|
|
20
14
|
container: {
|
|
21
15
|
flexDirection: string;
|
|
22
16
|
};
|
|
23
|
-
circle: {
|
|
24
|
-
mr: number;
|
|
25
|
-
};
|
|
26
17
|
};
|
|
27
18
|
top: {
|
|
28
19
|
container: {
|
|
29
20
|
flexDirection: string;
|
|
30
21
|
};
|
|
31
|
-
circle: {
|
|
32
|
-
mt: number;
|
|
33
|
-
};
|
|
34
22
|
};
|
|
35
23
|
};
|
|
36
24
|
export declare const spinnerSpeedMapping: Dict<string>;
|
package/spinner/consts.js
CHANGED
|
@@ -3,20 +3,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.spinnerSpeedMapping = exports.spinnerPositionMapping = void 0;
|
|
4
4
|
exports.spinnerPositionMapping = {
|
|
5
5
|
bottom: {
|
|
6
|
-
container: { flexDirection: 'column' }
|
|
7
|
-
circle: { mb: 1 }
|
|
6
|
+
container: { flexDirection: 'column' }
|
|
8
7
|
},
|
|
9
8
|
left: {
|
|
10
|
-
container: { flexDirection: 'row-reverse' }
|
|
11
|
-
circle: { ml: 1 }
|
|
9
|
+
container: { flexDirection: 'row-reverse' }
|
|
12
10
|
},
|
|
13
11
|
right: {
|
|
14
|
-
container: { flexDirection: 'row' }
|
|
15
|
-
circle: { mr: 1 }
|
|
12
|
+
container: { flexDirection: 'row' }
|
|
16
13
|
},
|
|
17
14
|
top: {
|
|
18
|
-
container: { flexDirection: 'column-reverse' }
|
|
19
|
-
circle: { mt: 1 }
|
|
15
|
+
container: { flexDirection: 'column-reverse' }
|
|
20
16
|
}
|
|
21
17
|
};
|
|
22
18
|
exports.spinnerSpeedMapping = {
|
package/spinner/spinner.js
CHANGED
|
@@ -59,8 +59,8 @@ exports.Spinner = (0, core_1.vui)(function (props, ref) {
|
|
|
59
59
|
h: isCustomSize ? size : undefined,
|
|
60
60
|
w: isCustomSize ? size : undefined
|
|
61
61
|
});
|
|
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),
|
|
63
|
-
react_1.default.createElement(exports.SpinnerCircle, __assign({ animation: "vui-spin " + speed + " linear infinite", className: "vui-spinnerCircle" }, styles.circle,
|
|
62
|
+
return (react_1.default.createElement(box_1.default, __assign({ center: true, className: (0, utils_1.cs)('vui-spinner', className), gap: 1, ref: ref, transitionDuration: "fast" }, styles.container, positionProps.container, rest),
|
|
63
|
+
react_1.default.createElement(exports.SpinnerCircle, __assign({ animation: "vui-spin " + speed + " linear infinite", className: "vui-spinnerCircle" }, styles.circle, circleProps)),
|
|
64
64
|
text && (react_1.default.createElement(t_1.default, __assign({ className: "vui-spinnerText" }, styles.text), text))));
|
|
65
65
|
});
|
|
66
66
|
exports.Spinner.displayName = 'Spinner';
|
package/switch/context.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { SwitchContext } from './switch.types';
|
|
3
|
-
declare const SwitchProvider: import("react").Provider<SwitchContext>,
|
|
4
|
-
export { SwitchProvider,
|
|
3
|
+
declare const SwitchProvider: import("react").Provider<SwitchContext>, useSwitchContext: () => SwitchContext;
|
|
4
|
+
export { SwitchProvider, useSwitchContext };
|
package/switch/context.js
CHANGED
|
@@ -16,8 +16,8 @@ var __read = (this && this.__read) || function (o, n) {
|
|
|
16
16
|
return ar;
|
|
17
17
|
};
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
-
exports.
|
|
19
|
+
exports.useSwitchContext = exports.SwitchProvider = void 0;
|
|
20
20
|
var utils_1 = require("../utils");
|
|
21
|
-
var _a = __read((0, utils_1.createContext)({ isOptional: true }), 2), SwitchProvider = _a[0],
|
|
21
|
+
var _a = __read((0, utils_1.createContext)({ isOptional: true }), 2), SwitchProvider = _a[0], useSwitchContext = _a[1];
|
|
22
22
|
exports.SwitchProvider = SwitchProvider;
|
|
23
|
-
exports.
|
|
23
|
+
exports.useSwitchContext = useSwitchContext;
|
package/switch/switchButton.js
CHANGED
|
@@ -86,12 +86,12 @@ exports.SwitchButtonBase = core_1.styled.spanBox(templateObject_4 || (templateOb
|
|
|
86
86
|
* Handles controlled and uncontrolled modes.
|
|
87
87
|
*/
|
|
88
88
|
exports.SwitchButton = (0, core_1.vui)(function (props, ref) {
|
|
89
|
-
var mergedProps = __assign(__assign({}, (0, context_1.
|
|
89
|
+
var mergedProps = __assign(__assign({}, (0, context_1.useSwitchContext)()), props);
|
|
90
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"]);
|
|
91
91
|
var isControlled = (0, react_1.useRef)(checked !== undefined).current;
|
|
92
92
|
var _b = __read((0, react_1.useState)(checked !== null && checked !== void 0 ? checked : defaultChecked), 2), isChecked = _b[0], setIsChecked = _b[1];
|
|
93
93
|
var _c = __read((0, react_1.useState)(false), 2), isFocused = _c[0], setIsFocused = _c[1];
|
|
94
|
-
var styles = (0, core_1.useStyleConfig)('Switch',
|
|
94
|
+
var styles = (0, core_1.useStyleConfig)('Switch', (0, context_1.useSwitchContext)());
|
|
95
95
|
var _d = styles.button, thumbStyles = _d.thumb, trackStyles = _d.track, buttonStyles = __rest(_d, ["thumb", "track"]);
|
|
96
96
|
(0, react_1.useEffect)(function () {
|
|
97
97
|
isControlled && setIsChecked(checked);
|
package/switch/switchLabel.js
CHANGED
|
@@ -10,6 +10,17 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
};
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
+
var t = {};
|
|
15
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
+
t[p] = s[p];
|
|
17
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
+
t[p[i]] = s[p[i]];
|
|
21
|
+
}
|
|
22
|
+
return t;
|
|
23
|
+
};
|
|
13
24
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
25
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
26
|
};
|
|
@@ -18,11 +29,13 @@ exports.SwitchLabel = void 0;
|
|
|
18
29
|
var react_1 = __importDefault(require("react"));
|
|
19
30
|
var core_1 = require("../core");
|
|
20
31
|
var t_1 = __importDefault(require("../t"));
|
|
32
|
+
var utils_1 = require("../utils");
|
|
21
33
|
var context_1 = require("./context");
|
|
22
34
|
/** Displays label text within the Switch component. */
|
|
23
35
|
exports.SwitchLabel = (0, core_1.vui)(function (props, ref) {
|
|
24
|
-
var
|
|
25
|
-
|
|
36
|
+
var className = props.className, rest = __rest(props, ["className"]);
|
|
37
|
+
var styles = (0, core_1.useStyleConfig)('Switch', (0, context_1.useSwitchContext)());
|
|
38
|
+
return react_1.default.createElement(t_1.default, __assign({ className: (0, utils_1.cs)('vui-switchLabel', className), display: "flex", ref: ref }, styles.label, rest));
|
|
26
39
|
});
|
|
27
40
|
exports.SwitchLabel.displayName = 'SwitchLabel';
|
|
28
41
|
exports.default = exports.SwitchLabel;
|
package/tag/context.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { Dict } from '../utils';
|
|
3
|
-
declare const TagProvider: import("react").Provider<Dict<any>>,
|
|
4
|
-
export { TagProvider,
|
|
3
|
+
declare const TagProvider: import("react").Provider<Dict<any>>, useTagContext: () => Dict<any>;
|
|
4
|
+
export { TagProvider, useTagContext };
|
package/tag/context.js
CHANGED
|
@@ -16,8 +16,8 @@ var __read = (this && this.__read) || function (o, n) {
|
|
|
16
16
|
return ar;
|
|
17
17
|
};
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
-
exports.
|
|
19
|
+
exports.useTagContext = exports.TagProvider = void 0;
|
|
20
20
|
var utils_1 = require("../utils");
|
|
21
|
-
var _a = __read((0, utils_1.createContext)({ isOptional: true }), 2), TagProvider = _a[0],
|
|
21
|
+
var _a = __read((0, utils_1.createContext)({ isOptional: true }), 2), TagProvider = _a[0], useTagContext = _a[1];
|
|
22
22
|
exports.TagProvider = TagProvider;
|
|
23
|
-
exports.
|
|
23
|
+
exports.useTagContext = useTagContext;
|
package/tag/tagButton.js
CHANGED
|
@@ -10,6 +10,17 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
};
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
+
var t = {};
|
|
15
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
+
t[p] = s[p];
|
|
17
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
+
t[p[i]] = s[p[i]];
|
|
21
|
+
}
|
|
22
|
+
return t;
|
|
23
|
+
};
|
|
13
24
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
25
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
26
|
};
|
|
@@ -18,12 +29,14 @@ exports.TagButton = void 0;
|
|
|
18
29
|
var react_1 = __importDefault(require("react"));
|
|
19
30
|
var button_1 = __importDefault(require("../button"));
|
|
20
31
|
var core_1 = require("../core");
|
|
32
|
+
var utils_1 = require("../utils");
|
|
21
33
|
var context_1 = require("./context");
|
|
22
34
|
/** Displays a button within the Tag. */
|
|
23
35
|
exports.TagButton = (0, core_1.vui)(function (props, ref) {
|
|
24
|
-
var
|
|
25
|
-
var
|
|
26
|
-
|
|
36
|
+
var className = props.className, rest = __rest(props, ["className"]);
|
|
37
|
+
var mergedProps = __assign(__assign({}, (0, context_1.useTagContext)()), props);
|
|
38
|
+
var styles = (0, core_1.useStyleConfig)('Tag', (0, context_1.useTagContext)());
|
|
39
|
+
return (react_1.default.createElement(button_1.default, __assign({ borderColor: "transparent", className: (0, utils_1.cs)('vui-tagButton', className), colorScheme: mergedProps.colorScheme, disabled: mergedProps.disabled, hoverBorderColor: "transparent", icon: "falTimes", mr: -0.5, ref: ref, variant: "text" }, styles.button, rest)));
|
|
27
40
|
});
|
|
28
41
|
exports.TagButton.displayName = 'TagButton';
|
|
29
42
|
exports.default = exports.TagButton;
|
package/tag/tagIcon.js
CHANGED
|
@@ -10,6 +10,17 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
};
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
+
var t = {};
|
|
15
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
+
t[p] = s[p];
|
|
17
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
+
t[p[i]] = s[p[i]];
|
|
21
|
+
}
|
|
22
|
+
return t;
|
|
23
|
+
};
|
|
13
24
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
25
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
26
|
};
|
|
@@ -18,11 +29,13 @@ exports.TagIcon = void 0;
|
|
|
18
29
|
var react_1 = __importDefault(require("react"));
|
|
19
30
|
var core_1 = require("../core");
|
|
20
31
|
var icon_1 = __importDefault(require("../icon"));
|
|
32
|
+
var utils_1 = require("../utils");
|
|
21
33
|
var context_1 = require("./context");
|
|
22
34
|
/** Displays an icon within the Tag. */
|
|
23
35
|
exports.TagIcon = (0, core_1.vui)(function (props, ref) {
|
|
24
|
-
var
|
|
25
|
-
|
|
36
|
+
var className = props.className, rest = __rest(props, ["className"]);
|
|
37
|
+
var styles = (0, core_1.useStyleConfig)('Tag', (0, context_1.useTagContext)());
|
|
38
|
+
return react_1.default.createElement(icon_1.default, __assign({ className: (0, utils_1.cs)('vui-tagIcon', className), ref: ref }, styles.icon, rest));
|
|
26
39
|
});
|
|
27
40
|
exports.TagIcon.displayName = 'TagIcon';
|
|
28
41
|
exports.default = exports.TagIcon;
|
package/tag/tagText.js
CHANGED
|
@@ -10,6 +10,17 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
};
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
+
var t = {};
|
|
15
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
+
t[p] = s[p];
|
|
17
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
+
t[p[i]] = s[p[i]];
|
|
21
|
+
}
|
|
22
|
+
return t;
|
|
23
|
+
};
|
|
13
24
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
25
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
26
|
};
|
|
@@ -18,11 +29,13 @@ exports.TagText = void 0;
|
|
|
18
29
|
var react_1 = __importDefault(require("react"));
|
|
19
30
|
var core_1 = require("../core");
|
|
20
31
|
var t_1 = __importDefault(require("../t"));
|
|
32
|
+
var utils_1 = require("../utils");
|
|
21
33
|
var context_1 = require("./context");
|
|
22
34
|
/** Displays text within the Tag. */
|
|
23
35
|
exports.TagText = (0, core_1.vui)(function (props, ref) {
|
|
24
|
-
var
|
|
25
|
-
|
|
36
|
+
var className = props.className, rest = __rest(props, ["className"]);
|
|
37
|
+
var styles = (0, core_1.useStyleConfig)('Tag', (0, context_1.useTagContext)());
|
|
38
|
+
return react_1.default.createElement(t_1.default, __assign({ className: (0, utils_1.cs)('vui-tagText', className), fontSize: "inherit", ref: ref }, styles.text, rest));
|
|
26
39
|
});
|
|
27
40
|
exports.TagText.displayName = 'TagText';
|
|
28
41
|
exports.default = exports.TagText;
|
package/textarea/textarea.js
CHANGED
|
@@ -120,7 +120,7 @@ exports.Textarea = (0, core_1.vui)(function (props, ref) {
|
|
|
120
120
|
rows: rows,
|
|
121
121
|
value: value
|
|
122
122
|
}, styles.textarea, textareaAliasedProps, textareaProps)),
|
|
123
|
-
showCount && (react_1.default.createElement(t_1.default, { color: "grey.80", position: "absolute", right: 0, size: "sm", top: "calc(100% + 1px)" },
|
|
123
|
+
showCount && (react_1.default.createElement(t_1.default, { className: "vui-textareaCount", color: "grey.80", position: "absolute", right: 0, size: "sm", top: "calc(100% + 1px)" },
|
|
124
124
|
count,
|
|
125
125
|
" / ",
|
|
126
126
|
maxLength))));
|
package/utils/react.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { RefObject } from 'react';
|
|
1
|
+
import React, { DependencyList, RefObject } from 'react';
|
|
2
2
|
import { AnyFunction, CreateContextOptions, CreateContextReturn } from './types';
|
|
3
3
|
declare type ReactRef<T> = React.Ref<T> | React.RefObject<T> | React.MutableRefObject<T>;
|
|
4
4
|
/**
|
|
@@ -11,7 +11,7 @@ export declare function createContext<ContextType>(options?: CreateContextOption
|
|
|
11
11
|
/** Assigns a node to all provided refs. */
|
|
12
12
|
export declare function mergeRefs<T>(...refs: (ReactRef<T> | undefined)[]): (node: T | null) => void;
|
|
13
13
|
/** Returns given callback with a stable reference, but keeps it updated internally. */
|
|
14
|
-
export declare function useCallbackRef<T extends AnyFunction>(callback?: T): T;
|
|
14
|
+
export declare function useCallbackRef<T extends AnyFunction>(callback?: T, deps?: DependencyList): T;
|
|
15
15
|
/**
|
|
16
16
|
* Triggers given callback when an event happens outside of a given element.
|
|
17
17
|
* Event listeners are attached to the window object.
|
package/utils/react.js
CHANGED
|
@@ -97,7 +97,8 @@ function mergeRefs() {
|
|
|
97
97
|
exports.mergeRefs = mergeRefs;
|
|
98
98
|
// TODO: Bring it from UI-Utils
|
|
99
99
|
/** Returns given callback with a stable reference, but keeps it updated internally. */
|
|
100
|
-
function useCallbackRef(callback) {
|
|
100
|
+
function useCallbackRef(callback, deps) {
|
|
101
|
+
if (deps === void 0) { deps = []; }
|
|
101
102
|
var ref = (0, react_1.useRef)(callback);
|
|
102
103
|
ref.current = callback;
|
|
103
104
|
return (0, react_1.useCallback)((function () {
|
|
@@ -107,7 +108,7 @@ function useCallbackRef(callback) {
|
|
|
107
108
|
args[_i] = arguments[_i];
|
|
108
109
|
}
|
|
109
110
|
return (_a = ref.current) === null || _a === void 0 ? void 0 : _a.call.apply(_a, __spreadArray([ref], __read(args), false));
|
|
110
|
-
}),
|
|
111
|
+
}), deps);
|
|
111
112
|
}
|
|
112
113
|
exports.useCallbackRef = useCallbackRef;
|
|
113
114
|
var defaultEvents = ['mousedown', 'touchstart'];
|