@payfit/unity-components 2.64.4 → 2.64.6
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/components/actionable/Actionable.js +21 -20
- package/dist/esm/components/avatar/Avatar.js +22 -22
- package/dist/esm/components/avatar/AvatarWithTooltip.d.ts +46 -0
- package/dist/esm/components/avatar/AvatarWithTooltip.js +39 -0
- package/dist/esm/components/avatar/InteractiveAvatar.d.ts +65 -0
- package/dist/esm/components/avatar/InteractiveAvatar.js +39 -0
- package/dist/esm/components/avatar/parts/AvatarPair.js +1 -1
- package/dist/esm/components/avatar-group/AvatarGroup.context.d.ts +10 -0
- package/dist/esm/components/avatar-group/AvatarGroup.context.js +18 -0
- package/dist/esm/components/avatar-group/AvatarGroup.d.ts +60 -0
- package/dist/esm/components/avatar-group/AvatarGroup.js +60 -0
- package/dist/esm/components/avatar-group/AvatarGroup.variants.d.ts +32 -0
- package/dist/esm/components/avatar-group/AvatarGroup.variants.js +19 -0
- package/dist/esm/components/avatar-group/figma/AvatarGroup.figma.d.ts +10 -0
- package/dist/esm/components/avatar-group/parts/AvatarGroupCount.d.ts +54 -0
- package/dist/esm/components/avatar-group/parts/AvatarGroupCount.js +38 -0
- package/dist/esm/components/carousel/parts/CarouselContent.js +3 -3
- package/dist/esm/components/segmented-button-group/parts/ToggleButton.js +14 -14
- package/dist/esm/components/selectable-button-group/parts/SelectableButton.js +10 -10
- package/dist/esm/components/skeleton/Skeleton.d.ts +90 -0
- package/dist/esm/components/skeleton/Skeleton.js +47 -0
- package/dist/esm/components/skeleton/figma/SkeletonRectangular.figma.d.ts +7 -0
- package/dist/esm/components/skeleton/figma/SkeletonText.figma.d.ts +7 -0
- package/dist/esm/index.d.ts +6 -1
- package/dist/esm/index.js +204 -199
- package/i18n/fr-FR.json +1 -0
- package/package.json +10 -10
- package/src/agent-references/component-catalog.json +82 -0
- /package/dist/esm/components/{collapsible-group/figma/CollapsibleGroup.figma.d.ts → skeleton/figma/SkeletonCircular.figma.d.ts} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { useResponsiveValue as e } from "../../../hooks/use-responsive-value.js";
|
|
2
|
+
import { useCarousel as t } from "../Carousel.context.js";
|
|
3
3
|
import { useEffect as n, useState as r } from "react";
|
|
4
4
|
import { uyTv as i } from "@payfit/unity-themes";
|
|
5
5
|
import { jsx as a } from "react/jsx-runtime";
|
|
@@ -16,7 +16,7 @@ var o = i({ slots: {
|
|
|
16
16
|
]
|
|
17
17
|
} });
|
|
18
18
|
function s({ className: i, children: s, itemsPerPage: c, gap: l, trackPadding: u, trackOffset: d = 0 }) {
|
|
19
|
-
let { carouselRef: f, a11yIds: p, api: m } =
|
|
19
|
+
let { carouselRef: f, a11yIds: p, api: m } = t(), { root: h, track: g } = o(), [_, v] = r(!1), y = e(c), b = e(l), x = e(d), S = e(u?.start), C = e(u?.end);
|
|
20
20
|
return n(() => {
|
|
21
21
|
if (!m) return;
|
|
22
22
|
let e = () => {
|
|
@@ -3,11 +3,11 @@ import { Spinner as t } from "../../spinner/Spinner.js";
|
|
|
3
3
|
import { SegmentedButtonGroupContext as n } from "../SegmentedButtonGroups.context.js";
|
|
4
4
|
import { forwardRef as r, useContext as i, useRef as a } from "react";
|
|
5
5
|
import { uyTv as o } from "@payfit/unity-themes";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
6
|
+
import { useFocusRing as s } from "react-aria/useFocusRing";
|
|
7
|
+
import { Fragment as c, jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
8
|
+
import { useIntl as d } from "react-intl";
|
|
9
|
+
import { mergeProps as f } from "react-aria/mergeProps";
|
|
10
|
+
import { useRadio as p } from "react-aria/useRadioGroup";
|
|
11
11
|
import { VisuallyHidden as m } from "react-aria/VisuallyHidden";
|
|
12
12
|
//#region src/components/segmented-button-group/parts/ToggleButton.tsx
|
|
13
13
|
var h = o({
|
|
@@ -62,40 +62,40 @@ var h = o({
|
|
|
62
62
|
isLoading: !1,
|
|
63
63
|
hasPrefixIcon: !1
|
|
64
64
|
}
|
|
65
|
-
}), g = ({ intl: n, children: r, isLoading: i, prefixIcon: a, isSelected: o }) => i ? /* @__PURE__ */
|
|
65
|
+
}), g = ({ intl: n, children: r, isLoading: i, prefixIcon: a, isSelected: o }) => i ? /* @__PURE__ */ l(t, {
|
|
66
66
|
label: n.formatMessage({
|
|
67
67
|
id: "unity:component:common:loading:label",
|
|
68
68
|
defaultMessage: "Loading..."
|
|
69
69
|
}),
|
|
70
70
|
color: "inherit",
|
|
71
71
|
size: "small"
|
|
72
|
-
}) : /* @__PURE__ */
|
|
72
|
+
}) : /* @__PURE__ */ u(c, { children: [a ? /* @__PURE__ */ l(e, {
|
|
73
73
|
src: o ? `${a}Filled` : `${a}Outlined`,
|
|
74
74
|
color: o ? "content.neutral" : "content.neutral.low",
|
|
75
75
|
role: "presentation"
|
|
76
76
|
}) : null, r] }), _ = r((e, t) => {
|
|
77
|
-
let { children: r, value: o, prefixIcon:
|
|
77
|
+
let { children: r, value: o, prefixIcon: c, isLoading: _ } = e, { state: v } = i(n), y = a(null), { inputProps: b } = p(e, v, y), { focusProps: x, isFocusVisible: S } = s(), C = d(), w = v.selectedValue === o, { base: T, wrapper: E } = h({
|
|
78
78
|
isSelected: w,
|
|
79
|
-
hasPrefixIcon: !!
|
|
79
|
+
hasPrefixIcon: !!c,
|
|
80
80
|
isLoading: _,
|
|
81
81
|
isFocusVisible: S
|
|
82
82
|
});
|
|
83
|
-
return /* @__PURE__ */
|
|
83
|
+
return /* @__PURE__ */ u("label", {
|
|
84
84
|
ref: t,
|
|
85
85
|
className: T(),
|
|
86
86
|
"aria-disabled": _,
|
|
87
|
-
children: [/* @__PURE__ */
|
|
88
|
-
...
|
|
87
|
+
children: [/* @__PURE__ */ l(m, { children: /* @__PURE__ */ l("input", {
|
|
88
|
+
...f(b, x),
|
|
89
89
|
ref: y,
|
|
90
90
|
disabled: _
|
|
91
|
-
}) }), /* @__PURE__ */
|
|
91
|
+
}) }), /* @__PURE__ */ l("span", {
|
|
92
92
|
className: E(),
|
|
93
93
|
children: g({
|
|
94
94
|
intl: C,
|
|
95
95
|
children: r,
|
|
96
96
|
isLoading: _,
|
|
97
97
|
isSelected: w,
|
|
98
|
-
prefixIcon:
|
|
98
|
+
prefixIcon: c
|
|
99
99
|
})
|
|
100
100
|
})]
|
|
101
101
|
});
|
|
@@ -3,9 +3,9 @@ import { Spinner as t } from "../../spinner/Spinner.js";
|
|
|
3
3
|
import { SelectableButtonGroupContext as n } from "../SelectableButtonGroup.context.js";
|
|
4
4
|
import { forwardRef as r, useCallback as i, useContext as a, useRef as o } from "react";
|
|
5
5
|
import { uyTv as s } from "@payfit/unity-themes";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
6
|
+
import { useFocusRing as c } from "react-aria/useFocusRing";
|
|
7
|
+
import { Fragment as l, jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
8
|
+
import { mergeProps as f } from "react-aria/mergeProps";
|
|
9
9
|
import { useToggleButtonGroupItem as p } from "react-aria/useToggleButtonGroup";
|
|
10
10
|
import { useHover as m } from "react-aria/useHover";
|
|
11
11
|
//#region src/components/selectable-button-group/parts/SelectableButton.tsx
|
|
@@ -43,12 +43,12 @@ var h = s({
|
|
|
43
43
|
let { buttonProps: v, isPressed: y, isSelected: b } = p({
|
|
44
44
|
id: r.value,
|
|
45
45
|
...r
|
|
46
|
-
}, _, g), { isDisabled: x = !1, isLoading: S = !1, prefixIcon: C, children: w } = r, { hoverProps: T, isHovered: E } = m({ isDisabled: x || S }), { isFocusVisible: D, focusProps: O } =
|
|
46
|
+
}, _, g), { isDisabled: x = !1, isLoading: S = !1, prefixIcon: C, children: w } = r, { hoverProps: T, isHovered: E } = m({ isDisabled: x || S }), { isFocusVisible: D, focusProps: O } = c(), k = i((e) => {
|
|
47
47
|
g.current = e, typeof s == "function" ? s(e) : s && (s.current = e);
|
|
48
48
|
}, [s]), { base: A, icon: j, label: M } = h({ hasIcon: !!C && !S });
|
|
49
|
-
return /* @__PURE__ */
|
|
49
|
+
return /* @__PURE__ */ d("button", {
|
|
50
50
|
"data-dd-privacy": "allow",
|
|
51
|
-
...
|
|
51
|
+
...f(v, T, O),
|
|
52
52
|
ref: k,
|
|
53
53
|
className: A({ className: r.className }),
|
|
54
54
|
disabled: v.disabled || x || S,
|
|
@@ -58,19 +58,19 @@ var h = s({
|
|
|
58
58
|
"data-focus-visible": D || void 0,
|
|
59
59
|
"data-selected": b,
|
|
60
60
|
"aria-busy": S,
|
|
61
|
-
children: [C && !S && /* @__PURE__ */
|
|
61
|
+
children: [C && !S && /* @__PURE__ */ u(e, {
|
|
62
62
|
src: b ? `${C}Filled` : `${C}Outlined`,
|
|
63
63
|
role: "presentation",
|
|
64
64
|
className: j(),
|
|
65
65
|
size: 20
|
|
66
|
-
}), S ? /* @__PURE__ */
|
|
66
|
+
}), S ? /* @__PURE__ */ d(l, { children: [/* @__PURE__ */ u(t, {
|
|
67
67
|
label: "Loading",
|
|
68
68
|
size: "small",
|
|
69
69
|
color: "inherit"
|
|
70
|
-
}), /* @__PURE__ */
|
|
70
|
+
}), /* @__PURE__ */ u("span", {
|
|
71
71
|
className: "uy:sr-only",
|
|
72
72
|
children: w
|
|
73
|
-
})] }) : /* @__PURE__ */
|
|
73
|
+
})] }) : /* @__PURE__ */ u("span", {
|
|
74
74
|
className: M(),
|
|
75
75
|
children: w
|
|
76
76
|
})]
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { HTMLAttributes } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Unity typography styles that `Skeleton` can mirror when `variant="text"`.
|
|
4
|
+
* Use the same style as the content that the placeholder will replace so its
|
|
5
|
+
* line height and vertical rhythm remain stable while data loads.
|
|
6
|
+
*/
|
|
7
|
+
export type SkeletonTextVariant = 'displayHeading' | 'h1' | 'h2' | 'h3' | 'h4' | 'overline' | 'subtitle' | 'displayTitle' | 'displayBody' | 'body' | 'bodyStrong' | 'bodySmall' | 'bodySmallStrong' | 'bodyLarge' | 'bodyLargeStrong' | 'action' | 'actionLarge' | 'actionSmall' | 'actionInfo';
|
|
8
|
+
type SkeletonBaseProps = Omit<HTMLAttributes<HTMLDivElement>, 'aria-hidden'> & {
|
|
9
|
+
'aria-hidden'?: boolean;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Props for {@link Skeleton}.
|
|
13
|
+
* Set `variant="text"` to expose the optional `textVariant` prop. Rectangular
|
|
14
|
+
* and circular placeholders intentionally reject `textVariant` so consumers
|
|
15
|
+
* cannot accidentally apply typography styles to non-text shapes.
|
|
16
|
+
* @property variant - Selects `rectangular`, `circular`, or `text`; defaults to
|
|
17
|
+
* `rectangular`.
|
|
18
|
+
* @property textVariant - Selects the Unity typography style for a text
|
|
19
|
+
* skeleton. It has an effect only when `variant="text"`.
|
|
20
|
+
* @property className - Adds layout and sizing classes. Use `uy:w-*` and
|
|
21
|
+
* `uy:h-*` for rectangular placeholders, `uy:size-*` for circular
|
|
22
|
+
* placeholders, and `ch`-based width classes such as `uy:w-[24ch]` for text.
|
|
23
|
+
* @property aria-hidden - Hides the placeholder from assistive technologies;
|
|
24
|
+
* defaults to `true` because the shape is normally decorative.
|
|
25
|
+
* @see {@link SkeletonTextVariant} for the available text styles.
|
|
26
|
+
*/
|
|
27
|
+
export type SkeletonProps = SkeletonBaseProps & ({
|
|
28
|
+
variant?: 'rectangular' | 'circular';
|
|
29
|
+
textVariant?: never;
|
|
30
|
+
} | {
|
|
31
|
+
variant: 'text';
|
|
32
|
+
textVariant?: SkeletonTextVariant;
|
|
33
|
+
});
|
|
34
|
+
/**
|
|
35
|
+
* Reserves the shape and rhythm of content while its data loads.
|
|
36
|
+
* Use `Skeleton` inside a stable layout when the final content dimensions are
|
|
37
|
+
* known but the content itself is not available yet. Choose a shape with
|
|
38
|
+
* `variant`, mirror text with `textVariant`, and pass explicit Unity sizing
|
|
39
|
+
* classes through `className`.
|
|
40
|
+
* @param props - Placeholder content, shape, typography, sizing, and HTML
|
|
41
|
+
* attributes.
|
|
42
|
+
* @param props.variant - Selects the placeholder shape. It defaults to
|
|
43
|
+
* `"rectangular"`; use `"circular"` for avatar-like content and `"text"` for
|
|
44
|
+
* typography-shaped content.
|
|
45
|
+
* @param props.textVariant - Selects the Unity typography style when
|
|
46
|
+
* `variant="text"`, such as `"h2"`, `"body"`, or `"bodySmallStrong"`.
|
|
47
|
+
* @param props.className - Supplies the dimensions and layout. Use
|
|
48
|
+
* `uy:w-*`/`uy:h-*` for rectangular shapes, `uy:size-*` for circular shapes,
|
|
49
|
+
* and `uy:w-[##ch]` for text widths that approximate the expected copy.
|
|
50
|
+
* `Skeleton` merges these classes with its generated visual styles so the
|
|
51
|
+
* variant's neutral background, animation, and shape treatment remain intact.
|
|
52
|
+
* @param props.aria-hidden - Defaults to `true` and keeps the decorative
|
|
53
|
+
* placeholder out of the accessibility tree. Set it to `false` only when the
|
|
54
|
+
* placeholder itself conveys information that users of assistive technology
|
|
55
|
+
* need to receive.
|
|
56
|
+
* @example
|
|
57
|
+
* ```tsx
|
|
58
|
+
* import { Skeleton } from '@payfit/unity-components'
|
|
59
|
+
*
|
|
60
|
+
* export function EmployeeCard({ isLoading }: { isLoading: boolean }) {
|
|
61
|
+
* return (
|
|
62
|
+
* <section aria-busy={isLoading} aria-label="Employee profile">
|
|
63
|
+
* {isLoading ? (
|
|
64
|
+
* <>
|
|
65
|
+
* <Skeleton variant="circular" className="uy:size-600" />
|
|
66
|
+
* <Skeleton
|
|
67
|
+
* variant="text"
|
|
68
|
+
* textVariant="h2"
|
|
69
|
+
* className="uy:w-[18ch]"
|
|
70
|
+
* />
|
|
71
|
+
* </>
|
|
72
|
+
* ) : (
|
|
73
|
+
* <h2>Ada Lovelace</h2>
|
|
74
|
+
* )}
|
|
75
|
+
* </section>
|
|
76
|
+
* )
|
|
77
|
+
* }
|
|
78
|
+
* ```
|
|
79
|
+
* @remarks
|
|
80
|
+
* Keep `Skeleton` itself decorative and expose loading semantics on the
|
|
81
|
+
* containing region with `aria-busy` and an accessible label. The component
|
|
82
|
+
* renders a `div` and forwards standard `HTMLAttributes<HTMLDivElement>` and
|
|
83
|
+
* its ref, so it does not provide interactive behavior or focus management.
|
|
84
|
+
* @see {@link SkeletonProps} for the complete prop contract.
|
|
85
|
+
* @see {@link SkeletonTextVariant} for text style values.
|
|
86
|
+
* @see [Figma component design](https://www.figma.com/design/poaMyU7abAgL9VRhx4ygyy/Unity-DS-%3E-Components-Library?node-id=22530-2318)
|
|
87
|
+
* @see [Zeroheight Skeleton documentation](https://www.payfit.design/24f360409/v/latest/p/87f013)
|
|
88
|
+
*/
|
|
89
|
+
export declare const Skeleton: import('react').ForwardRefExoticComponent<SkeletonProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
90
|
+
export {};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { forwardRef as e } from "react";
|
|
2
|
+
import { uyMerge as t, uyTv as n } from "@payfit/unity-themes";
|
|
3
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/skeleton/Skeleton.tsx
|
|
5
|
+
var i = n({
|
|
6
|
+
base: "uy:bg-surface-neutral-disabled uy:animate-pulse",
|
|
7
|
+
variants: {
|
|
8
|
+
variant: {
|
|
9
|
+
rectangular: "uy:rounded-50",
|
|
10
|
+
circular: "uy:rounded-circle",
|
|
11
|
+
text: "uy:inline-block uy:h-[1em] uy:my-[calc((1lh-1em)/2)] uy:rounded-50"
|
|
12
|
+
},
|
|
13
|
+
textVariant: {
|
|
14
|
+
displayHeading: "uy:typography-display-heading",
|
|
15
|
+
h1: "uy:typography-h1",
|
|
16
|
+
h2: "uy:typography-h2",
|
|
17
|
+
h3: "uy:typography-h3",
|
|
18
|
+
h4: "uy:typography-h4",
|
|
19
|
+
overline: "uy:typography-overline",
|
|
20
|
+
subtitle: "uy:typography-subtitle",
|
|
21
|
+
displayTitle: "uy:typography-display-title",
|
|
22
|
+
displayBody: "uy:typography-display-body",
|
|
23
|
+
body: "uy:typography-body",
|
|
24
|
+
bodyStrong: "uy:typography-body-strong",
|
|
25
|
+
bodySmall: "uy:typography-body-small",
|
|
26
|
+
bodySmallStrong: "uy:typography-body-small-strong",
|
|
27
|
+
bodyLarge: "uy:typography-body-large",
|
|
28
|
+
bodyLargeStrong: "uy:typography-body-large-strong",
|
|
29
|
+
action: "uy:typography-action",
|
|
30
|
+
actionLarge: "uy:typography-body-large",
|
|
31
|
+
actionSmall: "uy:typography-body-small",
|
|
32
|
+
actionInfo: "uy:typography-action uy:underline uy:decoration-dotted uy:decoration-[10%] uy:underline-offset-[25%]"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
defaultVariants: { variant: "rectangular" }
|
|
36
|
+
}), a = e(({ variant: e = "rectangular", textVariant: n, className: a, "aria-hidden": o = !0, ...s }, c) => /* @__PURE__ */ r("div", {
|
|
37
|
+
ref: c,
|
|
38
|
+
"aria-hidden": o,
|
|
39
|
+
className: t(a, i({
|
|
40
|
+
variant: e,
|
|
41
|
+
textVariant: n
|
|
42
|
+
})),
|
|
43
|
+
...s
|
|
44
|
+
}));
|
|
45
|
+
a.displayName = "Skeleton";
|
|
46
|
+
//#endregion
|
|
47
|
+
export { a as Skeleton };
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -20,10 +20,14 @@ export * from './components/autocomplete/Autocomplete.js';
|
|
|
20
20
|
export * from './components/autocomplete/parts/AutocompleteItem.js';
|
|
21
21
|
export * from './components/autocomplete/parts/AutocompleteItemGroup.js';
|
|
22
22
|
export * from './components/avatar/Avatar.js';
|
|
23
|
+
export * from './components/avatar/AvatarWithTooltip.js';
|
|
24
|
+
export * from './components/avatar/InteractiveAvatar.js';
|
|
23
25
|
export * from './components/avatar/parts/AvatarFallback.js';
|
|
24
26
|
export * from './components/avatar/parts/AvatarIcon.js';
|
|
25
27
|
export * from './components/avatar/parts/AvatarImage.js';
|
|
26
28
|
export * from './components/avatar/parts/AvatarPair.js';
|
|
29
|
+
export * from './components/avatar-group/AvatarGroup.js';
|
|
30
|
+
export * from './components/avatar-group/parts/AvatarGroupCount.js';
|
|
27
31
|
export * from './components/avatar/utils.js';
|
|
28
32
|
export * from './components/badge/Badge.js';
|
|
29
33
|
export * from './components/badge/parts/BadgeDot.js';
|
|
@@ -49,6 +53,7 @@ export * from './components/checkbox/CheckboxStandalone.js';
|
|
|
49
53
|
export * from './components/collapsible/Collapsible.js';
|
|
50
54
|
export * from './components/collapsible/parts/CollapsibleContent.js';
|
|
51
55
|
export * from './components/collapsible/parts/CollapsibleTitle.js';
|
|
56
|
+
export * from './components/collapsible-group/CollapsibleGroup.js';
|
|
52
57
|
export * from './components/data-table/DataTable.js';
|
|
53
58
|
export * from './components/data-table/parts/DataTableRoot.js';
|
|
54
59
|
export * from './components/data-table/parts/DataTableBulkActions.js';
|
|
@@ -157,6 +162,7 @@ export * from './components/radio-button-group/RadioButtonGroup.js';
|
|
|
157
162
|
export * from './components/radio-button-group/parts/RadioButton.js';
|
|
158
163
|
export * from './components/radio-button-group/parts/RadioButtonHelper.js';
|
|
159
164
|
export * from './components/search/Search.js';
|
|
165
|
+
export * from './components/skeleton/Skeleton.js';
|
|
160
166
|
export * from './components/segmented-button-group/SegmentedButtonGroup.js';
|
|
161
167
|
export * from './components/segmented-button-group/parts/ToggleButton.js';
|
|
162
168
|
export * from './components/selectable-button-group/SelectableButtonGroup.js';
|
|
@@ -238,4 +244,3 @@ export { useFieldA11yContext } from './components/form-field/TanstackFormField.c
|
|
|
238
244
|
export { fieldRevalidateLogic } from './utils/field-revalidate-logic.js';
|
|
239
245
|
export type { FieldRevalidateLogicProps } from './utils/field-revalidate-logic.js';
|
|
240
246
|
export * from './providers/router/RouterProvider.js';
|
|
241
|
-
export * from './components/collapsible-group/CollapsibleGroup.js';
|