@longline/aqua-ui 1.0.317 → 1.0.319

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.
@@ -0,0 +1,29 @@
1
+ import * as React from 'react';
2
+ import { Placement } from '@popperjs/core';
3
+ interface IListButtonProps {
4
+ /** @ignore */
5
+ children?: React.ReactNode;
6
+ /** Toggle control that opens/closes the list. Receives an `onClick` handler. */
7
+ toggle: React.ReactElement<{
8
+ onClick?: React.MouseEventHandler;
9
+ }>;
10
+ /**
11
+ * Pane width in pixels.
12
+ * @default 250
13
+ */
14
+ width?: number;
15
+ /**
16
+ * Popper placement.
17
+ * @default top-start
18
+ */
19
+ placement?: Placement;
20
+ }
21
+ /**
22
+ * Best used with `<ListRow>` children.
23
+ */
24
+ declare const ListButton: {
25
+ ({ width, placement, ...props }: IListButtonProps): React.JSX.Element;
26
+ displayName: string;
27
+ };
28
+ export { ListButton };
29
+ export type { IListButtonProps };
@@ -0,0 +1,79 @@
1
+ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
2
+ if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
3
+ return cooked;
4
+ };
5
+ var __assign = (this && this.__assign) || function () {
6
+ __assign = Object.assign || function(t) {
7
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
8
+ s = arguments[i];
9
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
10
+ t[p] = s[p];
11
+ }
12
+ return t;
13
+ };
14
+ return __assign.apply(this, arguments);
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
+ };
27
+ import * as React from 'react';
28
+ import styled from "styled-components";
29
+ import { usePopper } from 'react-popper';
30
+ import { createPortal } from 'react-dom';
31
+ import { useOutsideClose } from '../../hooks/useOutsideClose';
32
+ import { List } from '../../containers/List';
33
+ var ListButtonBase = function (props) {
34
+ var buttonRef = React.useRef(null);
35
+ var paneRef = React.useRef(null);
36
+ var _a = React.useState(false), open = _a[0], setOpen = _a[1];
37
+ useOutsideClose({
38
+ open: open,
39
+ refs: [paneRef, buttonRef],
40
+ onClose: function () { return setOpen(false); },
41
+ escapeToClose: true,
42
+ blurToClose: false
43
+ });
44
+ var _b = usePopper(buttonRef.current, paneRef.current, {
45
+ placement: 'top-start',
46
+ modifiers: [
47
+ {
48
+ name: 'offset',
49
+ options: {
50
+ offset: [0, 8],
51
+ },
52
+ }
53
+ ]
54
+ }), styles = _b.styles, attributes = _b.attributes, update = _b.update;
55
+ var toggleOpen = function () {
56
+ setOpen(!open);
57
+ // Update popper.
58
+ if (update)
59
+ update();
60
+ };
61
+ return (React.createElement(React.Fragment, null,
62
+ React.createElement("div", { ref: buttonRef, style: { display: 'inline-block' } }, React.cloneElement(props.toggle, { onClick: toggleOpen })),
63
+ createPortal(React.createElement(Pane, __assign({ "$open": open, "$width": props.width, style: styles.popper }, attributes.popper, { ref: paneRef }), open && React.createElement(List, { maxItems: 6, contract: true }, props.children)), document.body)));
64
+ };
65
+ 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"
66
+ /**
67
+ * Best used with `<ListRow>` children.
68
+ */
69
+ ])), function (p) { return p.$open ? 'block' : 'none'; }, function (p) { return p.$width; });
70
+ /**
71
+ * Best used with `<ListRow>` children.
72
+ */
73
+ var ListButton = function (_a) {
74
+ var _b = _a.width, width = _b === void 0 ? 250 : _b, _c = _a.placement, placement = _c === void 0 ? 'top-start' : _c, props = __rest(_a, ["width", "placement"]);
75
+ return React.createElement(ListButtonBase, __assign({ width: width, placement: placement }, props));
76
+ };
77
+ ListButton.displayName = "ListButton";
78
+ export { ListButton };
79
+ var templateObject_1;
@@ -0,0 +1 @@
1
+ export * from './ListButton';
@@ -0,0 +1 @@
1
+ export * from './ListButton';
@@ -65,9 +65,6 @@ interface ITertiaryButtonProps {
65
65
  * | `minWidth` | Minimum button width (default: "92px") |
66
66
  * | `disabled` | Prevents interaction |
67
67
  */
68
- declare const TertiaryButton: {
69
- ({ disabled, minWidth, ...props }: ITertiaryButtonProps): React.JSX.Element;
70
- displayName: string;
71
- };
68
+ declare const TertiaryButton: React.ForwardRefExoticComponent<ITertiaryButtonProps & React.RefAttributes<HTMLButtonElement>>;
72
69
  export { TertiaryButton };
73
70
  export type { ITertiaryButtonProps };
@@ -27,7 +27,7 @@ var __rest = (this && this.__rest) || function (s, e) {
27
27
  import * as React from 'react';
28
28
  import styled, { css, useTheme } from 'styled-components';
29
29
  import { Icon } from '../Icon';
30
- var TertiaryButtonBase = function (props) {
30
+ var TertiaryButtonBase = React.forwardRef(function (props, ref) {
31
31
  var theme = useTheme();
32
32
  var icon = function () {
33
33
  // No icon?
@@ -39,10 +39,10 @@ var TertiaryButtonBase = function (props) {
39
39
  // An IIconProps was provided. Use it as the props for the icon.
40
40
  return React.createElement(Icon, __assign({ color: props.primary ? theme.colors.neutral[100] : theme.colors.primary[3] }, props.icon));
41
41
  };
42
- return (React.createElement("button", { className: props.className, type: "button", disabled: props.disabled, onClick: props.onClick },
42
+ return (React.createElement("button", { ref: ref, className: props.className, type: "button", disabled: props.disabled, onClick: props.onClick },
43
43
  icon(),
44
44
  props.children));
45
- };
45
+ });
46
46
  var TertiaryButtonStyled = styled(TertiaryButtonBase)(templateObject_3 || (templateObject_3 = __makeTemplateObject([" \n // Size:\n height: 42px;\n min-width: ", ";\n padding-left: 16px;\n padding-right: 16px;\n\n // Font\n font: ", ";\n color: ", ";\n\n // Presentation:\n background-color: ", ";\n border-radius: ", "px;\n transition: \n background-color ease-in-out ", "ms, \n box-shadow ease-in-out ", "ms;\n border: none;\n cursor: pointer;\n text-transform: uppercase;\n user-select: none;\n outline: none;\n\n // Content alignment:\n display: flex;\n flex-direction: row;\n justify-content: center;\n align-items: center;\n flex-wrap: nowrap;\n white-space: nowrap;\n gap: 6px;\n \n // Shadow:\n box-shadow: ", ";\n &:hover {\n box-shadow: ", ";\n }\n &:active {\n ", " \n }\n\n // Disabled:\n ", "\n"], [" \n // Size:\n height: 42px;\n min-width: ", ";\n padding-left: 16px;\n padding-right: 16px;\n\n // Font\n font: ", ";\n color: ", ";\n\n // Presentation:\n background-color: ", ";\n border-radius: ", "px;\n transition: \n background-color ease-in-out ", "ms, \n box-shadow ease-in-out ", "ms;\n border: none;\n cursor: pointer;\n text-transform: uppercase;\n user-select: none;\n outline: none;\n\n // Content alignment:\n display: flex;\n flex-direction: row;\n justify-content: center;\n align-items: center;\n flex-wrap: nowrap;\n white-space: nowrap;\n gap: 6px;\n \n // Shadow:\n box-shadow: ", ";\n &:hover {\n box-shadow: ", ";\n }\n &:active {\n ", " \n }\n\n // Disabled:\n ", "\n"
47
47
  /**
48
48
  * A lightweight button for contextual actions within components.
@@ -113,10 +113,10 @@ var TertiaryButtonStyled = styled(TertiaryButtonBase)(templateObject_3 || (templ
113
113
  * | `minWidth` | Minimum button width (default: "92px") |
114
114
  * | `disabled` | Prevents interaction |
115
115
  */
116
- var TertiaryButton = function (_a) {
116
+ var TertiaryButton = React.forwardRef(function (_a, ref) {
117
117
  var _b = _a.disabled, disabled = _b === void 0 ? false : _b, _c = _a.minWidth, minWidth = _c === void 0 ? "92px" : _c, props = __rest(_a, ["disabled", "minWidth"]);
118
- return React.createElement(TertiaryButtonStyled, __assign({ disabled: disabled, minWidth: minWidth }, props));
119
- };
118
+ return React.createElement(TertiaryButtonStyled, __assign({ ref: ref, disabled: disabled, minWidth: minWidth }, props));
119
+ });
120
120
  TertiaryButton.displayName = "TertiaryButton";
121
121
  export { TertiaryButton };
122
122
  var templateObject_1, templateObject_2, templateObject_3;
@@ -25,6 +25,10 @@ interface IProps {
25
25
  * by the logo's viewbox width.
26
26
  */
27
27
  logoAspectRatio: number;
28
+ /**
29
+ * Optional additional header content.
30
+ */
31
+ header?: React.ReactNode;
28
32
  }
29
33
  declare const Public: (props: IProps) => React.JSX.Element;
30
34
  export { Public };
@@ -21,7 +21,7 @@ var Public = function (props) {
21
21
  });
22
22
  return (React.createElement(React.Fragment, null,
23
23
  React.createElement(Box, { ref: wrapperRef },
24
- React.createElement(Header, { logoUrl: props.logoUrl, logoAspectRatio: props.logoAspectRatio, onClick: props.hint ? function () { return setShowHint(!showHint); } : null }),
24
+ React.createElement(Header, { logoUrl: props.logoUrl, logoAspectRatio: props.logoAspectRatio, onClick: props.hint ? function () { return setShowHint(!showHint); } : null, children: props.header }),
25
25
  React.createElement(Body, { height: props.height },
26
26
  props.hint && React.createElement(Hint, { active: showHint }, props.hint),
27
27
  props.children)),
@@ -2,6 +2,7 @@ import * as React from 'react';
2
2
  interface IProps {
3
3
  /** @ignore */
4
4
  className?: string;
5
+ children?: React.ReactNode;
5
6
  logoUrl: string;
6
7
  logoAspectRatio: number;
7
8
  /**
@@ -9,11 +9,14 @@ var HeaderBase = function (props) {
9
9
  return React.createElement("div", { className: props.className },
10
10
  React.createElement(Logo, { style: { aspectRatio: props.logoAspectRatio } },
11
11
  React.createElement("use", { xlinkHref: props.logoUrl })),
12
- props.onClick && React.createElement(Icon, { onClick: props.onClick },
13
- React.createElement("use", { xlinkHref: SVG.Icons.Info })));
12
+ React.createElement(Controls, null,
13
+ props.children,
14
+ props.onClick && React.createElement(Icon, { onClick: props.onClick },
15
+ React.createElement("use", { xlinkHref: SVG.Icons.Info }))));
14
16
  };
15
17
  var Logo = styled.svg(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n height: 48px;\n width: auto;\n display: block;\n"], ["\n height: 48px;\n width: auto;\n display: block;\n"])));
16
- var Icon = styled.svg(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n width: 26px;\n height: 26px;\n fill: #fff;\n border: solid 1px #8A9BA8;\n padding: 5px;\n border-radius: 50%;\n box-sizing: border-box;\n cursor: pointer;\n transition: border-color ease-in-out 200ms, fill ease-in-out 200ms;\n &:hover {\n border: solid 1px #E9A759;\n fill: #E9A759;\n }\n"], ["\n width: 26px;\n height: 26px;\n fill: #fff;\n border: solid 1px #8A9BA8;\n padding: 5px;\n border-radius: 50%;\n box-sizing: border-box;\n cursor: pointer;\n transition: border-color ease-in-out 200ms, fill ease-in-out 200ms;\n &:hover {\n border: solid 1px #E9A759;\n fill: #E9A759;\n }\n"])));
17
- var Header = styled(HeaderBase)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n background:#1C242A;\n height: 64px;\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding-left: 16px;\n padding-right: 22px;\n border-top-left-radius: ", "px;\n border-top-right-radius: ", "px;\n"], ["\n background:#1C242A;\n height: 64px;\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding-left: 16px;\n padding-right: 22px;\n border-top-left-radius: ", "px;\n border-top-right-radius: ", "px;\n"])), function (p) { return p.theme.radius.normal; }, function (p) { return p.theme.radius.normal; });
18
+ var Controls = styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject([" \n display: flex;\n flex-direction: row;\n gap: 8px;\n align-items: center;\n"], [" \n display: flex;\n flex-direction: row;\n gap: 8px;\n align-items: center;\n"])));
19
+ var Icon = styled.svg(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n width: 26px;\n height: 26px;\n fill: #fff;\n border: solid 1px #8A9BA8;\n padding: 5px;\n border-radius: 50%;\n box-sizing: border-box;\n cursor: pointer;\n transition: border-color ease-in-out 200ms, fill ease-in-out 200ms;\n &:hover {\n border: solid 1px #E9A759;\n fill: #E9A759;\n }\n"], ["\n width: 26px;\n height: 26px;\n fill: #fff;\n border: solid 1px #8A9BA8;\n padding: 5px;\n border-radius: 50%;\n box-sizing: border-box;\n cursor: pointer;\n transition: border-color ease-in-out 200ms, fill ease-in-out 200ms;\n &:hover {\n border: solid 1px #E9A759;\n fill: #E9A759;\n }\n"])));
20
+ var Header = styled(HeaderBase)(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n background:#1C242A;\n height: 64px;\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding-left: 16px;\n padding-right: 22px;\n border-top-left-radius: ", "px;\n border-top-right-radius: ", "px;\n"], ["\n background:#1C242A;\n height: 64px;\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding-left: 16px;\n padding-right: 22px;\n border-top-left-radius: ", "px;\n border-top-right-radius: ", "px;\n"])), function (p) { return p.theme.radius.normal; }, function (p) { return p.theme.radius.normal; });
18
21
  export { Header };
19
- var templateObject_1, templateObject_2, templateObject_3;
22
+ var templateObject_1, templateObject_2, templateObject_3, templateObject_4;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@longline/aqua-ui",
3
- "version": "1.0.317",
3
+ "version": "1.0.319",
4
4
  "description": "AquaUI",
5
5
  "author": "Alexander van Oostenrijk / Longline Environment",
6
6
  "license": "Commercial",