@longline/aqua-ui 1.0.276 → 1.0.277
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/controls/{FilterButton/FilterButton.d.ts → ToggleButton/ToggleButton.d.ts} +9 -6
- package/controls/{FilterButton/FilterButton.js → ToggleButton/ToggleButton.js} +11 -14
- package/controls/ToggleButton/index.d.ts +1 -0
- package/controls/ToggleButton/index.js +1 -0
- package/modules/Filter/Filter.js +3 -2
- package/package.json +1 -1
- package/controls/FilterButton/index.d.ts +0 -1
- package/controls/FilterButton/index.js +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
interface
|
|
2
|
+
interface IToggleButtonProps {
|
|
3
3
|
/** @ignore */
|
|
4
4
|
className?: string;
|
|
5
5
|
/**
|
|
@@ -21,15 +21,18 @@ interface IFilterButtonProps {
|
|
|
21
21
|
* @default false
|
|
22
22
|
*/
|
|
23
23
|
open?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Icon URL
|
|
26
|
+
*/
|
|
27
|
+
url: string;
|
|
24
28
|
/**
|
|
25
29
|
* Fired when the button is clicked.
|
|
26
30
|
*/
|
|
27
31
|
onClick: (e?: React.MouseEvent) => void;
|
|
28
32
|
}
|
|
29
33
|
/**
|
|
30
|
-
* A `
|
|
31
|
-
* "depressed" and "highlighted" states to reflect UI status.
|
|
32
|
-
* combined with a pane to select filter options.
|
|
34
|
+
* A `ToggleButton` indicates whether something is active. It supports
|
|
35
|
+
* "depressed" and "highlighted" states to reflect UI status.
|
|
33
36
|
*/
|
|
34
|
-
declare const
|
|
35
|
-
export {
|
|
37
|
+
declare const ToggleButton: React.ForwardRefExoticComponent<IToggleButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
38
|
+
export { ToggleButton, IToggleButtonProps };
|
|
@@ -27,32 +27,29 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
27
27
|
import * as React from 'react';
|
|
28
28
|
import styled, { css } from 'styled-components';
|
|
29
29
|
import { Icon } from '../Icon';
|
|
30
|
-
|
|
31
|
-
var FilterButtonBase = React.forwardRef(function (props, ref) {
|
|
30
|
+
var ToggleButtonBase = React.forwardRef(function (props, ref) {
|
|
32
31
|
return React.createElement("button", { className: props.className, ref: ref, type: "button", onClick: props.onClick, title: props.title, disabled: props.disabled, "aria-pressed": props.active, "aria-expanded": props.open, "aria-disabled": props.disabled },
|
|
33
|
-
React.createElement(Icon, { url:
|
|
32
|
+
React.createElement(Icon, { url: props.url }));
|
|
34
33
|
});
|
|
35
|
-
var
|
|
34
|
+
var ToggleButtonStyled = styled(ToggleButtonBase).attrs(function (p) {
|
|
36
35
|
return {
|
|
37
36
|
$iconColor: p.disabled ? p.theme.colors.primary[2]
|
|
38
37
|
: p.theme.colors.neutral[100]
|
|
39
38
|
};
|
|
40
39
|
})(templateObject_4 || (templateObject_4 = __makeTemplateObject([" \n position: relative;\n // Size:\n height: 34px;\n\n // Presentation:\n background-color: ", ";\n transition: \n background-color ease-in-out ", "ms, \n box-shadow ease-in-out ", "ms;\n border-radius: ", "px;\n border: none;\n cursor: pointer;\n user-select: none;\n outline: none;\n box-shadow: ", ";\n\n &:hover {\n box-shadow: ", ";\n }\n &:active {\n background-color: ", " !important;\n box-shadow: ", ", ", ";\n }\n\n &:focus {\n outline: solid 2px ", ";\n }\n\n // Content alignment:\n display: flex;\n flex-direction: row;\n justify-content: start;\n align-items: center;\n\n svg {\n fill: ", ";\n width: 24px !important;\n max-width: 24px;\n height: 24px !important;\n max-height: 24px;\n } \n\n // Special active state overrides other states:\n ", "\n\n // Special open state overrides other states:\n ", " \n\n ", "\n"], [" \n position: relative;\n // Size:\n height: 34px;\n\n // Presentation:\n background-color: ", ";\n transition: \n background-color ease-in-out ", "ms, \n box-shadow ease-in-out ", "ms;\n border-radius: ", "px;\n border: none;\n cursor: pointer;\n user-select: none;\n outline: none;\n box-shadow: ", ";\n\n &:hover {\n box-shadow: ", ";\n }\n &:active {\n background-color: ", " !important;\n box-shadow: ", ", ", ";\n }\n\n &:focus {\n outline: solid 2px ", ";\n }\n\n // Content alignment:\n display: flex;\n flex-direction: row;\n justify-content: start;\n align-items: center;\n\n svg {\n fill: ", ";\n width: 24px !important;\n max-width: 24px;\n height: 24px !important;\n max-height: 24px;\n } \n\n // Special active state overrides other states:\n ", "\n\n // Special open state overrides other states:\n ", " \n\n ", "\n"
|
|
41
40
|
/**
|
|
42
|
-
* A `
|
|
43
|
-
* "depressed" and "highlighted" states to reflect UI status.
|
|
44
|
-
* combined with a pane to select filter options.
|
|
41
|
+
* A `ToggleButton` indicates whether something is active. It supports
|
|
42
|
+
* "depressed" and "highlighted" states to reflect UI status.
|
|
45
43
|
*/
|
|
46
44
|
])), function (p) { return p.theme.colors.primary[1]; }, function (p) { return p.theme.animation.duration; }, function (p) { return p.theme.animation.duration; }, function (p) { return p.theme.radius.normal; }, function (p) { return p.theme.shadows.large; }, function (p) { return p.theme.shadows.medium; }, function (p) { return p.theme.colors.primary[4]; }, function (p) { return p.theme.shadows.inner; }, function (p) { return p.theme.shadows.medium; }, function (p) { return p.theme.colors.neutral[100]; }, function (p) { return p.$iconColor; }, function (p) { return p.active && css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n background-color: ", ";\n svg { fill: ", "; }\n "], ["\n background-color: ", ";\n svg { fill: ", "; }\n "])), p.theme.colors.accent, p.theme.colors.neutral[100]); }, function (p) { return p.open && css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n background-color: ", " !important;\n box-shadow: ", ";\n &:hover {\n box-shadow: ", ";\n }\n "], ["\n background-color: ", " !important;\n box-shadow: ", ";\n &:hover {\n box-shadow: ", ";\n }\n "])), function (p) { return p.theme.colors.primary[4]; }, function (p) { return p.theme.shadows.inner; }, function (p) { return p.theme.shadows.inner; }); }, function (p) { return p.disabled && css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n cursor: auto;\n background-color: ", ";\n box-shadow: none;\n svg {\n fill: ", ";\n }\n "], ["\n cursor: auto;\n background-color: ", ";\n box-shadow: none;\n svg {\n fill: ", ";\n }\n "])), p.theme.colors.neutral[50], p.theme.colors.primary[3]); });
|
|
47
45
|
/**
|
|
48
|
-
* A `
|
|
49
|
-
* "depressed" and "highlighted" states to reflect UI status.
|
|
50
|
-
* combined with a pane to select filter options.
|
|
46
|
+
* A `ToggleButton` indicates whether something is active. It supports
|
|
47
|
+
* "depressed" and "highlighted" states to reflect UI status.
|
|
51
48
|
*/
|
|
52
|
-
var
|
|
49
|
+
var ToggleButton = React.forwardRef(function (_a, ref) {
|
|
53
50
|
var _b = _a.disabled, disabled = _b === void 0 ? false : _b, _c = _a.active, active = _c === void 0 ? false : _c, props = __rest(_a, ["disabled", "active"]);
|
|
54
|
-
return React.createElement(
|
|
51
|
+
return React.createElement(ToggleButtonStyled, __assign({ ref: ref, disabled: disabled, active: active }, props));
|
|
55
52
|
});
|
|
56
|
-
|
|
57
|
-
export {
|
|
53
|
+
ToggleButton.displayName = "FilterButton";
|
|
54
|
+
export { ToggleButton };
|
|
58
55
|
var templateObject_1, templateObject_2, templateObject_3, templateObject_4;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ToggleButton';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ToggleButton';
|
package/modules/Filter/Filter.js
CHANGED
|
@@ -28,9 +28,10 @@ import * as React from 'react';
|
|
|
28
28
|
import styled from 'styled-components';
|
|
29
29
|
import { createPortal } from 'react-dom';
|
|
30
30
|
import { usePopper } from 'react-popper';
|
|
31
|
-
import {
|
|
31
|
+
import { ToggleButton } from '../../controls/ToggleButton';
|
|
32
32
|
import { GlassPane } from '../../containers/GlassPane';
|
|
33
33
|
import { useOutsideClose } from '../../hooks/useOutsideClose';
|
|
34
|
+
import { SVG } from '../../svg';
|
|
34
35
|
var FilterBase = function (props) {
|
|
35
36
|
var buttonRef = React.useRef(null);
|
|
36
37
|
var paneRef = React.useRef(null);
|
|
@@ -60,7 +61,7 @@ var FilterBase = function (props) {
|
|
|
60
61
|
update();
|
|
61
62
|
};
|
|
62
63
|
return (React.createElement("div", { className: props.className },
|
|
63
|
-
React.createElement(
|
|
64
|
+
React.createElement(ToggleButton, { url: SVG.Icons.Filter, ref: buttonRef, active: props.active, open: open, onClick: toggleOpen }),
|
|
64
65
|
createPortal(React.createElement(Pane, __assign({ "$open": open, "$width": props.width, style: styles.popper }, attributes.popper, { ref: paneRef }), open && React.createElement(GlassPane, { padded: true, bordered: true }, props.children)), document.body)));
|
|
65
66
|
};
|
|
66
67
|
var Pane = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: ", ";\n width: ", "px;\n z-index: 2500;\n"], ["\n display: ", ";\n width: ", "px;\n z-index: 2500;\n"
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './FilterButton';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './FilterButton';
|