diff --git a/.changeset/forty-peaches-stay.md b/.changeset/forty-peaches-stay.md new file mode 100644 index 00000000000..de77f82d107 --- /dev/null +++ b/.changeset/forty-peaches-stay.md @@ -0,0 +1,6 @@ +--- +'@clerk/clerk-js': patch +'@clerk/types': patch +--- + +Refactor InvoicePage title and invoice ID UI. diff --git a/packages/clerk-js/bundlewatch.config.json b/packages/clerk-js/bundlewatch.config.json index 668550577df..feba2de381c 100644 --- a/packages/clerk-js/bundlewatch.config.json +++ b/packages/clerk-js/bundlewatch.config.json @@ -1,6 +1,6 @@ { "files": [ - { "path": "./dist/clerk.js", "maxSize": "592.5kB" }, + { "path": "./dist/clerk.js", "maxSize": "593kB" }, { "path": "./dist/clerk.browser.js", "maxSize": "74KB" }, { "path": "./dist/clerk.headless*.js", "maxSize": "55KB" }, { "path": "./dist/ui-common*.js", "maxSize": "100KB" }, diff --git a/packages/clerk-js/src/ui/components/Invoices/InvoicePage.tsx b/packages/clerk-js/src/ui/components/Invoices/InvoicePage.tsx index fcd9f09343e..dc2e965cb30 100644 --- a/packages/clerk-js/src/ui/components/Invoices/InvoicePage.tsx +++ b/packages/clerk-js/src/ui/components/Invoices/InvoicePage.tsx @@ -1,6 +1,8 @@ import { useInvoicesContext } from '../../contexts'; -import { Badge, Box, Dd, descriptors, Dl, Dt, Heading, Spinner, Text } from '../../customizables'; +import { Badge, Box, Button, Dd, descriptors, Dl, Dt, Heading, Icon, Span, Spinner, Text } from '../../customizables'; import { Header, LineItems } from '../../elements'; +import { useClipboard } from '../../hooks'; +import { Check, Copy } from '../../icons'; import { useRouter } from '../../router'; import { common } from '../../styledSystem'; import { colors } from '../../utils'; @@ -76,18 +78,43 @@ export const InvoicePage = () => { })} > - - {truncateWithEndVisible(invoice.id)} - + + + Invoice ID + + ({ + display: 'flex', + alignItems: 'center', + gap: t.space.$0x25, + color: t.colors.$colorTextSecondary, + })} + > + + + {truncateWithEndVisible(invoice.id)} + + + + {
@@ -116,7 +144,12 @@ export const InvoicePage = () => {
- {new Date(invoice.paymentDueOn).toLocaleDateString()} + + {new Date(invoice.paymentDueOn).toLocaleDateString()} +
{ >
@@ -134,7 +168,12 @@ export const InvoicePage = () => {
- {new Date(invoice.paymentDueOn).toLocaleDateString()} + + {new Date(invoice.paymentDueOn).toLocaleDateString()} +
@@ -183,3 +222,34 @@ export const InvoicePage = () => { ); }; + +function CopyButton({ text, copyLabel = 'Copy' }: { text: string; copyLabel?: string }) { + const { onCopy, hasCopied } = useClipboard(text); + + return ( + + ); +} diff --git a/packages/clerk-js/src/ui/customizables/elementDescriptors.ts b/packages/clerk-js/src/ui/customizables/elementDescriptors.ts index f91058baef1..0c37ad62c20 100644 --- a/packages/clerk-js/src/ui/customizables/elementDescriptors.ts +++ b/packages/clerk-js/src/ui/customizables/elementDescriptors.ts @@ -343,12 +343,20 @@ export const APPEARANCE_KEYS = containsAllElementsConfigKeys([ 'invoiceRoot', 'invoiceCard', 'invoiceHeader', + 'invoiceHeaderContent', 'invoiceTitle', + 'invoiceHeaderTitleBadgeContainer', + 'invoiceId', + 'invoiceIdContainer', + 'invoiceTitleIdContainer', 'invoiceBadge', 'invoiceDetails', 'invoiceDetailsItem', 'invoiceDetailsItemTitle', + 'invoiceDetailsItemTitleText', 'invoiceDetailsItemValue', + 'invoiceDetailsItemValueText', + 'invoiceCopyButton', 'invoiceContent', 'menuButton', diff --git a/packages/types/src/appearance.ts b/packages/types/src/appearance.ts index 03903d1ca4d..d758ed78214 100644 --- a/packages/types/src/appearance.ts +++ b/packages/types/src/appearance.ts @@ -467,12 +467,20 @@ export type ElementsConfig = { invoiceRoot: WithOptions; invoiceCard: WithOptions; invoiceHeader: WithOptions; + invoiceHeaderContent: WithOptions; invoiceTitle: WithOptions; + invoiceHeaderTitleBadgeContainer: WithOptions; + invoiceTitleIdContainer: WithOptions; + invoiceId: WithOptions; + invoiceIdContainer: WithOptions; invoiceBadge: WithOptions; invoiceDetails: WithOptions; invoiceDetailsItem: WithOptions; invoiceDetailsItemTitle: WithOptions; + invoiceDetailsItemTitleText: WithOptions; invoiceDetailsItemValue: WithOptions; + invoiceDetailsItemValueText: WithOptions; + invoiceCopyButton: WithOptions; invoiceContent: WithOptions; menuButton: WithOptions;