@payfit/unity-components 2.67.46 → 2.68.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.
- package/dist/esm/ai-kit.js +3 -0
- package/dist/esm/components/app-layout/AppLayout.js +1 -1
- package/dist/esm/components/button/Button.variants.d.ts +1 -2
- package/dist/esm/components/button/Button.variants.js +1 -1
- package/dist/esm/modules/ai-kit/components/ai-button/AIButton.d.ts +198 -0
- package/dist/esm/modules/ai-kit/components/ai-button/AIButton.js +164 -0
- package/dist/esm/modules/ai-kit/components/ai-button/figma/AIButton.figma.d.ts +7 -0
- package/dist/esm/modules/ai-kit/index.d.ts +2 -0
- package/dist/esm/modules/ai-kit/utils/ai-gradient-effect.d.ts +77 -0
- package/dist/esm/modules/ai-kit/utils/ai-gradient-effect.js +25 -0
- package/package.json +19 -7
- package/src/agent-references/component-catalog.json +25 -0
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { aiGradientEffect as e, aiGradientSurfaceEffect as t } from "./modules/ai-kit/utils/ai-gradient-effect.js";
|
|
2
|
+
import { AIButton as n } from "./modules/ai-kit/components/ai-button/AIButton.js";
|
|
3
|
+
export { n as AIButton, e as aiGradientEffect, t as aiGradientSurfaceEffect };
|
|
@@ -16,7 +16,7 @@ var a = t({
|
|
|
16
16
|
],
|
|
17
17
|
contentWrapper: ["uy:flex uy:min-w-0 uy:flex-1 uy:flex-col uy:relative", "uy:md:[&:has([data-unity-page])]:pl-0"],
|
|
18
18
|
contentHeader: "uy:hidden uy:md:contents",
|
|
19
|
-
content: ["uy:flex uy:flex-1 uy:flex-col", "uy:md:[&:has([data-unity-page])]:pr-0 uy:md:[&:has([data-unity-page])]:pt-0"],
|
|
19
|
+
content: ["uy:isolate uy:flex uy:flex-1 uy:flex-col", "uy:md:[&:has([data-unity-page])]:pr-0 uy:md:[&:has([data-unity-page])]:pt-0"],
|
|
20
20
|
footer: "uy:hidden uy:md:block"
|
|
21
21
|
},
|
|
22
22
|
variants: { withoutContentPadding: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { VariantProps } from '@payfit/unity-themes';
|
|
2
|
-
declare const buttonBase: import('tailwind-variants').TVReturnType<{
|
|
2
|
+
export declare const buttonBase: import('tailwind-variants').TVReturnType<{
|
|
3
3
|
isDisabled: {
|
|
4
4
|
true: "uy:disabled:cursor-not-allowed";
|
|
5
5
|
false: "";
|
|
@@ -308,4 +308,3 @@ export type ButtonBase = VariantProps<typeof buttonBase>;
|
|
|
308
308
|
export type ButtonFilled = VariantProps<typeof buttonFilled>;
|
|
309
309
|
export type ButtonOutlined = VariantProps<typeof buttonOutlined>;
|
|
310
310
|
export type ButtonGhost = VariantProps<typeof buttonGhost>;
|
|
311
|
-
export {};
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import { UnityIcon } from '@payfit/unity-icons';
|
|
2
|
+
import { PropsWithChildren } from 'react';
|
|
3
|
+
import { ButtonProps as AriaButtonProps } from 'react-aria-components/Button';
|
|
4
|
+
/**
|
|
5
|
+
* Defines the visual states shared by `AIButton` instances.
|
|
6
|
+
*
|
|
7
|
+
* Render `AIButton` instead of applying these classes directly so the surface,
|
|
8
|
+
* loading, disabled, and accessibility behavior stay synchronized.
|
|
9
|
+
*/
|
|
10
|
+
export declare const aiButton: import('tailwind-variants').TVReturnType<{
|
|
11
|
+
variant: {
|
|
12
|
+
outlined: string[];
|
|
13
|
+
ghost: string[];
|
|
14
|
+
};
|
|
15
|
+
isDisabled: {
|
|
16
|
+
true: string[];
|
|
17
|
+
};
|
|
18
|
+
}, undefined, string[], {
|
|
19
|
+
isDisabled: {
|
|
20
|
+
true: "uy:disabled:cursor-not-allowed";
|
|
21
|
+
false: "";
|
|
22
|
+
};
|
|
23
|
+
isLoading: {
|
|
24
|
+
true: "uy:data-[loading]:cursor-progress uy:data-[loading]:text-content-neutral-disabled";
|
|
25
|
+
false: "";
|
|
26
|
+
};
|
|
27
|
+
size: {
|
|
28
|
+
default: "uy:w-auto uy:grow-0 uy:basis-auto";
|
|
29
|
+
full: "uy:grow-1 uy:w-full uy:basis-full";
|
|
30
|
+
};
|
|
31
|
+
mode: {
|
|
32
|
+
default: string[];
|
|
33
|
+
compact: string[];
|
|
34
|
+
};
|
|
35
|
+
}, undefined, import('tailwind-variants').TVReturnType<{
|
|
36
|
+
isDisabled: {
|
|
37
|
+
true: "uy:disabled:cursor-not-allowed";
|
|
38
|
+
false: "";
|
|
39
|
+
};
|
|
40
|
+
isLoading: {
|
|
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[];
|
|
51
|
+
};
|
|
52
|
+
}, undefined, string[], {
|
|
53
|
+
isDisabled: {
|
|
54
|
+
true: "uy:disabled:cursor-not-allowed";
|
|
55
|
+
false: "";
|
|
56
|
+
};
|
|
57
|
+
isLoading: {
|
|
58
|
+
true: "uy:data-[loading]:cursor-progress uy:data-[loading]:text-content-neutral-disabled";
|
|
59
|
+
false: "";
|
|
60
|
+
};
|
|
61
|
+
size: {
|
|
62
|
+
default: "uy:w-auto uy:grow-0 uy:basis-auto";
|
|
63
|
+
full: "uy:grow-1 uy:w-full uy:basis-full";
|
|
64
|
+
};
|
|
65
|
+
mode: {
|
|
66
|
+
default: string[];
|
|
67
|
+
compact: string[];
|
|
68
|
+
};
|
|
69
|
+
}, undefined, import('tailwind-variants').TVReturnTypeLike<{
|
|
70
|
+
isDisabled: {
|
|
71
|
+
true: "uy:disabled:cursor-not-allowed";
|
|
72
|
+
false: "";
|
|
73
|
+
};
|
|
74
|
+
isLoading: {
|
|
75
|
+
true: "uy:data-[loading]:cursor-progress uy:data-[loading]:text-content-neutral-disabled";
|
|
76
|
+
false: "";
|
|
77
|
+
};
|
|
78
|
+
size: {
|
|
79
|
+
default: "uy:w-auto uy:grow-0 uy:basis-auto";
|
|
80
|
+
full: "uy:grow-1 uy:w-full uy:basis-full";
|
|
81
|
+
};
|
|
82
|
+
mode: {
|
|
83
|
+
default: string[];
|
|
84
|
+
compact: string[];
|
|
85
|
+
};
|
|
86
|
+
}, undefined>>>;
|
|
87
|
+
/**
|
|
88
|
+
* Configures an AI-assisted action and inherits standard React Aria button
|
|
89
|
+
* behavior such as `onPress`, `isDisabled`, and `type`.
|
|
90
|
+
*/
|
|
91
|
+
export type AIButtonProps = PropsWithChildren<Omit<AriaButtonProps, 'children' | 'className' | 'style'> & {
|
|
92
|
+
/**
|
|
93
|
+
* Selects the AI button appearance.
|
|
94
|
+
* - `outlined` keeps a visible AI gradient border while idle.
|
|
95
|
+
* - `ghost` reveals the AI treatment during interaction.
|
|
96
|
+
* @default 'outlined'
|
|
97
|
+
*/
|
|
98
|
+
variant?: 'outlined' | 'ghost';
|
|
99
|
+
/**
|
|
100
|
+
* Controls the button density.
|
|
101
|
+
* - `default` uses the standard action size.
|
|
102
|
+
* - `compact` uses the dense action size.
|
|
103
|
+
* @default 'default'
|
|
104
|
+
*/
|
|
105
|
+
mode?: 'default' | 'compact';
|
|
106
|
+
/**
|
|
107
|
+
* Shows a spinner and disables the action while it is in progress.
|
|
108
|
+
* The label remains visible to preserve the button's accessible name.
|
|
109
|
+
* @default false
|
|
110
|
+
*/
|
|
111
|
+
isLoading?: boolean;
|
|
112
|
+
/**
|
|
113
|
+
* Sets the accessible label announced by the loading spinner.
|
|
114
|
+
* @default The translated Unity loading label.
|
|
115
|
+
*/
|
|
116
|
+
loadingLabel?: string;
|
|
117
|
+
/** Renders a Unity icon before the label. */
|
|
118
|
+
prefixIcon?: UnityIcon;
|
|
119
|
+
/** Renders a Unity icon after the label. */
|
|
120
|
+
suffixIcon?: UnityIcon;
|
|
121
|
+
/**
|
|
122
|
+
* Truncates the visible label after the specified number of characters.
|
|
123
|
+
* The complete label remains available to assistive technology.
|
|
124
|
+
*/
|
|
125
|
+
truncateLabelLength?: number;
|
|
126
|
+
}>;
|
|
127
|
+
/**
|
|
128
|
+
* Triggers an AI-assisted action with Unity's dedicated visual language.
|
|
129
|
+
*
|
|
130
|
+
* Use `AIButton` for agentic actions such as drafting, rewriting, or
|
|
131
|
+
* summarizing. Pass `variant="outlined"` for a persistent gradient border or
|
|
132
|
+
* `variant="ghost"` for a quieter resting treatment. Use `isLoading` while an
|
|
133
|
+
* action runs; it disables the button, displays a spinner, and keeps the
|
|
134
|
+
* label visible.
|
|
135
|
+
* @param props - React Aria button props and AI Button presentation options.
|
|
136
|
+
* @see {@link AIButtonProps} for the available appearance, loading, icon, and
|
|
137
|
+
* truncation options.
|
|
138
|
+
* @example
|
|
139
|
+
* ```tsx
|
|
140
|
+
* import { AIButton } from '@payfit/unity-components/ai-kit'
|
|
141
|
+
*
|
|
142
|
+
* export function DraftContractButton() {
|
|
143
|
+
* return (
|
|
144
|
+
* <AIButton
|
|
145
|
+
* onPress={() => undefined}
|
|
146
|
+
* prefixIcon="AIEditOutlined"
|
|
147
|
+
* variant="outlined"
|
|
148
|
+
* >
|
|
149
|
+
* Draft with AI
|
|
150
|
+
* </AIButton>
|
|
151
|
+
* )
|
|
152
|
+
* }
|
|
153
|
+
* ```
|
|
154
|
+
* @remarks
|
|
155
|
+
* - `AIButton` renders a native button through React Aria. It supports pointer,
|
|
156
|
+
* Enter, and Space activation. Prefix and suffix icons are decorative; use
|
|
157
|
+
* the text label to provide the accessible name.
|
|
158
|
+
* - `AIButton` applies a glowing, rotating gradient effect on hover and focus.
|
|
159
|
+
* For users with reduced motion activated, the rotation is disabled.
|
|
160
|
+
*/
|
|
161
|
+
export declare const AIButton: import('react').ForwardRefExoticComponent<Omit<AriaButtonProps, "style" | "children" | "className"> & {
|
|
162
|
+
/**
|
|
163
|
+
* Selects the AI button appearance.
|
|
164
|
+
* - `outlined` keeps a visible AI gradient border while idle.
|
|
165
|
+
* - `ghost` reveals the AI treatment during interaction.
|
|
166
|
+
* @default 'outlined'
|
|
167
|
+
*/
|
|
168
|
+
variant?: "outlined" | "ghost";
|
|
169
|
+
/**
|
|
170
|
+
* Controls the button density.
|
|
171
|
+
* - `default` uses the standard action size.
|
|
172
|
+
* - `compact` uses the dense action size.
|
|
173
|
+
* @default 'default'
|
|
174
|
+
*/
|
|
175
|
+
mode?: "default" | "compact";
|
|
176
|
+
/**
|
|
177
|
+
* Shows a spinner and disables the action while it is in progress.
|
|
178
|
+
* The label remains visible to preserve the button's accessible name.
|
|
179
|
+
* @default false
|
|
180
|
+
*/
|
|
181
|
+
isLoading?: boolean;
|
|
182
|
+
/**
|
|
183
|
+
* Sets the accessible label announced by the loading spinner.
|
|
184
|
+
* @default The translated Unity loading label.
|
|
185
|
+
*/
|
|
186
|
+
loadingLabel?: string;
|
|
187
|
+
/** Renders a Unity icon before the label. */
|
|
188
|
+
prefixIcon?: UnityIcon;
|
|
189
|
+
/** Renders a Unity icon after the label. */
|
|
190
|
+
suffixIcon?: UnityIcon;
|
|
191
|
+
/**
|
|
192
|
+
* Truncates the visible label after the specified number of characters.
|
|
193
|
+
* The complete label remains available to assistive technology.
|
|
194
|
+
*/
|
|
195
|
+
truncateLabelLength?: number;
|
|
196
|
+
} & {
|
|
197
|
+
children?: import('react').ReactNode | undefined;
|
|
198
|
+
} & import('react').RefAttributes<HTMLButtonElement>>;
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import { Icon as e } from "../../../../components/icon/Icon.js";
|
|
2
|
+
import { Spinner as t } from "../../../../components/spinner/Spinner.js";
|
|
3
|
+
import { buttonBase as n } from "../../../../components/button/Button.variants.js";
|
|
4
|
+
import { aiGradientEffect as r, aiGradientSurfaceEffect as i } from "../../utils/ai-gradient-effect.js";
|
|
5
|
+
import { forwardRef as a, useMemo as o } from "react";
|
|
6
|
+
import { uyTv as s } from "@payfit/unity-themes";
|
|
7
|
+
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
8
|
+
import { useIntl as u } from "react-intl";
|
|
9
|
+
import { Button as d } from "react-aria-components/Button";
|
|
10
|
+
//#region src/modules/ai-kit/components/ai-button/AIButton.tsx
|
|
11
|
+
var f = s({
|
|
12
|
+
extend: n,
|
|
13
|
+
base: ["uy:relative uy:isolate uy:border-2 uy:border-transparent", "uy:[--uy-ai-gradient-effect-surface-radius:var(--uy-radius-75)] uy:sm:[--uy-ai-gradient-effect-surface-radius:var(--uy-radius-50)]"],
|
|
14
|
+
variants: {
|
|
15
|
+
variant: {
|
|
16
|
+
outlined: [
|
|
17
|
+
"uy:text-content-neutral-enabled",
|
|
18
|
+
"uy:enabled:data-[hovered=\"true\"]:text-content-neutral-hover",
|
|
19
|
+
"uy:enabled:active:text-content-neutral-active",
|
|
20
|
+
"uy:enabled:data-[pressed=\"true\"]:text-content-neutral-pressed",
|
|
21
|
+
"uy:enabled:data-[focus-visible=\"true\"]:text-content-neutral-focus"
|
|
22
|
+
],
|
|
23
|
+
ghost: [
|
|
24
|
+
"uy:bg-transparent uy:text-content-neutral-enabled",
|
|
25
|
+
"uy:enabled:data-[hovered=\"true\"]:text-content-neutral-hover",
|
|
26
|
+
"uy:enabled:active:text-content-neutral-active",
|
|
27
|
+
"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" })
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
isDisabled: !0,
|
|
51
|
+
variant: "outlined",
|
|
52
|
+
className: "uy:disabled:border-1 uy:disabled:border-border-neutral-high-disabled uy:data-[loading]:border-1 uy:data-[loading]:border-border-neutral-high-disabled"
|
|
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
|
+
}
|
|
72
|
+
},
|
|
73
|
+
compoundVariants: [
|
|
74
|
+
{
|
|
75
|
+
isDisabled: !1,
|
|
76
|
+
variant: "outlined",
|
|
77
|
+
className: i()
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
isDisabled: !1,
|
|
81
|
+
variant: "ghost",
|
|
82
|
+
className: i()
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
isDisabled: !0,
|
|
86
|
+
variant: "outlined",
|
|
87
|
+
className: "uy:inset-0 uy:bg-surface-neutral-disabled"
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
isDisabled: !0,
|
|
91
|
+
variant: "ghost",
|
|
92
|
+
className: "uy:bg-surface-neutral-disabled"
|
|
93
|
+
}
|
|
94
|
+
],
|
|
95
|
+
defaultVariants: {
|
|
96
|
+
isDisabled: !1,
|
|
97
|
+
variant: "outlined"
|
|
98
|
+
}
|
|
99
|
+
}), m = (n, r, i) => n ? /* @__PURE__ */ c(t, {
|
|
100
|
+
size: "small",
|
|
101
|
+
color: "inherit",
|
|
102
|
+
label: r
|
|
103
|
+
}) : i ? /* @__PURE__ */ c(e, {
|
|
104
|
+
"aria-hidden": "true",
|
|
105
|
+
color: "inherit",
|
|
106
|
+
"data-unity-icon": "prefix",
|
|
107
|
+
role: "presentation",
|
|
108
|
+
size: 20,
|
|
109
|
+
src: i
|
|
110
|
+
}) : null, h = a(({ children: t, isDisabled: n = !1, isLoading: r = !1, loadingLabel: i, mode: a, prefixIcon: s, suffixIcon: h, truncateLabelLength: g, variant: _, ...v }, y) => {
|
|
111
|
+
let b = u(), x = n || r, S = (i?.trim() ? i : void 0) ?? b.formatMessage({
|
|
112
|
+
id: "unity:component:common:loading:label",
|
|
113
|
+
defaultMessage: "Loading..."
|
|
114
|
+
}), C = o(() => f({
|
|
115
|
+
isDisabled: x,
|
|
116
|
+
isLoading: r,
|
|
117
|
+
mode: a === "compact" ? "compact" : "default",
|
|
118
|
+
size: "default",
|
|
119
|
+
variant: _
|
|
120
|
+
}), [
|
|
121
|
+
x,
|
|
122
|
+
r,
|
|
123
|
+
a,
|
|
124
|
+
_
|
|
125
|
+
]);
|
|
126
|
+
return /* @__PURE__ */ l(d, {
|
|
127
|
+
...v,
|
|
128
|
+
ref: y,
|
|
129
|
+
"data-dd-privacy": "allow",
|
|
130
|
+
"data-loading": r || void 0,
|
|
131
|
+
isDisabled: n,
|
|
132
|
+
isPending: r,
|
|
133
|
+
className: C,
|
|
134
|
+
children: [/* @__PURE__ */ c("span", {
|
|
135
|
+
"aria-hidden": "true",
|
|
136
|
+
className: p({
|
|
137
|
+
isDisabled: x,
|
|
138
|
+
variant: _
|
|
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",
|
|
143
|
+
children: [
|
|
144
|
+
m(r, S, s),
|
|
145
|
+
g && g > 0 ? /* @__PURE__ */ c("span", {
|
|
146
|
+
style: { "--uy-button-label-truncation-length": `${g}ch` },
|
|
147
|
+
className: "uy:truncate uy:min-w-0 uy:w-(--uy-button-label-truncation-length)",
|
|
148
|
+
children: t
|
|
149
|
+
}) : t,
|
|
150
|
+
h && /* @__PURE__ */ c(e, {
|
|
151
|
+
"aria-hidden": "true",
|
|
152
|
+
color: "inherit",
|
|
153
|
+
"data-unity-icon": "suffix",
|
|
154
|
+
role: "presentation",
|
|
155
|
+
size: 20,
|
|
156
|
+
src: h
|
|
157
|
+
})
|
|
158
|
+
]
|
|
159
|
+
})]
|
|
160
|
+
});
|
|
161
|
+
});
|
|
162
|
+
h.displayName = "AIButton";
|
|
163
|
+
//#endregion
|
|
164
|
+
export { h as AIButton, f as aiButton };
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Adds the animated PayFit AI gradient treatment to an enabled interactive
|
|
3
|
+
* host without requiring decorative markup.
|
|
4
|
+
*
|
|
5
|
+
* The host must be `uy:relative`, `uy:isolate`, and `uy:group`; its opaque
|
|
6
|
+
* surface must be layered above the pseudo-elements. Set
|
|
7
|
+
* `--uy-ai-gradient-effect-surface-radius` to the surface's actual corner
|
|
8
|
+
* radius. This utility expands that radius for its layers so their curvature
|
|
9
|
+
* stays aligned when they extend outside the surface.
|
|
10
|
+
*
|
|
11
|
+
* `::before` is the low-opacity, blurred glow. It extends by `spacing-100`
|
|
12
|
+
* around the host and becomes visible on hover and focus-visible. `::after`
|
|
13
|
+
* is the sharp gradient border: outlined controls show a resting border,
|
|
14
|
+
* hover and focus-visible expand it to 2px, and pressed contracts it to 1px.
|
|
15
|
+
* Both layers read `--uy-ai-gradient-angle`; the `gradient-rotate` animation
|
|
16
|
+
* updates that typed custom property, so the gradient continues rotating when
|
|
17
|
+
* a hover or focus-visible interaction becomes pressed.
|
|
18
|
+
*
|
|
19
|
+
* Apply this utility only while the host is enabled. Disabled and loading
|
|
20
|
+
* controls must provide their own non-animated border and surface tokens.
|
|
21
|
+
* Pair it with {@link aiGradientSurfaceEffect} on the opaque surface for the
|
|
22
|
+
* 6% interior overlay.
|
|
23
|
+
* @example
|
|
24
|
+
* ```tsx
|
|
25
|
+
* const aiAction = uyTv({
|
|
26
|
+
* base: [
|
|
27
|
+
* 'uy:relative uy:isolate uy:group uy:border-2 uy:border-transparent',
|
|
28
|
+
* 'uy:[--uy-ai-gradient-effect-surface-radius:var(--uy-radius-75)]',
|
|
29
|
+
* ],
|
|
30
|
+
* compoundVariants: [
|
|
31
|
+
* {
|
|
32
|
+
* isDisabled: false,
|
|
33
|
+
* className: aiGradientEffect({ variant: 'outlined' }),
|
|
34
|
+
* },
|
|
35
|
+
* ],
|
|
36
|
+
* })
|
|
37
|
+
*
|
|
38
|
+
* const aiActionSurface = uyTv({
|
|
39
|
+
* base: [
|
|
40
|
+
* 'uy:absolute uy:z-10 uy:rounded-[var(--uy-ai-gradient-effect-surface-radius)]',
|
|
41
|
+
* 'uy:bg-surface-neutral',
|
|
42
|
+
* ],
|
|
43
|
+
* compoundVariants: [
|
|
44
|
+
* {
|
|
45
|
+
* isDisabled: false,
|
|
46
|
+
* className: aiGradientSurfaceEffect(),
|
|
47
|
+
* },
|
|
48
|
+
* ],
|
|
49
|
+
* })
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
export declare const aiGradientEffect: import('tailwind-variants').TVReturnType<{
|
|
53
|
+
variant: {
|
|
54
|
+
outlined: "uy:after:opacity-100";
|
|
55
|
+
ghost: "";
|
|
56
|
+
};
|
|
57
|
+
}, undefined, string[], {
|
|
58
|
+
variant: {
|
|
59
|
+
outlined: "uy:after:opacity-100";
|
|
60
|
+
ghost: "";
|
|
61
|
+
};
|
|
62
|
+
}, undefined, import('tailwind-variants').TVReturnTypeLike<{
|
|
63
|
+
variant: {
|
|
64
|
+
outlined: "uy:after:opacity-100";
|
|
65
|
+
ghost: "";
|
|
66
|
+
};
|
|
67
|
+
}, undefined>>;
|
|
68
|
+
/**
|
|
69
|
+
* Adds the 6% PayFit AI gradient overlay for hovered, active, and pressed
|
|
70
|
+
* states of an enabled surface.
|
|
71
|
+
*
|
|
72
|
+
* Apply it to the opaque surface layered above {@link aiGradientEffect}. It
|
|
73
|
+
* deliberately does not set a resting or disabled background: the consuming
|
|
74
|
+
* component owns those surface tokens and must only apply this utility while
|
|
75
|
+
* enabled.
|
|
76
|
+
*/
|
|
77
|
+
export declare const aiGradientSurfaceEffect: import('tailwind-variants').TVReturnType<{} | {} | {}, undefined, string[], {} | {}, undefined, import('tailwind-variants').TVReturnTypeLike<unknown, undefined>>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { uyTv as e } from "@payfit/unity-themes";
|
|
2
|
+
//#region src/modules/ai-kit/utils/ai-gradient-effect.ts
|
|
3
|
+
var t = e({
|
|
4
|
+
base: [
|
|
5
|
+
"uy:[--uy-ai-gradient-angle:45deg] uy:transition-all",
|
|
6
|
+
"uy:before:content-[''] uy:before:pointer-events-none uy:before:absolute uy:before:-inset-100 uy:before:z-0 uy:before:rounded-[calc(var(--uy-ai-gradient-effect-surface-radius)+var(--uy-spacing-100))] uy:before:opacity-0 uy:before:blur-sm uy:before:[background:linear-gradient(var(--uy-ai-gradient-angle),var(--uy-gradient-payfit-ai))]",
|
|
7
|
+
"uy:after:content-[''] uy:after:pointer-events-none uy:after:absolute uy:after:-inset-[2px] uy:after:z-0 uy:after:rounded-[calc(var(--uy-ai-gradient-effect-surface-radius)+1px)] uy:after:opacity-0 uy:after:[background:linear-gradient(var(--uy-ai-gradient-angle),var(--uy-gradient-payfit-ai))]",
|
|
8
|
+
"uy:motion-safe:enabled:data-[hovered=\"true\"]:animate-gradient-rotate uy:motion-safe:enabled:data-[focus-visible=\"true\"]:animate-gradient-rotate",
|
|
9
|
+
"uy:enabled:data-[hovered=\"true\"]:before:opacity-10 uy:enabled:data-[focus-visible=\"true\"]:before:opacity-10",
|
|
10
|
+
"uy:enabled:data-[hovered=\"true\"]:after:opacity-100 uy:enabled:data-[focus-visible=\"true\"]:after:opacity-100 uy:enabled:data-[pressed=\"true\"]:after:opacity-100",
|
|
11
|
+
"uy:enabled:data-[pressed=\"true\"]:after:-inset-px",
|
|
12
|
+
"uy:enabled:data-[hovered=\"true\"]:after:rounded-[calc(var(--uy-ai-gradient-effect-surface-radius)+2px)] uy:enabled:data-[pressed=\"true\"]:after:rounded-[calc(var(--uy-ai-gradient-effect-surface-radius)+2px)] uy:enabled:data-[focus-visible=\"true\"]:after:rounded-[calc(var(--uy-ai-gradient-effect-surface-radius)+2px)]"
|
|
13
|
+
],
|
|
14
|
+
variants: { variant: {
|
|
15
|
+
outlined: "uy:after:opacity-100",
|
|
16
|
+
ghost: ""
|
|
17
|
+
} },
|
|
18
|
+
defaultVariants: { variant: "outlined" }
|
|
19
|
+
}), n = e({ base: [
|
|
20
|
+
"uy:group-data-[hovered=\"true\"]:[background:linear-gradient(45deg,color-mix(in_srgb,var(--uy-color-yellow-l5)_6%,transparent),color-mix(in_srgb,var(--uy-color-plum-l5)_6%,transparent),color-mix(in_srgb,var(--uy-color-blue-l4)_6%,transparent)),var(--uy-color-surface-neutral)]",
|
|
21
|
+
"uy:group-active:[background:linear-gradient(45deg,color-mix(in_srgb,var(--uy-color-yellow-l5)_6%,transparent),color-mix(in_srgb,var(--uy-color-plum-l5)_6%,transparent),color-mix(in_srgb,var(--uy-color-blue-l4)_6%,transparent)),var(--uy-color-surface-neutral)]",
|
|
22
|
+
"uy:group-data-[pressed=\"true\"]:[background:linear-gradient(45deg,color-mix(in_srgb,var(--uy-color-yellow-l5)_6%,transparent),color-mix(in_srgb,var(--uy-color-plum-l5)_6%,transparent),color-mix(in_srgb,var(--uy-color-blue-l4)_6%,transparent)),var(--uy-color-surface-neutral)]"
|
|
23
|
+
] });
|
|
24
|
+
//#endregion
|
|
25
|
+
export { t as aiGradientEffect, n as aiGradientSurfaceEffect };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@payfit/unity-components",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.68.1",
|
|
4
4
|
"module": "./dist/esm/index.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -37,6 +37,18 @@
|
|
|
37
37
|
"default": "./dist/esm/integrations/tanstack-router.js"
|
|
38
38
|
}
|
|
39
39
|
},
|
|
40
|
+
"./ai-kit": {
|
|
41
|
+
"import": {
|
|
42
|
+
"hrAppsLocalDev": "./src/modules/ai-kit/index.ts",
|
|
43
|
+
"types": "./dist/esm/modules/ai-kit/index.d.ts",
|
|
44
|
+
"default": "./dist/esm/ai-kit.js"
|
|
45
|
+
},
|
|
46
|
+
"module-sync": {
|
|
47
|
+
"types": "./dist/esm/modules/ai-kit/index.d.ts",
|
|
48
|
+
"hrAppsLocalDev": "./dist/esm/ai-kit.js",
|
|
49
|
+
"default": "./dist/esm/ai-kit.js"
|
|
50
|
+
}
|
|
51
|
+
},
|
|
40
52
|
"./testing-utils/storybook": {
|
|
41
53
|
"import": {
|
|
42
54
|
"hrAppsLocalDev": "./src/index.storybook-testing.ts",
|
|
@@ -65,7 +77,7 @@
|
|
|
65
77
|
"@hookform/resolvers": "5.2.1",
|
|
66
78
|
"@internationalized/date": "3.12.4",
|
|
67
79
|
"minimatch": "10.2.5",
|
|
68
|
-
"@payfit/unity-illustrations": "2.
|
|
80
|
+
"@payfit/unity-illustrations": "2.68.1",
|
|
69
81
|
"@radix-ui/react-avatar": "1.2.6",
|
|
70
82
|
"@radix-ui/react-slot": "1.3.3",
|
|
71
83
|
"@react-aria/interactions": "3.28.1",
|
|
@@ -100,8 +112,8 @@
|
|
|
100
112
|
},
|
|
101
113
|
"peerDependencies": {
|
|
102
114
|
"@hookform/devtools": "^4",
|
|
103
|
-
"@payfit/unity-icons": "2.
|
|
104
|
-
"@payfit/unity-themes": "2.
|
|
115
|
+
"@payfit/unity-icons": "2.68.1",
|
|
116
|
+
"@payfit/unity-themes": "2.68.1",
|
|
105
117
|
"@storybook/react-vite": "^10",
|
|
106
118
|
"@tanstack/react-query": "^5",
|
|
107
119
|
"@tanstack/react-router": "^1.131",
|
|
@@ -121,9 +133,9 @@
|
|
|
121
133
|
"@payfit/storybook-addon-console-errors": "0.0.0-use.local",
|
|
122
134
|
"@payfit/storybook-addon-datadog-rum": "0.0.0-use.local",
|
|
123
135
|
"@payfit/storybook-config": "0.0.0-use.local",
|
|
124
|
-
"@payfit/unity-icons": "2.
|
|
125
|
-
"@payfit/unity-illustrations": "2.
|
|
126
|
-
"@payfit/unity-themes": "2.
|
|
136
|
+
"@payfit/unity-icons": "2.68.1",
|
|
137
|
+
"@payfit/unity-illustrations": "2.68.1",
|
|
138
|
+
"@payfit/unity-themes": "2.68.1",
|
|
127
139
|
"@payfit/vite-configs": "0.0.0-use.local",
|
|
128
140
|
"@storybook/addon-a11y": "10.5.8",
|
|
129
141
|
"@storybook/addon-designs": "11.1.4",
|
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
{
|
|
2
2
|
"components": [
|
|
3
|
+
{
|
|
4
|
+
"description": "Triggers AI-assisted actions with a dedicated outlined or ghost treatment.",
|
|
5
|
+
"docsHref": "?path=/docs/ai-kit-ai-button--docs",
|
|
6
|
+
"id": "ai-kit-ai-button",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"ai",
|
|
9
|
+
"agent",
|
|
10
|
+
"action",
|
|
11
|
+
"button",
|
|
12
|
+
"AI action button",
|
|
13
|
+
"Agent action button"
|
|
14
|
+
],
|
|
15
|
+
"preview": {
|
|
16
|
+
"type": "story",
|
|
17
|
+
"story": "default",
|
|
18
|
+
"storyId": "ai-kit-ai-button--default"
|
|
19
|
+
},
|
|
20
|
+
"related": [],
|
|
21
|
+
"section": "components",
|
|
22
|
+
"tags": [
|
|
23
|
+
"type:component",
|
|
24
|
+
"category:actions"
|
|
25
|
+
],
|
|
26
|
+
"title": "AI Button"
|
|
27
|
+
},
|
|
3
28
|
{
|
|
4
29
|
"description": "Groups high-priority page actions in a responsive toolbar for bulk or contextual workflows.",
|
|
5
30
|
"docsHref": "?path=/docs/component-reference-actionbar--docs",
|