@payfit/unity-components 3.0.4 → 3.1.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/ai-kit.js +3 -1
- package/dist/esm/components/pill/Pill.d.ts +20 -2
- package/dist/esm/components/pill/Pill.js +10 -4
- package/dist/esm/modules/ai-kit/components/ai-button/AIButton.d.ts +63 -64
- package/dist/esm/modules/ai-kit/components/ai-button/AIButton.js +117 -95
- package/dist/esm/modules/ai-kit/components/ai-trigger-button/AITriggerButton.d.ts +124 -0
- package/dist/esm/modules/ai-kit/components/ai-trigger-button/AITriggerButton.js +108 -0
- package/dist/esm/modules/ai-kit/components/ai-trigger-button/figma/AITriggerButton.figma.d.ts +7 -0
- package/dist/esm/modules/ai-kit/components/payfit-ai-brand/PayfitAIBrand.d.ts +46 -0
- package/dist/esm/modules/ai-kit/components/payfit-ai-brand/PayfitAIBrand.js +74 -0
- package/dist/esm/modules/ai-kit/index.d.ts +2 -0
- package/dist/esm/modules/ai-kit/utils/ai-gradient-effect.d.ts +121 -57
- package/dist/esm/modules/ai-kit/utils/ai-gradient-effect.js +78 -18
- package/package.json +7 -7
- package/src/agent-references/component-catalog.json +60 -4
package/dist/esm/ai-kit.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import { aiGradientEffect as e, aiGradientSurfaceEffect as t } from "./modules/ai-kit/utils/ai-gradient-effect.js";
|
|
2
2
|
import { AIButton as n } from "./modules/ai-kit/components/ai-button/AIButton.js";
|
|
3
|
-
|
|
3
|
+
import { PayfitAIBrand as r } from "./modules/ai-kit/components/payfit-ai-brand/PayfitAIBrand.js";
|
|
4
|
+
import { AITriggerButton as i } from "./modules/ai-kit/components/ai-trigger-button/AITriggerButton.js";
|
|
5
|
+
export { n as AIButton, i as AITriggerButton, r as PayfitAIBrand, e as aiGradientEffect, t as aiGradientSurfaceEffect };
|
|
@@ -10,6 +10,10 @@ declare const pill: import('tailwind-variants').TVReturnType<{
|
|
|
10
10
|
circle: "uy:rounded-circle";
|
|
11
11
|
pill: "uy:rounded-pill uy:px-50";
|
|
12
12
|
};
|
|
13
|
+
isDot: {
|
|
14
|
+
true: "uy:!size-100 uy:!min-w-0";
|
|
15
|
+
false: "";
|
|
16
|
+
};
|
|
13
17
|
isVisible: {
|
|
14
18
|
true: "uy:visible";
|
|
15
19
|
false: "uy:invisible";
|
|
@@ -24,6 +28,10 @@ declare const pill: import('tailwind-variants').TVReturnType<{
|
|
|
24
28
|
circle: "uy:rounded-circle";
|
|
25
29
|
pill: "uy:rounded-pill uy:px-50";
|
|
26
30
|
};
|
|
31
|
+
isDot: {
|
|
32
|
+
true: "uy:!size-100 uy:!min-w-0";
|
|
33
|
+
false: "";
|
|
34
|
+
};
|
|
27
35
|
isVisible: {
|
|
28
36
|
true: "uy:visible";
|
|
29
37
|
false: "uy:invisible";
|
|
@@ -38,13 +46,20 @@ declare const pill: import('tailwind-variants').TVReturnType<{
|
|
|
38
46
|
circle: "uy:rounded-circle";
|
|
39
47
|
pill: "uy:rounded-pill uy:px-50";
|
|
40
48
|
};
|
|
49
|
+
isDot: {
|
|
50
|
+
true: "uy:!size-100 uy:!min-w-0";
|
|
51
|
+
false: "";
|
|
52
|
+
};
|
|
41
53
|
isVisible: {
|
|
42
54
|
true: "uy:visible";
|
|
43
55
|
false: "uy:invisible";
|
|
44
56
|
};
|
|
45
57
|
}, undefined>>;
|
|
46
58
|
export type PillProps = Partial<Pick<HTMLDivElement, 'id'>> & Required<Pick<AriaAttributes, 'aria-label'>> & Pick<AriaAttributes, 'aria-details' | 'aria-describedby' | 'aria-live'> & {
|
|
47
|
-
/**
|
|
59
|
+
/**
|
|
60
|
+
* The notification value. Its absolute value is displayed; use `0` to
|
|
61
|
+
* render an accessible dot without visible text.
|
|
62
|
+
*/
|
|
48
63
|
value: number;
|
|
49
64
|
/**
|
|
50
65
|
* The variant of the Pill, determining its color scheme
|
|
@@ -66,7 +81,10 @@ export type PillProps = Partial<Pick<HTMLDivElement, 'id'>> & Required<Pick<Aria
|
|
|
66
81
|
* The Pill component displays a count of notifications or other numerical values.
|
|
67
82
|
*/
|
|
68
83
|
declare const Pill: import('react').ForwardRefExoticComponent<Partial<Pick<HTMLDivElement, "id">> & Required<Pick<AriaAttributes, "aria-label">> & Pick<AriaAttributes, "aria-describedby" | "aria-details" | "aria-live"> & {
|
|
69
|
-
/**
|
|
84
|
+
/**
|
|
85
|
+
* The notification value. Its absolute value is displayed; use `0` to
|
|
86
|
+
* render an accessible dot without visible text.
|
|
87
|
+
*/
|
|
70
88
|
value: number;
|
|
71
89
|
/**
|
|
72
90
|
* The variant of the Pill, determining its color scheme
|
|
@@ -14,6 +14,10 @@ var r = t({
|
|
|
14
14
|
circle: "uy:rounded-circle",
|
|
15
15
|
pill: "uy:rounded-pill uy:px-50"
|
|
16
16
|
},
|
|
17
|
+
isDot: {
|
|
18
|
+
true: "uy:!size-100 uy:!min-w-0",
|
|
19
|
+
false: ""
|
|
20
|
+
},
|
|
17
21
|
isVisible: {
|
|
18
22
|
true: "uy:visible",
|
|
19
23
|
false: "uy:invisible"
|
|
@@ -22,25 +26,27 @@ var r = t({
|
|
|
22
26
|
defaultVariants: {
|
|
23
27
|
variant: "critical",
|
|
24
28
|
shape: "pill",
|
|
29
|
+
isDot: !1,
|
|
25
30
|
isVisible: !0
|
|
26
31
|
}
|
|
27
32
|
}), i = (e, t) => {
|
|
28
33
|
let n = 10 ** t - 1;
|
|
29
34
|
return e > n ? `${n}+` : e.toString();
|
|
30
35
|
}, a = e(({ variant: e = "critical", isVisible: t = !0, maxDigits: a = 2, value: o, ...s }, c) => {
|
|
31
|
-
let l =
|
|
36
|
+
let l = Math.abs(o), u = l === 0 ? "" : i(l, a), d = r({
|
|
32
37
|
variant: e,
|
|
33
38
|
isVisible: t,
|
|
34
|
-
shape:
|
|
39
|
+
shape: u.length <= 1 ? "circle" : "pill",
|
|
40
|
+
isDot: l === 0
|
|
35
41
|
});
|
|
36
42
|
return /* @__PURE__ */ n("span", {
|
|
37
43
|
"data-dd-privacy": "allow",
|
|
38
44
|
...s,
|
|
39
45
|
ref: c,
|
|
40
46
|
role: "status",
|
|
41
|
-
className:
|
|
47
|
+
className: d,
|
|
42
48
|
"aria-atomic": "true",
|
|
43
|
-
children:
|
|
49
|
+
children: u
|
|
44
50
|
});
|
|
45
51
|
});
|
|
46
52
|
a.displayName = "Pill";
|
|
@@ -9,81 +9,80 @@ import { ButtonProps as AriaButtonProps } from 'react-aria-components/Button';
|
|
|
9
9
|
*/
|
|
10
10
|
export declare const aiButton: import('tailwind-variants').TVReturnType<{
|
|
11
11
|
variant: {
|
|
12
|
-
outlined:
|
|
13
|
-
|
|
12
|
+
outlined: {
|
|
13
|
+
base: string[];
|
|
14
|
+
};
|
|
15
|
+
ghost: {
|
|
16
|
+
base: string[];
|
|
17
|
+
};
|
|
14
18
|
};
|
|
15
19
|
isDisabled: {
|
|
16
|
-
true:
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
true: "uy:disabled:cursor-not-allowed";
|
|
21
|
-
false: "";
|
|
20
|
+
true: {
|
|
21
|
+
base: string[];
|
|
22
|
+
aiSurface: string;
|
|
23
|
+
};
|
|
22
24
|
};
|
|
23
25
|
isLoading: {
|
|
24
|
-
true:
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
true: "uy:data-[loading]:cursor-progress uy:data-[loading]:text-content-neutral-disabled";
|
|
42
|
-
false: "";
|
|
43
|
-
};
|
|
44
|
-
size: {
|
|
45
|
-
default: "uy:w-auto uy:grow-0 uy:basis-auto";
|
|
46
|
-
full: "uy:grow-1 uy:w-full uy:basis-full";
|
|
47
|
-
};
|
|
48
|
-
mode: {
|
|
49
|
-
default: string[];
|
|
50
|
-
compact: string[];
|
|
26
|
+
true: {
|
|
27
|
+
aiSurface: string;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
}, {
|
|
31
|
+
base: string[];
|
|
32
|
+
aiSurface: string[];
|
|
33
|
+
content: string[];
|
|
34
|
+
label: string[];
|
|
35
|
+
}, undefined, {
|
|
36
|
+
variant: {
|
|
37
|
+
outlined: {
|
|
38
|
+
base: string[];
|
|
39
|
+
};
|
|
40
|
+
ghost: {
|
|
41
|
+
base: string[];
|
|
42
|
+
};
|
|
51
43
|
};
|
|
52
|
-
}, undefined, string[], {
|
|
53
44
|
isDisabled: {
|
|
54
|
-
true:
|
|
55
|
-
|
|
45
|
+
true: {
|
|
46
|
+
base: string[];
|
|
47
|
+
aiSurface: string;
|
|
48
|
+
};
|
|
56
49
|
};
|
|
57
50
|
isLoading: {
|
|
58
|
-
true:
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
51
|
+
true: {
|
|
52
|
+
aiSurface: string;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
}, {
|
|
56
|
+
base: string[];
|
|
57
|
+
aiSurface: string[];
|
|
58
|
+
content: string[];
|
|
59
|
+
label: string[];
|
|
60
|
+
}, import('tailwind-variants').TVReturnTypeLike<{
|
|
61
|
+
variant: {
|
|
62
|
+
outlined: {
|
|
63
|
+
base: string[];
|
|
64
|
+
};
|
|
65
|
+
ghost: {
|
|
66
|
+
base: string[];
|
|
67
|
+
};
|
|
68
68
|
};
|
|
69
|
-
}, undefined, import('tailwind-variants').TVReturnTypeLike<{
|
|
70
69
|
isDisabled: {
|
|
71
|
-
true:
|
|
72
|
-
|
|
70
|
+
true: {
|
|
71
|
+
base: string[];
|
|
72
|
+
aiSurface: string;
|
|
73
|
+
};
|
|
73
74
|
};
|
|
74
75
|
isLoading: {
|
|
75
|
-
true:
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
};
|
|
86
|
-
}, undefined>>>;
|
|
76
|
+
true: {
|
|
77
|
+
aiSurface: string;
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
}, {
|
|
81
|
+
base: string[];
|
|
82
|
+
aiSurface: string[];
|
|
83
|
+
content: string[];
|
|
84
|
+
label: string[];
|
|
85
|
+
}>>;
|
|
87
86
|
/**
|
|
88
87
|
* Configures an AI-assisted action and inherits standard React Aria button
|
|
89
88
|
* behavior such as `onPress`, `isDisabled`, and `type`.
|
|
@@ -155,7 +154,7 @@ export type AIButtonProps = PropsWithChildren<Omit<AriaButtonProps, 'children' |
|
|
|
155
154
|
* - `AIButton` renders a native button through React Aria. It supports pointer,
|
|
156
155
|
* Enter, and Space activation. Prefix and suffix icons are decorative; use
|
|
157
156
|
* the text label to provide the accessible name.
|
|
158
|
-
* - `AIButton` applies a
|
|
157
|
+
* - `AIButton` applies a rotating gradient effect on hover and focus.
|
|
159
158
|
* For users with reduced motion activated, the rotation is disabled.
|
|
160
159
|
*/
|
|
161
160
|
export declare const AIButton: import('react').ForwardRefExoticComponent<Omit<AriaButtonProps, "children" | "className" | "style"> & {
|
|
@@ -3,157 +3,179 @@ import { Spinner as t } from "../../../../components/spinner/Spinner.js";
|
|
|
3
3
|
import { buttonBase as n } from "../../../../components/button/Button.variants.js";
|
|
4
4
|
import { aiGradientEffect as r, aiGradientSurfaceEffect as i } from "../../utils/ai-gradient-effect.js";
|
|
5
5
|
import { forwardRef as a, useMemo as o } from "react";
|
|
6
|
-
import {
|
|
7
|
-
import { jsx as
|
|
8
|
-
import { useIntl as
|
|
9
|
-
import { Button as
|
|
6
|
+
import { uyMerge as s, uyTv as c } from "@payfit/unity-themes";
|
|
7
|
+
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
8
|
+
import { useIntl as d } from "react-intl";
|
|
9
|
+
import { Button as f } from "react-aria-components/Button";
|
|
10
10
|
//#region src/modules/ai-kit/components/ai-button/AIButton.tsx
|
|
11
|
-
var
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
var p = c({
|
|
12
|
+
slots: {
|
|
13
|
+
base: [
|
|
14
|
+
"uy:relative",
|
|
15
|
+
"uy:isolate",
|
|
16
|
+
"uy:[--uy-ai-gradient-border-width:1px]"
|
|
17
|
+
],
|
|
18
|
+
aiSurface: [i()],
|
|
19
|
+
content: [
|
|
20
|
+
"uy:relative",
|
|
21
|
+
"uy:z-20",
|
|
22
|
+
"uy:inline-flex",
|
|
23
|
+
"uy:items-center",
|
|
24
|
+
"uy:gap-50"
|
|
25
|
+
],
|
|
26
|
+
label: [
|
|
27
|
+
"uy:truncate",
|
|
28
|
+
"uy:min-w-0",
|
|
29
|
+
"uy:w-(--uy-button-label-truncation-length)"
|
|
30
|
+
]
|
|
31
|
+
},
|
|
14
32
|
variants: {
|
|
15
33
|
variant: {
|
|
16
|
-
outlined: [
|
|
34
|
+
outlined: { base: [
|
|
17
35
|
"uy:text-content-neutral-enabled",
|
|
36
|
+
"uy:enabled:data-[hovered=\"true\"]:[--uy-ai-gradient-border-width:2px]",
|
|
37
|
+
"uy:enabled:data-[focus-visible=\"true\"]:[--uy-ai-gradient-border-width:2px]",
|
|
38
|
+
"uy:enabled:hover:[--uy-ai-gradient-border-width:2px]",
|
|
39
|
+
"uy:enabled:focus-visible:[--uy-ai-gradient-border-width:2px]",
|
|
18
40
|
"uy:enabled:data-[hovered=\"true\"]:text-content-neutral-hover",
|
|
19
41
|
"uy:enabled:active:text-content-neutral-active",
|
|
20
42
|
"uy:enabled:data-[pressed=\"true\"]:text-content-neutral-pressed",
|
|
21
43
|
"uy:enabled:data-[focus-visible=\"true\"]:text-content-neutral-focus"
|
|
22
|
-
],
|
|
23
|
-
ghost: [
|
|
24
|
-
"uy:bg-transparent
|
|
44
|
+
] },
|
|
45
|
+
ghost: { base: [
|
|
46
|
+
"uy:bg-transparent",
|
|
47
|
+
"uy:text-content-neutral-enabled",
|
|
25
48
|
"uy:enabled:data-[hovered=\"true\"]:text-content-neutral-hover",
|
|
49
|
+
"uy:enabled:data-[hovered=\"true\"]:[--uy-ai-gradient-border-width:2px]",
|
|
26
50
|
"uy:enabled:active:text-content-neutral-active",
|
|
27
51
|
"uy:enabled:data-[pressed=\"true\"]:text-content-neutral-pressed",
|
|
28
|
-
"uy:enabled:data-[focus-visible=\"true\"]:text-content-neutral-focus"
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
isDisabled: { true: [
|
|
32
|
-
"uy:disabled:text-content-neutral-disabled",
|
|
33
|
-
"uy:disabled:bg-transparent",
|
|
34
|
-
"uy:data-[loading]:text-content-neutral-disabled",
|
|
35
|
-
"uy:data-[loading]:bg-transparent"
|
|
36
|
-
] }
|
|
37
|
-
},
|
|
38
|
-
compoundVariants: [
|
|
39
|
-
{
|
|
40
|
-
isDisabled: !1,
|
|
41
|
-
variant: "outlined",
|
|
42
|
-
className: r({ variant: "outlined" })
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
isDisabled: !1,
|
|
46
|
-
variant: "ghost",
|
|
47
|
-
className: r({ variant: "ghost" })
|
|
52
|
+
"uy:enabled:data-[focus-visible=\"true\"]:text-content-neutral-focus",
|
|
53
|
+
"uy:enabled:data-[focus-visible=\"true\"]:[--uy-ai-gradient-border-width:2px]"
|
|
54
|
+
] }
|
|
48
55
|
},
|
|
49
|
-
{
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
{
|
|
55
|
-
isDisabled: !0,
|
|
56
|
-
variant: "ghost",
|
|
57
|
-
className: "uy:disabled:bg-surface-neutral-disabled uy:data-[loading]:bg-surface-neutral-disabled"
|
|
58
|
-
}
|
|
59
|
-
],
|
|
60
|
-
defaultVariants: { variant: "outlined" }
|
|
61
|
-
}), p = s({
|
|
62
|
-
base: ["uy:pointer-events-none uy:absolute uy:-inset-px uy:z-10 uy:rounded-[var(--uy-ai-gradient-effect-surface-radius)]", "uy:group-data-[hovered=\"true\"]:inset-0 uy:group-active:inset-0 uy:group-data-[pressed=\"true\"]:inset-0 uy:group-data-[focus-visible=\"true\"]:inset-0"],
|
|
63
|
-
variants: {
|
|
64
|
-
variant: {
|
|
65
|
-
outlined: "uy:bg-surface-neutral",
|
|
66
|
-
ghost: "uy:bg-transparent uy:group-data-[focus-visible=\"true\"]:bg-surface-neutral"
|
|
67
|
-
},
|
|
68
|
-
isDisabled: {
|
|
69
|
-
true: "",
|
|
70
|
-
false: ""
|
|
71
|
-
}
|
|
56
|
+
isDisabled: { true: {
|
|
57
|
+
base: ["uy:disabled:text-content-neutral-disabled", "uy:data-[loading]:text-content-neutral-disabled"],
|
|
58
|
+
aiSurface: "uy:hidden"
|
|
59
|
+
} },
|
|
60
|
+
isLoading: { true: { aiSurface: "uy:hidden" } }
|
|
72
61
|
},
|
|
73
62
|
compoundVariants: [
|
|
74
63
|
{
|
|
75
64
|
isDisabled: !1,
|
|
76
65
|
variant: "outlined",
|
|
77
|
-
className:
|
|
66
|
+
className: { base: r({
|
|
67
|
+
gradient: "linear",
|
|
68
|
+
variant: "outlined",
|
|
69
|
+
glow: !1
|
|
70
|
+
}) }
|
|
78
71
|
},
|
|
79
72
|
{
|
|
80
73
|
isDisabled: !1,
|
|
81
74
|
variant: "ghost",
|
|
82
|
-
className:
|
|
75
|
+
className: { base: r({
|
|
76
|
+
gradient: "linear",
|
|
77
|
+
variant: "ghost",
|
|
78
|
+
glow: !1
|
|
79
|
+
}) }
|
|
83
80
|
},
|
|
84
81
|
{
|
|
85
82
|
isDisabled: !0,
|
|
86
83
|
variant: "outlined",
|
|
87
|
-
className:
|
|
84
|
+
className: { base: [
|
|
85
|
+
"uy:text-content-neutral-disabled",
|
|
86
|
+
"uy:disabled:border-1",
|
|
87
|
+
"uy:disabled:border-border-neutral-high-disabled",
|
|
88
|
+
"uy:data-[loading]:border-1",
|
|
89
|
+
"uy:data-[loading]:border-border-neutral-high-disabled",
|
|
90
|
+
"uy:enabled:data-[hovered=\"true\"]:text-content-neutral-disabled",
|
|
91
|
+
"uy:enabled:active:text-content-neutral-disabled",
|
|
92
|
+
"uy:enabled:data-[pressed=\"true\"]:text-content-neutral-disabled",
|
|
93
|
+
"uy:enabled:data-[focus-visible=\"true\"]:text-content-neutral-disabled"
|
|
94
|
+
] }
|
|
88
95
|
},
|
|
89
96
|
{
|
|
90
97
|
isDisabled: !0,
|
|
91
98
|
variant: "ghost",
|
|
92
|
-
className:
|
|
99
|
+
className: { base: [
|
|
100
|
+
"uy:bg-surface-neutral-low-disabled",
|
|
101
|
+
"uy:text-content-neutral-disabled",
|
|
102
|
+
"uy:enabled:data-[hovered=\"true\"]:bg-surface-neutral-low-disabled",
|
|
103
|
+
"uy:enabled:data-[hovered=\"true\"]:text-content-neutral-disabled",
|
|
104
|
+
"uy:enabled:active:bg-surface-neutral-low-disabled",
|
|
105
|
+
"uy:enabled:active:text-content-neutral-disabled",
|
|
106
|
+
"uy:enabled:data-[pressed=\"true\"]:bg-surface-neutral-low-disabled",
|
|
107
|
+
"uy:enabled:data-[pressed=\"true\"]:text-content-neutral-disabled",
|
|
108
|
+
"uy:enabled:data-[focus-visible=\"true\"]:bg-surface-neutral-low-disabled",
|
|
109
|
+
"uy:enabled:data-[focus-visible=\"true\"]:text-content-neutral-disabled"
|
|
110
|
+
] }
|
|
93
111
|
}
|
|
94
112
|
],
|
|
95
113
|
defaultVariants: {
|
|
114
|
+
variant: "outlined",
|
|
96
115
|
isDisabled: !1,
|
|
97
|
-
|
|
116
|
+
isLoading: !1
|
|
98
117
|
}
|
|
99
|
-
}), m = (n, r, i) => n ? /* @__PURE__ */
|
|
118
|
+
}), m = (n, r, i) => n ? /* @__PURE__ */ l(t, {
|
|
100
119
|
size: "small",
|
|
101
120
|
color: "inherit",
|
|
102
121
|
label: r
|
|
103
|
-
}) : i ? /* @__PURE__ */
|
|
122
|
+
}) : i ? /* @__PURE__ */ l(e, {
|
|
104
123
|
"aria-hidden": "true",
|
|
105
124
|
color: "inherit",
|
|
106
125
|
"data-unity-icon": "prefix",
|
|
107
126
|
role: "presentation",
|
|
108
127
|
size: 20,
|
|
109
128
|
src: i
|
|
110
|
-
}) : null, h = a(({ children: t, isDisabled:
|
|
111
|
-
let
|
|
129
|
+
}) : null, h = a(({ children: t, isDisabled: r = !1, isLoading: i = !1, loadingLabel: a, mode: c, prefixIcon: h, suffixIcon: g, truncateLabelLength: _, variant: v, ...y }, b) => {
|
|
130
|
+
let x = d(), S = r || i, C = (a?.trim() ? a : void 0) ?? x.formatMessage({
|
|
112
131
|
id: "unity:component:common:loading:label",
|
|
113
132
|
defaultMessage: "Loading..."
|
|
114
|
-
}),
|
|
115
|
-
isDisabled:
|
|
116
|
-
isLoading:
|
|
117
|
-
mode:
|
|
118
|
-
size: "default"
|
|
119
|
-
|
|
133
|
+
}), w = o(() => n({
|
|
134
|
+
isDisabled: S,
|
|
135
|
+
isLoading: i,
|
|
136
|
+
mode: c === "compact" ? "compact" : "default",
|
|
137
|
+
size: "default"
|
|
138
|
+
}), [
|
|
139
|
+
S,
|
|
140
|
+
i,
|
|
141
|
+
c
|
|
142
|
+
]), T = o(() => p({
|
|
143
|
+
isDisabled: S,
|
|
144
|
+
isLoading: i,
|
|
145
|
+
variant: v
|
|
120
146
|
}), [
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
_
|
|
147
|
+
S,
|
|
148
|
+
i,
|
|
149
|
+
v
|
|
125
150
|
]);
|
|
126
|
-
return /* @__PURE__ */
|
|
127
|
-
...
|
|
128
|
-
ref:
|
|
151
|
+
return /* @__PURE__ */ u(f, {
|
|
152
|
+
...y,
|
|
153
|
+
ref: b,
|
|
129
154
|
"data-dd-privacy": "allow",
|
|
130
|
-
"data-loading":
|
|
131
|
-
isDisabled:
|
|
132
|
-
isPending:
|
|
133
|
-
className:
|
|
134
|
-
children: [/* @__PURE__ */
|
|
155
|
+
"data-loading": i || void 0,
|
|
156
|
+
isDisabled: r,
|
|
157
|
+
isPending: i,
|
|
158
|
+
className: s(w, T.base()),
|
|
159
|
+
children: [/* @__PURE__ */ l("span", {
|
|
135
160
|
"aria-hidden": "true",
|
|
136
|
-
className:
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
"data-unity-slot": "surface"
|
|
141
|
-
}), /* @__PURE__ */ l("span", {
|
|
142
|
-
className: "uy:relative uy:z-20 uy:inline-flex uy:gap-50 uy:items-center",
|
|
161
|
+
className: T.aiSurface(),
|
|
162
|
+
"data-unity-slot": "ai.surface"
|
|
163
|
+
}), /* @__PURE__ */ u("span", {
|
|
164
|
+
className: T.content(),
|
|
143
165
|
children: [
|
|
144
|
-
m(
|
|
145
|
-
|
|
146
|
-
style: { "--uy-button-label-truncation-length": `${
|
|
147
|
-
className:
|
|
166
|
+
m(i, C, h),
|
|
167
|
+
_ && _ > 0 ? /* @__PURE__ */ l("span", {
|
|
168
|
+
style: { "--uy-button-label-truncation-length": `${_}ch` },
|
|
169
|
+
className: T.label(),
|
|
148
170
|
children: t
|
|
149
171
|
}) : t,
|
|
150
|
-
|
|
172
|
+
g && /* @__PURE__ */ l(e, {
|
|
151
173
|
"aria-hidden": "true",
|
|
152
174
|
color: "inherit",
|
|
153
175
|
"data-unity-icon": "suffix",
|
|
154
176
|
role: "presentation",
|
|
155
177
|
size: 20,
|
|
156
|
-
src:
|
|
178
|
+
src: g
|
|
157
179
|
})
|
|
158
180
|
]
|
|
159
181
|
})]
|
|
@@ -161,4 +183,4 @@ var f = s({
|
|
|
161
183
|
});
|
|
162
184
|
h.displayName = "AIButton";
|
|
163
185
|
//#endregion
|
|
164
|
-
export { h as AIButton,
|
|
186
|
+
export { h as AIButton, p as aiButton };
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { ReactElement, ReactNode } from 'react';
|
|
2
|
+
import { ToggleButtonProps as AriaToggleButtonProps } from 'react-aria-components/ToggleButton';
|
|
3
|
+
export type AITriggerButtonBrandSlotProps = {
|
|
4
|
+
/** Resolved brand appearance for the trigger's enabled or disabled state. */
|
|
5
|
+
appearance: 'color' | 'grayscale';
|
|
6
|
+
/** Resolved brand size for the trigger density. */
|
|
7
|
+
size: number;
|
|
8
|
+
/** Applies the trigger-owned brand hover motion. */
|
|
9
|
+
className: string;
|
|
10
|
+
/** Keeps the brand decorative because the button label names the control. */
|
|
11
|
+
'aria-hidden': true;
|
|
12
|
+
};
|
|
13
|
+
export type AITriggerButtonProps = Omit<AriaToggleButtonProps, 'aria-expanded' | 'children' | 'className' | 'isPending'> & {
|
|
14
|
+
/**
|
|
15
|
+
* Provides the visible and accessible name for the AI assistant surface.
|
|
16
|
+
* The label remains available to assistive technology when `iconOnly` is
|
|
17
|
+
* true.
|
|
18
|
+
*/
|
|
19
|
+
children: ReactNode;
|
|
20
|
+
/**
|
|
21
|
+
* Renders only the brand mark and exposes `children` in a tooltip.
|
|
22
|
+
* @default false
|
|
23
|
+
*/
|
|
24
|
+
iconOnly?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Selects the button density.
|
|
27
|
+
* @default 'default'
|
|
28
|
+
*/
|
|
29
|
+
mode?: 'default' | 'compact';
|
|
30
|
+
/**
|
|
31
|
+
* Prevents selection changes and applies the disabled brand treatment while
|
|
32
|
+
* the assistant surface is loading.
|
|
33
|
+
* @default false
|
|
34
|
+
*/
|
|
35
|
+
isLoading?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Renders the PayFit AI brand inside a consumer-owned composition, such as
|
|
38
|
+
* an `Anchor` with a notification `Pill`. Forward every supplied property
|
|
39
|
+
* to `PayfitAIBrand` to retain the trigger's state treatment and motion.
|
|
40
|
+
*/
|
|
41
|
+
brandSlot?: (props: AITriggerButtonBrandSlotProps) => ReactElement;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Toggles a PayFit AI assistant surface from a compact, recognizable entry
|
|
45
|
+
* point.
|
|
46
|
+
* Use `AITriggerButton` with `aria-controls` to associate the trigger with
|
|
47
|
+
* the panel it reveals. Control it with `isSelected` and `onChange`, or pass
|
|
48
|
+
* `defaultSelected` for uncontrolled selection. Set `iconOnly` when space is
|
|
49
|
+
* limited; the label stays available as the button's accessible name and is
|
|
50
|
+
* shown in a tooltip.
|
|
51
|
+
* @param props - React Aria toggle-button props and AI trigger appearance
|
|
52
|
+
* options.
|
|
53
|
+
* @param props.children - The visible label and accessible name for the AI
|
|
54
|
+
* assistant surface. The component keeps this label available to assistive
|
|
55
|
+
* technology when `iconOnly` is `true`.
|
|
56
|
+
* @param props.iconOnly - Renders only the PayFit AI brand mark and shows the
|
|
57
|
+
* label in a tooltip. Defaults to `false`.
|
|
58
|
+
* @param props.mode - Selects the trigger density: `default` uses a 24px brand
|
|
59
|
+
* mark and `compact` uses a 20px mark. Defaults to `default`.
|
|
60
|
+
* @param props.isLoading - Disables the trigger and applies its loading brand
|
|
61
|
+
* treatment while the assistant surface loads. Defaults to `false`.
|
|
62
|
+
* @param props.brandSlot - Renders a consumer-owned brand composition instead
|
|
63
|
+
* of `PayfitAIBrand`. It receives `appearance`, `size`, `className`, and
|
|
64
|
+
* `aria-hidden`; forward every property to the rendered brand to preserve the
|
|
65
|
+
* trigger's visual state and motion.
|
|
66
|
+
* @param props.defaultSelected - Sets the initial selected state for an
|
|
67
|
+
* uncontrolled trigger.
|
|
68
|
+
* @param props.isSelected - Controls the selected state. Pass this with
|
|
69
|
+
* `onChange` for a controlled trigger.
|
|
70
|
+
* @param props.onChange - Receives the next selected state after the user
|
|
71
|
+
* toggles the trigger.
|
|
72
|
+
* @param props.isDisabled - Prevents the user from toggling the trigger.
|
|
73
|
+
* @param props.aria-controls - Identifies the assistant panel that this
|
|
74
|
+
* trigger reveals.
|
|
75
|
+
* @see {@link AITriggerButtonProps} for the AI-specific props.
|
|
76
|
+
* @example
|
|
77
|
+
* ```tsx
|
|
78
|
+
* import { AITriggerButton } from '@payfit/unity-components/ai-kit'
|
|
79
|
+
*
|
|
80
|
+
* export function AssistantTrigger() {
|
|
81
|
+
* return (
|
|
82
|
+
* <AITriggerButton aria-controls="assistant-panel">
|
|
83
|
+
* Payfit AI
|
|
84
|
+
* </AITriggerButton>
|
|
85
|
+
* )
|
|
86
|
+
* }
|
|
87
|
+
* ```
|
|
88
|
+
* @remarks
|
|
89
|
+
* - The component renders a native button with React Aria toggle-button
|
|
90
|
+
* semantics.
|
|
91
|
+
* - Activate the trigger with Enter or Space.
|
|
92
|
+
* - The trigger exposes `aria-pressed` and mirrors its selected state through
|
|
93
|
+
* `aria-expanded` for the associated disclosure.
|
|
94
|
+
*/
|
|
95
|
+
export declare const AITriggerButton: import('react').ForwardRefExoticComponent<Omit<AriaToggleButtonProps, "children" | "aria-expanded" | "className" | "isPending"> & {
|
|
96
|
+
/**
|
|
97
|
+
* Provides the visible and accessible name for the AI assistant surface.
|
|
98
|
+
* The label remains available to assistive technology when `iconOnly` is
|
|
99
|
+
* true.
|
|
100
|
+
*/
|
|
101
|
+
children: ReactNode;
|
|
102
|
+
/**
|
|
103
|
+
* Renders only the brand mark and exposes `children` in a tooltip.
|
|
104
|
+
* @default false
|
|
105
|
+
*/
|
|
106
|
+
iconOnly?: boolean;
|
|
107
|
+
/**
|
|
108
|
+
* Selects the button density.
|
|
109
|
+
* @default 'default'
|
|
110
|
+
*/
|
|
111
|
+
mode?: "default" | "compact";
|
|
112
|
+
/**
|
|
113
|
+
* Prevents selection changes and applies the disabled brand treatment while
|
|
114
|
+
* the assistant surface is loading.
|
|
115
|
+
* @default false
|
|
116
|
+
*/
|
|
117
|
+
isLoading?: boolean;
|
|
118
|
+
/**
|
|
119
|
+
* Renders the PayFit AI brand inside a consumer-owned composition, such as
|
|
120
|
+
* an `Anchor` with a notification `Pill`. Forward every supplied property
|
|
121
|
+
* to `PayfitAIBrand` to retain the trigger's state treatment and motion.
|
|
122
|
+
*/
|
|
123
|
+
brandSlot?: (props: AITriggerButtonBrandSlotProps) => ReactElement;
|
|
124
|
+
} & import('react').RefAttributes<HTMLButtonElement>>;
|