@wise/dynamic-flow-types 2.31.0 → 2.32.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,8 +1,9 @@
1
+ import type { ListLayoutCallToAction } from './ListLayoutCallToAction';
1
2
  import type { ListLayoutItem } from './ListLayoutItem';
2
3
  import type { Size } from '../misc/Size';
3
4
  /**
4
- * A list of items with statuses.
5
- * @deprecated Please use 'StatusListLayout' instead
5
+ * A list of read-only fields displaying information with optional images or icons for the user.
6
+ * @experimental This feature may be changed in the future without notice.
6
7
  */
7
8
  export type ListLayout = {
8
9
  /**
@@ -10,14 +11,18 @@ export type ListLayout = {
10
11
  */
11
12
  type: 'list';
12
13
  /**
13
- * Array of items.
14
- */
15
- items: ListLayoutItem[];
16
- /**
17
14
  * The user-facing title.
18
15
  */
19
16
  title?: string;
20
17
  /**
18
+ * A titled call to action which can be performed by the user.
19
+ */
20
+ callToAction?: ListLayoutCallToAction;
21
+ /**
22
+ * Array of items.
23
+ */
24
+ items: ListLayoutItem[];
25
+ /**
21
26
  * Specify a particular control to use to represent the layout. If the control is unknown, it will be ignored.
22
27
  */
23
28
  control?: string;
@@ -0,0 +1,18 @@
1
+ import type { Behavior } from '../feature/Behavior';
2
+ /**
3
+ * The call to action configuration used by [com.wise.dynamicflow.layout.ListLayout]. For example, it could be used to provide an edit action.
4
+ */
5
+ export type ListLayoutCallToAction = {
6
+ /**
7
+ * A user-facing title.
8
+ */
9
+ title: string;
10
+ /**
11
+ * A description of the call to action to be used by screen readers.
12
+ */
13
+ accessibilityDescription?: string;
14
+ /**
15
+ * Behavior that should be performed when user interacts with call to action.
16
+ */
17
+ behavior: Behavior;
18
+ };
@@ -1,24 +1,42 @@
1
- import type { Icon } from '../misc/Icon';
2
1
  import type { ListLayoutStatus } from './ListLayoutStatus';
2
+ import type { Icon } from '../misc/Icon';
3
+ import type { Image } from '../misc/Image';
3
4
  /**
4
5
  * A single entry in a [ListLayout].
5
- * @deprecated Please use 'StatusListLayout' instead
6
6
  */
7
7
  export type ListLayoutItem = {
8
+ /**
9
+ * A user-facing description.
10
+ * @deprecated Please use 'StatusListLayout' instead
11
+ */
12
+ description?: string;
13
+ /**
14
+ * The status of the item, if it has one.
15
+ * @deprecated Please use 'StatusListLayout' instead
16
+ */
17
+ status?: ListLayoutStatus;
18
+ /**
19
+ * An icon to represent the item.
20
+ */
21
+ icon?: Icon;
22
+ /**
23
+ * An image to represent the option.
24
+ */
25
+ image?: Image;
8
26
  /**
9
27
  * A user-facing title.
10
28
  */
11
29
  title: string;
12
30
  /**
13
- * A user-facing description.
31
+ * A user-facing subtitle.
14
32
  */
15
- description?: string;
33
+ subtitle?: string;
16
34
  /**
17
- * An icon to represent the item.
35
+ * A user-facing value.
18
36
  */
19
- icon: Icon;
37
+ value?: string;
20
38
  /**
21
- * The status of the item, if it has one.
39
+ * A user-facing subvalue.
22
40
  */
23
- status?: ListLayoutStatus;
41
+ subvalue?: string;
24
42
  };
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Represents the state of an item in a [ListLayout].
3
- * @deprecated Please use 'StatusListLayout' instead
2
+ * Represents the state of an item in the legacy [ListLayout].
3
+ * @deprecated Please use 'StatusListLayout' with 'StatusListLayout.Status' instead
4
4
  */
5
5
  export type ListLayoutStatus = 'warning' | 'neutral' | 'positive';
@@ -11,6 +11,7 @@ export type DecisionRendererProps = {
11
11
  export type DecisionOption = {
12
12
  description?: string;
13
13
  disabled?: boolean;
14
+ href?: string;
14
15
  icon?: Icon;
15
16
  image?: Image;
16
17
  title: string;
@@ -1 +1,22 @@
1
- export type { Image } from '../next';
1
+ /**
2
+ * Images fetched from URLs.
3
+ */
4
+ export type Image = {
5
+ /**
6
+ * @deprecated Please use 'accessibilityDescription' instead
7
+ */
8
+ text?: string;
9
+ /**
10
+ * The URL to use to fetch the image.
11
+ */
12
+ url: string;
13
+ /**
14
+ * The URI to use to fetch the image.
15
+ */
16
+ uri?: string;
17
+ /**
18
+ * A description of the content of the image to be used by screen readers.
19
+ * @experimental This feature may be changed in the future without notice.
20
+ */
21
+ accessibilityDescription?: string;
22
+ };
@@ -0,0 +1,33 @@
1
+ import { Icon } from "./Icon";
2
+ import { Image } from "./Image";
3
+ import { Margin } from "./constants";
4
+ export type ListRendererProps = {
5
+ type: 'list';
6
+ callToAction?: ListCallToAction;
7
+ control?: string;
8
+ items: ListItem[];
9
+ margin: Margin;
10
+ title?: string;
11
+ };
12
+ export type ListItem = {
13
+ icon?: Icon;
14
+ image?: Image;
15
+ title?: string;
16
+ subtitle?: string;
17
+ value?: string;
18
+ subvalue?: string;
19
+ };
20
+ export type ListCallToAction = ListCallToActionLink | ListCallToActionAction;
21
+ export type ListCallToActionLink = {
22
+ type: 'link';
23
+ accessibilityDescription?: string;
24
+ href: string;
25
+ title: string;
26
+ onClick: () => void;
27
+ };
28
+ export type ListCallToActionAction = {
29
+ type: 'action';
30
+ accessibilityDescription?: string;
31
+ title: string;
32
+ onClick: () => void;
33
+ };
@@ -14,6 +14,7 @@ import { HiddenRendererProps } from './HiddenRendererProps';
14
14
  import { ImageRendererProps } from './ImageRendererProps';
15
15
  import { InstructionsRendererProps } from './InstructionsRendererProps';
16
16
  import { IntegerInputRendererProps } from './IntegerInputRendererProps';
17
+ import { ListRendererProps } from './ListRendererProps';
17
18
  import { LoadingIndicatorRendererProps } from './LoadingIndicatorRendererProps';
18
19
  import { MarkdownRendererProps } from './MarkdownRendererProps';
19
20
  import { ModalRendererProps } from './ModalRendererProps';
@@ -29,10 +30,10 @@ import { StatusListRendererProps } from './StatusListRendererProps';
29
30
  import { StepRendererProps } from './StepRendererProps';
30
31
  import { TextInputRendererProps } from './TextInputRendererProps';
31
32
  import { UploadInputRendererProps } from './UploadInputRendererProps';
32
- export type RendererProps = AlertRendererProps | BooleanInputRendererProps | BoxRendererProps | ButtonRendererProps | ColumnsRendererProps | CoreContainerRendererProps | DateInputRendererProps | DecisionRendererProps | DividerRendererProps | FormRendererProps | FormSectionRendererProps | HeadingRendererProps | HiddenRendererProps | ImageRendererProps | InstructionsRendererProps | IntegerInputRendererProps | LoadingIndicatorRendererProps | MarkdownRendererProps | ModalRendererProps | MultiSelectInputRendererProps | MultiUploadInputRendererProps | NumberInputRendererProps | ParagraphRendererProps | RepeatableRendererProps | ReviewRendererProps | SearchRendererProps | SelectInputRendererProps | StatusListRendererProps | StepRendererProps | TextInputRendererProps | UploadInputRendererProps;
33
+ export type RendererProps = AlertRendererProps | BooleanInputRendererProps | BoxRendererProps | ButtonRendererProps | ColumnsRendererProps | CoreContainerRendererProps | DateInputRendererProps | DecisionRendererProps | DividerRendererProps | FormRendererProps | FormSectionRendererProps | HeadingRendererProps | HiddenRendererProps | ImageRendererProps | InstructionsRendererProps | IntegerInputRendererProps | ListRendererProps | LoadingIndicatorRendererProps | MarkdownRendererProps | ModalRendererProps | MultiSelectInputRendererProps | MultiUploadInputRendererProps | NumberInputRendererProps | ParagraphRendererProps | RepeatableRendererProps | ReviewRendererProps | SearchRendererProps | SelectInputRendererProps | StatusListRendererProps | StepRendererProps | TextInputRendererProps | UploadInputRendererProps;
33
34
  export type Renderer<P extends RendererProps> = {
34
35
  canRenderType: P['type'];
35
36
  canRender?: (props: P) => boolean;
36
37
  render: (props: P) => JSX.Element;
37
38
  };
38
- export type Renderers = readonly (Renderer<StepRendererProps> | Renderer<CoreContainerRendererProps> | Renderer<AlertRendererProps> | Renderer<BoxRendererProps> | Renderer<ColumnsRendererProps> | Renderer<DecisionRendererProps> | Renderer<DividerRendererProps> | Renderer<FormRendererProps> | Renderer<HeadingRendererProps> | Renderer<InstructionsRendererProps> | Renderer<LoadingIndicatorRendererProps> | Renderer<MarkdownRendererProps> | Renderer<ImageRendererProps> | Renderer<ModalRendererProps> | Renderer<ParagraphRendererProps> | Renderer<ReviewRendererProps> | Renderer<SearchRendererProps> | Renderer<StatusListRendererProps> | Renderer<FormSectionRendererProps> | Renderer<BooleanInputRendererProps> | Renderer<ButtonRendererProps> | Renderer<DateInputRendererProps> | Renderer<HiddenRendererProps> | Renderer<IntegerInputRendererProps> | Renderer<NumberInputRendererProps> | Renderer<RepeatableRendererProps> | Renderer<SelectInputRendererProps> | Renderer<MultiSelectInputRendererProps> | Renderer<TextInputRendererProps> | Renderer<UploadInputRendererProps> | Renderer<MultiUploadInputRendererProps>)[];
39
+ export type Renderers = readonly (Renderer<StepRendererProps> | Renderer<CoreContainerRendererProps> | Renderer<AlertRendererProps> | Renderer<BoxRendererProps> | Renderer<ColumnsRendererProps> | Renderer<DecisionRendererProps> | Renderer<DividerRendererProps> | Renderer<FormRendererProps> | Renderer<HeadingRendererProps> | Renderer<InstructionsRendererProps> | Renderer<ListRendererProps> | Renderer<LoadingIndicatorRendererProps> | Renderer<MarkdownRendererProps> | Renderer<ImageRendererProps> | Renderer<ModalRendererProps> | Renderer<ParagraphRendererProps> | Renderer<ReviewRendererProps> | Renderer<SearchRendererProps> | Renderer<StatusListRendererProps> | Renderer<FormSectionRendererProps> | Renderer<BooleanInputRendererProps> | Renderer<ButtonRendererProps> | Renderer<DateInputRendererProps> | Renderer<HiddenRendererProps> | Renderer<IntegerInputRendererProps> | Renderer<NumberInputRendererProps> | Renderer<RepeatableRendererProps> | Renderer<SelectInputRendererProps> | Renderer<MultiSelectInputRendererProps> | Renderer<TextInputRendererProps> | Renderer<UploadInputRendererProps> | Renderer<MultiUploadInputRendererProps>)[];
@@ -1,4 +1,4 @@
1
- import type { SearchResult as SearchResultSpec } from '../next';
1
+ import type { ImageLayout, SearchResult as SearchResultSpec } from '../next';
2
2
  import { Margin } from './constants';
3
3
  export type SearchRendererProps = {
4
4
  type: 'search';
@@ -27,7 +27,10 @@ export type ResultsSearchState = {
27
27
  type: 'results';
28
28
  results: SearchResult[];
29
29
  };
30
- export type SearchResult = Pick<SearchResultSpec, 'description' | 'icon' | 'image' | 'title' | 'type'> & {
30
+ export type SearchResult = Pick<SearchResultSpec, 'description' | 'icon' | 'title' | 'type'> & {
31
31
  id?: string;
32
+ image?: ImageLayout & {
33
+ uri?: string;
34
+ };
32
35
  onClick: () => void;
33
36
  };
@@ -14,6 +14,7 @@ export type { HiddenRendererProps } from './HiddenRendererProps';
14
14
  export type { ImageRendererProps } from './ImageRendererProps';
15
15
  export type { InstructionsRendererProps, InstructionItem } from './InstructionsRendererProps';
16
16
  export type { IntegerInputRendererProps } from './IntegerInputRendererProps';
17
+ export type { ListRendererProps } from './ListRendererProps';
17
18
  export type { LoadingIndicatorRendererProps } from './LoadingIndicatorRendererProps';
18
19
  export type { MarkdownRendererProps } from './MarkdownRendererProps';
19
20
  export type { ModalRendererProps } from './ModalRendererProps';
@@ -93,6 +93,21 @@ export type HeadingLayout = {
93
93
  };
94
94
  export type ImageLayout = {
95
95
  type: 'image';
96
+ content?: {
97
+ accessibilityDescription?: string;
98
+ /**
99
+ * @deprecated Please use accessibilityDescription
100
+ */
101
+ text?: string;
102
+ /**
103
+ * @deprecated Please use uri
104
+ */
105
+ url?: string;
106
+ uri?: string;
107
+ };
108
+ /**
109
+ * @deprecated Please use content.uri
110
+ */
96
111
  url: string;
97
112
  /**
98
113
  * @deprecated Please use accessibilityDescription
@@ -101,7 +116,7 @@ export type ImageLayout = {
101
116
  size?: Size;
102
117
  margin?: Margin;
103
118
  /**
104
- * @experimental accessibilityDescription is experimental and subject to change
119
+ * @deprecated Please use content.accessibilityDescription
105
120
  */
106
121
  accessibilityDescription?: string;
107
122
  };