@linzjs/lui 21.36.0 → 21.38.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,18 @@
1
+ # [21.38.0](https://github.com/linz/lui/compare/v21.37.0...v21.38.0) (2024-07-01)
2
+
3
+
4
+ ### Features
5
+
6
+ * **ColorPalette:** created a colour palette ([#1126](https://github.com/linz/lui/issues/1126)) ([816b7ad](https://github.com/linz/lui/commit/816b7adaaed2f5ac66c256dd184f1a009c6de4d3))
7
+
8
+ # [21.37.0](https://github.com/linz/lui/compare/v21.36.0...v21.37.0) (2024-07-01)
9
+
10
+
11
+ ### Features
12
+
13
+ * **LuiModalV2:** trigger release ([#1129](https://github.com/linz/lui/issues/1129)) ([a914f10](https://github.com/linz/lui/commit/a914f10d05d070d40cda00b30aecab808c27ffe2))
14
+ * **LuiModalV2:** Update modals UI ([#1127](https://github.com/linz/lui/issues/1127)) ([05d3ae5](https://github.com/linz/lui/commit/05d3ae571ff52dedabfc93ec4a056a0d0b3fe508))
15
+
1
16
  # [21.36.0](https://github.com/linz/lui/compare/v21.35.0...v21.36.0) (2024-07-01)
2
17
 
3
18
 
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import './ColorPalette.scss';
3
+ export declare const ColorInputGroup: React.ForwardRefExoticComponent<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React.HTMLAttributes<HTMLDivElement>> & React.RefAttributes<HTMLDivElement>>;
4
+ export declare const ColorInput: React.ForwardRefExoticComponent<{
5
+ name: string;
6
+ color: string;
7
+ description?: string | undefined;
8
+ label?: Omit<React.DetailedHTMLProps<React.LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, "aria-label" | "htmlFor"> | undefined;
9
+ } & Omit<Pick<React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "key" | keyof React.InputHTMLAttributes<HTMLInputElement>>, "id" | "name" | "type" | "value"> & React.RefAttributes<HTMLInputElement>>;
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ import './ColorPalette.scss';
3
+ /**
4
+ * @description Default colour palette template component using predetermined colours.
5
+ * To use custom colours, refer to the ColorInput and ColorInputGroup components.
6
+ * @param selected - The currently selected colour.
7
+ * @param onSelect - Callback function to handle the selected colour.
8
+ * @param name - The name of the colour picker.
9
+ */
10
+ export declare const ColorPalette: React.ForwardRefExoticComponent<{
11
+ selected?: string | undefined;
12
+ onSelect: (color: string) => void;
13
+ name?: string | undefined;
14
+ } & Omit<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React.HTMLAttributes<HTMLDivElement>>, "onSelect"> & React.RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,8 @@
1
+ export declare const defaultColours: Array<{
2
+ color: string;
3
+ description: string;
4
+ }>;
5
+ export declare const customColoursOne: Array<{
6
+ color: string;
7
+ description: string;
8
+ }>;
@@ -0,0 +1,7 @@
1
+ import { FC, PropsWithChildren } from 'react';
2
+ import { LuiModalV2Props } from './LuiModalV2';
3
+ export declare type LuiAlertModalLevel = 'success' | 'info' | 'warning' | 'error';
4
+ export declare type LuiAlertModalV2Props = Omit<LuiModalV2Props, 'headingIcon'> & {
5
+ level: LuiAlertModalLevel;
6
+ };
7
+ export declare const LuiAlertModalV2: FC<PropsWithChildren<LuiAlertModalV2Props>>;
@@ -13,10 +13,19 @@ interface ILuiModal {
13
13
  appendToElement?: () => HTMLElement;
14
14
  headerStyle?: 'light' | 'default';
15
15
  }
16
+ /**
17
+ * @deprecated this is replaced by `LuiModalV2`. [Migration notes](https://github.com/linz/Lui/pull/1127).
18
+ */
16
19
  export declare const LuiModal: React.FC<React.PropsWithChildren<ILuiModal>>;
20
+ /**
21
+ * @deprecated this is replaced by `LuiAlertModalV2`. [Migration notes](https://github.com/linz/Lui/pull/1127).
22
+ */
17
23
  export declare const LuiAlertModal: React.FC<React.PropsWithChildren<{
18
24
  level: 'success' | 'info' | 'warning' | 'error';
19
25
  } & ILuiModal>>;
26
+ /**
27
+ * @deprecated this is replaced by `LuiModalV2.Buttons`. [Migration notes](https://github.com/linz/Lui/pull/1127).
28
+ */
20
29
  export declare const LuiAlertModalButtons: React.FC<React.PropsWithChildren<unknown>>;
21
30
  interface IModalHeader {
22
31
  headingText?: string;
@@ -24,5 +33,8 @@ interface IModalHeader {
24
33
  onClose?: () => void;
25
34
  style?: 'light' | 'default';
26
35
  }
36
+ /**
37
+ * @deprecated this is deprecated alongside `LuiModal`. [Migration notes](https://github.com/linz/Lui/pull/1127).
38
+ */
27
39
  export declare const LuiModalHeader: React.FC<React.PropsWithChildren<IModalHeader>>;
28
40
  export {};
@@ -0,0 +1,34 @@
1
+ import React, { PropsWithChildren } from 'react';
2
+ import { LuiIconProps } from '../LuiIcon/LuiIcon';
3
+ export declare type LuiModalV2Props = {
4
+ key?: string;
5
+ /** Default `true` */
6
+ shouldCloseOnOverlayClick?: boolean;
7
+ /** Default `true` */
8
+ shouldCloseOnEsc?: boolean | 'use-keyup';
9
+ onClose?: () => void | Promise<void>;
10
+ showCloseButton?: boolean;
11
+ className?: string;
12
+ /** If set to true, the modal will take the full screen width. Default `false` */
13
+ maxWidth?: boolean;
14
+ headingText?: string;
15
+ headingIcon?: LuiIconProps;
16
+ helpLink?: string | (() => void | Promise<void>);
17
+ isLoading?: boolean;
18
+ /** Sets the overlay to white. This is only to be used for situations when the user is working in a component and there is benefit to hiding the surrounding page. An example is editing types of instruments in the Dealings flow in LOL. */
19
+ lowContrast?: boolean;
20
+ /** By default, the modal autofocuses the first `input` or `button` inside it. Set this prop to `true` to disable that behaviour. Default `false`. This is kept from LuiModal "V1" for backwards compatibility. */
21
+ preventAutoFocus?: boolean;
22
+ /** By default, the modal portal will be appended to the document's body, but we might need to append it to another element. This is passed the React Modal `parentSelector` prop. */
23
+ appendToElement?: () => HTMLElement;
24
+ };
25
+ /** Implements the [updated modal design system](https://www.figma.com/design/E7g3n5ziI7bR8MisISayia/FigLUI?node-id=9924-54717&t=q2r6Gct1cKGP9Q5B-0), keeping the same api as `LuiModal` as much as possible. */
26
+ export declare const LuiModalV2: {
27
+ (props: PropsWithChildren<LuiModalV2Props>): JSX.Element;
28
+ Buttons: React.FC<React.PropsWithChildren<{
29
+ className?: string | undefined;
30
+ }>>;
31
+ HeaderTitle: React.FC<React.PropsWithChildren<{
32
+ className?: string | undefined;
33
+ }>>;
34
+ };
@@ -4,7 +4,7 @@
4
4
  *
5
5
  * @param onEscape the handler function
6
6
  */
7
- export declare const useEscapeFunction: (onEscape: () => void) => void;
7
+ export declare const useEscapeFunction: (onEscape: (e: KeyboardEvent) => void | Promise<void>, trigger?: 'keyup' | 'keydown') => void;
8
8
  /**
9
9
  * A hook which allows handling of click event anywhere on the page.
10
10
  * Provides a way of handling clicks done inside or outside the element bound to the returned react ref.
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import { MutableRefObject, RefObject } from 'react';
2
2
  /**
3
3
  * This hook will callback with handleClickOutside() when "mousedown" dom event occurs off the refElement
4
4
  * usage:
@@ -11,4 +11,4 @@ import React from 'react';
11
11
  return <button ref={refElement}>Click Me!</button>;
12
12
  ```
13
13
  */
14
- export declare function useClickedOutsideElement(refElement: React.RefObject<HTMLElement>, handleClickOutside: CallableFunction): void;
14
+ export declare function useClickedOutsideElement(refElement: RefObject<HTMLElement> | MutableRefObject<HTMLElement>, handleClickOutside: CallableFunction): void;
package/dist/index.d.ts CHANGED
@@ -37,6 +37,8 @@ export * from './components/LuiHeaderMenu/LuiHeaderMenus';
37
37
  export * from './components/LuiHeaderMenuV2/LuiHeaderMenusV2';
38
38
  export { LuiUpdatesSplashModal } from './components/LuiUpdateSplashModal/LuiUpdatesSplashModal';
39
39
  export { LuiModal, LuiAlertModal, LuiAlertModalButtons, } from './components/LuiModal/LuiModal';
40
+ export { LuiModalV2, type LuiModalV2Props, } from './components/LuiModal/LuiModalV2';
41
+ export { LuiAlertModalV2, type LuiAlertModalLevel, type LuiAlertModalV2Props, } from './components/LuiModal/LuiAlertModalV2';
40
42
  export { type ISearchInputProps, LuiSearchInput, } from './components/LuiSearchInput/LuiSearchInput';
41
43
  export { type ISearchGroupedResult, type ISearchResult, } from './components/LuiSearchInput/ResultsDisplay';
42
44
  export { type ISearchMenuOption, type ILuiSearchBoxProps, LuiSearchBox, } from './components/LuiSearchBox/LuiSearchBox';
@@ -72,5 +74,7 @@ export { LuiPagination } from './components/LuiPagination/LuiPagination';
72
74
  export { Splitter } from './components/Splitter/Splitter';
73
75
  export { useSplitterRef } from './components/Splitter/useSplitterRef';
74
76
  export { LuiBannerV2 } from './components/LuiBannerV2/LuiBannerV2';
77
+ export { ColorPalette } from './components/LuiColourPicker/ColorPalette';
78
+ export { ColorInput, ColorInputGroup, } from './components/LuiColourPicker/ColorInput';
75
79
  export { useToast } from './components/Toast';
76
80
  export { LuiMessagingContextProvider, useShowLUIMessage, LuiToastMessage, } from './components/Toast/Upgrade';