@flipdish/ui-library 0.58.1 → 0.59.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/components/atoms/Badge/index.cjs +15 -59
- package/dist/components/atoms/Badge/index.cjs.map +1 -1
- package/dist/components/atoms/Badge/index.d.ts +22 -98
- package/dist/components/atoms/Badge/index.d.ts.map +1 -1
- package/dist/components/atoms/Badge/index.js +15 -59
- package/dist/components/atoms/Badge/index.js.map +1 -1
- package/dist/components/atoms/Badges/Badge/Badge.cjs +71 -0
- package/dist/components/atoms/Badges/Badge/Badge.cjs.map +1 -0
- package/dist/components/atoms/Badges/Badge/Badge.d.ts +99 -0
- package/dist/components/atoms/Badges/Badge/Badge.d.ts.map +1 -0
- package/dist/components/atoms/Badges/Badge/Badge.js +63 -0
- package/dist/components/atoms/Badges/Badge/Badge.js.map +1 -0
- package/dist/components/atoms/{Badge → Badges/Badge}/Badge.styles.cjs +1 -1
- package/dist/components/atoms/Badges/Badge/Badge.styles.cjs.map +1 -0
- package/dist/components/atoms/{Badge → Badges/Badge}/Badge.styles.d.ts +1 -1
- package/dist/components/atoms/Badges/Badge/Badge.styles.d.ts.map +1 -0
- package/dist/components/atoms/{Badge → Badges/Badge}/Badge.styles.js +1 -1
- package/dist/components/atoms/Badges/Badge/Badge.styles.js.map +1 -0
- package/dist/components/atoms/Badges/Badge/badge.types.cjs.map +1 -0
- package/dist/components/atoms/Badges/Badge/badge.types.d.ts.map +1 -0
- package/dist/components/atoms/Badges/Badge/badge.types.js.map +1 -0
- package/dist/components/atoms/{Badge → Badges/Badge/utilities}/badge.utils.d.ts +2 -2
- package/dist/components/atoms/Badges/Badge/utilities/badge.utils.d.ts.map +1 -0
- package/dist/components/atoms/Badges/BadgeGroup/BadgeGroup.cjs +116 -0
- package/dist/components/atoms/Badges/BadgeGroup/BadgeGroup.cjs.map +1 -0
- package/dist/components/atoms/Badges/BadgeGroup/BadgeGroup.d.ts +38 -0
- package/dist/components/atoms/Badges/BadgeGroup/BadgeGroup.d.ts.map +1 -0
- package/dist/components/atoms/Badges/BadgeGroup/BadgeGroup.js +114 -0
- package/dist/components/atoms/Badges/BadgeGroup/BadgeGroup.js.map +1 -0
- package/dist/components/atoms/Badges/index.cjs +16 -0
- package/dist/components/atoms/Badges/index.cjs.map +1 -0
- package/dist/components/atoms/Badges/index.d.ts +16 -0
- package/dist/components/atoms/Badges/index.d.ts.map +1 -0
- package/dist/components/atoms/Badges/index.js +3 -0
- package/dist/components/atoms/Badges/index.js.map +1 -0
- package/dist/components/forms/fields/FormRadioCardGroup/index.cjs +3 -3
- package/dist/components/forms/fields/FormRadioCardGroup/index.cjs.map +1 -1
- package/dist/components/forms/fields/FormRadioCardGroup/index.d.ts +3 -3
- package/dist/components/forms/fields/FormRadioCardGroup/index.d.ts.map +1 -1
- package/dist/components/forms/fields/FormRadioCardGroup/index.js +3 -3
- package/dist/components/layouts/PageHubLayout/components/PageHubLayoutSectionNav.cjs +2 -2
- package/dist/components/layouts/PageHubLayout/components/PageHubLayoutSectionNav.cjs.map +1 -1
- package/dist/components/layouts/PageHubLayout/components/PageHubLayoutSectionNav.js +1 -1
- package/dist/components/molecules/ActivityFeed/index.cjs +2 -2
- package/dist/components/molecules/ActivityFeed/index.cjs.map +1 -1
- package/dist/components/molecules/ActivityFeed/index.d.ts +1 -1
- package/dist/components/molecules/ActivityFeed/index.d.ts.map +1 -1
- package/dist/components/molecules/ActivityFeed/index.js +1 -1
- package/dist/components/molecules/BadgeGroup/index.cjs +3 -110
- package/dist/components/molecules/BadgeGroup/index.cjs.map +1 -1
- package/dist/components/molecules/BadgeGroup/index.d.ts +5 -37
- package/dist/components/molecules/BadgeGroup/index.d.ts.map +1 -1
- package/dist/components/molecules/BadgeGroup/index.js +3 -110
- package/dist/components/molecules/BadgeGroup/index.js.map +1 -1
- package/dist/components/molecules/RadioCards/RadioCardAvatar/RadioCardAvatar.cjs +37 -0
- package/dist/components/molecules/RadioCards/RadioCardAvatar/RadioCardAvatar.cjs.map +1 -0
- package/dist/components/molecules/RadioCards/RadioCardAvatar/RadioCardAvatar.d.ts +33 -0
- package/dist/components/molecules/RadioCards/RadioCardAvatar/RadioCardAvatar.d.ts.map +1 -0
- package/dist/components/molecules/RadioCards/RadioCardAvatar/RadioCardAvatar.js +35 -0
- package/dist/components/molecules/RadioCards/RadioCardAvatar/RadioCardAvatar.js.map +1 -0
- package/dist/components/molecules/{RadioGroup → RadioCards/RadioCardAvatar}/hooks/useCommitOnPress.cjs +1 -1
- package/dist/components/molecules/RadioCards/RadioCardAvatar/hooks/useCommitOnPress.cjs.map +1 -0
- package/dist/components/molecules/{RadioGroup → RadioCards/RadioCardAvatar}/hooks/useCommitOnPress.d.ts +6 -6
- package/dist/components/molecules/RadioCards/RadioCardAvatar/hooks/useCommitOnPress.d.ts.map +1 -0
- package/dist/components/molecules/{RadioGroup → RadioCards/RadioCardAvatar}/hooks/useCommitOnPress.js +1 -1
- package/dist/components/molecules/RadioCards/RadioCardAvatar/hooks/useCommitOnPress.js.map +1 -0
- package/dist/components/molecules/{RadioGroup/components/RadioGroupRadioButton.cjs → RadioCards/RadioCardBullet/RadioCardBullet.cjs} +3 -3
- package/dist/components/molecules/RadioCards/RadioCardBullet/RadioCardBullet.cjs.map +1 -0
- package/dist/components/molecules/{RadioGroup/components/RadioGroupRadioButton.d.ts → RadioCards/RadioCardBullet/RadioCardBullet.d.ts} +5 -5
- package/dist/components/molecules/RadioCards/RadioCardBullet/RadioCardBullet.d.ts.map +1 -0
- package/dist/components/molecules/{RadioGroup/components/RadioGroupRadioButton.js → RadioCards/RadioCardBullet/RadioCardBullet.js} +3 -3
- package/dist/components/molecules/RadioCards/RadioCardBullet/RadioCardBullet.js.map +1 -0
- package/dist/components/molecules/{RadioGroup/components/RadioGroupCheckbox.cjs → RadioCards/RadioCardCheck/RadioCardCheck.cjs} +4 -4
- package/dist/components/molecules/RadioCards/RadioCardCheck/RadioCardCheck.cjs.map +1 -0
- package/dist/components/molecules/{RadioGroup/components/RadioGroupCheckbox.d.ts → RadioCards/RadioCardCheck/RadioCardCheck.d.ts} +6 -7
- package/dist/components/molecules/RadioCards/RadioCardCheck/RadioCardCheck.d.ts.map +1 -0
- package/dist/components/molecules/{RadioGroup/components/RadioGroupCheckbox.js → RadioCards/RadioCardCheck/RadioCardCheck.js} +4 -4
- package/dist/components/molecules/RadioCards/RadioCardCheck/RadioCardCheck.js.map +1 -0
- package/dist/components/molecules/{RadioGroup/components/RadioGroupIconSimple.cjs → RadioCards/RadioCardIcon/RadioCardIcon.cjs} +3 -3
- package/dist/components/molecules/RadioCards/RadioCardIcon/RadioCardIcon.cjs.map +1 -0
- package/dist/components/molecules/{RadioGroup/components/RadioGroupIconSimple.d.ts → RadioCards/RadioCardIcon/RadioCardIcon.d.ts} +5 -6
- package/dist/components/molecules/RadioCards/RadioCardIcon/RadioCardIcon.d.ts.map +1 -0
- package/dist/components/molecules/{RadioGroup/components/RadioGroupIconSimple.js → RadioCards/RadioCardIcon/RadioCardIcon.js} +3 -3
- package/dist/components/molecules/RadioCards/RadioCardIcon/RadioCardIcon.js.map +1 -0
- package/dist/components/molecules/{RadioGroup/components/RadioGroupIconCard.cjs → RadioCards/RadioCardIconFeatured/RadioCardIconFeatured.cjs} +5 -5
- package/dist/components/molecules/RadioCards/RadioCardIconFeatured/RadioCardIconFeatured.cjs.map +1 -0
- package/dist/components/molecules/{RadioGroup/components/RadioGroupIconCard.d.ts → RadioCards/RadioCardIconFeatured/RadioCardIconFeatured.d.ts} +3 -3
- package/dist/components/molecules/RadioCards/RadioCardIconFeatured/RadioCardIconFeatured.d.ts.map +1 -0
- package/dist/components/molecules/{RadioGroup/components/RadioGroupIconCard.js → RadioCards/RadioCardIconFeatured/RadioCardIconFeatured.js} +4 -4
- package/dist/components/molecules/RadioCards/RadioCardIconFeatured/RadioCardIconFeatured.js.map +1 -0
- package/dist/components/molecules/{RadioGroup/components/RadioGroupPaymentIcon.cjs → RadioCards/RadioCardPayment/RadioCardPayment.cjs} +3 -3
- package/dist/components/molecules/RadioCards/RadioCardPayment/RadioCardPayment.cjs.map +1 -0
- package/dist/components/molecules/{RadioGroup/components/RadioGroupPaymentIcon.d.ts → RadioCards/RadioCardPayment/RadioCardPayment.d.ts} +3 -3
- package/dist/components/molecules/RadioCards/RadioCardPayment/RadioCardPayment.d.ts.map +1 -0
- package/dist/components/molecules/{RadioGroup/components/RadioGroupPaymentIcon.js → RadioCards/RadioCardPayment/RadioCardPayment.js} +3 -3
- package/dist/components/molecules/RadioCards/RadioCardPayment/RadioCardPayment.js.map +1 -0
- package/dist/components/molecules/{RadioGroup → RadioCards}/hooks/useOptionIds.cjs.map +1 -1
- package/dist/components/molecules/{RadioGroup → RadioCards}/hooks/useOptionIds.d.ts.map +1 -1
- package/dist/components/molecules/{RadioGroup → RadioCards}/hooks/useOptionIds.js.map +1 -1
- package/dist/components/molecules/RadioCards/index.cjs +18 -0
- package/dist/components/molecules/RadioCards/index.cjs.map +1 -0
- package/dist/components/molecules/RadioCards/index.d.ts +23 -0
- package/dist/components/molecules/RadioCards/index.d.ts.map +1 -0
- package/dist/components/molecules/RadioCards/index.js +7 -0
- package/dist/components/molecules/RadioCards/index.js.map +1 -0
- package/dist/components/molecules/{RadioGroup/radioGroup.types.d.ts → RadioCards/radioCards.types.d.ts} +12 -10
- package/dist/components/molecules/RadioCards/radioCards.types.d.ts.map +1 -0
- package/dist/components/molecules/RadioGroup/components/RadioGroupAvatar.cjs +2 -7
- package/dist/components/molecules/RadioGroup/components/RadioGroupAvatar.cjs.map +1 -1
- package/dist/components/molecules/RadioGroup/components/RadioGroupAvatar.d.ts +2 -7
- package/dist/components/molecules/RadioGroup/components/RadioGroupAvatar.d.ts.map +1 -1
- package/dist/components/molecules/RadioGroup/components/RadioGroupAvatar.js +2 -7
- package/dist/components/molecules/RadioGroup/components/RadioGroupAvatar.js.map +1 -1
- package/dist/components/molecules/RadioGroup/index.cjs +26 -14
- package/dist/components/molecules/RadioGroup/index.cjs.map +1 -1
- package/dist/components/molecules/RadioGroup/index.d.ts +25 -8
- package/dist/components/molecules/RadioGroup/index.d.ts.map +1 -1
- package/dist/components/molecules/RadioGroup/index.js +23 -7
- package/dist/components/molecules/RadioGroup/index.js.map +1 -1
- package/dist/components/molecules/Tabs/index.cjs +2 -2
- package/dist/components/molecules/Tabs/index.cjs.map +1 -1
- package/dist/components/molecules/Tabs/index.js +1 -1
- package/dist/components/organisms/Calendar/components/CalendarHeader.cjs +2 -2
- package/dist/components/organisms/Calendar/components/CalendarHeader.cjs.map +1 -1
- package/dist/components/organisms/Calendar/components/CalendarHeader.js +1 -1
- package/dist/components/organisms/HeaderNavigation/components/NavItem.cjs +2 -2
- package/dist/components/organisms/HeaderNavigation/components/NavItem.cjs.map +1 -1
- package/dist/components/organisms/HeaderNavigation/components/NavItem.js +1 -1
- package/dist/components/organisms/PageHeader/components/PageHeaderTabNav.cjs +2 -2
- package/dist/components/organisms/PageHeader/components/PageHeaderTabNav.cjs.map +1 -1
- package/dist/components/organisms/PageHeader/components/PageHeaderTabNav.js +1 -1
- package/dist/components/organisms/SidebarNavigation/components/NavItem.cjs +2 -2
- package/dist/components/organisms/SidebarNavigation/components/NavItem.cjs.map +1 -1
- package/dist/components/organisms/SidebarNavigation/components/NavItem.js +1 -1
- package/dist/components/organisms/Table/index.cjs +2 -2
- package/dist/components/organisms/Table/index.cjs.map +1 -1
- package/dist/components/organisms/Table/index.js +1 -1
- package/dist/native/components/atoms/Badge/index.d.ts +20 -97
- package/dist/native/components/atoms/Badge/index.d.ts.map +1 -1
- package/dist/native/components/atoms/Badge/index.js +17 -62
- package/dist/native/components/atoms/Badge/index.js.map +1 -1
- package/dist/native/components/atoms/Badges/Badge/Badge.d.ts +98 -0
- package/dist/native/components/atoms/Badges/Badge/Badge.d.ts.map +1 -0
- package/dist/native/components/atoms/Badges/Badge/Badge.js +66 -0
- package/dist/native/components/atoms/Badges/Badge/Badge.js.map +1 -0
- package/dist/native/components/atoms/{Badge → Badges/Badge}/Badge.styles.d.ts +1 -1
- package/dist/native/components/atoms/Badges/Badge/Badge.styles.d.ts.map +1 -0
- package/dist/native/components/atoms/{Badge → Badges/Badge}/Badge.styles.js +1 -1
- package/dist/native/components/atoms/Badges/Badge/Badge.styles.js.map +1 -0
- package/dist/native/components/atoms/Badges/Badge/badge.types.d.ts.map +1 -0
- package/dist/native/components/atoms/Badges/Badge/badge.types.js.map +1 -0
- package/dist/native/components/atoms/{Badge → Badges/Badge/utilities}/badge.utils.d.ts +2 -2
- package/dist/native/components/atoms/Badges/Badge/utilities/badge.utils.d.ts.map +1 -0
- package/dist/native/components/atoms/{Badge → Badges/Badge/utilities}/badge.utils.js +1 -1
- package/dist/native/components/atoms/Badges/Badge/utilities/badge.utils.js.map +1 -0
- package/dist/native/components/atoms/Badges/index.d.ts +5 -0
- package/dist/native/components/atoms/Badges/index.d.ts.map +1 -0
- package/dist/native/components/atoms/Badges/index.js +2 -0
- package/dist/native/components/atoms/Badges/index.js.map +1 -0
- package/dist/native/components/molecules/RadioCards/index.d.ts +12 -0
- package/package.json +1 -1
- package/dist/components/atoms/Badge/Badge.styles.cjs.map +0 -1
- package/dist/components/atoms/Badge/Badge.styles.d.ts.map +0 -1
- package/dist/components/atoms/Badge/Badge.styles.js.map +0 -1
- package/dist/components/atoms/Badge/badge.types.cjs.map +0 -1
- package/dist/components/atoms/Badge/badge.types.d.ts.map +0 -1
- package/dist/components/atoms/Badge/badge.types.js.map +0 -1
- package/dist/components/atoms/Badge/badge.utils.d.ts.map +0 -1
- package/dist/components/molecules/RadioGroup/components/RadioGroupAvatarCard.cjs +0 -39
- package/dist/components/molecules/RadioGroup/components/RadioGroupAvatarCard.cjs.map +0 -1
- package/dist/components/molecules/RadioGroup/components/RadioGroupAvatarCard.d.ts +0 -32
- package/dist/components/molecules/RadioGroup/components/RadioGroupAvatarCard.d.ts.map +0 -1
- package/dist/components/molecules/RadioGroup/components/RadioGroupAvatarCard.js +0 -37
- package/dist/components/molecules/RadioGroup/components/RadioGroupAvatarCard.js.map +0 -1
- package/dist/components/molecules/RadioGroup/components/RadioGroupCheckbox.cjs.map +0 -1
- package/dist/components/molecules/RadioGroup/components/RadioGroupCheckbox.d.ts.map +0 -1
- package/dist/components/molecules/RadioGroup/components/RadioGroupCheckbox.js.map +0 -1
- package/dist/components/molecules/RadioGroup/components/RadioGroupIconCard.cjs.map +0 -1
- package/dist/components/molecules/RadioGroup/components/RadioGroupIconCard.d.ts.map +0 -1
- package/dist/components/molecules/RadioGroup/components/RadioGroupIconCard.js.map +0 -1
- package/dist/components/molecules/RadioGroup/components/RadioGroupIconSimple.cjs.map +0 -1
- package/dist/components/molecules/RadioGroup/components/RadioGroupIconSimple.d.ts.map +0 -1
- package/dist/components/molecules/RadioGroup/components/RadioGroupIconSimple.js.map +0 -1
- package/dist/components/molecules/RadioGroup/components/RadioGroupPaymentIcon.cjs.map +0 -1
- package/dist/components/molecules/RadioGroup/components/RadioGroupPaymentIcon.d.ts.map +0 -1
- package/dist/components/molecules/RadioGroup/components/RadioGroupPaymentIcon.js.map +0 -1
- package/dist/components/molecules/RadioGroup/components/RadioGroupRadioButton.cjs.map +0 -1
- package/dist/components/molecules/RadioGroup/components/RadioGroupRadioButton.d.ts.map +0 -1
- package/dist/components/molecules/RadioGroup/components/RadioGroupRadioButton.js.map +0 -1
- package/dist/components/molecules/RadioGroup/hooks/useCommitOnPress.cjs.map +0 -1
- package/dist/components/molecules/RadioGroup/hooks/useCommitOnPress.d.ts.map +0 -1
- package/dist/components/molecules/RadioGroup/hooks/useCommitOnPress.js.map +0 -1
- package/dist/components/molecules/RadioGroup/radioGroup.types.d.ts.map +0 -1
- package/dist/native/components/atoms/Badge/Badge.styles.d.ts.map +0 -1
- package/dist/native/components/atoms/Badge/Badge.styles.js.map +0 -1
- package/dist/native/components/atoms/Badge/badge.types.d.ts.map +0 -1
- package/dist/native/components/atoms/Badge/badge.types.js.map +0 -1
- package/dist/native/components/atoms/Badge/badge.utils.d.ts.map +0 -1
- package/dist/native/components/atoms/Badge/badge.utils.js.map +0 -1
- /package/dist/components/atoms/{Badge → Badges/Badge}/badge.types.cjs +0 -0
- /package/dist/components/atoms/{Badge → Badges/Badge}/badge.types.d.ts +0 -0
- /package/dist/components/atoms/{Badge → Badges/Badge}/badge.types.js +0 -0
- /package/dist/components/molecules/{RadioGroup → RadioCards}/hooks/useOptionIds.cjs +0 -0
- /package/dist/components/molecules/{RadioGroup → RadioCards}/hooks/useOptionIds.d.ts +0 -0
- /package/dist/components/molecules/{RadioGroup → RadioCards}/hooks/useOptionIds.js +0 -0
- /package/dist/native/components/atoms/{Badge → Badges/Badge}/badge.types.d.ts +0 -0
- /package/dist/native/components/atoms/{Badge → Badges/Badge}/badge.types.js +0 -0
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
4
|
var uiIcons = require('@flipdish/ui-icons');
|
|
5
5
|
var Avatar = require('@flipdish/ui-library/components/atoms/Avatar');
|
|
6
|
-
var
|
|
6
|
+
var Badges = require('@flipdish/ui-library/components/atoms/Badges');
|
|
7
7
|
var Button = require('@flipdish/ui-library/components/atoms/Button');
|
|
8
8
|
var Dot = require('@flipdish/ui-library/components/atoms/Dot');
|
|
9
9
|
var cx = require('@flipdish/ui-library/utilities/cx');
|
|
@@ -25,7 +25,7 @@ const FeedItem = ({ id, user, date, action, attachment, comment, labels, message
|
|
|
25
25
|
});
|
|
26
26
|
return (jsxRuntime.jsxs("article", { "data-testid": itemTestId, className: "relative flex gap-3", children: [unseen && jsxRuntime.jsx(Dot.Dot, { size: "md", color: "fg-success-secondary", className: "absolute top-0 right-0" }), jsxRuntime.jsxs("div", { className: "flex shrink-0 flex-col", children: [jsxRuntime.jsx(Avatar.Avatar, { src: user.avatarUrl, alt: user.name, size: size === 'sm' ? 'sm' : 'md', status: user.status }), connector && (jsxRuntime.jsx("div", { className: "relative my-1 flex h-full w-full justify-center self-center overflow-hidden", children: jsxRuntime.jsx("svg", { className: "absolute", width: "2.4", children: jsxRuntime.jsx("line", { x1: "1.2", y1: "1.2", x2: "1.2", y2: "100%", className: "stroke-border-primary", stroke: "black", strokeWidth: "2.4", strokeDasharray: "0,6", strokeLinecap: "round" }) }) }))] }), jsxRuntime.jsxs("div", { className: cx.cx('flex flex-1 flex-col gap-3', connector && 'pb-8'), children: [jsxRuntime.jsxs("header", { children: [jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [jsxRuntime.jsx("a", { href: hrefUtils.safeHref(user.href), className: "rounded text-sm font-medium text-secondary outline-focus-ring focus-visible:outline-2 focus-visible:outline-offset-2", children: user.name }), date && (jsxRuntime.jsx("time", { className: "text-xs text-tertiary", dateTime: date, children: date }))] }), action && (jsxRuntime.jsxs("p", { className: "text-sm text-tertiary", children: [action.content, ' ', action.target && (jsxRuntime.jsx(Button.Button
|
|
27
27
|
// A rejected href renders the action as a non-link rather than an empty link.
|
|
28
|
-
, { ...(actionHref !== undefined ? { href: actionHref } : { isDisabled: true }), className: "inline text-sm font-medium whitespace-normal", color: "link-color", size: "sm", children: action.target }))] })), user.username && jsxRuntime.jsx("p", { className: "text-sm text-tertiary", children: user.username })] }), attachment && (jsxRuntime.jsxs("figure", { className: "flex gap-3", children: [jsxRuntime.jsx(uiIcons.FileIcon, { type: attachment.type, theme: "light", className: "size-10 dark:hidden" }), jsxRuntime.jsx(uiIcons.FileIcon, { type: attachment.type, theme: "dark", className: "size-10 not-dark:hidden" }), jsxRuntime.jsxs("figcaption", { children: [jsxRuntime.jsx("p", { className: "text-sm font-medium text-secondary", children: attachment.name }), jsxRuntime.jsx("p", { className: "text-sm text-tertiary", children: attachment.size })] })] })), labels && labels.length > 0 && (jsxRuntime.jsx("aside", { className: "flex gap-1", "aria-label": "Labels", children: labels.map((label) => (jsxRuntime.jsx(
|
|
28
|
+
, { ...(actionHref !== undefined ? { href: actionHref } : { isDisabled: true }), className: "inline text-sm font-medium whitespace-normal", color: "link-color", size: "sm", children: action.target }))] })), user.username && jsxRuntime.jsx("p", { className: "text-sm text-tertiary", children: user.username })] }), attachment && (jsxRuntime.jsxs("figure", { className: "flex gap-3", children: [jsxRuntime.jsx(uiIcons.FileIcon, { type: attachment.type, theme: "light", className: "size-10 dark:hidden" }), jsxRuntime.jsx(uiIcons.FileIcon, { type: attachment.type, theme: "dark", className: "size-10 not-dark:hidden" }), jsxRuntime.jsxs("figcaption", { children: [jsxRuntime.jsx("p", { className: "text-sm font-medium text-secondary", children: attachment.name }), jsxRuntime.jsx("p", { className: "text-sm text-tertiary", children: attachment.size })] })] })), labels && labels.length > 0 && (jsxRuntime.jsx("aside", { className: "flex gap-1", "aria-label": "Labels", children: labels.map((label) => (jsxRuntime.jsx(Badges.Badge, { color: label.color, size: "sm", children: label.name }, label.name))) })), comment && jsxRuntime.jsx("q", { className: "text-sm text-tertiary", children: comment }), message && (jsxRuntime.jsx("section", { className: cx.cx('gap-2 rounded-lg rounded-tl-none p-3 ring-1 ring-secondary ring-inset', connector && 'py-2.5'), children: jsxRuntime.jsx("p", { className: "text-sm text-secondary", children: message }) }))] })] }));
|
|
29
29
|
};
|
|
30
30
|
|
|
31
31
|
exports.FeedItem = FeedItem;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../../../src/components/molecules/ActivityFeed/index.tsx"],"sourcesContent":[null],"names":["safeHref","useResolvedTestId","slugifyTestId","_jsxs","_jsx","Dot","Avatar","cx","Button","FileIcon","Badge"],"mappings":";;;;;;;;;;;;AA4DA;;;;;AAKG;AACI,MAAM,QAAQ,GAAG,CAAC,EACvB,EAAE,EACF,IAAI,EACJ,IAAI,EACJ,MAAM,EACN,UAAU,EACV,OAAO,EACP,MAAM,EACN,OAAO,EACP,MAAM,EACN,SAAS,EACT,IAAI,GAAG,IAAI,EACX,aAAa,EAAE,UAAU,GACX,KAAI;AAClB,IAAA,MAAM,UAAU,GAAG,MAAM,GAAGA,kBAAQ,CAAC,MAAM,CAAC,IAAc,CAAC,G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AS,EAAC,yBAAyB,EAAA,CAAG,EAEpFN,eAAA,CAAA,YAAA,EAAA,EAAA,QAAA,EAAA,CACEC,cAAA,CAAA,GAAA,EAAA,EAAG,SAAS,EAAC,oCAAoC,EAAA,QAAA,EAAE,UAAU,CAAC,IAAI,GAAK,EACvEA,cAAA,CAAA,GAAA,EAAA,EAAG,SAAS,EAAC,uBAAuB,EAAA,QAAA,EAAE,UAAU,CAAC,IAAI,GAAK,CAAA,EAAA,CAC/C,CAAA,EAAA,CACN,CACV,EAEA,MAAM,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,KAC1BA,0BAAO,SAAS,EAAC,YAAY,EAAA,YAAA,EAAY,QAAQ,YAC9C,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,MAChBA,cAAA,CAACM,
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../../src/components/molecules/ActivityFeed/index.tsx"],"sourcesContent":[null],"names":["safeHref","useResolvedTestId","slugifyTestId","_jsxs","_jsx","Dot","Avatar","cx","Button","FileIcon","Badge"],"mappings":";;;;;;;;;;;;AA4DA;;;;;AAKG;AACI,MAAM,QAAQ,GAAG,CAAC,EACvB,EAAE,EACF,IAAI,EACJ,IAAI,EACJ,MAAM,EACN,UAAU,EACV,OAAO,EACP,MAAM,EACN,OAAO,EACP,MAAM,EACN,SAAS,EACT,IAAI,GAAG,IAAI,EACX,aAAa,EAAE,UAAU,GACX,KAAI;AAClB,IAAA,MAAM,UAAU,GAAG,MAAM,GAAGA,kBAAQ,CAAC,MAAM,CAAC,IAAc,CAAC,GAAG,SAAS;IAEvE,MAAM,UAAU,GAAGC,6BAAiB,CAAC;AACnC,QAAA,MAAM,EAAE,UAAU;QAClB,OAAO,EAAE,aAAaC,yBAAa,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAA,CAAE;QACjD,QAAQ,EAAE,aAAaA,yBAAa,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAA,CAAE;AACnD,KAAA,CAAC;I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AC,IAAI,GAAK,CAAA,EAAA,CAC/C,CAAA,EAAA,CACN,CACV,EAEA,MAAM,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,KAC1BA,0BAAO,SAAS,EAAC,YAAY,EAAA,YAAA,EAAY,QAAQ,YAC9C,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,MAChBA,cAAA,CAACM,YAAK,EAAA,EAAkB,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,IAAI,EAAC,IAAI,EAAA,QAAA,EAClD,KAAK,CAAC,IAAI,IADD,KAAK,CAAC,IAAI,CAEd,CACT,CAAC,GACI,CACT,EACA,OAAO,IAAIN,cAAA,CAAA,GAAA,EAAA,EAAG,SAAS,EAAC,uBAAuB,EAAA,QAAA,EAAE,OAAO,EAAA,CAAK,EAC7D,OAAO,KACNA,cAAA,CAAA,SAAA,EAAA,EAAS,SAAS,EAAEG,KAAE,CAAC,uEAAuE,EAAE,SAAS,IAAI,QAAQ,CAAC,EAAA,QAAA,EACpHH,sBAAG,SAAS,EAAC,wBAAwB,EAAA,QAAA,EAAE,OAAO,EAAA,CAAK,GAC3C,CACX,CAAA,EAAA,CACG,CAAA,EAAA,CACE;AAEd;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { BadgeColors } from '@flipdish/ui-library/components/atoms/
|
|
1
|
+
import type { BadgeColors } from '@flipdish/ui-library/components/atoms/Badges';
|
|
2
2
|
export type FeedItemType = {
|
|
3
3
|
/** Identifies the item and derives its default `data-testid`. */
|
|
4
4
|
id: string | number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/molecules/ActivityFeed/index.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/molecules/ActivityFeed/index.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,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AM,QAAQ,GAAI,uHAatB,aAAa,gCAiGf,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { FileIcon } from '@flipdish/ui-icons';
|
|
3
3
|
import { Avatar } from '@flipdish/ui-library/components/atoms/Avatar';
|
|
4
|
-
import { Badge } from '@flipdish/ui-library/components/atoms/
|
|
4
|
+
import { Badge } from '@flipdish/ui-library/components/atoms/Badges';
|
|
5
5
|
import { Button } from '@flipdish/ui-library/components/atoms/Button';
|
|
6
6
|
import { Dot } from '@flipdish/ui-library/components/atoms/Dot';
|
|
7
7
|
import { cx } from '@flipdish/ui-library/utilities/cx';
|
|
@@ -1,116 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var uiIcons = require('@flipdish/ui-icons');
|
|
5
|
-
var cx = require('@flipdish/ui-library/utilities/cx');
|
|
6
|
-
var testIdUtils = require('@flipdish/ui-library/utilities/testIdUtils');
|
|
7
|
-
var React = require('react');
|
|
8
|
-
var componentGuard_utils = require('../../../utilities/__internal__/componentGuardUtils/componentGuard.utils.cjs');
|
|
3
|
+
var Badges = require('@flipdish/ui-library/components/atoms/Badges');
|
|
9
4
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
root: 'rounded-full ring-1 ring-inset',
|
|
13
|
-
addon: 'rounded-full ring-1 ring-inset',
|
|
14
|
-
},
|
|
15
|
-
modern: {
|
|
16
|
-
root: 'rounded-[10px] bg-primary text-secondary shadow-xs ring-1 ring-inset ring-primary hover:bg-secondary',
|
|
17
|
-
addon: 'flex items-center rounded-md bg-primary shadow-xs ring-1 ring-inset ring-primary',
|
|
18
|
-
icon: 'text-utility-neutral-500',
|
|
19
|
-
},
|
|
20
|
-
};
|
|
21
|
-
const getSizeClasses = (theme, text, icon) => ({
|
|
22
|
-
leading: {
|
|
23
|
-
md: {
|
|
24
|
-
root: cx.cx('py-1 pr-2 pl-1 text-xs font-medium', !text && !icon && 'pr-1'),
|
|
25
|
-
addon: cx.cx('px-2 py-0.5', theme === 'modern' && 'gap-1 px-1.5', text && 'mr-2'),
|
|
26
|
-
icon: 'ml-1 size-4',
|
|
27
|
-
},
|
|
28
|
-
lg: {
|
|
29
|
-
root: cx.cx('py-1 pr-2 pl-1 text-sm font-medium', !text && !icon && 'pr-1'),
|
|
30
|
-
addon: cx.cx('px-2.5 py-0.5', theme === 'modern' && 'gap-1.5 px-2', text && 'mr-2'),
|
|
31
|
-
icon: 'ml-1 size-4',
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
trailing: {
|
|
35
|
-
md: {
|
|
36
|
-
root: cx.cx('py-1 pr-1 pl-3 text-xs font-medium', theme === 'modern' && 'pl-2.5'),
|
|
37
|
-
addon: cx.cx('py-0.5 pr-1.5 pl-2', theme === 'modern' && 'pr-1.5 pl-2', text && 'ml-2'),
|
|
38
|
-
icon: 'ml-0.5 size-3 stroke-[3px]',
|
|
39
|
-
dot: 'mr-1.5',
|
|
40
|
-
},
|
|
41
|
-
lg: {
|
|
42
|
-
root: 'py-1 pr-1 pl-3 text-sm font-medium',
|
|
43
|
-
addon: cx.cx('py-0.5 pr-2 pl-2.5', theme === 'modern' && 'pr-1.5 pl-2', text && 'ml-2'),
|
|
44
|
-
icon: 'ml-1 size-3 stroke-[3px]',
|
|
45
|
-
dot: 'mr-2',
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
|
-
});
|
|
49
|
-
const colorClasses = cx.sortCx({
|
|
50
|
-
light: {
|
|
51
|
-
brand: {
|
|
52
|
-
root: 'bg-utility-brand-50 text-utility-brand-700 ring-utility-brand-200 hover:bg-utility-brand-100',
|
|
53
|
-
addon: 'bg-primary text-current ring-utility-brand-200',
|
|
54
|
-
icon: 'text-utility-brand-500',
|
|
55
|
-
},
|
|
56
|
-
gray: {
|
|
57
|
-
root: 'bg-utility-neutral-50 text-utility-neutral-700 ring-utility-neutral-200 hover:bg-utility-neutral-100',
|
|
58
|
-
addon: 'bg-primary text-current ring-utility-neutral-200',
|
|
59
|
-
icon: 'text-utility-neutral-500',
|
|
60
|
-
},
|
|
61
|
-
error: {
|
|
62
|
-
root: 'bg-utility-red-50 text-utility-red-700 ring-utility-red-200 hover:bg-utility-red-100',
|
|
63
|
-
addon: 'bg-primary text-current ring-utility-red-200',
|
|
64
|
-
icon: 'text-utility-red-500',
|
|
65
|
-
},
|
|
66
|
-
warning: {
|
|
67
|
-
root: 'bg-utility-yellow-50 text-utility-yellow-700 ring-utility-yellow-200 hover:bg-utility-yellow-100',
|
|
68
|
-
addon: 'bg-primary text-current ring-utility-yellow-200',
|
|
69
|
-
icon: 'text-utility-yellow-500',
|
|
70
|
-
},
|
|
71
|
-
success: {
|
|
72
|
-
root: 'bg-utility-green-50 text-utility-green-700 ring-utility-green-200 hover:bg-utility-green-100',
|
|
73
|
-
addon: 'bg-primary text-current ring-utility-green-200',
|
|
74
|
-
icon: 'text-utility-green-500',
|
|
75
|
-
},
|
|
76
|
-
},
|
|
77
|
-
modern: {
|
|
78
|
-
brand: {
|
|
79
|
-
dot: 'bg-utility-brand-500 outline-3 -outline-offset-1 outline-utility-brand-100',
|
|
80
|
-
},
|
|
81
|
-
gray: {
|
|
82
|
-
dot: 'bg-utility-neutral-500 outline-3 -outline-offset-1 outline-utility-neutral-100',
|
|
83
|
-
},
|
|
84
|
-
error: {
|
|
85
|
-
dot: 'bg-utility-red-500 outline-3 -outline-offset-1 outline-utility-red-100',
|
|
86
|
-
},
|
|
87
|
-
warning: {
|
|
88
|
-
dot: 'bg-utility-yellow-500 outline-3 -outline-offset-1 outline-utility-yellow-100',
|
|
89
|
-
},
|
|
90
|
-
success: {
|
|
91
|
-
dot: 'bg-utility-green-500 outline-3 -outline-offset-1 outline-utility-green-100',
|
|
92
|
-
},
|
|
93
|
-
},
|
|
94
|
-
});
|
|
95
|
-
/**
|
|
96
|
-
* A compound badge that pairs a highlighted addon pill with a text label — used for
|
|
97
|
-
* announcements, feature callouts, and contextual status groups.
|
|
98
|
-
*
|
|
99
|
-
* @summary highlighted addon pill paired with a label
|
|
100
|
-
*/
|
|
101
|
-
const BadgeGroup = ({ children, addonText, size = 'md', color = 'brand', theme = 'light', align = 'leading', className, iconTrailing: IconTrailing = uiIcons.ArrowRight, 'data-testid': dataTestId, }) => {
|
|
102
|
-
const badgeGroupTestId = testIdUtils.useResolvedTestId({ testId: dataTestId, segment: 'badge-group', rootName: 'badge-group' });
|
|
103
|
-
const colors = colorClasses[theme][color];
|
|
104
|
-
const sizes = getSizeClasses(theme, !!children, !!IconTrailing)[align][size];
|
|
105
|
-
const rootClasses = cx.cx('inline-flex w-max cursor-pointer items-center transition duration-100 ease-linear', baseClasses[theme].root, sizes.root, colors.root, className);
|
|
106
|
-
const addonClasses = cx.cx('inline-flex items-center', baseClasses[theme].addon, sizes.addon, colors.addon);
|
|
107
|
-
const dotClasses = cx.cx('inline-block size-2 shrink-0 rounded-full', sizes.dot, colors.dot);
|
|
108
|
-
const iconClasses = cx.cx(baseClasses[theme].icon, sizes.icon, colors.icon);
|
|
109
|
-
if (align === 'trailing') {
|
|
110
|
-
return (jsxRuntime.jsxs("div", { className: rootClasses, "data-testid": badgeGroupTestId, children: [theme === 'modern' && jsxRuntime.jsx("span", { className: dotClasses }), children, jsxRuntime.jsxs("span", { className: addonClasses, children: [addonText, componentGuard_utils.isReactComponent(IconTrailing) && jsxRuntime.jsx(IconTrailing, { className: iconClasses }), React.isValidElement(IconTrailing) && IconTrailing] })] }));
|
|
111
|
-
}
|
|
112
|
-
return (jsxRuntime.jsxs("div", { className: rootClasses, "data-testid": badgeGroupTestId, children: [jsxRuntime.jsxs("span", { className: addonClasses, children: [theme === 'modern' && jsxRuntime.jsx("span", { className: dotClasses }), addonText] }), children, componentGuard_utils.isReactComponent(IconTrailing) && jsxRuntime.jsx(IconTrailing, { className: iconClasses }), React.isValidElement(IconTrailing) && IconTrailing] }));
|
|
113
|
-
};
|
|
5
|
+
/** @deprecated Import from `@flipdish/ui-library/components/atoms/Badges`. Removed in the next major. */
|
|
6
|
+
const BadgeGroup = Badges.BadgeGroup;
|
|
114
7
|
|
|
115
8
|
exports.BadgeGroup = BadgeGroup;
|
|
116
9
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../../../src/components/molecules/BadgeGroup/index.tsx"],"sourcesContent":[null],"names":["
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../../src/components/molecules/BadgeGroup/index.tsx"],"sourcesContent":[null],"names":["BadgeGroupNext"],"mappings":";;;;AAMA;AACO,MAAM,UAAU,GAAGA;;"}
|
|
@@ -1,38 +1,6 @@
|
|
|
1
|
-
import type
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
type
|
|
6
|
-
export interface BadgeGroupProps {
|
|
7
|
-
/** Label rendered beside the addon pill. */
|
|
8
|
-
children?: string | ReactNode;
|
|
9
|
-
/** Text inside the highlighted addon pill. */
|
|
10
|
-
addonText: string;
|
|
11
|
-
/** Text size and padding of the group. */
|
|
12
|
-
size?: Size;
|
|
13
|
-
/** Colour scheme of the group; in the `modern` theme it colours only the status dot. */
|
|
14
|
-
color: Color;
|
|
15
|
-
/** `light` renders a tinted pill; `modern` renders a neutral card with a coloured status dot. */
|
|
16
|
-
theme?: Theme;
|
|
17
|
-
/**
|
|
18
|
-
* Alignment of the badge addon element.
|
|
19
|
-
*/
|
|
20
|
-
align?: Align;
|
|
21
|
-
/** Icon component or element rendered after the label, or inside the addon when `align` is `trailing`. */
|
|
22
|
-
iconTrailing?: FC<{
|
|
23
|
-
className?: string;
|
|
24
|
-
}> | ReactNode;
|
|
25
|
-
/** Extra classes merged onto the root element. */
|
|
26
|
-
className?: string;
|
|
27
|
-
/** Overrides the `data-testid` (defaults to `fd-badge-group`). */
|
|
28
|
-
'data-testid'?: string;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* A compound badge that pairs a highlighted addon pill with a text label — used for
|
|
32
|
-
* announcements, feature callouts, and contextual status groups.
|
|
33
|
-
*
|
|
34
|
-
* @summary highlighted addon pill paired with a label
|
|
35
|
-
*/
|
|
36
|
-
export declare const BadgeGroup: ({ children, addonText, size, color, theme, align, className, iconTrailing: IconTrailing, "data-testid": dataTestId, }: BadgeGroupProps) => import("react").JSX.Element;
|
|
37
|
-
export {};
|
|
1
|
+
import { type BadgeGroupProps as BadgeGroupPropsNext } from '@flipdish/ui-library/components/atoms/Badges';
|
|
2
|
+
/** @deprecated Import from `@flipdish/ui-library/components/atoms/Badges`. Removed in the next major. */
|
|
3
|
+
export declare const BadgeGroup: ({ children, addonText, size, color, theme, align, className, iconTrailing: IconTrailing, "data-testid": dataTestId, }: BadgeGroupPropsNext) => import("react").JSX.Element;
|
|
4
|
+
/** @deprecated Import from `@flipdish/ui-library/components/atoms/Badges`. Removed in the next major. */
|
|
5
|
+
export type BadgeGroupProps = BadgeGroupPropsNext;
|
|
38
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/molecules/BadgeGroup/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/molecules/BadgeGroup/index.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAgC,KAAK,eAAe,IAAI,mBAAmB,EAAE,MAAM,8CAA8C,CAAC;AAEzI,yGAAyG;AACzG,eAAO,MAAM,UAAU,6KAAiB,CAAC;AACzC,yGAAyG;AACzG,MAAM,MAAM,eAAe,GAAG,mBAAmB,CAAC"}
|
|
@@ -1,114 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ArrowRight } from '@flipdish/ui-icons';
|
|
3
|
-
import { sortCx, cx } from '@flipdish/ui-library/utilities/cx';
|
|
4
|
-
import { useResolvedTestId } from '@flipdish/ui-library/utilities/testIdUtils';
|
|
5
|
-
import { isValidElement } from 'react';
|
|
6
|
-
import { isReactComponent } from '../../../utilities/__internal__/componentGuardUtils/componentGuard.utils.js';
|
|
1
|
+
import { BadgeGroup as BadgeGroup$1 } from '@flipdish/ui-library/components/atoms/Badges';
|
|
7
2
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
root: 'rounded-full ring-1 ring-inset',
|
|
11
|
-
addon: 'rounded-full ring-1 ring-inset',
|
|
12
|
-
},
|
|
13
|
-
modern: {
|
|
14
|
-
root: 'rounded-[10px] bg-primary text-secondary shadow-xs ring-1 ring-inset ring-primary hover:bg-secondary',
|
|
15
|
-
addon: 'flex items-center rounded-md bg-primary shadow-xs ring-1 ring-inset ring-primary',
|
|
16
|
-
icon: 'text-utility-neutral-500',
|
|
17
|
-
},
|
|
18
|
-
};
|
|
19
|
-
const getSizeClasses = (theme, text, icon) => ({
|
|
20
|
-
leading: {
|
|
21
|
-
md: {
|
|
22
|
-
root: cx('py-1 pr-2 pl-1 text-xs font-medium', !text && !icon && 'pr-1'),
|
|
23
|
-
addon: cx('px-2 py-0.5', theme === 'modern' && 'gap-1 px-1.5', text && 'mr-2'),
|
|
24
|
-
icon: 'ml-1 size-4',
|
|
25
|
-
},
|
|
26
|
-
lg: {
|
|
27
|
-
root: cx('py-1 pr-2 pl-1 text-sm font-medium', !text && !icon && 'pr-1'),
|
|
28
|
-
addon: cx('px-2.5 py-0.5', theme === 'modern' && 'gap-1.5 px-2', text && 'mr-2'),
|
|
29
|
-
icon: 'ml-1 size-4',
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
trailing: {
|
|
33
|
-
md: {
|
|
34
|
-
root: cx('py-1 pr-1 pl-3 text-xs font-medium', theme === 'modern' && 'pl-2.5'),
|
|
35
|
-
addon: cx('py-0.5 pr-1.5 pl-2', theme === 'modern' && 'pr-1.5 pl-2', text && 'ml-2'),
|
|
36
|
-
icon: 'ml-0.5 size-3 stroke-[3px]',
|
|
37
|
-
dot: 'mr-1.5',
|
|
38
|
-
},
|
|
39
|
-
lg: {
|
|
40
|
-
root: 'py-1 pr-1 pl-3 text-sm font-medium',
|
|
41
|
-
addon: cx('py-0.5 pr-2 pl-2.5', theme === 'modern' && 'pr-1.5 pl-2', text && 'ml-2'),
|
|
42
|
-
icon: 'ml-1 size-3 stroke-[3px]',
|
|
43
|
-
dot: 'mr-2',
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
});
|
|
47
|
-
const colorClasses = sortCx({
|
|
48
|
-
light: {
|
|
49
|
-
brand: {
|
|
50
|
-
root: 'bg-utility-brand-50 text-utility-brand-700 ring-utility-brand-200 hover:bg-utility-brand-100',
|
|
51
|
-
addon: 'bg-primary text-current ring-utility-brand-200',
|
|
52
|
-
icon: 'text-utility-brand-500',
|
|
53
|
-
},
|
|
54
|
-
gray: {
|
|
55
|
-
root: 'bg-utility-neutral-50 text-utility-neutral-700 ring-utility-neutral-200 hover:bg-utility-neutral-100',
|
|
56
|
-
addon: 'bg-primary text-current ring-utility-neutral-200',
|
|
57
|
-
icon: 'text-utility-neutral-500',
|
|
58
|
-
},
|
|
59
|
-
error: {
|
|
60
|
-
root: 'bg-utility-red-50 text-utility-red-700 ring-utility-red-200 hover:bg-utility-red-100',
|
|
61
|
-
addon: 'bg-primary text-current ring-utility-red-200',
|
|
62
|
-
icon: 'text-utility-red-500',
|
|
63
|
-
},
|
|
64
|
-
warning: {
|
|
65
|
-
root: 'bg-utility-yellow-50 text-utility-yellow-700 ring-utility-yellow-200 hover:bg-utility-yellow-100',
|
|
66
|
-
addon: 'bg-primary text-current ring-utility-yellow-200',
|
|
67
|
-
icon: 'text-utility-yellow-500',
|
|
68
|
-
},
|
|
69
|
-
success: {
|
|
70
|
-
root: 'bg-utility-green-50 text-utility-green-700 ring-utility-green-200 hover:bg-utility-green-100',
|
|
71
|
-
addon: 'bg-primary text-current ring-utility-green-200',
|
|
72
|
-
icon: 'text-utility-green-500',
|
|
73
|
-
},
|
|
74
|
-
},
|
|
75
|
-
modern: {
|
|
76
|
-
brand: {
|
|
77
|
-
dot: 'bg-utility-brand-500 outline-3 -outline-offset-1 outline-utility-brand-100',
|
|
78
|
-
},
|
|
79
|
-
gray: {
|
|
80
|
-
dot: 'bg-utility-neutral-500 outline-3 -outline-offset-1 outline-utility-neutral-100',
|
|
81
|
-
},
|
|
82
|
-
error: {
|
|
83
|
-
dot: 'bg-utility-red-500 outline-3 -outline-offset-1 outline-utility-red-100',
|
|
84
|
-
},
|
|
85
|
-
warning: {
|
|
86
|
-
dot: 'bg-utility-yellow-500 outline-3 -outline-offset-1 outline-utility-yellow-100',
|
|
87
|
-
},
|
|
88
|
-
success: {
|
|
89
|
-
dot: 'bg-utility-green-500 outline-3 -outline-offset-1 outline-utility-green-100',
|
|
90
|
-
},
|
|
91
|
-
},
|
|
92
|
-
});
|
|
93
|
-
/**
|
|
94
|
-
* A compound badge that pairs a highlighted addon pill with a text label — used for
|
|
95
|
-
* announcements, feature callouts, and contextual status groups.
|
|
96
|
-
*
|
|
97
|
-
* @summary highlighted addon pill paired with a label
|
|
98
|
-
*/
|
|
99
|
-
const BadgeGroup = ({ children, addonText, size = 'md', color = 'brand', theme = 'light', align = 'leading', className, iconTrailing: IconTrailing = ArrowRight, 'data-testid': dataTestId, }) => {
|
|
100
|
-
const badgeGroupTestId = useResolvedTestId({ testId: dataTestId, segment: 'badge-group', rootName: 'badge-group' });
|
|
101
|
-
const colors = colorClasses[theme][color];
|
|
102
|
-
const sizes = getSizeClasses(theme, !!children, !!IconTrailing)[align][size];
|
|
103
|
-
const rootClasses = cx('inline-flex w-max cursor-pointer items-center transition duration-100 ease-linear', baseClasses[theme].root, sizes.root, colors.root, className);
|
|
104
|
-
const addonClasses = cx('inline-flex items-center', baseClasses[theme].addon, sizes.addon, colors.addon);
|
|
105
|
-
const dotClasses = cx('inline-block size-2 shrink-0 rounded-full', sizes.dot, colors.dot);
|
|
106
|
-
const iconClasses = cx(baseClasses[theme].icon, sizes.icon, colors.icon);
|
|
107
|
-
if (align === 'trailing') {
|
|
108
|
-
return (jsxs("div", { className: rootClasses, "data-testid": badgeGroupTestId, children: [theme === 'modern' && jsx("span", { className: dotClasses }), children, jsxs("span", { className: addonClasses, children: [addonText, isReactComponent(IconTrailing) && jsx(IconTrailing, { className: iconClasses }), isValidElement(IconTrailing) && IconTrailing] })] }));
|
|
109
|
-
}
|
|
110
|
-
return (jsxs("div", { className: rootClasses, "data-testid": badgeGroupTestId, children: [jsxs("span", { className: addonClasses, children: [theme === 'modern' && jsx("span", { className: dotClasses }), addonText] }), children, isReactComponent(IconTrailing) && jsx(IconTrailing, { className: iconClasses }), isValidElement(IconTrailing) && IconTrailing] }));
|
|
111
|
-
};
|
|
3
|
+
/** @deprecated Import from `@flipdish/ui-library/components/atoms/Badges`. Removed in the next major. */
|
|
4
|
+
const BadgeGroup = BadgeGroup$1;
|
|
112
5
|
|
|
113
6
|
export { BadgeGroup };
|
|
114
7
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/molecules/BadgeGroup/index.tsx"],"sourcesContent":[null],"names":["
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/molecules/BadgeGroup/index.tsx"],"sourcesContent":[null],"names":["BadgeGroupNext"],"mappings":";;AAMA;AACO,MAAM,UAAU,GAAGA;;"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var Avatar = require('@flipdish/ui-library/components/atoms/Avatar');
|
|
5
|
+
var Checkboxes = require('@flipdish/ui-library/components/atoms/Checkboxes');
|
|
6
|
+
var Radios = require('@flipdish/ui-library/components/atoms/Radios');
|
|
7
|
+
var cx = require('@flipdish/ui-library/utilities/cx');
|
|
8
|
+
var testIdUtils = require('@flipdish/ui-library/utilities/testIdUtils');
|
|
9
|
+
var reactAriaComponents = require('react-aria-components');
|
|
10
|
+
var useOptionIds = require('../hooks/useOptionIds.cjs');
|
|
11
|
+
var useCommitOnPress = require('./hooks/useCommitOnPress.cjs');
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Radio group where each option is a card with an avatar or logo, a title, a subtitle and an
|
|
15
|
+
* optional footer for a link or action. Use to pick a person, brand, store or other entity by its
|
|
16
|
+
* picture; the footer sits outside the radio, so a link in it never nests inside the control.
|
|
17
|
+
*
|
|
18
|
+
* @summary pick one person or entity from avatar-led cards
|
|
19
|
+
*/
|
|
20
|
+
const RadioCardAvatar = ({ items, size = 'sm', avatarShape = 'square', indicator = 'radio', commitOn = 'change', value, defaultValue, onChange, onOptionPress, className, 'data-testid': dataTestId, ...props }) => {
|
|
21
|
+
const rootTestId = testIdUtils.useResolvedTestId({ testId: dataTestId, segment: 'radio-group', rootName: 'radio-group' });
|
|
22
|
+
const Indicator = indicator === 'checkbox' ? Checkboxes.CheckboxBase : Radios.RadioButtonBase;
|
|
23
|
+
const optionIds = useOptionIds.useOptionIds();
|
|
24
|
+
const { selectionProps, optionHandlers } = useCommitOnPress.useCommitOnPress({ commitOn, value, defaultValue, onChange, onOptionPress });
|
|
25
|
+
return (jsxRuntime.jsx(reactAriaComponents.RadioGroup, { ...props, ...selectionProps, "data-testid": rootTestId, className: (state) => cx.cx('flex flex-col gap-3', typeof className === 'function' ? className(state) : className), children: ({ state, isDisabled: isGroupDisabled, isReadOnly }) => items.map((item, index) => {
|
|
26
|
+
const isSelected = state.selectedValue === item.value;
|
|
27
|
+
const isDisabled = isGroupDisabled || Boolean(item.disabled);
|
|
28
|
+
const optionTestId = testIdUtils.joinTestId(rootTestId, `option-${item.value}`);
|
|
29
|
+
const { subtitle: subtitleId } = optionIds(index, { subtitle: item.subtitle });
|
|
30
|
+
return (
|
|
31
|
+
// The card, not the radio, carries the selected ring so the footer sits inside it.
|
|
32
|
+
jsxRuntime.jsxs("div", { ...optionHandlers(item.value, { isDisabled, isReadOnly }), className: cx.cx('relative flex flex-col rounded-xl bg-primary ring-inset', isSelected ? 'ring-2 ring-brand' : 'ring-1 ring-secondary', isDisabled && 'bg-disabled_subtle ring-disabled_subtle'), children: [jsxRuntime.jsx(reactAriaComponents.Radio, { isDisabled: item.disabled, value: item.value, "aria-label": [item.title, item.secondaryTitle].filter(Boolean).join(' '), "aria-describedby": subtitleId, "data-testid": optionTestId, className: ({ isDisabled }) => cx.cx('peer flex cursor-pointer items-center', size === 'md' ? 'gap-4 p-5' : 'gap-3 px-4 py-5', isDisabled && 'cursor-not-allowed'), children: ({ isDisabled, isSelected, isFocusVisible }) => (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Avatar.Avatar, { size: size === 'md' ? 'xl' : 'lg', rounded: avatarShape === 'round', border: avatarShape === 'square', src: item.src, alt: "", initials: item.initials, placeholderIcon: item.placeholderIcon }), jsxRuntime.jsxs("div", { className: "flex min-w-0 flex-1 flex-col", children: [jsxRuntime.jsxs("div", { className: cx.cx('flex items-center', size === 'md' ? 'gap-4' : 'gap-3'), children: [jsxRuntime.jsxs("span", { className: cx.cx('flex min-w-0 flex-1 gap-1.5', size === 'md' ? 'text-lg' : 'text-md'), children: [jsxRuntime.jsx("span", { className: "truncate font-semibold text-primary", children: item.title }), item.secondaryTitle && jsxRuntime.jsx("span", { className: "max-w-1/2 shrink-0 truncate text-tertiary", children: item.secondaryTitle })] }), jsxRuntime.jsx(Indicator, { size: size, isDisabled: isDisabled, isSelected: isSelected, isFocusVisible: isFocusVisible })] }), item.subtitle && (jsxRuntime.jsx("span", { id: subtitleId, className: cx.cx('truncate text-tertiary', size === 'md' ? 'text-md' : 'text-sm'), children: item.subtitle }))] })] })) }), jsxRuntime.jsx("span", { "aria-hidden": "true", className: "pointer-events-none absolute inset-0 rounded-xl outline-focus-ring peer-data-[focus-visible]:outline-2 peer-data-[focus-visible]:outline-offset-2" }), item.footer && (jsxRuntime.jsx("div", { className: cx.cx('flex justify-end border-t border-secondary px-4 py-3', isSelected ? 'mx-0.5' : 'mx-px'), children: item.footer }))] }, item.value));
|
|
33
|
+
}) }));
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
exports.RadioCardAvatar = RadioCardAvatar;
|
|
37
|
+
//# sourceMappingURL=RadioCardAvatar.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RadioCardAvatar.cjs","sources":["../../../../../src/components/molecules/RadioCards/RadioCardAvatar/RadioCardAvatar.tsx"],"sourcesContent":[null],"names":["useResolvedTestId","CheckboxBase","RadioButtonBase","useOptionIds","useCommitOnPress","_jsx","AriaRadioGroup","cx","joinTestId","_jsxs","AriaRadio","_Fragment","Avatar"],"mappings":";;;;;;;;;;;;AAoCA;;;;;;AAMG;AACI,MAAM,eAAe,GAAG,CAAC,EAC9B,KAAK,EACL,IAAI,GAAG,IAAI,EACX,WAAW,GAAG,QAAQ,EACtB,SAAS,GAAG,OAAO,EACnB,QAAQ,GAAG,QAAQ,EACnB,KAAK,EACL,YAAY,EACZ,QAAQ,EACR,aAAa,EACb,SAAS,EACT,aAAa,EAAE,UAAU,EACzB,GAAG,KAAK,EACa,KAAI;AACzB,IAAA,MAAM,UAAU,GAAGA,6BAAiB,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,aAAa,EAAE,CAAC;AAC7G,IAAA,MAAM,SAAS,GAAG,SAAS,KAAK,UAAU,GAAGC,uBAAY,GAAGC,sBAAe;AAC3E,IAAA,MAAM,SAAS,GAAGC,yBAAY,EAAE;IAEhC,MAAM,EAAE,cAAc,EAAE,cAAc,EAAE,GAAGC,iCAAgB,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,aAAa,EAAE,CAAC;AAEvH,IAAA,QACEC,cAAA,CAACC,8BAAc,EAAA,EAAA,GACT,KAAK,EAAA,GACL,cAAc,EAAA,aAAA,EACL,UAAU,EACvB,SAAS,EAAE,CAAC,KA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CAAA,MAAA,EAAA,EAAM,EAAE,EAAE,UAAU,EAAE,SAAS,EAAEE,KAAE,CAAC,wBAAwB,EAAE,IAAI,KAAK,IAAI,GAAG,SAAS,GAAG,SAAS,CAAC,EAAA,QAAA,EACjG,IAAI,CAAC,QAAQ,EAAA,CACT,CACR,IACG,CAAA,EAAA,CACL,CACJ,GACS,EAEZF,cAAA,CAAA,MAAA,EAAA,EAAA,aAAA,EACc,MAAM,EAClB,SAAS,EAAC,mJAAmJ,EAAA,CAC7J,EAED,IAAI,CAAC,MAAM,KACVA,wBAAK,SAAS,EAAEE,KAAE,CAAC,sDAAsD,EAAE,UAAU,GAAG,QAAQ,GAAG,OAAO,CAAC,YAAG,IAAI,CAAC,MAAM,EAAA,CAAO,CACjI,CAAA,EAAA,EAxDI,IAAI,CAAC,KAAK,CAyDX;QAEV,CAAC,CAAC,EAAA,CAEW;AAErB;;"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { RadioGroupProps } from 'react-aria-components';
|
|
2
|
+
import type { RadioCardAvatarItemType, RadioCardOptionPressType } from '../radioCards.types';
|
|
3
|
+
export interface RadioCardAvatarProps extends Omit<RadioGroupProps, 'onChange'> {
|
|
4
|
+
/** Avatar, text and indicator size of every option. */
|
|
5
|
+
size?: 'sm' | 'md';
|
|
6
|
+
/** People or entities to choose from; each `value` is the option value. */
|
|
7
|
+
items: RadioCardAvatarItemType[];
|
|
8
|
+
/** Shape of every avatar: `square` with a border for a logo, `round` without one for a person. */
|
|
9
|
+
avatarShape?: 'square' | 'round';
|
|
10
|
+
/** The selection mark: a radio dot, or the check tile the other cards use. */
|
|
11
|
+
indicator?: 'radio' | 'checkbox';
|
|
12
|
+
/**
|
|
13
|
+
* When `onChange` fires. `change` is the native radio: arrow keys move the check and change the value.
|
|
14
|
+
* `press` is for a choice that navigates: arrow keys only move the check, a press (click, Space, Enter)
|
|
15
|
+
* changes the value, and leaving the group puts the check back on the value.
|
|
16
|
+
*/
|
|
17
|
+
commitOn?: 'change' | 'press';
|
|
18
|
+
/** Called with the new value. With `commitOn="press"` the second argument carries the press's modifier keys; otherwise it is absent. */
|
|
19
|
+
onChange?: (value: string, press?: RadioCardOptionPressType) => void;
|
|
20
|
+
/** Called with the option's value and the press's modifier keys on every press of it, selected or not; `onChange` stays silent for the one already selected. */
|
|
21
|
+
onOptionPress?: (value: string, press: RadioCardOptionPressType) => void;
|
|
22
|
+
/** Overrides the root `data-testid`. Options derive from it (e.g. `<root>--option-<value>`). */
|
|
23
|
+
'data-testid'?: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Radio group where each option is a card with an avatar or logo, a title, a subtitle and an
|
|
27
|
+
* optional footer for a link or action. Use to pick a person, brand, store or other entity by its
|
|
28
|
+
* picture; the footer sits outside the radio, so a link in it never nests inside the control.
|
|
29
|
+
*
|
|
30
|
+
* @summary pick one person or entity from avatar-led cards
|
|
31
|
+
*/
|
|
32
|
+
export declare const RadioCardAvatar: ({ items, size, avatarShape, indicator, commitOn, value, defaultValue, onChange, onOptionPress, className, "data-testid": dataTestId, ...props }: RadioCardAvatarProps) => import("react").JSX.Element;
|
|
33
|
+
//# sourceMappingURL=RadioCardAvatar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RadioCardAvatar.d.ts","sourceRoot":"","sources":["../../../../../src/components/molecules/RadioCards/RadioCardAvatar/RadioCardAvatar.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAG7D,OAAO,KAAK,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAG7F,MAAM,WAAW,oBAAqB,SAAQ,IAAI,CAAC,eAAe,EAAE,UAAU,CAAC;IAC7E,uDAAuD;IACvD,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACnB,2EAA2E;IAC3E,KAAK,EAAE,uBAAuB,EAAE,CAAC;IACjC,kGAAkG;IAClG,WAAW,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;IACjC,8EAA8E;IAC9E,SAAS,CAAC,EAAE,OAAO,GAAG,UAAU,CAAC;IACjC;;;;OAIG;IACH,QAAQ,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;IAC9B,wIAAwI;IACxI,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,wBAAwB,KAAK,IAAI,CAAC;IACrE,gKAAgK;IAChK,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,wBAAwB,KAAK,IAAI,CAAC;IACzE,gGAAgG;IAChG,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,GAAI,iJAa7B,oBAAoB,gCAuFtB,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
|
+
import { Avatar } from '@flipdish/ui-library/components/atoms/Avatar';
|
|
3
|
+
import { CheckboxBase } from '@flipdish/ui-library/components/atoms/Checkboxes';
|
|
4
|
+
import { RadioButtonBase } from '@flipdish/ui-library/components/atoms/Radios';
|
|
5
|
+
import { cx } from '@flipdish/ui-library/utilities/cx';
|
|
6
|
+
import { useResolvedTestId, joinTestId } from '@flipdish/ui-library/utilities/testIdUtils';
|
|
7
|
+
import { RadioGroup, Radio } from 'react-aria-components';
|
|
8
|
+
import { useOptionIds } from '../hooks/useOptionIds.js';
|
|
9
|
+
import { useCommitOnPress } from './hooks/useCommitOnPress.js';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Radio group where each option is a card with an avatar or logo, a title, a subtitle and an
|
|
13
|
+
* optional footer for a link or action. Use to pick a person, brand, store or other entity by its
|
|
14
|
+
* picture; the footer sits outside the radio, so a link in it never nests inside the control.
|
|
15
|
+
*
|
|
16
|
+
* @summary pick one person or entity from avatar-led cards
|
|
17
|
+
*/
|
|
18
|
+
const RadioCardAvatar = ({ items, size = 'sm', avatarShape = 'square', indicator = 'radio', commitOn = 'change', value, defaultValue, onChange, onOptionPress, className, 'data-testid': dataTestId, ...props }) => {
|
|
19
|
+
const rootTestId = useResolvedTestId({ testId: dataTestId, segment: 'radio-group', rootName: 'radio-group' });
|
|
20
|
+
const Indicator = indicator === 'checkbox' ? CheckboxBase : RadioButtonBase;
|
|
21
|
+
const optionIds = useOptionIds();
|
|
22
|
+
const { selectionProps, optionHandlers } = useCommitOnPress({ commitOn, value, defaultValue, onChange, onOptionPress });
|
|
23
|
+
return (jsx(RadioGroup, { ...props, ...selectionProps, "data-testid": rootTestId, className: (state) => cx('flex flex-col gap-3', typeof className === 'function' ? className(state) : className), children: ({ state, isDisabled: isGroupDisabled, isReadOnly }) => items.map((item, index) => {
|
|
24
|
+
const isSelected = state.selectedValue === item.value;
|
|
25
|
+
const isDisabled = isGroupDisabled || Boolean(item.disabled);
|
|
26
|
+
const optionTestId = joinTestId(rootTestId, `option-${item.value}`);
|
|
27
|
+
const { subtitle: subtitleId } = optionIds(index, { subtitle: item.subtitle });
|
|
28
|
+
return (
|
|
29
|
+
// The card, not the radio, carries the selected ring so the footer sits inside it.
|
|
30
|
+
jsxs("div", { ...optionHandlers(item.value, { isDisabled, isReadOnly }), className: cx('relative flex flex-col rounded-xl bg-primary ring-inset', isSelected ? 'ring-2 ring-brand' : 'ring-1 ring-secondary', isDisabled && 'bg-disabled_subtle ring-disabled_subtle'), children: [jsx(Radio, { isDisabled: item.disabled, value: item.value, "aria-label": [item.title, item.secondaryTitle].filter(Boolean).join(' '), "aria-describedby": subtitleId, "data-testid": optionTestId, className: ({ isDisabled }) => cx('peer flex cursor-pointer items-center', size === 'md' ? 'gap-4 p-5' : 'gap-3 px-4 py-5', isDisabled && 'cursor-not-allowed'), children: ({ isDisabled, isSelected, isFocusVisible }) => (jsxs(Fragment, { children: [jsx(Avatar, { size: size === 'md' ? 'xl' : 'lg', rounded: avatarShape === 'round', border: avatarShape === 'square', src: item.src, alt: "", initials: item.initials, placeholderIcon: item.placeholderIcon }), jsxs("div", { className: "flex min-w-0 flex-1 flex-col", children: [jsxs("div", { className: cx('flex items-center', size === 'md' ? 'gap-4' : 'gap-3'), children: [jsxs("span", { className: cx('flex min-w-0 flex-1 gap-1.5', size === 'md' ? 'text-lg' : 'text-md'), children: [jsx("span", { className: "truncate font-semibold text-primary", children: item.title }), item.secondaryTitle && jsx("span", { className: "max-w-1/2 shrink-0 truncate text-tertiary", children: item.secondaryTitle })] }), jsx(Indicator, { size: size, isDisabled: isDisabled, isSelected: isSelected, isFocusVisible: isFocusVisible })] }), item.subtitle && (jsx("span", { id: subtitleId, className: cx('truncate text-tertiary', size === 'md' ? 'text-md' : 'text-sm'), children: item.subtitle }))] })] })) }), jsx("span", { "aria-hidden": "true", className: "pointer-events-none absolute inset-0 rounded-xl outline-focus-ring peer-data-[focus-visible]:outline-2 peer-data-[focus-visible]:outline-offset-2" }), item.footer && (jsx("div", { className: cx('flex justify-end border-t border-secondary px-4 py-3', isSelected ? 'mx-0.5' : 'mx-px'), children: item.footer }))] }, item.value));
|
|
31
|
+
}) }));
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export { RadioCardAvatar };
|
|
35
|
+
//# sourceMappingURL=RadioCardAvatar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RadioCardAvatar.js","sources":["../../../../../src/components/molecules/RadioCards/RadioCardAvatar/RadioCardAvatar.tsx"],"sourcesContent":[null],"names":["_jsx","AriaRadioGroup","_jsxs","AriaRadio","_Fragment"],"mappings":";;;;;;;;;;AAoCA;;;;;;AAMG;AACI,MAAM,eAAe,GAAG,CAAC,EAC9B,KAAK,EACL,IAAI,GAAG,IAAI,EACX,WAAW,GAAG,QAAQ,EACtB,SAAS,GAAG,OAAO,EACnB,QAAQ,GAAG,QAAQ,EACnB,KAAK,EACL,YAAY,EACZ,QAAQ,EACR,aAA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|
-
* Owns when
|
|
43
|
+
* Owns when a `RadioCardAvatar` option's choice is committed. In `change` mode it passes the selection props through.
|
|
44
44
|
* In `press` mode it keeps the check the arrow keys moved to, commits only on a press, and puts the check back
|
|
45
45
|
* when `value` changes or focus leaves the group.
|
|
46
46
|
*
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCommitOnPress.cjs","sources":["../../../../../../src/components/molecules/RadioCards/RadioCardAvatar/hooks/useCommitOnPress.ts"],"sourcesContent":[null],"names":["useState","useRef"],"mappings":";;;;AA4CA,MAAM,YAAY,GAAG,CAAC,MAAmB,KAAiC,MAAM,YAAY,gBAAgB,IAAI,MAAM,CAAC,IAAI,KAAK,OAAO;AAEvI;;;;;;AAMG;AACI,MAAM,aAAa,GAAG,CAAC,KAAiC,EAAE,MAA0C,MAAgC;IACzI,OAAO,EAAE,KAAK,CAAC,OAAO;IACtB,OAAO,EAAE,KAAK,CAAC,OAAO;IACtB,QAAQ,EAAE,KAAK,CAAC,QAAQ;IACxB,MAAM,EAAE,KAAK,CAAC,MAAM;IACpB,MAAM;AACP,CAAA;AAED;;;;;AAKG;AACI,MAAM,aAAa,GAAG,CAAC,KAAiB,MAA0C,KAAK,CAAC,MAAM,KAAK,CAAC,GAAG,UAAU,GAAG,SAAS;AAEpI;;;;;;;AAOG;AACI,MAAM,UAAU,GAAG,CAAC,KAAoB,KAAa;AAC1D,IAAA,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,MAAM,CAAC;AAAE,QAAA,OAAO,KAAK;AAC7C,IAAA,IAAI,KAAK,CAAC,GAAG,KAAK,OAAO;AAAE,QAAA,OAAO,IAAI;IACtC,OAAO,KAAK,CAAC,GAAG,KAAK,GAAG,IAAI,KAAK,CAAC,MAAM,CAAC,OAAO;AAClD;AAEA;;;;;;;AAOG;AACI,MAAM,gBAAgB,GAAG,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,aAAa,EAA2B,KAAI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AAM,EAAE,CAAC,KAAK,KAAI;AAChB,YAAA,gBAAgB,CAAC,OAAO,GAAG,KAAK;AAChC,YAAA,IAAI,cAAc,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,aAAa,EAAE,QAAQ,CAAC,KAAK,CAAC,aAAa,CAAC;gBAAE,UAAU,CAAC,IAAI,CAAC;QAC3G,CAAC;AACF,KAAA,CAAC;AAEF,IAAA,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE;AAC3C;;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { FocusEvent, KeyboardEvent, MouseEvent } from 'react';
|
|
2
|
-
import type {
|
|
2
|
+
import type { RadioCardOptionPressType } from '../../radioCards.types';
|
|
3
3
|
interface UseCommitOnPressOptions {
|
|
4
4
|
/** `change` fires `onChange` as the native radio does; `press` defers it to a press and lets arrow keys only move the check. */
|
|
5
5
|
commitOn: 'change' | 'press';
|
|
@@ -8,9 +8,9 @@ interface UseCommitOnPressOptions {
|
|
|
8
8
|
/** The first value of an uncontrolled group. */
|
|
9
9
|
defaultValue: string | null | undefined;
|
|
10
10
|
/** The consumer's change callback; in `press` mode it also receives the press that committed the change. */
|
|
11
|
-
onChange?: (value: string, press?:
|
|
11
|
+
onChange?: (value: string, press?: RadioCardOptionPressType) => void;
|
|
12
12
|
/** The consumer's press callback, called for every press whether or not the value changes. */
|
|
13
|
-
onOptionPress?: (value: string, press:
|
|
13
|
+
onOptionPress?: (value: string, press: RadioCardOptionPressType) => void;
|
|
14
14
|
}
|
|
15
15
|
/** The props the group takes for its selection: untouched in `change` mode, the pending check in `press` mode. */
|
|
16
16
|
interface SelectionProps {
|
|
@@ -37,14 +37,14 @@ interface OptionHandlers {
|
|
|
37
37
|
* @param source Whether the press came from the keyboard or a pointer.
|
|
38
38
|
* @returns The modifier keys and source a consumer needs to open the option's target in a new tab.
|
|
39
39
|
*/
|
|
40
|
-
export declare const toOptionPress: (event: MouseEvent | KeyboardEvent, source:
|
|
40
|
+
export declare const toOptionPress: (event: MouseEvent | KeyboardEvent, source: RadioCardOptionPressType["source"]) => RadioCardOptionPressType;
|
|
41
41
|
/**
|
|
42
42
|
* Whether a click came from the keyboard: Space on a focused radio fires a native click with no `detail`.
|
|
43
43
|
*
|
|
44
44
|
* @param event The click on an option.
|
|
45
45
|
* @returns `keyboard` for a click with no pointer behind it, otherwise `pointer`.
|
|
46
46
|
*/
|
|
47
|
-
export declare const pressSourceOf: (event: MouseEvent) =>
|
|
47
|
+
export declare const pressSourceOf: (event: MouseEvent) => RadioCardOptionPressType["source"];
|
|
48
48
|
/**
|
|
49
49
|
* Whether a keydown on a radio input is a press of its option. Enter always is, since a native radio ignores it.
|
|
50
50
|
* Space is only when the radio is already checked, where Chromium fires no click; on an unchecked radio the
|
|
@@ -55,7 +55,7 @@ export declare const pressSourceOf: (event: MouseEvent) => OptionPressType["sour
|
|
|
55
55
|
*/
|
|
56
56
|
export declare const isPressKey: (event: KeyboardEvent) => boolean;
|
|
57
57
|
/**
|
|
58
|
-
* Owns when
|
|
58
|
+
* Owns when a `RadioCardAvatar` option's choice is committed. In `change` mode it passes the selection props through.
|
|
59
59
|
* In `press` mode it keeps the check the arrow keys moved to, commits only on a press, and puts the check back
|
|
60
60
|
* when `value` changes or focus leaves the group.
|
|
61
61
|
*
|