@loomhq/lens 10.80.1 → 10.81.0

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.
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { SeverityLevels } from './types';
3
- declare const NotificationBarOuterWrapper: import("@emotion/styled-base").StyledComponent<React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>, NotificationBarWrapperProps, object>;
4
- declare const NotificationBar: ({ children, onCloseClick, isOpen, severity, ...props }: NotificationBarProps & React.ComponentProps<typeof NotificationBarOuterWrapper>) => JSX.Element;
3
+ declare const NotificationBarWrapper: import("@emotion/styled-base").StyledComponent<React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>, NotificationBarWrapperProps, object>;
4
+ declare const NotificationBar: ({ children, onCloseClick, isOpen, severity, ...props }: NotificationBarProps & React.ComponentProps<typeof NotificationBarWrapper>) => JSX.Element;
5
5
  declare type NotificationBarProps = {
6
6
  children?: React.ReactNode;
7
7
  isOpen?: boolean;
@@ -10,6 +10,7 @@ var __rest = (this && this.__rest) || function (s, e) {
10
10
  return t;
11
11
  };
12
12
  import React, { useEffect } from 'react';
13
+ import { u } from '../../utilities';
13
14
  import styled from '@emotion/styled';
14
15
  import { SvgClose, SvgAlertTriangle, SvgInfo, SvgWarningAlert, } from '../icon/available-icons';
15
16
  import Align from '../align/align';
@@ -45,32 +46,30 @@ const severityStyles = {
45
46
  },
46
47
  };
47
48
  const DURATION = 350;
48
- const NotificationBarOuterWrapper = styled.aside `
49
+ const NotificationBarWrapper = styled.aside `
50
+ --paddingXOffset: var(--lns-space-large);
51
+ --alignItems: start;
52
+
49
53
  display: grid;
50
- align-content: center;
54
+ align-items: var(--alignItems);
55
+ justify-content: space-between;
56
+ grid-template-columns: 1fr auto;
51
57
  ${props => `background-color: ${severityStyles[props.severity].bgColor}`};
52
58
  ${props => `font-family: ${severityStyles[props.severity].fontFamily}`};
53
59
 
54
60
  ${props => `color: ${severityStyles[props.severity].color}`};
55
61
  position: fixed;
56
- padding: var(--lns-space-medium) 0;
62
+ padding: var(--lns-space-medium) var(--paddingXOffset);
57
63
  top: 0;
58
64
  left: 0;
59
65
  transition: ${DURATION}ms box-shadow, ${DURATION}ms transform;
60
- width: 100vw;
66
+ width: 100%;
67
+ box-sizing: border-box;
61
68
  z-index: 1100;
62
69
  opacity: ${props => (props.isOpen ? '1' : '0')};
63
70
  transform: ${props => props.isOpen ? 'translateY(0px)' : 'translateY(-100%)'};
64
- `;
65
- const NotificationBarInnerWrapper = styled.div `
66
- --responsive-padding: var(--lns-space-small);
67
- margin: 0 auto;
68
- max-width: 1600px;
69
- padding-left: var(--responsive-padding);
70
- padding-right: var(--responsive-padding);
71
- width: calc(100% - (2 * var(--responsive-padding)));
72
- @media (min-width: 800px) {
73
- --responsive-padding: var(--lns-space-medium);
71
+ @media (min-width: 872px) {
72
+ --alignItems: center;
74
73
  }
75
74
  `;
76
75
  const NotificationBar = (_a) => {
@@ -92,16 +91,18 @@ const NotificationBar = (_a) => {
92
91
  };
93
92
  }, [isOpen, onCloseClick]);
94
93
  usePushPageDown(isOpen);
95
- return isOpen ? (React.createElement(NotificationBarOuterWrapper, Object.assign({ isOpen: isOpen, severity: severity }, props),
96
- React.createElement(NotificationBarInnerWrapper, null,
97
- React.createElement(Arrange, { alignItems: { default: 'start', small: 'center' }, justifyContent: "space-between", columns: ['1fr auto'] },
98
- React.createElement(Container, { paddingY: { default: 'xsmall', xsmall: 0 }, width: "100%" },
99
- React.createElement(Arrange, { autoFlow: "column", gap: "small", justifyContent: "center" },
100
- ((_b = severityStyles[severity]) === null || _b === void 0 ? void 0 : _b.icon) ? (React.createElement(Align, { alignment: "topLeft" },
101
- React.createElement(Icon, { icon: severityStyles[severity].icon, color: (_c = severityStyles[severity].color) !== null && _c !== void 0 ? _c : 'var(--lns-color-white)' }))) : null,
102
- ' ',
103
- children),
104
- props.button),
105
- React.createElement(IconButton, { iconColor: (_d = severityStyles[severity].color) !== null && _d !== void 0 ? _d : 'var(--lns-color-white)', tabIndex: 0, altText: "Close", icon: React.createElement(SvgClose, null), onClick: onCloseClick }))))) : null;
94
+ // NOTE: The UI for internal alert is slightly different.
95
+ const isInternalAlert = severity === 'internal';
96
+ return isOpen ? (React.createElement(NotificationBarWrapper, Object.assign({ isOpen: isOpen, severity: severity }, props),
97
+ React.createElement(Arrange, { alignItems: { default: 'start', small: 'center' }, justifyContent: "space-between", autoFlow: isInternalAlert ? 'column' : undefined, columns: !isInternalAlert ? ['1fr auto'] : undefined },
98
+ React.createElement(Container, { paddingY: { default: 'xsmall', xsmall: 0 },
99
+ // Visually offsets the close X so that text appears centre-aligned
100
+ paddingLeft: !isInternalAlert ? { default: 0, medium: u(3.5) } : undefined, width: "100%" },
101
+ React.createElement(Arrange, { autoFlow: "column", gap: isInternalAlert ? 'medium' : 'small', justifyContent: "center" },
102
+ ((_b = severityStyles[severity]) === null || _b === void 0 ? void 0 : _b.icon) ? (React.createElement(Align, { alignment: "topLeft" },
103
+ React.createElement(Icon, { icon: severityStyles[severity].icon, color: (_c = severityStyles[severity].color) !== null && _c !== void 0 ? _c : 'var(--lns-color-white)' }))) : null,
104
+ ' ',
105
+ children))),
106
+ React.createElement(IconButton, { iconColor: (_d = severityStyles[severity].color) !== null && _d !== void 0 ? _d : 'var(--lns-color-white)', tabIndex: 0, altText: "Close", icon: React.createElement(SvgClose, null), onClick: onCloseClick }))) : null;
106
107
  };
107
108
  export default NotificationBar;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loomhq/lens",
3
- "version": "10.80.1",
3
+ "version": "10.81.0",
4
4
  "scripts": {
5
5
  "dev": "next",
6
6
  "build:next": "next build",