@monimesl/dot-renderer-react 1.0.0-beta.0 → 1.0.0-beta.10
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 +3 -3
- package/dist/components/amount-input.js +1 -1
- package/dist/components/avatar.js +1 -1
- package/dist/components/box.js +9 -3
- package/dist/components/button.js +64 -14
- package/dist/components/carousel.js +65 -50
- package/dist/components/chip.js +4 -5
- package/dist/components/code-input.js +1 -1
- package/dist/components/detail-row.js +5 -5
- package/dist/components/disclosure.js +11 -6
- package/dist/components/empty-state.js +7 -6
- package/dist/components/feedback.js +7 -7
- package/dist/components/field-box.js +1 -1
- package/dist/components/field.js +5 -4
- package/dist/components/footer.js +6 -11
- package/dist/components/grid.js +25 -15
- package/dist/components/hidden-view.js +5 -0
- package/dist/components/icon-button.js +1 -1
- package/dist/components/icon.js +32 -5
- package/dist/components/index.d.ts +2 -1
- package/dist/components/index.js +3 -1
- package/dist/components/input.js +1 -1
- package/dist/components/link.js +11 -3
- package/dist/components/list.js +62 -33
- package/dist/components/option.js +6 -5
- package/dist/components/padding.js +9 -10
- package/dist/components/pinned-bar.js +29 -0
- package/dist/components/pinned.d.ts +6 -0
- package/dist/components/pinned.js +26 -0
- package/dist/components/pressable.js +3 -1
- package/dist/components/prose.js +23 -20
- package/dist/components/rich-text.js +30 -18
- package/dist/components/scroll.js +33 -10
- package/dist/components/select.js +1 -1
- package/dist/components/sheet.js +55 -46
- package/dist/components/side-room.js +5 -0
- package/dist/components/skeleton.js +1 -1
- package/dist/components/slider.js +3 -3
- package/dist/components/spinner.js +1 -1
- package/dist/components/stack.js +12 -8
- package/dist/components/stepper.js +4 -5
- package/dist/components/steps.js +17 -14
- package/dist/components/tabs.js +74 -27
- package/dist/components/text.js +12 -14
- package/dist/components/toast.js +3 -3
- package/dist/components/toggles.js +14 -11
- package/dist/components/tokens.d.ts +16 -0
- package/dist/components/tokens.js +26 -1
- package/dist/components/view.js +40 -18
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/page-root.js +9 -3
- package/dist/pull-to-refresh.js +1 -1
- package/dist/root.js +4 -3
- package/dist/styles.css +1 -1
- package/dist/theme.d.ts +12 -1
- package/dist/theme.js +85 -15
- package/package.json +4 -4
package/dist/components/grid.js
CHANGED
|
@@ -1,25 +1,32 @@
|
|
|
1
|
+
import { CARD_RADIUS_SCALE, CENTERED, DISABLED_OPACITY, PILL_STYLE } from "./tokens.js";
|
|
1
2
|
import { useTheme } from "../theme.js";
|
|
2
|
-
import { CARD_RADIUS_SCALE, CENTERED, FONT_SIZE, PILL_STYLE, SPACE } from "./tokens.js";
|
|
3
3
|
import { wholeCount } from "./numbers.js";
|
|
4
4
|
import { paddingStyle } from "./padding.js";
|
|
5
|
+
import { SideRoomContext } from "./side-room.js";
|
|
5
6
|
import { IconGraphic } from "./icon.js";
|
|
6
7
|
import { pressable } from "./pressable.js";
|
|
7
8
|
import { createEvent } from "@monimesl/dot-core";
|
|
8
9
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
10
|
//#region src/components/grid.tsx
|
|
10
11
|
const TILE_SIZE = 52;
|
|
11
|
-
const Grid$1 = ({ columns = 4, gap = "medium", children, ...padding }) =>
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
|
|
12
|
+
const Grid$1 = ({ columns = 4, gap = "medium", children, ...padding }) => {
|
|
13
|
+
const { space } = useTheme();
|
|
14
|
+
return /* @__PURE__ */ jsx("div", {
|
|
15
|
+
className: "dot-grid",
|
|
16
|
+
style: {
|
|
17
|
+
display: "grid",
|
|
18
|
+
gridTemplateColumns: `repeat(${wholeCount(columns)}, minmax(0, 1fr))`,
|
|
19
|
+
gap: space[gap],
|
|
20
|
+
...paddingStyle(padding, space)
|
|
21
|
+
},
|
|
22
|
+
children: /* @__PURE__ */ jsx(SideRoomContext.Provider, {
|
|
23
|
+
value: false,
|
|
24
|
+
children
|
|
25
|
+
})
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
const GridItem$1 = ({ label, icon, image, badge, disabled = false, onTap }) => {
|
|
29
|
+
const { colors, radius, fontSize } = useTheme();
|
|
23
30
|
let picture = null;
|
|
24
31
|
if (image) picture = /* @__PURE__ */ jsx("img", {
|
|
25
32
|
src: image,
|
|
@@ -39,9 +46,11 @@ const GridItem$1 = ({ label, icon, image, badge, onTap }) => {
|
|
|
39
46
|
size: 24,
|
|
40
47
|
color: "currentColor"
|
|
41
48
|
});
|
|
42
|
-
const press = onTap ? pressable(() => onTap(createEvent("tap"))) : void 0;
|
|
49
|
+
const press = onTap && !disabled ? pressable(() => onTap(createEvent("tap"))) : void 0;
|
|
43
50
|
return /* @__PURE__ */ jsxs("div", {
|
|
44
51
|
className: "dot-grid-item",
|
|
52
|
+
role: onTap ? "button" : void 0,
|
|
53
|
+
"aria-disabled": disabled || void 0,
|
|
45
54
|
...press,
|
|
46
55
|
style: {
|
|
47
56
|
position: "relative",
|
|
@@ -50,6 +59,7 @@ const GridItem$1 = ({ label, icon, image, badge, onTap }) => {
|
|
|
50
59
|
alignItems: "center",
|
|
51
60
|
gap: 6,
|
|
52
61
|
padding: "4px 0",
|
|
62
|
+
opacity: disabled ? DISABLED_OPACITY : void 0,
|
|
53
63
|
cursor: press ? "pointer" : void 0
|
|
54
64
|
},
|
|
55
65
|
children: [/* @__PURE__ */ jsxs("span", {
|
|
@@ -85,7 +95,7 @@ const GridItem$1 = ({ label, icon, image, badge, onTap }) => {
|
|
|
85
95
|
WebkitLineClamp: 2,
|
|
86
96
|
WebkitBoxOrient: "vertical",
|
|
87
97
|
color: colors.text,
|
|
88
|
-
fontSize:
|
|
98
|
+
fontSize: fontSize.caption,
|
|
89
99
|
lineHeight: "normal",
|
|
90
100
|
textAlign: "center"
|
|
91
101
|
},
|
package/dist/components/icon.js
CHANGED
|
@@ -1,24 +1,51 @@
|
|
|
1
|
-
import { useTheme } from "../theme.js";
|
|
2
1
|
import { ICON_SIZE } from "./tokens.js";
|
|
2
|
+
import { useTheme } from "../theme.js";
|
|
3
3
|
import { ICON_ARTWORK } from "./icon-artwork.js";
|
|
4
4
|
import { IconSvg } from "./icon-svg.js";
|
|
5
|
-
import {
|
|
5
|
+
import { textToneColor } from "./box.js";
|
|
6
6
|
import { jsx } from "react/jsx-runtime";
|
|
7
7
|
//#region src/components/icon.tsx
|
|
8
|
+
const ICON_PATH = /^statics\/(?!.*\.\.)[\w./-]+\.svg$/i;
|
|
9
|
+
const unknownIcons = /* @__PURE__ */ new Set();
|
|
8
10
|
function IconGraphic({ name, size, color }) {
|
|
9
|
-
|
|
11
|
+
const { icons } = useTheme();
|
|
12
|
+
if (Object.hasOwn(ICON_ARTWORK, name)) return /* @__PURE__ */ jsx(IconSvg, {
|
|
10
13
|
artwork: ICON_ARTWORK[name],
|
|
11
14
|
size,
|
|
12
15
|
color
|
|
13
16
|
});
|
|
17
|
+
const path = Object.hasOwn(icons, name) ? icons[name] : void 0;
|
|
18
|
+
if (path === void 0 || !ICON_PATH.test(path)) {
|
|
19
|
+
if (!unknownIcons.has(name)) {
|
|
20
|
+
unknownIcons.add(name);
|
|
21
|
+
console.warn(`The theme has no icon named "${name}". Add it to theme.icons in dot.ts.`);
|
|
22
|
+
}
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
const mask = `url("${path}") center / contain no-repeat`;
|
|
26
|
+
return /* @__PURE__ */ jsx("span", {
|
|
27
|
+
className: "dot-icon",
|
|
28
|
+
"aria-hidden": "true",
|
|
29
|
+
style: {
|
|
30
|
+
display: "inline-flex",
|
|
31
|
+
width: size,
|
|
32
|
+
height: size,
|
|
33
|
+
verticalAlign: "middle",
|
|
34
|
+
flexShrink: 0,
|
|
35
|
+
backgroundColor: color,
|
|
36
|
+
mask,
|
|
37
|
+
WebkitMask: mask
|
|
38
|
+
}
|
|
39
|
+
});
|
|
14
40
|
}
|
|
15
41
|
const Icon = ({ name, size = "medium", tone = "default" }) => {
|
|
16
|
-
const
|
|
42
|
+
const theme = useTheme();
|
|
17
43
|
if (!name) return null;
|
|
44
|
+
const color = textToneColor(tone, theme) ?? theme.colors.text;
|
|
18
45
|
return /* @__PURE__ */ jsx(IconGraphic, {
|
|
19
46
|
name,
|
|
20
47
|
size: ICON_SIZE[size],
|
|
21
|
-
color
|
|
48
|
+
color
|
|
22
49
|
});
|
|
23
50
|
};
|
|
24
51
|
//#endregion
|
|
@@ -17,6 +17,7 @@ import { Input } from "./input.js";
|
|
|
17
17
|
import { Link } from "./link.js";
|
|
18
18
|
import { List, ListItem } from "./list.js";
|
|
19
19
|
import { Option } from "./option.js";
|
|
20
|
+
import { Pinned } from "./pinned.js";
|
|
20
21
|
import { Bullet, BulletList, Prose, Quote } from "./prose.js";
|
|
21
22
|
import { QRCode } from "./qr-code.js";
|
|
22
23
|
import { RichText } from "./rich-text.js";
|
|
@@ -35,4 +36,4 @@ import { TextArea } from "./text-area.js";
|
|
|
35
36
|
import { Toast } from "./toast.js";
|
|
36
37
|
import { Checkbox, Radio, RadioGroup, Switch } from "./toggles.js";
|
|
37
38
|
import { View } from "./view.js";
|
|
38
|
-
export { AmountInput, Avatar, Badge, Bullet, BulletList, Button, Carousel, Checkbox, Chip, CodeInput, DetailRow, Disclosure, Divider, EmptyState, Footer, Grid, GridItem, Icon, Image, Input, Link, List, ListItem, Notice, Option, ProgressBar, Prose, QRCode, Quote, Radio, RadioGroup, RichText, Scroll, Select, Sheet, Skeleton, Slider, Spinner, Stack, Step, Stepper, Steps, Switch, Tab, Tabs, Text, TextArea, Toast, View };
|
|
39
|
+
export { AmountInput, Avatar, Badge, Bullet, BulletList, Button, Carousel, Checkbox, Chip, CodeInput, DetailRow, Disclosure, Divider, EmptyState, Footer, Grid, GridItem, Icon, Image, Input, Link, List, ListItem, Notice, Option, Pinned, ProgressBar, Prose, QRCode, Quote, Radio, RadioGroup, RichText, Scroll, Select, Sheet, Skeleton, Slider, Spinner, Stack, Step, Stepper, Steps, Switch, Tab, Tabs, Text, TextArea, Toast, View };
|
package/dist/components/index.js
CHANGED
|
@@ -19,6 +19,7 @@ import { Input } from "./input.js";
|
|
|
19
19
|
import { Link } from "./link.js";
|
|
20
20
|
import { List, ListItem } from "./list.js";
|
|
21
21
|
import { Option } from "./option.js";
|
|
22
|
+
import { Pinned } from "./pinned.js";
|
|
22
23
|
import { Bullet, BulletList, Prose, Quote } from "./prose.js";
|
|
23
24
|
import { QRCode } from "./qr-code.js";
|
|
24
25
|
import { Text } from "./text.js";
|
|
@@ -63,6 +64,7 @@ var components_exports = /* @__PURE__ */ __exportAll({
|
|
|
63
64
|
ListItem: () => ListItem,
|
|
64
65
|
Notice: () => Notice,
|
|
65
66
|
Option: () => Option,
|
|
67
|
+
Pinned: () => Pinned,
|
|
66
68
|
ProgressBar: () => ProgressBar,
|
|
67
69
|
Prose: () => Prose,
|
|
68
70
|
QRCode: () => QRCode,
|
|
@@ -89,4 +91,4 @@ var components_exports = /* @__PURE__ */ __exportAll({
|
|
|
89
91
|
View: () => View
|
|
90
92
|
});
|
|
91
93
|
//#endregion
|
|
92
|
-
export { AmountInput, Avatar, Badge, Bullet, BulletList, Button, Carousel, Checkbox, Chip, CodeInput, DetailRow, Disclosure, Divider, EmptyState, Footer, Grid, GridItem, Icon, Image, Input, Link, List, ListItem, Notice, Option, ProgressBar, Prose, QRCode, Quote, Radio, RadioGroup, RichText, Scroll, Select, Sheet, Skeleton, Slider, Spinner, Stack, Step, Stepper, Steps, Switch, Tab, Tabs, Text, TextArea, Toast, View, components_exports };
|
|
94
|
+
export { AmountInput, Avatar, Badge, Bullet, BulletList, Button, Carousel, Checkbox, Chip, CodeInput, DetailRow, Disclosure, Divider, EmptyState, Footer, Grid, GridItem, Icon, Image, Input, Link, List, ListItem, Notice, Option, Pinned, ProgressBar, Prose, QRCode, Quote, Radio, RadioGroup, RichText, Scroll, Select, Sheet, Skeleton, Slider, Spinner, Stack, Step, Stepper, Steps, Switch, Tab, Tabs, Text, TextArea, Toast, View, components_exports };
|
package/dist/components/input.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useTheme } from "../theme.js";
|
|
2
1
|
import { ICON_SIZE, SPACE } from "./tokens.js";
|
|
2
|
+
import { useTheme } from "../theme.js";
|
|
3
3
|
import { Field } from "./field.js";
|
|
4
4
|
import { BARE_INPUT_STYLE, useFieldBox, useFieldNote } from "./field-box.js";
|
|
5
5
|
import { useTypedText } from "./typed-text.js";
|
package/dist/components/link.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { pressLook } from "./tokens.js";
|
|
1
2
|
import { useTheme } from "../theme.js";
|
|
2
3
|
import { toneColor } from "./tones.js";
|
|
3
4
|
import { pressable } from "./pressable.js";
|
|
@@ -5,14 +6,21 @@ import { isHttps } from "./https.js";
|
|
|
5
6
|
import { createEvent } from "@monimesl/dot-core";
|
|
6
7
|
import { jsx } from "react/jsx-runtime";
|
|
7
8
|
//#region src/components/link.tsx
|
|
8
|
-
const Link$1 = ({ href, tone, onTap, children }) => {
|
|
9
|
+
const Link$1 = ({ href, tone, disabled, onTap, children }) => {
|
|
9
10
|
const { colors } = useTheme();
|
|
10
11
|
const style = {
|
|
11
|
-
color: tone ? toneColor(colors, tone) : colors.
|
|
12
|
+
color: tone ? toneColor(colors, tone) : colors.primaryText,
|
|
12
13
|
textDecorationLine: "underline",
|
|
13
14
|
textUnderlineOffset: "2px",
|
|
14
|
-
|
|
15
|
+
...pressLook(disabled)
|
|
15
16
|
};
|
|
17
|
+
if (disabled) return /* @__PURE__ */ jsx("span", {
|
|
18
|
+
className: "dot-link",
|
|
19
|
+
role: "link",
|
|
20
|
+
"aria-disabled": true,
|
|
21
|
+
style,
|
|
22
|
+
children
|
|
23
|
+
});
|
|
16
24
|
if (isHttps(href)) return /* @__PURE__ */ jsx("a", {
|
|
17
25
|
className: "dot-link",
|
|
18
26
|
href,
|
package/dist/components/list.js
CHANGED
|
@@ -1,16 +1,34 @@
|
|
|
1
|
+
import { CARD_RADIUS_SCALE, CENTERED, DISABLED_OPACITY, ICON_SIZE, SHADOWS, WEIGHTS, pressLook } from "./tokens.js";
|
|
1
2
|
import { useTheme } from "../theme.js";
|
|
2
|
-
import { CARD_RADIUS_SCALE, CENTERED, FONT_SIZE, ICON_SIZE, WEIGHTS } from "./tokens.js";
|
|
3
3
|
import { CHEVRON_RIGHT_ARTWORK } from "./icon-artwork.js";
|
|
4
4
|
import { IconSvg } from "./icon-svg.js";
|
|
5
5
|
import { insets, paddingStyle } from "./padding.js";
|
|
6
6
|
import { IconGraphic } from "./icon.js";
|
|
7
7
|
import { createEvent } from "@monimesl/dot-core";
|
|
8
|
-
import { useEffect, useRef } from "react";
|
|
8
|
+
import { createContext, useContext, useEffect, useRef } from "react";
|
|
9
9
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
10
10
|
//#region src/components/list.tsx
|
|
11
11
|
const END_MARGIN = "0px 0px 200px 0px";
|
|
12
|
-
const
|
|
13
|
-
|
|
12
|
+
const ROW_SIZES = {
|
|
13
|
+
sm: {
|
|
14
|
+
block: 12,
|
|
15
|
+
gap: 12,
|
|
16
|
+
image: 40,
|
|
17
|
+
icon: 36,
|
|
18
|
+
glyph: ICON_SIZE.medium
|
|
19
|
+
},
|
|
20
|
+
md: {
|
|
21
|
+
block: 16,
|
|
22
|
+
gap: 16,
|
|
23
|
+
image: 48,
|
|
24
|
+
icon: 44,
|
|
25
|
+
glyph: ICON_SIZE.large
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
const ListSizeContext = createContext("sm");
|
|
29
|
+
const List$1 = ({ size = "sm", onEndReached, children, ...padding }) => {
|
|
30
|
+
const { colors, radius, space, elevation, scheme } = useTheme();
|
|
31
|
+
const raised = elevation === "raised";
|
|
14
32
|
const listRef = useRef(null);
|
|
15
33
|
const lastRowReached = useRef(null);
|
|
16
34
|
useEffect(() => {
|
|
@@ -25,32 +43,37 @@ const List$1 = ({ onEndReached, children, ...padding }) => {
|
|
|
25
43
|
observer.observe(lastRow);
|
|
26
44
|
return () => observer.disconnect();
|
|
27
45
|
});
|
|
28
|
-
return /* @__PURE__ */ jsx(
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
46
|
+
return /* @__PURE__ */ jsx(ListSizeContext.Provider, {
|
|
47
|
+
value: Object.hasOwn(ROW_SIZES, size) ? size : "sm",
|
|
48
|
+
children: /* @__PURE__ */ jsx("ul", {
|
|
49
|
+
ref: listRef,
|
|
50
|
+
className: "dot-list",
|
|
51
|
+
style: {
|
|
52
|
+
display: "flex",
|
|
53
|
+
flexDirection: "column",
|
|
54
|
+
margin: 0,
|
|
55
|
+
...paddingStyle(padding, space),
|
|
56
|
+
overflow: "hidden",
|
|
57
|
+
listStyle: "none",
|
|
58
|
+
borderRadius: radius * CARD_RADIUS_SCALE,
|
|
59
|
+
border: raised ? "none" : `1px solid ${colors.border}`,
|
|
60
|
+
boxShadow: raised ? SHADOWS[scheme].low : void 0,
|
|
61
|
+
background: colors.surface,
|
|
62
|
+
"--dot-list-divider": colors.border
|
|
63
|
+
},
|
|
64
|
+
children
|
|
65
|
+
})
|
|
44
66
|
});
|
|
45
67
|
};
|
|
46
|
-
const ListItem$1 = ({ title, subtitle, value, icon, image, onTap, children, ...padding }) => {
|
|
47
|
-
const { colors, radius } = useTheme();
|
|
68
|
+
const ListItem$1 = ({ title, subtitle, value, icon, image, disabled = false, onTap, children, ...padding }) => {
|
|
69
|
+
const { colors, radius, space, fontSize } = useTheme();
|
|
70
|
+
const rowSize = ROW_SIZES[useContext(ListSizeContext)];
|
|
48
71
|
let leading = null;
|
|
49
72
|
if (image) leading = /* @__PURE__ */ jsx("img", {
|
|
50
73
|
src: image,
|
|
51
74
|
alt: "",
|
|
52
|
-
width:
|
|
53
|
-
height:
|
|
75
|
+
width: rowSize.image,
|
|
76
|
+
height: rowSize.image,
|
|
54
77
|
style: {
|
|
55
78
|
borderRadius: radius,
|
|
56
79
|
objectFit: "cover",
|
|
@@ -60,15 +83,15 @@ const ListItem$1 = ({ title, subtitle, value, icon, image, onTap, children, ...p
|
|
|
60
83
|
else if (icon) leading = /* @__PURE__ */ jsx("span", {
|
|
61
84
|
style: {
|
|
62
85
|
...CENTERED,
|
|
63
|
-
width:
|
|
64
|
-
height:
|
|
86
|
+
width: rowSize.icon,
|
|
87
|
+
height: rowSize.icon,
|
|
65
88
|
borderRadius: "50%",
|
|
66
89
|
background: colors.muted,
|
|
67
90
|
flexShrink: 0
|
|
68
91
|
},
|
|
69
92
|
children: /* @__PURE__ */ jsx(IconGraphic, {
|
|
70
93
|
name: icon,
|
|
71
|
-
size:
|
|
94
|
+
size: rowSize.glyph,
|
|
72
95
|
color: colors.text
|
|
73
96
|
})
|
|
74
97
|
});
|
|
@@ -91,7 +114,7 @@ const ListItem$1 = ({ title, subtitle, value, icon, image, onTap, children, ...p
|
|
|
91
114
|
children: title
|
|
92
115
|
}) : null, subtitle ? /* @__PURE__ */ jsx("span", {
|
|
93
116
|
style: {
|
|
94
|
-
fontSize:
|
|
117
|
+
fontSize: fontSize.caption,
|
|
95
118
|
lineHeight: "normal",
|
|
96
119
|
color: colors.subtle
|
|
97
120
|
},
|
|
@@ -99,6 +122,7 @@ const ListItem$1 = ({ title, subtitle, value, icon, image, onTap, children, ...p
|
|
|
99
122
|
}) : null]
|
|
100
123
|
}),
|
|
101
124
|
trailing || onTap ? /* @__PURE__ */ jsxs("div", {
|
|
125
|
+
inert: disabled,
|
|
102
126
|
style: {
|
|
103
127
|
display: "flex",
|
|
104
128
|
alignItems: "center",
|
|
@@ -116,24 +140,29 @@ const ListItem$1 = ({ title, subtitle, value, icon, image, onTap, children, ...p
|
|
|
116
140
|
const rowStyle = {
|
|
117
141
|
display: "flex",
|
|
118
142
|
alignItems: "center",
|
|
119
|
-
gap:
|
|
120
|
-
...paddingStyle(padding, insets(
|
|
143
|
+
gap: rowSize.gap,
|
|
144
|
+
...paddingStyle(padding, space, insets(rowSize.block, 16)),
|
|
121
145
|
width: "100%",
|
|
122
146
|
background: colors.surface,
|
|
123
147
|
color: colors.text,
|
|
124
|
-
fontSize:
|
|
148
|
+
fontSize: fontSize.body,
|
|
125
149
|
textAlign: "start"
|
|
126
150
|
};
|
|
127
151
|
return /* @__PURE__ */ jsx("li", {
|
|
128
152
|
className: "dot-list-item",
|
|
129
|
-
|
|
153
|
+
"aria-disabled": disabled || void 0,
|
|
154
|
+
style: onTap ? { background: colors.surface } : {
|
|
155
|
+
...rowStyle,
|
|
156
|
+
opacity: disabled ? DISABLED_OPACITY : 1
|
|
157
|
+
},
|
|
130
158
|
children: onTap ? /* @__PURE__ */ jsx("button", {
|
|
131
159
|
type: "button",
|
|
160
|
+
disabled,
|
|
132
161
|
onClick: () => onTap(createEvent("tap")),
|
|
133
162
|
style: {
|
|
134
163
|
...rowStyle,
|
|
135
164
|
border: "none",
|
|
136
|
-
|
|
165
|
+
...pressLook(disabled)
|
|
137
166
|
},
|
|
138
167
|
children: content
|
|
139
168
|
}) : content
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
+
import { ICON_SIZE, WEIGHTS, pressLook } from "./tokens.js";
|
|
1
2
|
import { useTheme } from "../theme.js";
|
|
2
|
-
import { FONT_SIZE, ICON_SIZE, WEIGHTS } from "./tokens.js";
|
|
3
3
|
import { CHECK_ARTWORK } from "./icon-artwork.js";
|
|
4
4
|
import { IconSvg } from "./icon-svg.js";
|
|
5
5
|
import { OptionPlaceContext } from "./option-place.js";
|
|
6
6
|
import { useContext } from "react";
|
|
7
7
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
8
8
|
//#region src/components/option.tsx
|
|
9
|
-
const Option = ({ value, label }) => {
|
|
10
|
-
const { colors } = useTheme();
|
|
9
|
+
const Option = ({ value, label, disabled }) => {
|
|
10
|
+
const { colors, fontSize } = useTheme();
|
|
11
11
|
const place = useContext(OptionPlaceContext);
|
|
12
12
|
const chosen = value !== void 0 && value === place.value;
|
|
13
13
|
if (place.inField) return chosen ? /* @__PURE__ */ jsx(Fragment$1, { children: label }) : null;
|
|
@@ -17,6 +17,7 @@ const Option = ({ value, label }) => {
|
|
|
17
17
|
className: "dot-option",
|
|
18
18
|
role: "option",
|
|
19
19
|
"aria-selected": chosen,
|
|
20
|
+
disabled,
|
|
20
21
|
onClick: choose && value !== void 0 ? () => choose(value) : void 0,
|
|
21
22
|
style: {
|
|
22
23
|
display: "flex",
|
|
@@ -28,10 +29,10 @@ const Option = ({ value, label }) => {
|
|
|
28
29
|
borderBottom: `1px solid ${colors.border}`,
|
|
29
30
|
background: "transparent",
|
|
30
31
|
color: colors.text,
|
|
31
|
-
fontSize:
|
|
32
|
+
fontSize: fontSize.body,
|
|
32
33
|
fontWeight: chosen ? WEIGHTS.bold : WEIGHTS.regular,
|
|
33
34
|
textAlign: "start",
|
|
34
|
-
|
|
35
|
+
...pressLook(disabled)
|
|
35
36
|
},
|
|
36
37
|
children: [/* @__PURE__ */ jsx("span", { children: label }), chosen ? /* @__PURE__ */ jsx(IconSvg, {
|
|
37
38
|
artwork: CHECK_ARTWORK,
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { SPACE } from "./tokens.js";
|
|
2
1
|
//#region src/components/padding.ts
|
|
3
2
|
const NO_INSETS = {
|
|
4
3
|
top: 0,
|
|
@@ -14,21 +13,21 @@ function insets(block, inline = block) {
|
|
|
14
13
|
bottom: block
|
|
15
14
|
};
|
|
16
15
|
}
|
|
17
|
-
function paddingStyle(props, ownInsets = NO_INSETS) {
|
|
16
|
+
function paddingStyle(props, space, ownInsets = NO_INSETS) {
|
|
18
17
|
return {
|
|
19
|
-
paddingTop: sidePadding(props.paddingTop ?? props.padding, ownInsets.top),
|
|
20
|
-
paddingInlineStart: sidePadding(props.paddingStart ?? props.padding, ownInsets.start),
|
|
21
|
-
paddingInlineEnd: sidePadding(props.paddingEnd ?? props.padding, ownInsets.end),
|
|
22
|
-
paddingBottom: sidePadding(props.paddingBottom ?? props.padding, ownInsets.bottom)
|
|
18
|
+
paddingTop: sidePadding(props.paddingTop ?? props.padding, space, ownInsets.top),
|
|
19
|
+
paddingInlineStart: sidePadding(props.paddingStart ?? props.padding, space, ownInsets.start),
|
|
20
|
+
paddingInlineEnd: sidePadding(props.paddingEnd ?? props.padding, space, ownInsets.end),
|
|
21
|
+
paddingBottom: sidePadding(props.paddingBottom ?? props.padding, space, ownInsets.bottom)
|
|
23
22
|
};
|
|
24
23
|
}
|
|
25
|
-
function sidePadding(pageSpace, ownPixels) {
|
|
24
|
+
function sidePadding(pageSpace, space, ownPixels) {
|
|
26
25
|
if (pageSpace === void 0) return ownPixels;
|
|
27
|
-
return
|
|
26
|
+
return space[pageSpace];
|
|
28
27
|
}
|
|
29
28
|
const HOME_INDICATOR = "env(safe-area-inset-bottom, 0px)";
|
|
30
|
-
function pinnedPaddingStyle(props, ownInsets) {
|
|
31
|
-
const style = paddingStyle(props, ownInsets);
|
|
29
|
+
function pinnedPaddingStyle(props, space, ownInsets) {
|
|
30
|
+
const style = paddingStyle(props, space, ownInsets);
|
|
32
31
|
return {
|
|
33
32
|
...style,
|
|
34
33
|
paddingBottom: `calc(${style.paddingBottom}px + ${HOME_INDICATOR})`
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { insets, paddingStyle, pinnedPaddingStyle } from "./padding.js";
|
|
2
|
+
//#region src/components/pinned-bar.ts
|
|
3
|
+
const STATUS_BAR = "env(safe-area-inset-top, 0px)";
|
|
4
|
+
function pinnedBarStyle(edge, padding, space, ownInsets = insets(0)) {
|
|
5
|
+
let edgeStyle;
|
|
6
|
+
if (edge === "top") edgeStyle = {
|
|
7
|
+
...paddingStyle(padding, space, ownInsets),
|
|
8
|
+
top: STATUS_BAR
|
|
9
|
+
};
|
|
10
|
+
else edgeStyle = {
|
|
11
|
+
...pinnedPaddingStyle(padding, space, ownInsets),
|
|
12
|
+
bottom: 0,
|
|
13
|
+
marginTop: "auto"
|
|
14
|
+
};
|
|
15
|
+
return {
|
|
16
|
+
...edgeStyle,
|
|
17
|
+
position: "sticky",
|
|
18
|
+
zIndex: 1,
|
|
19
|
+
display: "flex",
|
|
20
|
+
flexDirection: "column",
|
|
21
|
+
alignSelf: "stretch",
|
|
22
|
+
marginInlineStart: "calc(-1 * var(--dot-view-start, 0px))",
|
|
23
|
+
marginInlineEnd: "calc(-1 * var(--dot-view-end, 0px))",
|
|
24
|
+
paddingInlineStart: `calc(var(--dot-view-start, 0px) + ${edgeStyle.paddingInlineStart}px)`,
|
|
25
|
+
paddingInlineEnd: `calc(var(--dot-view-end, 0px) + ${edgeStyle.paddingInlineEnd}px)`
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
//#endregion
|
|
29
|
+
export { pinnedBarStyle };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { useTheme } from "../theme.js";
|
|
2
|
+
import { backgroundColor } from "./box.js";
|
|
3
|
+
import { pinnedBarStyle } from "./pinned-bar.js";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/pinned.tsx
|
|
6
|
+
const Pinned = ({ edge = "top", gap = "medium", background = "background", border = "none", children, ...padding }) => {
|
|
7
|
+
const theme = useTheme();
|
|
8
|
+
const { colors, space } = theme;
|
|
9
|
+
const style = {
|
|
10
|
+
...pinnedBarStyle(edge, padding, space),
|
|
11
|
+
gap: space[gap],
|
|
12
|
+
background: backgroundColor(background, theme)
|
|
13
|
+
};
|
|
14
|
+
if (border !== "none") {
|
|
15
|
+
const line = `1px solid ${border === "strong" ? colors.subtle : colors.border}`;
|
|
16
|
+
if (edge === "top") style.borderBottom = line;
|
|
17
|
+
else style.borderTop = line;
|
|
18
|
+
}
|
|
19
|
+
return /* @__PURE__ */ jsx("div", {
|
|
20
|
+
className: `dot-pinned dot-bar-${edge}`,
|
|
21
|
+
style,
|
|
22
|
+
children
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
//#endregion
|
|
26
|
+
export { Pinned };
|
|
@@ -3,7 +3,9 @@ function pressable(press) {
|
|
|
3
3
|
return {
|
|
4
4
|
role: "button",
|
|
5
5
|
tabIndex: 0,
|
|
6
|
-
onClick:
|
|
6
|
+
onClick: (event) => {
|
|
7
|
+
if (!event.target.closest(":disabled, [aria-disabled=\"true\"]")) press();
|
|
8
|
+
},
|
|
7
9
|
onKeyDown: (event) => {
|
|
8
10
|
if (event.target !== event.currentTarget) return;
|
|
9
11
|
if (event.key === "Enter" || event.key === " ") {
|
package/dist/components/prose.js
CHANGED
|
@@ -1,29 +1,32 @@
|
|
|
1
|
+
import { SELECTABLE } from "./tokens.js";
|
|
1
2
|
import { useTheme } from "../theme.js";
|
|
2
|
-
import { FONT_SIZE, SELECTABLE } from "./tokens.js";
|
|
3
3
|
import { paddingStyle } from "./padding.js";
|
|
4
4
|
import { InsideProse } from "./prose-context.js";
|
|
5
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
//#region src/components/prose.tsx
|
|
7
7
|
const READING_WIDTH = 680;
|
|
8
|
-
const Prose = ({ children, ...padding }) =>
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
children
|
|
23
|
-
|
|
24
|
-
|
|
8
|
+
const Prose = ({ children, ...padding }) => {
|
|
9
|
+
const { space } = useTheme();
|
|
10
|
+
return /* @__PURE__ */ jsx("div", {
|
|
11
|
+
className: "dot-prose",
|
|
12
|
+
style: {
|
|
13
|
+
display: "flex",
|
|
14
|
+
flexDirection: "column",
|
|
15
|
+
gap: 12,
|
|
16
|
+
width: "100%",
|
|
17
|
+
maxWidth: READING_WIDTH,
|
|
18
|
+
marginInline: "auto",
|
|
19
|
+
...SELECTABLE,
|
|
20
|
+
...paddingStyle(padding, space)
|
|
21
|
+
},
|
|
22
|
+
children: /* @__PURE__ */ jsx(InsideProse.Provider, {
|
|
23
|
+
value: true,
|
|
24
|
+
children
|
|
25
|
+
})
|
|
26
|
+
});
|
|
27
|
+
};
|
|
25
28
|
const Quote = ({ cite, children }) => {
|
|
26
|
-
const { colors } = useTheme();
|
|
29
|
+
const { colors, fontSize } = useTheme();
|
|
27
30
|
return /* @__PURE__ */ jsxs("blockquote", {
|
|
28
31
|
className: "dot-quote",
|
|
29
32
|
style: {
|
|
@@ -37,7 +40,7 @@ const Quote = ({ cite, children }) => {
|
|
|
37
40
|
},
|
|
38
41
|
children: [children, cite && /* @__PURE__ */ jsxs("span", {
|
|
39
42
|
style: {
|
|
40
|
-
fontSize:
|
|
43
|
+
fontSize: fontSize.caption,
|
|
41
44
|
fontStyle: "normal",
|
|
42
45
|
color: colors.subtle
|
|
43
46
|
},
|