@linzjs/lui 21.4.0 → 21.6.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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ # [21.6.0](https://github.com/linz/lui/compare/v21.5.0...v21.6.0) (2023-11-01)
2
+
3
+
4
+ ### Features
5
+
6
+ * expose shouldCloseOnEsc for LuiModal ([#1037](https://github.com/linz/lui/issues/1037)) ([c17f418](https://github.com/linz/lui/commit/c17f418fe7a6d813bc686699e53de793484e5f80))
7
+
8
+ # [21.5.0](https://github.com/linz/lui/compare/v21.4.0...v21.5.0) (2023-10-31)
9
+
10
+
11
+ ### Features
12
+
13
+ * SURVEY-19904 allow LuiSplash video ([#1036](https://github.com/linz/lui/issues/1036)) ([e91bc44](https://github.com/linz/lui/commit/e91bc4476b238a92f042abc3dd674835d086f585))
14
+
1
15
  # [21.4.0](https://github.com/linz/lui/compare/v21.3.1...v21.4.0) (2023-10-31)
2
16
 
3
17
 
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  interface ILuiModal {
3
3
  key?: string;
4
4
  shouldCloseOnOverlayClick?: boolean;
5
+ shouldCloseOnEsc?: boolean;
5
6
  onClose?: () => void;
6
7
  className?: string;
7
8
  maxWidth?: boolean;
@@ -1,13 +1,27 @@
1
1
  import { ReactNode } from 'react';
2
- interface SplashModalProps {
3
- bigImage: string;
4
- smallImage: string;
2
+ interface IFrameConfig {
3
+ url: string;
4
+ width: number;
5
+ height: number;
6
+ title: string;
7
+ iframeWrapperClass?: string;
8
+ iFrameProps?: Partial<JSX.IntrinsicElements['iframe']>;
9
+ }
10
+ declare type SplashModalProps = {
5
11
  header: string;
6
12
  wrapperClass?: string;
7
13
  id: string;
8
14
  releaseVersion: string;
9
15
  enabled: boolean;
10
16
  children?: ReactNode;
11
- }
17
+ } & ({
18
+ bigImage: string;
19
+ smallImage: string;
20
+ iframe?: never;
21
+ } | {
22
+ bigImage?: never;
23
+ smallImage?: never;
24
+ iframe: IFrameConfig;
25
+ });
12
26
  export declare const LuiUpdatesSplashModal: (props: SplashModalProps) => JSX.Element;
13
27
  export {};
package/dist/index.js CHANGED
@@ -42042,6 +42042,7 @@ var LuiUpdatesSplashModal = function (props) {
42042
42042
  if (typeof process === 'undefined' || ((_a = process === null || process === void 0 ? void 0 : process.env) === null || _a === void 0 ? void 0 : _a.NODE_ENV) !== 'test') {
42043
42043
  Modal.setAppElement('#root');
42044
42044
  }
42045
+ var featureMedia = props.iframe ? (React__default["default"].createElement(FeatureIFrame, { iframeConfig: props.iframe })) : (React__default["default"].createElement(FeatureImages, { bigImage: props.bigImage, smallImage: props.smallImage }));
42045
42046
  return (React__default["default"].createElement(Modal, { isOpen: props.enabled &&
42046
42047
  showModal &&
42047
42048
  props.releaseVersion.trim() !== currentVersion, shouldCloseOnEsc: true, onRequestClose: handleClose, shouldCloseOnOverlayClick: true, contentLabel: "Recent updates", className: "lui-splash-content lui-box-shadow", overlayClassName: "splash_overlay" },
@@ -42052,14 +42053,25 @@ var LuiUpdatesSplashModal = function (props) {
42052
42053
  React__default["default"].createElement("h1", null, props.header)),
42053
42054
  React__default["default"].createElement("button", { "aria-label": "Close dialog", onClick: handleClose },
42054
42055
  React__default["default"].createElement(LuiIcon, { alt: "cross_icon", name: "ic_clear", status: "interactive", size: "md" }))),
42055
- React__default["default"].createElement("div", { className: "lui-feature-img" },
42056
- React__default["default"].createElement("img", { className: "lui-hide-xs lui-hide-sm", alt: "What's new", src: props.bigImage }),
42057
- React__default["default"].createElement("img", { className: "lui-hide-md lui-hide-lg lui-hide-xl", alt: "What's new", src: props.smallImage })),
42056
+ featureMedia,
42058
42057
  React__default["default"].createElement("div", { className: 'lui-feature-text' }, props.children))));
42058
+ };
42059
+ var FeatureImages = function (_a) {
42060
+ var bigImage = _a.bigImage, smallImage = _a.smallImage;
42061
+ return (React__default["default"].createElement("div", { className: "lui-feature-img" },
42062
+ React__default["default"].createElement("img", { className: "lui-hide-xs lui-hide-sm", alt: "What's new", src: bigImage }),
42063
+ React__default["default"].createElement("img", { className: "lui-hide-md lui-hide-lg lui-hide-xl", alt: "What's new", src: smallImage })));
42064
+ };
42065
+ var FeatureIFrame = function (_a) {
42066
+ var iframeConfig = _a.iframeConfig;
42067
+ var wrapperClass = iframeConfig.iframeWrapperClass || 'iframe-wrapper';
42068
+ var iFrameProps = iframeConfig.iFrameProps ? iframeConfig.iFrameProps : {};
42069
+ return (React__default["default"].createElement("div", { className: wrapperClass },
42070
+ React__default["default"].createElement("iframe", __assign({ width: iframeConfig.width, height: iframeConfig.height, src: iframeConfig.url, title: iframeConfig.title }, iFrameProps))));
42059
42071
  };
42060
42072
 
42061
42073
  var LuiModal = function (props) {
42062
- var _a;
42074
+ var _a, _b;
42063
42075
  var node = React.useRef(null);
42064
42076
  var handleClickOutside = React.useCallback(function (e) {
42065
42077
  // current DOES have a contains!
@@ -42086,7 +42098,7 @@ var LuiModal = function (props) {
42086
42098
  Modal.setAppElement('#root');
42087
42099
  }
42088
42100
  }
42089
- return (React__default["default"].createElement(Modal, __assign({ key: props.key, isOpen: true, shouldCloseOnOverlayClick: props.shouldCloseOnOverlayClick, onRequestClose: props.onClose, overlayClassName: "modal", className: props.lowContrast ? 'lui-scrim-low-contrast' : 'lui-scrim', ariaHideApp: !isTest }, (props.appendToElement && {
42101
+ return (React__default["default"].createElement(Modal, __assign({ key: props.key, isOpen: true, shouldCloseOnOverlayClick: props.shouldCloseOnOverlayClick, shouldCloseOnEsc: (_b = props.shouldCloseOnEsc) !== null && _b !== void 0 ? _b : true, onRequestClose: props.onClose, overlayClassName: "modal", className: props.lowContrast ? 'lui-scrim-low-contrast' : 'lui-scrim', ariaHideApp: !isTest }, (props.appendToElement && {
42090
42102
  parentSelector: props.appendToElement
42091
42103
  })),
42092
42104
  React__default["default"].createElement("div", { ref: node, className: clsx('lui-modal lui-box-shadow', props.maxWidth && 'lui-max-width', props.headingText && 'lui-modal-no-padding', props.className) },