asma-ui-core 3.128.2 → 3.129.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/asma-ui-core.css +1 -1
- package/dist/components/custom/widget/widget/StyledWidget.js +4 -4
- package/dist/components/data-display/card/Card.js +327 -0
- package/dist/components/data-display/card/Card.module.js +7 -0
- package/dist/components/data-display/card/Card.types.js +21 -0
- package/dist/components/data-display/card/CardList.js +85 -0
- package/dist/components/data-display/card/CardParts.js +97 -0
- package/dist/components/data-display/card/cardModel.js +46 -0
- package/dist/components/data-display/interactive-chip/StyledInteractiveChip.js +4 -4
- package/dist/components/feedback/dialog/StyledDialog.js +5 -5
- package/dist/components/feedback/minimizable-dialog/v2/MinimizableDialogV2.js +7 -7
- package/dist/components/inputs/button/StyledButton.js +1 -1
- package/dist/components/inputs/dynamic-select/components/DynamicInteractiveChipGroup.js +4 -4
- package/dist/components/inputs/dynamic-select/components/DynamicSelectAutocomplete.js +1 -1
- package/dist/components/inputs/emoji-choice/StyledEmojiChoice.js +1 -1
- package/dist/components/inputs/phone-field/CountryCodeSelect.js +4 -4
- package/dist/components/inputs/select-autocomplete/SelectAutocompletePicker.js +1 -1
- package/dist/components/inputs/select-autocomplete/StyledSelectAutocomplete.js +4 -4
- package/dist/components/navigation/menu/StyledMenuList.js +1 -1
- package/dist/components/utils/bottom-sheet/StyledBottomSheet.js +9 -9
- package/dist/components/utils/popover/PopoverSheet.js +10 -10
- package/dist/index.js +632 -619
- package/dist/src/components/data-display/card/Card.d.ts +9 -0
- package/dist/src/components/data-display/card/Card.types.d.ts +193 -0
- package/dist/src/components/data-display/card/CardList.d.ts +45 -0
- package/dist/src/components/data-display/card/CardParts.d.ts +44 -0
- package/dist/src/components/data-display/card/cardModel.d.ts +61 -0
- package/dist/src/components/data-display/card/cardModel.test.d.ts +1 -0
- package/dist/src/components/data-display/card/index.d.ts +5 -0
- package/dist/src/components/data-display/card/story/cardStoryFixtures.d.ts +95 -0
- package/dist/src/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { CardProps } from './Card.types';
|
|
2
|
+
/**
|
|
3
|
+
* Shared Card shell (ASMA-8318): one base for every card type. Header and footer parts are fixed and
|
|
4
|
+
* opt-in, the body is `children`, and the interaction model follows from the props (CARD-1, CARD-2).
|
|
5
|
+
*
|
|
6
|
+
* @see asma-modules/_docs/ux/components/component-card.md:101 — §3 Anatomy, §4 Interaction models
|
|
7
|
+
* @see asma-modules/_docs/frontend/plans/2026-10-30-17-25-plan-asma-ui-core-card-component.md — plan
|
|
8
|
+
*/
|
|
9
|
+
export declare const Card: (props: CardProps) => JSX.Element;
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import { MouseEvent, ReactElement, ReactNode } from 'react';
|
|
2
|
+
import { UiCoreLocale } from '../../../helpers/uiCoreLocale';
|
|
3
|
+
/** Interaction model of a card. Derived from its props, never passed in (CARD-2). */
|
|
4
|
+
export type CardModel = 'full' | 'partial' | 'static';
|
|
5
|
+
export type CardHeadingLevel = 2 | 3 | 4 | 5 | 6;
|
|
6
|
+
/** Props the shell puts on the opening element when an app renders its own router link. */
|
|
7
|
+
export interface CardLinkRenderProps {
|
|
8
|
+
href: string;
|
|
9
|
+
target?: string;
|
|
10
|
+
className: string;
|
|
11
|
+
'aria-labelledby': string;
|
|
12
|
+
'aria-describedby': string | undefined;
|
|
13
|
+
'aria-current': 'true' | undefined;
|
|
14
|
+
'data-card-link': '';
|
|
15
|
+
onClick?: (event: MouseEvent<HTMLAnchorElement>) => void;
|
|
16
|
+
children: ReactNode;
|
|
17
|
+
}
|
|
18
|
+
/** A page destination: a real link, so new tab, copy link and back all work (CARD-3). */
|
|
19
|
+
export interface CardOpenLink {
|
|
20
|
+
href: string;
|
|
21
|
+
target?: string;
|
|
22
|
+
onClick?: (event: MouseEvent<HTMLAnchorElement>) => void;
|
|
23
|
+
/** Render the app's router link (e.g. react-router `Link`) instead of a native `<a>`. Spread every prop. */
|
|
24
|
+
renderLink?: (props: CardLinkRenderProps) => ReactElement;
|
|
25
|
+
}
|
|
26
|
+
/** A dialog or sheet on the same page: a `<button aria-haspopup="dialog">` in the heading (CARD-3). */
|
|
27
|
+
export interface CardOpenDialog {
|
|
28
|
+
onOpen: () => void;
|
|
29
|
+
}
|
|
30
|
+
export type CardOpen = CardOpenLink | CardOpenDialog;
|
|
31
|
+
/** One item of the ⋮ menu, drawn as a `StyledMenuItem` (as the Workspaces cards do). */
|
|
32
|
+
export interface CardMenuAction {
|
|
33
|
+
label: string;
|
|
34
|
+
onSelect: () => void;
|
|
35
|
+
icon?: ReactNode;
|
|
36
|
+
/** A destructive action, such as Delete: drawn in the error colour. */
|
|
37
|
+
danger?: boolean;
|
|
38
|
+
/** Keeps the action visible but unavailable, and says why (HOD-4, DIS-4). */
|
|
39
|
+
disabledReason?: string;
|
|
40
|
+
}
|
|
41
|
+
/** What `menu.render` gets to draw the app's own popover, anchored to the card's ⋮ button. */
|
|
42
|
+
export interface CardMenuRenderProps {
|
|
43
|
+
anchorEl: HTMLElement | null;
|
|
44
|
+
open: boolean;
|
|
45
|
+
close: () => void;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* The ⋮ menu. The card always draws the ⋮ button (40 × 40, named "Flere handlinger for «title»").
|
|
49
|
+
* `actions`: the card draws the design-system menu (`StyledMenu`), at most seven items.
|
|
50
|
+
* `render`: the app draws its own popover instead, anchored to the button.
|
|
51
|
+
*/
|
|
52
|
+
export type CardMenu = {
|
|
53
|
+
actions: CardMenuAction[];
|
|
54
|
+
render?: never;
|
|
55
|
+
} | {
|
|
56
|
+
render: (popover: CardMenuRenderProps) => ReactNode;
|
|
57
|
+
actions?: never;
|
|
58
|
+
};
|
|
59
|
+
export interface CardCheckbox {
|
|
60
|
+
checked: boolean;
|
|
61
|
+
onChange: (checked: boolean) => void;
|
|
62
|
+
/** Disables the checkbox and shows why on hover, focus and tap (DIS-4). */
|
|
63
|
+
disabledReason?: string;
|
|
64
|
+
/** Hides the visible "Velg"; the name stays "Velg «title»". The contract asks for the label (CARD-5). */
|
|
65
|
+
hideLabel?: boolean;
|
|
66
|
+
size?: 'small' | 'medium';
|
|
67
|
+
}
|
|
68
|
+
export interface CardType {
|
|
69
|
+
label: string;
|
|
70
|
+
icon?: ReactNode;
|
|
71
|
+
/** Text colour of the type label. Decoration only; check contrast for every state (CARD-10). */
|
|
72
|
+
color?: string;
|
|
73
|
+
/** `helper`: 14 px word, 16 px icon (default). `body`: 16 px word, 20 px icon, as Figma draws Module. */
|
|
74
|
+
size?: 'helper' | 'body';
|
|
75
|
+
}
|
|
76
|
+
export interface CardStatus {
|
|
77
|
+
label: string;
|
|
78
|
+
/** Colour of the decorative square beside the status word. */
|
|
79
|
+
squareColor?: string;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Shared Card shell (ASMA-8318). Header and footer parts are fixed; the body is `children`.
|
|
83
|
+
* Every part is opt-in: a part that is not passed is absent, never left empty (CARD-7).
|
|
84
|
+
*
|
|
85
|
+
* @see asma-modules/_docs/ux/components/component-card.md:101 — §3 Anatomy
|
|
86
|
+
* @see asma-modules/_docs/frontend/plans/2026-10-30-17-25-plan-asma-ui-core-card-component.md — §1.3 API
|
|
87
|
+
*/
|
|
88
|
+
export interface CardProps {
|
|
89
|
+
/** The item's name. Rendered as a heading that wraps in full (CARD-8). */
|
|
90
|
+
title: ReactNode;
|
|
91
|
+
/** Plain-text title for control names. Read from `title` by default; pass it only when a component inside `title` renders the text itself. */
|
|
92
|
+
titleText?: string;
|
|
93
|
+
/** Heading level of the title, one below the section heading above the cards (CARD-8). Defaults to the `CardList`'s `cardHeadingLevel`, else `3`. */
|
|
94
|
+
headingLevel?: CardHeadingLevel;
|
|
95
|
+
/** What the card opens. Without it the card is static. */
|
|
96
|
+
open?: CardOpen;
|
|
97
|
+
/**
|
|
98
|
+
* Read-only (static): the card only shows the item. No link, no CTA, no footer buttons, no hover, not in
|
|
99
|
+
* the tab order (CARD-6). A card without `open` is read-only as well.
|
|
100
|
+
*/
|
|
101
|
+
readOnly?: boolean;
|
|
102
|
+
/** Cut the title to N lines with CSS. Only for screens recorded in the truncation pattern §8; never in Ad Voca. */
|
|
103
|
+
titleClamp?: 1 | 2;
|
|
104
|
+
checkbox?: CardCheckbox;
|
|
105
|
+
/** Badge Dot. `{ visibleLabel: true }` also shows the "Ulest" word next to it. */
|
|
106
|
+
unread?: boolean | {
|
|
107
|
+
visibleLabel: boolean;
|
|
108
|
+
};
|
|
109
|
+
/** Highlight tags: a string becomes the design-system tag (`CardTag`); pass an element for your own. */
|
|
110
|
+
tags?: ReactNode[];
|
|
111
|
+
menu?: CardMenu;
|
|
112
|
+
type?: CardType;
|
|
113
|
+
status?: CardStatus;
|
|
114
|
+
/** Overdue words, e.g. "Forfalt • 4 dager". See `getOverdueDays`. */
|
|
115
|
+
overdue?: {
|
|
116
|
+
label: string;
|
|
117
|
+
};
|
|
118
|
+
/** Line under the title in the title column, e.g. the pathway name (§3 Body). */
|
|
119
|
+
subtitle?: ReactNode;
|
|
120
|
+
/** Image beside the title and subtitle; it comes after the title in the DOM (CARD-9). */
|
|
121
|
+
media?: ReactNode;
|
|
122
|
+
/**
|
|
123
|
+
* Footer call-to-action label, in any product: shown when passed, absent when not. Passed whole by the
|
|
124
|
+
* app: its word and the chevron, e.g.
|
|
125
|
+
* `<>Åpne<ChevronRightIcon className='h-6 w-6' /></>`. The card shows it as a label, not a button: not
|
|
126
|
+
* focusable, no hover of its own, not part of the link's name (the heading names it), gama-500 (warning-800 when overdue)
|
|
127
|
+
* (CARD-4). Pass text and icons only, never a control.
|
|
128
|
+
*/
|
|
129
|
+
cta?: ReactNode;
|
|
130
|
+
/**
|
|
131
|
+
* A real button in the CTA's place at the footer end, instead of the `cta` label (Figma `5021:142351`,
|
|
132
|
+
* "button"), e.g. `<StyledButton variant='text' endIcon={<ChevronRightIcon />}>Open</StyledButton>`, or a
|
|
133
|
+
* "View details" button that opens the app's own popover. Name it with `useCardContext().composeName`.
|
|
134
|
+
* It runs its own action, has its own tab stop and makes the card partially clickable, opening from its
|
|
135
|
+
* title row only; when passed, `cta` is not shown. Hidden on read-only and disabled cards, and replaced by "Vises nå" while selected.
|
|
136
|
+
*/
|
|
137
|
+
ctaAction?: ReactNode;
|
|
138
|
+
/** Chevron right after the title text, inside the link. Independent of `cta`. */
|
|
139
|
+
titleChevron?: boolean;
|
|
140
|
+
/**
|
|
141
|
+
* Footer button(s) at the start of the footer, e.g. "Signer". Not limited by the card; keep the
|
|
142
|
+
* footer to two actions in total (CARD-12) and put the rest in the ⋮ menu.
|
|
143
|
+
*/
|
|
144
|
+
footerAction?: ReactNode;
|
|
145
|
+
/** The item the user is viewing now: `aria-current` and a visible "Vises nå" label (CARD-11). */
|
|
146
|
+
selected?: boolean;
|
|
147
|
+
/**
|
|
148
|
+
* The item exists but cannot be opened now, e.g. a module scheduled for later (Figma `7334:33933`). It
|
|
149
|
+
* opens nothing and shows no CTA and no footer buttons: grey fill and leading edge, the not-allowed
|
|
150
|
+
* cursor, no hover or pressed look. Its link stays in the tab order as `aria-disabled="true"` with the focus ring (DIS-3).
|
|
151
|
+
* Say why in the status, e.g. "Available later", and when in the body (DIS-1). Ignored on a read-only card.
|
|
152
|
+
*/
|
|
153
|
+
disabled?: boolean;
|
|
154
|
+
/** Leading-edge colour. Decoration only. */
|
|
155
|
+
accentColor?: string;
|
|
156
|
+
/** Language of the built-in strings ("Viewing now", control names). Defaults to the `CardList`'s, else `en`, as in the rest of ui-core. */
|
|
157
|
+
locale?: UiCoreLocale;
|
|
158
|
+
/** Override single strings on top of `locale`. */
|
|
159
|
+
labels?: Partial<CardLabels>;
|
|
160
|
+
/** Classes on the card root. */
|
|
161
|
+
className?: string;
|
|
162
|
+
/**
|
|
163
|
+
* Classes on the parts the card draws: `root` the whole card (edge, size, radius, …), `title` the heading,
|
|
164
|
+
* `body` the body column (title, facts), `footer` the footer. Set the resting edge colour with the
|
|
165
|
+
* variable, e.g. `[--card-border-color:var(--colors-delta-200)]`, so focus, pressed, selected and
|
|
166
|
+
* overdue still draw their own edge; a plain `border-*` class would hide them.
|
|
167
|
+
*/
|
|
168
|
+
classes?: {
|
|
169
|
+
root?: string;
|
|
170
|
+
title?: string;
|
|
171
|
+
body?: string;
|
|
172
|
+
footer?: string;
|
|
173
|
+
};
|
|
174
|
+
dataTest: string;
|
|
175
|
+
/** Body slot. Wrap any interactive element in `CardControl`. */
|
|
176
|
+
children?: ReactNode;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Every visible and accessible string of the card family. ui-core ships bokmål (the wording decided in
|
|
180
|
+
* the card contract, Q11) and English; pick one with `locale` and override single strings with `labels`.
|
|
181
|
+
*
|
|
182
|
+
* @see asma-modules/_docs/ux/components/component-card.md:383 — §12 Q11
|
|
183
|
+
*/
|
|
184
|
+
export interface CardLabels {
|
|
185
|
+
select: string;
|
|
186
|
+
viewingNow: string;
|
|
187
|
+
unread: string;
|
|
188
|
+
selectFor: (title: string) => string;
|
|
189
|
+
moreActionsFor: (title: string) => string;
|
|
190
|
+
/** A control's name followed by its card's title, e.g. "Delt status, «Av-Grunndata»" (CARD-5). */
|
|
191
|
+
withTitle: (label: string, title: string) => string;
|
|
192
|
+
}
|
|
193
|
+
export declare const CARD_LABELS: Record<UiCoreLocale, CardLabels>;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { UiCoreLocale } from '../../../helpers/uiCoreLocale';
|
|
3
|
+
import { CardHeadingLevel } from './Card.types';
|
|
4
|
+
/** Loading placeholder in the card's shape; hidden from assistive technology, the list says it is busy (CARD-17). */
|
|
5
|
+
export declare const CardSkeleton: () => JSX.Element;
|
|
6
|
+
export interface CardListSelection {
|
|
7
|
+
/** Controlled by the app, so the checked cards survive a visit to an item and back (CARD-13). */
|
|
8
|
+
checkedIds: readonly string[];
|
|
9
|
+
onCheckedChange: (id: string, checked: boolean) => void;
|
|
10
|
+
disabledReason?: (id: string) => string | undefined;
|
|
11
|
+
}
|
|
12
|
+
export interface CardListProps<T> {
|
|
13
|
+
items: readonly T[];
|
|
14
|
+
getId: (item: T) => string;
|
|
15
|
+
renderCard: (item: T) => ReactNode;
|
|
16
|
+
/**
|
|
17
|
+
* Heading level of every card title in the list, so they all match (CARD-8). Optional: a card's own
|
|
18
|
+
* `headingLevel` wins; without either, cards use `h3`.
|
|
19
|
+
*/
|
|
20
|
+
cardHeadingLevel?: CardHeadingLevel;
|
|
21
|
+
/** Language of every card's built-in strings. Defaults to `en`, as in the rest of ui-core. */
|
|
22
|
+
locale?: UiCoreLocale;
|
|
23
|
+
/** `grid` (default): as many columns of at least 18 rem as fit, the cards of a row equally tall; each card stays ≤ 37.5 rem. `column`: one left-aligned column (CARD-16). */
|
|
24
|
+
layout?: 'column' | 'grid';
|
|
25
|
+
loading?: boolean;
|
|
26
|
+
skeletonCount?: number;
|
|
27
|
+
/** Says why the list is empty and what to do (CARD-17). */
|
|
28
|
+
empty?: ReactNode;
|
|
29
|
+
/** Announced politely when an action the user took changed the list (4.1.3). */
|
|
30
|
+
statusMessage?: string;
|
|
31
|
+
/** Puts focus back on this card's link, e.g. after returning from the item it opens (CARD-13). */
|
|
32
|
+
restoreFocusId?: string;
|
|
33
|
+
selection?: CardListSelection;
|
|
34
|
+
ariaLabel?: string;
|
|
35
|
+
className?: string;
|
|
36
|
+
dataTest: string;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* A group of cards is a list: `<ul>` with one `<li>` per card, loading and empty states, and a checkbox on
|
|
40
|
+
* every card in select mode (CARD-7, CARD-13, CARD-16, CARD-17). Only the list: a heading, a count, a
|
|
41
|
+
* bulk-actions bar or "Show more" around it are the app's, in its own design.
|
|
42
|
+
*
|
|
43
|
+
* @see asma-modules/_docs/ux/components/component-card.md:201 — CARD-17
|
|
44
|
+
*/
|
|
45
|
+
export declare const CardList: <T>(props: CardListProps<T>) => JSX.Element;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { CardCheckbox, CardLabels, CardMenu } from './Card.types';
|
|
3
|
+
interface CardControlProps {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
className?: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Lifts a control above the card's stretched link, so a tap on it never opens the card, and gives
|
|
9
|
+
* it at least a 40 × 40 CSS px hit area that includes its visible label (CARD-5, CARD-16). Text in
|
|
10
|
+
* it stays selectable, so a value users copy belongs here too. Any `CardControl` in a card's body
|
|
11
|
+
* makes the card partially clickable.
|
|
12
|
+
*
|
|
13
|
+
* @see asma-modules/_docs/ux/components/component-card.md:140 — CARD-5
|
|
14
|
+
*/
|
|
15
|
+
export declare const CardControl: ({ children, className }: CardControlProps) => JSX.Element;
|
|
16
|
+
/**
|
|
17
|
+
* Highlight tag: Design System tag, 11 px, semibold, uppercase through CSS so screen readers do not
|
|
18
|
+
* spell it out. Sized in rem with no fixed height, so larger text and spacing never clip it (CARD-10, Q10).
|
|
19
|
+
*/
|
|
20
|
+
export declare const CardTag: ({ children }: {
|
|
21
|
+
children: string;
|
|
22
|
+
}) => JSX.Element;
|
|
23
|
+
interface CardCheckboxControlProps {
|
|
24
|
+
checkbox: CardCheckbox;
|
|
25
|
+
titleText: string;
|
|
26
|
+
labels: CardLabels;
|
|
27
|
+
dataTest: string;
|
|
28
|
+
}
|
|
29
|
+
/** Selection checkbox named "Velg «title»"; the visible "Velg" sits inside its hit area (CARD-5, CARD-13). */
|
|
30
|
+
export declare const CardCheckboxControl: ({ checkbox, titleText, labels, dataTest }: CardCheckboxControlProps) => JSX.Element;
|
|
31
|
+
interface CardMenuControlProps {
|
|
32
|
+
menu: CardMenu;
|
|
33
|
+
titleText: string;
|
|
34
|
+
labels: CardLabels;
|
|
35
|
+
dataTest: string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* ⋮ trigger. With `actions` it opens the design-system menu, as the Workspaces cards do; with
|
|
39
|
+
* `render` the app's own popover. Focus returns to the trigger when it closes (CARD-14).
|
|
40
|
+
*
|
|
41
|
+
* @see asma-modules/_docs/ux/components/component-card.md:188 — CARD-14
|
|
42
|
+
*/
|
|
43
|
+
export declare const CardMenuControl: ({ menu, titleText, labels, dataTest }: CardMenuControlProps) => JSX.Element;
|
|
44
|
+
export {};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { KeyboardEvent, PointerEvent } from 'react';
|
|
2
|
+
import { UiCoreLocale } from '../../../helpers/uiCoreLocale';
|
|
3
|
+
import { CardCheckbox, CardHeadingLevel, CardModel, CardOpen } from './Card.types';
|
|
4
|
+
export interface CardModelInput {
|
|
5
|
+
open?: CardOpen;
|
|
6
|
+
readOnly?: boolean;
|
|
7
|
+
checkbox?: boolean;
|
|
8
|
+
menu?: boolean;
|
|
9
|
+
footerAction?: boolean;
|
|
10
|
+
ctaAction?: boolean;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* The model follows what the card does (CARD-2): it opens nothing → static; it opens one thing and
|
|
14
|
+
* holds any control → partially clickable; otherwise fully clickable. Select mode never changes it.
|
|
15
|
+
*
|
|
16
|
+
* @see asma-modules/_docs/ux/components/component-card.md:114 — §4 Interaction models
|
|
17
|
+
*/
|
|
18
|
+
export declare const resolveCardModel: (input: CardModelInput, bodyControlCount: number) => CardModel;
|
|
19
|
+
/**
|
|
20
|
+
* Whole calendar days since the due date, in local time; 0 on the due date or before it.
|
|
21
|
+
* The card's overdue words ("Forfalt • N dager") are built by the app from this number (CARD-10).
|
|
22
|
+
*
|
|
23
|
+
* @see asma-modules/_docs/ux/components/component-card.md:169 — CARD-10
|
|
24
|
+
*/
|
|
25
|
+
export declare const getOverdueDays: (dueDate: Date, today?: Date) => number;
|
|
26
|
+
/** What a body control needs to name itself after its card (CARD-5). */
|
|
27
|
+
export interface CardContextValue {
|
|
28
|
+
titleText: string;
|
|
29
|
+
/** The label followed by the card's title in the card's locale, e.g. "Delt status, «Av-Grunndata»". */
|
|
30
|
+
composeName: (label: string) => string;
|
|
31
|
+
registerControl: () => () => void;
|
|
32
|
+
}
|
|
33
|
+
export declare const CardContext: import('react').Context<CardContextValue | null>;
|
|
34
|
+
/** Read the surrounding card's title and naming helper from inside its body. */
|
|
35
|
+
export declare const useCardContext: () => CardContextValue;
|
|
36
|
+
/** Provided by `CardList` to every card in it (CARD-7, CARD-8, CARD-13). */
|
|
37
|
+
export interface CardListItemContextValue {
|
|
38
|
+
headingLevel?: CardHeadingLevel;
|
|
39
|
+
checkbox?: CardCheckbox;
|
|
40
|
+
locale?: UiCoreLocale;
|
|
41
|
+
}
|
|
42
|
+
export declare const CardListItemContext: import('react').Context<CardListItemContextValue>;
|
|
43
|
+
interface PressedHoldHandlers {
|
|
44
|
+
onPointerDown: (event: PointerEvent<HTMLElement>) => void;
|
|
45
|
+
onPointerUp: () => void;
|
|
46
|
+
onPointerLeave: () => void;
|
|
47
|
+
onPointerCancel: () => void;
|
|
48
|
+
onKeyDown: (event: KeyboardEvent<HTMLElement>) => void;
|
|
49
|
+
onKeyUp: () => void;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Keeps the card's pressed look for at least ~100 ms, so a fast tap still shows it; dragging off
|
|
53
|
+
* the card cancels it. Only a press on the card's own link counts, never one on a control (CARD-15).
|
|
54
|
+
*
|
|
55
|
+
* @see asma-modules/_docs/ux/patterns/pattern-pressed-state.md:81 — Timing and motion
|
|
56
|
+
*/
|
|
57
|
+
export declare const usePressedHold: () => {
|
|
58
|
+
isPressed: boolean;
|
|
59
|
+
handlers: PressedHoldHandlers;
|
|
60
|
+
};
|
|
61
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { CardProps } from '../Card.types';
|
|
3
|
+
/**
|
|
4
|
+
* Ad Voca type presets, read from Figma 9Q7C7JYPgnUSsrX1L8v40t (card component set 4808:169482):
|
|
5
|
+
* leading-edge colour and type-label colour per type. Consent's `shield-question` icon has no
|
|
6
|
+
* ui-core counterpart yet, so the story uses the document outline icon in its place.
|
|
7
|
+
*/
|
|
8
|
+
export declare const AD_VOCA_TYPES: {
|
|
9
|
+
module: {
|
|
10
|
+
type: {
|
|
11
|
+
label: string;
|
|
12
|
+
icon: import("react").JSX.Element;
|
|
13
|
+
color: string;
|
|
14
|
+
size: "body";
|
|
15
|
+
};
|
|
16
|
+
accentColor: string;
|
|
17
|
+
};
|
|
18
|
+
questionnaire: {
|
|
19
|
+
type: {
|
|
20
|
+
label: string;
|
|
21
|
+
icon: import("react").JSX.Element;
|
|
22
|
+
color: string;
|
|
23
|
+
};
|
|
24
|
+
accentColor: string;
|
|
25
|
+
};
|
|
26
|
+
task: {
|
|
27
|
+
type: {
|
|
28
|
+
label: string;
|
|
29
|
+
icon: import("react").JSX.Element;
|
|
30
|
+
color: string;
|
|
31
|
+
};
|
|
32
|
+
accentColor: string;
|
|
33
|
+
};
|
|
34
|
+
event: {
|
|
35
|
+
type: {
|
|
36
|
+
label: string;
|
|
37
|
+
icon: import("react").JSX.Element;
|
|
38
|
+
color: string;
|
|
39
|
+
};
|
|
40
|
+
accentColor: string;
|
|
41
|
+
};
|
|
42
|
+
consent: {
|
|
43
|
+
type: {
|
|
44
|
+
label: string;
|
|
45
|
+
icon: import("react").JSX.Element;
|
|
46
|
+
color: string;
|
|
47
|
+
};
|
|
48
|
+
accentColor: string;
|
|
49
|
+
};
|
|
50
|
+
document: {
|
|
51
|
+
type: {
|
|
52
|
+
label: string;
|
|
53
|
+
icon: import("react").JSX.Element;
|
|
54
|
+
color: string;
|
|
55
|
+
};
|
|
56
|
+
accentColor: string;
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
export type AdVocaTypeKey = keyof typeof AD_VOCA_TYPES;
|
|
60
|
+
export declare const LONG_TITLE = "Achieve a 20% increase in monthly active users by the end of the sprint, and keep it up for the rest of the quarter.";
|
|
61
|
+
export declare const STATUS_NOT_STARTED: {
|
|
62
|
+
label: string;
|
|
63
|
+
squareColor: string;
|
|
64
|
+
};
|
|
65
|
+
export declare const STATUS_VIEW_ONLY: {
|
|
66
|
+
label: string;
|
|
67
|
+
squareColor: string;
|
|
68
|
+
};
|
|
69
|
+
export declare const OVERDUE: {
|
|
70
|
+
label: string;
|
|
71
|
+
};
|
|
72
|
+
/** The reason a disabled card cannot be opened yet (Figma 7334:33933, DIS-1). */
|
|
73
|
+
export declare const STATUS_AVAILABLE_LATER: {
|
|
74
|
+
label: string;
|
|
75
|
+
squareColor: string;
|
|
76
|
+
};
|
|
77
|
+
/** When a disabled card opens, in body text colour (Figma "Card date" 7134:153564). */
|
|
78
|
+
export declare const ScheduledFact: () => JSX.Element;
|
|
79
|
+
export declare const ModuleImage: () => JSX.Element;
|
|
80
|
+
export declare const ReceivedFact: ({ label }: {
|
|
81
|
+
label?: string;
|
|
82
|
+
}) => JSX.Element;
|
|
83
|
+
/** Card inside workspace: the sub-goal and its category as one helper line (Figma 4823:147915). */
|
|
84
|
+
export declare const SubGoalCategory: () => JSX.Element;
|
|
85
|
+
export declare const EventFacts: () => JSX.Element;
|
|
86
|
+
/** Body content of each Ad Voca type, as listed in ASMA-8318 §2. */
|
|
87
|
+
export declare const adVocaBody: (key: AdVocaTypeKey) => ReactNode;
|
|
88
|
+
/** The Ad Voca call-to-action content an app passes to `cta`: the word and the chevron. */
|
|
89
|
+
export declare const ctaContent: (label: string) => ReactNode;
|
|
90
|
+
/** Props of one Ad Voca card of the given type, in its resting state. */
|
|
91
|
+
export declare const adVocaCardProps: (key: AdVocaTypeKey, dataTest: string) => CardProps;
|
|
92
|
+
/** Ad Opus Workspace card as Figma 5055:168041 draws it: checkbox, unread, tag, ⋮, "View details" in the footer, and the Shared status switch or "Not shareable". */
|
|
93
|
+
export declare const WorkspaceCard: ({ canShare }: {
|
|
94
|
+
canShare?: boolean;
|
|
95
|
+
}) => JSX.Element;
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export * from './helpers';
|
|
2
2
|
export * from './components/data-display/badge';
|
|
3
|
+
export * from './components/data-display/card';
|
|
3
4
|
export * from './components/data-display/chip';
|
|
4
5
|
export * from './components/data-display/interactive-chip';
|
|
5
6
|
export * from './components/data-display/tooltip';
|