aidos-ui 3.0.0 → 3.0.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.
- package/README.md +2 -2
- package/dist/Badge.d.ts +1 -2
- package/dist/BaseLink.d.ts +1 -1
- package/dist/BaseList.d.ts +1 -1
- package/dist/BaseListAddOn.d.ts +1 -1
- package/dist/BaseListItem.d.ts +1 -1
- package/dist/BaseView.d.ts +1 -1
- package/dist/Box.d.ts +1 -2
- package/dist/Card.d.ts +1 -1
- package/dist/Checkbox.d.ts +1 -2
- package/dist/Circle.d.ts +1 -2
- package/dist/Column.d.ts +1 -1
- package/dist/DarkMode.d.ts +2 -2
- package/dist/DatePicker.d.ts +1 -2
- package/dist/DesignBook.d.ts +1 -2
- package/dist/Dialog.d.ts +2 -2
- package/dist/Dropdown.d.ts +1 -2
- package/dist/FlexLayout.d.ts +1 -1
- package/dist/Icon.d.ts +1 -1
- package/dist/List.d.ts +2 -2
- package/dist/List.js +10 -2
- package/dist/List.js.map +1 -1
- package/dist/ListButtonItem.d.ts +1 -1
- package/dist/ListDivider.d.ts +1 -2
- package/dist/ListHeaderItem.d.ts +1 -1
- package/dist/ListItem.d.ts +1 -1
- package/dist/ListLinkItem.d.ts +1 -1
- package/dist/ListSpacer.d.ts +1 -2
- package/dist/Popover.d.ts +2 -2
- package/dist/ProgressBar.d.ts +1 -2
- package/dist/ProgressCircle.d.ts +1 -2
- package/dist/Providers.d.ts +1 -1
- package/dist/RootView.d.ts +1 -1
- package/dist/Router.d.ts +1 -2
- package/dist/RouterState.d.ts +1 -1
- package/dist/Row.d.ts +1 -1
- package/dist/StackContext.d.ts +1 -1
- package/dist/StaticCheckbox.d.ts +1 -2
- package/dist/Sublist.d.ts +3 -2
- package/dist/Sublist.js +2 -2
- package/dist/Sublist.js.map +1 -1
- package/dist/SubmitIconInput.d.ts +1 -2
- package/dist/Tabs.d.ts +1 -1
- package/dist/Text.d.ts +8 -8
- package/dist/TextInputWithState.d.ts +1 -1
- package/dist/TextPairing.d.ts +1 -1
- package/dist/Tooltip.d.ts +1 -1
- package/dist/jss.d.ts +2 -2
- package/dist/stateMachineContextFactory.d.ts +1 -1
- package/package.json +8 -3
- package/public/index.json +1 -0
- package/scripts/embeddings.js +93 -0
- package/scripts/publish.js +1 -0
- package/scripts/test_embeddings.js +47 -0
- package/src/List.tsx +12 -2
- package/src/Sublist.tsx +3 -0
- package/src/docs/mdx.tsx +99 -0
- package/src/docs/pages.ts +112 -0
- package/src/pages/Badge.mdx +1 -1
- package/src/pages/Button.mdx +4 -4
- package/src/pages/Link.mdx +3 -3
- package/src/pages/List.mdx +99 -1
- package/src/pages/_app.tsx +126 -241
- package/src/pages/index.mdx +1 -1
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { pipeline } from "@xenova/transformers";
|
|
2
|
+
import fs from "fs/promises";
|
|
3
|
+
import path from "path";
|
|
4
|
+
import { fileURLToPath } from "url";
|
|
5
|
+
import { unified } from "unified";
|
|
6
|
+
import remarkParse from "remark-parse";
|
|
7
|
+
import remarkMdx from "remark-mdx";
|
|
8
|
+
|
|
9
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
10
|
+
const __dirname = path.dirname(__filename);
|
|
11
|
+
const __rootdir = path.join(__dirname, "..");
|
|
12
|
+
const __pages = path.join(__rootdir, "src", "pages");
|
|
13
|
+
const __public = path.join(__rootdir, "public");
|
|
14
|
+
|
|
15
|
+
const generateEmbeddings = await pipeline(
|
|
16
|
+
"feature-extraction",
|
|
17
|
+
"Xenova/all-MiniLM-L6-v2"
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
const files = await fs.readdir(__pages);
|
|
21
|
+
|
|
22
|
+
const index = [];
|
|
23
|
+
|
|
24
|
+
for (const file of files) {
|
|
25
|
+
if (path.extname(file) !== ".mdx") {
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const filepath = path.join(__pages, file);
|
|
30
|
+
const filename = path.parse(file).name;
|
|
31
|
+
const content = await fs.readFile(filepath, "utf-8");
|
|
32
|
+
const sections = parseContent(content);
|
|
33
|
+
|
|
34
|
+
const embeddings = await Promise.all(
|
|
35
|
+
sections.map(async ({ text, heading, headingDepth }) => {
|
|
36
|
+
const embedding = await generateEmbeddings(text, {
|
|
37
|
+
normalize: true,
|
|
38
|
+
pooling: "mean",
|
|
39
|
+
});
|
|
40
|
+
return {
|
|
41
|
+
heading,
|
|
42
|
+
headingDepth,
|
|
43
|
+
filename,
|
|
44
|
+
embedding: Array.from(embedding.data),
|
|
45
|
+
};
|
|
46
|
+
})
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
index.push(...embeddings);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
await fs.writeFile(
|
|
53
|
+
path.join(__public, "index.json"),
|
|
54
|
+
JSON.stringify({ index })
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
function parseChildren(children) {
|
|
58
|
+
const result = [];
|
|
59
|
+
|
|
60
|
+
for (const node of children) {
|
|
61
|
+
if (node.type === "text") {
|
|
62
|
+
result.push(node.value);
|
|
63
|
+
} else if (node.type === "inlineCode") {
|
|
64
|
+
result.push(node.value);
|
|
65
|
+
} else if (node.type === "link") {
|
|
66
|
+
result.push(parseChildren(node.children));
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return result.join(" ");
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function parseContent(content) {
|
|
74
|
+
const ast = unified().use(remarkParse).use(remarkMdx).parse(content);
|
|
75
|
+
const result = [];
|
|
76
|
+
let headingDepth = 1;
|
|
77
|
+
let heading = "";
|
|
78
|
+
|
|
79
|
+
for (const node of ast.children) {
|
|
80
|
+
if (node.type === "paragraph") {
|
|
81
|
+
result.push({
|
|
82
|
+
text: heading + ": " + parseChildren(node.children),
|
|
83
|
+
heading,
|
|
84
|
+
headingDepth,
|
|
85
|
+
});
|
|
86
|
+
} else if (node.type === "heading") {
|
|
87
|
+
headingDepth = node.depth;
|
|
88
|
+
heading = parseChildren(node.children);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return result;
|
|
93
|
+
}
|
package/scripts/publish.js
CHANGED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { pipeline } from "@xenova/transformers";
|
|
2
|
+
import fs from "fs/promises";
|
|
3
|
+
import path from "path";
|
|
4
|
+
import { fileURLToPath } from "url";
|
|
5
|
+
|
|
6
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
7
|
+
const __dirname = path.dirname(__filename);
|
|
8
|
+
const __rootdir = path.join(__dirname, "..");
|
|
9
|
+
const __public = path.join(__rootdir, "public");
|
|
10
|
+
|
|
11
|
+
const index = await fs
|
|
12
|
+
.readFile(path.join(__public, "index.json"), "utf-8")
|
|
13
|
+
.then((data) => JSON.parse(data).index);
|
|
14
|
+
|
|
15
|
+
const generateEmbeddings = await pipeline(
|
|
16
|
+
"feature-extraction",
|
|
17
|
+
"Xenova/all-MiniLM-L6-v2"
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
const query = "how to install";
|
|
21
|
+
|
|
22
|
+
const queryEmbeddings = await generateEmbeddings(query, {
|
|
23
|
+
normalize: true,
|
|
24
|
+
pooling: "mean",
|
|
25
|
+
}).then((embedding) => embedding.data);
|
|
26
|
+
|
|
27
|
+
function dot(xs, ys) {
|
|
28
|
+
let sum = 0;
|
|
29
|
+
|
|
30
|
+
for (let i = 0; i < xs.length; i++) {
|
|
31
|
+
sum += xs[i] * ys[i];
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return sum;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const results = index
|
|
38
|
+
.map((element) => {
|
|
39
|
+
return {
|
|
40
|
+
...element,
|
|
41
|
+
dot: dot(queryEmbeddings, element.embedding),
|
|
42
|
+
};
|
|
43
|
+
})
|
|
44
|
+
.sort((a, b) => b.dot - a.dot)
|
|
45
|
+
.slice(0, 5);
|
|
46
|
+
|
|
47
|
+
console.log({ results });
|
package/src/List.tsx
CHANGED
|
@@ -9,6 +9,7 @@ interface ListProps extends BaseListProps {
|
|
|
9
9
|
autofocus?: boolean;
|
|
10
10
|
role?: undefined;
|
|
11
11
|
navigation?: boolean;
|
|
12
|
+
carded?: boolean;
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
export function List({
|
|
@@ -17,6 +18,7 @@ export function List({
|
|
|
17
18
|
autofocus = false,
|
|
18
19
|
navigation = true,
|
|
19
20
|
bare,
|
|
21
|
+
carded = true,
|
|
20
22
|
...otherProps
|
|
21
23
|
}: ListProps) {
|
|
22
24
|
const rootRef = useNavigation({ autofocus, enabled: navigation });
|
|
@@ -29,10 +31,18 @@ export function List({
|
|
|
29
31
|
jsStyle={[
|
|
30
32
|
{ overflow: "hidden" },
|
|
31
33
|
!bare && {
|
|
32
|
-
border: `1px solid ${cssVar("--divider")}`,
|
|
33
|
-
borderRadius: cssVar("--border-radius-l"),
|
|
34
34
|
backgroundColor: cssVar("--overlay-background"),
|
|
35
35
|
},
|
|
36
|
+
!bare &&
|
|
37
|
+
!carded && {
|
|
38
|
+
borderBottom: `1px solid ${cssVar("--divider")}`,
|
|
39
|
+
borderTop: `1px solid ${cssVar("--divider")}`,
|
|
40
|
+
},
|
|
41
|
+
!bare &&
|
|
42
|
+
carded && {
|
|
43
|
+
border: `1px solid ${cssVar("--divider")}`,
|
|
44
|
+
borderRadius: cssVar("--border-radius-l"),
|
|
45
|
+
},
|
|
36
46
|
jsStyle,
|
|
37
47
|
]}
|
|
38
48
|
{...otherProps}
|
package/src/Sublist.tsx
CHANGED
|
@@ -8,6 +8,7 @@ import { JSStyle } from "./jss";
|
|
|
8
8
|
export function Sublist({
|
|
9
9
|
children,
|
|
10
10
|
label,
|
|
11
|
+
labelBold,
|
|
11
12
|
initialState = { collapsed: false },
|
|
12
13
|
jsStyle,
|
|
13
14
|
secondaryAddOn,
|
|
@@ -16,6 +17,7 @@ export function Sublist({
|
|
|
16
17
|
bare?: boolean;
|
|
17
18
|
children: React.ReactNode;
|
|
18
19
|
label: string;
|
|
20
|
+
labelBold?: boolean;
|
|
19
21
|
initialState?: {
|
|
20
22
|
collapsed: boolean;
|
|
21
23
|
};
|
|
@@ -29,6 +31,7 @@ export function Sublist({
|
|
|
29
31
|
<ListButtonItem
|
|
30
32
|
bare={bare}
|
|
31
33
|
headline={label}
|
|
34
|
+
headlineBold={labelBold}
|
|
32
35
|
onClick={() => setCollapsed((x) => !x)}
|
|
33
36
|
jsStyle={jsStyle}
|
|
34
37
|
addOn={
|
package/src/docs/mdx.tsx
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { MDXProvider } from "@mdx-js/react";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { PropsWithChildren } from "react";
|
|
4
|
+
import { H1, H2, H3, Li, P, Span } from "../Text";
|
|
5
|
+
import { BaseLink } from "../BaseLink";
|
|
6
|
+
import { BaseView } from "../BaseView";
|
|
7
|
+
import { ListDivider } from "../ListDivider";
|
|
8
|
+
import { cssVar } from "../jss";
|
|
9
|
+
import { Roboto } from "next/font/google";
|
|
10
|
+
|
|
11
|
+
const monospace = Roboto({ weight: "400", subsets: ["latin"] });
|
|
12
|
+
|
|
13
|
+
const components: any = {
|
|
14
|
+
h1: (props) => (
|
|
15
|
+
<H1 jsStyle={{ marginBottom: cssVar("--spacing-xl") }} {...props} />
|
|
16
|
+
),
|
|
17
|
+
h2: (props) => (
|
|
18
|
+
<H2
|
|
19
|
+
id={labelToID(props.children)}
|
|
20
|
+
jsStyle={{ marginBottom: cssVar("--spacing-l") }}
|
|
21
|
+
{...props}
|
|
22
|
+
/>
|
|
23
|
+
),
|
|
24
|
+
h3: (props) => {
|
|
25
|
+
return <H3 id={labelToID(props.children)} {...props} />;
|
|
26
|
+
},
|
|
27
|
+
p: (props) => (
|
|
28
|
+
<P jsStyle={{ marginBottom: cssVar("--spacing-m") }} {...props} />
|
|
29
|
+
),
|
|
30
|
+
span: (props) => <Span {...props} />,
|
|
31
|
+
li: (props) => (
|
|
32
|
+
<Li jsStyle={{ marginBottom: cssVar("--spacing-s") }} {...props} />
|
|
33
|
+
),
|
|
34
|
+
a: (props) => {
|
|
35
|
+
return (
|
|
36
|
+
<BaseLink
|
|
37
|
+
bare
|
|
38
|
+
color="positive"
|
|
39
|
+
jsStyle={{
|
|
40
|
+
display: "inline-block",
|
|
41
|
+
paddingBottom: cssVar("--spacing-s"),
|
|
42
|
+
paddingTop: cssVar("--spacing-s"),
|
|
43
|
+
}}
|
|
44
|
+
href={props.href}
|
|
45
|
+
>
|
|
46
|
+
{props.children}
|
|
47
|
+
</BaseLink>
|
|
48
|
+
);
|
|
49
|
+
},
|
|
50
|
+
hr: () => (
|
|
51
|
+
<BaseView
|
|
52
|
+
jsStyle={{
|
|
53
|
+
marginBottom: cssVar("--spacing-xxl"),
|
|
54
|
+
marginTop: cssVar("--spacing-xxl"),
|
|
55
|
+
}}
|
|
56
|
+
>
|
|
57
|
+
<ListDivider />
|
|
58
|
+
</BaseView>
|
|
59
|
+
),
|
|
60
|
+
pre: (props) => {
|
|
61
|
+
return (
|
|
62
|
+
<pre
|
|
63
|
+
style={{ borderRadius: cssVar("--border-radius-l") }}
|
|
64
|
+
className={props.children.props.className}
|
|
65
|
+
tabIndex={0}
|
|
66
|
+
>
|
|
67
|
+
<code className={props.children.props.className}>
|
|
68
|
+
{props.children.props.children}
|
|
69
|
+
</code>
|
|
70
|
+
</pre>
|
|
71
|
+
);
|
|
72
|
+
},
|
|
73
|
+
code: ({ children }) => (
|
|
74
|
+
<span
|
|
75
|
+
className={monospace.className}
|
|
76
|
+
style={{
|
|
77
|
+
color: cssVar("--primary-text"),
|
|
78
|
+
backgroundColor: cssVar("--secondary-background"),
|
|
79
|
+
borderRadius: cssVar("--border-radius-m"),
|
|
80
|
+
padding: cssVar("--spacing-xs"),
|
|
81
|
+
border: `1px solid ${cssVar("--divider")}`,
|
|
82
|
+
display: "inline-block",
|
|
83
|
+
}}
|
|
84
|
+
>
|
|
85
|
+
{children}
|
|
86
|
+
</span>
|
|
87
|
+
),
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
export function labelToID(string: string): string {
|
|
91
|
+
return string
|
|
92
|
+
.replace(/[A-Z]/g, (m) => m.toLowerCase())
|
|
93
|
+
.replace(/\s/g, "-")
|
|
94
|
+
.replace(/\?/g, "");
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export function DocsMDXProvider({ children }: PropsWithChildren<{}>) {
|
|
98
|
+
return <MDXProvider components={components}>{children}</MDXProvider>;
|
|
99
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { Size } from "../jss";
|
|
2
|
+
|
|
3
|
+
type PageLink = {
|
|
4
|
+
type: "link";
|
|
5
|
+
page: string;
|
|
6
|
+
name?: string;
|
|
7
|
+
headlineSize?: Size;
|
|
8
|
+
headlineBold?: boolean;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
type Page =
|
|
12
|
+
| PageLink
|
|
13
|
+
| {
|
|
14
|
+
type: "section";
|
|
15
|
+
label: string;
|
|
16
|
+
content: Array<PageLink>;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export const pages: Array<Page> = [
|
|
20
|
+
{
|
|
21
|
+
type: "link",
|
|
22
|
+
page: "",
|
|
23
|
+
name: "Aidos UI",
|
|
24
|
+
headlineSize: "large",
|
|
25
|
+
headlineBold: true,
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
type: "section",
|
|
29
|
+
label: "CSS",
|
|
30
|
+
content: [{ type: "link", page: "css-in-js", name: "jss" }],
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
type: "section",
|
|
34
|
+
label: "Primary components",
|
|
35
|
+
content: [
|
|
36
|
+
{ type: "link", page: "FlexLayout" },
|
|
37
|
+
{ type: "link", page: "Text" },
|
|
38
|
+
{ type: "link", page: "TextPairing" },
|
|
39
|
+
{ type: "link", page: "Icon" },
|
|
40
|
+
],
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
type: "section",
|
|
44
|
+
label: "Buttons and links",
|
|
45
|
+
content: [
|
|
46
|
+
{ type: "link", page: "Button" },
|
|
47
|
+
{ type: "link", page: "Link" },
|
|
48
|
+
{ type: "link", page: "IconButton" },
|
|
49
|
+
],
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
type: "section",
|
|
53
|
+
label: "Inputs",
|
|
54
|
+
content: [
|
|
55
|
+
{ type: "link", page: "TextInput" },
|
|
56
|
+
{ type: "link", page: "RangeInput" },
|
|
57
|
+
{ type: "link", page: "TimeInput" },
|
|
58
|
+
{ type: "link", page: "Checkbox" },
|
|
59
|
+
],
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
type: "section",
|
|
63
|
+
label: "List components",
|
|
64
|
+
content: [
|
|
65
|
+
{ type: "link", page: "List" },
|
|
66
|
+
{ type: "link", page: "ListHeader" },
|
|
67
|
+
{ type: "link", page: "navigation", name: "List navigation" },
|
|
68
|
+
],
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
type: "section",
|
|
72
|
+
label: "Modals",
|
|
73
|
+
content: [
|
|
74
|
+
{ type: "link", page: "Dialog" },
|
|
75
|
+
{ type: "link", page: "Popover" },
|
|
76
|
+
{ type: "link", page: "Tooltip" },
|
|
77
|
+
],
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
type: "section",
|
|
81
|
+
label: "Visual indicators",
|
|
82
|
+
content: [
|
|
83
|
+
{ type: "link", page: "Badge" },
|
|
84
|
+
{ type: "link", page: "ProgressBar" },
|
|
85
|
+
{ type: "link", page: "ProgressCircle" },
|
|
86
|
+
],
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
type: "section",
|
|
90
|
+
label: "Complex components",
|
|
91
|
+
content: [
|
|
92
|
+
{ type: "link", page: "Tabs" },
|
|
93
|
+
{ type: "link", page: "Calendar" },
|
|
94
|
+
],
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
type: "section",
|
|
98
|
+
label: "Hooks",
|
|
99
|
+
content: [
|
|
100
|
+
{ type: "link", page: "useCookie" },
|
|
101
|
+
{ type: "link", page: "useNavigation" },
|
|
102
|
+
{ type: "link", page: "useKeyboard" },
|
|
103
|
+
{ type: "link", page: "useRefEffect" },
|
|
104
|
+
{ type: "link", page: "usePromise" },
|
|
105
|
+
],
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
type: "section",
|
|
109
|
+
label: "Utils",
|
|
110
|
+
content: [{ type: "link", page: "Hashing" }],
|
|
111
|
+
},
|
|
112
|
+
];
|
package/src/pages/Badge.mdx
CHANGED
|
@@ -3,7 +3,7 @@ import { Row } from "../Row";
|
|
|
3
3
|
|
|
4
4
|
# Badge
|
|
5
5
|
|
|
6
|
-
This component
|
|
6
|
+
This is a simple component that can be used to bring attention to a specific part of the user interface, for example an unread notification, an update, an important element...
|
|
7
7
|
|
|
8
8
|
---
|
|
9
9
|
|
package/src/pages/Button.mdx
CHANGED
|
@@ -3,13 +3,13 @@ import { Row } from "../Row";
|
|
|
3
3
|
|
|
4
4
|
# Button
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
The `Button` component can be used for the user to take actions with a single click, it supports a variety of styles each of them with different semantics.
|
|
7
7
|
|
|
8
8
|
---
|
|
9
9
|
|
|
10
|
-
##
|
|
10
|
+
## Button variants
|
|
11
11
|
|
|
12
|
-
The basic `Button` comes in three main variants,
|
|
12
|
+
The basic `Button` comes in three main variants, each of them with a specific intent in mind. It also support a "disabled" variant, for cases where the button is not actionable.
|
|
13
13
|
|
|
14
14
|
- Positive: actions that are going to create something or strongly agree
|
|
15
15
|
- Secondary: actions that are less central to the user experience
|
|
@@ -34,7 +34,7 @@ The basic `Button` comes in three main variants, and a disabled style that appli
|
|
|
34
34
|
|
|
35
35
|
---
|
|
36
36
|
|
|
37
|
-
## Bare
|
|
37
|
+
## Bare button
|
|
38
38
|
|
|
39
39
|
The bare `Button` variants fulfill the same function than the basic counterparts but have a lighter style that can be more easily integrated in complex components.
|
|
40
40
|
|
package/src/pages/Link.mdx
CHANGED
|
@@ -7,9 +7,9 @@ The `Link` component looks the same as the `Button` component and the only diffe
|
|
|
7
7
|
|
|
8
8
|
---
|
|
9
9
|
|
|
10
|
-
##
|
|
10
|
+
## Link variants
|
|
11
11
|
|
|
12
|
-
The basic `Link` comes in three main variants,
|
|
12
|
+
The basic `Link` comes in three main variants, each of them with a specific intent in mind. It also support a "disabled" variant, for cases where the button is not actionable.
|
|
13
13
|
|
|
14
14
|
- Positive: actions that are going to create something or strongly agree
|
|
15
15
|
- Secondary: actions that are less central to the user experience
|
|
@@ -34,7 +34,7 @@ The basic `Link` comes in three main variants, and a disabled style that applies
|
|
|
34
34
|
|
|
35
35
|
---
|
|
36
36
|
|
|
37
|
-
## Bare
|
|
37
|
+
## Bare link
|
|
38
38
|
|
|
39
39
|
The bare `Link` variants fulfill the same function than the basic counterparts but have a lighter style that can be more easily integrated in complex components.
|
|
40
40
|
|
package/src/pages/List.mdx
CHANGED
|
@@ -11,6 +11,8 @@ The `List` component is used to represent data in a list, it has several compone
|
|
|
11
11
|
|
|
12
12
|
## Base list
|
|
13
13
|
|
|
14
|
+
The default list style has round borders and high contrast background. It can opt out of the roundedness (for example it is useful to go edge-to-edge on small displays) and it also support a bare style, with much more subtle styling.
|
|
15
|
+
|
|
14
16
|
<List ariaLabel="example">
|
|
15
17
|
<ListItem
|
|
16
18
|
headline="Headline"
|
|
@@ -105,10 +107,106 @@ The `List` component is used to represent data in a list, it has several compone
|
|
|
105
107
|
</List>
|
|
106
108
|
```
|
|
107
109
|
|
|
110
|
+
<List carded={false} ariaLabel="example">
|
|
111
|
+
<ListItem
|
|
112
|
+
headline="Headline"
|
|
113
|
+
body="Body"
|
|
114
|
+
addOn={<Icon color="primary" icon="fa-bell" size="medium" />}
|
|
115
|
+
addOnPosition="start"
|
|
116
|
+
/>
|
|
117
|
+
<ListButtonItem
|
|
118
|
+
color="positive"
|
|
119
|
+
headline="Positive button"
|
|
120
|
+
addOn={<Icon color="highlight" icon="fa-plus" size="medium" />}
|
|
121
|
+
addOnPosition="start"
|
|
122
|
+
onClick={() => {}}
|
|
123
|
+
/>
|
|
124
|
+
<ListButtonItem
|
|
125
|
+
color="secondary"
|
|
126
|
+
headline="Secondary button"
|
|
127
|
+
addOn={<Icon color="primary" icon="fa-bicycle" size="medium" />}
|
|
128
|
+
addOnPosition="start"
|
|
129
|
+
onClick={() => {}}
|
|
130
|
+
/>
|
|
131
|
+
<ListButtonItem
|
|
132
|
+
color="negative"
|
|
133
|
+
headline="Negative button"
|
|
134
|
+
addOn={<Icon color="negative" icon="fa-ban" size="medium" />}
|
|
135
|
+
addOnPosition="start"
|
|
136
|
+
onClick={() => {}}
|
|
137
|
+
/>
|
|
138
|
+
<ListLinkItem
|
|
139
|
+
href="/"
|
|
140
|
+
color="secondary"
|
|
141
|
+
headline="Selected link"
|
|
142
|
+
selected
|
|
143
|
+
addOn={<Icon color="primary" icon="fa-renren" size="medium" />}
|
|
144
|
+
addOnPosition="start"
|
|
145
|
+
/>
|
|
146
|
+
<ListLinkItem
|
|
147
|
+
href="/"
|
|
148
|
+
color="secondary"
|
|
149
|
+
headline="Link"
|
|
150
|
+
addOn={<Icon color="primary" icon="fa-renren" size="medium" />}
|
|
151
|
+
addOnPosition="start"
|
|
152
|
+
withDivider={false}
|
|
153
|
+
/>
|
|
154
|
+
</List>
|
|
155
|
+
|
|
156
|
+
```js
|
|
157
|
+
<List carded={false} ariaLabel="example">
|
|
158
|
+
<ListItem
|
|
159
|
+
headline="Headline"
|
|
160
|
+
body="Body"
|
|
161
|
+
addOn={<Icon color="primary" icon="fa-bell" size="medium" />}
|
|
162
|
+
addOnPosition="start"
|
|
163
|
+
/>
|
|
164
|
+
<ListButtonItem
|
|
165
|
+
color="positive"
|
|
166
|
+
headline="Positive button"
|
|
167
|
+
addOn={<Icon color="highlight" icon="fa-plus" size="medium" />}
|
|
168
|
+
addOnPosition="start"
|
|
169
|
+
onClick={() => {}}
|
|
170
|
+
/>
|
|
171
|
+
<ListButtonItem
|
|
172
|
+
color="secondary"
|
|
173
|
+
headline="Secondary button"
|
|
174
|
+
addOn={<Icon color="primary" icon="fa-bicycle" size="medium" />}
|
|
175
|
+
addOnPosition="start"
|
|
176
|
+
onClick={() => {}}
|
|
177
|
+
/>
|
|
178
|
+
<ListButtonItem
|
|
179
|
+
color="negative"
|
|
180
|
+
headline="Negative button"
|
|
181
|
+
addOn={<Icon color="negative" icon="fa-ban" size="medium" />}
|
|
182
|
+
addOnPosition="start"
|
|
183
|
+
onClick={() => {}}
|
|
184
|
+
/>
|
|
185
|
+
<ListLinkItem
|
|
186
|
+
href="/"
|
|
187
|
+
color="secondary"
|
|
188
|
+
headline="Selected link"
|
|
189
|
+
selected
|
|
190
|
+
addOn={<Icon color="primary" icon="fa-renren" size="medium" />}
|
|
191
|
+
addOnPosition="start"
|
|
192
|
+
/>
|
|
193
|
+
<ListLinkItem
|
|
194
|
+
href="/"
|
|
195
|
+
color="secondary"
|
|
196
|
+
headline="Link"
|
|
197
|
+
addOn={<Icon color="primary" icon="fa-renren" size="medium" />}
|
|
198
|
+
addOnPosition="start"
|
|
199
|
+
withDivider={false}
|
|
200
|
+
/>
|
|
201
|
+
</List>
|
|
202
|
+
```
|
|
203
|
+
|
|
108
204
|
---
|
|
109
205
|
|
|
110
206
|
## Bare list
|
|
111
207
|
|
|
208
|
+
The bare list, like other components that support the `bare` style, is much more subtle, has less contrast and no borders. For elements that are constantly on display but may not always be necessary (for example navigation elements) it could be preferred to make the user interface cleaner and lighter.
|
|
209
|
+
|
|
112
210
|
<List bare ariaLabel="example">
|
|
113
211
|
<ListItem
|
|
114
212
|
bare
|
|
@@ -237,7 +335,7 @@ The `List` component is used to represent data in a list, it has several compone
|
|
|
237
335
|
|
|
238
336
|
---
|
|
239
337
|
|
|
240
|
-
## navigation
|
|
338
|
+
## Keyboard navigation
|
|
241
339
|
|
|
242
340
|
Lists support keyboard navigation by default via the `useNavigation` hook. It can be disabled by passing the prop `navigation` and tries to emulate the [grid layout spec](https://www.w3.org/WAI/ARIA/apg/patterns/grid/examples/layout-grids/):
|
|
243
341
|
|