diff --git a/packages/island/src/atoms/button/Button.tsx b/packages/island/src/atoms/button/Button.tsx
index f70c674..f85aaf2 100644
--- a/packages/island/src/atoms/button/Button.tsx
+++ b/packages/island/src/atoms/button/Button.tsx
@@ -25,6 +25,7 @@ export function Button({
frozenAlign,
pressableWhenFrozen = false,
isLoading = false,
+ reloadDocument = false,
className,
children,
...props
@@ -48,6 +49,21 @@ export function Button({
// also drop it from the tab order and lose focus. A button stays focused and announces busy.
if (props.href !== undefined && !isBlocked) {
const linkProps = props as ButtonLinkElementProps;
+ if (reloadDocument) {
+ // A full load needs the native anchor: NextLink would navigate inside the app.
+ return (
+
+ {content}
+
+ );
+ }
return (
` (href and name only) that loads the page afresh instead of the
+ * app's client navigation, for when no router can be trusted, such as after the app crashed.
+ */
+ reloadDocument?: boolean;
children?: ReactNode;
};
diff --git a/packages/island/src/atoms/chip/variants.ts b/packages/island/src/atoms/chip/variants.ts
index d066406..ba358b4 100644
--- a/packages/island/src/atoms/chip/variants.ts
+++ b/packages/island/src/atoms/chip/variants.ts
@@ -15,7 +15,7 @@ export const chipVariants = cva(
},
size: {
sm: 'min-h-control-sm px-3.5 text-body-sm leading-6',
- md: 'min-h-control-md text-[0.9375rem] leading-6',
+ md: 'min-h-control-md text-body-compact leading-6',
},
},
defaultVariants: { selected: false, size: 'md' },
diff --git a/packages/island/src/atoms/select/Select.tsx b/packages/island/src/atoms/select/Select.tsx
index 01b3146..31a2d80 100644
--- a/packages/island/src/atoms/select/Select.tsx
+++ b/packages/island/src/atoms/select/Select.tsx
@@ -54,7 +54,12 @@ export function Select({
{...props}
>
{options.map((option) => (
-
+
{option.label}
))}
diff --git a/packages/island/src/atoms/select/types.ts b/packages/island/src/atoms/select/types.ts
index f4b0647..33c7a96 100644
--- a/packages/island/src/atoms/select/types.ts
+++ b/packages/island/src/atoms/select/types.ts
@@ -2,7 +2,12 @@ import type { ComponentPropsWithRef, ReactNode } from 'react';
import type { IconName } from '../icon';
-export type SelectOption = { value: string; label: ReactNode };
+export type SelectOption = {
+ value: string;
+ label: ReactNode;
+ /** Listed but can't be picked, such as a day before today in a date picker. */
+ disabled?: boolean;
+};
export type SelectProps = Omit, 'children'> & {
/** The visible label above the control, such as «روز». */
diff --git a/packages/island/src/atoms/switch/Switch.tsx b/packages/island/src/atoms/switch/Switch.tsx
index 2ae83bd..c2d5596 100644
--- a/packages/island/src/atoms/switch/Switch.tsx
+++ b/packages/island/src/atoms/switch/Switch.tsx
@@ -11,8 +11,9 @@ import { switchKnobVariants, switchTrackVariants } from './variants';
/**
* An on/off control that applies to a form, such as offering a period or running a promotion. It
- * is a `role="switch"` button in a 44px hit area; with `children` the label is part of it. A locked
- * switch stays focusable and says why elsewhere; a disabled one is never used.
+ * is a `role="switch"` button in a 44px hit area; with `children` the label (DS body-md 600) is
+ * part of it. A locked switch stays focusable and says why elsewhere; only its track dims, as the
+ * DS frozen switch does, so the label stays readable. A disabled one is never used.
*/
export function Switch({
checked,
@@ -46,9 +47,7 @@ export function Switch({
}}
className={cn(
'inline-flex min-h-touch-target min-w-touch-target items-center justify-center gap-3 rounded-md outline-none focus-visible:focus-ring',
- locked
- ? 'cursor-not-allowed opacity-(--opacity-dimmed)'
- : 'cursor-pointer',
+ locked ? 'cursor-not-allowed' : 'cursor-pointer',
hasText && 'justify-between text-start',
className,
)}
@@ -64,7 +63,7 @@ export function Switch({
{children}
@@ -85,7 +84,7 @@ export function Switch({
diff --git a/packages/island/src/atoms/switch/types.ts b/packages/island/src/atoms/switch/types.ts
index c96054d..6acabf4 100644
--- a/packages/island/src/atoms/switch/types.ts
+++ b/packages/island/src/atoms/switch/types.ts
@@ -16,6 +16,9 @@ export type SwitchProps = Omit<
* Read out as the switch's description.
*/
description?: ReactNode;
- /** Can't change now, such as a period during the 7-day lock: 50%, `aria-disabled`, still focusable. */
+ /**
+ * Can't change now, such as a period during the 7-day lock: the track at 40%, `aria-disabled`,
+ * still focusable.
+ */
locked?: boolean;
};
diff --git a/packages/island/src/atoms/switch/variants.ts b/packages/island/src/atoms/switch/variants.ts
index ab183df..6fd761e 100644
--- a/packages/island/src/atoms/switch/variants.ts
+++ b/packages/island/src/atoms/switch/variants.ts
@@ -9,8 +9,10 @@ export const switchTrackVariants = cva(
true: 'border-action-primary bg-action-primary',
false: 'border-border-default bg-surface-sunken',
},
+ /** Can't change now: the track alone at the DS frozen 40%. */
+ locked: { true: 'opacity-(--opacity-frozen)', false: '' },
},
- defaultVariants: { checked: false },
+ defaultVariants: { checked: false, locked: false },
},
);
diff --git a/packages/island/src/index.ts b/packages/island/src/index.ts
index b5d92a2..fc25f3f 100644
--- a/packages/island/src/index.ts
+++ b/packages/island/src/index.ts
@@ -123,6 +123,7 @@ export { AvatarField } from './molecules/avatar-field';
export type {
AvatarFieldLabels,
AvatarFieldProps,
+ AvatarFieldRemoveStyle,
AvatarFieldStatus,
} from './molecules/avatar-field';
export { Banner, bannerVariants } from './molecules/banner';
@@ -162,7 +163,7 @@ export type {
export { FormSection } from './molecules/form-section';
export type { FormSectionProps } from './molecules/form-section';
export { InfoTip, infoTipVariants } from './molecules/info-tip';
-export type { InfoTipProps } from './molecules/info-tip';
+export type { InfoTipPlacement, InfoTipProps } from './molecules/info-tip';
export { KeyValue, keyValueVariants } from './molecules/key-value';
export type { KeyValueProps, KeyValueTone } from './molecules/key-value';
export {
@@ -265,7 +266,11 @@ export type {
SegmentedChoiceTrack,
} from './molecules/segmented-choice';
export { Sheet } from './molecules/sheet';
-export type { SheetPlacement, SheetProps } from './molecules/sheet';
+export type {
+ SheetPlacement,
+ SheetPopoverWidth,
+ SheetProps,
+} from './molecules/sheet';
export { StateMessage, stateMessageVariants } from './molecules/state-message';
export type {
StateMessageProps,
diff --git a/packages/island/src/molecules/avatar-field/AvatarField.tsx b/packages/island/src/molecules/avatar-field/AvatarField.tsx
index 3bb5dd3..218802f 100644
--- a/packages/island/src/molecules/avatar-field/AvatarField.tsx
+++ b/packages/island/src/molecules/avatar-field/AvatarField.tsx
@@ -29,6 +29,8 @@ export function AvatarField({
onRemove,
onRetry,
disabled = false,
+ size = '2xl',
+ removeStyle = 'link',
labels,
className,
}: AvatarFieldProps) {
@@ -51,7 +53,7 @@ export function AvatarField({
)}
- {src && onRemove && status === 'idle' && (
-
- {labels.remove}
-
- )}
+ {src &&
+ onRemove &&
+ status === 'idle' &&
+ (removeStyle === 'ghost' ? (
+
+ ) : (
+
+ {labels.remove}
+
+ ))}
{hasError && (
diff --git a/packages/island/src/molecules/avatar-field/index.ts b/packages/island/src/molecules/avatar-field/index.ts
index 0d0d4af..d140e21 100644
--- a/packages/island/src/molecules/avatar-field/index.ts
+++ b/packages/island/src/molecules/avatar-field/index.ts
@@ -1,6 +1,7 @@
export { AvatarField } from './AvatarField';
export type {
AvatarFieldLabels,
+ AvatarFieldRemoveStyle,
AvatarFieldProps,
AvatarFieldStatus,
} from './types';
diff --git a/packages/island/src/molecules/avatar-field/types.ts b/packages/island/src/molecules/avatar-field/types.ts
index 46b4ea6..6ec6e5f 100644
--- a/packages/island/src/molecules/avatar-field/types.ts
+++ b/packages/island/src/molecules/avatar-field/types.ts
@@ -1,5 +1,10 @@
import type { ReactNode } from 'react';
+import type { AvatarSize } from '../../atoms/avatar';
+
+/** link: «حذف تصویر» as a standalone text link. ghost: a small ghost button (DS J12-2). */
+export type AvatarFieldRemoveStyle = 'link' | 'ghost';
+
/** idle: nothing in flight. uploading: the picked photo is on its way. failed: it didn't arrive. */
export type AvatarFieldStatus = 'idle' | 'uploading' | 'failed';
@@ -38,6 +43,10 @@ export type AvatarFieldProps = {
/** Sends the same file again after a failed upload. */
onRetry?: () => void;
disabled?: boolean;
+ /** The photo's size: 96px (`2xl`, the default), or the DS lg 52px of the account page (J12-2). */
+ size?: AvatarSize;
+ /** How «حذف تصویر» looks: a text link (the default) or a small ghost button (J12-2). */
+ removeStyle?: AvatarFieldRemoveStyle;
labels: AvatarFieldLabels;
className?: string;
};
diff --git a/packages/island/src/molecules/detail-row/DetailRow.tsx b/packages/island/src/molecules/detail-row/DetailRow.tsx
index 4dc042d..185c0ab 100644
--- a/packages/island/src/molecules/detail-row/DetailRow.tsx
+++ b/packages/island/src/molecules/detail-row/DetailRow.tsx
@@ -1,14 +1,24 @@
+import type { ReactNode } from 'react';
+
import { Button } from '../../atoms/button';
import { FlexBox } from '../../atoms/flex-box';
import { Typography } from '../../atoms/typography';
-import { Element } from '../../primitives/element';
import { cn } from '../../tools/cn';
import type { DetailRowProps } from './types';
import { detailRowVariants, detailValueVariants } from './variants';
+/** A string or a number, or a list of only those (`{date} {t('to')} {date}`). */
+function isPlainText(node: ReactNode): boolean {
+ return (
+ typeof node === 'string' ||
+ typeof node === 'number' ||
+ (Array.isArray(node) && node.every(isPlainText))
+ );
+}
+
/**
* One line of a `
` (DS KV), such as a receipt or a payment's detail: the key at the start in
- * 13px secondary, its value at the end on one baseline. Put rows in a KeyValue for the DS group with
+ * 13px secondary, its value at the end on one baseline, text through Typography. Put rows in a KeyValue for the DS group with
* hairlines, or in any `dl`.
*/
export function DetailRow({
@@ -22,6 +32,9 @@ export function DetailRow({
onCopy,
className,
}: DetailRowProps) {
+ // Plain text goes through Typography here; parts (an Amount, a badge) bring their own.
+ const isText = isPlainText(children);
+
return (
{ltr ? (
-
+
{children}
-
+
+ ) : isText ? (
+
+ {children}
+
) : (
children
)}
diff --git a/packages/island/src/molecules/detail-row/variants.ts b/packages/island/src/molecules/detail-row/variants.ts
index 5c1273f..e471485 100644
--- a/packages/island/src/molecules/detail-row/variants.ts
+++ b/packages/island/src/molecules/detail-row/variants.ts
@@ -19,7 +19,7 @@ export const detailRowVariants = cva('min-w-0', {
* (badge, value, copy) sit in one end-aligned row that wraps.
*/
export const detailValueVariants = cva(
- 'm-0 min-w-0 text-end text-[0.9375rem] leading-[1.625rem]',
+ 'm-0 min-w-0 text-end text-body-compact leading-[1.625rem]',
{
variants: {
strong: { true: 'font-semibold', false: 'font-normal' },
diff --git a/packages/island/src/molecules/file-field/FileField.tsx b/packages/island/src/molecules/file-field/FileField.tsx
index 4423428..9258d75 100644
--- a/packages/island/src/molecules/file-field/FileField.tsx
+++ b/packages/island/src/molecules/file-field/FileField.tsx
@@ -173,7 +173,7 @@ export function FileField({
{labels.pick}
diff --git a/packages/island/src/molecules/form-section/FormSection.tsx b/packages/island/src/molecules/form-section/FormSection.tsx
index 9409d40..1c70209 100644
--- a/packages/island/src/molecules/form-section/FormSection.tsx
+++ b/packages/island/src/molecules/form-section/FormSection.tsx
@@ -1,21 +1,30 @@
import { useId } from 'react';
import { FlexBox } from '../../atoms/flex-box';
+import { Icon } from '../../atoms/icon';
import { Typography } from '../../atoms/typography';
import type { FormSectionProps } from './types';
/**
* One titled part of a long form, such as a photo, a set of chips or a list of links: the heading
- * with its optional marker, a hint, then the controls. The section is named by its heading.
+ * with its optional icon and marker, a hint, then the controls. The section is named by its
+ * heading.
*/
export function FormSection({
title,
+ tag = 'h2',
+ titleIcon,
note,
hint,
className,
children,
}: FormSectionProps) {
const titleId = useId();
+ const marker = note != null && (
+
+ {note}
+
+ );
return (
-
- {title}
- {note != null && (
-
- {note}
+ {titleIcon ? (
+
+
+ {title}
- )}
-
+
+ {marker}
+
+ ) : (
+
+ {title}
+ {marker}
+
+ )}
{hint != null && (
{hint}
diff --git a/packages/island/src/molecules/form-section/types.ts b/packages/island/src/molecules/form-section/types.ts
index 55ecdfa..7cec40d 100644
--- a/packages/island/src/molecules/form-section/types.ts
+++ b/packages/island/src/molecules/form-section/types.ts
@@ -1,8 +1,14 @@
import type { ReactNode } from 'react';
+import type { IconName } from '../../atoms/icon';
+
export type FormSectionProps = {
- /** The section's name, a level-2 heading. */
+ /** The section's name, a heading at `tag`'s level. */
title: ReactNode;
+ /** The heading's level: h2 (default), or h3 for a section inside a titled block. */
+ tag?: 'h2' | 'h3';
+ /** A 16px secondary icon after the title, such as `lock` on a private section (J02-4). */
+ titleIcon?: IconName;
/** A quiet marker after the title, such as «(اختیاری)». */
note?: ReactNode;
/** One sentence under the title: what to put here. */
diff --git a/packages/island/src/molecules/info-tip/InfoTip.tsx b/packages/island/src/molecules/info-tip/InfoTip.tsx
index 4f2c73e..a64035c 100644
--- a/packages/island/src/molecules/info-tip/InfoTip.tsx
+++ b/packages/island/src/molecules/info-tip/InfoTip.tsx
@@ -12,9 +12,14 @@ import { infoTipVariants } from './variants';
/**
* An ⓘ that explains the figure beside it. Hover and keyboard focus show the text; a tap toggles
* it, and a tap anywhere else or Escape closes it, because touch has no hover. The button is 44px;
- * the icon 16.
+ * the icon 16. The text opens under the ⓘ, or above it with `placement="above"`.
*/
-export function InfoTip({ label, children, className }: InfoTipProps) {
+export function InfoTip({
+ label,
+ children,
+ placement = 'below',
+ className,
+}: InfoTipProps) {
const [isOpen, setIsOpen] = useState(false);
const tipId = useId();
const rootRef = useRef(null);
@@ -62,7 +67,7 @@ export function InfoTip({ label, children, className }: InfoTipProps) {
role="tooltip"
variant="caption"
color="inverse"
- className={infoTipVariants({ open: isOpen })}
+ className={infoTipVariants({ open: isOpen, placement })}
>
{children}
diff --git a/packages/island/src/molecules/info-tip/index.ts b/packages/island/src/molecules/info-tip/index.ts
index 2ff6d99..81d6d6f 100644
--- a/packages/island/src/molecules/info-tip/index.ts
+++ b/packages/island/src/molecules/info-tip/index.ts
@@ -1,3 +1,3 @@
export { InfoTip } from './InfoTip';
-export type { InfoTipProps } from './types';
+export type { InfoTipPlacement, InfoTipProps } from './types';
export { infoTipVariants } from './variants';
diff --git a/packages/island/src/molecules/info-tip/types.ts b/packages/island/src/molecules/info-tip/types.ts
index 42a9034..299e250 100644
--- a/packages/island/src/molecules/info-tip/types.ts
+++ b/packages/island/src/molecules/info-tip/types.ts
@@ -5,5 +5,9 @@ export type InfoTipProps = {
label: string;
/** What the figure means, one or two sentences. */
children: ReactNode;
+ /** Where the text opens: under the ⓘ (the default), or above it. */
+ placement?: InfoTipPlacement;
className?: string;
};
+
+export type InfoTipPlacement = 'below' | 'above';
diff --git a/packages/island/src/molecules/info-tip/variants.ts b/packages/island/src/molecules/info-tip/variants.ts
index efa7427..1608c39 100644
--- a/packages/island/src/molecules/info-tip/variants.ts
+++ b/packages/island/src/molecules/info-tip/variants.ts
@@ -1,12 +1,17 @@
import { cva } from 'class-variance-authority';
-/** Under the ⓘ, its start on the icon's, on the inverse surface. */
+/** By the ⓘ, its start on the icon's, on the inverse surface: under it, or above it. */
export const infoTipVariants = cva(
- 'pointer-events-none absolute start-0 top-[calc(100%+0.25rem)] z-menu hidden w-max max-w-[16.25rem] rounded-sm bg-surface-inverse px-3 py-1.5 text-start whitespace-normal shadow-2 group-hover:block group-has-[:focus-visible]:block',
+ 'pointer-events-none absolute start-0 z-menu hidden w-max max-w-[16.25rem] rounded-sm bg-surface-inverse px-3 py-1.5 text-start whitespace-normal shadow-2 group-hover:block group-has-[:focus-visible]:block',
{
variants: {
open: { true: 'block', false: '' },
+ /** above: where the tip under the icon would cover the figure it explains (J10-6e). */
+ placement: {
+ below: 'top-[calc(100%+0.25rem)]',
+ above: 'bottom-[calc(100%+0.25rem)]',
+ },
},
- defaultVariants: { open: false },
+ defaultVariants: { open: false, placement: 'below' },
},
);
diff --git a/packages/island/src/molecules/list-row/ListRow.tsx b/packages/island/src/molecules/list-row/ListRow.tsx
index abc1834..28af8dc 100644
--- a/packages/island/src/molecules/list-row/ListRow.tsx
+++ b/packages/island/src/molecules/list-row/ListRow.tsx
@@ -32,6 +32,7 @@ export function ListRow(props: ListRowProps) {
unreadLabel,
dimmed = false,
disabled = false,
+ selected = false,
className,
} = props;
const hasSecondLine = subtitle != null || meta != null || children != null;
@@ -41,6 +42,7 @@ export function ListRow(props: ListRowProps) {
unread,
dimmed,
disabled,
+ selected,
interactive: props.href !== undefined || props.onClick !== undefined,
}),
className,
@@ -48,6 +50,7 @@ export function ListRow(props: ListRowProps) {
const layout = {
alignItems: hasSecondLine ? 'items-start' : 'items-center',
gap: 'gap-3',
+ 'aria-current': selected || undefined,
} as const;
const content = (
@@ -82,7 +85,7 @@ export function ListRow(props: ListRowProps) {
tag="span"
variant="inherit"
color="inherit"
- className="text-[0.9375rem] leading-6 font-semibold"
+ className="text-body-compact leading-6 font-semibold"
>
{title}
diff --git a/packages/island/src/molecules/list-row/types.ts b/packages/island/src/molecules/list-row/types.ts
index b1f37f7..4694b5f 100644
--- a/packages/island/src/molecules/list-row/types.ts
+++ b/packages/island/src/molecules/list-row/types.ts
@@ -53,6 +53,11 @@ type ListRowBaseProps = {
dimmed?: boolean;
/** Can't be opened now: 40%, no pointer, `aria-disabled`; a link row renders no link. */
disabled?: boolean;
+ /**
+ * The current one, such as the row whose details are open in a side panel: the sunken ground
+ * and `aria-current`.
+ */
+ selected?: boolean;
className?: string;
};
diff --git a/packages/island/src/molecules/list-row/variants.ts b/packages/island/src/molecules/list-row/variants.ts
index ff8325d..02eb396 100644
--- a/packages/island/src/molecules/list-row/variants.ts
+++ b/packages/island/src/molecules/list-row/variants.ts
@@ -28,8 +28,8 @@ export const listHeaderVariants = cva(
/**
* One 64px row: lead, text, end column, chevron. Top-aligned when it has a second line, centred
- * when only a title. An unread row is tinted with a dot at its start; a dimmed one fades every child
- * but those marked `data-keep`. As a link or a button the whole row is the hit area, and its focus
+ * when only a title. An unread row is tinted with a dot at its start; a selected one keeps the
+ * sunken ground; a dimmed one fades every child but those marked `data-keep`. As a link or a button the whole row is the hit area, and its focus
* ring sits inside, so the list's rounded clip never cuts it.
*/
export const listRowVariants = cva(
@@ -46,6 +46,8 @@ export const listRowVariants = cva(
false: '',
},
disabled: { true: 'frozen', false: '' },
+ /** The row whose details are open beside the list: the DS hover ground, hovered or not. */
+ selected: { true: 'bg-surface-sunken', false: '' },
},
compoundVariants: [
{
@@ -53,12 +55,18 @@ export const listRowVariants = cva(
interactive: true,
className: 'actionable:hover:bg-action-primary-muted',
},
+ {
+ selected: true,
+ interactive: true,
+ className: 'actionable:hover:bg-surface-sunken',
+ },
],
defaultVariants: {
unread: false,
interactive: false,
dimmed: false,
disabled: false,
+ selected: false,
},
},
);
diff --git a/packages/island/src/molecules/page-header/variants.ts b/packages/island/src/molecules/page-header/variants.ts
index 0ea5dba..b269743 100644
--- a/packages/island/src/molecules/page-header/variants.ts
+++ b/packages/island/src/molecules/page-header/variants.ts
@@ -8,7 +8,7 @@ export const pageHeaderTitleVariants = cva('m-0 min-w-0', {
variants: {
size: {
md: 'text-[1.375rem] leading-9 font-bold',
- sm: 'text-[1.125rem] leading-7.5 font-semibold',
+ sm: 'text-body-lg leading-7.5 font-semibold',
},
},
defaultVariants: { size: 'md' },
diff --git a/packages/island/src/molecules/result-panel/ResultPanel.tsx b/packages/island/src/molecules/result-panel/ResultPanel.tsx
index 36c1c86..1f2fe7d 100644
--- a/packages/island/src/molecules/result-panel/ResultPanel.tsx
+++ b/packages/island/src/molecules/result-panel/ResultPanel.tsx
@@ -58,7 +58,7 @@ export function ResultPanel({
{body}
diff --git a/packages/island/src/molecules/search-field/variants.ts b/packages/island/src/molecules/search-field/variants.ts
index 3c133ec..ed56c66 100644
--- a/packages/island/src/molecules/search-field/variants.ts
+++ b/packages/island/src/molecules/search-field/variants.ts
@@ -7,5 +7,5 @@ export const searchFieldVariants = cva(
/** The bare input inside the pill; the browser's own clear and magnifier are hidden. */
export const searchFieldInputVariants = cva(
- 'h-full min-w-0 flex-1 border-0 bg-transparent p-0 text-[0.9375rem] text-text-primary outline-none placeholder:text-text-tertiary [&::-webkit-search-cancel-button]:appearance-none [&::-webkit-search-decoration]:appearance-none',
+ 'h-full min-w-0 flex-1 border-0 bg-transparent p-0 text-body-compact text-text-primary outline-none placeholder:text-text-tertiary [&::-webkit-search-cancel-button]:appearance-none [&::-webkit-search-decoration]:appearance-none',
);
diff --git a/packages/island/src/molecules/segmented-choice/variants.ts b/packages/island/src/molecules/segmented-choice/variants.ts
index 8c54674..4b642b7 100644
--- a/packages/island/src/molecules/segmented-choice/variants.ts
+++ b/packages/island/src/molecules/segmented-choice/variants.ts
@@ -35,7 +35,7 @@ export const segmentedChoiceOptionVariants = cva(
tone: { brand: '', neutral: '' },
size: {
sm: 'min-h-control-sm px-3.5 text-body-sm leading-6',
- md: 'min-h-10 px-4 text-[0.9375rem] leading-6',
+ md: 'min-h-10 px-4 text-body-compact leading-6',
},
/** Disabled but not frozen: each option dims, as a disabled chip does (C4 ۱.۶). */
disabled: { true: 'frozen', false: '' },
diff --git a/packages/island/src/molecules/sheet/Sheet.tsx b/packages/island/src/molecules/sheet/Sheet.tsx
index 06607be..1df6918 100644
--- a/packages/island/src/molecules/sheet/Sheet.tsx
+++ b/packages/island/src/molecules/sheet/Sheet.tsx
@@ -28,6 +28,7 @@ export function Sheet({
closeLabel,
dismissible = true,
alert,
+ popoverWidth,
className,
}: SheetProps) {
const titleId = useId();
@@ -41,6 +42,7 @@ export function Sheet({
footer={footer}
onClose={onClose}
closeLabel={closeLabel}
+ width={popoverWidth}
className={className}
>
{children}
diff --git a/packages/island/src/molecules/sheet/components/SheetPopover.tsx b/packages/island/src/molecules/sheet/components/SheetPopover.tsx
index c09a0fe..898f68b 100644
--- a/packages/island/src/molecules/sheet/components/SheetPopover.tsx
+++ b/packages/island/src/molecules/sheet/components/SheetPopover.tsx
@@ -9,10 +9,11 @@ import { cn } from '../../../tools/cn';
import { useDismiss } from '../hooks/use-dismiss';
import { useFlip } from '../hooks/use-flip';
import type { SheetPopoverProps } from '../types';
+import { sheetPopoverVariants } from '../variants';
import { SheetHead } from './SheetHead';
/**
- * A desktop popover, 320px, anchored by its caller in a positioned container next to the
+ * A desktop popover, 320px (360px `wide`, the DS SharePopover), anchored by its caller in a positioned container next to the
* trigger. It hangs under the trigger at the inline end, and flips above or to the inline start
* when it would run off the screen. No scrim and not modal: Escape, the ✕ or a press outside
* closes it.
@@ -25,6 +26,7 @@ export function SheetPopover({
footer,
onClose,
closeLabel,
+ width,
className,
}: SheetPopoverProps) {
const ref = useRef(null);
@@ -42,11 +44,7 @@ export function SheetPopover({
ref={ref}
aria-labelledby={titleId}
direction="flex-col"
- className={cn(
- 'absolute start-auto end-0 top-full z-menu m-0 mt-2 w-80 text-text-primary max-w-[calc(100vw-2rem)] rounded-lg border border-border-subtle bg-surface-raised p-4 shadow-2',
- 'data-above:top-auto data-above:bottom-full data-above:mt-0 data-above:mb-2 data-align-start:start-0 data-align-start:end-auto',
- className,
- )}
+ className={cn(sheetPopoverVariants({ width }), className)}
>
{icon && {icon}}
;
+ 'placement' | 'dismissible' | 'alert' | 'onExited' | 'popoverWidth'
+> & {
+ width?: SheetPopoverWidth;
+};
diff --git a/packages/island/src/molecules/sheet/variants.ts b/packages/island/src/molecules/sheet/variants.ts
index 4e8679f..1054b07 100644
--- a/packages/island/src/molecules/sheet/variants.ts
+++ b/packages/island/src/molecules/sheet/variants.ts
@@ -24,3 +24,14 @@ export const sheetPanelVariants = cva(
},
},
);
+
+/** The popover's width: 320px for support and notes, 360px for the DS SharePopover. */
+export const sheetPopoverVariants = cva(
+ 'absolute start-auto end-0 top-full z-menu m-0 mt-2 max-w-[calc(100vw-2rem)] rounded-lg border border-border-subtle bg-surface-raised p-4 text-text-primary shadow-2 data-above:top-auto data-above:bottom-full data-above:mt-0 data-above:mb-2 data-align-start:start-0 data-align-start:end-auto',
+ {
+ variants: {
+ width: { default: 'w-80', wide: 'w-90' },
+ },
+ defaultVariants: { width: 'default' },
+ },
+);
diff --git a/packages/island/src/molecules/stat-tile/variants.ts b/packages/island/src/molecules/stat-tile/variants.ts
index f3aa5f6..dab9421 100644
--- a/packages/island/src/molecules/stat-tile/variants.ts
+++ b/packages/island/src/molecules/stat-tile/variants.ts
@@ -12,7 +12,7 @@ export const statTileVariants = cva('min-w-0 rounded-lg border p-4', {
});
/** The figure, 24/36/700, in a status hue when it carries one. */
-export const statTileValueVariants = cva('text-[1.5rem] leading-9 font-bold', {
+export const statTileValueVariants = cva('text-stat', {
variants: {
valueTone: {
default: 'text-text-primary',
diff --git a/packages/island/src/molecules/tab-links/TabLinks.tsx b/packages/island/src/molecules/tab-links/TabLinks.tsx
index a007e26..b3e729f 100644
--- a/packages/island/src/molecules/tab-links/TabLinks.tsx
+++ b/packages/island/src/molecules/tab-links/TabLinks.tsx
@@ -11,13 +11,16 @@ import { tabLinksVariants, tabLinkVariants } from './variants';
* «اشتراکها» · «تراکنشها» · «دنبالشدهها» (U2; U8 ۴.۱, ۶.۱; U8 ۵.۲: the 48px row, not a pill
* row). Mobile sets `band` under the top bar; desktop sits it in the column. Plain links in a named
* nav, so Tab walks them and Enter follows one; no state, so it renders on the server, and its
- * place stays put while a tab's content loads.
+ * place stays put while a tab's content loads. Tabs that filter one page (`?ledger=payouts`) pass
+ * `replace` and `scroll={false}`, so a tab neither adds history nor jumps to the top.
*/
export function TabLinks({
items,
label,
fill = false,
band,
+ replace,
+ scroll,
className,
}: TabLinksProps) {
return (
@@ -32,6 +35,8 @@ export function TabLinks({
key={item.href}
tag={NextLink}
href={item.href}
+ replace={replace}
+ scroll={scroll}
aria-current={item.isActive ? 'page' : undefined}
display="inline-flex"
alignItems="items-center"
diff --git a/packages/island/src/molecules/tab-links/types.ts b/packages/island/src/molecules/tab-links/types.ts
index 5cbb217..9acd046 100644
--- a/packages/island/src/molecules/tab-links/types.ts
+++ b/packages/island/src/molecules/tab-links/types.ts
@@ -21,5 +21,12 @@ export type TabLinksProps = VariantProps & {
* label, as a short filter row does.
*/
fill?: boolean;
+ /**
+ * The tabs filter the page they sit on rather than open another section: a tab replaces the
+ * history entry instead of adding one.
+ */
+ replace?: boolean;
+ /** false: a tab keeps the page's scroll instead of going to the top. */
+ scroll?: boolean;
className?: string;
};
diff --git a/packages/island/src/molecules/tab-links/variants.ts b/packages/island/src/molecules/tab-links/variants.ts
index ecc168e..113c849 100644
--- a/packages/island/src/molecules/tab-links/variants.ts
+++ b/packages/island/src/molecules/tab-links/variants.ts
@@ -13,7 +13,7 @@ export const tabLinksVariants = cva('min-w-0 border-b border-border-subtle', {
* and the underline; the others are secondary and darken under the pointer.
*/
export const tabLinkVariants = cva(
- '-mb-px h-12 cursor-pointer border-b-2 px-4 text-[0.9375rem] leading-6 font-semibold whitespace-nowrap no-underline transition-colors duration-120 ease-standard focus-visible:focus-ring',
+ '-mb-px h-12 cursor-pointer border-b-2 px-4 text-body-compact leading-6 font-semibold whitespace-nowrap no-underline transition-colors duration-120 ease-standard focus-visible:focus-ring',
{
variants: {
active: {
diff --git a/packages/island/src/molecules/text-input/types.ts b/packages/island/src/molecules/text-input/types.ts
index e83d80e..a68eed0 100644
--- a/packages/island/src/molecules/text-input/types.ts
+++ b/packages/island/src/molecules/text-input/types.ts
@@ -11,7 +11,10 @@ export type TextInputProps = Omit<
error?: ReactNode;
/** A positive live check, such as «نام کاربری آزاد است». */
success?: ReactNode;
- /** `ltr` for شبا, URLs, usernames, tickers and codes. */
+ /**
+ * `ltr` for شبا, URLs, usernames, tickers and codes: direction and alignment only. A شبا or bank
+ * code also passes `inputClassName="font-latin"` (0011).
+ */
dir?: 'rtl' | 'ltr';
/** A fixed affix inside the field, such as `IR` for شبا. */
prefix?: ReactNode;
diff --git a/packages/island/src/molecules/text-input/variants.ts b/packages/island/src/molecules/text-input/variants.ts
index 664e304..04b3213 100644
--- a/packages/island/src/molecules/text-input/variants.ts
+++ b/packages/island/src/molecules/text-input/variants.ts
@@ -38,8 +38,11 @@ export const textInputControlVariants = cva(
variants: {
multiline: { true: 'min-h-24 resize-y', false: '' },
locked: { true: 'text-text-secondary', false: '' },
- /** شبا, URLs, usernames, tickers and codes, in Latin digits as banks print them. */
- ltr: { true: 'text-left font-latin tracking-[0.02em]', false: '' },
+ /**
+ * URLs, usernames, tickers and codes, left to right. The font stays Yekan Bakh FaNum: only
+ * شبا and bank codes take the Latin face, through the caller's `inputClassName` (0011).
+ */
+ ltr: { true: 'text-left tracking-[0.02em]', false: '' },
},
defaultVariants: { multiline: false, locked: false, ltr: false },
},
diff --git a/packages/island/src/organisms/post-card/PostCard.tsx b/packages/island/src/organisms/post-card/PostCard.tsx
index db3df91..4bd96cb 100644
--- a/packages/island/src/organisms/post-card/PostCard.tsx
+++ b/packages/island/src/organisms/post-card/PostCard.tsx
@@ -16,7 +16,7 @@ import type { PostCardProps } from './types';
* for the shared LockedTeaser, so locking never changes the feed's rhythm.
*
* Server-renderable: only a multi-image carousel, a frozen edit's tooltip and the desktop share
- * menu are client parts. The handlers (`owner`, `onShare`, `onCopyLink`, `onImageClick`, `onCta`)
+ * popover are client parts. The handlers (`owner`, `onShare`, `onCopyLink`, `onImageClick`, `onCta`)
* need a client caller; a server render passes `href`, `channelHref` and `ctaHref` links instead.
*/
export function PostCard(props: PostCardProps) {
@@ -35,6 +35,7 @@ export function PostCard(props: PostCardProps) {
owner,
onShare,
onCopyLink,
+ shareUrl,
accessNote,
labels,
className,
@@ -104,6 +105,7 @@ export function PostCard(props: PostCardProps) {
owner={owner}
onShare={onShare}
onCopyLink={onCopyLink}
+ shareUrl={shareUrl}
premium={premium}
isPrediction={props.prediction != null}
labels={labels}
diff --git a/packages/island/src/organisms/post-card/components/PostActions.tsx b/packages/island/src/organisms/post-card/components/PostActions.tsx
index ce7b578..013a610 100644
--- a/packages/island/src/organisms/post-card/components/PostActions.tsx
+++ b/packages/island/src/organisms/post-card/components/PostActions.tsx
@@ -3,33 +3,34 @@ import { FlexBox } from '../../../atoms/flex-box';
import { cn } from '../../../tools/cn';
import { ABOVE_LINK_CLASS } from '../constants';
import type { PostActionsProps } from '../types';
-import { PostShareMenu } from './PostShareMenu';
+import { PostSharePopover } from './PostSharePopover';
/**
* Ghost icon buttons at the inline end. Everyone else: share. The creator: preview (premium),
* share, edit (frozen after 15 minutes) and delete; a prediction post keeps only preview and
* share, because predictions can't be edited or deleted. With a copy handler, share opens the
- * desktop menu (C4b ۳.۴, ۶.۱); while it is open the footer rises over the cards after it, which
- * would otherwise paint over the menu hanging below.
+ * desktop share popover (C4b ۳.۴, ۶.۱); while it is open the footer rises over the cards after it,
+ * which would otherwise paint over the popover hanging below.
*/
export function PostActions({
owner,
onShare,
onCopyLink,
+ shareUrl,
premium,
isPrediction,
labels,
}: PostActionsProps) {
const share = owner?.onShare ?? onShare;
const copy = owner?.onCopyLink ?? onCopyLink;
- const { copyLink } = labels;
- const hasMenu = copy != null && copyLink != null;
+ const { copyLink, close } = labels;
+ const hasPopover = copy != null && copyLink != null && close != null;
const preview = premium ? owner?.onPreview : undefined;
const mutable = owner != null && !isPrediction;
const canEdit = mutable && (owner.onEdit != null || owner.editFrozen);
const canDelete = mutable && owner.onDelete != null;
- if (!share && !hasMenu && !preview && !canEdit && !canDelete) return null;
+ if (!share && !hasPopover && !preview && !canEdit && !canDelete) return null;
return (
{preview && (
@@ -50,11 +51,14 @@ export function PostActions({
onClick={preview}
/>
)}
- {copy && copyLink != null ? (
-
) : (
share && (
diff --git a/packages/island/src/organisms/post-card/components/PostShareMenu.tsx b/packages/island/src/organisms/post-card/components/PostShareMenu.tsx
deleted file mode 100644
index 95f9e03..0000000
--- a/packages/island/src/organisms/post-card/components/PostShareMenu.tsx
+++ /dev/null
@@ -1,42 +0,0 @@
-'use client';
-
-import { useState } from 'react';
-
-import { Button } from '../../../atoms/button';
-import { FlexBox } from '../../../atoms/flex-box';
-import { ActionMenu } from '../../../molecules/action-menu';
-import type { PostShareMenuProps } from '../types';
-
-/**
- * Desktop share (C4b ۳.۴, ۶.۱): there is no OS share sheet, so the share button opens a menu
- * under it at its inline end with one item, «کپی لینک». The copy closes the menu; the caller
- * confirms it with a toast. The wrapper holds only the trigger and the menu, the area the menu
- * treats as inside.
- */
-export function PostShareMenu({
- onCopyLink,
- label,
- copyLinkLabel,
-}: PostShareMenuProps) {
- const [isOpen, setIsOpen] = useState(false);
-
- return (
-
-
- );
-}
diff --git a/packages/island/src/organisms/post-card/components/PostSharePopover.tsx b/packages/island/src/organisms/post-card/components/PostSharePopover.tsx
new file mode 100644
index 0000000..6238c67
--- /dev/null
+++ b/packages/island/src/organisms/post-card/components/PostSharePopover.tsx
@@ -0,0 +1,72 @@
+'use client';
+
+import { useState } from 'react';
+
+import { Button } from '../../../atoms/button';
+import { FlexBox } from '../../../atoms/flex-box';
+import { Typography } from '../../../atoms/typography';
+import { Sheet } from '../../../molecules/sheet';
+import type { PostSharePopoverProps } from '../types';
+
+/**
+ * Desktop share (DS SharePopover, J05-5c, J08-4g): there is no OS share sheet, so the share button
+ * opens a 360px popover under it at its inline end: «اشتراکگذاری پست» with ✕, the post's link
+ * (LTR) and «کپی لینک». The copy closes it; the caller confirms it with a toast. The wrapper holds
+ * only the trigger and the popover, the area the popover treats as inside.
+ */
+export function PostSharePopover({
+ onCopyLink,
+ label,
+ title,
+ copyLinkLabel,
+ closeLabel,
+ url,
+}: PostSharePopoverProps) {
+ const [isOpen, setIsOpen] = useState(false);
+
+ return (
+
+
+ );
+}
diff --git a/packages/island/src/organisms/post-card/types.ts b/packages/island/src/organisms/post-card/types.ts
index c6f99a6..2693cf8 100644
--- a/packages/island/src/organisms/post-card/types.ts
+++ b/packages/island/src/organisms/post-card/types.ts
@@ -29,7 +29,7 @@ export type PostViewer = 'pending' | 'guest' | 'member';
*/
export type PostCardOwner = {
onShare?: () => void;
- /** Desktop (C4b ۶.۱): share opens a menu with «کپی لینک» instead of calling `onShare`. */
+ /** Desktop (C4b ۶.۱): share opens the share popover with «کپی لینک» instead of calling `onShare`. */
onCopyLink?: () => void;
/** Never shown on a prediction post: predictions are immutable. */
onEdit?: () => void;
@@ -75,10 +75,12 @@ export type PostCardLabels = {
nextImage?: string;
/** A locked post's image count, from 2 images: `(n) => <>{n} تصویر>` → «۳ تصویر». */
imageCount: (count: string) => ReactNode;
- /** «اشتراکگذاری». */
+ /** The share button's name and the desktop popover's title, «اشتراکگذاری پست». */
share: string;
- /** «کپی لینک», the desktop share menu's one item. Required with `onCopyLink`. */
+ /** «کپی لینک», the desktop share popover's button. Required with `onCopyLink`. */
copyLink?: string;
+ /** The desktop share popover's ✕, «بستن». Required with `onCopyLink`. */
+ close?: string;
/** The creator's own footer. */
owner: {
/** «مشاهده به عنوان کاربر». */
@@ -141,10 +143,15 @@ type PostCardBaseProps = {
/** Everyone else: a share-only footer. Client callers only. */
onShare?: () => void;
/**
- * Desktop, everyone else (C4b ۳.۴): share opens a menu with «کپی لینک» under it instead of
- * calling `onShare`. Confirm the copy with a toast. Client callers only.
+ * Desktop, everyone else (C4b ۳.۴): share opens the share popover with «کپی لینک» under it
+ * instead of calling `onShare`. Confirm the copy with a toast. Client callers only.
*/
onCopyLink?: () => void;
+ /**
+ * The post's link as the desktop share popover shows it, without the scheme:
+ * `lumina.ir/@sara_gold/posts/1042`. Read in the browser; only an open popover shows it.
+ */
+ shareUrl?: string;
/**
* An open post: how the viewer has it, «دسترسی از طریق اشتراک سالانه» (Post--unlocked), with a
* check under a hairline at the end of the body. A locked post ignores it.
@@ -255,19 +262,25 @@ export type PostLockedProps = Pick<
export type PostActionsProps = Pick<
PostCardBaseProps,
- 'owner' | 'onShare' | 'onCopyLink' | 'labels'
+ 'owner' | 'onShare' | 'onCopyLink' | 'shareUrl' | 'labels'
> & {
premium: boolean;
/** Predictions are immutable: no edit or delete. */
isPrediction: boolean;
};
-export type PostShareMenuProps = {
+export type PostSharePopoverProps = {
onCopyLink: () => void;
- /** The share button's and the menu's accessible name, «اشتراکگذاری». */
+ /** The share button's accessible name, «اشتراکگذاری پست». */
label: string;
+ /** The popover's title, «اشتراکگذاری پست». */
+ title: string;
/** «کپی لینک». */
copyLinkLabel: string;
+ /** The ✕'s accessible name, «بستن». */
+ closeLabel: string;
+ /** The link, shown LTR under the title. */
+ url?: string;
};
export type PostAccessProps = Pick & {
diff --git a/packages/island/src/organisms/prediction-card/PredictionCard.tsx b/packages/island/src/organisms/prediction-card/PredictionCard.tsx
index 974368e..071effb 100644
--- a/packages/island/src/organisms/prediction-card/PredictionCard.tsx
+++ b/packages/island/src/organisms/prediction-card/PredictionCard.tsx
@@ -5,6 +5,7 @@ import { cn } from '../../tools/cn';
import { LockedBody } from './components/LockedBody';
import { PredictionBody } from './components/PredictionBody';
import { PredictionSeal } from './components/PredictionSeal';
+import { LINKED_CARD_CLASS } from './constants';
import type { PredictionCardProps } from './types';
import { resolveStatus } from './utils';
import { predictionCardVariants } from './variants';
@@ -14,6 +15,7 @@ import { predictionCardVariants } from './variants';
* signed ROI) or what is at stake (open: to target, to stop, risk to reward), the range bar shows
* where it stands between stop loss and final target, and the levels give the exact prices. The
* seal with the publish time closes every card, locked ones too, because it is the trust signal.
+ * With `href` the card opens its post: the title is the link, stretched over the card.
* Server-renderable: only the owner's close button needs a client caller for its handler.
*/
export function PredictionCard(props: PredictionCardProps) {
@@ -22,6 +24,7 @@ export function PredictionCard(props: PredictionCardProps) {
embedded = false,
premium = false,
caption,
+ href,
publishedAt,
now,
onClosePrediction,
@@ -45,18 +48,24 @@ export function PredictionCard(props: PredictionCardProps) {
{props.locked ? (
) : (
diff --git a/packages/island/src/organisms/prediction-card/components/PredictionBody.tsx b/packages/island/src/organisms/prediction-card/components/PredictionBody.tsx
index 249e476..e1d1386 100644
--- a/packages/island/src/organisms/prediction-card/components/PredictionBody.tsx
+++ b/packages/island/src/organisms/prediction-card/components/PredictionBody.tsx
@@ -20,6 +20,7 @@ import { PredictionRange } from './PredictionRange';
/** Header, hero, range bar, then the levels (compact) or the ladder, progress and caption (expanded). */
export function PredictionBody({
prediction: data,
+ href,
expanded,
premium,
caption,
@@ -39,6 +40,7 @@ export function PredictionBody({
return (
<>
-
- {title}
-
+ {href ? (
+
+ {title}
+
+ ) : (
+
+ {title}
+
+ )}
{meta}
{badges}
diff --git a/packages/island/src/organisms/prediction-card/constants.ts b/packages/island/src/organisms/prediction-card/constants.ts
index 23af822..acf78d9 100644
--- a/packages/island/src/organisms/prediction-card/constants.ts
+++ b/packages/island/src/organisms/prediction-card/constants.ts
@@ -8,6 +8,14 @@ import type {
PredictionTrend,
} from './types';
+/** With `href`, the title is the post's link and its hit area covers the card; the card draws the ring. */
+export const STRETCHED_LINK_CLASS =
+ 'rounded-xs no-underline outline-none after:absolute after:inset-0 after:rounded-lg';
+
+/** A card with a post link: the hover border and, from the link's keyboard focus, the ring. */
+export const LINKED_CARD_CLASS =
+ 'transition-[border-color,box-shadow] duration-120 ease-standard hover:border-border-strong has-[[data-prediction-link]:focus-visible]:focus-ring';
+
/** ±0.05% from entry is breakeven: flat colour, flat arrow. */
export const BREAKEVEN_BAND = 0.05;
/** Float slack when a close lands exactly on a level. */
diff --git a/packages/island/src/organisms/prediction-card/types.ts b/packages/island/src/organisms/prediction-card/types.ts
index a9d912d..a745d81 100644
--- a/packages/island/src/organisms/prediction-card/types.ts
+++ b/packages/island/src/organisms/prediction-card/types.ts
@@ -184,6 +184,12 @@ type PredictionCardOwnProps = {
premium?: boolean;
/** The creator's rationale, expanded only, in a sunken box after the levels. */
caption?: ReactNode;
+ /**
+ * The prediction's post, as the DS card links to it: the title becomes the link and its hit area
+ * stretches over the card; «بستن زودهنگام» keeps its own tap. Never inside a PostCard, whose own
+ * link already covers it.
+ */
+ href?: string;
/** The trust signal: the seal always shows it, with the time. */
publishedAt: DateInput;
/** The time the time left and the horizon progress count from. Pass it from the server render. */
@@ -263,6 +269,8 @@ export type PredictionHeadProps = {
title: ReactNode;
meta: ReactNode;
badges: ReactNode;
+ /** The post: the title row becomes its stretched link. */
+ href?: string;
};
export type PredictionBadgesProps = {
@@ -346,6 +354,7 @@ export type LadderRow = {
export type LockedBodyProps = {
prediction?: Partial;
+ href?: string;
/** Already false when embedded. */
premium: boolean;
labels: PredictionCardLabels;
@@ -353,6 +362,7 @@ export type LockedBodyProps = {
export type PredictionBodyProps = {
prediction: PredictionData;
+ href?: string;
expanded: boolean;
/** Already false when embedded. */
premium: boolean;
diff --git a/packages/island/src/organisms/subscription-card/components/SubscriptionRow.tsx b/packages/island/src/organisms/subscription-card/components/SubscriptionRow.tsx
index 22beecb..2c6cb57 100644
--- a/packages/island/src/organisms/subscription-card/components/SubscriptionRow.tsx
+++ b/packages/island/src/organisms/subscription-card/components/SubscriptionRow.tsx
@@ -9,7 +9,7 @@ export function SubscriptionRow({ label, children }: SubscriptionRowProps) {
alignItems="items-baseline"
justifyContent="justify-between"
gap="gap-3"
- className="py-1.5 text-[0.9375rem] leading-6.5"
+ className="py-1.5 text-body-compact leading-6.5"
>
{label}
diff --git a/packages/island/src/styles/theme.css b/packages/island/src/styles/theme.css
index 95a4a83..e808ad9 100644
--- a/packages/island/src/styles/theme.css
+++ b/packages/island/src/styles/theme.css
@@ -50,6 +50,15 @@
--text-micro: 0.6875rem;
--text-micro--line-height: 1.125rem;
--text-micro--font-weight: 500;
+ /* The v6 compositions' 15px step, between body-sm and body-md: list-row titles, tabs, chips,
+ key–value values, the header nav. Callers set their own leading and weight where they differ. */
+ --text-body-compact: 0.9375rem;
+ --text-body-compact--line-height: 1.5rem;
+ --text-body-compact--font-weight: 400;
+ /* A StatTile's figure (DS 24/36/700), one step under display. */
+ --text-stat: 1.5rem;
+ --text-stat--line-height: 2.25rem;
+ --text-stat--font-weight: 700;
/* The landing's own display type (/), a step above `display`: its h1 and its section titles.
Typography's `hero` and `section` variants step them up at the tablet and desktop widths. */
--text-hero: 1.75rem;
diff --git a/packages/island/src/tools/cn/constants.ts b/packages/island/src/tools/cn/constants.ts
index 847ab2d..face7c3 100644
--- a/packages/island/src/tools/cn/constants.ts
+++ b/packages/island/src/tools/cn/constants.ts
@@ -10,6 +10,8 @@ export const TEXT_SIZES = [
'label',
'caption',
'micro',
+ 'body-compact',
+ 'stat',
'hero',
'hero-md',
'hero-lg',
diff --git a/packages/tools/src/format/format.ts b/packages/tools/src/format/format.ts
index eb03843..68da6d9 100644
--- a/packages/tools/src/format/format.ts
+++ b/packages/tools/src/format/format.ts
@@ -40,6 +40,10 @@ const timeFormatter = new Intl.DateTimeFormat(LOCALE, {
const relativeFormatter = new Intl.RelativeTimeFormat(LOCALE, {
numeric: 'auto',
});
+const listFormatter = new Intl.ListFormat(LOCALE, {
+ type: 'conjunction',
+ style: 'narrow',
+});
const numberFormatters = new Map();
const unitFormatters = new Map();
@@ -103,6 +107,11 @@ function sign(value: number, decimals: number): string {
return value > 0 ? '+' : MINUS_SIGN;
}
+/** `طلا، فارکس، کریپتو`: items joined with the Persian comma, as the locale lists them. */
+export function list(items: readonly string[]): string {
+ return listFormatter.format(items);
+}
+
/** `1234567.8` → `1٬234٬567٫8`. The font draws the digits in Persian. */
export function number(value: number, decimals = 0): string {
const digits = persianSeparators(
diff --git a/packages/tools/src/format/index.ts b/packages/tools/src/format/index.ts
index 925ac3b..12751bf 100644
--- a/packages/tools/src/format/index.ts
+++ b/packages/tools/src/format/index.ts
@@ -5,6 +5,7 @@ export {
horizon,
iso,
latinDigits,
+ list,
number,
percent,
price,
diff --git a/packages/tools/src/index.ts b/packages/tools/src/index.ts
index da587a9..b27220d 100644
--- a/packages/tools/src/index.ts
+++ b/packages/tools/src/index.ts
@@ -5,6 +5,7 @@ export {
horizon,
iso,
latinDigits,
+ list,
LOCALE,
number,
percent,