diff --git a/apps/docs/components/collapsible/collapsible.css b/apps/docs/components/collapsible/collapsible.css
index 6d0282a60..b4d703788 100644
--- a/apps/docs/components/collapsible/collapsible.css
+++ b/apps/docs/components/collapsible/collapsible.css
@@ -7,7 +7,7 @@
line-height: 1.35;
color: var(--hd-color-neutral-text);
display: flex;
- width: 100%;
+ width: calc(100% + var(--hd-space-2) * 2);
justify-content: space-between;
align-items: center;
padding-block: var(--hd-space-2);
diff --git a/apps/docs/components/highlightCode/HighlightCode.tsx b/apps/docs/components/highlightCode/HighlightCode.tsx
index a205881ac..1188779b9 100644
--- a/apps/docs/components/highlightCode/HighlightCode.tsx
+++ b/apps/docs/components/highlightCode/HighlightCode.tsx
@@ -1,36 +1,49 @@
"use client";
-import { useEffect, useState } from "react";
+import { useEffect, useMemo, useState } from "react";
import * as prod from "react/jsx-runtime";
import { unified } from "unified";
import rehypeReact from "rehype-react";
import rehypeParse from "rehype-parse";
import Pre from "@/components/pre/Pre.tsx";
+import InlineCode, { type InlineCodeProps } from "@/components/code/InlineCode.tsx";
+
+export type Variant = "default" | "tiny";
export interface HighlightCodeProps {
code: string;
+ variant?: Variant;
}
-const production = { Fragment: prod.Fragment, jsx: prod.jsx, jsxs: prod.jsxs, components: { pre: Pre } };
+const production = { Fragment: prod.Fragment, jsx: prod.jsx, jsxs: prod.jsxs };
-function useProcessor(text: string) {
+function useProcessor(text: string, variant?: Variant) {
const [Content, setContent] = useState(<>>);
useEffect(() => {
+ const options = {
+ ...production,
+ components: {
+ pre: variant === "tiny" ? (props: InlineCodeProps) =>
: Pre
+ }
+ };
+
unified()
.use(rehypeParse, { fragment: true })
// @ts-expect-error: rehype-react types error
- .use(rehypeReact, production)
+ .use(rehypeReact, options)
.process(text)
.then(file => {
setContent(file.result);
});
- }, [text]);
+ }, [text, variant]);
return Content;
}
-export default function HighlightCode({ code }: HighlightCodeProps) {
- return useProcessor(code);
+export default function HighlightCode({ code, variant = "default" }: HighlightCodeProps) {
+ const processor = useProcessor(code, variant);
+
+ return useMemo(() => processor, [processor]);
}
diff --git a/apps/docs/components/pre/Pre.tsx b/apps/docs/components/pre/Pre.tsx
index 2751466ea..9e8582539 100644
--- a/apps/docs/components/pre/Pre.tsx
+++ b/apps/docs/components/pre/Pre.tsx
@@ -12,9 +12,10 @@ export type PreProps = React.DetailedHTMLProps
, H
"data-language"?: string;
raw?: string;
className?: string;
+ theme?: "light" | "dark";
};
-const Pre = ({ children, className, title, "data-language": dataLanguage, raw, ...props }: PreProps) => {
+const Pre = ({ children, className, title, "data-language": dataLanguage, raw, theme = "dark", ...props }: PreProps) => {
const classes = clsx("hd-pre", {
"hd-pre--title": title
}, className);
@@ -31,7 +32,7 @@ const Pre = ({ children, className, title, "data-language": dataLanguage, raw, .
const copyButton = raw && ;
return (
-
+
{title &&
diff --git a/apps/docs/components/table/Table.tsx b/apps/docs/components/table/Table.tsx
index 9a84d3db0..b9bb84520 100644
--- a/apps/docs/components/table/Table.tsx
+++ b/apps/docs/components/table/Table.tsx
@@ -2,7 +2,7 @@
import clsx from "clsx";
import { Cell, Column, Row, Table as TableRA, TableBody, TableHeader } from "react-aria-components";
-import type { ReactNode } from "react";
+import React, { type ReactNode, useMemo } from "react";
import "./table.css";
@@ -25,6 +25,7 @@ function generateUniqueKey() {
const Table = ({ data, head, lastColumnAlignment = "left", ariaLabel = "standard table", className }: TableProps) => {
const textAlignRight = lastColumnAlignment === "right";
const lastColumn = head.length - 1;
+ const dataItem = useMemo(() => data, [data]);
const headItems = head.map((item, index) => {
return (
@@ -37,7 +38,7 @@ const Table = ({ data, head, lastColumnAlignment = "left", ariaLabel = "standard
);
});
- const dataItems = data.map(item => {
+ const dataItems = dataItem.map(item => {
return (
{Object.keys(item).map((key, index) => {
@@ -54,6 +55,7 @@ const Table = ({ data, head, lastColumnAlignment = "left", ariaLabel = "standard
});
return (
+
{headItems}
diff --git a/apps/docs/components/table/table.css b/apps/docs/components/table/table.css
index 195fba20c..b0c769ddf 100644
--- a/apps/docs/components/table/table.css
+++ b/apps/docs/components/table/table.css
@@ -23,6 +23,10 @@
min-width: 3rem;
}
+.hd-table__th {
+ padding: var(--hd-space-1);
+}
+
.hd-table__cell {
font-family: var(--hd-mono-font-family);
font-size: 0.8125rem;
diff --git a/apps/docs/components/title/title.css b/apps/docs/components/title/title.css
index c28ec9f2e..a5c2861ff 100644
--- a/apps/docs/components/title/title.css
+++ b/apps/docs/components/title/title.css
@@ -1,9 +1,9 @@
.hd-title {
- --hd-title-font-family: var(--hd-default-font-family);
+ --hd-title-font-family: var(--hd-default-font-family);
- font-family: var(--hd-title-font-family);
- line-height: 1;
- margin-block: 0;
+ font-family: var(--hd-title-font-family);
+ line-height: 1;
+ margin-block: 0;
}
.hd-title--level1 {
@@ -34,14 +34,12 @@
.hd-title-link {
position: relative;
display: inline;
- padding-left: 2ch;
- margin-left: -2ch;
}
-.hd-title-link::before {
+.hd-title-link::after {
content: "#";
position: absolute;
- left: 0;
+ left: calc(100% + 1ch);
font-size: 1em;
line-height: inherit;
color: var(--hd-color-neutral-text-weak);
@@ -49,7 +47,7 @@
transition: opacity 0.1s ease-in;
}
-.hd-title-link:hover::before,
-.hd-title-link:focus::before {
+.hd-title-link:hover::after,
+.hd-title-link:focus::after {
opacity: 1;
}
diff --git a/apps/docs/content/components/button.mdx b/apps/docs/content/components/button.mdx
index d7c844de4..afc5f1a01 100644
--- a/apps/docs/content/components/button.mdx
+++ b/apps/docs/content/components/button.mdx
@@ -11,14 +11,12 @@ links:
## Usage
-```shell
-import { Button } from "@hopper-ui/components";
-```
```tsx showLineNumbers
+import { Button } from "@hopper-ui/components";
+
```
## Props
-The table below contains all types of the props available in title component.
diff --git a/apps/docs/datas/components/Button.json b/apps/docs/datas/components/Button.json
index 9b7263605..5ae859e2b 100644
--- a/apps/docs/datas/components/Button.json
+++ b/apps/docs/datas/components/Button.json
@@ -1 +1 @@
-[{"tags":{},"filePath":"/Users/franck.gaudin/Devel/DS/wl-hopper/packages/components/src/buttons/src/Button.tsx","description":"Buttons are used to initialize an action. Button labels express what action will occur when the user interacts with it.\n\n[View Documentation](TODO)","displayName":"Button","methods":[],"props":{"variant":{"defaultValue":{"value":"\"primary\""},"description":"The visual style of the button.\n*","name":"variant","parent":{"fileName":"wl-hopper/packages/components/src/buttons/src/Button.tsx","name":"ButtonProps"},"declarations":[{"fileName":"wl-hopper/packages/components/src/buttons/src/Button.tsx","name":"ButtonProps"}],"required":false,"type":{"name":"\"primary\" | \"secondary\" | \"danger\" | \"upsell\" | \"ghost-primary\" | \"ghost-secondary\" | \"ghost-danger\""}},"size":{"defaultValue":{"value":"\"md\""},"description":"A button can vary in size.","name":"size","parent":{"fileName":"wl-hopper/packages/components/src/buttons/src/Button.tsx","name":"ButtonProps"},"declarations":[{"fileName":"wl-hopper/packages/components/src/buttons/src/Button.tsx","name":"ButtonProps"}],"required":false,"type":{"name":"ResponsiveProp<\"sm\" | \"md\">"}},"fluid":{"defaultValue":null,"description":"Whether or not the button takes up the width of its container.","name":"fluid","parent":{"fileName":"wl-hopper/packages/components/src/buttons/src/Button.tsx","name":"ButtonProps"},"declarations":[{"fileName":"wl-hopper/packages/components/src/buttons/src/Button.tsx","name":"ButtonProps"}],"required":false,"type":{"name":"ResponsiveProp"}},"isLoading":{"defaultValue":null,"description":"","name":"isLoading","parent":{"fileName":"wl-hopper/packages/components/src/buttons/src/Button.tsx","name":"ButtonProps"},"declarations":[{"fileName":"wl-hopper/packages/components/src/buttons/src/Button.tsx","name":"ButtonProps"}],"required":false,"type":{"name":"boolean"}},"href":{"defaultValue":null,"description":"A URL to link to. Setting this makes the component render an `a` tag instead of a `button`","name":"href","parent":{"fileName":"wl-hopper/packages/components/src/buttons/src/Button.tsx","name":"ButtonProps"},"declarations":[{"fileName":"wl-hopper/packages/components/src/buttons/src/Button.tsx","name":"ButtonProps"}],"required":false,"type":{"name":"string"}},"target":{"defaultValue":null,"description":"The target window for the link.","name":"target","parent":{"fileName":"wl-hopper/packages/components/src/buttons/src/Button.tsx","name":"ButtonProps"},"declarations":[{"fileName":"wl-hopper/packages/components/src/buttons/src/Button.tsx","name":"ButtonProps"}],"required":false,"type":{"name":"string"}},"rel":{"defaultValue":null,"description":"The relationship between the linked resource and the current page. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel).","name":"rel","parent":{"fileName":"wl-hopper/packages/components/src/buttons/src/Button.tsx","name":"ButtonProps"},"declarations":[{"fileName":"wl-hopper/packages/components/src/buttons/src/Button.tsx","name":"ButtonProps"}],"required":false,"type":{"name":"string"}},"form":{"defaultValue":null,"description":"The