@linzjs/lui 11.9.0 → 11.10.3

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,31 @@
1
+ ## [11.10.3](https://github.com/linz/lui/compare/v11.10.2...v11.10.3) (2022-01-12)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * add missing dependency to useEffect hook. ([#513](https://github.com/linz/lui/issues/513)) ([4e4998c](https://github.com/linz/lui/commit/4e4998c299f7cc1f8b215f70047874e1bc2ef13d))
7
+
8
+ ## [11.10.2](https://github.com/linz/lui/compare/v11.10.1...v11.10.2) (2022-01-12)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * Allow LuiTooltip animation to be disabled. ([#512](https://github.com/linz/lui/issues/512)) ([686b752](https://github.com/linz/lui/commit/686b75217f883c3ab5d288273e51e3e741d06ee5))
14
+
15
+ ## [11.10.1](https://github.com/linz/lui/compare/v11.10.0...v11.10.1) (2022-01-11)
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * forgot to export LuiBadge 😅 ([#509](https://github.com/linz/lui/issues/509)) ([e347919](https://github.com/linz/lui/commit/e3479192c579e1316c4b7c8e7234fad1bd8ee0f0))
21
+
22
+ # [11.10.0](https://github.com/linz/lui/compare/v11.9.0...v11.10.0) (2022-01-11)
23
+
24
+
25
+ ### Features
26
+
27
+ * **LuiSelectInput & LuiTextAreaInput:** Added Mandatory star ([#506](https://github.com/linz/lui/issues/506)) ([cd296bf](https://github.com/linz/lui/commit/cd296bf67a686bccfd05b0c1d143da5298b7ee12))
28
+
1
29
  # [11.9.0](https://github.com/linz/lui/compare/v11.8.0...v11.9.0) (2022-01-11)
2
30
 
3
31
 
@@ -9,6 +9,7 @@ export interface SelectProps {
9
9
  onChange?: ChangeEventHandler<HTMLSelectElement>;
10
10
  options: SelectOptions[];
11
11
  value: string;
12
+ mandatory?: boolean;
12
13
  hideLabel?: boolean;
13
14
  selectProps?: SelectHTMLAttributes<HTMLSelectElement>;
14
15
  label: JSX.Element | string;
@@ -29,3 +29,7 @@ export declare const Error: {
29
29
  (): JSX.Element;
30
30
  storyName: string;
31
31
  };
32
+ export declare const MandatoryStar: {
33
+ (): JSX.Element;
34
+ storyName: string;
35
+ };
@@ -1,6 +1,7 @@
1
1
  import { ChangeEventHandler, InputHTMLAttributes } from 'react';
2
2
  export interface LuiTextAreaInputProps {
3
3
  label: JSX.Element | string;
4
+ mandatory?: boolean;
4
5
  inputProps?: InputHTMLAttributes<HTMLTextAreaElement>;
5
6
  onChange?: ChangeEventHandler<HTMLTextAreaElement>;
6
7
  value: string;
@@ -24,3 +24,7 @@ export declare const Error: {
24
24
  (): JSX.Element;
25
25
  storyName: string;
26
26
  };
27
+ export declare const Mandatory: {
28
+ (): JSX.Element;
29
+ storyName: string;
30
+ };
@@ -7,5 +7,6 @@ export interface ILuiTooltipProperties {
7
7
  placement?: Placement;
8
8
  trigger?: string;
9
9
  children: ReactNode;
10
+ animation?: boolean;
10
11
  }
11
12
  export declare const LuiTooltip: (props: ILuiTooltipProperties) => JSX.Element;
@@ -9,6 +9,7 @@ export declare type ILOLCommonDrawerMenuProps = Omit<ILOLAppLauncherMenuProps, '
9
9
  appSpecificLinks?: ReactNode;
10
10
  path: string;
11
11
  hasStickyHeader?: boolean;
12
+ showRequestsLink?: boolean;
12
13
  };
13
14
  export declare const LOLCommonDrawerMenu: (props: ILOLCommonDrawerMenuProps) => JSX.Element;
14
15
  export declare const LOLCommonDrawerMenuAfterLinks: (props: {
@@ -0,0 +1,43 @@
1
+ /// <reference types="jest" />
2
+ import { IFirm } from './contexts/LOLUserContext';
3
+ export declare const mockGetUserInfo: (firms: IFirm[]) => jest.Mock<import("msw/lib/types").AsyncResponseResolverReturnType<import("msw/lib/types").MockedResponse<{
4
+ user: {
5
+ id: string;
6
+ idHash: string;
7
+ email: string;
8
+ givenNames: string;
9
+ surname: string;
10
+ loginType: string;
11
+ preferredName: string;
12
+ firms: IFirm[];
13
+ passwordChangeRequired: boolean;
14
+ roles: never[];
15
+ lastLogin: string;
16
+ };
17
+ }>>, [import("msw/lib/types").MockedRequest<import("msw/lib/types/utils/handlers/requestHandler").DefaultRequestBodyType, import("msw/lib/types").RequestParams>, import("msw/lib/types").ResponseComposition<{
18
+ user: {
19
+ id: string;
20
+ idHash: string;
21
+ email: string;
22
+ givenNames: string;
23
+ surname: string;
24
+ loginType: string;
25
+ preferredName: string;
26
+ firms: IFirm[];
27
+ passwordChangeRequired: boolean;
28
+ roles: never[];
29
+ lastLogin: string;
30
+ };
31
+ }>, {
32
+ set: typeof import("msw/lib/types/context").set;
33
+ status: (statusCode: number, statusText?: string | undefined) => import("msw/lib/types").ResponseTransformer<any>;
34
+ cookie: (name: string, value: string, options?: import("cookie").CookieSerializeOptions | undefined) => import("msw/lib/types").ResponseTransformer<any>;
35
+ body: <BodyType extends string | Blob | ArrayBufferView | ArrayBuffer | ReadableStream<any> | FormData>(value: BodyType) => import("msw/lib/types").ResponseTransformer<BodyType>;
36
+ text: <BodyType_1 extends string>(body: BodyType_1) => import("msw/lib/types").ResponseTransformer<BodyType_1>;
37
+ json: <BodyTypeJSON>(body: BodyTypeJSON, { merge }?: {
38
+ merge?: boolean | undefined;
39
+ } | undefined) => import("msw/lib/types").ResponseTransformer<BodyTypeJSON>;
40
+ xml: <BodyType_2 extends string>(body: BodyType_2) => import("msw/lib/types").ResponseTransformer<BodyType_2>;
41
+ delay: (durationMs?: number | undefined) => import("msw/lib/types").ResponseTransformer<any>;
42
+ fetch: (input: string | import("msw/lib/types").MockedRequest<import("msw/lib/types/utils/handlers/requestHandler").DefaultRequestBodyType, import("msw/lib/types").RequestParams>, requestInit?: RequestInit | undefined) => any;
43
+ }]>;
@@ -46,6 +46,7 @@ interface CommonDrawerMenuTemplateProps {
46
46
  smallHeader: boolean;
47
47
  loginType: string;
48
48
  stickyHeader: boolean;
49
+ showRequestsLink: boolean;
49
50
  }
50
51
  export declare const CommonDrawerMenu: Story<CommonDrawerMenuTemplateProps>;
51
52
  interface DrawerMenuTemplateProps {
package/dist/index.d.ts CHANGED
@@ -48,3 +48,4 @@ export { LOLAuthorisedLink } from './components/lol/LOLAuthorisedLink';
48
48
  export { LOLCommonDrawerMenu, LOLCommonDrawerMenuAfterLinks, LOLDrawerMenu, } from './components/lol/LOLCommonDrawerMenu';
49
49
  export { LuiTooltip, ILuiTooltipProperties, } from './components/LuiTooltip/LuiTooltip';
50
50
  export * from './hooks';
51
+ export { LuiBadge } from './components/LuiBadge/LuiBadge';
@@ -1174,7 +1174,9 @@ var LuiSelectInput = function LuiSelectInput(props) {
1174
1174
  }, React__default.createElement("label", {
1175
1175
  htmlFor: id,
1176
1176
  className: "LuiSelect-label"
1177
- }, React__default.createElement("span", {
1177
+ }, props.mandatory && React__default.createElement("span", {
1178
+ className: "LuiSelect-mandatory"
1179
+ }, "*"), React__default.createElement("span", {
1178
1180
  className: clsx('LuiSelect-label-text', props.hideLabel ? 'LuiScreenReadersOnly' : '')
1179
1181
  }, props.label), React__default.createElement("div", {
1180
1182
  className: "LuiSelect-wrapper"
@@ -1215,7 +1217,9 @@ var LuiTextAreaInput = function LuiTextAreaInput(props) {
1215
1217
  className: clsx('LuiTextAreaInput')
1216
1218
  }, React__default.createElement("label", {
1217
1219
  htmlFor: id
1218
- }, React__default.createElement("span", {
1220
+ }, props.mandatory && React__default.createElement("span", {
1221
+ className: "LuiTextAreaInput-mandatory"
1222
+ }, "*"), React__default.createElement("span", {
1219
1223
  className: "LuiTextAreaInput-label"
1220
1224
  }, props.label), React__default.createElement("textarea", Object.assign({
1221
1225
  id: id,
@@ -20270,7 +20274,7 @@ var LOLDrawerMenuFirmSwitcher = function LOLDrawerMenuFirmSwitcher(props) {
20270
20274
  });
20271
20275
  };
20272
20276
 
20273
- var _excluded$5 = ["appSpecificLinks", "appSpecificSections", "path", "hasStickyHeader"];
20277
+ var _excluded$5 = ["appSpecificLinks", "appSpecificSections", "path", "hasStickyHeader", "showRequestsLink"];
20274
20278
  var LOLDrawerMenu = function LOLDrawerMenu(props) {
20275
20279
  return React__default.createElement(LuiDrawerMenu, {
20276
20280
  hasStickyHeader: props.hasStickyHeader
@@ -20287,6 +20291,7 @@ var LOLCommonDrawerMenu = function LOLCommonDrawerMenu(props) {
20287
20291
  appSpecificSections = props.appSpecificSections,
20288
20292
  path = props.path,
20289
20293
  hasStickyHeader = props.hasStickyHeader,
20294
+ showRequestsLink = props.showRequestsLink,
20290
20295
  restOfProps = _objectWithoutPropertiesLoose(props, _excluded$5);
20291
20296
 
20292
20297
  return React__default.createElement(LOLDrawerMenu, {
@@ -20295,7 +20300,7 @@ var LOLCommonDrawerMenu = function LOLCommonDrawerMenu(props) {
20295
20300
  pathname: path
20296
20301
  }, restOfProps)), React__default.createElement(LOLDrawerMenuFirmSwitcher, {
20297
20302
  minimumFilterCount: 5
20298
- }), appSpecificLinks && React__default.createElement(React__default.Fragment, null, React__default.createElement(LuiDrawerMenuDivider, null), appSpecificLinks), React__default.createElement(LuiDrawerMenuDivider, null), React__default.createElement(LOLCommonDrawerMenuAfterLinks, {
20303
+ }), showRequestsLink && React__default.createElement(React__default.Fragment, null, React__default.createElement(LuiDrawerMenuDivider, null), React__default.createElement(LOLCommonMenuRequestsLink, null)), appSpecificLinks && React__default.createElement(React__default.Fragment, null, React__default.createElement(LuiDrawerMenuDivider, null), appSpecificLinks), React__default.createElement(LuiDrawerMenuDivider, null), React__default.createElement(LOLCommonDrawerMenuAfterLinks, {
20299
20304
  path: path
20300
20305
  }));
20301
20306
  };
@@ -20322,6 +20327,28 @@ var LOLCommonDrawerMenuAfterLinks = function LOLCommonDrawerMenuAfterLinks(props
20322
20327
  }));
20323
20328
  };
20324
20329
 
20330
+ var LOLCommonMenuRequestsLink = function LOLCommonMenuRequestsLink() {
20331
+ var openRequestsApp = function openRequestsApp() {
20332
+ window.open('/requests', '_blank');
20333
+ };
20334
+
20335
+ return React__default.createElement(LuiDrawerMenuOption, {
20336
+ label: 'Create request',
20337
+ onClick: function onClick() {
20338
+ openRequestsApp();
20339
+ },
20340
+ badge: React__default.createElement("img", {
20341
+ src: ExternalIcon,
20342
+ alt: "Link opens in a new tab",
20343
+ style: {
20344
+ width: '16px',
20345
+ height: '16px',
20346
+ marginTop: '4px'
20347
+ }
20348
+ })
20349
+ });
20350
+ };
20351
+
20325
20352
  var id = 0;
20326
20353
 
20327
20354
  var getKey = function getKey() {
@@ -20332,7 +20359,9 @@ var LuiTooltip = function LuiTooltip(props) {
20332
20359
  var children = props.children,
20333
20360
  message = props.message,
20334
20361
  placement = props.placement,
20335
- trigger = props.trigger;
20362
+ trigger = props.trigger,
20363
+ _props$animation = props.animation,
20364
+ animation = _props$animation === void 0 ? true : _props$animation;
20336
20365
  var id = "LuiToolTip_" + React.useMemo(getKey, []);
20337
20366
 
20338
20367
  if (typeof message !== 'string') {
@@ -20346,14 +20375,15 @@ var LuiTooltip = function LuiTooltip(props) {
20346
20375
  trigger: trigger,
20347
20376
  theme: 'LUI',
20348
20377
  placement: placement,
20349
- offset: [0, 24]
20378
+ offset: [0, 24],
20379
+ animation: animation
20350
20380
  });
20351
20381
  return function () {
20352
20382
  var _document$getElementB, _document$getElementB2;
20353
20383
 
20354
20384
  (_document$getElementB = document.getElementById(id)) == null ? void 0 : (_document$getElementB2 = _document$getElementB._tippy) == null ? void 0 : _document$getElementB2.destroy();
20355
20385
  };
20356
- }, [id, message, placement, trigger]);
20386
+ }, [id, message, placement, trigger, animation]);
20357
20387
  return React__default.createElement("span", {
20358
20388
  id: id
20359
20389
  }, children);
@@ -20389,6 +20419,12 @@ function useClickedOutsideElement(refElement, handleClickOutside) {
20389
20419
  }, []);
20390
20420
  }
20391
20421
 
20422
+ var LuiBadge = function LuiBadge(props) {
20423
+ return React__default.createElement("p", {
20424
+ className: clsx('LuiBadge', props.size === 'sm' && 'LuiBadge--sm', props.size === 'lg' && 'LuiBadge--lg', props.backgroundFill && 'LuiBadge--fill', props.variation === 'warning' && 'LuiBadge--warning')
20425
+ }, props.children);
20426
+ };
20427
+
20392
20428
  exports.FIRM_KEY = FIRM_KEY;
20393
20429
  exports.FIRM_NAME_KEY = FIRM_NAME_KEY;
20394
20430
  exports.GLOBAL_CLIENT_REFERENCE_KEY = GLOBAL_CLIENT_REFERENCE_KEY;
@@ -20406,6 +20442,7 @@ exports.LOLUserContextProvider = LOLUserContextProvider;
20406
20442
  exports.LOLUserLastLogin = LOLUserLastLogin;
20407
20443
  exports.LuiAlertModal = LuiAlertModal;
20408
20444
  exports.LuiAlertModalButtons = LuiAlertModalButtons;
20445
+ exports.LuiBadge = LuiBadge;
20409
20446
  exports.LuiBanner = LuiBanner;
20410
20447
  exports.LuiBannerContent = LuiBannerContent;
20411
20448
  exports.LuiBearingFormikInput = LuiBearingFormikInput;