@stenajs-webui/elements 18.1.1 → 18.2.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,27 @@
1
+ # v18.2.0 (Mon Feb 27 2023)
2
+
3
+ #### 🚀 Enhancement
4
+
5
+ - New modal API [#560](https://github.com/StenaIT/stenajs-webui/pull/560) ([@mattias800](https://github.com/mattias800))
6
+
7
+ #### Authors: 1
8
+
9
+ - Mattias Andersson ([@mattias800](https://github.com/mattias800))
10
+
11
+ ---
12
+
13
+ # v18.1.2 (Mon Feb 27 2023)
14
+
15
+ #### 🐛 Bug Fix
16
+
17
+ - Button icons now customisable using CSS properties [#563](https://github.com/StenaIT/stenajs-webui/pull/563) ([@mattias800](https://github.com/mattias800))
18
+
19
+ #### Authors: 1
20
+
21
+ - Mattias Andersson ([@mattias800](https://github.com/mattias800))
22
+
23
+ ---
24
+
1
25
  # v18.0.1 (Thu Feb 16 2023)
2
26
 
3
27
  #### 🐛 Bug Fix
@@ -2,7 +2,6 @@ import { IconDefinition } from "@fortawesome/fontawesome-svg-core";
2
2
  import { ReactNode } from "react";
3
3
  export declare type ButtonSize = "medium" | "small" | "large";
4
4
  export declare type ButtonVariant = "normal" | "danger" | "success";
5
- export declare const getIconSizeFromButtonSize: (size: ButtonSize, hasLabel: boolean) => ButtonSize;
6
5
  export interface CommonButtonProps {
7
6
  /** The text on the button. */
8
7
  label?: string;
@@ -14,6 +14,5 @@ export interface ButtonContentProps {
14
14
  spinnerClassName?: string;
15
15
  leftWrapperClassName?: string;
16
16
  rightWrapperClassName?: string;
17
- iconSize?: "large" | "medium" | "small";
18
17
  }
19
18
  export declare const ButtonContent: React.FC<ButtonContentProps>;
@@ -0,0 +1,3 @@
1
+ export declare type ShowCommand<TProps, TPromiseResolve> = keyof TProps extends never ? () => Promise<TPromiseResolve | undefined> : (props: TProps) => Promise<TPromiseResolve | undefined>;
2
+ export declare type ResolveCommand<TPromiseResolve> = (resolveValue: TPromiseResolve) => void;
3
+ export declare type RejectCommand = (error?: Error) => void;
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ import { RejectCommand, ResolveCommand } from "./DialogCommands";
3
+ export interface DialogContextValue<TResolveValue> {
4
+ resolve: ResolveCommand<TResolveValue>;
5
+ reject: RejectCommand;
6
+ }
7
+ export declare const DialogContext: import("react").Context<DialogContextValue<any> | undefined>;
@@ -0,0 +1,22 @@
1
+ import React, { ReactNode, RefObject } from "react";
2
+ import { RejectCommand, ShowCommand } from "./DialogCommands";
3
+ declare type UseDialogCallbacks<TProps, TPromiseResolve> = {
4
+ show: ShowCommand<TProps, TPromiseResolve>;
5
+ reject: RejectCommand;
6
+ };
7
+ export declare type UseDialogResult<TProps, TPromiseResolve> = [
8
+ ReactNode,
9
+ UseDialogCallbacks<TProps, TPromiseResolve>
10
+ ];
11
+ export interface DialogOptions {
12
+ disableCloseOnClickOutside?: boolean;
13
+ modal: boolean;
14
+ className: string;
15
+ closingClassName: string;
16
+ contentWrapperClassName: string;
17
+ ref?: RefObject<HTMLDialogElement>;
18
+ onResolve?: () => void;
19
+ onReject?: () => void;
20
+ }
21
+ export declare function useDialog<TProps, TPromiseResolve = void>(component: React.FC<TProps>, options: DialogOptions): UseDialogResult<TProps, TPromiseResolve>;
22
+ export {};
@@ -0,0 +1,2 @@
1
+ import { DialogContextValue } from "./DialogContext";
2
+ export declare const useDialogPromise: <TResolveValue = void>() => DialogContextValue<TResolveValue>;
@@ -0,0 +1,9 @@
1
+ import React from "react";
2
+ import { DialogOptions, UseDialogResult } from "../UseDialog";
3
+ export declare type SlideFrom = SlideFromLeftRight | SlideFromTopBottom;
4
+ export declare type SlideFromLeftRight = "left" | "right";
5
+ export declare type SlideFromTopBottom = "top" | "bottom";
6
+ interface DrawerOptions extends Partial<Omit<DialogOptions, "disableCloseOnClickOutside">> {
7
+ }
8
+ export declare function useDrawerDialog<TProps, TPromiseResolve = void>(component: React.FC<TProps>, slideFrom?: SlideFrom, options?: DrawerOptions): UseDialogResult<TProps, TPromiseResolve>;
9
+ export {};
@@ -0,0 +1,3 @@
1
+ import React from "react";
2
+ import { DialogOptions, UseDialogResult } from "../UseDialog";
3
+ export declare function useModalDialog<TProps, TPromiseResolve = void>(component: React.FC<TProps>, options?: Partial<DialogOptions>): UseDialogResult<TProps, TPromiseResolve>;
@@ -1,10 +1,10 @@
1
1
  import { IconDefinition } from "@fortawesome/fontawesome-svg-core";
2
2
  import { FontAwesomeIconProps } from "@fortawesome/react-fontawesome";
3
- import { Omit, BoxProps } from "@stenajs-webui/core";
3
+ import { BoxProps, Omit } from "@stenajs-webui/core";
4
4
  import * as React from "react";
5
5
  export interface IconProps extends Omit<FontAwesomeIconProps, "color" | "size" | "icon" | "display">, Pick<BoxProps, "display"> {
6
6
  icon?: IconDefinition;
7
7
  color?: string;
8
- size?: number;
8
+ size?: number | string;
9
9
  }
10
10
  export declare const Icon: React.ForwardRefExoticComponent<IconProps & React.RefAttributes<HTMLDivElement>>;
package/dist/index.d.ts CHANGED
@@ -42,3 +42,7 @@ export * from "./components/ui/value-table/ValueTable";
42
42
  export * from "./components/ui/value-table/ValueTableItem";
43
43
  export * from "./components/ui/route-leg/RouteLeg";
44
44
  export * from "./components/ui/route-leg/TimeTag";
45
+ export * from "./components/ui/dialog/UseDialog";
46
+ export * from "./components/ui/dialog/UseDialogPromise";
47
+ export * from "./components/ui/dialog/drawer/UseDrawerDialog";
48
+ export * from "./components/ui/dialog/modal/UseModalDialog";