@veevarts/design-system 2.0.0-beta.6 → 2.0.0-csm.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/README.md +36 -0
- package/dist/components/Drawer/Drawer.d.ts +17 -0
- package/dist/components/Drawer/index.d.ts +2 -0
- package/dist/components/Modal/CloseButton.d.ts +18 -0
- package/dist/components/Modal/Modal.d.ts +15 -0
- package/dist/components/Modal/index.d.ts +2 -0
- package/dist/components/Modal/useLabelledCloseButton.d.ts +13 -0
- package/dist/components/Select/Select.d.ts +10 -0
- package/dist/components/Table/Table.d.ts +7 -0
- package/dist/components/Table/index.d.ts +2 -0
- package/dist/components/index.d.ts +6 -0
- package/dist/index.cjs +10 -9
- package/dist/index.d.ts +4 -0
- package/dist/index.js +11264 -5922
- package/dist/patterns/ActivityTimeline/ActivityTimeline.d.ts +3 -0
- package/dist/patterns/ActivityTimeline/index.d.ts +2 -0
- package/dist/patterns/ActivityTimeline/styles.d.ts +15 -0
- package/dist/patterns/ActivityTimeline/types.d.ts +15 -0
- package/dist/patterns/AdminTable/AdminTable.d.ts +1 -0
- package/dist/patterns/AdminTable/styles.d.ts +6 -0
- package/dist/patterns/AdminToolbar/AdminToolbar.d.ts +13 -2
- package/dist/patterns/AdminToolbar/index.d.ts +1 -0
- package/dist/patterns/AdminToolbar/styles.d.ts +49 -0
- package/dist/patterns/AdminToolbar/types.d.ts +2 -0
- package/dist/patterns/AmountList/AmountList.d.ts +3 -0
- package/dist/patterns/AmountList/index.d.ts +2 -0
- package/dist/patterns/AmountList/styles.d.ts +23 -0
- package/dist/patterns/AmountList/types.d.ts +26 -0
- package/dist/patterns/ArtifactCard/ArtifactCard.d.ts +19 -0
- package/dist/patterns/ArtifactCard/index.d.ts +2 -0
- package/dist/patterns/ArtifactCard/styles.d.ts +31 -0
- package/dist/patterns/ArtifactCard/types.d.ts +34 -0
- package/dist/patterns/AssistantActivity/AssistantActivity.d.ts +15 -0
- package/dist/patterns/AssistantActivity/formatAssistantDuration.d.ts +10 -0
- package/dist/patterns/AssistantActivity/index.d.ts +3 -0
- package/dist/patterns/AssistantActivity/styles.d.ts +31 -0
- package/dist/patterns/AssistantActivity/types.d.ts +37 -0
- package/dist/patterns/AssistantComposer/AssistantComposer.d.ts +15 -0
- package/dist/patterns/AssistantComposer/index.d.ts +2 -0
- package/dist/patterns/AssistantComposer/styles.d.ts +27 -0
- package/dist/patterns/AssistantComposer/types.d.ts +48 -0
- package/dist/patterns/AssistantMarkdown/AssistantMarkdown.d.ts +17 -0
- package/dist/patterns/AssistantMarkdown/index.d.ts +3 -0
- package/dist/patterns/AssistantMarkdown/parser.d.ts +37 -0
- package/dist/patterns/AssistantMarkdown/styles.d.ts +35 -0
- package/dist/patterns/AssistantMarkdown/types.d.ts +37 -0
- package/dist/patterns/AssistantMessage/AssistantMessage.d.ts +17 -0
- package/dist/patterns/AssistantMessage/index.d.ts +2 -0
- package/dist/patterns/AssistantMessage/styles.d.ts +45 -0
- package/dist/patterns/AssistantMessage/types.d.ts +73 -0
- package/dist/patterns/AssistantNotice/AssistantNotice.d.ts +17 -0
- package/dist/patterns/AssistantNotice/index.d.ts +2 -0
- package/dist/patterns/AssistantNotice/styles.d.ts +36 -0
- package/dist/patterns/AssistantNotice/types.d.ts +46 -0
- package/dist/patterns/CardList/CardList.d.ts +3 -0
- package/dist/patterns/CardList/index.d.ts +2 -0
- package/dist/patterns/CardList/styles.d.ts +20 -0
- package/dist/patterns/CardList/types.d.ts +20 -0
- package/dist/patterns/CardStack/CardStack.d.ts +7 -0
- package/dist/patterns/CardStack/index.d.ts +2 -0
- package/dist/patterns/CardStack/styles.d.ts +2 -0
- package/dist/patterns/CashTenderForm/types.d.ts +6 -0
- package/dist/patterns/CellText/CellText.d.ts +16 -0
- package/dist/patterns/CellText/index.d.ts +2 -0
- package/dist/patterns/CellText/styles.d.ts +7 -0
- package/dist/patterns/CitationMarker/CitationMarker.d.ts +16 -0
- package/dist/patterns/CitationMarker/index.d.ts +2 -0
- package/dist/patterns/CitationMarker/styles.d.ts +19 -0
- package/dist/patterns/CitationMarker/types.d.ts +12 -0
- package/dist/patterns/DiscardGuard/DiscardGuard.d.ts +23 -0
- package/dist/patterns/DiscardGuard/context.d.ts +25 -0
- package/dist/patterns/DiscardGuard/index.d.ts +6 -0
- package/dist/patterns/DiscardGuard/useDiscardGuard.d.ts +38 -0
- package/dist/patterns/DonationAmounts/index.d.ts +1 -1
- package/dist/patterns/DonationAmounts/styles.d.ts +32 -0
- package/dist/patterns/DonationAmounts/types.d.ts +55 -1
- package/dist/patterns/DonationAmounts/utils/currency.d.ts +7 -3
- package/dist/patterns/EntityRow/EntityList.d.ts +9 -0
- package/dist/patterns/EntityRow/EntityRow.d.ts +3 -0
- package/dist/patterns/EntityRow/context.d.ts +2 -0
- package/dist/patterns/EntityRow/icons.d.ts +3 -0
- package/dist/patterns/EntityRow/index.d.ts +3 -0
- package/dist/patterns/EntityRow/initials.d.ts +6 -0
- package/dist/patterns/EntityRow/styles.d.ts +59 -0
- package/dist/patterns/EntityRow/types.d.ts +118 -0
- package/dist/patterns/FilterSelect/FilterSelect.d.ts +3 -0
- package/dist/patterns/FilterSelect/FilterSelectGroup.d.ts +3 -0
- package/dist/patterns/FilterSelect/index.d.ts +3 -0
- package/dist/patterns/FilterSelect/styles.d.ts +17 -0
- package/dist/patterns/FilterSelect/types.d.ts +19 -0
- package/dist/patterns/InlineConfirm/InlineConfirm.d.ts +38 -0
- package/dist/patterns/InlineConfirm/index.d.ts +2 -0
- package/dist/patterns/InlineConfirm/styles.d.ts +16 -0
- package/dist/patterns/InstallmentFundAssignment/InstallmentFundAssignment.d.ts +1 -1
- package/dist/patterns/InstallmentFundAssignment/types.d.ts +3 -0
- package/dist/patterns/InstallmentSchedule/InstallmentSchedule.d.ts +1 -1
- package/dist/patterns/InstallmentSchedule/InstallmentTable.d.ts +1 -1
- package/dist/patterns/InstallmentSchedule/index.d.ts +1 -1
- package/dist/patterns/InstallmentSchedule/types.d.ts +62 -3
- package/dist/patterns/InstallmentSchedule/utils.d.ts +33 -0
- package/dist/patterns/KeyValueChip/KeyValueChip.d.ts +1 -0
- package/dist/patterns/KeyValueRows/KeyValueRows.d.ts +13 -0
- package/dist/patterns/KeyValueRows/index.d.ts +2 -0
- package/dist/patterns/KeyValueRows/styles.d.ts +8 -0
- package/dist/patterns/LineItemRows/LineItemRows.d.ts +17 -0
- package/dist/patterns/LineItemRows/index.d.ts +2 -0
- package/dist/patterns/LineItemRows/styles.d.ts +13 -0
- package/dist/patterns/ListPanel/ListPanel.d.ts +2 -0
- package/dist/patterns/LoadMoreFooter/LoadMoreFooter.d.ts +3 -0
- package/dist/patterns/LoadMoreFooter/index.d.ts +2 -0
- package/dist/patterns/LoadMoreFooter/styles.d.ts +7 -0
- package/dist/patterns/LoadMoreFooter/types.d.ts +10 -0
- package/dist/patterns/MetaCard/types.d.ts +2 -0
- package/dist/patterns/ModalPanels/ModalPanels.d.ts +35 -0
- package/dist/patterns/ModalPanels/context.d.ts +20 -0
- package/dist/patterns/ModalPanels/focus.d.ts +44 -0
- package/dist/patterns/ModalPanels/index.d.ts +6 -0
- package/dist/patterns/ModalPanels/styles.d.ts +13 -0
- package/dist/patterns/ModalPanels/useModalPanels.d.ts +30 -0
- package/dist/patterns/OutcomeView/index.d.ts +1 -1
- package/dist/patterns/OutcomeView/types.d.ts +110 -3
- package/dist/patterns/PageHeader/PageHeader.d.ts +1 -0
- package/dist/patterns/PaginationSummary/PaginationSummary.d.ts +12 -0
- package/dist/patterns/PaginationSummary/index.d.ts +1 -1
- package/dist/patterns/PaymentSubAmountInput/PaymentSubAmountInput.d.ts +2 -0
- package/dist/patterns/PillTabs/PillTabs.d.ts +3 -0
- package/dist/patterns/PillTabs/ids.d.ts +9 -0
- package/dist/patterns/PillTabs/index.d.ts +3 -0
- package/dist/patterns/PillTabs/styles.d.ts +20 -0
- package/dist/patterns/PillTabs/types.d.ts +21 -0
- package/dist/patterns/{CatalogItemCard → Programs/CatalogItemCard}/type.d.ts +1 -1
- package/dist/patterns/{EventDetails → Programs/EventDetails}/EventDetails.d.ts +3 -1
- package/dist/patterns/{OfferCard → Programs/OfferCard}/OfferCard.d.ts +1 -1
- package/dist/patterns/{OfferCard → Programs/OfferCard}/types.d.ts +7 -0
- package/dist/patterns/Programs/ProgramListItem/ProgramListItem.d.ts +17 -0
- package/dist/patterns/Programs/ProgramListItem/index.d.ts +2 -0
- package/dist/patterns/Programs/index.d.ts +5 -0
- package/dist/patterns/ReasonSelect/types.d.ts +1 -0
- package/dist/patterns/RecordCard/RecordCard.d.ts +3 -0
- package/dist/patterns/RecordCard/index.d.ts +2 -0
- package/dist/patterns/RecordCard/styles.d.ts +16 -0
- package/dist/patterns/RecordCard/types.d.ts +22 -0
- package/dist/patterns/RecordHeader/RecordHeader.d.ts +3 -0
- package/dist/patterns/RecordHeader/index.d.ts +2 -0
- package/dist/patterns/RecordHeader/styles.d.ts +43 -0
- package/dist/patterns/RecordHeader/types.d.ts +30 -0
- package/dist/patterns/RecordLayout/RecordLayout.d.ts +3 -0
- package/dist/patterns/RecordLayout/index.d.ts +2 -0
- package/dist/patterns/RecordLayout/styles.d.ts +8 -0
- package/dist/patterns/RecordLayout/types.d.ts +6 -0
- package/dist/patterns/RecordTotals/RecordTotals.d.ts +19 -0
- package/dist/patterns/RecordTotals/index.d.ts +2 -0
- package/dist/patterns/RecordTotals/styles.d.ts +19 -0
- package/dist/patterns/RefundMethodCards/RefundMethodCards.d.ts +4 -0
- package/dist/patterns/RefundMethodCards/index.d.ts +2 -0
- package/dist/patterns/RefundMethodCards/styles.d.ts +59 -0
- package/dist/patterns/RefundMethodCards/types.d.ts +72 -0
- package/dist/patterns/RefundProgressList/RefundProgressList.d.ts +4 -0
- package/dist/patterns/RefundProgressList/index.d.ts +2 -0
- package/dist/patterns/RefundProgressList/styles.d.ts +44 -0
- package/dist/patterns/RefundProgressList/types.d.ts +37 -0
- package/dist/patterns/RelatedRecordList/RelatedRecordList.d.ts +3 -0
- package/dist/patterns/RelatedRecordList/index.d.ts +2 -0
- package/dist/patterns/RelatedRecordList/styles.d.ts +19 -0
- package/dist/patterns/RelatedRecordList/types.d.ts +17 -0
- package/dist/patterns/ScrollToLatest/ScrollToLatest.d.ts +16 -0
- package/dist/patterns/ScrollToLatest/index.d.ts +2 -0
- package/dist/patterns/ScrollToLatest/styles.d.ts +11 -0
- package/dist/patterns/ScrollToLatest/types.d.ts +27 -0
- package/dist/patterns/SessionExpiredCard/SessionExpiredCard.d.ts +14 -0
- package/dist/patterns/SessionExpiredCard/index.d.ts +2 -0
- package/dist/patterns/SessionExpiredCard/type.d.ts +6 -0
- package/dist/patterns/SourceList/SourceList.d.ts +12 -0
- package/dist/patterns/SourceList/index.d.ts +2 -0
- package/dist/patterns/SourceList/styles.d.ts +20 -0
- package/dist/patterns/SourceList/types.d.ts +28 -0
- package/dist/patterns/SourcePill/SourcePill.d.ts +13 -0
- package/dist/patterns/SourcePill/index.d.ts +2 -0
- package/dist/patterns/SourcePill/styles.d.ts +19 -0
- package/dist/patterns/SourcePill/types.d.ts +19 -0
- package/dist/patterns/SplitPaymentSummary/index.d.ts +1 -1
- package/dist/patterns/SplitPaymentSummary/types.d.ts +18 -0
- package/dist/patterns/StatTiles/StatTiles.d.ts +3 -0
- package/dist/patterns/StatTiles/index.d.ts +2 -0
- package/dist/patterns/StatTiles/styles.d.ts +8 -0
- package/dist/patterns/StatTiles/types.d.ts +12 -0
- package/dist/patterns/StatusChip/StatusChip.d.ts +3 -3
- package/dist/patterns/StepProgress/StepProgress.d.ts +4 -0
- package/dist/patterns/StepProgress/index.d.ts +2 -0
- package/dist/patterns/StepProgress/styles.d.ts +29 -0
- package/dist/patterns/StepProgress/types.d.ts +43 -0
- package/dist/patterns/Summary/components/ActionBar.d.ts +2 -0
- package/dist/patterns/Summary/components/GrandTotalRow.d.ts +1 -0
- package/dist/patterns/Summary/components/ItemRow.d.ts +1 -0
- package/dist/patterns/Summary/components/SummaryBody.d.ts +4 -1
- package/dist/patterns/Summary/components/TotalsLineRow.d.ts +3 -2
- package/dist/patterns/Summary/types.d.ts +51 -9
- package/dist/patterns/TableSkeleton/TableSkeleton.d.ts +1 -0
- package/dist/patterns/TileSelect/TileSelect.d.ts +80 -2
- package/dist/patterns/TileSelect/index.d.ts +1 -1
- package/dist/patterns/TileSelect/styles.d.ts +14 -0
- package/dist/patterns/ToolbarButton/ToolbarButton.d.ts +2 -0
- package/dist/patterns/UnderlineTabs/UnderlineTabs.d.ts +20 -1
- package/dist/patterns/UnderlineTabs/index.d.ts +1 -1
- package/dist/patterns/UnderlineTabs/styles.d.ts +10 -0
- package/dist/patterns/WizardShell/index.d.ts +1 -1
- package/dist/patterns/WizardShell/types.d.ts +9 -1
- package/dist/patterns/grid-columns.d.ts +1 -1
- package/dist/patterns/index.d.ts +87 -17
- package/dist/patterns/shared/hasContent.d.ts +2 -0
- package/dist/patterns/shared/index.d.ts +1 -0
- package/dist/patterns/shared/motion.d.ts +6 -0
- package/dist/patterns/shared/recordTone.d.ts +9 -0
- package/dist/patterns/shared/rem.d.ts +4 -0
- package/dist/patterns/shared/useContainerWidth.d.ts +6 -0
- package/dist/patterns/shared/useDecimalDraft.d.ts +33 -0
- package/dist/patterns/shared/usePrefillEdits.d.ts +7 -0
- package/dist/providers/DensityProvider.d.ts +7 -0
- package/dist/providers/HeroUIProvider.d.ts +14 -1
- package/dist/providers/close-label-context.d.ts +18 -0
- package/dist/providers/density.d.ts +17 -0
- package/dist/providers/index.d.ts +4 -0
- package/dist/tailwind/index.cjs +107 -5
- package/dist/tailwind/index.d.ts +61 -0
- package/dist/tailwind/index.mjs +104 -5
- package/dist/test/ReducedMotion.d.ts +4 -0
- package/dist/test/RootFontSize.d.ts +5 -0
- package/dist/test/backdrop.d.ts +12 -0
- package/dist/test/container-width.d.ts +14 -0
- package/dist/test/contrast.d.ts +1 -0
- package/dist/test/px-class-names.d.ts +1 -0
- package/dist/test/px-classes.d.ts +3 -0
- package/dist/test/root-font-size.d.ts +8 -0
- package/dist/tokens/assistant-surface.d.ts +66 -0
- package/dist/tokens/index.d.ts +2 -0
- package/dist/tokens/pos-surface.d.ts +23 -4
- package/package.json +5 -2
- /package/dist/patterns/{CatalogItemCard → Programs/CatalogItemCard}/CatalogItemCard.d.ts +0 -0
- /package/dist/patterns/{CatalogItemCard → Programs/CatalogItemCard}/index.d.ts +0 -0
- /package/dist/patterns/{EventDetails → Programs/EventDetails}/index.d.ts +0 -0
- /package/dist/patterns/{OfferCard → Programs/OfferCard}/examples/CustomQuantitySelectorExample.d.ts +0 -0
- /package/dist/patterns/{OfferCard → Programs/OfferCard}/examples/ListWithEurosCurrencyExample.d.ts +0 -0
- /package/dist/patterns/{OfferCard → Programs/OfferCard}/examples/ListWithoutAnimationExample.d.ts +0 -0
- /package/dist/patterns/{OfferCard → Programs/OfferCard}/examples/index.d.ts +0 -0
- /package/dist/patterns/{OfferCard → Programs/OfferCard}/index.d.ts +0 -0
- /package/dist/patterns/{OfferCard → Programs/OfferCard}/utils/animations.d.ts +0 -0
- /package/dist/patterns/{OfferCard → Programs/OfferCard}/utils/currency.d.ts +0 -0
- /package/dist/patterns/{OfferCard → Programs/OfferCard}/utils/index.d.ts +0 -0
- /package/dist/patterns/{OfferCard → Programs/OfferCard}/utils/offers.d.ts +0 -0
- /package/dist/patterns/{OfferCard → Programs/OfferCard}/variants/OfferCardEmpty.d.ts +0 -0
- /package/dist/patterns/{OfferCard → Programs/OfferCard}/variants/OfferCardError.d.ts +0 -0
- /package/dist/patterns/{OfferCard → Programs/OfferCard}/variants/OfferCardList.d.ts +0 -0
- /package/dist/patterns/{OfferCard → Programs/OfferCard}/variants/OfferCardSkeleton.d.ts +0 -0
- /package/dist/patterns/{OfferCard → Programs/OfferCard}/variants/index.d.ts +0 -0
- /package/dist/patterns/{SessionTimeline → Programs/SessionTimeline}/SessionTimeline.d.ts +0 -0
- /package/dist/patterns/{SessionTimeline → Programs/SessionTimeline}/index.d.ts +0 -0
- /package/dist/patterns/{SessionTimeline → Programs/SessionTimeline}/type.d.ts +0 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Decides what a link may do: return the href to use (as is, or rewritten),
|
|
4
|
+
* or `null` to show the link's text without a link.
|
|
5
|
+
*/
|
|
6
|
+
export type AssistantMarkdownLinkPolicy = (href: string) => string | null;
|
|
7
|
+
export interface AssistantMarkdownProps {
|
|
8
|
+
/** The Markdown to render. Untrusted: raw HTML, images and bare or angle-bracket URLs render as text. */
|
|
9
|
+
source: string;
|
|
10
|
+
/**
|
|
11
|
+
* Defaults to `defaultAssistantLinkPolicy`: absolute `http://` and `https://`
|
|
12
|
+
* URLs, and `mailto:` (address only), only. Whatever a policy returns is
|
|
13
|
+
* checked too: an `http(s)` href must name its host (`https://…`) and is
|
|
14
|
+
* rendered in canonical form, and an href with no scheme that names a host
|
|
15
|
+
* (`//…`) is refused, so the domain shown is where the link goes.
|
|
16
|
+
*/
|
|
17
|
+
linkPolicy?: AssistantMarkdownLinkPolicy;
|
|
18
|
+
/**
|
|
19
|
+
* Shifts heading levels so an answer fits under the page's own headings:
|
|
20
|
+
* `#` renders as `h(1 + headingOffset)`, capped at `h6`. Defaults to 2.
|
|
21
|
+
*/
|
|
22
|
+
headingOffset?: number;
|
|
23
|
+
/**
|
|
24
|
+
* Renders each `[n]` in the text (n from 1 to 999), for example with
|
|
25
|
+
* `CitationMarker`. Not inside link text, where a control would nest in a
|
|
26
|
+
* link, and not for an escaped `\\[n\\]`. Without it, `[n]` stays text.
|
|
27
|
+
*/
|
|
28
|
+
renderCitation?: (index: number) => ReactNode;
|
|
29
|
+
/** Read by screen readers after each link. Defaults to "opens in a new tab". */
|
|
30
|
+
newTabLabel?: string;
|
|
31
|
+
/** Accessible name of each table's scroll box. Defaults to "Table". */
|
|
32
|
+
tableLabel?: string;
|
|
33
|
+
/** Accessible name of each code block's scroll box. Defaults to "Code". */
|
|
34
|
+
codeLabel?: string;
|
|
35
|
+
className?: string;
|
|
36
|
+
'data-testid'?: string;
|
|
37
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { JSX } from 'react';
|
|
2
|
+
import { AssistantMessageProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* One turn of a conversation with an assistant: the person's on the right in
|
|
5
|
+
* a neutral bubble, the assistant's on the left at full width under a small
|
|
6
|
+
* mark, with no bubble of its own. Content, copy and controls all come in as props; the pattern renders
|
|
7
|
+
* whatever `children` it is given (plain text or a rendered answer).
|
|
8
|
+
*
|
|
9
|
+
* Each turn is an `<article>` named by its author, so a screen reader can move
|
|
10
|
+
* turn by turn. It announces nothing on its own: run-state announcements
|
|
11
|
+
* belong to `AssistantNotice`.
|
|
12
|
+
*/
|
|
13
|
+
export declare function AssistantMessage({ author, authorLabel, children, status, statusLabel, meta, actions, icon, className, classNames, 'data-testid': dataTestId, }: AssistantMessageProps): JSX.Element;
|
|
14
|
+
export declare namespace AssistantMessage {
|
|
15
|
+
var displayName: string;
|
|
16
|
+
}
|
|
17
|
+
export default AssistantMessage;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { AssistantMessageStatus } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Every slot class of `AssistantMessage`.
|
|
4
|
+
*
|
|
5
|
+
* Colours are HeroUI semantic tokens (they flip under `.dark`) plus the `ai-*`
|
|
6
|
+
* palette (which flips with them). No `bg-white`: the assistant pieces carry
|
|
7
|
+
* their own dark values because the DS has no dark theme.
|
|
8
|
+
*
|
|
9
|
+
* The assistant's turn paints nothing: it is full width with no bubble, so it
|
|
10
|
+
* shows whatever surface the app puts it on (a card, an inset box, a
|
|
11
|
+
* translucent dark panel). Painting `ai-assistant-bubble` edge to edge with no
|
|
12
|
+
* padding made a bare block on any surface but HeroUI `content1`.
|
|
13
|
+
*
|
|
14
|
+
* Secondary text is `default-500` on a plain card and `default-600` inside a
|
|
15
|
+
* fill: default-500 measures 4.40:1 on the light user bubble, under AA. See
|
|
16
|
+
* `src/tokens/__test__/assistant-surface.test.ts`.
|
|
17
|
+
*/
|
|
18
|
+
export declare const assistantMessageClass: {
|
|
19
|
+
readonly base: "flex w-full min-w-0 flex-col gap-1.5";
|
|
20
|
+
readonly baseUser: "items-end";
|
|
21
|
+
readonly baseAssistant: "items-start";
|
|
22
|
+
readonly header: "flex min-w-0 max-w-full flex-wrap items-center gap-x-2 gap-y-0.5";
|
|
23
|
+
readonly mark: "inline-flex size-6 flex-none items-center justify-center rounded-full bg-ai-fill text-ai-accent";
|
|
24
|
+
readonly author: "min-w-0 text-sm font-semibold text-ai-accent [overflow-wrap:anywhere]";
|
|
25
|
+
readonly meta: "min-w-0 text-xs tabular-nums text-default-500 [overflow-wrap:anywhere]";
|
|
26
|
+
readonly body: "min-w-0 text-sm leading-relaxed text-foreground [overflow-wrap:anywhere]";
|
|
27
|
+
readonly bodyUser: "max-w-[85%] rounded-2xl rounded-br-md bg-ai-user-bubble px-4 py-2.5";
|
|
28
|
+
readonly bodyAssistant: "w-full";
|
|
29
|
+
/** A plain string keeps the line breaks the person typed. */
|
|
30
|
+
readonly plain: "whitespace-pre-wrap";
|
|
31
|
+
readonly status: "m-0 flex min-w-0 items-center gap-1.5 text-xs font-medium [overflow-wrap:anywhere]";
|
|
32
|
+
/**
|
|
33
|
+
* The status mark's own 14px box. Without words it is all a sighted reader
|
|
34
|
+
* sees, so it keeps its place before Iconify has loaded the icon.
|
|
35
|
+
*/
|
|
36
|
+
readonly statusIcon: "inline-flex size-3.5 flex-none";
|
|
37
|
+
readonly actions: "flex flex-wrap items-center gap-1";
|
|
38
|
+
/** The person's name, for screen readers only. */
|
|
39
|
+
readonly userLabel: "sr-only";
|
|
40
|
+
/** The default status word when `statusLabel` is empty, for screen readers only: the icon shows it. */
|
|
41
|
+
readonly statusFallback: "sr-only";
|
|
42
|
+
};
|
|
43
|
+
export declare const assistantMessageStatusClass: Record<Exclude<AssistantMessageStatus, 'complete'>, string>;
|
|
44
|
+
export declare const ASSISTANT_MESSAGE_STATUS_ICON: Record<Exclude<AssistantMessageStatus, 'complete'>, string>;
|
|
45
|
+
export declare const ASSISTANT_MESSAGE_DEFAULT_ICON = "solar:stars-minimalistic-linear";
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
/** Who wrote the turn. */
|
|
3
|
+
export type AssistantMessageAuthor = 'user' | 'assistant';
|
|
4
|
+
/**
|
|
5
|
+
* How the turn ended. `stopped` means the person stopped it; `error` means
|
|
6
|
+
* it failed. Either way the content that arrived is still shown.
|
|
7
|
+
*/
|
|
8
|
+
export type AssistantMessageStatus = 'complete' | 'stopped' | 'error';
|
|
9
|
+
export interface AssistantMessageClassNames {
|
|
10
|
+
base?: string;
|
|
11
|
+
header?: string;
|
|
12
|
+
body?: string;
|
|
13
|
+
status?: string;
|
|
14
|
+
meta?: string;
|
|
15
|
+
actions?: string;
|
|
16
|
+
}
|
|
17
|
+
/** A label that says something: text or an element, never empty or absent. */
|
|
18
|
+
export type AssistantMessageStatusLabel = Exclude<ReactNode, null | undefined | boolean>;
|
|
19
|
+
/**
|
|
20
|
+
* A stopped or failed turn must say so in words: without a label it would
|
|
21
|
+
* read as a finished answer, to sighted people and screen readers alike. The
|
|
22
|
+
* union makes the label required whenever `status` is not `complete`, and
|
|
23
|
+
* still accepts a `status` computed at runtime as long as a label comes with it.
|
|
24
|
+
*
|
|
25
|
+
* The type is not the only guard: an empty string, an `undefined` from an
|
|
26
|
+
* unchecked lookup, or a wrapper that loses the union all reach the component
|
|
27
|
+
* without words, so it still draws the status icon with a default word for
|
|
28
|
+
* screen readers ("Stopped" / "Failed").
|
|
29
|
+
*
|
|
30
|
+
* A wrapper keeps the requirement by omitting from the base props, not from
|
|
31
|
+
* the union: `Omit<AssistantMessageBaseProps, 'author'> & AssistantMessageStatusProps`.
|
|
32
|
+
*/
|
|
33
|
+
export type AssistantMessageStatusProps = {
|
|
34
|
+
/** Defaults to `complete`. */
|
|
35
|
+
status?: 'complete';
|
|
36
|
+
/** Ignored on a complete turn. */
|
|
37
|
+
statusLabel?: ReactNode;
|
|
38
|
+
} | {
|
|
39
|
+
status: 'stopped' | 'error';
|
|
40
|
+
/** Shown under the content, e.g. "Stopped by you". Required: it is the only text that says so. */
|
|
41
|
+
statusLabel: AssistantMessageStatusLabel;
|
|
42
|
+
};
|
|
43
|
+
export interface AssistantMessageBaseProps {
|
|
44
|
+
/**
|
|
45
|
+
* Who wrote the turn. Named `author`, not `role`, because `role` on a DS
|
|
46
|
+
* pattern means the ARIA role (`FeedbackState`).
|
|
47
|
+
*/
|
|
48
|
+
author: AssistantMessageAuthor;
|
|
49
|
+
/**
|
|
50
|
+
* The turn's accessible name, e.g. "You" or "Assistant". Shown next to the
|
|
51
|
+
* assistant mark; on the person's own turn it is read by screen readers
|
|
52
|
+
* only.
|
|
53
|
+
*/
|
|
54
|
+
authorLabel: string;
|
|
55
|
+
/**
|
|
56
|
+
* The turn's content. A plain string keeps its line breaks. Empty (a turn
|
|
57
|
+
* that failed before any text arrived), no body is drawn.
|
|
58
|
+
*/
|
|
59
|
+
children?: ReactNode;
|
|
60
|
+
/** Small secondary line: a time, a duration. */
|
|
61
|
+
meta?: ReactNode;
|
|
62
|
+
/** Controls under the turn (copy, retry). Rendered as given. */
|
|
63
|
+
actions?: ReactNode;
|
|
64
|
+
/**
|
|
65
|
+
* Iconify name of the assistant mark, or `false` for none. Defaults to a
|
|
66
|
+
* sparkle. Ignored on the person's own turn.
|
|
67
|
+
*/
|
|
68
|
+
icon?: string | false;
|
|
69
|
+
className?: string;
|
|
70
|
+
classNames?: AssistantMessageClassNames;
|
|
71
|
+
'data-testid'?: string;
|
|
72
|
+
}
|
|
73
|
+
export type AssistantMessageProps = AssistantMessageBaseProps & AssistantMessageStatusProps;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { JSX } from 'react';
|
|
2
|
+
import { AssistantNoticeProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* The run state of an assistant panel: working, nothing yet, failed, a limit,
|
|
5
|
+
* offline, no access, or a plain note. A HeroUI `Alert` underneath, with one
|
|
6
|
+
* kind per state and every word supplied by the caller.
|
|
7
|
+
*
|
|
8
|
+
* Announcements follow `FeedbackState`: `error` is `role="alert"`
|
|
9
|
+
* (assertive), every other kind `role="status"` (polite). The live region
|
|
10
|
+
* wraps the title and description only; the action and the details stay
|
|
11
|
+
* outside it, so revealing details is not announced as a new alert.
|
|
12
|
+
*/
|
|
13
|
+
export declare function AssistantNotice({ kind, title, description, elapsed, action, details, detailsLabel, icon, role, ariaLive, className, classNames, 'data-testid': dataTestId, }: AssistantNoticeProps): JSX.Element;
|
|
14
|
+
export declare namespace AssistantNotice {
|
|
15
|
+
var displayName: string;
|
|
16
|
+
}
|
|
17
|
+
export default AssistantNotice;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { AssistantNoticeKind } from './types';
|
|
2
|
+
type AlertColor = 'default' | 'danger' | 'warning';
|
|
3
|
+
interface KindStyle {
|
|
4
|
+
/** HeroUI `Alert` colour: its flat fill for the kind. */
|
|
5
|
+
color: AlertColor;
|
|
6
|
+
/** Extra base classes. `dark:` repeats are needed to beat Alert's own `dark:bg-*`. */
|
|
7
|
+
base: string;
|
|
8
|
+
title: string;
|
|
9
|
+
description: string;
|
|
10
|
+
icon: string;
|
|
11
|
+
}
|
|
12
|
+
export declare const assistantNoticeKindStyle: Record<AssistantNoticeKind, KindStyle>;
|
|
13
|
+
export declare const assistantNoticeClass: {
|
|
14
|
+
/** Alert centres a body with no title prop; the copy here is children, so pin it to the top-left. */
|
|
15
|
+
readonly base: "items-start gap-x-3 px-4 py-3";
|
|
16
|
+
readonly mainWrapper: "ms-0 min-h-0 min-w-0 items-start justify-start gap-0.5";
|
|
17
|
+
readonly icon: "mt-0.5 inline-flex size-5 flex-none items-center justify-center";
|
|
18
|
+
/**
|
|
19
|
+
* The live region: title and description only. The action and the details
|
|
20
|
+
* sit outside it, so opening "Details" on an error does not re-announce
|
|
21
|
+
* the technical text assertively.
|
|
22
|
+
*/
|
|
23
|
+
readonly live: "flex w-full min-w-0 flex-col gap-0.5";
|
|
24
|
+
readonly titleRow: "flex min-w-0 flex-wrap items-baseline gap-x-2";
|
|
25
|
+
readonly title: "m-0 min-w-0 text-sm font-medium [overflow-wrap:anywhere]";
|
|
26
|
+
readonly elapsed: "text-sm tabular-nums";
|
|
27
|
+
readonly description: "m-0 min-w-0 text-sm [overflow-wrap:anywhere]";
|
|
28
|
+
readonly action: "mt-2 flex flex-wrap items-center gap-2";
|
|
29
|
+
readonly detailsToggle: "-ms-1.5 h-7 min-w-0 gap-1 px-1.5 text-xs font-medium text-current";
|
|
30
|
+
readonly detailsWrapper: "w-full min-w-0";
|
|
31
|
+
readonly detailsChevron: "transition-transform motion-reduce:transition-none [html[data-pos-reduce-motion=true]_&]:transition-none";
|
|
32
|
+
readonly detailsChevronOpen: "rotate-180";
|
|
33
|
+
readonly details: "mt-1 max-h-48 overflow-auto whitespace-pre-wrap rounded-md bg-content1 p-2 font-mono text-xs text-foreground [overflow-wrap:anywhere]";
|
|
34
|
+
};
|
|
35
|
+
export declare const ASSISTANT_NOTICE_DEFAULT_ROLE: Record<AssistantNoticeKind, 'alert' | 'status'>;
|
|
36
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* The run states an assistant panel shows. The caller maps its own errors to
|
|
4
|
+
* these; the pattern knows nothing about where they came from.
|
|
5
|
+
*
|
|
6
|
+
* - `thinking`: a turn is running. Pair it with `elapsed`.
|
|
7
|
+
* - `empty`: nothing asked yet.
|
|
8
|
+
* - `error`: the turn failed.
|
|
9
|
+
* - `caution`: a limit was reached (rate, daily, per-turn); no retry now.
|
|
10
|
+
* - `offline`: the service or the connection is down.
|
|
11
|
+
* - `blocked`: the person cannot use the assistant (no access, not set up).
|
|
12
|
+
* - `info`: anything else worth saying.
|
|
13
|
+
*/
|
|
14
|
+
export type AssistantNoticeKind = 'thinking' | 'empty' | 'error' | 'caution' | 'offline' | 'blocked' | 'info';
|
|
15
|
+
export interface AssistantNoticeClassNames {
|
|
16
|
+
base?: string;
|
|
17
|
+
title?: string;
|
|
18
|
+
description?: string;
|
|
19
|
+
action?: string;
|
|
20
|
+
details?: string;
|
|
21
|
+
}
|
|
22
|
+
export interface AssistantNoticeProps {
|
|
23
|
+
kind: AssistantNoticeKind;
|
|
24
|
+
title: ReactNode;
|
|
25
|
+
description?: ReactNode;
|
|
26
|
+
/**
|
|
27
|
+
* A running clock next to the title ("12 s"). Hidden from screen readers so
|
|
28
|
+
* a ticking value is not announced every second; they hear the title once.
|
|
29
|
+
*/
|
|
30
|
+
elapsed?: ReactNode;
|
|
31
|
+
/** A control under the text (Retry, Sign in). Rendered as given. */
|
|
32
|
+
action?: ReactNode;
|
|
33
|
+
/** Technical detail, revealed by a "Details" toggle. */
|
|
34
|
+
details?: ReactNode;
|
|
35
|
+
/** Name of the details toggle. Defaults to "Details". */
|
|
36
|
+
detailsLabel?: string;
|
|
37
|
+
/** Iconify name to replace the kind's icon, or `false` for none. */
|
|
38
|
+
icon?: string | false;
|
|
39
|
+
/** Defaults to `alert` for `error`, `status` otherwise. */
|
|
40
|
+
role?: 'alert' | 'status';
|
|
41
|
+
/** Defaults to `assertive` for `error`, `polite` otherwise. */
|
|
42
|
+
ariaLive?: 'polite' | 'assertive' | 'off';
|
|
43
|
+
className?: string;
|
|
44
|
+
classNames?: AssistantNoticeClassNames;
|
|
45
|
+
'data-testid'?: string;
|
|
46
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare const cardListClass: {
|
|
2
|
+
readonly base: "w-full";
|
|
3
|
+
readonly list: "m-0 list-none p-0";
|
|
4
|
+
readonly item: "relative border-b border-pos-hair last:border-b-0";
|
|
5
|
+
readonly card: "block w-full px-4 py-[0.875rem] text-left";
|
|
6
|
+
readonly cardInteractive: "cursor-pointer outline-none transition-colors hover:bg-default-50 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-primary motion-reduce:transition-none [html[data-pos-reduce-motion=true]_&]:transition-none";
|
|
7
|
+
readonly headline: "flex items-baseline gap-2.5";
|
|
8
|
+
readonly headlineWithActions: "pr-[3.25rem]";
|
|
9
|
+
readonly title: "min-w-0 text-[0.90625rem] font-semibold text-primary [overflow-wrap:anywhere]";
|
|
10
|
+
readonly amount: "ml-auto shrink-0 whitespace-nowrap text-[0.9375rem] font-bold tabular-nums text-default-900";
|
|
11
|
+
readonly actions: "absolute right-4 top-[0.1875rem] z-[1]";
|
|
12
|
+
readonly chips: "mt-[0.5625rem] flex flex-wrap gap-1.5";
|
|
13
|
+
readonly chipsLine: "mt-[0.5625rem] flex items-center gap-2.5";
|
|
14
|
+
readonly chipsInline: "flex min-w-0 flex-wrap gap-1.5";
|
|
15
|
+
readonly rows: "mt-[0.5625rem] block";
|
|
16
|
+
readonly row: "flex items-baseline gap-3 py-[0.1875rem] text-[0.8125rem]";
|
|
17
|
+
readonly rowLabel: "shrink-0 text-default-500";
|
|
18
|
+
readonly rowValue: "ml-auto min-w-0 text-right text-default-700 [overflow-wrap:anywhere]";
|
|
19
|
+
readonly skeletonRow: "border-b border-pos-hair p-4 last:border-b-0";
|
|
20
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export interface CardListItem {
|
|
3
|
+
id: string;
|
|
4
|
+
title: ReactNode;
|
|
5
|
+
amount?: ReactNode;
|
|
6
|
+
chips?: ReactNode;
|
|
7
|
+
rows?: Array<{
|
|
8
|
+
label: string;
|
|
9
|
+
value: ReactNode;
|
|
10
|
+
}>;
|
|
11
|
+
actions?: ReactNode;
|
|
12
|
+
}
|
|
13
|
+
export interface CardListProps {
|
|
14
|
+
items: CardListItem[];
|
|
15
|
+
ariaLabel: string;
|
|
16
|
+
onSelect?: (id: string) => void;
|
|
17
|
+
loading?: boolean;
|
|
18
|
+
skeletonCount?: number;
|
|
19
|
+
'data-testid'?: string;
|
|
20
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export type CardStackLayout = 'stack' | 'grid';
|
|
3
|
+
export interface CardStackProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
layout?: CardStackLayout;
|
|
5
|
+
'data-testid'?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const CardStack: React.FC<CardStackProps>;
|
|
@@ -29,6 +29,10 @@ export interface CashTenderLabels {
|
|
|
29
29
|
* `{due}` is replaced with the formatted due amount.
|
|
30
30
|
*/
|
|
31
31
|
insufficientMessageTemplate?: string;
|
|
32
|
+
exactAmountLabel?: string;
|
|
33
|
+
exactAmountAriaTemplate?: string;
|
|
34
|
+
quickAmountsLabel?: string;
|
|
35
|
+
quickAmountAriaTemplate?: string;
|
|
32
36
|
}
|
|
33
37
|
export interface CashTenderFormProps {
|
|
34
38
|
/**
|
|
@@ -70,6 +74,8 @@ export interface CashTenderFormProps {
|
|
|
70
74
|
* the guard is value-based. Omit for no cap.
|
|
71
75
|
*/
|
|
72
76
|
maxAmount?: number;
|
|
77
|
+
quickAmounts?: readonly number[];
|
|
78
|
+
showExactAmount?: boolean;
|
|
73
79
|
/**
|
|
74
80
|
* Auto-focus the Cash Received field when this component mounts.
|
|
75
81
|
* Pair with `key={...}` from the host to re-trigger focus on every
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { SignedAmountTone } from '../shared/recordTone';
|
|
3
|
+
export type CellTextVariant = 'text' | 'reference' | 'amount';
|
|
4
|
+
export interface CellTextProps {
|
|
5
|
+
variant?: CellTextVariant;
|
|
6
|
+
tone?: SignedAmountTone;
|
|
7
|
+
secondary?: React.ReactNode;
|
|
8
|
+
children: React.ReactNode;
|
|
9
|
+
'data-testid'?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare const CellText: React.FC<CellTextProps>;
|
|
12
|
+
export interface ChipStackProps {
|
|
13
|
+
children: React.ReactNode;
|
|
14
|
+
'data-testid'?: string;
|
|
15
|
+
}
|
|
16
|
+
export declare const ChipStack: React.FC<ChipStackProps>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { CellTextVariant } from './CellText';
|
|
2
|
+
export declare const cellTextClass: {
|
|
3
|
+
readonly base: "whitespace-nowrap text-[0.875rem]";
|
|
4
|
+
readonly secondary: "text-default-500";
|
|
5
|
+
readonly chipStack: "inline-flex flex-col items-start gap-[0.3125rem]";
|
|
6
|
+
};
|
|
7
|
+
export declare const cellTextVariantClass: Record<CellTextVariant, string>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { JSX } from 'react';
|
|
2
|
+
import { CitationMarkerProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* A `[n]` marker inside an assistant's answer, pointing at one of its sources.
|
|
5
|
+
* Pressed, it calls `onSelect` (reveal the source, open it); without
|
|
6
|
+
* `onSelect` it is plain text with the same look.
|
|
7
|
+
*
|
|
8
|
+
* A native `<button>`, not HeroUI's: it sits inside a sentence and must align
|
|
9
|
+
* to the text baseline at text size, which HeroUI's Button (a fixed-height
|
|
10
|
+
* control with a minimum width) is not built for.
|
|
11
|
+
*/
|
|
12
|
+
export declare function CitationMarker({ index, label, onSelect, 'data-testid': dataTestId, }: CitationMarkerProps): JSX.Element;
|
|
13
|
+
export declare namespace CitationMarker {
|
|
14
|
+
var displayName: string;
|
|
15
|
+
}
|
|
16
|
+
export default CitationMarker;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Every slot class of `CitationMarker`. The `ai-*` palette marks it as the
|
|
3
|
+
* assistant's: `ai-accent` on `ai-fill` measures 5.49:1 light and 8.15:1 dark
|
|
4
|
+
* (`src/tokens/__test__/assistant-surface.test.ts`), enough for 11px bold.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* The `[n]` badge, shared with `SourcePill`'s marker: the two exist to be
|
|
8
|
+
* matched by eye, so they must never drift apart.
|
|
9
|
+
*/
|
|
10
|
+
export declare const citationBadgeClass = "inline-flex items-center rounded border border-ai-border bg-ai-fill px-1 text-[0.6875rem] font-semibold leading-4 tabular-nums text-ai-accent";
|
|
11
|
+
export declare const citationMarkerClass: {
|
|
12
|
+
/**
|
|
13
|
+
* Inline in a sentence: baseline-aligned, a left margin only (a right one
|
|
14
|
+
* would strand the punctuation after it), no fixed height.
|
|
15
|
+
*/
|
|
16
|
+
readonly base: "ms-0.5 align-baseline inline-flex items-center rounded border border-ai-border bg-ai-fill px-1 text-[0.6875rem] font-semibold leading-4 tabular-nums text-ai-accent";
|
|
17
|
+
readonly interactive: "cursor-pointer transition-colors hover:border-ai-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ai-focus motion-reduce:transition-none";
|
|
18
|
+
readonly srOnly: "sr-only";
|
|
19
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface CitationMarkerProps {
|
|
2
|
+
/** What the marker shows: `1` renders as `[1]`; `E1` as `[E1]`. */
|
|
3
|
+
index: number | string;
|
|
4
|
+
/**
|
|
5
|
+
* The accessible name, e.g. "Show source 1: email, Renewal pricing". The
|
|
6
|
+
* visible `[1]` alone says nothing to a screen reader.
|
|
7
|
+
*/
|
|
8
|
+
label: string;
|
|
9
|
+
/** Called when the marker is pressed, typically to reveal its source. Omitted, the marker is plain text. */
|
|
10
|
+
onSelect?: () => void;
|
|
11
|
+
'data-testid'?: string;
|
|
12
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { DiscardGuardController } from './useDiscardGuard';
|
|
3
|
+
/** @internal Used by `ModalPanels` to make each panel its own guard scope. */
|
|
4
|
+
export declare const DiscardGuardScope: React.FC<{
|
|
5
|
+
scope: string;
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
}>;
|
|
8
|
+
export interface DiscardGuardProps {
|
|
9
|
+
/** The controller from `useDiscardGuard()`. */
|
|
10
|
+
guard: DiscardGuardController;
|
|
11
|
+
children: React.ReactNode;
|
|
12
|
+
/** Confirmation heading. Default `'Discard changes?'`. */
|
|
13
|
+
title?: string;
|
|
14
|
+
/** What is lost by confirming. Default `'What you entered will be lost.'`. */
|
|
15
|
+
description?: React.ReactNode;
|
|
16
|
+
/** Confirm (discard) label. Default `'Discard'`. */
|
|
17
|
+
confirmLabel?: string;
|
|
18
|
+
/** Label of the action that returns to the form. Default `'Keep editing'`. */
|
|
19
|
+
keepEditingLabel?: string;
|
|
20
|
+
/** Root test id of the confirmation; derives `-confirm` and `-dismiss`. Default `'discard-guard'`. */
|
|
21
|
+
'data-testid'?: string;
|
|
22
|
+
}
|
|
23
|
+
export declare const DiscardGuard: React.FC<DiscardGuardProps>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { DirtyReport, Leave } from './useDiscardGuard';
|
|
2
|
+
export interface DiscardGuardContextValue {
|
|
3
|
+
guardScope: (scope: string | null, leave: Leave) => void;
|
|
4
|
+
bypass: (leave: Leave) => void;
|
|
5
|
+
report: (id: string, report: DirtyReport) => void;
|
|
6
|
+
unreport: (id: string) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare const DiscardGuardContext: import('react').Context<DiscardGuardContextValue>;
|
|
9
|
+
/** The scope a reporter or a Back press belongs to. `ModalPanels` sets one per panel. */
|
|
10
|
+
export declare const DiscardScopeContext: import('react').Context<string | null>;
|
|
11
|
+
/**
|
|
12
|
+
* Call from a form while it is mounted. Unmounting withdraws the report, so a
|
|
13
|
+
* form that is gone never holds an exit hostage.
|
|
14
|
+
*/
|
|
15
|
+
export declare function useReportUnsavedChanges(isDirty: boolean): void;
|
|
16
|
+
export interface DiscardGuardActions {
|
|
17
|
+
/** Leave the whole surface: asks when any form is dirty. */
|
|
18
|
+
guard: (leave: Leave) => void;
|
|
19
|
+
/** Leave without asking — the input was saved. */
|
|
20
|
+
bypass: (leave: Leave) => void;
|
|
21
|
+
}
|
|
22
|
+
/** The guard's exits, for components rendered inside `<DiscardGuard>`. */
|
|
23
|
+
export declare function useDiscardGuardActions(): DiscardGuardActions;
|
|
24
|
+
/** @internal Back inside a panel: asks only when that panel holds unsaved input. */
|
|
25
|
+
export declare function useScopedDiscardGuard(): (leave: Leave) => void;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { DiscardGuard } from './DiscardGuard';
|
|
2
|
+
export type { DiscardGuardProps } from './DiscardGuard';
|
|
3
|
+
export { useDiscardGuard } from './useDiscardGuard';
|
|
4
|
+
export type { DiscardGuardController } from './useDiscardGuard';
|
|
5
|
+
export { useDiscardGuardActions, useReportUnsavedChanges } from './context';
|
|
6
|
+
export type { DiscardGuardActions } from './context';
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export type Leave = () => void;
|
|
2
|
+
/** One mounted reporter: which scope (panel) it belongs to and whether it holds unsaved input. */
|
|
3
|
+
export interface DirtyReport {
|
|
4
|
+
scope: string | null;
|
|
5
|
+
isDirty: boolean;
|
|
6
|
+
}
|
|
7
|
+
interface PendingLeave {
|
|
8
|
+
leave: Leave;
|
|
9
|
+
}
|
|
10
|
+
/** Wiring `<DiscardGuard>` reads; not part of the consumer contract. */
|
|
11
|
+
interface DiscardGuardInternals {
|
|
12
|
+
pending: PendingLeave | null;
|
|
13
|
+
/** Bumped on confirm so the dialog unmounts in the same commit as the exit (see the file header). */
|
|
14
|
+
confirmKey: number;
|
|
15
|
+
confirm: () => void;
|
|
16
|
+
keepEditing: () => void;
|
|
17
|
+
report: (id: string, report: DirtyReport) => void;
|
|
18
|
+
unreport: (id: string) => void;
|
|
19
|
+
guardScope: (scope: string | null, leave: Leave) => void;
|
|
20
|
+
}
|
|
21
|
+
export interface DiscardGuardController {
|
|
22
|
+
/** True while any mounted form reports unsaved input. */
|
|
23
|
+
readonly isDirty: boolean;
|
|
24
|
+
/** Runs `leave` now, or after the operator confirms when a form is dirty. */
|
|
25
|
+
guard: (leave: Leave) => void;
|
|
26
|
+
/** Runs `leave` without asking — for exits that keep the input, like a successful save. */
|
|
27
|
+
bypass: (leave: Leave) => void;
|
|
28
|
+
/**
|
|
29
|
+
* Wraps a modal's `onOpenChange` so its close button, Escape and outside
|
|
30
|
+
* click go through `guard`. Opening passes straight through.
|
|
31
|
+
*/
|
|
32
|
+
guardOpenChange: (onOpenChange: (open: boolean) => void) => (open: boolean) => void;
|
|
33
|
+
/** @internal Read by `<DiscardGuard>`. */
|
|
34
|
+
readonly internals: DiscardGuardInternals;
|
|
35
|
+
}
|
|
36
|
+
/** Creates the guard. Call it in the component that owns the modal. */
|
|
37
|
+
export declare function useDiscardGuard(): DiscardGuardController;
|
|
38
|
+
export {};
|
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* Ensures exclusive selection (preset OR custom).
|
|
6
6
|
*/
|
|
7
7
|
export { DonationAmounts } from './DonationAmounts';
|
|
8
|
-
export type { DonationAmount, SelectedDonation, DonationLabels, DonationAmountsProps } from './types';
|
|
8
|
+
export type { DonationAmount, SelectedDonation, DonationLabels, DonationAmountsProps, DonationAmountsVariant, } from './types';
|
|
9
9
|
export { formatCurrency, parseCurrency } from './utils/currency';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { DonationAmountsProps, DonationAmountsVariant } from './types';
|
|
2
|
+
type TiledVariant = Exclude<DonationAmountsVariant, 'pill'>;
|
|
3
|
+
type FieldSize = NonNullable<DonationAmountsProps['size']>;
|
|
4
|
+
interface VariantSlots {
|
|
5
|
+
root: string;
|
|
6
|
+
title: string;
|
|
7
|
+
eyebrow: string;
|
|
8
|
+
caption: string;
|
|
9
|
+
grid: string;
|
|
10
|
+
preset: string;
|
|
11
|
+
presetIdle: string;
|
|
12
|
+
presetSelected: string;
|
|
13
|
+
amount: string;
|
|
14
|
+
amountSelected: string;
|
|
15
|
+
sublabel: string;
|
|
16
|
+
customLabel: string;
|
|
17
|
+
inputBase: string;
|
|
18
|
+
inputWrapper: string;
|
|
19
|
+
inputWrapperActive: string;
|
|
20
|
+
input: string;
|
|
21
|
+
}
|
|
22
|
+
export declare const donationAmountsSlots: Record<TiledVariant, VariantSlots>;
|
|
23
|
+
/**
|
|
24
|
+
* What `size` changes in `tile` and `pos`: the custom field's height and text.
|
|
25
|
+
* `md` is the mockup's field (38px in `tile`, 40px in `pos`); `sm` and `lg`
|
|
26
|
+
* are HeroUI's 32px and 48px fields. The Add button takes `size` directly.
|
|
27
|
+
*/
|
|
28
|
+
export declare const donationAmountsFieldSize: Record<TiledVariant, Record<FieldSize, {
|
|
29
|
+
wrapper: string;
|
|
30
|
+
input: string;
|
|
31
|
+
}>>;
|
|
32
|
+
export {};
|