@longline/aqua-ui 1.0.209 → 1.0.211
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/containers/Form/Field.d.ts +2 -0
- package/controls/ListView/elements/Table.js +3 -0
- package/controls/TabBar/Tab.d.ts +5 -0
- package/controls/TabBar/Tab.js +21 -4
- package/controls/TabBar/TabBar.d.ts +6 -1
- package/controls/TabBar/TabBar.js +3 -2
- package/package.json +1 -1
- package/styles/StyleBase.js +1 -1
|
@@ -35,10 +35,12 @@ interface IFieldProps {
|
|
|
35
35
|
forceupdate?: boolean;
|
|
36
36
|
/**
|
|
37
37
|
* If true, display an asterisk for required fields.
|
|
38
|
+
* @default false
|
|
38
39
|
*/
|
|
39
40
|
asterisk?: boolean;
|
|
40
41
|
/**
|
|
41
42
|
* If true, apply ghost state to Field and the control in it.
|
|
43
|
+
* @default false
|
|
42
44
|
*/
|
|
43
45
|
ghost?: boolean;
|
|
44
46
|
/**
|
|
@@ -94,6 +94,9 @@ var TableBase = function (_a) {
|
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
96
|
}, [activeRef]);
|
|
97
|
+
// Show no-data element only after an additional render tick. Race conditions
|
|
98
|
+
// in evaluating multiple states in ListView's user can result in a situation
|
|
99
|
+
// where data is present, and yet "no data" appears.
|
|
97
100
|
React.useEffect(function () {
|
|
98
101
|
var _a;
|
|
99
102
|
if ((!Array.isArray(props.data) || ((_a = props.data) === null || _a === void 0 ? void 0 : _a.length) === 0) && !props.ghost) {
|
package/controls/TabBar/Tab.d.ts
CHANGED
|
@@ -16,6 +16,11 @@ interface ITabProps {
|
|
|
16
16
|
* Fired when tab is clicked.
|
|
17
17
|
*/
|
|
18
18
|
onClick?: () => void;
|
|
19
|
+
/**
|
|
20
|
+
* If true, apply ghost state to Tab.
|
|
21
|
+
* @default false
|
|
22
|
+
*/
|
|
23
|
+
ghost?: boolean;
|
|
19
24
|
}
|
|
20
25
|
declare const Tab: React.ForwardRefExoticComponent<ITabProps & React.RefAttributes<HTMLDivElement>>;
|
|
21
26
|
export { Tab, ITabProps };
|
package/controls/TabBar/Tab.js
CHANGED
|
@@ -13,13 +13,30 @@ var __assign = (this && this.__assign) || function () {
|
|
|
13
13
|
};
|
|
14
14
|
return __assign.apply(this, arguments);
|
|
15
15
|
};
|
|
16
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
17
|
+
var t = {};
|
|
18
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
19
|
+
t[p] = s[p];
|
|
20
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
21
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
22
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
23
|
+
t[p[i]] = s[p[i]];
|
|
24
|
+
}
|
|
25
|
+
return t;
|
|
26
|
+
};
|
|
16
27
|
import * as React from 'react';
|
|
17
28
|
import styled, { css } from 'styled-components';
|
|
29
|
+
import { Ghost } from '../Ghost';
|
|
18
30
|
var TabBase = React.forwardRef(function (props, ref) {
|
|
19
|
-
return React.createElement("div", { role: "tab", "aria-selected": props.active,
|
|
31
|
+
return React.createElement("div", { className: props.className, role: "tab", "aria-selected": props.active, ref: ref, onClick: props.onClick },
|
|
32
|
+
props.ghost && React.createElement(Ghost, { style: { position: 'absolute', left: '5px', top: '6px', right: '5px', bottom: '6px', zIndex: 100 } }),
|
|
33
|
+
React.createElement("div", null, props.children));
|
|
34
|
+
});
|
|
35
|
+
var TabStyled = styled(TabBase)(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n position: relative;\n display: table-cell;\n vertical-align: middle;\n text-align: center;\n white-space: nowrap;\n padding: 0 20px;\n\n font: ", ";\n box-sizing: border-box;\n ", "\n height: 40px;\n z-index: 1;\n cursor: pointer;\n color: ", ";\n transition: color ", "ms ease-in-out;\n\n /* User cannot select header text.\n * This prevents accidental selection when clicking the tab.\n */\n user-select: none; \n\n ", " \n &:hover {\n color: ", ";\n }\n\n // Ghost state:\n ", " \n"], ["\n position: relative;\n display: table-cell;\n vertical-align: middle;\n text-align: center;\n white-space: nowrap;\n padding: 0 20px;\n\n font: ", ";\n box-sizing: border-box;\n ", "\n height: 40px;\n z-index: 1;\n cursor: pointer;\n color: ", ";\n transition: color ", "ms ease-in-out;\n\n /* User cannot select header text.\n * This prevents accidental selection when clicking the tab.\n */\n user-select: none; \n\n ", " \n &:hover {\n color: ", ";\n }\n\n // Ghost state:\n ", " \n"])), function (p) { return p.theme.font.labelLarge; }, function (p) { return p.tabWidth && css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["min-width: ", "px;"], ["min-width: ", "px;"])), p.tabWidth); }, function (p) { return p.theme.colors.neutral[80]; }, function (p) { return p.theme.animation.duration; }, function (p) { return p.active && css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n color: ", ";\n "], ["\n color: ", ";\n "])), function (p) { return p.theme.colors.neutral[100]; }); }, function (p) { return p.theme.colors.neutral[100]; }, function (p) { return p.ghost && css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n pointer-events: none;\n user-select: none;\n & > *:not(:first-child) {\n border: solid 1px red;\n visibility: hidden;\n } \n "], ["\n pointer-events: none;\n user-select: none;\n & > *:not(:first-child) {\n border: solid 1px red;\n visibility: hidden;\n } \n "]))); });
|
|
36
|
+
var Tab = React.forwardRef(function (_a, ref) {
|
|
37
|
+
var _b = _a.ghost, ghost = _b === void 0 ? false : _b, props = __rest(_a, ["ghost"]);
|
|
38
|
+
return React.createElement(TabStyled, __assign({ ref: ref, ghost: ghost }, props));
|
|
20
39
|
});
|
|
21
|
-
var TabStyled = styled(TabBase)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n display: table-cell;\n vertical-align: middle;\n text-align: center;\n white-space: nowrap;\n padding: 0 20px;\n\n font: ", ";\n box-sizing: border-box;\n ", "\n height: 40px;\n z-index: 1;\n cursor: pointer;\n color: ", ";\n transition: color ", "ms ease-in-out;\n\n /* User cannot select header text.\n * This prevents accidental selection when clicking the tab.\n */\n user-select: none; \n\n ", " \n &:hover {\n color: ", ";\n }\n"], ["\n display: table-cell;\n vertical-align: middle;\n text-align: center;\n white-space: nowrap;\n padding: 0 20px;\n\n font: ", ";\n box-sizing: border-box;\n ", "\n height: 40px;\n z-index: 1;\n cursor: pointer;\n color: ", ";\n transition: color ", "ms ease-in-out;\n\n /* User cannot select header text.\n * This prevents accidental selection when clicking the tab.\n */\n user-select: none; \n\n ", " \n &:hover {\n color: ", ";\n }\n"])), function (p) { return p.theme.font.labelLarge; }, function (p) { return p.tabWidth && css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["min-width: ", "px;"], ["min-width: ", "px;"])), p.tabWidth); }, function (p) { return p.theme.colors.neutral[80]; }, function (p) { return p.theme.animation.duration; }, function (p) { return p.active && css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n color: ", ";\n "], ["\n color: ", ";\n "])), function (p) { return p.theme.colors.neutral[100]; }); }, function (p) { return p.theme.colors.neutral[100]; });
|
|
22
|
-
var Tab = React.forwardRef(function (props, ref) { return React.createElement(TabStyled, __assign({ ref: ref }, props)); });
|
|
23
40
|
Tab.displayName = "TabBar.Tab";
|
|
24
41
|
export { Tab };
|
|
25
|
-
var templateObject_1, templateObject_2, templateObject_3;
|
|
42
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4;
|
|
@@ -29,6 +29,11 @@ interface ITabBarProps {
|
|
|
29
29
|
* @param idx - The index of the new active tab.
|
|
30
30
|
*/
|
|
31
31
|
onChange?: (idx: number) => void;
|
|
32
|
+
/**
|
|
33
|
+
* If true, apply ghost state to TabBar and Tabs in it.
|
|
34
|
+
* @default false
|
|
35
|
+
*/
|
|
36
|
+
ghost?: boolean;
|
|
32
37
|
}
|
|
33
38
|
/**
|
|
34
39
|
* A `TabBar` presents an array of `TabBar.Tab` children in a horizontal bar,
|
|
@@ -38,7 +43,7 @@ interface ITabBarProps {
|
|
|
38
43
|
* This is just a `TabBar`; if you need tabs and panes, use the `Tab` container.
|
|
39
44
|
*/
|
|
40
45
|
declare const TabBar: {
|
|
41
|
-
({ active, ...props }: ITabBarProps): React.JSX.Element;
|
|
46
|
+
({ active, ghost, ...props }: ITabBarProps): React.JSX.Element;
|
|
42
47
|
Tab: React.ForwardRefExoticComponent<import("./Tab").ITabProps & React.RefAttributes<HTMLDivElement>>;
|
|
43
48
|
displayName: string;
|
|
44
49
|
};
|
|
@@ -198,6 +198,7 @@ var TabBarBase = function (props) {
|
|
|
198
198
|
ref: function (el) { return tabRefs.current[idx] = el; },
|
|
199
199
|
active: active === idx,
|
|
200
200
|
tabWidth: props.tabWidth,
|
|
201
|
+
ghost: props.ghost,
|
|
201
202
|
onClick: function () { return handleTabClick(idx); }
|
|
202
203
|
});
|
|
203
204
|
}),
|
|
@@ -221,8 +222,8 @@ var TabBarStyled = styled(TabBarBase)(templateObject_2 || (templateObject_2 = __
|
|
|
221
222
|
* This is just a `TabBar`; if you need tabs and panes, use the `Tab` container.
|
|
222
223
|
*/
|
|
223
224
|
var TabBar = function (_a) {
|
|
224
|
-
var _b = _a.active, active = _b === void 0 ? 0 : _b, props = __rest(_a, ["active"]);
|
|
225
|
-
return React.createElement(TabBarStyled, __assign({ active: active }, props));
|
|
225
|
+
var _b = _a.active, active = _b === void 0 ? 0 : _b, _c = _a.ghost, ghost = _c === void 0 ? false : _c, props = __rest(_a, ["active", "ghost"]);
|
|
226
|
+
return React.createElement(TabBarStyled, __assign({ active: active, ghost: ghost }, props));
|
|
226
227
|
};
|
|
227
228
|
TabBar.Tab = Tab;
|
|
228
229
|
TabBar.displayName = "TabBar";
|
package/package.json
CHANGED
package/styles/StyleBase.js
CHANGED
|
@@ -3,6 +3,6 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook
|
|
|
3
3
|
return cooked;
|
|
4
4
|
};
|
|
5
5
|
import { createGlobalStyle } from 'styled-components';
|
|
6
|
-
var StyleBase = createGlobalStyle(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n\n body {\n font-family: Roboto;\n font-style: normal;\n font-weight: 400;\n font-display: swap;\n color: ", ";\n }\n\n b, strong {\n font-weight: 700;\n }\n\n i, em {\n font-style: italic;\n }\n\n small, sub, sup { font-size: .83em; }\n sub { vertical-align: sub; }\n sup { vertical-align: super; }\n"], ["\n\n body {\n font-family: Roboto;\n font-style: normal;\n font-weight: 400;\n font-display: swap;\n color: ", ";\n }\n\n b, strong {\n font-weight: 700;\n }\n\n i, em {\n font-style: italic;\n }\n\n small, sub, sup { font-size: .83em; }\n sub { vertical-align: sub; }\n sup { vertical-align: super; }\n"])), function (p) { return p.theme.colors.font; });
|
|
6
|
+
var StyleBase = createGlobalStyle(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n\n body {\n font-family: Roboto;\n font-style: normal;\n font-weight: 400;\n font-display: swap;\n color: ", ";\n }\n\n b, strong {\n font-weight: 700;\n }\n\n i, em {\n font-style: italic;\n }\n\n a, a:visited, a:active, a:link {\n color: ", ";\n }\n\n small, sub, sup { font-size: .83em; }\n sub { vertical-align: sub; }\n sup { vertical-align: super; }\n"], ["\n\n body {\n font-family: Roboto;\n font-style: normal;\n font-weight: 400;\n font-display: swap;\n color: ", ";\n }\n\n b, strong {\n font-weight: 700;\n }\n\n i, em {\n font-style: italic;\n }\n\n a, a:visited, a:active, a:link {\n color: ", ";\n }\n\n small, sub, sup { font-size: .83em; }\n sub { vertical-align: sub; }\n sup { vertical-align: super; }\n"])), function (p) { return p.theme.colors.font; }, function (p) { return p.theme.colors.primary[1]; });
|
|
7
7
|
export { StyleBase };
|
|
8
8
|
var templateObject_1;
|