@breathe-ds/ui 0.6.0 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -101,7 +101,13 @@ export function ContactRow({ name, nameDisplay, meta, actions, defaultOpen = fal
|
|
|
101
101
|
* the group, rows separated by a hairline that starts at the name (after the
|
|
102
102
|
* 40px avatar + its padding: 70px, 74px from md), drawn as a ::before so the
|
|
103
103
|
* row itself never moves. */
|
|
104
|
-
export function ContactList({ children, className = "" }: { children: ReactNode; className?: string }) {
|
|
104
|
+
export function ContactList({ children, inset = true, className = "" }: { children: ReactNode; /** false: hairline from the edge (rows without an avatar, e.g. PublicationRow). */ inset?: boolean; className?: string }) {
|
|
105
|
+
if (!inset)
|
|
106
|
+
return (
|
|
107
|
+
<ul className={`m-0 list-none overflow-hidden rounded-[22px] bg-card p-0 [&>li+li]:border-t [&>li+li]:border-line ${className}`}>
|
|
108
|
+
{children}
|
|
109
|
+
</ul>
|
|
110
|
+
);
|
|
105
111
|
return (
|
|
106
112
|
<ul
|
|
107
113
|
className={`m-0 list-none overflow-hidden rounded-[22px] bg-card p-0 [&>li+li]:before:absolute [&>li+li]:before:top-0 [&>li+li]:before:right-0 [&>li+li]:before:left-[4.375rem] [&>li+li]:before:h-px [&>li+li]:before:bg-line [&>li+li]:before:content-[''] md:[&>li+li]:before:left-[4.625rem] ${className}`}
|
|
@@ -213,3 +213,97 @@ export function PublicationCard({
|
|
|
213
213
|
</article>
|
|
214
214
|
);
|
|
215
215
|
}
|
|
216
|
+
|
|
217
|
+
type RowProps = {
|
|
218
|
+
title: string;
|
|
219
|
+
/** Title as rendered (e.g. with the search match marked). */
|
|
220
|
+
titleDisplay?: ReactNode;
|
|
221
|
+
lang?: string;
|
|
222
|
+
/** One quiet line under the title: "Ensaio clínico randomizado · Pastor-Pons e mais 6". */
|
|
223
|
+
meta?: ReactNode;
|
|
224
|
+
abstract?: string[];
|
|
225
|
+
abstractLang?: string;
|
|
226
|
+
/** The publication's page. */
|
|
227
|
+
href?: string;
|
|
228
|
+
pdf?: string;
|
|
229
|
+
defaultOpen?: boolean;
|
|
230
|
+
headingLevel?: "h2" | "h3";
|
|
231
|
+
linkComponent?: ElementType;
|
|
232
|
+
labels?: Partial<PublicationCardLabels>;
|
|
233
|
+
className?: string;
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* PublicationRow — a study in a long library, as a row of a ContactList
|
|
238
|
+
* (the same white inset-grouped list as the professionals directory): the
|
|
239
|
+
* list shows only the title and one quiet line (type · first author); tapping
|
|
240
|
+
* opens the abstract and two plain-text links, "read the article" and the PDF.
|
|
241
|
+
* The list of 16 big cards was a wall; this is a list of titles.
|
|
242
|
+
*/
|
|
243
|
+
export function PublicationRow({
|
|
244
|
+
title,
|
|
245
|
+
titleDisplay,
|
|
246
|
+
lang,
|
|
247
|
+
meta,
|
|
248
|
+
abstract,
|
|
249
|
+
abstractLang,
|
|
250
|
+
href,
|
|
251
|
+
pdf,
|
|
252
|
+
defaultOpen = false,
|
|
253
|
+
headingLevel: H = "h2",
|
|
254
|
+
linkComponent,
|
|
255
|
+
labels,
|
|
256
|
+
className = "",
|
|
257
|
+
}: RowProps) {
|
|
258
|
+
const t = { ...EN, ...labels };
|
|
259
|
+
const L: ElementType = linkComponent ?? "a";
|
|
260
|
+
const [open, setOpen] = useState(defaultOpen);
|
|
261
|
+
const panel = useId();
|
|
262
|
+
const LINK =
|
|
263
|
+
"group/act inline-flex min-h-11 items-center gap-2 rounded-[2px] text-[0.9375rem] font-semibold text-ink underline decoration-transparent decoration-[1.5px] underline-offset-4 transition-[text-decoration-color] duration-150 hover:decoration-ink focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ink motion-reduce:transition-none";
|
|
264
|
+
return (
|
|
265
|
+
<li className={`relative list-none ${className}`}>
|
|
266
|
+
<H className="m-0 font-normal">
|
|
267
|
+
<button
|
|
268
|
+
type="button"
|
|
269
|
+
aria-expanded={open}
|
|
270
|
+
aria-controls={panel}
|
|
271
|
+
onClick={() => setOpen((v) => !v)}
|
|
272
|
+
className="group/row flex min-h-16 w-full items-center gap-4 px-5 py-3.5 text-left transition-colors duration-150 active:bg-tint/50 focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ink motion-reduce:transition-none md:px-6"
|
|
273
|
+
>
|
|
274
|
+
<span className="min-w-0 flex-1">
|
|
275
|
+
<span lang={lang} className="line-clamp-3 block font-heading text-[1.0625rem] leading-snug font-medium text-pretty text-ink">
|
|
276
|
+
{titleDisplay ?? title}
|
|
277
|
+
</span>
|
|
278
|
+
{meta && <span className="mt-1 block text-sm text-ink-soft">{meta}</span>}
|
|
279
|
+
</span>
|
|
280
|
+
<ChevronDown
|
|
281
|
+
aria-hidden="true"
|
|
282
|
+
size={18}
|
|
283
|
+
className={`shrink-0 text-ink-soft transition-transform duration-200 motion-reduce:transition-none ${open ? "rotate-180" : "group-hover/row:translate-y-0.5"}`}
|
|
284
|
+
/>
|
|
285
|
+
</button>
|
|
286
|
+
</H>
|
|
287
|
+
<div id={panel} hidden={!open} className={`${FADE_IN} px-5 pb-5 md:px-6`}>
|
|
288
|
+
{abstract && abstract.length > 0 && <AbstractText paragraphs={abstract} lang={abstractLang ?? lang} className="text-[0.9375rem]" />}
|
|
289
|
+
{(href || pdf) && (
|
|
290
|
+
<div className="mt-3 flex flex-wrap gap-x-6">
|
|
291
|
+
{href && (
|
|
292
|
+
<L href={href} className={LINK}>
|
|
293
|
+
{t.read}
|
|
294
|
+
<ArrowRight aria-hidden="true" size={16} className="text-ink-soft transition-transform duration-200 group-hover/act:translate-x-0.5 motion-reduce:transform-none" />
|
|
295
|
+
</L>
|
|
296
|
+
)}
|
|
297
|
+
{pdf && (
|
|
298
|
+
<a href={pdf} target="_blank" rel="noopener noreferrer" className={LINK}>
|
|
299
|
+
<FileText aria-hidden="true" size={16} className="text-ink-soft" />
|
|
300
|
+
{t.pdf}
|
|
301
|
+
<span className="sr-only">{` ${t.of} ${title} ${t.newTab}`}</span>
|
|
302
|
+
</a>
|
|
303
|
+
)}
|
|
304
|
+
</div>
|
|
305
|
+
)}
|
|
306
|
+
</div>
|
|
307
|
+
</li>
|
|
308
|
+
);
|
|
309
|
+
}
|
package/package.json
CHANGED