@payfit/unity-components 3.1.17 → 3.1.19

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.
@@ -165,6 +165,10 @@ interface UnknownErrorStateProps extends ErrorStateBaseProps {
165
165
  * @default: Back to dashboard
166
166
  */
167
167
  backButtonLabel?: ReactNode;
168
+ /**
169
+ * Callback function triggered when the back button is pressed.
170
+ */
171
+ onBackButtonPress?: () => void;
168
172
  /**
169
173
  * Must be undefined for unknown error states.
170
174
  */
@@ -44,18 +44,19 @@ var h = m({ slots: {
44
44
  } }), g = (e, t) => /* @__PURE__ */ d(o, { children: [/* @__PURE__ */ u("div", {
45
45
  className: "uy:mb-200",
46
46
  children: e.detailDescription ?? t?.detailDescription
47
- }), /* @__PURE__ */ u(i, { children: e.error.message })] }), _ = (e, n) => /* @__PURE__ */ u("div", {
48
- className: "uy:mt-200 uy:@section:block uy:hidden",
49
- children: /* @__PURE__ */ u(t, {
50
- onClick: () => {
51
- window.history.go(-1);
52
- },
53
- color: "primary",
54
- variant: "ghost",
55
- children: e.backButtonLabel ?? n?.backButtonLabel
56
- })
57
- }), v = (e, t) => e === "generic" ? t ? "known" : "unknown" : e, y = s((i, o) => {
58
- let { icon: s, illustration: m, onButtonPress: y, buttonLabel: b, mainTitle: x, mainDescription: S, mainDescriptionComponent: C, type: w, error: T, entityName: E, role: D = "status" } = i, { base: O, content: k, container: A, wrapper: j, illustration: M, icon: N, informationContainer: P, information: F, informationComponent: ee, description: I, h1: L, h2: R, h3: z, h4: B } = h(), V = f(), H = a(V, { noPermissionEntityName: E }), U = l(null), { level: W } = r({ ref: U }), G = c((e) => {
47
+ }), /* @__PURE__ */ u(i, { children: e.error.message })] }), _ = (e, n) => {
48
+ let r = e.backButtonLabel ?? n?.backButtonLabel;
49
+ return /* @__PURE__ */ u("div", {
50
+ className: "uy:mt-200 uy:@section:block uy:hidden",
51
+ children: /* @__PURE__ */ u(t, {
52
+ onPress: e.onBackButtonPress ?? n?.onBackButtonPress,
53
+ color: "primary",
54
+ variant: "ghost",
55
+ children: r
56
+ })
57
+ });
58
+ }, v = (e, t) => e === "generic" ? t ? "known" : "unknown" : e, y = s((i, o) => {
59
+ let { icon: s, illustration: m, onButtonPress: y, buttonLabel: b, mainTitle: x, mainDescription: S, mainDescriptionComponent: C, type: w, error: T, entityName: E, role: D = "status" } = i, { base: O, content: k, container: A, wrapper: j, illustration: M, icon: N, informationContainer: P, information: F, informationComponent: I, description: ee, h1: L, h2: R, h3: z, h4: B } = h(), V = f(), H = a(V, { noPermissionEntityName: E }), U = l(null), { level: W } = r({ ref: U }), G = c((e) => {
59
60
  U.current = e, o && (typeof o == "function" ? o(e) : o.current = e);
60
61
  }, [o]), K = v(w, T), q = H.get(K), J = m ?? q?.illustration, Y = s ?? q?.icon, X = b ?? q?.buttonLabel, Z = x ?? q?.mainTitle, Q = S ?? q?.mainDescription, $ = C ?? q?.mainDescriptionComponent;
61
62
  return /* @__PURE__ */ u("div", {
@@ -134,7 +135,7 @@ var h = m({ slots: {
134
135
  asElement: "p",
135
136
  variant: "body",
136
137
  color: "content.neutral.low",
137
- className: ee(),
138
+ className: I(),
138
139
  children: $
139
140
  })
140
141
  ]
@@ -148,7 +149,7 @@ var h = m({ slots: {
148
149
  }),
149
150
  K === "unknown" && _(i, q),
150
151
  K === "known" && /* @__PURE__ */ u("div", {
151
- className: I(),
152
+ className: ee(),
152
153
  children: g(i, q)
153
154
  })
154
155
  ]
@@ -12,5 +12,6 @@ export interface ErrorStateConfig {
12
12
  buttonLabel: ReactNode;
13
13
  detailDescription?: ReactNode;
14
14
  backButtonLabel?: ReactNode;
15
+ onBackButtonPress?: () => void;
15
16
  }
16
17
  export declare const initConfig: (intl: IntlShape, values?: Parameters<IntlShape["formatMessage"]>[1]) => Map<ErrorStateVariant, ErrorStateConfig>;
@@ -69,7 +69,10 @@ var a = (a, o) => /* @__PURE__ */ new Map([
69
69
  backButtonLabel: a.formatMessage({
70
70
  id: "unity:component:error-state:unknown:back-link:label",
71
71
  defaultMessage: "Back to dashboard"
72
- }, { br: () => /* @__PURE__ */ t("br", {}) })
72
+ }, { br: () => /* @__PURE__ */ t("br", {}) }),
73
+ onBackButtonPress: () => {
74
+ window.history.go(-1);
75
+ }
73
76
  }],
74
77
  ["404", {
75
78
  illustration: r,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payfit/unity-components",
3
- "version": "3.1.17",
3
+ "version": "3.1.19",
4
4
  "module": "./dist/esm/index.js",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -103,7 +103,7 @@
103
103
  "@formatjs/intl": "4.1.12",
104
104
  "@internationalized/date": "3.12.4",
105
105
  "minimatch": "10.2.5",
106
- "@payfit/unity-illustrations": "3.1.17",
106
+ "@payfit/unity-illustrations": "3.1.19",
107
107
  "@radix-ui/react-avatar": "1.2.6",
108
108
  "@radix-ui/react-slot": "1.3.3",
109
109
  "@react-aria/interactions": "3.28.1",
@@ -133,8 +133,8 @@
133
133
  },
134
134
  "peerDependencies": {
135
135
  "@hookform/devtools": "4.4.0",
136
- "@payfit/unity-icons": "3.1.17",
137
- "@payfit/unity-themes": "3.1.17",
136
+ "@payfit/unity-icons": "3.1.19",
137
+ "@payfit/unity-themes": "3.1.19",
138
138
  "@storybook/react-vite": "^10",
139
139
  "@tanstack/react-query": "^5",
140
140
  "@tanstack/form-core": "1.33.5",
@@ -157,9 +157,9 @@
157
157
  "@payfit/storybook-addon-console-errors": "0.0.0-use.local",
158
158
  "@payfit/storybook-addon-datadog-rum": "0.0.0-use.local",
159
159
  "@payfit/storybook-config": "0.0.0-use.local",
160
- "@payfit/unity-icons": "3.1.17",
161
- "@payfit/unity-illustrations": "3.1.17",
162
- "@payfit/unity-themes": "3.1.17",
160
+ "@payfit/unity-icons": "3.1.19",
161
+ "@payfit/unity-illustrations": "3.1.19",
162
+ "@payfit/unity-themes": "3.1.19",
163
163
  "@payfit/vite-configs": "0.0.0-use.local",
164
164
  "@storybook/addon-a11y": "10.6.0",
165
165
  "@storybook/addon-designs": "11.1.4",