@longline/aqua-ui 1.0.210 → 1.0.212
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/TabBar/Tab.d.ts +10 -0
- package/controls/TabBar/Tab.js +21 -4
- package/controls/TabBar/TabBar.d.ts +11 -1
- package/controls/TabBar/TabBar.js +7 -5
- package/controls/TabBar/Underliner.d.ts +2 -0
- package/controls/TabBar/Underliner.js +1 -1
- package/package.json +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
|
/**
|
package/controls/TabBar/Tab.d.ts
CHANGED
|
@@ -16,6 +16,16 @@ interface ITabProps {
|
|
|
16
16
|
* Fired when tab is clicked.
|
|
17
17
|
*/
|
|
18
18
|
onClick?: () => void;
|
|
19
|
+
/**
|
|
20
|
+
* If true, applies ghost state to `Tab`.
|
|
21
|
+
* @default false
|
|
22
|
+
*/
|
|
23
|
+
ghost?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* A `disabled` `Tab` cannot be clicked.
|
|
26
|
+
* @default false
|
|
27
|
+
*/
|
|
28
|
+
disabled?: boolean;
|
|
19
29
|
}
|
|
20
30
|
declare const Tab: React.ForwardRefExoticComponent<ITabProps & React.RefAttributes<HTMLDivElement>>;
|
|
21
31
|
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_6 || (templateObject_6 = __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 and disabled cannot be clicked:\n ", "\n\n // Disabled:\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 and disabled cannot be clicked:\n ", "\n\n // Disabled:\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 || p.disabled) && css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n pointer-events: none;\n "], ["\n pointer-events: none;\n "]))); }, function (p) { return p.disabled && css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n color: ", ";\n &:hover {\n color: ", ";\n }\n "], ["\n color: ", ";\n &:hover {\n color: ", ";\n }\n "])), function (p) { return p.theme.colors.neutral[50]; }, function (p) { return p.theme.colors.neutral[50]; }); }, function (p) { return p.ghost && css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n & > *:not(:first-child) {\n border: solid 1px red;\n visibility: hidden;\n } \n "], ["\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, _c = _a.disabled, disabled = _c === void 0 ? false : _c, props = __rest(_a, ["ghost", "disabled"]);
|
|
38
|
+
return React.createElement(TabStyled, __assign({ ref: ref, ghost: ghost, disabled: disabled }, 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, templateObject_5, templateObject_6;
|
|
@@ -29,6 +29,16 @@ 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;
|
|
37
|
+
/**
|
|
38
|
+
* A `disabled` `TabBar`'s tabs cannot be clicked.
|
|
39
|
+
* @default false
|
|
40
|
+
*/
|
|
41
|
+
disabled?: boolean;
|
|
32
42
|
}
|
|
33
43
|
/**
|
|
34
44
|
* A `TabBar` presents an array of `TabBar.Tab` children in a horizontal bar,
|
|
@@ -38,7 +48,7 @@ interface ITabBarProps {
|
|
|
38
48
|
* This is just a `TabBar`; if you need tabs and panes, use the `Tab` container.
|
|
39
49
|
*/
|
|
40
50
|
declare const TabBar: {
|
|
41
|
-
({ active, ...props }: ITabBarProps): React.JSX.Element;
|
|
51
|
+
({ active, ghost, disabled, ...props }: ITabBarProps): React.JSX.Element;
|
|
42
52
|
Tab: React.ForwardRefExoticComponent<import("./Tab").ITabProps & React.RefAttributes<HTMLDivElement>>;
|
|
43
53
|
displayName: string;
|
|
44
54
|
};
|
|
@@ -198,13 +198,15 @@ 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,
|
|
202
|
+
disabled: props.disabled,
|
|
201
203
|
onClick: function () { return handleTabClick(idx); }
|
|
202
204
|
});
|
|
203
205
|
}),
|
|
204
|
-
React.createElement(Underliner, { ref: underlinerRef }))));
|
|
206
|
+
React.createElement(Underliner, { disabled: props.disabled || props.ghost, ref: underlinerRef }))));
|
|
205
207
|
};
|
|
206
208
|
var Slider = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: absolute;\n left: 0;\n top: 0;\n width: auto !important;\n min-width: 100%;\n height: 40px;\n box-sizing: border-box;\n display: block;\n border-bottom: solid 1px ", ";\n"], ["\n position: absolute;\n left: 0;\n top: 0;\n width: auto !important;\n min-width: 100%;\n height: 40px;\n box-sizing: border-box;\n display: block;\n border-bottom: solid 1px ", ";\n"])), function (p) { return p.theme.colors.neutral[80]; });
|
|
207
|
-
var TabBarStyled = styled(TabBarBase)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n position: relative;\n display: block;\n height: 40px;\n min-height: 40px;\n overflow-x: hidden;\n overflow-y: hidden;\n"], ["\n position: relative;\n display: block;\n height: 40px;\n min-height: 40px;\n overflow-x: hidden;\n overflow-y: hidden;\n"
|
|
209
|
+
var TabBarStyled = styled(TabBarBase)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n position: relative;\n display: block;\n height: 40px;\n min-height: 40px;\n overflow-x: hidden;\n overflow-y: hidden;\n ", " {\n border-color: ", ";\n }\n"], ["\n position: relative;\n display: block;\n height: 40px;\n min-height: 40px;\n overflow-x: hidden;\n overflow-y: hidden;\n ", " {\n border-color: ", ";\n }\n"
|
|
208
210
|
/**
|
|
209
211
|
* A `TabBar` presents an array of `TabBar.Tab` children in a horizontal bar,
|
|
210
212
|
* with an underliner under the active child. The `onClick(idx)` event is fired
|
|
@@ -212,7 +214,7 @@ var TabBarStyled = styled(TabBarBase)(templateObject_2 || (templateObject_2 = __
|
|
|
212
214
|
*
|
|
213
215
|
* This is just a `TabBar`; if you need tabs and panes, use the `Tab` container.
|
|
214
216
|
*/
|
|
215
|
-
])));
|
|
217
|
+
])), Slider, function (p) { return (p.disabled || p.ghost) ? p.theme.colors.neutral[50] : p.theme.colors.neutral[80]; });
|
|
216
218
|
/**
|
|
217
219
|
* A `TabBar` presents an array of `TabBar.Tab` children in a horizontal bar,
|
|
218
220
|
* with an underliner under the active child. The `onClick(idx)` event is fired
|
|
@@ -221,8 +223,8 @@ var TabBarStyled = styled(TabBarBase)(templateObject_2 || (templateObject_2 = __
|
|
|
221
223
|
* This is just a `TabBar`; if you need tabs and panes, use the `Tab` container.
|
|
222
224
|
*/
|
|
223
225
|
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));
|
|
226
|
+
var _b = _a.active, active = _b === void 0 ? 0 : _b, _c = _a.ghost, ghost = _c === void 0 ? false : _c, _d = _a.disabled, disabled = _d === void 0 ? false : _d, props = __rest(_a, ["active", "ghost", "disabled"]);
|
|
227
|
+
return React.createElement(TabBarStyled, __assign({ active: active, ghost: ghost, disabled: disabled }, props));
|
|
226
228
|
};
|
|
227
229
|
TabBar.Tab = Tab;
|
|
228
230
|
TabBar.displayName = "TabBar";
|
|
@@ -2,6 +2,8 @@ import * as React from 'react';
|
|
|
2
2
|
interface IUnderlinerProps {
|
|
3
3
|
/** @ignore */
|
|
4
4
|
className?: string;
|
|
5
|
+
/** Is TabBar disabled? */
|
|
6
|
+
disabled?: boolean;
|
|
5
7
|
}
|
|
6
8
|
declare const Underliner: React.ForwardRefExoticComponent<IUnderlinerProps & React.RefAttributes<HTMLDivElement>>;
|
|
7
9
|
export { Underliner };
|
|
@@ -21,7 +21,7 @@ var UnderlinerBase = React.forwardRef(function (props, ref) {
|
|
|
21
21
|
/**
|
|
22
22
|
* Underliner passes a reference to itself back to its parent.
|
|
23
23
|
*/
|
|
24
|
-
var UnderlinerStyled = styled(UnderlinerBase)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n // Position and size:\n position: absolute;\n left: 0;\n top: 38px;\n width: 0px;\n height: 0px;\n // Appearance:\n border-top: solid 4px ", ";\n box-sizing: border-box;\n transition: transform ease .3s, width ease .3s;\n"], ["\n // Position and size:\n position: absolute;\n left: 0;\n top: 38px;\n width: 0px;\n height: 0px;\n // Appearance:\n border-top: solid 4px ", ";\n box-sizing: border-box;\n transition: transform ease .3s, width ease .3s;\n"])), function (p) { return p.theme.colors.primary[1]; });
|
|
24
|
+
var UnderlinerStyled = styled(UnderlinerBase)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n // Position and size:\n position: absolute;\n left: 0;\n top: 38px;\n width: 0px;\n height: 0px;\n // Appearance:\n border-top: solid 4px ", ";\n box-sizing: border-box;\n transition: transform ease .3s, width ease .3s;\n"], ["\n // Position and size:\n position: absolute;\n left: 0;\n top: 38px;\n width: 0px;\n height: 0px;\n // Appearance:\n border-top: solid 4px ", ";\n box-sizing: border-box;\n transition: transform ease .3s, width ease .3s;\n"])), function (p) { return p.disabled ? p.theme.colors.neutral[50] : p.theme.colors.primary[1]; });
|
|
25
25
|
var Underliner = React.forwardRef(function (props, ref) {
|
|
26
26
|
return React.createElement(UnderlinerStyled, __assign({ ref: ref }, props));
|
|
27
27
|
});
|