@payfit/unity-components 1.1.0 → 1.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/dist/esm/adapters/standardSchemaAdapter.d.ts +7 -0
- package/dist/esm/adapters/standardSchemaAdapter.js +20 -0
- package/dist/esm/adapters/zodAdapter.d.ts +13 -0
- package/dist/esm/adapters/zodAdapter.js +74 -0
- package/dist/esm/components/action-bar/ActionBar.js +62 -64
- package/dist/esm/components/actionable/Actionable.d.ts +50 -3
- package/dist/esm/components/actionable/Actionable.js +49 -39
- package/dist/esm/components/app-menu/parts/AppMenuFooter.js +63 -63
- package/dist/esm/components/autocomplete/parts/AutocompleteClearButton.js +5 -5
- package/dist/esm/components/bottom-sheet/parts/BottomSheetDragIndicator.js +30 -31
- package/dist/esm/components/checkbox-field/CheckboxField.d.ts +2 -2
- package/dist/esm/components/checkbox-field/CheckboxField.js +18 -17
- package/dist/esm/components/checkbox-group-field/CheckboxGroupField.d.ts +2 -2
- package/dist/esm/components/checkbox-group-field/CheckboxGroupField.js +4 -1
- package/dist/esm/components/code/Code.d.ts +37 -0
- package/dist/esm/components/code/Code.js +39 -0
- package/dist/esm/components/code/copyToClipboard.d.ts +1 -0
- package/dist/esm/components/code/copyToClipboard.js +10 -0
- package/dist/esm/components/collapsible/Collapsible.d.ts +1 -1
- package/dist/esm/components/collapsible/Collapsible.js +14 -13
- package/dist/esm/components/collapsible/parts/CollapsibleTitle.js +7 -7
- package/dist/esm/components/data-table/DataTable.d.ts +76 -10
- package/dist/esm/components/data-table/DataTable.js +81 -78
- package/dist/esm/components/data-table/parts/ColumnSortHeader.js +13 -13
- package/dist/esm/components/data-table/parts/DataTableBulkActions.js +20 -20
- package/dist/esm/components/date-calendar/DateCalendar.js +52 -52
- package/dist/esm/components/date-calendar/parts/DateSegmentSelect.js +30 -33
- package/dist/esm/components/date-picker/DatePicker.js +64 -64
- package/dist/esm/components/date-picker/parts/DateInput.js +33 -33
- package/dist/esm/components/date-picker-field/DatePickerField.d.ts +2 -2
- package/dist/esm/components/dialog/parts/DialogActions/DialogButton.js +12 -12
- package/dist/esm/components/error-state/ErrorState.d.ts +196 -0
- package/dist/esm/components/error-state/ErrorState.js +153 -0
- package/dist/esm/components/error-state/initConfig.d.ts +16 -0
- package/dist/esm/components/error-state/initConfig.js +149 -0
- package/dist/esm/components/error-state/parts/Collapsible.d.ts +59 -0
- package/dist/esm/components/error-state/parts/Collapsible.js +67 -0
- package/dist/esm/components/form/Form.d.ts +15 -9
- package/dist/esm/components/form/Form.js +53 -50
- package/dist/esm/components/form-field/FormField.js +24 -23
- package/dist/esm/components/form-field/utils/isFieldRequired.d.ts +4 -4
- package/dist/esm/components/form-field/utils/isFieldRequired.js +5 -20
- package/dist/esm/components/funnel-layout/FunnelLayout.d.ts +1 -1
- package/dist/esm/components/funnel-layout/FunnelLayout.js +61 -110
- package/dist/esm/components/funnel-layout/parts/FunnelPage.js +8 -9
- package/dist/esm/components/funnel-layout/parts/FunnelPageActions.js +24 -24
- package/dist/esm/components/funnel-layout/parts/FunnelPageFooter.js +6 -7
- package/dist/esm/components/funnel-layout/parts/FunnelPageHeader.d.ts +2 -2
- package/dist/esm/components/funnel-layout/parts/FunnelSidebar.d.ts +2 -2
- package/dist/esm/components/funnel-layout/parts/FunnelSidebar.js +9 -10
- package/dist/esm/components/funnel-layout/parts/FunnelTopBar.js +0 -1
- package/dist/esm/components/input/Input.js +28 -28
- package/dist/esm/components/label/Label.js +19 -19
- package/dist/esm/components/multi-select/MultiSelect.js +94 -94
- package/dist/esm/components/multi-select/hooks/use-multiselection-state.js +32 -32
- package/dist/esm/components/multi-select/parts/MultiSelectButton.js +38 -38
- package/dist/esm/components/multi-select/parts/MultiSelectPopover.js +16 -16
- package/dist/esm/components/multi-select-field/MultiSelectField.d.ts +2 -2
- package/dist/esm/components/multi-select-field/MultiSelectField.js +53 -53
- package/dist/esm/components/nav/parts/NavGroup.js +21 -21
- package/dist/esm/components/number-field/NumberField.d.ts +3 -3
- package/dist/esm/components/number-input/NumberInput.js +58 -58
- package/dist/esm/components/pagination/Pagination.js +97 -101
- package/dist/esm/components/pagination/parts/PaginationJumpDialog.js +39 -40
- package/dist/esm/components/popover/parts/PopoverHeader.js +8 -8
- package/dist/esm/components/radio-button-group/parts/RadioButton.js +11 -11
- package/dist/esm/components/select-field/SelectField.d.ts +2 -2
- package/dist/esm/components/select-field/SelectField.js +4 -1
- package/dist/esm/components/selectable-button-group/SelectableButtonGroup.js +22 -23
- package/dist/esm/components/selectable-button-group-field/SelectableButtonGroupField.d.ts +2 -2
- package/dist/esm/components/side-panel/parts/SidePanelDragIndicator.js +30 -31
- package/dist/esm/components/skip-links/SkipLinks.js +50 -43
- package/dist/esm/components/table/Table.js +79 -76
- package/dist/esm/components/table/parts/TableBody.js +6 -6
- package/dist/esm/components/table/parts/TableCell.js +25 -25
- package/dist/esm/components/table/parts/TableColumnHeader.js +38 -38
- package/dist/esm/components/table/parts/TablePagination.js +61 -59
- package/dist/esm/components/table/parts/TableRow.js +16 -16
- package/dist/esm/components/tabs/parts/TabList.js +50 -54
- package/dist/esm/components/task-menu/parts/Content.js +24 -24
- package/dist/esm/components/task-menu/parts/Header.js +24 -24
- package/dist/esm/components/task-menu/parts/SubTask.js +74 -74
- package/dist/esm/components/task-menu/parts/Task.js +69 -69
- package/dist/esm/components/task-menu/parts/TaskGroup.js +45 -45
- package/dist/esm/components/text-area/TextArea.js +30 -31
- package/dist/esm/components/text-field/TextField.d.ts +2 -2
- package/dist/esm/components/toggle-switch-field/ToggleSwitchField.d.ts +2 -2
- package/dist/esm/components/toggle-switch-field/ToggleSwitchField.js +4 -1
- package/dist/esm/components/toggle-switch-group/ToggleSwitchGroup.js +74 -74
- package/dist/esm/components/toggle-switch-group-field/ToggleSwitchGroupField.d.ts +2 -2
- package/dist/esm/components/toggle-switch-group-field/ToggleSwitchGroupField.js +36 -32
- package/dist/esm/hooks/use-form.d.ts +5 -5
- package/dist/esm/hooks/use-form.types.d.ts +2 -2
- package/dist/esm/hooks/use-resizable.js +13 -14
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.js +22 -19
- package/dist/esm/types/schema.d.ts +8 -0
- package/dist/esm/utils/createSchemaAdapter.d.ts +7 -0
- package/dist/esm/utils/createSchemaAdapter.js +13 -0
- package/dist/esm/utils/platform.js +2 -3
- package/i18n/en-GB.json +16 -0
- package/i18n/es-ES.json +16 -0
- package/i18n/fr-FR.json +16 -0
- package/package.json +25 -19
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
import { jsx as n } from "react/jsx-runtime";
|
|
2
2
|
import { useContext as p } from "react";
|
|
3
3
|
import { OverlayTriggerStateContext as u } from "react-aria-components";
|
|
4
|
-
import { Button as
|
|
5
|
-
const
|
|
4
|
+
import { Button as i } from "../../../button/Button.js";
|
|
5
|
+
const x = ({
|
|
6
6
|
children: e,
|
|
7
|
-
variant:
|
|
7
|
+
variant: f,
|
|
8
8
|
onPress: r,
|
|
9
9
|
isLoading: c,
|
|
10
10
|
icon: o,
|
|
11
11
|
...a
|
|
12
12
|
}) => {
|
|
13
|
-
const
|
|
14
|
-
switch (
|
|
13
|
+
const s = p(u);
|
|
14
|
+
switch (f) {
|
|
15
15
|
case "close":
|
|
16
|
-
const
|
|
16
|
+
const m = r;
|
|
17
17
|
return /* @__PURE__ */ n(
|
|
18
|
-
|
|
18
|
+
i,
|
|
19
19
|
{
|
|
20
20
|
...a,
|
|
21
21
|
prefixIcon: o,
|
|
22
22
|
variant: "secondary",
|
|
23
23
|
onPress: (t) => {
|
|
24
|
-
|
|
24
|
+
m && m(t), s?.close();
|
|
25
25
|
},
|
|
26
26
|
children: e
|
|
27
27
|
}
|
|
28
28
|
);
|
|
29
29
|
case "confirm":
|
|
30
30
|
return /* @__PURE__ */ n(
|
|
31
|
-
|
|
31
|
+
i,
|
|
32
32
|
{
|
|
33
33
|
...a,
|
|
34
34
|
prefixIcon: o,
|
|
@@ -42,7 +42,7 @@ const l = ({
|
|
|
42
42
|
);
|
|
43
43
|
case "danger":
|
|
44
44
|
return /* @__PURE__ */ n(
|
|
45
|
-
|
|
45
|
+
i,
|
|
46
46
|
{
|
|
47
47
|
...a,
|
|
48
48
|
variant: "primary",
|
|
@@ -57,7 +57,7 @@ const l = ({
|
|
|
57
57
|
);
|
|
58
58
|
}
|
|
59
59
|
};
|
|
60
|
-
|
|
60
|
+
x.displayName = "DialogButton";
|
|
61
61
|
export {
|
|
62
|
-
|
|
62
|
+
x as DialogButton
|
|
63
63
|
};
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import { UnityIcon } from '@payfit/unity-icons';
|
|
2
|
+
import { UnityIllustrationAsset } from '@payfit/unity-illustrations';
|
|
3
|
+
import { ReactNode } from 'react';
|
|
4
|
+
export declare const errorState: import('tailwind-variants').TVReturnType<{
|
|
5
|
+
[key: string]: {
|
|
6
|
+
[key: string]: import('tailwind-merge').ClassNameValue | {
|
|
7
|
+
h1?: import('tailwind-merge').ClassNameValue;
|
|
8
|
+
h2?: import('tailwind-merge').ClassNameValue;
|
|
9
|
+
h3?: import('tailwind-merge').ClassNameValue;
|
|
10
|
+
h4?: import('tailwind-merge').ClassNameValue;
|
|
11
|
+
base?: import('tailwind-merge').ClassNameValue;
|
|
12
|
+
icon?: import('tailwind-merge').ClassNameValue;
|
|
13
|
+
description?: import('tailwind-merge').ClassNameValue;
|
|
14
|
+
illustration?: import('tailwind-merge').ClassNameValue;
|
|
15
|
+
informationContainer?: import('tailwind-merge').ClassNameValue;
|
|
16
|
+
information?: import('tailwind-merge').ClassNameValue;
|
|
17
|
+
informationComponent?: import('tailwind-merge').ClassNameValue;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
} | {
|
|
21
|
+
[x: string]: {
|
|
22
|
+
[x: string]: import('tailwind-merge').ClassNameValue | {
|
|
23
|
+
h1?: import('tailwind-merge').ClassNameValue;
|
|
24
|
+
h2?: import('tailwind-merge').ClassNameValue;
|
|
25
|
+
h3?: import('tailwind-merge').ClassNameValue;
|
|
26
|
+
h4?: import('tailwind-merge').ClassNameValue;
|
|
27
|
+
base?: import('tailwind-merge').ClassNameValue;
|
|
28
|
+
icon?: import('tailwind-merge').ClassNameValue;
|
|
29
|
+
description?: import('tailwind-merge').ClassNameValue;
|
|
30
|
+
illustration?: import('tailwind-merge').ClassNameValue;
|
|
31
|
+
informationContainer?: import('tailwind-merge').ClassNameValue;
|
|
32
|
+
information?: import('tailwind-merge').ClassNameValue;
|
|
33
|
+
informationComponent?: import('tailwind-merge').ClassNameValue;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
} | {}, {
|
|
37
|
+
base: string[];
|
|
38
|
+
illustration: string[];
|
|
39
|
+
icon: string[];
|
|
40
|
+
informationContainer: string[];
|
|
41
|
+
information: string[];
|
|
42
|
+
informationComponent: string[];
|
|
43
|
+
h1: string[];
|
|
44
|
+
h2: string[];
|
|
45
|
+
h3: string[];
|
|
46
|
+
h4: string[];
|
|
47
|
+
description: string[];
|
|
48
|
+
}, undefined, {
|
|
49
|
+
[key: string]: {
|
|
50
|
+
[key: string]: import('tailwind-merge').ClassNameValue | {
|
|
51
|
+
h1?: import('tailwind-merge').ClassNameValue;
|
|
52
|
+
h2?: import('tailwind-merge').ClassNameValue;
|
|
53
|
+
h3?: import('tailwind-merge').ClassNameValue;
|
|
54
|
+
h4?: import('tailwind-merge').ClassNameValue;
|
|
55
|
+
base?: import('tailwind-merge').ClassNameValue;
|
|
56
|
+
icon?: import('tailwind-merge').ClassNameValue;
|
|
57
|
+
description?: import('tailwind-merge').ClassNameValue;
|
|
58
|
+
illustration?: import('tailwind-merge').ClassNameValue;
|
|
59
|
+
informationContainer?: import('tailwind-merge').ClassNameValue;
|
|
60
|
+
information?: import('tailwind-merge').ClassNameValue;
|
|
61
|
+
informationComponent?: import('tailwind-merge').ClassNameValue;
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
} | {}, {
|
|
65
|
+
base: string[];
|
|
66
|
+
illustration: string[];
|
|
67
|
+
icon: string[];
|
|
68
|
+
informationContainer: string[];
|
|
69
|
+
information: string[];
|
|
70
|
+
informationComponent: string[];
|
|
71
|
+
h1: string[];
|
|
72
|
+
h2: string[];
|
|
73
|
+
h3: string[];
|
|
74
|
+
h4: string[];
|
|
75
|
+
description: string[];
|
|
76
|
+
}, import('tailwind-variants').TVReturnType<unknown, {
|
|
77
|
+
base: string[];
|
|
78
|
+
illustration: string[];
|
|
79
|
+
icon: string[];
|
|
80
|
+
informationContainer: string[];
|
|
81
|
+
information: string[];
|
|
82
|
+
informationComponent: string[];
|
|
83
|
+
h1: string[];
|
|
84
|
+
h2: string[];
|
|
85
|
+
h3: string[];
|
|
86
|
+
h4: string[];
|
|
87
|
+
description: string[];
|
|
88
|
+
}, undefined, unknown, unknown, undefined>>;
|
|
89
|
+
interface ErrorStateBaseProps {
|
|
90
|
+
/**
|
|
91
|
+
* Callback function triggered when the main action button is pressed.
|
|
92
|
+
*/
|
|
93
|
+
onButtonPress: () => void;
|
|
94
|
+
/**
|
|
95
|
+
* Custom label for the main action button. If not provided, uses default label from configuration.
|
|
96
|
+
* @default: Go to dashboard
|
|
97
|
+
*/
|
|
98
|
+
buttonLabel?: string;
|
|
99
|
+
/**
|
|
100
|
+
* Custom main title for the error state. If not provided, uses default title from configuration.
|
|
101
|
+
* @default: Something went wrong
|
|
102
|
+
*/
|
|
103
|
+
mainTitle?: ReactNode;
|
|
104
|
+
/**
|
|
105
|
+
* Custom main description for the error state. If not provided, uses default description from configuration.
|
|
106
|
+
*/
|
|
107
|
+
mainDescription?: ReactNode;
|
|
108
|
+
/**
|
|
109
|
+
* Custom main description specifically for component-level display. If not provided, uses default from configuration.
|
|
110
|
+
* @default: Please refresh the page or check your connection. We’ve been notified of the issue and are working to resolve it as quickly as possible.
|
|
111
|
+
*/
|
|
112
|
+
mainDescriptionComponent?: ReactNode;
|
|
113
|
+
/**
|
|
114
|
+
* Custom illustration to display. If not provided, uses default illustration from configuration.
|
|
115
|
+
* @default: Please refresh the page or try signing in again. We’ve been notified of the issue and are working to resolve it as quickly as possible.
|
|
116
|
+
*/
|
|
117
|
+
illustration?: UnityIllustrationAsset;
|
|
118
|
+
/**
|
|
119
|
+
* Custom icon to display. If not provided, uses default icon from configuration.
|
|
120
|
+
*/
|
|
121
|
+
icon?: UnityIcon;
|
|
122
|
+
/**
|
|
123
|
+
* ARIA role for the error state container.
|
|
124
|
+
* @default "status"
|
|
125
|
+
*/
|
|
126
|
+
role?: string;
|
|
127
|
+
}
|
|
128
|
+
interface KnownErrorStateProps extends ErrorStateBaseProps {
|
|
129
|
+
/**
|
|
130
|
+
* The error object containing the error message to display.
|
|
131
|
+
*/
|
|
132
|
+
error: Error;
|
|
133
|
+
/**
|
|
134
|
+
* Additional description text to display alongside the error details.
|
|
135
|
+
* @default: Here's the technical error detail. If the problem continues, you can send it to <Link>our customer support</Link> so we can help unblock you:
|
|
136
|
+
*/
|
|
137
|
+
detailDescription?: ReactNode;
|
|
138
|
+
/**
|
|
139
|
+
* Type identifier for known errors.
|
|
140
|
+
*/
|
|
141
|
+
type: 'generic';
|
|
142
|
+
}
|
|
143
|
+
interface UnknownErrorStateProps extends ErrorStateBaseProps {
|
|
144
|
+
/**
|
|
145
|
+
* Custom label for the back button. If not provided, uses default label from configuration.
|
|
146
|
+
* @default: Back to dashboard
|
|
147
|
+
*/
|
|
148
|
+
backButtonLabel?: ReactNode;
|
|
149
|
+
/**
|
|
150
|
+
* Must be undefined for unknown error states.
|
|
151
|
+
*/
|
|
152
|
+
error: undefined;
|
|
153
|
+
/**
|
|
154
|
+
* Type identifier for unknown errors.
|
|
155
|
+
*/
|
|
156
|
+
type: 'generic';
|
|
157
|
+
}
|
|
158
|
+
interface _404ErrorStateProps extends ErrorStateBaseProps {
|
|
159
|
+
/**
|
|
160
|
+
* Type identifier for 404 errors.
|
|
161
|
+
*/
|
|
162
|
+
type: '404';
|
|
163
|
+
/**
|
|
164
|
+
* No error object needed for 404 states.
|
|
165
|
+
*/
|
|
166
|
+
error: never;
|
|
167
|
+
}
|
|
168
|
+
export type ErrorStateProps = KnownErrorStateProps | UnknownErrorStateProps | _404ErrorStateProps;
|
|
169
|
+
/**
|
|
170
|
+
* The `ErrorState` component displays error information with contextual messaging and actions.
|
|
171
|
+
* It provides a consistent way to handle different types of errors (generic, 404) with appropriate visual feedback and user actions.
|
|
172
|
+
* The component adapts its layout based on container size and error type, supporting multiple breakpoints for optimal user experience.
|
|
173
|
+
* @param {ErrorStateProps} props - The props for the `ErrorState` component
|
|
174
|
+
* @see {@link ErrorStateProps} for all available props
|
|
175
|
+
* @example
|
|
176
|
+
* ```tsx
|
|
177
|
+
* import { ErrorState } from '@payfit/unity-components'
|
|
178
|
+
*
|
|
179
|
+
* function Example() {
|
|
180
|
+
* return (
|
|
181
|
+
* <ErrorState
|
|
182
|
+
* type="generic"
|
|
183
|
+
* error={new Error('Something went wrong')}
|
|
184
|
+
* onButtonPress={() => window.location.reload()}
|
|
185
|
+
* buttonLabel="Retry"
|
|
186
|
+
* mainTitle="Oops! Something went wrong"
|
|
187
|
+
* mainDescription="We encountered an unexpected error. Please try again."
|
|
188
|
+
* />
|
|
189
|
+
* )
|
|
190
|
+
* }
|
|
191
|
+
* ```
|
|
192
|
+
* @remarks
|
|
193
|
+
* [API](https://unity-components.payfit.io/?path=/docs/feedback-errorstate--docs) • [Design docs](https://www.payfit.design/)
|
|
194
|
+
*/
|
|
195
|
+
declare const ErrorState: import('react').ForwardRefExoticComponent<ErrorStateProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
196
|
+
export { ErrorState };
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { jsx as n, jsxs as c } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as q } from "react";
|
|
3
|
+
import { Illustration as A } from "@payfit/unity-illustrations";
|
|
4
|
+
import { useIntl as F } from "react-intl";
|
|
5
|
+
import { tv as G } from "tailwind-variants";
|
|
6
|
+
import { Button as y } from "../button/Button.js";
|
|
7
|
+
import { Code as H } from "../code/Code.js";
|
|
8
|
+
import { Icon as J } from "../icon/Icon.js";
|
|
9
|
+
import { Text as o } from "../text/Text.js";
|
|
10
|
+
import { initConfig as K } from "./initConfig.js";
|
|
11
|
+
import { Collapsible as O } from "./parts/Collapsible.js";
|
|
12
|
+
const Q = G({
|
|
13
|
+
slots: {
|
|
14
|
+
base: [
|
|
15
|
+
"uy:max-w-[704px] uy:flex uy:flex-col uy:items-center uy:justify-center uy:gap-250 uy:w-full uy:justify-self-center"
|
|
16
|
+
],
|
|
17
|
+
illustration: [
|
|
18
|
+
"uy:@section:block",
|
|
19
|
+
//common but start from section level
|
|
20
|
+
"uy:hidden",
|
|
21
|
+
//component
|
|
22
|
+
"",
|
|
23
|
+
// page
|
|
24
|
+
"uy:@section:w-[220px]",
|
|
25
|
+
//section
|
|
26
|
+
"uy:@app:w-[240px]"
|
|
27
|
+
//app
|
|
28
|
+
],
|
|
29
|
+
icon: [
|
|
30
|
+
"uy:bg-surface-neutral-lowest uy:rounded-125 uy:p-100",
|
|
31
|
+
//component
|
|
32
|
+
"uy:@section:hidden"
|
|
33
|
+
// others
|
|
34
|
+
],
|
|
35
|
+
informationContainer: [
|
|
36
|
+
"uy:flex uy:flex-col uy:items-center uy:justify-center uy:gap-150 uy:text-center uy"
|
|
37
|
+
],
|
|
38
|
+
information: [
|
|
39
|
+
"uy:hidden",
|
|
40
|
+
//component
|
|
41
|
+
"",
|
|
42
|
+
//page
|
|
43
|
+
"uy:@section:block"
|
|
44
|
+
//section
|
|
45
|
+
],
|
|
46
|
+
informationComponent: [
|
|
47
|
+
"uy:block",
|
|
48
|
+
//component
|
|
49
|
+
"uy:@section:hidden"
|
|
50
|
+
// others
|
|
51
|
+
],
|
|
52
|
+
h1: ["uy:hidden uy:@app:block"],
|
|
53
|
+
// only on app
|
|
54
|
+
h2: ["uy:hidden uy:@page:@max-app:block"],
|
|
55
|
+
// only on page
|
|
56
|
+
h3: ["uy:hidden uy:@section:@max-page:block"],
|
|
57
|
+
// only on section
|
|
58
|
+
h4: ["uy:block uy:@section:hidden"],
|
|
59
|
+
// only on component
|
|
60
|
+
description: ["uy:hidden uy:@section:block uy:@section:w-full"]
|
|
61
|
+
}
|
|
62
|
+
}), U = (t, i) => {
|
|
63
|
+
const r = t.detailDescription ?? i?.detailDescription;
|
|
64
|
+
return /* @__PURE__ */ c(O, { children: [
|
|
65
|
+
/* @__PURE__ */ n("div", { className: "uy:mb-200", children: r }),
|
|
66
|
+
/* @__PURE__ */ n(H, { children: t.error.message })
|
|
67
|
+
] });
|
|
68
|
+
}, V = (t, i) => {
|
|
69
|
+
const r = t.backButtonLabel ?? i?.backButtonLabel;
|
|
70
|
+
return /* @__PURE__ */ n("div", { className: "uy:mt-200", children: /* @__PURE__ */ n(
|
|
71
|
+
y,
|
|
72
|
+
{
|
|
73
|
+
onClick: () => {
|
|
74
|
+
window.history.go(-1);
|
|
75
|
+
},
|
|
76
|
+
color: "primary",
|
|
77
|
+
variant: "ghost",
|
|
78
|
+
children: r
|
|
79
|
+
}
|
|
80
|
+
) });
|
|
81
|
+
}, W = q((t, i) => {
|
|
82
|
+
const {
|
|
83
|
+
icon: r,
|
|
84
|
+
illustration: p,
|
|
85
|
+
onButtonPress: h,
|
|
86
|
+
buttonLabel: f,
|
|
87
|
+
mainTitle: b,
|
|
88
|
+
mainDescription: v,
|
|
89
|
+
mainDescriptionComponent: g,
|
|
90
|
+
type: u,
|
|
91
|
+
error: k,
|
|
92
|
+
role: x = "status"
|
|
93
|
+
} = t, {
|
|
94
|
+
base: w,
|
|
95
|
+
illustration: N,
|
|
96
|
+
icon: C,
|
|
97
|
+
informationContainer: D,
|
|
98
|
+
information: E,
|
|
99
|
+
informationComponent: B,
|
|
100
|
+
description: L,
|
|
101
|
+
h1: M,
|
|
102
|
+
h2: j,
|
|
103
|
+
h3: I,
|
|
104
|
+
h4: T
|
|
105
|
+
} = Q(), l = F(), S = K(l);
|
|
106
|
+
let a = u === "404" ? "404" : "unknown";
|
|
107
|
+
u === "generic" && k && (a = "known");
|
|
108
|
+
const e = S.get(a), m = p ?? e?.illustration, d = r ?? e?.icon, P = f ?? e?.buttonLabel, s = b ?? e?.mainTitle, z = v ?? e?.mainDescription, R = g ?? e?.mainDescriptionComponent;
|
|
109
|
+
return /* @__PURE__ */ n("div", { role: x, ref: i, className: "uy:@container uy:w-full", children: /* @__PURE__ */ c("div", { className: w(), children: [
|
|
110
|
+
m && /* @__PURE__ */ n(
|
|
111
|
+
A,
|
|
112
|
+
{
|
|
113
|
+
src: m,
|
|
114
|
+
variant: "picture",
|
|
115
|
+
alt: l.formatMessage({
|
|
116
|
+
id: "unity:component:error-state:common:illustration:alt",
|
|
117
|
+
defaultMessage: "Error states"
|
|
118
|
+
}),
|
|
119
|
+
className: N(),
|
|
120
|
+
isDecorative: !0
|
|
121
|
+
}
|
|
122
|
+
),
|
|
123
|
+
d && /* @__PURE__ */ n(
|
|
124
|
+
J,
|
|
125
|
+
{
|
|
126
|
+
src: d,
|
|
127
|
+
size: 24,
|
|
128
|
+
color: "content.neutral.low",
|
|
129
|
+
alt: l.formatMessage({
|
|
130
|
+
id: "unity:component:error-state:common:icon:alt",
|
|
131
|
+
defaultMessage: "Error states"
|
|
132
|
+
}),
|
|
133
|
+
className: C()
|
|
134
|
+
}
|
|
135
|
+
),
|
|
136
|
+
/* @__PURE__ */ c("div", { className: D(), children: [
|
|
137
|
+
/* @__PURE__ */ n(o, { asElement: "h1", variant: "h1", className: M(), children: s }),
|
|
138
|
+
/* @__PURE__ */ n(o, { asElement: "h2", variant: "h2", className: j(), children: s }),
|
|
139
|
+
/* @__PURE__ */ n(o, { asElement: "h3", variant: "h3", className: I(), children: s }),
|
|
140
|
+
/* @__PURE__ */ n(o, { asElement: "h4", variant: "h4", className: T(), children: s }),
|
|
141
|
+
/* @__PURE__ */ n(o, { asElement: "p", variant: "body", className: E(), children: z }),
|
|
142
|
+
/* @__PURE__ */ n(o, { asElement: "p", variant: "body", className: B(), children: R })
|
|
143
|
+
] }),
|
|
144
|
+
/* @__PURE__ */ n(y, { variant: "primary", onPress: h, children: P }),
|
|
145
|
+
a === "unknown" && V(t, e),
|
|
146
|
+
a === "known" && /* @__PURE__ */ n("div", { className: L(), children: U(t, e) })
|
|
147
|
+
] }) });
|
|
148
|
+
});
|
|
149
|
+
W.displayName = "ErrorState";
|
|
150
|
+
export {
|
|
151
|
+
W as ErrorState,
|
|
152
|
+
Q as errorState
|
|
153
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { UnityIcon } from '@payfit/unity-icons';
|
|
2
|
+
import { UnityIllustrationAsset } from '@payfit/unity-illustrations';
|
|
3
|
+
import { ReactNode } from 'react';
|
|
4
|
+
import { IntlShape } from 'react-intl';
|
|
5
|
+
export type ErrorStateVariant = 'known' | 'unknown' | '404';
|
|
6
|
+
export interface ErrorStateConfig {
|
|
7
|
+
illustration: UnityIllustrationAsset;
|
|
8
|
+
icon: UnityIcon;
|
|
9
|
+
mainTitle: ReactNode;
|
|
10
|
+
mainDescription: ReactNode;
|
|
11
|
+
mainDescriptionComponent?: ReactNode;
|
|
12
|
+
buttonLabel: ReactNode;
|
|
13
|
+
detailDescription?: ReactNode;
|
|
14
|
+
backButtonLabel?: ReactNode;
|
|
15
|
+
}
|
|
16
|
+
export declare const initConfig: (intl: IntlShape) => Map<ErrorStateVariant, ErrorStateConfig>;
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import t from "@payfit/unity-illustrations/assets/EmptyStateIncidentPanel";
|
|
3
|
+
import a from "@payfit/unity-illustrations/assets/EmptyStateResearch";
|
|
4
|
+
import { Link as n } from "../link/Link.js";
|
|
5
|
+
const c = (e) => /* @__PURE__ */ new Map([
|
|
6
|
+
[
|
|
7
|
+
"known",
|
|
8
|
+
{
|
|
9
|
+
illustration: t,
|
|
10
|
+
icon: "WarningCircleOutlined",
|
|
11
|
+
mainTitle: e.formatMessage(
|
|
12
|
+
{
|
|
13
|
+
id: "unity:component:error-state:common:main-title",
|
|
14
|
+
defaultMessage: "Something went wrong"
|
|
15
|
+
},
|
|
16
|
+
{ br: () => /* @__PURE__ */ r("br", {}) }
|
|
17
|
+
),
|
|
18
|
+
mainDescription: e.formatMessage(
|
|
19
|
+
{
|
|
20
|
+
id: "unity:component:error-state:known:main-description",
|
|
21
|
+
defaultMessage: "Please refresh the page or check your connection.<br></br>We’ve been notified of the issue and are working to resolve it as quickly as possible."
|
|
22
|
+
},
|
|
23
|
+
{ br: () => /* @__PURE__ */ r("br", {}) }
|
|
24
|
+
),
|
|
25
|
+
mainDescriptionComponent: e.formatMessage(
|
|
26
|
+
{
|
|
27
|
+
id: "unity:component:error-state:common:main-description-component",
|
|
28
|
+
defaultMessage: "Please refresh the page or try signing in again. We’ve been notified of the issue and are working to resolve it as quickly as possible."
|
|
29
|
+
},
|
|
30
|
+
{ br: () => /* @__PURE__ */ r("br", {}) }
|
|
31
|
+
),
|
|
32
|
+
buttonLabel: e.formatMessage(
|
|
33
|
+
{
|
|
34
|
+
id: "unity:component:error-state:button:label",
|
|
35
|
+
defaultMessage: "Go to dashboard"
|
|
36
|
+
},
|
|
37
|
+
{ br: () => /* @__PURE__ */ r("br", {}) }
|
|
38
|
+
),
|
|
39
|
+
detailDescription: e.formatMessage(
|
|
40
|
+
{
|
|
41
|
+
id: "unity:component:error-state:detail-description",
|
|
42
|
+
defaultMessage: "Here's the technical error detail.<br></br> <br></br>If the problem continues, you can send it to <Link>our customer support</Link> so we can help unblock you:"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
br: () => /* @__PURE__ */ r("br", {}),
|
|
46
|
+
Link: (o) => /* @__PURE__ */ r(
|
|
47
|
+
n,
|
|
48
|
+
{
|
|
49
|
+
variant: "inline",
|
|
50
|
+
isExternal: !0,
|
|
51
|
+
color: "primary",
|
|
52
|
+
href: e.formatMessage({
|
|
53
|
+
id: "unity:component:common:customer-support:url"
|
|
54
|
+
}),
|
|
55
|
+
children: o
|
|
56
|
+
}
|
|
57
|
+
)
|
|
58
|
+
}
|
|
59
|
+
)
|
|
60
|
+
}
|
|
61
|
+
],
|
|
62
|
+
[
|
|
63
|
+
"unknown",
|
|
64
|
+
{
|
|
65
|
+
illustration: t,
|
|
66
|
+
icon: "WarningCircleOutlined",
|
|
67
|
+
mainTitle: e.formatMessage(
|
|
68
|
+
{
|
|
69
|
+
id: "unity:component:error-state:common:main-title",
|
|
70
|
+
defaultMessage: "Something went wrong"
|
|
71
|
+
},
|
|
72
|
+
{ br: () => /* @__PURE__ */ r("br", {}) }
|
|
73
|
+
),
|
|
74
|
+
mainDescription: e.formatMessage(
|
|
75
|
+
{
|
|
76
|
+
id: "unity:component:error-state:unknown:main-description",
|
|
77
|
+
defaultMessage: "Please refresh the page or try signing in again.<br></br>We’ve been notified of the issue and are working to resolve it as quickly as possible.<br></br>If the problem continues, please contact <Link>our customer support</Link>."
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
br: () => /* @__PURE__ */ r("br", {}),
|
|
81
|
+
Link: (o) => /* @__PURE__ */ r(
|
|
82
|
+
n,
|
|
83
|
+
{
|
|
84
|
+
variant: "inline",
|
|
85
|
+
isExternal: !0,
|
|
86
|
+
color: "primary",
|
|
87
|
+
href: e.formatMessage({
|
|
88
|
+
id: "unity:component:common:customer-support:url"
|
|
89
|
+
}),
|
|
90
|
+
children: o
|
|
91
|
+
}
|
|
92
|
+
)
|
|
93
|
+
}
|
|
94
|
+
),
|
|
95
|
+
mainDescriptionComponent: e.formatMessage(
|
|
96
|
+
{
|
|
97
|
+
id: "unity:component:error-state:common:main-description-component",
|
|
98
|
+
defaultMessage: "Please refresh the page or try signing in again. We’ve been notified of the issue and are working to resolve it as quickly as possible."
|
|
99
|
+
},
|
|
100
|
+
{ br: () => /* @__PURE__ */ r("br", {}) }
|
|
101
|
+
),
|
|
102
|
+
buttonLabel: e.formatMessage(
|
|
103
|
+
{
|
|
104
|
+
id: "unity:component:error-state:button:label",
|
|
105
|
+
defaultMessage: "Go to dashboard"
|
|
106
|
+
},
|
|
107
|
+
{ br: () => /* @__PURE__ */ r("br", {}) }
|
|
108
|
+
),
|
|
109
|
+
backButtonLabel: e.formatMessage(
|
|
110
|
+
{
|
|
111
|
+
id: "unity:component:error-state:unknown:back-link:label",
|
|
112
|
+
defaultMessage: "Back to dashboard"
|
|
113
|
+
},
|
|
114
|
+
{ br: () => /* @__PURE__ */ r("br", {}) }
|
|
115
|
+
)
|
|
116
|
+
}
|
|
117
|
+
],
|
|
118
|
+
[
|
|
119
|
+
"404",
|
|
120
|
+
{
|
|
121
|
+
illustration: a,
|
|
122
|
+
icon: "WarningCircleOutlined",
|
|
123
|
+
mainTitle: e.formatMessage(
|
|
124
|
+
{
|
|
125
|
+
id: "unity:component:error-state:404:main-title",
|
|
126
|
+
defaultMessage: "Sorry, we couldn’t find what you’re looking for"
|
|
127
|
+
},
|
|
128
|
+
{ br: () => /* @__PURE__ */ r("br", {}) }
|
|
129
|
+
),
|
|
130
|
+
mainDescription: e.formatMessage(
|
|
131
|
+
{
|
|
132
|
+
id: "unity:component:error-state:404:main-description",
|
|
133
|
+
defaultMessage: "This item may have been moved or deleted.<br></br>You can try searching for it manually or start again from your dashboard."
|
|
134
|
+
},
|
|
135
|
+
{ br: () => /* @__PURE__ */ r("br", {}) }
|
|
136
|
+
),
|
|
137
|
+
buttonLabel: e.formatMessage(
|
|
138
|
+
{
|
|
139
|
+
id: "unity:component:error-state:button:label",
|
|
140
|
+
defaultMessage: "Go to dashboard"
|
|
141
|
+
},
|
|
142
|
+
{ br: () => /* @__PURE__ */ r("br", {}) }
|
|
143
|
+
)
|
|
144
|
+
}
|
|
145
|
+
]
|
|
146
|
+
]);
|
|
147
|
+
export {
|
|
148
|
+
c as initConfig
|
|
149
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { PropsWithChildren, ReactNode } from 'react';
|
|
2
|
+
import { VariantProps } from 'tailwind-variants';
|
|
3
|
+
declare const collapsible: import('tailwind-variants').TVReturnType<{
|
|
4
|
+
isExpanded: {
|
|
5
|
+
true: {
|
|
6
|
+
icon: string;
|
|
7
|
+
};
|
|
8
|
+
false: {
|
|
9
|
+
icon: string;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
}, {
|
|
13
|
+
base: string[];
|
|
14
|
+
heading: string;
|
|
15
|
+
button: string[];
|
|
16
|
+
title: string;
|
|
17
|
+
icon: string;
|
|
18
|
+
content: string;
|
|
19
|
+
}, undefined, {
|
|
20
|
+
isExpanded: {
|
|
21
|
+
true: {
|
|
22
|
+
icon: string;
|
|
23
|
+
};
|
|
24
|
+
false: {
|
|
25
|
+
icon: string;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
}, {
|
|
29
|
+
base: string[];
|
|
30
|
+
heading: string;
|
|
31
|
+
button: string[];
|
|
32
|
+
title: string;
|
|
33
|
+
icon: string;
|
|
34
|
+
content: string;
|
|
35
|
+
}, import('tailwind-variants').TVReturnType<{
|
|
36
|
+
isExpanded: {
|
|
37
|
+
true: {
|
|
38
|
+
icon: string;
|
|
39
|
+
};
|
|
40
|
+
false: {
|
|
41
|
+
icon: string;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
}, {
|
|
45
|
+
base: string[];
|
|
46
|
+
heading: string;
|
|
47
|
+
button: string[];
|
|
48
|
+
title: string;
|
|
49
|
+
icon: string;
|
|
50
|
+
content: string;
|
|
51
|
+
}, undefined, unknown, unknown, undefined>>;
|
|
52
|
+
export interface CollapsibleProps extends PropsWithChildren<VariantProps<typeof collapsible>> {
|
|
53
|
+
children: ReactNode;
|
|
54
|
+
}
|
|
55
|
+
declare const Collapsible: {
|
|
56
|
+
({ children, ...props }: CollapsibleProps): import("react/jsx-runtime").JSX.Element;
|
|
57
|
+
displayName: string;
|
|
58
|
+
};
|
|
59
|
+
export { Collapsible };
|