@payfit/unity-components 2.17.12 → 2.18.1

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,69 +1,5 @@
1
- import { VariantProps } from '@payfit/unity-themes';
2
1
  import { PropsWithChildren } from 'react';
3
- declare const alert: import('tailwind-variants').TVReturnType<{
4
- variant: {
5
- info: {
6
- base: string;
7
- };
8
- warning: {
9
- base: string;
10
- };
11
- success: {
12
- base: string;
13
- };
14
- danger: {
15
- base: string;
16
- };
17
- };
18
- }, {
19
- base: string;
20
- content: string;
21
- icon: string;
22
- }, undefined, {
23
- variant: {
24
- info: {
25
- base: string;
26
- };
27
- warning: {
28
- base: string;
29
- };
30
- success: {
31
- base: string;
32
- };
33
- danger: {
34
- base: string;
35
- };
36
- };
37
- }, {
38
- base: string;
39
- content: string;
40
- icon: string;
41
- }, import('tailwind-variants').TVReturnType<{
42
- variant: {
43
- info: {
44
- base: string;
45
- };
46
- warning: {
47
- base: string;
48
- };
49
- success: {
50
- base: string;
51
- };
52
- danger: {
53
- base: string;
54
- };
55
- };
56
- }, {
57
- base: string;
58
- content: string;
59
- icon: string;
60
- }, undefined, unknown, unknown, undefined>>;
61
- type BaseAlertProps = PropsWithChildren<{
62
- /**
63
- * The alert's variant, which determines its visual style.
64
- */
65
- variant: NonNullable<VariantProps<typeof alert>['variant']>;
66
- }>;
2
+ type BaseAlertProps = PropsWithChildren;
67
3
  type DismissableConfig = {
68
4
  /**
69
5
  * Whether the alert is dismissable by the user, and should render a close button.
@@ -87,9 +23,33 @@ type DismissableConfig = {
87
23
  */
88
24
  dismissButtonLabel: string;
89
25
  };
90
- export type AlertProps = BaseAlertProps & DismissableConfig;
26
+ type VariantConfig = {
27
+ /**
28
+ * The alert's variant, which determines its visual style.
29
+ * Each variant has a fixed icon:
30
+ * - info: InfoFilled
31
+ * - warning: WarningFilled
32
+ * - success: CheckCircleFilled
33
+ * - danger: WarningCircleFilled
34
+ * - insight: LightbulbFilamentFilled
35
+ */
36
+ variant?: 'info' | 'warning' | 'success' | 'danger' | 'insight';
37
+ };
38
+ export type AlertProps = BaseAlertProps & DismissableConfig & VariantConfig;
91
39
  /**
92
- * Alerts display brief messages for the user without interrupting their use of the app. They can provide feedback, confirmations, warnings, or errors.
40
+ * Alerts display brief messages for the user without interrupting their use of the app.
41
+ * They can provide feedback, confirmations, warnings, errors, or educational insights.
42
+ * @example
43
+ * <Alert variant="info">
44
+ * <AlertTitle>Information</AlertTitle>
45
+ * <AlertContent>This is an informational message.</AlertContent>
46
+ * </Alert>
47
+ * @example
48
+ * // Insight variant for tips and guidance
49
+ * <Alert variant="insight">
50
+ * <AlertTitle>Pro Tip</AlertTitle>
51
+ * <AlertContent>Use keyboard shortcuts to navigate faster.</AlertContent>
52
+ * </Alert>
93
53
  */
94
54
  declare const Alert: import('react').ForwardRefExoticComponent<AlertProps & import('react').RefAttributes<HTMLDivElement>>;
95
55
  export { Alert };
@@ -1,9 +1,9 @@
1
- import { jsxs as n, jsx as r } from "react/jsx-runtime";
2
- import { forwardRef as b } from "react";
3
- import { uyTv as g } from "@payfit/unity-themes";
1
+ import { jsxs as s, jsx as t } from "react/jsx-runtime";
2
+ import { forwardRef as g } from "react";
3
+ import { uyTv as b } from "@payfit/unity-themes";
4
4
  import { CircularIconButton as a } from "../icon-button/CircularIconButton.js";
5
- import { Icon as p } from "../icon/Icon.js";
6
- const w = g({
5
+ import { Icon as w } from "../icon/Icon.js";
6
+ const p = b({
7
7
  slots: {
8
8
  base: "uy:p-200 uy:flex uy:flex-col uy:sm:flex-row uy:gap-100 uy:sm:gap-200 uy:border uy:border-solid uy:rounded-150 uy:sm:rounded-100",
9
9
  content: "uy:flex uy:flex-col uy:flex-1 uy:[&>header:has(+*:not(footer))]:mb-100 uy:[&>*+footer]:mt-200 uy:[&>*:first-child:not(header)]:sm:pt-50",
@@ -12,16 +12,24 @@ const w = g({
12
12
  variants: {
13
13
  variant: {
14
14
  info: {
15
- base: "uy:bg-surface-info-lowest uy:border-border-info-lowest"
15
+ base: "uy:bg-surface-info-lowest uy:border-border-info-lowest",
16
+ icon: "uy:text-content-info"
16
17
  },
17
18
  warning: {
18
- base: "uy:bg-surface-warning-lowest uy:border-border-warning-lowest"
19
+ base: "uy:bg-surface-warning-lowest uy:border-border-warning-lowest",
20
+ icon: "uy:text-content-warning"
19
21
  },
20
22
  success: {
21
- base: "uy:bg-surface-success-lowest uy:border-border-success-lowest"
23
+ base: "uy:bg-surface-success-lowest uy:border-border-success-lowest",
24
+ icon: "uy:text-content-success"
22
25
  },
23
26
  danger: {
24
- base: "uy:bg-surface-danger-lowest uy:border-border-danger-lowest"
27
+ base: "uy:bg-surface-danger-lowest uy:border-border-danger-lowest",
28
+ icon: "uy:text-content-danger"
29
+ },
30
+ insight: {
31
+ base: "uy:bg-surface-neutral-lowest uy:border-surface-neutral-lowest",
32
+ icon: "uy:text-content-neutral-lowest"
25
33
  }
26
34
  }
27
35
  },
@@ -29,53 +37,54 @@ const w = g({
29
37
  variant: "info"
30
38
  }
31
39
  }), x = {
32
- info: { src: "InfoFilled", color: "content.info" },
33
- warning: { src: "WarningFilled", color: "content.warning" },
34
- success: { src: "CheckCircleFilled", color: "content.success" },
35
- danger: { src: "WarningCircleFilled", color: "content.danger" }
36
- }, h = b(
40
+ info: "InfoFilled",
41
+ warning: "WarningFilled",
42
+ success: "CheckCircleFilled",
43
+ danger: "WarningCircleFilled",
44
+ insight: "LightbulbFilamentFilled"
45
+ }, h = g(
37
46
  ({
38
- children: c,
39
- variant: e,
40
- isDismissable: o,
41
- onDismiss: s,
42
- dismissButtonLabel: t,
43
- ...l
44
- }, i) => {
45
- const { base: u, content: d, icon: y } = w({ variant: e }), f = x[e], m = {
47
+ children: l,
48
+ variant: e = "info",
49
+ isDismissable: o = !1,
50
+ onDismiss: n,
51
+ dismissButtonLabel: r,
52
+ ...i
53
+ }, u) => {
54
+ const { base: c, content: d, icon: y } = p({ variant: e }), f = x[e], m = {
46
55
  role: e === "danger" ? "alert" : "status",
47
56
  "aria-live": e === "danger" ? "assertive" : "polite",
48
57
  "aria-atomic": !0,
49
58
  "aria-relevant": "additions removals"
50
59
  };
51
- return /* @__PURE__ */ n(
60
+ return /* @__PURE__ */ s(
52
61
  "div",
53
62
  {
63
+ ...i,
54
64
  "data-dd-privacy": "mask",
55
- ref: i,
56
- className: u(),
65
+ ref: u,
66
+ className: c(),
57
67
  ...m,
58
- ...l,
59
68
  children: [
60
- /* @__PURE__ */ n("div", { className: y(), children: [
61
- /* @__PURE__ */ r(p, { size: 24, ...f, alt: `${e} alert` }),
62
- o && /* @__PURE__ */ r(
69
+ /* @__PURE__ */ s("div", { className: y(), children: [
70
+ /* @__PURE__ */ t(w, { src: f, size: 24, role: "presentation" }),
71
+ o && r && /* @__PURE__ */ t(
63
72
  a,
64
73
  {
65
- title: t,
74
+ title: r,
66
75
  icon: "CloseOutlined",
67
- onPress: s,
76
+ onPress: n,
68
77
  className: "uy:sm:hidden"
69
78
  }
70
79
  )
71
80
  ] }),
72
- /* @__PURE__ */ r("section", { className: d(), children: c }),
73
- o && /* @__PURE__ */ r(
81
+ /* @__PURE__ */ t("section", { className: d(), children: l }),
82
+ o && r && /* @__PURE__ */ t(
74
83
  a,
75
84
  {
76
- title: t,
85
+ title: r,
77
86
  icon: "CloseOutlined",
78
- onPress: s,
87
+ onPress: n,
79
88
  className: "uy:hidden uy:sm:flex"
80
89
  }
81
90
  )
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payfit/unity-components",
3
- "version": "2.17.12",
3
+ "version": "2.18.1",
4
4
  "module": "./dist/esm/index.js",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -42,7 +42,7 @@
42
42
  "@hookform/devtools": "4.4.0",
43
43
  "@hookform/resolvers": "5.2.1",
44
44
  "@internationalized/date": "3.12.0",
45
- "@payfit/unity-illustrations": "2.17.12",
45
+ "@payfit/unity-illustrations": "2.18.1",
46
46
  "@radix-ui/react-avatar": "1.1.11",
47
47
  "@radix-ui/react-slot": "1.2.4",
48
48
  "@react-aria/interactions": "3.27.1",
@@ -74,8 +74,8 @@
74
74
  },
75
75
  "peerDependencies": {
76
76
  "@hookform/devtools": "^4",
77
- "@payfit/unity-icons": "2.17.12",
78
- "@payfit/unity-themes": "2.17.12",
77
+ "@payfit/unity-icons": "2.18.1",
78
+ "@payfit/unity-themes": "2.18.1",
79
79
  "@storybook/react-vite": "^10.2.2",
80
80
  "@tanstack/react-query": "^5",
81
81
  "@tanstack/react-router": "^1.131",
@@ -95,9 +95,9 @@
95
95
  "@payfit/hr-apps-tsconfigs": "0.0.0-use.local",
96
96
  "@payfit/storybook-addon-console-errors": "0.0.0-use.local",
97
97
  "@payfit/storybook-config": "0.0.0-use.local",
98
- "@payfit/unity-icons": "2.17.12",
99
- "@payfit/unity-illustrations": "2.17.12",
100
- "@payfit/unity-themes": "2.17.12",
98
+ "@payfit/unity-icons": "2.18.1",
99
+ "@payfit/unity-illustrations": "2.18.1",
100
+ "@payfit/unity-themes": "2.18.1",
101
101
  "@payfit/vite-configs": "0.0.0-use.local",
102
102
  "@storybook/addon-a11y": "10.2.17",
103
103
  "@storybook/addon-designs": "11.1.2",