@veevarts/design-system 2.27.0 → 2.28.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/README.md +17 -0
- package/dist/index.cjs +5 -5
- package/dist/index.d.ts +2 -0
- package/dist/index.js +4481 -3955
- package/dist/patterns/AdminTextField/AdminTextField.d.ts +4 -44
- package/dist/patterns/AdminTextField/index.d.ts +2 -2
- package/dist/patterns/AdminTextField/styles.d.ts +29 -0
- package/dist/patterns/AdminTextField/types.d.ts +78 -0
- package/dist/patterns/FeedbackState/FeedbackState.d.ts +1 -1
- package/dist/patterns/FeedbackState/type.d.ts +11 -1
- package/dist/patterns/Notice/Notice.d.ts +16 -0
- package/dist/patterns/Notice/index.d.ts +2 -0
- package/dist/patterns/Notice/styles.d.ts +35 -0
- package/dist/patterns/Notice/type.d.ts +39 -0
- package/dist/patterns/TileSelect/TileSelect.d.ts +2 -115
- package/dist/patterns/TileSelect/index.d.ts +1 -1
- package/dist/patterns/TileSelect/styles.d.ts +42 -0
- package/dist/patterns/TileSelect/types.d.ts +140 -0
- package/dist/patterns/VerticalSteps/StepPager.d.ts +6 -0
- package/dist/patterns/VerticalSteps/StepsReadiness.d.ts +15 -0
- package/dist/patterns/VerticalSteps/VerticalSteps.d.ts +6 -0
- package/dist/patterns/VerticalSteps/index.d.ts +4 -0
- package/dist/patterns/VerticalSteps/styles.d.ts +54 -0
- package/dist/patterns/VerticalSteps/types.d.ts +100 -0
- package/dist/patterns/index.d.ts +6 -2
- package/dist/providers/HeroUIProvider.d.ts +7 -1
- package/dist/providers/ToastProvider.d.ts +16 -0
- package/dist/providers/index.d.ts +2 -0
- package/package.json +1 -1
|
@@ -1,53 +1,13 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
+
import { AdminFieldLabelProps, AdminTextFieldProps } from './types';
|
|
2
3
|
/**
|
|
3
4
|
* The uppercase field label, standalone — for a control this component does
|
|
4
5
|
* not cover (a checkbox group, a read-only preview) that should still be
|
|
5
6
|
* captioned like every other admin field. `suffix` is the lighter tail:
|
|
6
7
|
* "· optional", "· auto-generated, immutable".
|
|
7
|
-
*/
|
|
8
|
-
export declare const AdminFieldLabel: React.FC<{
|
|
9
|
-
children: React.ReactNode;
|
|
10
|
-
suffix?: React.ReactNode;
|
|
11
|
-
className?: string;
|
|
12
|
-
'data-testid'?: string;
|
|
13
|
-
}>;
|
|
14
|
-
interface AdminTextFieldBase {
|
|
15
|
-
/** Uppercase label above the control. Omit only when an adjacent element already names it. */
|
|
16
|
-
label?: React.ReactNode;
|
|
17
|
-
/** Lighter annotation after the label (e.g. `· optional`). Ignored without a label. */
|
|
18
|
-
labelSuffix?: React.ReactNode;
|
|
19
|
-
value: string;
|
|
20
|
-
placeholder?: string;
|
|
21
|
-
disabled?: boolean;
|
|
22
|
-
/** Monospace face without the read-only treatment, for codes the user types. */
|
|
23
|
-
mono?: boolean;
|
|
24
|
-
/** Claim initial focus. Only for the first field of a dialog, never on a page. */
|
|
25
|
-
autoFocus?: boolean;
|
|
26
|
-
/** Small helper or error text under the control. */
|
|
27
|
-
hint?: React.ReactNode;
|
|
28
|
-
/** Renders the hint as an error and marks the control invalid. */
|
|
29
|
-
invalid?: boolean;
|
|
30
|
-
className?: string;
|
|
31
|
-
'data-testid'?: string;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* `onChange` is REQUIRED unless the field is read-only.
|
|
35
|
-
*
|
|
36
|
-
* This is a controlled input: given a `value` and no handler, React pins it and
|
|
37
|
-
* typing does nothing — a field that looks editable, accepts focus, and silently
|
|
38
|
-
* discards every keystroke. That is indistinguishable from a bug at a glance,
|
|
39
|
-
* and it is what happens by accident when someone renders one to show a value.
|
|
40
8
|
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
* and announces it correctly.
|
|
9
|
+
* `isRequired` adds a visible `*` and the screen-reader `requiredLabel`;
|
|
10
|
+
* `help` adds an ⓘ that opens it in a popover, kept outside the label text.
|
|
44
11
|
*/
|
|
45
|
-
export
|
|
46
|
-
readOnly: true;
|
|
47
|
-
onChange?: never;
|
|
48
|
-
} | {
|
|
49
|
-
readOnly?: false;
|
|
50
|
-
onChange: (value: string) => void;
|
|
51
|
-
});
|
|
12
|
+
export declare const AdminFieldLabel: React.FC<AdminFieldLabelProps>;
|
|
52
13
|
export declare const AdminTextField: React.FC<AdminTextFieldProps>;
|
|
53
|
-
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { AdminFieldLabel, AdminTextField } from './AdminTextField';
|
|
2
|
-
export type { AdminTextFieldProps } from './
|
|
3
|
-
export { adminFieldErrorClass, adminFieldHintClass, adminFieldLabelClass, adminFieldLabelSuffixClass, adminInputClass, adminInputReadOnlyClass, adminInputWrapperClass, } from './styles';
|
|
2
|
+
export type { AdminTextFieldProps, AdminFieldLabelProps, AdminFieldRequiredProps, AdminFieldHelpProps } from './types';
|
|
3
|
+
export { adminFieldErrorClass, adminFieldHelpButtonClass, adminFieldHelpContentClass, adminFieldHelpIconClass, adminFieldHintClass, adminFieldLabelClass, adminFieldLabelNoAutoMarkClass, adminFieldLabelRowClass, adminFieldLabelSuffixClass, adminFieldRequiredClass, adminInputClass, adminInputReadOnlyClass, adminInputWrapperClass, } from './styles';
|
|
@@ -22,6 +22,35 @@ export declare const adminFieldLabelClass = "text-[11px] font-semibold uppercase
|
|
|
22
22
|
* aside, not as part of the field's name.
|
|
23
23
|
*/
|
|
24
24
|
export declare const adminFieldLabelSuffixClass = "font-normal normal-case tracking-normal";
|
|
25
|
+
/**
|
|
26
|
+
* The visible `*` of a required field. `after:content-none` switches off the
|
|
27
|
+
* `*` HeroUI's own `isRequired` paints into its label slot, so there is one
|
|
28
|
+
* mark, the one carrying the screen-reader word.
|
|
29
|
+
*/
|
|
30
|
+
export declare const adminFieldRequiredClass = "ms-0.5 text-acct-danger";
|
|
31
|
+
/**
|
|
32
|
+
* The label row a field with `help` draws itself, in place of HeroUI's.
|
|
33
|
+
* HeroUI pushes its box down by `font-size-small + 10px` (24px) to make room
|
|
34
|
+
* for its outside label; this row takes the same height from the same
|
|
35
|
+
* variable, so a field with help and one without line up in a form row.
|
|
36
|
+
* `min-h` rather than `h`, so a label that wraps grows the row instead of
|
|
37
|
+
* running into the box.
|
|
38
|
+
*
|
|
39
|
+
* `text-foreground` because that is the color HeroUI's label actually renders
|
|
40
|
+
* in above the box (`group-data-[filled-within=true]:text-foreground` beats
|
|
41
|
+
* the `text-acct-muted` it is given), measured at `rgb(17, 24, 28)`.
|
|
42
|
+
*/
|
|
43
|
+
export declare const adminFieldLabelRowClass = "mb-0 min-h-[calc(var(--heroui-font-size-small)_+_10px)] text-foreground";
|
|
44
|
+
/** Added to HeroUI's `label` slot so its `isRequired` mark does not double ours. */
|
|
45
|
+
export declare const adminFieldLabelNoAutoMarkClass = "after:content-none";
|
|
46
|
+
/**
|
|
47
|
+
* The ⓘ that opens a field's help: a 24px round hit target (WCAG 2.5.8) whose
|
|
48
|
+
* negative margin keeps the 11px label row from growing to fit it.
|
|
49
|
+
*/
|
|
50
|
+
export declare const adminFieldHelpButtonClass = "ms-0.5 -my-1.5 size-6 min-w-6 align-middle text-acct-sub data-[hover=true]:bg-acct-page data-[hover=true]:text-acct-ink";
|
|
51
|
+
export declare const adminFieldHelpIconClass = "size-4";
|
|
52
|
+
/** The popover the ⓘ opens. Body copy, so sentence case and ink. */
|
|
53
|
+
export declare const adminFieldHelpContentClass = "max-w-xs rounded-xl px-3 py-2 text-xs leading-normal text-acct-ink2";
|
|
25
54
|
/**
|
|
26
55
|
* The 38px box — HeroUI's `inputWrapper` slot, which carries the border and
|
|
27
56
|
* background (the `input` slot is the bare field).
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* The required mark. Plain optional props rather than a union that forces
|
|
4
|
+
* `requiredLabel` with `isRequired`: a union collapses under
|
|
5
|
+
* `Omit<AdminTextFieldProps, …>`, so every wrapper that forwards props would
|
|
6
|
+
* stop compiling.
|
|
7
|
+
*/
|
|
8
|
+
export interface AdminFieldRequiredProps {
|
|
9
|
+
/** Adds a visible `*` after the label (and its suffix). */
|
|
10
|
+
isRequired?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* The word screen readers hear for the `*` ("required", "obligatoire").
|
|
13
|
+
* Pass it with `isRequired`: the `*` itself is hidden from them.
|
|
14
|
+
*/
|
|
15
|
+
requiredLabel?: string;
|
|
16
|
+
}
|
|
17
|
+
/** Help on demand: an ⓘ button after the label that opens it in a popover. */
|
|
18
|
+
export interface AdminFieldHelpProps {
|
|
19
|
+
help?: React.ReactNode;
|
|
20
|
+
/** Accessible name of the ⓘ ("About timezone"). Without it the ⓘ is named by the label text. */
|
|
21
|
+
helpLabel?: string;
|
|
22
|
+
}
|
|
23
|
+
export interface AdminFieldLabelProps extends AdminFieldRequiredProps, AdminFieldHelpProps {
|
|
24
|
+
children: React.ReactNode;
|
|
25
|
+
/** The lighter tail: "· optional", "· auto-generated, immutable". */
|
|
26
|
+
suffix?: React.ReactNode;
|
|
27
|
+
/**
|
|
28
|
+
* `id` of the control this captions. The text then renders as a real
|
|
29
|
+
* `<label>`, so clicking it focuses the control. The ⓘ stays outside it.
|
|
30
|
+
*/
|
|
31
|
+
htmlFor?: string;
|
|
32
|
+
/** `id` of the text element, for a group to point `aria-labelledby` at. */
|
|
33
|
+
id?: string;
|
|
34
|
+
className?: string;
|
|
35
|
+
'data-testid'?: string;
|
|
36
|
+
}
|
|
37
|
+
export interface AdminTextFieldBase extends AdminFieldRequiredProps, AdminFieldHelpProps {
|
|
38
|
+
/** Uppercase label above the control. Omit only when an adjacent element already names it. */
|
|
39
|
+
label?: React.ReactNode;
|
|
40
|
+
/** Lighter annotation after the label (e.g. `· optional`). Ignored without a label. */
|
|
41
|
+
labelSuffix?: React.ReactNode;
|
|
42
|
+
value: string;
|
|
43
|
+
placeholder?: string;
|
|
44
|
+
disabled?: boolean;
|
|
45
|
+
/** Monospace face without the read-only treatment, for codes the user types. */
|
|
46
|
+
mono?: boolean;
|
|
47
|
+
/** Claim initial focus. Only for the first field of a dialog, never on a page. */
|
|
48
|
+
autoFocus?: boolean;
|
|
49
|
+
/** Small helper or error text under the control. */
|
|
50
|
+
hint?: React.ReactNode;
|
|
51
|
+
/** Renders the hint as an error and marks the control invalid. */
|
|
52
|
+
invalid?: boolean;
|
|
53
|
+
className?: string;
|
|
54
|
+
'data-testid'?: string;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* `onChange` is REQUIRED unless the field is read-only.
|
|
58
|
+
*
|
|
59
|
+
* This is a controlled input: given a `value` and no handler, React pins it and
|
|
60
|
+
* typing does nothing — a field that looks editable, accepts focus, and silently
|
|
61
|
+
* discards every keystroke. That is indistinguishable from a bug at a glance,
|
|
62
|
+
* and it is what happens by accident when someone renders one to show a value.
|
|
63
|
+
*
|
|
64
|
+
* Showing a value without accepting edits is a real case, so it stays possible;
|
|
65
|
+
* it just has to be said, with `readOnly`, which also renders it as system-owned
|
|
66
|
+
* and announces it correctly.
|
|
67
|
+
*
|
|
68
|
+
* `isRequired` / `help` behave as on {@link AdminFieldLabelProps}, and are
|
|
69
|
+
* ignored without a `label`. `isRequired` also marks the input
|
|
70
|
+
* `aria-required`, without the browser's own `required` validation.
|
|
71
|
+
*/
|
|
72
|
+
export type AdminTextFieldProps = AdminTextFieldBase & ({
|
|
73
|
+
readOnly: true;
|
|
74
|
+
onChange?: never;
|
|
75
|
+
} | {
|
|
76
|
+
readOnly?: false;
|
|
77
|
+
onChange: (value: string) => void;
|
|
78
|
+
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { JSX } from 'react';
|
|
2
2
|
import { EmptyStateProps, ErrorStateProps, FeedbackStateProps, LoadingStateProps, SuccessStateProps } from './type';
|
|
3
|
-
export declare function FeedbackState(
|
|
3
|
+
export declare function FeedbackState(props: FeedbackStateProps): JSX.Element;
|
|
4
4
|
export declare namespace FeedbackState {
|
|
5
5
|
var displayName: string;
|
|
6
6
|
}
|
|
@@ -20,6 +20,8 @@ export interface FeedbackStateClassNames {
|
|
|
20
20
|
spinner?: string;
|
|
21
21
|
title?: string;
|
|
22
22
|
description?: string;
|
|
23
|
+
/** The `ErrorState` reference code line. */
|
|
24
|
+
referenceCode?: string;
|
|
23
25
|
actions?: string;
|
|
24
26
|
}
|
|
25
27
|
export interface FeedbackStateProps {
|
|
@@ -50,6 +52,14 @@ export interface FeedbackStateProps {
|
|
|
50
52
|
'data-testid'?: string;
|
|
51
53
|
}
|
|
52
54
|
export type EmptyStateProps = Omit<FeedbackStateProps, 'variant'>;
|
|
53
|
-
export
|
|
55
|
+
export interface ErrorStateProps extends Omit<FeedbackStateProps, 'variant'> {
|
|
56
|
+
/**
|
|
57
|
+
* Support code for this failure, e.g. `"FR-QE-900"`, shown on a small line under the description
|
|
58
|
+
* so a user can quote it from a screenshot. Nothing is rendered without it.
|
|
59
|
+
*/
|
|
60
|
+
referenceCode?: string;
|
|
61
|
+
/** Text before the code. Defaults to `"Reference code:"`; the caller owns i18n. */
|
|
62
|
+
referenceCodeLabel?: string;
|
|
63
|
+
}
|
|
54
64
|
export type LoadingStateProps = Omit<FeedbackStateProps, 'variant'>;
|
|
55
65
|
export type SuccessStateProps = Omit<FeedbackStateProps, 'variant'>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { JSX } from 'react';
|
|
2
|
+
import { NoticeProps } from './type';
|
|
3
|
+
/**
|
|
4
|
+
* An inline message with a severity: the DS answer to HeroUI's
|
|
5
|
+
* `Alert variant="flat" isClosable={false}` repeated per call, and to the
|
|
6
|
+
* hand-rolled red lines and boxes of the POS.
|
|
7
|
+
*
|
|
8
|
+
* Danger and warning are `role="alert"` (assertive), info and success
|
|
9
|
+
* `role="status"` (polite). Copy comes in as props; the caller owns i18n.
|
|
10
|
+
* The only motion is the dismiss button's press feedback, which is dropped
|
|
11
|
+
* when the OS or the POS asks for reduced motion.
|
|
12
|
+
*/
|
|
13
|
+
export declare function Notice({ tone, variant, title, description, actions, onDismiss, dismissLabel, role, className, 'data-testid': dataTestId, }: NoticeProps): JSX.Element;
|
|
14
|
+
export declare namespace Notice {
|
|
15
|
+
var displayName: string;
|
|
16
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { NoticeTone, NoticeVariant } from './type';
|
|
2
|
+
/**
|
|
3
|
+
* One glyph per tone, on every variant. Solar `bold` so the shape reads at
|
|
4
|
+
* callout size; the danger tone had four different glyphs across the apps
|
|
5
|
+
* before this (HeroUI's own, two Solar outlines and a gravity-ui fill).
|
|
6
|
+
*/
|
|
7
|
+
export declare const NOTICE_ICON: Record<NoticeTone, string>;
|
|
8
|
+
export declare const NOTICE_DISMISS_ICON = "solar:close-circle-linear";
|
|
9
|
+
/**
|
|
10
|
+
* Every size is rem (or em off a rem font size), so the POS "Text size"
|
|
11
|
+
* setting, which scales the root font size, scales the notice with it. The
|
|
12
|
+
* values are the design hub's px at a 16px root.
|
|
13
|
+
*/
|
|
14
|
+
export declare const noticeClass: Record<NoticeVariant, {
|
|
15
|
+
root: string;
|
|
16
|
+
iconWrapper: string;
|
|
17
|
+
iconSize: string;
|
|
18
|
+
text: string;
|
|
19
|
+
title: string;
|
|
20
|
+
description: string;
|
|
21
|
+
actions: string;
|
|
22
|
+
dismiss: string;
|
|
23
|
+
}>;
|
|
24
|
+
/**
|
|
25
|
+
* Tints. All `pos-*` tokens, the palette the Quick and POS surfaces style
|
|
26
|
+
* with; each text tone clears 4.5:1 on its fill (`pos-surface.test.ts`). The
|
|
27
|
+
* banner discs for danger and warning are the mockup's own tints; info and
|
|
28
|
+
* success have none in the mockup, so their disc is the tone at 15%.
|
|
29
|
+
*/
|
|
30
|
+
export declare const noticeTone: Record<NoticeTone, {
|
|
31
|
+
callout: string;
|
|
32
|
+
banner: string;
|
|
33
|
+
disc: string;
|
|
34
|
+
title: string;
|
|
35
|
+
}>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
/** Severity. Picks the tint, the glyph and the default live-region role. */
|
|
3
|
+
export type NoticeTone = 'info' | 'success' | 'warning' | 'danger';
|
|
4
|
+
/**
|
|
5
|
+
* Which of the design hub's two notice shapes to draw.
|
|
6
|
+
*
|
|
7
|
+
* `callout` is the inline note of the Quick Donation and Quick Membership
|
|
8
|
+
* mockups (`.callout-info`, `.callout-warn`): a small tinted block, the glyph
|
|
9
|
+
* on the first line, the title run in bold ahead of the text.
|
|
10
|
+
*
|
|
11
|
+
* `banner` is the POS `.banner`: the glyph in a filled disc, the title in the
|
|
12
|
+
* tone on its own line, muted body copy and an action row under it.
|
|
13
|
+
*/
|
|
14
|
+
export type NoticeVariant = 'callout' | 'banner';
|
|
15
|
+
export interface NoticeProps {
|
|
16
|
+
/** Severity. Defaults to `info`. */
|
|
17
|
+
tone?: NoticeTone;
|
|
18
|
+
/** `callout` (default) or `banner`. */
|
|
19
|
+
variant?: NoticeVariant;
|
|
20
|
+
/** Short lead: run in bold before the description on a callout, its own line on a banner. */
|
|
21
|
+
title?: ReactNode;
|
|
22
|
+
/** The message. Phrasing content (text, links, `strong`): it shares a line with a callout's title. */
|
|
23
|
+
description?: ReactNode;
|
|
24
|
+
/** Buttons or links, rendered under the text. */
|
|
25
|
+
actions?: ReactNode;
|
|
26
|
+
/** Shows a dismiss button that calls this. The notice does not hide itself: the caller stops rendering it. */
|
|
27
|
+
onDismiss?: () => void;
|
|
28
|
+
/** Accessible name of the dismiss button. Defaults to `"Dismiss"`. */
|
|
29
|
+
dismissLabel?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Live-region role. Defaults to `alert` for `danger` and `warning`, `status`
|
|
32
|
+
* for `info` and `success`; the matching `aria-live` follows it.
|
|
33
|
+
*/
|
|
34
|
+
role?: 'alert' | 'status';
|
|
35
|
+
/** Root className, for layout (margins, width). */
|
|
36
|
+
className?: string;
|
|
37
|
+
/** Root test id; the parts are suffixed (`-icon`, `-title`, `-description`, `-actions`, `-dismiss`). */
|
|
38
|
+
'data-testid'?: string;
|
|
39
|
+
}
|
|
@@ -1,117 +1,4 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
key: string;
|
|
5
|
-
/** Visible label rendered under the icon. */
|
|
6
|
-
label: string;
|
|
7
|
-
/**
|
|
8
|
-
* Icon: iconify name (`'lucide:credit-card'`) or a `ReactNode` for
|
|
9
|
-
* fully-custom SVGs.
|
|
10
|
-
*/
|
|
11
|
-
icon: string | React.ReactNode;
|
|
12
|
-
/** Disable the tile (greyed out, no click). */
|
|
13
|
-
isDisabled?: boolean;
|
|
14
|
-
/**
|
|
15
|
-
* One line of supporting copy. Rendered only by `variant="compact"`,
|
|
16
|
-
* for an option that ended up in the "More" menu, where the label
|
|
17
|
-
* alone ("Other") rarely says enough.
|
|
18
|
-
*/
|
|
19
|
-
description?: string;
|
|
20
|
-
/**
|
|
21
|
-
* `variant="compact"` only: keep this option in the "More" menu at
|
|
22
|
-
* every width, however much room the track has. For an action that is
|
|
23
|
-
* secondary by decision rather than by measurement — a payments picker
|
|
24
|
-
* that wants "Other" one click away so the methods people actually
|
|
25
|
-
* reach for own the row.
|
|
26
|
-
*
|
|
27
|
-
* The menu is rendered whenever an option asks for it, so this also
|
|
28
|
-
* overrides the rule that suppresses a menu holding a single option.
|
|
29
|
-
*/
|
|
30
|
-
alwaysInMenu?: boolean;
|
|
31
|
-
/**
|
|
32
|
-
* `variant="compact"` only: what this option is worth keeping on the
|
|
33
|
-
* track. When the pill runs out of room the LOWEST priority folds into
|
|
34
|
-
* the menu first; equal priorities fold from the end of the list.
|
|
35
|
-
* Default `0`.
|
|
36
|
-
*
|
|
37
|
-
* Display order is untouched — this decides what survives a squeeze,
|
|
38
|
-
* not where anything sits. A payments picker can list "Other" before
|
|
39
|
-
* "Split payment" and still lose "Other" first, because splitting a
|
|
40
|
-
* payment is the rarer, weightier thing to reach for.
|
|
41
|
-
*/
|
|
42
|
-
priority?: number;
|
|
43
|
-
/** Override per-tile test id; defaults to `${dataTestId}-${key}`. */
|
|
44
|
-
'data-testid'?: string;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* `'tiles'` — the icon-over-label grid, with a `<Select>` dropdown under
|
|
48
|
-
* `md`. The picker is the subject of the step.
|
|
49
|
-
*
|
|
50
|
-
* `'compact'` — a segmented pill of label-only toggles at every width,
|
|
51
|
-
* keeping every option the track can hold and folding the rest into a
|
|
52
|
-
* "More" menu rather than scrolling. The picker is a control among others.
|
|
53
|
-
*/
|
|
54
|
-
export type TileSelectVariant = 'tiles' | 'compact';
|
|
55
|
-
/**
|
|
56
|
-
* Tile size for `variant="tiles"`.
|
|
57
|
-
*
|
|
58
|
-
* `'md'` (default) — the 80px icon-over-label tile of the payments drop-in.
|
|
59
|
-
*
|
|
60
|
-
* `'sm'` — the 58px tender tile of the Quick Donation / Quick Membership
|
|
61
|
-
* mockups (`.tender-tile`): 17px icon over an 11.5px label, 10px/4px padding,
|
|
62
|
-
* 12px radius, 8px between tiles; the picked tile takes a brand border, a 9%
|
|
63
|
-
* brand tint and brand text. DS tokens only, rem only.
|
|
64
|
-
*/
|
|
65
|
-
export type TileSelectSize = 'md' | 'sm';
|
|
66
|
-
export interface TileSelectProps {
|
|
67
|
-
/** Options to render in order. */
|
|
68
|
-
options: readonly TileSelectOption[];
|
|
69
|
-
/** Currently selected option `key`. `null` = no selection. */
|
|
70
|
-
selectedKey: string | null;
|
|
71
|
-
/** Fires when a tile is selected. */
|
|
72
|
-
onSelect: (key: string) => void;
|
|
73
|
-
/** Optional heading rendered above the grid. */
|
|
74
|
-
heading?: string;
|
|
75
|
-
/**
|
|
76
|
-
* `aria-label` for the wrapping group when `heading` is omitted.
|
|
77
|
-
* Translatable. Default `'Select an option'`. When `heading` is
|
|
78
|
-
* provided this prop is ignored — the grid is labelled by the
|
|
79
|
-
* heading element.
|
|
80
|
-
*/
|
|
81
|
-
ariaLabel?: string;
|
|
82
|
-
/**
|
|
83
|
-
* How the options render. Default `'tiles'`.
|
|
84
|
-
* See {@link TileSelectVariant}.
|
|
85
|
-
*/
|
|
86
|
-
variant?: TileSelectVariant;
|
|
87
|
-
/**
|
|
88
|
-
* `variant="compact"` only: a CAP on how many options stay on the pill.
|
|
89
|
-
* Unset by default, and normally best left that way — the pill already
|
|
90
|
-
* measures the track and keeps every option that fits, folding only
|
|
91
|
-
* what is left over. Set it when a surface wants a shorter row than
|
|
92
|
-
* its width allows.
|
|
93
|
-
*
|
|
94
|
-
* The cap gives way in one case: when honouring it would leave a single
|
|
95
|
-
* option in the menu that the track had room for. A "More" button is
|
|
96
|
-
* wider than most labels, so that fold costs space and buys a click.
|
|
97
|
-
*/
|
|
98
|
-
maxVisible?: number;
|
|
99
|
-
/**
|
|
100
|
-
* `variant="compact"` only: label for the overflow trigger. Shown
|
|
101
|
-
* until an option inside the menu is selected, after which the
|
|
102
|
-
* trigger carries that option's label. Translatable. Default `'More'`.
|
|
103
|
-
*/
|
|
104
|
-
moreLabel?: string;
|
|
105
|
-
/**
|
|
106
|
-
* Grid columns on >= sm. Default `3`. Mobile collapses to 2.
|
|
107
|
-
* `5` and `6` keep a full method set on one row on a wide surface.
|
|
108
|
-
* Ignored by `variant="compact"`, which is a single strip.
|
|
109
|
-
*/
|
|
110
|
-
columnsDesktop?: 2 | 3 | 4 | 5 | 6;
|
|
111
|
-
columnsMobile?: 1 | 2;
|
|
112
|
-
/** `variant="tiles"` only. See {@link TileSelectSize}. Default `'md'`. */
|
|
113
|
-
size?: TileSelectSize;
|
|
114
|
-
className?: string;
|
|
115
|
-
'data-testid'?: string;
|
|
116
|
-
}
|
|
2
|
+
import { TileSelectProps } from './types';
|
|
3
|
+
export type { TileSelectOption, TileSelectProps, TileSelectSize, TileSelectVariant } from './types';
|
|
117
4
|
export declare const TileSelect: React.FC<TileSelectProps>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { TileSelect } from './TileSelect';
|
|
2
|
-
export type { TileSelectProps, TileSelectOption, TileSelectVariant, TileSelectSize } from './
|
|
2
|
+
export type { TileSelectProps, TileSelectOption, TileSelectVariant, TileSelectSize } from './types';
|
|
@@ -11,4 +11,46 @@ export declare const smallTileClass: {
|
|
|
11
11
|
readonly active: "border-primary bg-primary/[.09] text-primary data-[hover=true]:bg-primary/[.09]";
|
|
12
12
|
readonly icon: "flex h-[1.0625rem] w-[1.0625rem] items-center justify-center";
|
|
13
13
|
readonly label: "text-[0.71875rem] font-medium leading-[0.875rem]";
|
|
14
|
+
/** `isLocked`: dashed and muted, and inert under the pointer. `pos-muted` is 4.83:1 on white. */
|
|
15
|
+
readonly locked: "cursor-not-allowed border-dashed border-pos-line-strong bg-white text-pos-muted data-[hover=true]:border-pos-line-strong data-[hover=true]:bg-white data-[pressed=true]:scale-100";
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* `size="md"` tile classes.
|
|
19
|
+
*
|
|
20
|
+
* Sized to the Figma spec for the payments-drop-in method picker (PP-1154):
|
|
21
|
+
* 48px inner content (icon 20 + gap 8 + label 20) + 32px vertical padding
|
|
22
|
+
* (`py-4`) = 80px. `h-auto` lets the tile grow past that floor when content
|
|
23
|
+
* wraps (localised long labels, a description).
|
|
24
|
+
*
|
|
25
|
+
* `bg-transparent` suppresses HeroUI's own fill so the active and hover
|
|
26
|
+
* surfaces come from these classes alone.
|
|
27
|
+
*/
|
|
28
|
+
export declare const mediumTileClass: {
|
|
29
|
+
readonly tile: "flex flex-col items-center justify-center gap-2 h-auto min-h-20 px-4 py-4 border bg-transparent transition-colors motion-reduce:transition-none [html[data-pos-reduce-motion=true]_&]:transition-none";
|
|
30
|
+
readonly idle: "border-default-200 text-default-800 hover:bg-default-50";
|
|
31
|
+
readonly active: "border-primary bg-primary-50 text-primary";
|
|
32
|
+
readonly label: "text-sm font-medium";
|
|
33
|
+
/**
|
|
34
|
+
* The grid holds a description or a badge: every tile left-aligns, with
|
|
35
|
+
* the icon and badge on one row, then the label, then the description.
|
|
36
|
+
*/
|
|
37
|
+
readonly detailed: "items-start justify-start gap-1 whitespace-normal text-left";
|
|
38
|
+
/** Wraps the badge under the icon rather than overflowing a narrow tile. */
|
|
39
|
+
readonly header: "mb-1 flex w-full flex-wrap items-start justify-between gap-2";
|
|
40
|
+
/**
|
|
41
|
+
* `default-600`, not 500: on the picked tile's `primary-50` tint the 500
|
|
42
|
+
* measured 4.498:1, a hair under the floor.
|
|
43
|
+
*/
|
|
44
|
+
readonly description: "text-xs font-normal leading-snug text-default-600";
|
|
45
|
+
/** The locked tile's description, muted with the rest of it (4.6:1 on `default-50`). */
|
|
46
|
+
readonly lockedDescription: "text-default-500";
|
|
47
|
+
/** `default-600` on `default-100`: about 7:1. */
|
|
48
|
+
readonly badge: "shrink-0 whitespace-nowrap rounded-full bg-default-100 px-2 py-0.5 text-[11px] font-medium leading-4 text-default-600";
|
|
49
|
+
/**
|
|
50
|
+
* `isLocked`: dashed, muted, inert under the pointer. Muted by color, not
|
|
51
|
+
* opacity, so the text keeps its contrast: `default-500` on `default-50`
|
|
52
|
+
* measures 4.6:1. HeroUI's hover dim and press scale are switched off.
|
|
53
|
+
*/
|
|
54
|
+
readonly locked: "cursor-not-allowed border-dashed border-default-300 bg-default-50 text-default-500 hover:bg-default-50 data-[hover=true]:opacity-100 data-[pressed=true]:scale-100";
|
|
55
|
+
readonly lockedIcon: "text-default-400";
|
|
14
56
|
};
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface TileSelectOption {
|
|
3
|
+
/** Stable identifier returned via `onSelect`. */
|
|
4
|
+
key: string;
|
|
5
|
+
/** Visible label rendered under the icon. */
|
|
6
|
+
label: string;
|
|
7
|
+
/**
|
|
8
|
+
* Icon: iconify name (`'lucide:credit-card'`) or a `ReactNode` for
|
|
9
|
+
* fully-custom SVGs.
|
|
10
|
+
*/
|
|
11
|
+
icon: string | React.ReactNode;
|
|
12
|
+
/**
|
|
13
|
+
* Disable the tile (greyed out, no click). The tile is `disabled`, so it
|
|
14
|
+
* also leaves the tab order. For an option that exists but cannot be
|
|
15
|
+
* picked yet, use `isLocked`.
|
|
16
|
+
*/
|
|
17
|
+
isDisabled?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* One line of supporting copy. `variant="compact"` renders it for an
|
|
20
|
+
* option that ended up in the "More" menu, where the label alone
|
|
21
|
+
* ("Other") rarely says enough. `variant="tiles"` renders it only in a
|
|
22
|
+
* grid opted in to the detailed tile (some option has a `badge` or is
|
|
23
|
+
* `isLocked`): on the `size="md"` tile under the label, and as the item
|
|
24
|
+
* description in the small-viewport `<Select>`. On its own it changes
|
|
25
|
+
* nothing in the tile grid.
|
|
26
|
+
*/
|
|
27
|
+
description?: string;
|
|
28
|
+
/**
|
|
29
|
+
* A short tag on the tile's top row: "Coming soon", "New".
|
|
30
|
+
* `variant="tiles"` at `size="md"`; also the end of its `<Select>` item.
|
|
31
|
+
* Opts the grid in to the detailed tile.
|
|
32
|
+
*/
|
|
33
|
+
badge?: string;
|
|
34
|
+
/**
|
|
35
|
+
* Shown, not pickable: a dashed, muted tile that ignores presses. Unlike
|
|
36
|
+
* `isDisabled` it stays focusable and is `aria-disabled`, so keyboard and
|
|
37
|
+
* screen-reader users reach it and hear `lockedReason`. `variant="compact"`
|
|
38
|
+
* and the small-viewport `<Select>` treat it as disabled. Opts the grid in
|
|
39
|
+
* to the detailed tile.
|
|
40
|
+
*/
|
|
41
|
+
isLocked?: boolean;
|
|
42
|
+
/** What a locked tile announces. Defaults to `badge`. */
|
|
43
|
+
lockedReason?: string;
|
|
44
|
+
/**
|
|
45
|
+
* `variant="compact"` only: keep this option in the "More" menu at
|
|
46
|
+
* every width, however much room the track has. For an action that is
|
|
47
|
+
* secondary by decision rather than by measurement — a payments picker
|
|
48
|
+
* that wants "Other" one click away so the methods people actually
|
|
49
|
+
* reach for own the row.
|
|
50
|
+
*
|
|
51
|
+
* The menu is rendered whenever an option asks for it, so this also
|
|
52
|
+
* overrides the rule that suppresses a menu holding a single option.
|
|
53
|
+
*/
|
|
54
|
+
alwaysInMenu?: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* `variant="compact"` only: what this option is worth keeping on the
|
|
57
|
+
* track. When the pill runs out of room the LOWEST priority folds into
|
|
58
|
+
* the menu first; equal priorities fold from the end of the list.
|
|
59
|
+
* Default `0`.
|
|
60
|
+
*
|
|
61
|
+
* Display order is untouched — this decides what survives a squeeze,
|
|
62
|
+
* not where anything sits. A payments picker can list "Other" before
|
|
63
|
+
* "Split payment" and still lose "Other" first, because splitting a
|
|
64
|
+
* payment is the rarer, weightier thing to reach for.
|
|
65
|
+
*/
|
|
66
|
+
priority?: number;
|
|
67
|
+
/** Override per-tile test id; defaults to `${dataTestId}-${key}`. */
|
|
68
|
+
'data-testid'?: string;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* `'tiles'` — the icon-over-label grid, with a `<Select>` dropdown under
|
|
72
|
+
* `md`. The picker is the subject of the step.
|
|
73
|
+
*
|
|
74
|
+
* `'compact'` — a segmented pill of label-only toggles at every width,
|
|
75
|
+
* keeping every option the track can hold and folding the rest into a
|
|
76
|
+
* "More" menu rather than scrolling. The picker is a control among others.
|
|
77
|
+
*/
|
|
78
|
+
export type TileSelectVariant = 'tiles' | 'compact';
|
|
79
|
+
/**
|
|
80
|
+
* Tile size for `variant="tiles"`.
|
|
81
|
+
*
|
|
82
|
+
* `'md'` (default) — the 80px icon-over-label tile of the payments drop-in.
|
|
83
|
+
*
|
|
84
|
+
* `'sm'` — the 58px tender tile of the Quick Donation / Quick Membership
|
|
85
|
+
* mockups (`.tender-tile`): 17px icon over an 11.5px label, 10px/4px padding,
|
|
86
|
+
* 12px radius, 8px between tiles; the picked tile takes a brand border, a 9%
|
|
87
|
+
* brand tint and brand text. DS tokens only, rem only.
|
|
88
|
+
*/
|
|
89
|
+
export type TileSelectSize = 'md' | 'sm';
|
|
90
|
+
export interface TileSelectProps {
|
|
91
|
+
/** Options to render in order. */
|
|
92
|
+
options: readonly TileSelectOption[];
|
|
93
|
+
/** Currently selected option `key`. `null` = no selection. */
|
|
94
|
+
selectedKey: string | null;
|
|
95
|
+
/** Fires when a tile is selected. */
|
|
96
|
+
onSelect: (key: string) => void;
|
|
97
|
+
/** Optional heading rendered above the grid. */
|
|
98
|
+
heading?: string;
|
|
99
|
+
/**
|
|
100
|
+
* `aria-label` for the wrapping group when `heading` is omitted.
|
|
101
|
+
* Translatable. Default `'Select an option'`. When `heading` is
|
|
102
|
+
* provided this prop is ignored — the grid is labelled by the
|
|
103
|
+
* heading element.
|
|
104
|
+
*/
|
|
105
|
+
ariaLabel?: string;
|
|
106
|
+
/**
|
|
107
|
+
* How the options render. Default `'tiles'`.
|
|
108
|
+
* See {@link TileSelectVariant}.
|
|
109
|
+
*/
|
|
110
|
+
variant?: TileSelectVariant;
|
|
111
|
+
/**
|
|
112
|
+
* `variant="compact"` only: a CAP on how many options stay on the pill.
|
|
113
|
+
* Unset by default, and normally best left that way — the pill already
|
|
114
|
+
* measures the track and keeps every option that fits, folding only
|
|
115
|
+
* what is left over. Set it when a surface wants a shorter row than
|
|
116
|
+
* its width allows.
|
|
117
|
+
*
|
|
118
|
+
* The cap gives way in one case: when honouring it would leave a single
|
|
119
|
+
* option in the menu that the track had room for. A "More" button is
|
|
120
|
+
* wider than most labels, so that fold costs space and buys a click.
|
|
121
|
+
*/
|
|
122
|
+
maxVisible?: number;
|
|
123
|
+
/**
|
|
124
|
+
* `variant="compact"` only: label for the overflow trigger. Shown
|
|
125
|
+
* until an option inside the menu is selected, after which the
|
|
126
|
+
* trigger carries that option's label. Translatable. Default `'More'`.
|
|
127
|
+
*/
|
|
128
|
+
moreLabel?: string;
|
|
129
|
+
/**
|
|
130
|
+
* Grid columns on >= sm. Default `3`. Mobile collapses to 2.
|
|
131
|
+
* `5` and `6` keep a full method set on one row on a wide surface.
|
|
132
|
+
* Ignored by `variant="compact"`, which is a single strip.
|
|
133
|
+
*/
|
|
134
|
+
columnsDesktop?: 2 | 3 | 4 | 5 | 6;
|
|
135
|
+
columnsMobile?: 1 | 2;
|
|
136
|
+
/** `variant="tiles"` only. See {@link TileSelectSize}. Default `'md'`. */
|
|
137
|
+
size?: TileSelectSize;
|
|
138
|
+
className?: string;
|
|
139
|
+
'data-testid'?: string;
|
|
140
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { JSX } from 'react';
|
|
2
|
+
import { StepPagerProps } from './types';
|
|
3
|
+
export declare function StepPager({ steps, currentStep, onStepChange, progressLabel, nextLabel, previousLabel, finalActionLabel, onFinalAction, isFinalActionDisabled, className, 'data-testid': dataTestId, previousTestId, nextTestId, finalActionTestId, }: StepPagerProps): JSX.Element;
|
|
4
|
+
export declare namespace StepPager {
|
|
5
|
+
var displayName: string;
|
|
6
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { JSX } from 'react';
|
|
2
|
+
import { StepsReadinessProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* The verdict that sits in `VerticalSteps`' `header`: ready to publish,
|
|
5
|
+
* N things to fix, or already live. Copy comes in as props.
|
|
6
|
+
*
|
|
7
|
+
* `role="status"` on every variant: the count changes while the user edits,
|
|
8
|
+
* and a polite announcement is the right weight for it. `data-ready` is
|
|
9
|
+
* `"true"` for `ready` and `live`, `"false"` for `fix`, so a test can wait on
|
|
10
|
+
* it without reading copy.
|
|
11
|
+
*/
|
|
12
|
+
export declare function StepsReadiness({ variant, title, description, className, 'data-testid': dataTestId, }: StepsReadinessProps): JSX.Element;
|
|
13
|
+
export declare namespace StepsReadiness {
|
|
14
|
+
var displayName: string;
|
|
15
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { JSX } from 'react';
|
|
2
|
+
import { VerticalStepsProps } from './types';
|
|
3
|
+
export declare function VerticalSteps({ steps, currentStep: currentStepProp, defaultStep, onStepChange, isStepReachable, ariaLabel, statusLabels, header, maxHeight, className, style, 'data-testid': dataTestId, ...rest }: VerticalStepsProps): JSX.Element;
|
|
4
|
+
export declare namespace VerticalSteps {
|
|
5
|
+
var displayName: string;
|
|
6
|
+
}
|