timvir 0.1.42
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/blocks/Arbitrary/Arbitrary.d.ts +11 -0
- package/blocks/Arbitrary/context.d.ts +7 -0
- package/blocks/Arbitrary/docs/index.mdx +36 -0
- package/blocks/Arbitrary/index.d.ts +2 -0
- package/blocks/Arbitrary/index.js +117 -0
- package/blocks/Arbitrary/samples/basic.d.ts +5 -0
- package/blocks/Arbitrary/styles.css +6 -0
- package/blocks/Code/Code.d.ts +35 -0
- package/blocks/Code/docs/api.mdx +76 -0
- package/blocks/Code/docs/index.mdx +39 -0
- package/blocks/Code/index.d.ts +1 -0
- package/blocks/Code/index.js +154 -0
- package/blocks/Code/samples/basic.d.ts +5 -0
- package/blocks/Code/samples/toggle.d.ts +2 -0
- package/blocks/Code/styles.css +14 -0
- package/blocks/Code/theme.d.ts +2 -0
- package/blocks/ColorBar/ColorBar.d.ts +18 -0
- package/blocks/ColorBar/docs/api.mdx +76 -0
- package/blocks/ColorBar/docs/index.mdx +128 -0
- package/blocks/ColorBar/index.d.ts +1 -0
- package/blocks/ColorBar/index.js +90 -0
- package/blocks/ColorBar/samples/basic.d.ts +2 -0
- package/blocks/ColorBar/styles.css +5 -0
- package/blocks/ColorBook/ColorBook.d.ts +16 -0
- package/blocks/ColorBook/docs/api.mdx +76 -0
- package/blocks/ColorBook/docs/index.mdx +12 -0
- package/blocks/ColorBook/index.d.ts +1 -0
- package/blocks/ColorBook/index.js +77 -0
- package/blocks/ColorBook/samples/basic.d.ts +2 -0
- package/blocks/ColorBook/styles.css +6 -0
- package/blocks/Cover/Cover.d.ts +20 -0
- package/blocks/Cover/docs/api.mdx +76 -0
- package/blocks/Cover/docs/index.mdx +20 -0
- package/blocks/Cover/index.d.ts +1 -0
- package/blocks/Cover/index.js +64 -0
- package/blocks/Cover/samples/basic.d.ts +2 -0
- package/blocks/Exhibit/Exhibit.d.ts +19 -0
- package/blocks/Exhibit/docs/api.mdx +76 -0
- package/blocks/Exhibit/docs/index.mdx +56 -0
- package/blocks/Exhibit/index.d.ts +1 -0
- package/blocks/Exhibit/index.js +83 -0
- package/blocks/Exhibit/samples/basic.d.ts +2 -0
- package/blocks/Exhibit/styles.css +3 -0
- package/blocks/Font/Font.d.ts +15 -0
- package/blocks/Font/docs/api.mdx +76 -0
- package/blocks/Font/docs/index.mdx +23 -0
- package/blocks/Font/index.d.ts +1 -0
- package/blocks/Font/index.js +131 -0
- package/blocks/Font/samples/basic.d.ts +5 -0
- package/blocks/Font/samples/system.d.ts +2 -0
- package/blocks/Font/styles.css +9 -0
- package/blocks/Grid/Grid.d.ts +9 -0
- package/blocks/Grid/docs/api.mdx +76 -0
- package/blocks/Grid/docs/index.mdx +82 -0
- package/blocks/Grid/index.d.ts +1 -0
- package/blocks/Grid/index.js +53 -0
- package/blocks/Grid/samples/basic.d.ts +2 -0
- package/blocks/Grid/styles.css +1 -0
- package/blocks/Icon/Icon.d.ts +11 -0
- package/blocks/Icon/docs/api.mdx +76 -0
- package/blocks/Icon/docs/index.mdx +218 -0
- package/blocks/Icon/index.d.ts +1 -0
- package/blocks/Icon/index.js +155 -0
- package/blocks/Icon/internal/Canvas.d.ts +9 -0
- package/blocks/Icon/internal/index.d.ts +1 -0
- package/blocks/Icon/samples/basic.d.ts +2 -0
- package/blocks/Icon/styles.css +5 -0
- package/blocks/Icon/types.d.ts +10 -0
- package/blocks/Message/Message.d.ts +10 -0
- package/blocks/Message/docs/api.mdx +76 -0
- package/blocks/Message/docs/index.mdx +63 -0
- package/blocks/Message/index.d.ts +1 -0
- package/blocks/Message/index.js +72 -0
- package/blocks/Message/samples/basic.d.ts +5 -0
- package/blocks/Message/styles.css +6 -0
- package/blocks/Swatch/Swatch.d.ts +33 -0
- package/blocks/Swatch/docs/api.mdx +76 -0
- package/blocks/Swatch/docs/index.mdx +39 -0
- package/blocks/Swatch/index.d.ts +1 -0
- package/blocks/Swatch/index.js +84 -0
- package/blocks/Swatch/samples/basic.d.ts +2 -0
- package/blocks/Swatch/styles.css +4 -0
- package/blocks/Viewport/Viewport.d.ts +17 -0
- package/blocks/Viewport/docs/api.mdx +76 -0
- package/blocks/Viewport/docs/index.mdx +34 -0
- package/blocks/Viewport/index.d.ts +1 -0
- package/blocks/Viewport/index.js +322 -0
- package/blocks/Viewport/internal/Caption.d.ts +8 -0
- package/blocks/Viewport/internal/Handle.d.ts +10 -0
- package/blocks/Viewport/internal/Ruler.d.ts +7 -0
- package/blocks/Viewport/internal/index.d.ts +3 -0
- package/blocks/Viewport/samples/basic.d.ts +2 -0
- package/blocks/Viewport/styles.css +14 -0
- package/blocks/WebLink/WebLink.d.ts +10 -0
- package/blocks/WebLink/docs/api.mdx +76 -0
- package/blocks/WebLink/docs/index.mdx +13 -0
- package/blocks/WebLink/index.d.ts +1 -0
- package/blocks/WebLink/index.js +97 -0
- package/blocks/WebLink/samples/basic.d.ts +5 -0
- package/blocks/WebLink/styles.css +8 -0
- package/blocks/index.d.ts +13 -0
- package/blocks/index.js +13 -0
- package/blocks/styles.css +81 -0
- package/bus/index.d.ts +12 -0
- package/bus/index.js +22 -0
- package/bus/messages.d.ts +15 -0
- package/context/index.d.ts +20 -0
- package/context/index.js +15 -0
- package/core/components/Footer/Footer.d.ts +16 -0
- package/core/components/Footer/docs/api.mdx +76 -0
- package/core/components/Footer/docs/index.mdx +27 -0
- package/core/components/Footer/index.d.ts +1 -0
- package/core/components/Footer/samples/basic.d.ts +5 -0
- package/core/components/NavigationFooter/NavigationFooter.d.ts +19 -0
- package/core/components/NavigationFooter/docs/api.mdx +76 -0
- package/core/components/NavigationFooter/docs/index.mdx +10 -0
- package/core/components/NavigationFooter/index.d.ts +1 -0
- package/core/components/NavigationFooter/samples/basic.d.ts +5 -0
- package/core/components/Page/Page.d.ts +60 -0
- package/core/components/Page/components.d.ts +46 -0
- package/core/components/Page/docs/api.mdx +76 -0
- package/core/components/Page/docs/index.mdx +37 -0
- package/core/components/Page/index.d.ts +2 -0
- package/core/components/Page/internal/Section.d.ts +7 -0
- package/core/components/Page/internal/Sidebar.d.ts +15 -0
- package/core/components/Page/internal/index.d.ts +2 -0
- package/core/components/Page/samples/basic.d.ts +2 -0
- package/core/components/Page/samples/layout.d.ts +2 -0
- package/core/components/Page/types.d.ts +5 -0
- package/core/index.d.ts +22 -0
- package/core/index.js +708 -0
- package/core/layout.d.ts +4 -0
- package/core/styles.css +47 -0
- package/core/theme/colors.d.ts +36 -0
- package/core/theme/index.d.ts +1 -0
- package/hooks/index.d.ts +1 -0
- package/hooks/index.js +72 -0
- package/hooks/useResizeObserver/index.d.ts +56 -0
- package/package.json +27 -0
- package/std/base58/index.d.ts +2 -0
- package/std/base58/index.js +71 -0
- package/styles.css +128 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# API
|
|
2
|
+
|
|
3
|
+
<div style={ { display: "grid", gridTemplateColumns: "min-content 1fr" } }>
|
|
4
|
+
<div style={ { fontWeight: "bold", marginRight: 16 } }>Root:</div>
|
|
5
|
+
<div>{`<div>`}</div>
|
|
6
|
+
<div style={ { fontWeight: "bold", marginRight: 16 } }>Ref:</div>
|
|
7
|
+
<div>Forward <span style={ { color: "rgb(153, 153, 153)" } }>(HTMLDivElement)</span></div>
|
|
8
|
+
</div>
|
|
9
|
+
|
|
10
|
+
## Props
|
|
11
|
+
|
|
12
|
+
<Props {...{"fields":[{"name":"source","type":{"optional":true,"name":"ReactNode","module":""},"comment":{"shortText":""}},{"name":"caption","type":{"optional":true,"name":"ReactNode","module":""},"comment":{"shortText":""}},{"name":"bleed","type":{"optional":true,"name":"number","module":""},"def":"0","comment":{"shortText":"How much the component should extend out of its original box."}}]}} />
|
|
13
|
+
|
|
14
|
+
export const required = (
|
|
15
|
+
<svg
|
|
16
|
+
x="0px"
|
|
17
|
+
y="0px"
|
|
18
|
+
width="10px"
|
|
19
|
+
height="10px"
|
|
20
|
+
viewBox="0 0 16 16"
|
|
21
|
+
style={ { position: "relative", top: 0, display: "inline-block", marginRight: 8 } }
|
|
22
|
+
>
|
|
23
|
+
<g transform="translate(0, 0)">
|
|
24
|
+
<circle cx="8" cy="8" r="8" fill="#444444"></circle>
|
|
25
|
+
</g>
|
|
26
|
+
</svg>
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
export const optional = (
|
|
30
|
+
<svg
|
|
31
|
+
x="0px"
|
|
32
|
+
y="0px"
|
|
33
|
+
width="10px"
|
|
34
|
+
height="10px"
|
|
35
|
+
viewBox="0 0 16 16"
|
|
36
|
+
style={ { position: "relative", top: 0, display: "inline-block", marginRight: 8 } }
|
|
37
|
+
>
|
|
38
|
+
<g transform="translate(0, 0)">
|
|
39
|
+
<circle
|
|
40
|
+
cx="8"
|
|
41
|
+
cy="8"
|
|
42
|
+
r="7.5"
|
|
43
|
+
fill="none"
|
|
44
|
+
stroke="#444444"
|
|
45
|
+
strokeLinecap="round"
|
|
46
|
+
strokeLinejoin="round"
|
|
47
|
+
data-cap="butt"
|
|
48
|
+
></circle>
|
|
49
|
+
</g>
|
|
50
|
+
</svg>
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
export const Props = ({ fields }) => (
|
|
54
|
+
<div style={ { marginTop: 16, display: "grid", gridGap: 24 } }>
|
|
55
|
+
{fields.map(({ name, type, def, example, comment }) => (
|
|
56
|
+
<div key={name}>
|
|
57
|
+
<div style={ { marginLeft: -18 } }>
|
|
58
|
+
{type.optional ? optional : required}
|
|
59
|
+
<span style={ { fontWeight: "bold" } }>{name}</span>{`: `}
|
|
60
|
+
<span>{type.name}</span>
|
|
61
|
+
{def && (
|
|
62
|
+
<>
|
|
63
|
+
{` = `}<span style={ { fontWeight: "bold" } }>{def}</span>
|
|
64
|
+
</>
|
|
65
|
+
)}
|
|
66
|
+
</div>
|
|
67
|
+
<div>{comment.shortText}</div>
|
|
68
|
+
{example && (
|
|
69
|
+
<div style={ { marginLeft: 0, marginTop: 8, color: "rgb(153, 153, 153)", fontSize: "0.8rem" } }>
|
|
70
|
+
Example: <span style={ { fontWeight: "bold" } }>{example}</span>
|
|
71
|
+
</div>
|
|
72
|
+
)}
|
|
73
|
+
</div>
|
|
74
|
+
))}
|
|
75
|
+
</div>
|
|
76
|
+
)
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { Exhibit } from "..";
|
|
2
|
+
import { Code } from "timvir/blocks";
|
|
3
|
+
|
|
4
|
+
# Exhibit
|
|
5
|
+
|
|
6
|
+
The `<Exhibit>` is a block which is used to present something–usually a React component–in a nice way. It's a way to say:
|
|
7
|
+
|
|
8
|
+
<Sample variant="basic" />
|
|
9
|
+
|
|
10
|
+
<Code language="jsx">
|
|
11
|
+
<Sample variant="basic" as="source/markup" />
|
|
12
|
+
</Code>
|
|
13
|
+
|
|
14
|
+
Think of it as a `<figure>` + `<figcaption>` for React components.
|
|
15
|
+
|
|
16
|
+
Add a title to the exhibit if it helps the reader to understand the exhibit better. The title is placed snuggly to the exhibit.
|
|
17
|
+
|
|
18
|
+
<Exhibit bleed={8} title="This Is Not A Button" caption="It's an input element, of type text">
|
|
19
|
+
<input type="text" placeholder="Type something…" style={{ boxSizing: "border-box", width: "100%", padding: 8 }} />
|
|
20
|
+
</Exhibit>
|
|
21
|
+
|
|
22
|
+
## Bleed
|
|
23
|
+
|
|
24
|
+
Use the `bleed` prop to control how much the checkered background extends beyond the box of the element itself.
|
|
25
|
+
|
|
26
|
+
#### bleed 0
|
|
27
|
+
|
|
28
|
+
<Exhibit bleed={0}>
|
|
29
|
+
<div
|
|
30
|
+
style={{ height: 40, padding: "0 16px", background: "teal", color: "white", display: "flex", alignItems: "center" }}
|
|
31
|
+
/>
|
|
32
|
+
</Exhibit>
|
|
33
|
+
|
|
34
|
+
#### bleed 4
|
|
35
|
+
|
|
36
|
+
<Exhibit bleed={4}>
|
|
37
|
+
<div
|
|
38
|
+
style={{ height: 40, padding: "0 16px", background: "teal", color: "white", display: "flex", alignItems: "center" }}
|
|
39
|
+
/>
|
|
40
|
+
</Exhibit>
|
|
41
|
+
|
|
42
|
+
#### bleed 12
|
|
43
|
+
|
|
44
|
+
<Exhibit bleed={12}>
|
|
45
|
+
<div
|
|
46
|
+
style={{ height: 40, padding: "0 16px", background: "teal", color: "white", display: "flex", alignItems: "center" }}
|
|
47
|
+
/>
|
|
48
|
+
</Exhibit>
|
|
49
|
+
|
|
50
|
+
#### bleed 24
|
|
51
|
+
|
|
52
|
+
<Exhibit bleed={24}>
|
|
53
|
+
<div
|
|
54
|
+
style={{ height: 40, padding: "0 16px", background: "teal", color: "white", display: "flex", alignItems: "center" }}
|
|
55
|
+
/>
|
|
56
|
+
</Exhibit>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Exhibit } from "./Exhibit";
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { useMDXComponents } from '@mdx-js/react';
|
|
2
|
+
import { useBlock } from 'timvir/core';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Takes a list of class names and filters for truthy ones, joining them into a single class name for convenience.
|
|
7
|
+
* eg.
|
|
8
|
+
* ```js
|
|
9
|
+
* cx('red', isBig && 'big') // returns 'red big' if `isBig` is true, otherwise returns 'red'
|
|
10
|
+
* ```
|
|
11
|
+
* If arguments provided are objects, these objects are merged together, and the values are taken as class names:
|
|
12
|
+
*
|
|
13
|
+
* ```js
|
|
14
|
+
* cx({ color: 'class1', textDecoration: 'class2'}, { color: 'class3' }) // returns `class3 class2`
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* @returns the combined, space separated class names that can be applied directly to the class attribute
|
|
18
|
+
*/
|
|
19
|
+
const cx = function cx() {
|
|
20
|
+
const presentClassNames = Array.prototype.slice.call(arguments).filter(Boolean); // In the basic case, `cx` is passed all strings, and we simply need to join them together with space separators
|
|
21
|
+
|
|
22
|
+
const classNamesResult = presentClassNames.filter(arg => typeof arg !== 'object'); // There might also be objects (eg. from the atomic API) such as cx('foo', {
|
|
23
|
+
// key1: 'bar', key2: 'fizz'}, { key1: 'buzz' }) the desired behavior is to
|
|
24
|
+
// deduplicate the values based on their properties. The object's values are
|
|
25
|
+
// the class names
|
|
26
|
+
|
|
27
|
+
const styleCollectionResult = Object.values(Object.assign({}, ...presentClassNames.filter(arg => typeof arg === 'object')));
|
|
28
|
+
return [...styleCollectionResult, ...classNamesResult].join(' ');
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* The underlying DOM element which is rendered by this component.
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
const Root = "figure";
|
|
36
|
+
|
|
37
|
+
function Exhibit(props, ref) {
|
|
38
|
+
const block = useBlock(props);
|
|
39
|
+
const components = {
|
|
40
|
+
h3: "h3",
|
|
41
|
+
...useMDXComponents()
|
|
42
|
+
};
|
|
43
|
+
const {
|
|
44
|
+
title,
|
|
45
|
+
caption,
|
|
46
|
+
bleed = 0,
|
|
47
|
+
BackdropProps,
|
|
48
|
+
children,
|
|
49
|
+
className,
|
|
50
|
+
style,
|
|
51
|
+
...rest
|
|
52
|
+
} = block.props;
|
|
53
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, title && /*#__PURE__*/React.createElement(components.h3, null, title), /*#__PURE__*/React.createElement(Root, {
|
|
54
|
+
ref: ref,
|
|
55
|
+
className: cx(className, classes.root),
|
|
56
|
+
style: { ...style,
|
|
57
|
+
[cssVariables.bleed]: typeof bleed === "number" ? `${bleed}px` : bleed
|
|
58
|
+
},
|
|
59
|
+
...rest
|
|
60
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
61
|
+
className: classes.container,
|
|
62
|
+
style: {
|
|
63
|
+
border: bleed !== 0 ? `1px solid var(${cssVariables.borderColor})` : "none"
|
|
64
|
+
},
|
|
65
|
+
...BackdropProps
|
|
66
|
+
}, children), caption && /*#__PURE__*/React.createElement("figcaption", {
|
|
67
|
+
className: classes.caption
|
|
68
|
+
}, caption)));
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
var Exhibit$1 = /*#__PURE__*/React.forwardRef(Exhibit);
|
|
72
|
+
const cssVariables = {
|
|
73
|
+
bleed: "--timvir-b-Exhibit-bleed",
|
|
74
|
+
borderColor: "--timvir-b-Exhibit-borderColor",
|
|
75
|
+
background: "--timvir-b-Exhibit-background"
|
|
76
|
+
};
|
|
77
|
+
const classes = {
|
|
78
|
+
root: "r1nql2f9",
|
|
79
|
+
container: "c4ji594",
|
|
80
|
+
caption: "cf43jjx"
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
export { Exhibit$1 as Exhibit };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
.r1nql2f9{margin:0 0 1.5rem;--timvir-b-Exhibit-bleed:0px;--timvir-b-Exhibit-borderColor:#EFEFEF;--timvir-b-Exhibit-background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAAAAACoWZBhAAAAF0lEQVQI12P4BAI/QICBFCaYBPNJYQIAkUZftTbC4sIAAAAASUVORK5CYII=);}:root[data-timvir-theme="dark"] .r1nql2f9{--timvir-b-Exhibit-borderColor:#101010;--timvir-b-Exhibit-background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAAAAACoWZBhAAAAFklEQVQI12NQBQF2EGAghQkmwXxSmADZJQiZ2ZZ46gAAAABJRU5ErkJggg==);}
|
|
2
|
+
.c4ji594{display:flow-root;background:var(--timvir-b-Exhibit-background);margin:0 calc(-1 * var(--timvir-b-Exhibit-bleed));padding:var(--timvir-b-Exhibit-bleed);}
|
|
3
|
+
.cf43jjx{font-size:0.75rem;color:var(--timvir-secondary-text-color);margin-top:2px;}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* The underlying DOM element which is rendered by this component.
|
|
4
|
+
*/
|
|
5
|
+
declare const Root = "div";
|
|
6
|
+
interface Props extends React.ComponentPropsWithoutRef<typeof Root> {
|
|
7
|
+
name: string;
|
|
8
|
+
font: {
|
|
9
|
+
style?: React.CSSProperties;
|
|
10
|
+
className?: string;
|
|
11
|
+
};
|
|
12
|
+
info?: React.ReactNode;
|
|
13
|
+
}
|
|
14
|
+
declare const _default: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLDivElement>>;
|
|
15
|
+
export default _default;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# API
|
|
2
|
+
|
|
3
|
+
<div style={ { display: "grid", gridTemplateColumns: "min-content 1fr" } }>
|
|
4
|
+
<div style={ { fontWeight: "bold", marginRight: 16 } }>Root:</div>
|
|
5
|
+
<div>{`<div>`}</div>
|
|
6
|
+
<div style={ { fontWeight: "bold", marginRight: 16 } }>Ref:</div>
|
|
7
|
+
<div>Forward <span style={ { color: "rgb(153, 153, 153)" } }>(HTMLDivElement)</span></div>
|
|
8
|
+
</div>
|
|
9
|
+
|
|
10
|
+
## Props
|
|
11
|
+
|
|
12
|
+
<Props {...{"fields":[{"name":"name","type":{"optional":false,"name":"string","module":""},"comment":{"shortText":""}},{"name":"font","type":{"optional":false,"name":"{ style?: CSSProperties; className?: string; }","module":""},"comment":{"shortText":""}},{"name":"info","type":{"optional":true,"name":"ReactNode","module":""},"comment":{"shortText":""}}]}} />
|
|
13
|
+
|
|
14
|
+
export const required = (
|
|
15
|
+
<svg
|
|
16
|
+
x="0px"
|
|
17
|
+
y="0px"
|
|
18
|
+
width="10px"
|
|
19
|
+
height="10px"
|
|
20
|
+
viewBox="0 0 16 16"
|
|
21
|
+
style={ { position: "relative", top: 0, display: "inline-block", marginRight: 8 } }
|
|
22
|
+
>
|
|
23
|
+
<g transform="translate(0, 0)">
|
|
24
|
+
<circle cx="8" cy="8" r="8" fill="#444444"></circle>
|
|
25
|
+
</g>
|
|
26
|
+
</svg>
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
export const optional = (
|
|
30
|
+
<svg
|
|
31
|
+
x="0px"
|
|
32
|
+
y="0px"
|
|
33
|
+
width="10px"
|
|
34
|
+
height="10px"
|
|
35
|
+
viewBox="0 0 16 16"
|
|
36
|
+
style={ { position: "relative", top: 0, display: "inline-block", marginRight: 8 } }
|
|
37
|
+
>
|
|
38
|
+
<g transform="translate(0, 0)">
|
|
39
|
+
<circle
|
|
40
|
+
cx="8"
|
|
41
|
+
cy="8"
|
|
42
|
+
r="7.5"
|
|
43
|
+
fill="none"
|
|
44
|
+
stroke="#444444"
|
|
45
|
+
strokeLinecap="round"
|
|
46
|
+
strokeLinejoin="round"
|
|
47
|
+
data-cap="butt"
|
|
48
|
+
></circle>
|
|
49
|
+
</g>
|
|
50
|
+
</svg>
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
export const Props = ({ fields }) => (
|
|
54
|
+
<div style={ { marginTop: 16, display: "grid", gridGap: 24 } }>
|
|
55
|
+
{fields.map(({ name, type, def, example, comment }) => (
|
|
56
|
+
<div key={name}>
|
|
57
|
+
<div style={ { marginLeft: -18 } }>
|
|
58
|
+
{type.optional ? optional : required}
|
|
59
|
+
<span style={ { fontWeight: "bold" } }>{name}</span>{`: `}
|
|
60
|
+
<span>{type.name}</span>
|
|
61
|
+
{def && (
|
|
62
|
+
<>
|
|
63
|
+
{` = `}<span style={ { fontWeight: "bold" } }>{def}</span>
|
|
64
|
+
</>
|
|
65
|
+
)}
|
|
66
|
+
</div>
|
|
67
|
+
<div>{comment.shortText}</div>
|
|
68
|
+
{example && (
|
|
69
|
+
<div style={ { marginLeft: 0, marginTop: 8, color: "rgb(153, 153, 153)", fontSize: "0.8rem" } }>
|
|
70
|
+
Example: <span style={ { fontWeight: "bold" } }>{example}</span>
|
|
71
|
+
</div>
|
|
72
|
+
)}
|
|
73
|
+
</div>
|
|
74
|
+
))}
|
|
75
|
+
</div>
|
|
76
|
+
)
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Font } from "..";
|
|
2
|
+
import { Code } from "../../Code";
|
|
3
|
+
import { Viewport } from "../../Viewport";
|
|
4
|
+
|
|
5
|
+
# Font
|
|
6
|
+
|
|
7
|
+
<Sample variant="basic" />
|
|
8
|
+
|
|
9
|
+
<Font name="Heading 2" font={{ style: { fontFamily: "system-ui", fontWeight: 700, fontSize: "2vw", lineHeight: 1.3 } }}>
|
|
10
|
+
The basic structure of each upright letter remained the same in its italic companion.
|
|
11
|
+
</Font>
|
|
12
|
+
|
|
13
|
+
<Font name="Body 1" font={{ style: { fontFamily: "system-ui", fontSize: 18 } }}>
|
|
14
|
+
Originally called Neuste schmale fette Zeitungs-Grotesk, the design was listed in this catalogue as Enge fette Grotesque. It was a straight-sided sans serif with rounded terminals, and it bears no relation to any styles of Akzidenz-Grotesk. The remaining three sans serif designs in that undated, post-sale catalogue were Schmale magere Grotesque, Breite Grotesque, and Breite fette Grotesque.
|
|
15
|
+
</Font>
|
|
16
|
+
|
|
17
|
+
<Font name="Meta" font={{ style: { fontFamily: "system-ui", fontSize: 14 } }}>
|
|
18
|
+
Meta Text
|
|
19
|
+
</Font>
|
|
20
|
+
|
|
21
|
+
## Inside Viewport
|
|
22
|
+
|
|
23
|
+
<Viewport src="/docs/components/Font/samples/system" />
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Font } from "./Font";
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { useMDXComponents } from '@mdx-js/react';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import * as Icons from 'react-feather';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Takes a list of class names and filters for truthy ones, joining them into a single class name for convenience.
|
|
7
|
+
* eg.
|
|
8
|
+
* ```js
|
|
9
|
+
* cx('red', isBig && 'big') // returns 'red big' if `isBig` is true, otherwise returns 'red'
|
|
10
|
+
* ```
|
|
11
|
+
* If arguments provided are objects, these objects are merged together, and the values are taken as class names:
|
|
12
|
+
*
|
|
13
|
+
* ```js
|
|
14
|
+
* cx({ color: 'class1', textDecoration: 'class2'}, { color: 'class3' }) // returns `class3 class2`
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* @returns the combined, space separated class names that can be applied directly to the class attribute
|
|
18
|
+
*/
|
|
19
|
+
const cx = function cx() {
|
|
20
|
+
const presentClassNames = Array.prototype.slice.call(arguments).filter(Boolean); // In the basic case, `cx` is passed all strings, and we simply need to join them together with space separators
|
|
21
|
+
|
|
22
|
+
const classNamesResult = presentClassNames.filter(arg => typeof arg !== 'object'); // There might also be objects (eg. from the atomic API) such as cx('foo', {
|
|
23
|
+
// key1: 'bar', key2: 'fizz'}, { key1: 'buzz' }) the desired behavior is to
|
|
24
|
+
// deduplicate the values based on their properties. The object's values are
|
|
25
|
+
// the class names
|
|
26
|
+
|
|
27
|
+
const styleCollectionResult = Object.values(Object.assign({}, ...presentClassNames.filter(arg => typeof arg === 'object')));
|
|
28
|
+
return [...styleCollectionResult, ...classNamesResult].join(' ');
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* The underlying DOM element which is rendered by this component.
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
const Root = "div";
|
|
36
|
+
const classes = {
|
|
37
|
+
meta: "mby32tn"
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
function Font(props, ref) {
|
|
41
|
+
const components = {
|
|
42
|
+
h3: "h3",
|
|
43
|
+
...useMDXComponents()
|
|
44
|
+
};
|
|
45
|
+
const {
|
|
46
|
+
name,
|
|
47
|
+
font,
|
|
48
|
+
info,
|
|
49
|
+
className,
|
|
50
|
+
children,
|
|
51
|
+
...rest
|
|
52
|
+
} = props;
|
|
53
|
+
const [contentRef, setContentRef] = React.useState(null);
|
|
54
|
+
const [fontSizeRef, setFontSizeRef] = React.useState(null);
|
|
55
|
+
const [infoRef, setInfoRef] = React.useState(null);
|
|
56
|
+
React.useEffect(() => {
|
|
57
|
+
if (contentRef) {
|
|
58
|
+
const computedStyle = window.getComputedStyle(contentRef);
|
|
59
|
+
const intervalId = setInterval(() => {
|
|
60
|
+
if (fontSizeRef) {
|
|
61
|
+
const innerText = `${name} – ${Math.round(parseInt(computedStyle.fontSize))}px`;
|
|
62
|
+
|
|
63
|
+
if (fontSizeRef.innerText !== innerText) {
|
|
64
|
+
fontSizeRef.innerText = innerText;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}, 250);
|
|
68
|
+
return () => {
|
|
69
|
+
clearInterval(intervalId);
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
}, [name, contentRef]);
|
|
73
|
+
return /*#__PURE__*/React.createElement(Root, {
|
|
74
|
+
ref: ref,
|
|
75
|
+
className: cx(className, "rc7ivp5"),
|
|
76
|
+
...rest
|
|
77
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
78
|
+
className: classes.meta
|
|
79
|
+
}, /*#__PURE__*/React.createElement(components.h3, {
|
|
80
|
+
className: "fe58upx"
|
|
81
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
82
|
+
ref: setFontSizeRef
|
|
83
|
+
}, name)), info && /*#__PURE__*/React.createElement("div", {
|
|
84
|
+
className: "d10949ho",
|
|
85
|
+
onClick: () => {
|
|
86
|
+
if (infoRef && contentRef) {
|
|
87
|
+
// const contentParent = contentRef.parentElement;
|
|
88
|
+
const infoParent = infoRef.parentElement;
|
|
89
|
+
|
|
90
|
+
if (infoParent.style.height === "0px") {
|
|
91
|
+
infoParent.style.height = `${infoRef.getBoundingClientRect().height}px`;
|
|
92
|
+
infoParent.style.opacity = "1"; // contentParent.style.height = "0px";
|
|
93
|
+
// contentParent.style.opacity = "0";
|
|
94
|
+
} else {
|
|
95
|
+
infoParent.style.height = "0px";
|
|
96
|
+
infoParent.style.opacity = "0"; // contentParent.style.height = window.getComputedStyle(contentRef).height;
|
|
97
|
+
// contentParent.style.opacity = "1";
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}, /*#__PURE__*/React.createElement(Icons.Info, {
|
|
102
|
+
size: "1.1em"
|
|
103
|
+
}))), /*#__PURE__*/React.createElement("div", {
|
|
104
|
+
className: "d1o2du3z"
|
|
105
|
+
}, info && /*#__PURE__*/React.createElement("div", {
|
|
106
|
+
className: "d1o9zhgl",
|
|
107
|
+
style: {
|
|
108
|
+
height: 0,
|
|
109
|
+
opacity: 0
|
|
110
|
+
}
|
|
111
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
112
|
+
ref: setInfoRef,
|
|
113
|
+
className: "ddlplux"
|
|
114
|
+
}, info)), /*#__PURE__*/React.createElement("div", {
|
|
115
|
+
className: "dw285p4",
|
|
116
|
+
style: {
|
|
117
|
+
height: "auto",
|
|
118
|
+
opacity: 1
|
|
119
|
+
}
|
|
120
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
121
|
+
ref: setContentRef,
|
|
122
|
+
contentEditable: true,
|
|
123
|
+
spellCheck: "false",
|
|
124
|
+
className: cx(font.className, "dx3nfmc"),
|
|
125
|
+
style: font.style
|
|
126
|
+
}, children || "The quick brown fox jumps over the lazy dog"))));
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
var Font$1 = /*#__PURE__*/React.forwardRef(Font);
|
|
130
|
+
|
|
131
|
+
export { Font$1 as Font };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
.mby32tn{display:flex;align-items:baseline;font-size:0.9rem;font-weight:bold;transition:all 0.2s;}
|
|
2
|
+
.rc7ivp5{padding:16px 0;}
|
|
3
|
+
.fe58upx{margin:0 auto 0 0;}
|
|
4
|
+
.d10949ho{cursor:pointer;}.d10949ho:hover{color:var(--c-p-4);opacity:1;}.d10949ho > svg{position:relative;top:2px;}
|
|
5
|
+
.d1o2du3z{display:flex;flex-direction:column;}
|
|
6
|
+
.d1o9zhgl{overflow:hidden;transition:height 0.2s,opacity 0.2s 0.1s;}
|
|
7
|
+
.ddlplux{padding:0 0 16px;display:flex;flex-direction:column;}
|
|
8
|
+
.dw285p4{overflow:hidden;transition:height 0.2s,opacity 0.2s 0.1s;}
|
|
9
|
+
.dx3nfmc{outline:none;user-select:text;white-space:pre-wrap;overflow-wrap:break-word;}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* The underlying DOM element which is rendered by this component.
|
|
4
|
+
*/
|
|
5
|
+
declare const Root = "div";
|
|
6
|
+
interface Props extends React.ComponentProps<typeof Root> {
|
|
7
|
+
}
|
|
8
|
+
declare const _default: React.ForwardRefExoticComponent<Pick<Props, "key" | "dir" | "onError" | "hidden" | "color" | "style" | "translate" | "prefix" | "slot" | "title" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "draggable" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture"> & React.RefAttributes<HTMLDivElement>>;
|
|
9
|
+
export default _default;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# API
|
|
2
|
+
|
|
3
|
+
<div style={ { display: "grid", gridTemplateColumns: "min-content 1fr" } }>
|
|
4
|
+
<div style={ { fontWeight: "bold", marginRight: 16 } }>Root:</div>
|
|
5
|
+
<div>{`<div>`}</div>
|
|
6
|
+
<div style={ { fontWeight: "bold", marginRight: 16 } }>Ref:</div>
|
|
7
|
+
<div>Forward <span style={ { color: "rgb(153, 153, 153)" } }>(HTMLDivElement)</span></div>
|
|
8
|
+
</div>
|
|
9
|
+
|
|
10
|
+
## Props
|
|
11
|
+
|
|
12
|
+
<Props {...{"fields":[]}} />
|
|
13
|
+
|
|
14
|
+
export const required = (
|
|
15
|
+
<svg
|
|
16
|
+
x="0px"
|
|
17
|
+
y="0px"
|
|
18
|
+
width="10px"
|
|
19
|
+
height="10px"
|
|
20
|
+
viewBox="0 0 16 16"
|
|
21
|
+
style={ { position: "relative", top: 0, display: "inline-block", marginRight: 8 } }
|
|
22
|
+
>
|
|
23
|
+
<g transform="translate(0, 0)">
|
|
24
|
+
<circle cx="8" cy="8" r="8" fill="#444444"></circle>
|
|
25
|
+
</g>
|
|
26
|
+
</svg>
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
export const optional = (
|
|
30
|
+
<svg
|
|
31
|
+
x="0px"
|
|
32
|
+
y="0px"
|
|
33
|
+
width="10px"
|
|
34
|
+
height="10px"
|
|
35
|
+
viewBox="0 0 16 16"
|
|
36
|
+
style={ { position: "relative", top: 0, display: "inline-block", marginRight: 8 } }
|
|
37
|
+
>
|
|
38
|
+
<g transform="translate(0, 0)">
|
|
39
|
+
<circle
|
|
40
|
+
cx="8"
|
|
41
|
+
cy="8"
|
|
42
|
+
r="7.5"
|
|
43
|
+
fill="none"
|
|
44
|
+
stroke="#444444"
|
|
45
|
+
strokeLinecap="round"
|
|
46
|
+
strokeLinejoin="round"
|
|
47
|
+
data-cap="butt"
|
|
48
|
+
></circle>
|
|
49
|
+
</g>
|
|
50
|
+
</svg>
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
export const Props = ({ fields }) => (
|
|
54
|
+
<div style={ { marginTop: 16, display: "grid", gridGap: 24 } }>
|
|
55
|
+
{fields.map(({ name, type, def, example, comment }) => (
|
|
56
|
+
<div key={name}>
|
|
57
|
+
<div style={ { marginLeft: -18 } }>
|
|
58
|
+
{type.optional ? optional : required}
|
|
59
|
+
<span style={ { fontWeight: "bold" } }>{name}</span>{`: `}
|
|
60
|
+
<span>{type.name}</span>
|
|
61
|
+
{def && (
|
|
62
|
+
<>
|
|
63
|
+
{` = `}<span style={ { fontWeight: "bold" } }>{def}</span>
|
|
64
|
+
</>
|
|
65
|
+
)}
|
|
66
|
+
</div>
|
|
67
|
+
<div>{comment.shortText}</div>
|
|
68
|
+
{example && (
|
|
69
|
+
<div style={ { marginLeft: 0, marginTop: 8, color: "rgb(153, 153, 153)", fontSize: "0.8rem" } }>
|
|
70
|
+
Example: <span style={ { fontWeight: "bold" } }>{example}</span>
|
|
71
|
+
</div>
|
|
72
|
+
)}
|
|
73
|
+
</div>
|
|
74
|
+
))}
|
|
75
|
+
</div>
|
|
76
|
+
)
|