@payfit/unity-components 3.29.37 → 3.29.39

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/README.md CHANGED
@@ -42,5 +42,6 @@ Add an emoji below:
42
42
  - 🤸
43
43
  - ✏️
44
44
  - 🪴
45
+ - 🛟
45
46
 
46
47
  In some cases, the library is not published properly, which fails publish for payslip-template.
@@ -2,9 +2,10 @@ import { CircularIconButton as e } from "../../icon-button/CircularIconButton.js
2
2
  import { forwardRef as t } from "react";
3
3
  import { uyTv as n } from "@payfit/unity-themes";
4
4
  import { jsx as r, jsxs as i } from "react/jsx-runtime";
5
- import { Heading as a } from "react-aria-components/Heading";
5
+ import { useIntl as a } from "react-intl";
6
+ import { Heading as o } from "react-aria-components/Heading";
6
7
  //#region src/core/components/bottom-sheet/parts/BottomSheetHeader.tsx
7
- var o = n({ slots: {
8
+ var s = n({ slots: {
8
9
  base: [
9
10
  "uy:py-200 uy:px-300 uy:w-full",
10
11
  "uy:flex uy:flex-col uy:shrink-0",
@@ -14,28 +15,28 @@ var o = n({ slots: {
14
15
  content: ["uy:flex uy:items-center uy:w-full"],
15
16
  heading: ["uy:typography-h3 uy:text-center uy:text-content-neutral uy:truncate", "uy:flex-1 uy:min-w-0"],
16
17
  buttonContainer: ["uy:flex-shrink-0 uy:flex-grow-0 uy:w-[28px]"]
17
- } }), s = t(({ children: t, ...n }, s) => {
18
- let { base: c, content: l, heading: u, buttonContainer: d } = o();
18
+ } }), c = t(({ children: t, ...n }, c) => {
19
+ let { base: l, content: u, heading: d, buttonContainer: f } = s(), p = a();
19
20
  return /* @__PURE__ */ r("header", {
20
- ref: s,
21
- className: c(),
21
+ ref: c,
22
+ className: l(),
22
23
  ...n,
23
24
  children: /* @__PURE__ */ i("div", {
24
- className: l(),
25
+ className: u(),
25
26
  children: [
26
- /* @__PURE__ */ r("div", { className: d() }),
27
- /* @__PURE__ */ r(a, {
27
+ /* @__PURE__ */ r("div", { className: f() }),
28
+ /* @__PURE__ */ r(o, {
28
29
  slot: "title",
29
- className: u(),
30
+ className: d(),
30
31
  children: t
31
32
  }),
32
33
  /* @__PURE__ */ r("div", {
33
- className: d(),
34
+ className: f(),
34
35
  children: /* @__PURE__ */ r(e, {
35
36
  asElement: "button",
36
37
  slot: "close",
37
38
  icon: "CloseOutlined",
38
- title: "Close",
39
+ title: p.formatMessage({ id: "unity:component:common:close:label" }),
39
40
  size: "large",
40
41
  color: "content.neutral.low"
41
42
  })
@@ -44,6 +45,6 @@ var o = n({ slots: {
44
45
  })
45
46
  });
46
47
  });
47
- s.displayName = "BottomSheetHeader";
48
+ c.displayName = "BottomSheetHeader";
48
49
  //#endregion
49
- export { s as BottomSheetHeader, o as bottomSheetHeader };
50
+ export { c as BottomSheetHeader, s as bottomSheetHeader };
@@ -0,0 +1,30 @@
1
+ import { IntlShape } from 'react-intl';
2
+ import { PlayCtx } from '../../types/testing.js';
3
+ /**
4
+ * Factory function returning a set of helpers to test Unity BottomSheet components.
5
+ * It wires Storybook's `Play` context with convenient utilities to query,
6
+ * assert, and interact with bottom sheets rendered on the canvas.
7
+ * @param context The Storybook play context used to group steps and actions.
8
+ * @param globalIntl The global intl instance to use for localization.
9
+ * @returns An object of helpers: `findBottomSheet`, `closeBottomSheet`, `assertBottomSheetIsClosed`, `assertElementExistsInBottomSheet`, and `triggerBottomSheetAction`.
10
+ */
11
+ export declare const getTestingUtilsBottomSheet: (context: PlayCtx, globalIntl: IntlShape) => {
12
+ findBottomSheet: ({ title }: {
13
+ title: string;
14
+ }) => Promise<HTMLElement>;
15
+ closeBottomSheetWithDismissButton: ({ title, dismissButtonLabel, }: {
16
+ title: string;
17
+ dismissButtonLabel?: string;
18
+ }) => Promise<void>;
19
+ assertBottomSheetIsClosed: (bottomSheet: HTMLElement) => Promise<void>;
20
+ assertElementExistsInBottomSheet: ({ title, content, primaryActionLabel, secondaryActionLabel, }: {
21
+ title: string;
22
+ content?: string;
23
+ primaryActionLabel?: string;
24
+ secondaryActionLabel?: string;
25
+ }) => Promise<void>;
26
+ triggerFooterButtonAction: ({ title, buttonLabel, }: {
27
+ title: string;
28
+ buttonLabel: string;
29
+ }) => Promise<void>;
30
+ };
@@ -0,0 +1,41 @@
1
+ import { expect as e, screen as t, userEvent as n, waitFor as r, within as i } from "storybook/test";
2
+ //#region src/core/components/bottom-sheet/test-utils.ts
3
+ var a = (a, o) => {
4
+ let s = async ({ title: e }) => await r(() => {
5
+ let n = t.queryByRole("dialog", { name: e });
6
+ if (!n) throw Error(`BottomSheet with title: "${e}" not found in the page`);
7
+ return n;
8
+ });
9
+ return {
10
+ findBottomSheet: s,
11
+ closeBottomSheetWithDismissButton: async ({ title: e, dismissButtonLabel: t = o.formatMessage({ id: "unity:component:common:close:label" }) }) => {
12
+ console.log({ dismissButtonLabel: t }), await a.step("Close BottomSheet", async () => {
13
+ let r = await s({ title: e });
14
+ await n.click(i(r).getByRole("button", { name: t }), { delay: 100 });
15
+ });
16
+ },
17
+ assertBottomSheetIsClosed: async (t) => {
18
+ await r(async () => {
19
+ await e(t).not.toBeInTheDocument();
20
+ }, { timeout: 1e3 });
21
+ },
22
+ assertElementExistsInBottomSheet: async ({ title: t, content: n, primaryActionLabel: r, secondaryActionLabel: o }) => {
23
+ let c = await s({ title: t });
24
+ n && await a.step(`Check if "${n}" is in the BottomSheet`, async () => {
25
+ await e(i(c).getByText(n)).toBeInTheDocument();
26
+ }), r && await a.step(`Check if "${r}" is in the BottomSheet`, async () => {
27
+ await e(i(c).getByRole("button", { name: r })).toBeInTheDocument();
28
+ }), o && await a.step(`Check if "${o}" is in the BottomSheet`, async () => {
29
+ await e(i(c).getByRole("button", { name: o })).toBeInTheDocument();
30
+ });
31
+ },
32
+ triggerFooterButtonAction: async ({ title: e, buttonLabel: t }) => {
33
+ let r = await s({ title: e });
34
+ await a.step(`Trigger the button "${t}" of the BottomSheet`, async () => {
35
+ await n.click(i(r).getByRole("button", { name: t }));
36
+ });
37
+ }
38
+ };
39
+ };
40
+ //#endregion
41
+ export { a as getTestingUtilsBottomSheet };
@@ -4,3 +4,4 @@ export { getTestingUtilsMultiSelect } from './core/components/multi-select-field
4
4
  export { getTestingUtilsSelect } from './core/components/select-field/test-utils.js';
5
5
  export { getTestingUtilsToast } from './core/components/toast/test-utils.js';
6
6
  export { getTestingUtilsDialog } from './core/components/dialog/test-utils.js';
7
+ export { getTestingUtilsBottomSheet } from './core/components/bottom-sheet/test-utils.js';
@@ -4,4 +4,5 @@ import { getTestingUtilsMultiSelect as n } from "./core/components/multi-select-
4
4
  import { getTestingUtilsSelect as r } from "./core/components/select-field/test-utils.js";
5
5
  import { getTestingUtilsToast as i } from "./core/components/toast/test-utils.js";
6
6
  import { getTestingUtilsDialog as a } from "./core/components/dialog/test-utils.js";
7
- export { e as getTestingUtilsDatePicker, t as getTestingUtilsDateRangePicker, a as getTestingUtilsDialog, n as getTestingUtilsMultiSelect, r as getTestingUtilsSelect, i as getTestingUtilsToast };
7
+ import { getTestingUtilsBottomSheet as o } from "./core/components/bottom-sheet/test-utils.js";
8
+ export { o as getTestingUtilsBottomSheet, e as getTestingUtilsDatePicker, t as getTestingUtilsDateRangePicker, a as getTestingUtilsDialog, n as getTestingUtilsMultiSelect, r as getTestingUtilsSelect, i as getTestingUtilsToast };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payfit/unity-components",
3
- "version": "3.29.37",
3
+ "version": "3.29.39",
4
4
  "keywords": [
5
5
  "tanstack-intent"
6
6
  ],
@@ -97,7 +97,7 @@
97
97
  "dependencies": {
98
98
  "@formatjs/intl": "4.1.12",
99
99
  "@internationalized/date": "3.12.4",
100
- "@payfit/unity-illustrations": "3.29.37",
100
+ "@payfit/unity-illustrations": "3.29.39",
101
101
  "@radix-ui/react-avatar": "1.3.1",
102
102
  "@radix-ui/react-slot": "1.5.0",
103
103
  "@react-aria/interactions": "3.28.1",
@@ -136,8 +136,8 @@
136
136
  "@payfit/storybook-addon-console-errors": "0.0.0-use.local",
137
137
  "@payfit/storybook-addon-datadog-rum": "0.0.0-use.local",
138
138
  "@payfit/storybook-config": "0.0.0-use.local",
139
- "@payfit/unity-icons": "3.29.37",
140
- "@payfit/unity-themes": "3.29.37",
139
+ "@payfit/unity-icons": "3.29.39",
140
+ "@payfit/unity-themes": "3.29.39",
141
141
  "@payfit/vite-configs": "0.0.0-use.local",
142
142
  "@storybook/addon-a11y": "10.6.1",
143
143
  "@storybook/addon-designs": "12.0.0",
@@ -174,8 +174,8 @@
174
174
  "vitest": "5.1.1"
175
175
  },
176
176
  "peerDependencies": {
177
- "@payfit/unity-icons": "3.29.37",
178
- "@payfit/unity-themes": "3.29.37",
177
+ "@payfit/unity-icons": "3.29.39",
178
+ "@payfit/unity-themes": "3.29.39",
179
179
  "@storybook/react-vite": "^10",
180
180
  "@tanstack/form-core": "1.33.5",
181
181
  "@tanstack/react-form": "1.33.5",