@monimesl/dot-renderer-react 0.1.0-alpha.9 → 1.0.0-beta.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 +24 -20
- package/dist/color.js +25 -36
- package/dist/components/amount-input.js +26 -21
- package/dist/components/avatar.d.ts +6 -0
- package/dist/components/avatar.js +68 -0
- package/dist/components/box.js +56 -0
- package/dist/components/carousel.js +70 -66
- package/dist/components/code-input.js +6 -7
- package/dist/components/disclosure.d.ts +6 -0
- package/dist/components/disclosure.js +76 -0
- package/dist/components/empty-state.js +2 -4
- package/dist/components/feedback.js +39 -23
- package/dist/components/footer.js +3 -2
- package/dist/components/grid.js +4 -5
- package/dist/components/https.js +11 -0
- package/dist/components/icon-artwork.js +139 -70
- package/dist/components/icon-button.js +28 -0
- package/dist/components/icon-svg.js +27 -0
- package/dist/components/icon.js +5 -20
- package/dist/components/index.d.ts +9 -1
- package/dist/components/index.js +22 -2
- package/dist/components/input.js +24 -2
- package/dist/components/link.js +1 -8
- package/dist/components/list.js +17 -17
- package/dist/components/numbers.js +9 -0
- package/dist/components/option.js +4 -3
- package/dist/components/padding.js +18 -7
- package/dist/components/prose-context.js +5 -0
- package/dist/components/prose.d.ts +9 -0
- package/dist/components/prose.js +67 -0
- package/dist/components/rich-text.d.ts +6 -0
- package/dist/components/rich-text.js +73 -0
- package/dist/components/scroll.js +27 -25
- package/dist/components/select.js +4 -3
- package/dist/components/sheet.js +9 -8
- package/dist/components/slider.d.ts +6 -0
- package/dist/components/slider.js +57 -0
- package/dist/components/stack.d.ts +6 -0
- package/dist/components/stack.js +25 -0
- package/dist/components/stepper.d.ts +6 -0
- package/dist/components/stepper.js +92 -0
- package/dist/components/steps.d.ts +7 -0
- package/dist/components/steps.js +110 -0
- package/dist/components/tabs.js +23 -19
- package/dist/components/text.js +74 -13
- package/dist/components/toast.js +4 -4
- package/dist/components/toggles.js +6 -7
- package/dist/components/tokens.js +14 -2
- package/dist/components/tones.js +13 -7
- package/dist/components/typed-text.js +2 -2
- package/dist/components/view.js +19 -9
- package/dist/index.d.ts +9 -1
- package/dist/index.js +10 -2
- package/dist/markdown.js +255 -0
- package/dist/page-root.js +1 -1
- package/dist/pull-to-refresh.js +120 -0
- package/dist/root.js +31 -11
- package/dist/styles.css +1 -95
- package/dist/theme.d.ts +3 -2
- package/dist/theme.js +60 -15
- package/package.json +8 -7
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { useTheme } from "../theme.js";
|
|
2
|
+
import { CENTERED, FONT_SIZE, WEIGHTS } from "./tokens.js";
|
|
3
|
+
import { paddingStyle } from "./padding.js";
|
|
4
|
+
import { IconGraphic } from "./icon.js";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
//#region src/components/steps.tsx
|
|
7
|
+
const MARK_SIZE = 24;
|
|
8
|
+
const Steps = ({ children, ...padding }) => /* @__PURE__ */ jsx("ol", {
|
|
9
|
+
className: "dot-steps",
|
|
10
|
+
style: {
|
|
11
|
+
display: "flex",
|
|
12
|
+
flexDirection: "column",
|
|
13
|
+
margin: 0,
|
|
14
|
+
...paddingStyle(padding)
|
|
15
|
+
},
|
|
16
|
+
children
|
|
17
|
+
});
|
|
18
|
+
function stepMark(colors, status) {
|
|
19
|
+
switch (status) {
|
|
20
|
+
case "done": return {
|
|
21
|
+
background: colors.success,
|
|
22
|
+
border: colors.success,
|
|
23
|
+
icon: "check"
|
|
24
|
+
};
|
|
25
|
+
case "failed": return {
|
|
26
|
+
background: colors.danger,
|
|
27
|
+
border: colors.danger,
|
|
28
|
+
icon: "close"
|
|
29
|
+
};
|
|
30
|
+
case "current": return {
|
|
31
|
+
background: colors.primary,
|
|
32
|
+
border: colors.primary,
|
|
33
|
+
icon: void 0
|
|
34
|
+
};
|
|
35
|
+
case "upcoming": return {
|
|
36
|
+
background: "transparent",
|
|
37
|
+
border: colors.subtle,
|
|
38
|
+
icon: void 0
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
const Step = ({ title, text, status = "upcoming" }) => {
|
|
43
|
+
const { colors } = useTheme();
|
|
44
|
+
const { background, border, icon } = stepMark(colors, status);
|
|
45
|
+
return /* @__PURE__ */ jsxs("li", {
|
|
46
|
+
className: "dot-step",
|
|
47
|
+
"aria-current": status === "current" ? "step" : void 0,
|
|
48
|
+
style: {
|
|
49
|
+
display: "flex",
|
|
50
|
+
gap: 12,
|
|
51
|
+
listStyle: "none"
|
|
52
|
+
},
|
|
53
|
+
children: [/* @__PURE__ */ jsxs("span", {
|
|
54
|
+
style: {
|
|
55
|
+
display: "flex",
|
|
56
|
+
flexDirection: "column",
|
|
57
|
+
alignItems: "center"
|
|
58
|
+
},
|
|
59
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
60
|
+
style: {
|
|
61
|
+
...CENTERED,
|
|
62
|
+
flexShrink: 0,
|
|
63
|
+
width: MARK_SIZE,
|
|
64
|
+
height: MARK_SIZE,
|
|
65
|
+
boxSizing: "border-box",
|
|
66
|
+
borderRadius: "50%",
|
|
67
|
+
border: `2px solid ${border}`,
|
|
68
|
+
background
|
|
69
|
+
},
|
|
70
|
+
children: icon ? /* @__PURE__ */ jsx(IconGraphic, {
|
|
71
|
+
name: icon,
|
|
72
|
+
size: 14,
|
|
73
|
+
color: "#ffffff"
|
|
74
|
+
}) : null
|
|
75
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
76
|
+
className: "dot-step-line",
|
|
77
|
+
style: {
|
|
78
|
+
flex: 1,
|
|
79
|
+
width: 2,
|
|
80
|
+
minHeight: 12,
|
|
81
|
+
background: colors.border
|
|
82
|
+
}
|
|
83
|
+
})]
|
|
84
|
+
}), /* @__PURE__ */ jsxs("span", {
|
|
85
|
+
style: {
|
|
86
|
+
display: "flex",
|
|
87
|
+
flexDirection: "column",
|
|
88
|
+
gap: 2,
|
|
89
|
+
paddingBottom: 16
|
|
90
|
+
},
|
|
91
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
92
|
+
style: {
|
|
93
|
+
fontSize: FONT_SIZE.body,
|
|
94
|
+
fontWeight: status === "current" ? WEIGHTS.bold : WEIGHTS.medium,
|
|
95
|
+
color: status === "upcoming" ? colors.subtle : colors.text,
|
|
96
|
+
lineHeight: `${MARK_SIZE}px`
|
|
97
|
+
},
|
|
98
|
+
children: title
|
|
99
|
+
}), text ? /* @__PURE__ */ jsx("span", {
|
|
100
|
+
style: {
|
|
101
|
+
fontSize: FONT_SIZE.caption,
|
|
102
|
+
color: colors.subtle
|
|
103
|
+
},
|
|
104
|
+
children: text
|
|
105
|
+
}) : null]
|
|
106
|
+
})]
|
|
107
|
+
});
|
|
108
|
+
};
|
|
109
|
+
//#endregion
|
|
110
|
+
export { Step, Steps };
|
package/dist/components/tabs.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useTheme } from "../theme.js";
|
|
2
|
-
import { FONT_SIZE, PILL_STYLE, WEIGHTS } from "./tokens.js";
|
|
2
|
+
import { CENTERED, FONT_SIZE, PILL_STYLE, WEIGHTS } from "./tokens.js";
|
|
3
3
|
import { paddingStyle } from "./padding.js";
|
|
4
4
|
import { TabsRoot } from "../vendor/@base-ui/react/tabs/root/TabsRoot.js";
|
|
5
5
|
import { TabsTab } from "../vendor/@base-ui/react/tabs/tab/TabsTab.js";
|
|
@@ -15,6 +15,14 @@ const TabsContext = createContext({
|
|
|
15
15
|
const Tabs$1 = ({ value, variant = "underline", onChange, children, ...padding }) => {
|
|
16
16
|
const { colors, radius } = useTheme();
|
|
17
17
|
const segmented = variant === "segmented";
|
|
18
|
+
let variantStyle;
|
|
19
|
+
if (segmented) variantStyle = {
|
|
20
|
+
gap: 2,
|
|
21
|
+
padding: 3,
|
|
22
|
+
borderRadius: radius,
|
|
23
|
+
background: colors.muted
|
|
24
|
+
};
|
|
25
|
+
else variantStyle = { borderBottom: `1px solid ${colors.border}` };
|
|
18
26
|
return /* @__PURE__ */ jsx(TabsRoot, {
|
|
19
27
|
value: value ?? null,
|
|
20
28
|
onValueChange: (next) => {
|
|
@@ -26,12 +34,7 @@ const Tabs$1 = ({ value, variant = "underline", onChange, children, ...padding }
|
|
|
26
34
|
style: {
|
|
27
35
|
display: "flex",
|
|
28
36
|
overflowX: "auto",
|
|
29
|
-
...
|
|
30
|
-
gap: 2,
|
|
31
|
-
padding: 3,
|
|
32
|
-
borderRadius: radius,
|
|
33
|
-
background: colors.muted
|
|
34
|
-
} : { borderBottom: `1px solid ${colors.border}` }
|
|
37
|
+
...variantStyle
|
|
35
38
|
},
|
|
36
39
|
children: /* @__PURE__ */ jsx(TabsContext.Provider, {
|
|
37
40
|
value: {
|
|
@@ -50,13 +53,22 @@ const Tab$1 = ({ value, label, badge }) => {
|
|
|
50
53
|
const selected = value === chosen;
|
|
51
54
|
let color = colors.subtle;
|
|
52
55
|
if (selected) color = segmented ? colors.text : colors.primary;
|
|
56
|
+
let variantStyle;
|
|
57
|
+
if (segmented) variantStyle = {
|
|
58
|
+
borderRadius: Math.max(radius - 2, 0),
|
|
59
|
+
background: selected ? colors.surface : "transparent",
|
|
60
|
+
boxShadow: selected ? "0 1px 3px rgba(0, 0, 0, 0.15)" : "none"
|
|
61
|
+
};
|
|
62
|
+
else variantStyle = {
|
|
63
|
+
marginBottom: -1,
|
|
64
|
+
background: "transparent",
|
|
65
|
+
borderBottom: `2px solid ${selected ? colors.primary : "transparent"}`
|
|
66
|
+
};
|
|
53
67
|
return /* @__PURE__ */ jsxs(TabsTab, {
|
|
54
68
|
className: "dot-tab",
|
|
55
69
|
value,
|
|
56
70
|
style: {
|
|
57
|
-
|
|
58
|
-
alignItems: "center",
|
|
59
|
-
justifyContent: "center",
|
|
71
|
+
...CENTERED,
|
|
60
72
|
gap: 6,
|
|
61
73
|
flex: "1 0 auto",
|
|
62
74
|
minHeight: segmented ? 36 : 44,
|
|
@@ -67,15 +79,7 @@ const Tab$1 = ({ value, label, badge }) => {
|
|
|
67
79
|
whiteSpace: "nowrap",
|
|
68
80
|
color,
|
|
69
81
|
cursor: "pointer",
|
|
70
|
-
...
|
|
71
|
-
borderRadius: Math.max(radius - 2, 0),
|
|
72
|
-
background: selected ? colors.surface : "transparent",
|
|
73
|
-
boxShadow: selected ? "0 1px 3px rgba(0, 0, 0, 0.15)" : "none"
|
|
74
|
-
} : {
|
|
75
|
-
marginBottom: -1,
|
|
76
|
-
background: "transparent",
|
|
77
|
-
borderBottom: `2px solid ${selected ? colors.primary : "transparent"}`
|
|
78
|
-
}
|
|
82
|
+
...variantStyle
|
|
79
83
|
},
|
|
80
84
|
children: [label, badge ? /* @__PURE__ */ jsx("span", {
|
|
81
85
|
style: {
|
package/dist/components/text.js
CHANGED
|
@@ -1,26 +1,82 @@
|
|
|
1
1
|
import { useTheme } from "../theme.js";
|
|
2
|
-
import { FONT_SIZE, WEIGHTS } from "./tokens.js";
|
|
2
|
+
import { FONT_SIZE, SELECTABLE, WEIGHTS } from "./tokens.js";
|
|
3
3
|
import { paddingStyle } from "./padding.js";
|
|
4
|
-
import { toneColor } from "./tones.js";
|
|
4
|
+
import { isTone, toneColor } from "./tones.js";
|
|
5
|
+
import { InsideProse } from "./prose-context.js";
|
|
6
|
+
import { customColor } from "./box.js";
|
|
5
7
|
import { createContext, useContext } from "react";
|
|
6
8
|
import { jsx } from "react/jsx-runtime";
|
|
7
9
|
//#region src/components/text.tsx
|
|
8
10
|
const InsideText = createContext(false);
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
const VARIANTS = {
|
|
12
|
+
display: {
|
|
13
|
+
weight: "bold",
|
|
14
|
+
lineHeight: 1.15,
|
|
15
|
+
heading: true
|
|
16
|
+
},
|
|
17
|
+
title: {
|
|
18
|
+
weight: "bold",
|
|
19
|
+
lineHeight: 1.25,
|
|
20
|
+
heading: true
|
|
21
|
+
},
|
|
22
|
+
subtitle: {
|
|
23
|
+
weight: "medium",
|
|
24
|
+
lineHeight: 1.35,
|
|
25
|
+
heading: true
|
|
26
|
+
},
|
|
27
|
+
lead: {
|
|
28
|
+
weight: "regular",
|
|
29
|
+
lineHeight: 1.5,
|
|
30
|
+
heading: false
|
|
31
|
+
},
|
|
32
|
+
body: {
|
|
33
|
+
weight: "regular",
|
|
34
|
+
lineHeight: 1.5,
|
|
35
|
+
heading: false
|
|
36
|
+
},
|
|
37
|
+
caption: {
|
|
38
|
+
weight: "regular",
|
|
39
|
+
lineHeight: 1.4,
|
|
40
|
+
heading: false
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
const LEADING_CHANGE = {
|
|
44
|
+
tight: -.1,
|
|
45
|
+
normal: 0,
|
|
46
|
+
relaxed: .2
|
|
47
|
+
};
|
|
48
|
+
const DECORATION = {
|
|
49
|
+
none: "none",
|
|
50
|
+
underline: "underline",
|
|
51
|
+
strikethrough: "line-through"
|
|
52
|
+
};
|
|
53
|
+
const Text = ({ variant = "body", tone, weight, align, maxLines, decoration, numeric, leading, italic, selectable, children, ...padding }) => {
|
|
54
|
+
const theme = useTheme();
|
|
55
|
+
const insideText = useContext(InsideText);
|
|
56
|
+
const inProse = useContext(InsideProse);
|
|
57
|
+
const { heading, lineHeight, weight: defaultWeight } = VARIANTS[variant];
|
|
58
|
+
const defaultLeading = inProse && !heading ? "relaxed" : "normal";
|
|
13
59
|
const style = {
|
|
14
|
-
display:
|
|
15
|
-
|
|
60
|
+
display: insideText ? "inline" : "block",
|
|
61
|
+
marginInline: 0,
|
|
62
|
+
marginBlockEnd: 0,
|
|
63
|
+
marginBlockStart: inProse && heading ? void 0 : 0,
|
|
16
64
|
fontSize: FONT_SIZE[variant],
|
|
17
|
-
lineHeight: "normal",
|
|
18
65
|
fontWeight: WEIGHTS[weight ?? defaultWeight],
|
|
19
|
-
|
|
20
|
-
|
|
66
|
+
fontStyle: italic ? "italic" : void 0,
|
|
67
|
+
letterSpacing: variant === "display" ? "-0.02em" : "normal",
|
|
68
|
+
color: tone ? textColor(tone, theme) : "inherit",
|
|
21
69
|
textAlign: align,
|
|
70
|
+
textDecorationLine: decoration ? DECORATION[decoration] : void 0,
|
|
71
|
+
fontVariantNumeric: numeric ? "tabular-nums" : void 0,
|
|
72
|
+
...selectable ? SELECTABLE : void 0,
|
|
22
73
|
...paddingStyle(padding)
|
|
23
74
|
};
|
|
75
|
+
if (!insideText) {
|
|
76
|
+
style.lineHeight = lineHeight + LEADING_CHANGE[leading ?? defaultLeading];
|
|
77
|
+
style.textWrap = heading ? "balance" : "pretty";
|
|
78
|
+
style.overflowWrap = "anywhere";
|
|
79
|
+
}
|
|
24
80
|
if (maxLines) {
|
|
25
81
|
style.display = "-webkit-box";
|
|
26
82
|
style.WebkitLineClamp = maxLines;
|
|
@@ -31,8 +87,8 @@ const Text = ({ variant = "body", tone, weight, align, maxLines, children, ...pa
|
|
|
31
87
|
value: true,
|
|
32
88
|
children
|
|
33
89
|
});
|
|
34
|
-
if (variant === "title" && !
|
|
35
|
-
className: "dot-text",
|
|
90
|
+
if ((variant === "title" || variant === "subtitle") && !insideText) return /* @__PURE__ */ jsx(variant === "title" ? "h2" : "h3", {
|
|
91
|
+
className: "dot-text dot-heading",
|
|
36
92
|
style,
|
|
37
93
|
children: content
|
|
38
94
|
});
|
|
@@ -42,5 +98,10 @@ const Text = ({ variant = "body", tone, weight, align, maxLines, children, ...pa
|
|
|
42
98
|
children: content
|
|
43
99
|
});
|
|
44
100
|
};
|
|
101
|
+
function textColor(tone, theme) {
|
|
102
|
+
if (isTone(tone)) return toneColor(theme.colors, tone);
|
|
103
|
+
if (tone === "onPrimary") return theme.colors.onPrimary;
|
|
104
|
+
return customColor(tone, theme);
|
|
105
|
+
}
|
|
45
106
|
//#endregion
|
|
46
107
|
export { Text };
|
package/dist/components/toast.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useTheme } from "../theme.js";
|
|
2
2
|
import { FONT_SIZE, ICON_SIZE, SPACE } from "./tokens.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { IconSvg } from "./icon-svg.js";
|
|
4
|
+
import { STATUS_ARTWORK } from "./tones.js";
|
|
5
5
|
import { createEvent } from "@monimesl/dot-core";
|
|
6
6
|
import { useEffect, useEffectEvent, useState } from "react";
|
|
7
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -45,8 +45,8 @@ const Toast$1 = ({ message, tone = "default", duration = 2500, onHide }) => {
|
|
|
45
45
|
fontSize: FONT_SIZE.body,
|
|
46
46
|
boxShadow: "0 4px 16px rgba(0, 0, 0, 0.2)"
|
|
47
47
|
},
|
|
48
|
-
children: [tone === "default" ? null : /* @__PURE__ */ jsx(
|
|
49
|
-
|
|
48
|
+
children: [tone === "default" ? null : /* @__PURE__ */ jsx(IconSvg, {
|
|
49
|
+
artwork: STATUS_ARTWORK[tone],
|
|
50
50
|
size: ICON_SIZE.medium,
|
|
51
51
|
color: colors.onPrimary
|
|
52
52
|
}), /* @__PURE__ */ jsx("span", { children: message })]
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { useTheme } from "../theme.js";
|
|
2
|
-
import { DISABLED_OPACITY, FONT_SIZE, ICON_SIZE, SPACE } from "./tokens.js";
|
|
2
|
+
import { CENTERED, DISABLED_OPACITY, FONT_SIZE, ICON_SIZE, SPACE } from "./tokens.js";
|
|
3
3
|
import { FieldLabel } from "./field.js";
|
|
4
|
-
import {
|
|
4
|
+
import { CHECK_ARTWORK } from "./icon-artwork.js";
|
|
5
|
+
import { IconSvg } from "./icon-svg.js";
|
|
5
6
|
import { CheckboxRoot } from "../vendor/@base-ui/react/checkbox/root/CheckboxRoot.js";
|
|
6
7
|
import { CheckboxIndicator } from "../vendor/@base-ui/react/checkbox/indicator/CheckboxIndicator.js";
|
|
7
8
|
import { RadioRoot } from "../vendor/@base-ui/react/radio/root/RadioRoot.js";
|
|
@@ -34,9 +35,7 @@ function ChoiceMark({ round, checked, children }) {
|
|
|
34
35
|
const filled = checked && !round;
|
|
35
36
|
return /* @__PURE__ */ jsx("span", {
|
|
36
37
|
style: {
|
|
37
|
-
|
|
38
|
-
alignItems: "center",
|
|
39
|
-
justifyContent: "center",
|
|
38
|
+
...CENTERED,
|
|
40
39
|
flexShrink: 0,
|
|
41
40
|
width: 22,
|
|
42
41
|
height: 22,
|
|
@@ -94,8 +93,8 @@ const Checkbox$1 = ({ checked = false, label, disabled, onChange }) => {
|
|
|
94
93
|
checked,
|
|
95
94
|
children: /* @__PURE__ */ jsx(CheckboxIndicator, {
|
|
96
95
|
style: { display: "flex" },
|
|
97
|
-
children: /* @__PURE__ */ jsx(
|
|
98
|
-
|
|
96
|
+
children: /* @__PURE__ */ jsx(IconSvg, {
|
|
97
|
+
artwork: CHECK_ARTWORK,
|
|
99
98
|
size: ICON_SIZE.small,
|
|
100
99
|
color: colors.onPrimary
|
|
101
100
|
})
|
|
@@ -8,7 +8,10 @@ const SPACE = {
|
|
|
8
8
|
const FONT_SIZE = {
|
|
9
9
|
caption: 13,
|
|
10
10
|
body: 15,
|
|
11
|
-
|
|
11
|
+
lead: 17,
|
|
12
|
+
subtitle: 17,
|
|
13
|
+
title: 20,
|
|
14
|
+
display: 32
|
|
12
15
|
};
|
|
13
16
|
const WEIGHTS = {
|
|
14
17
|
regular: 400,
|
|
@@ -17,6 +20,11 @@ const WEIGHTS = {
|
|
|
17
20
|
};
|
|
18
21
|
const CARD_RADIUS_SCALE = 1.5;
|
|
19
22
|
const DISABLED_OPACITY = .6;
|
|
23
|
+
const CENTERED = {
|
|
24
|
+
display: "flex",
|
|
25
|
+
alignItems: "center",
|
|
26
|
+
justifyContent: "center"
|
|
27
|
+
};
|
|
20
28
|
const ICON_SIZE = {
|
|
21
29
|
small: 16,
|
|
22
30
|
medium: 20,
|
|
@@ -33,5 +41,9 @@ const PILL_STYLE = {
|
|
|
33
41
|
lineHeight: "16px",
|
|
34
42
|
textAlign: "center"
|
|
35
43
|
};
|
|
44
|
+
const SELECTABLE = {
|
|
45
|
+
userSelect: "text",
|
|
46
|
+
WebkitUserSelect: "text"
|
|
47
|
+
};
|
|
36
48
|
//#endregion
|
|
37
|
-
export { CARD_RADIUS_SCALE, DISABLED_OPACITY, FONT_SIZE, ICON_SIZE, PILL_STYLE, SPACE, WEIGHTS };
|
|
49
|
+
export { CARD_RADIUS_SCALE, CENTERED, DISABLED_OPACITY, FONT_SIZE, ICON_SIZE, PILL_STYLE, SELECTABLE, SPACE, WEIGHTS };
|
package/dist/components/tones.js
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
|
+
import { ERROR_ARTWORK, INFO_ARTWORK, SUCCESS_ARTWORK, WARNING_ARTWORK } from "./icon-artwork.js";
|
|
2
|
+
import { TONES } from "@monimesl/dot-core";
|
|
1
3
|
//#region src/components/tones.ts
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
const TONE_WORDS = new Set(TONES);
|
|
5
|
+
function isTone(word) {
|
|
6
|
+
return TONE_WORDS.has(word);
|
|
7
|
+
}
|
|
8
|
+
const STATUS_ARTWORK = {
|
|
9
|
+
default: INFO_ARTWORK,
|
|
10
|
+
info: INFO_ARTWORK,
|
|
11
|
+
success: SUCCESS_ARTWORK,
|
|
12
|
+
warning: WARNING_ARTWORK,
|
|
13
|
+
danger: ERROR_ARTWORK
|
|
8
14
|
};
|
|
9
15
|
function toneColor(colors, tone) {
|
|
10
16
|
switch (tone) {
|
|
@@ -21,4 +27,4 @@ function withOpacity(color, opacity) {
|
|
|
21
27
|
return `${color}${Math.round(opacity * 255).toString(16).padStart(2, "0")}`;
|
|
22
28
|
}
|
|
23
29
|
//#endregion
|
|
24
|
-
export {
|
|
30
|
+
export { STATUS_ARTWORK, isTone, toneBackground, toneColor };
|
|
@@ -6,8 +6,8 @@ function useTypedText(value, sendsChanges, show = (text) => text) {
|
|
|
6
6
|
const [previousValue, setPreviousValue] = useState(value);
|
|
7
7
|
if (value !== previousValue) {
|
|
8
8
|
setPreviousValue(value);
|
|
9
|
-
const
|
|
10
|
-
if (
|
|
9
|
+
const echoIndex = awaitingEcho.indexOf(value ?? "");
|
|
10
|
+
if (echoIndex >= 0) setAwaitingEcho(awaitingEcho.slice(echoIndex + 1));
|
|
11
11
|
else {
|
|
12
12
|
setAwaitingEcho([]);
|
|
13
13
|
setText(show(value ?? ""));
|
package/dist/components/view.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { useTheme } from "../theme.js";
|
|
2
|
-
import {
|
|
2
|
+
import { SPACE } from "./tokens.js";
|
|
3
3
|
import { insets, paddingStyle } from "./padding.js";
|
|
4
|
+
import { Footer as Footer$1 } from "./footer.js";
|
|
4
5
|
import { pressable } from "./pressable.js";
|
|
6
|
+
import { boxStyle } from "./box.js";
|
|
5
7
|
import { createEvent } from "@monimesl/dot-core";
|
|
8
|
+
import { Children, isValidElement } from "react";
|
|
6
9
|
import { jsx } from "react/jsx-runtime";
|
|
7
10
|
//#region src/components/view.tsx
|
|
8
11
|
const ALIGN = {
|
|
@@ -17,8 +20,14 @@ const JUSTIFY = {
|
|
|
17
20
|
end: "flex-end",
|
|
18
21
|
between: "space-between"
|
|
19
22
|
};
|
|
20
|
-
const
|
|
21
|
-
|
|
23
|
+
const CARD_LOOK = {
|
|
24
|
+
background: "surface",
|
|
25
|
+
border: "subtle",
|
|
26
|
+
radius: "large"
|
|
27
|
+
};
|
|
28
|
+
const View$1 = (props) => {
|
|
29
|
+
const { direction = "column", gap = "medium", align = "stretch", justify = "start", wrap = false, grow = false, variant = "plain", onTap, children } = props;
|
|
30
|
+
const theme = useTheme();
|
|
22
31
|
const card = variant === "card";
|
|
23
32
|
const style = {
|
|
24
33
|
display: "flex",
|
|
@@ -27,18 +36,15 @@ const View$1 = ({ direction = "column", gap = "medium", align = "stretch", justi
|
|
|
27
36
|
justifyContent: JUSTIFY[justify],
|
|
28
37
|
flexWrap: wrap ? "wrap" : "nowrap",
|
|
29
38
|
gap: SPACE[gap],
|
|
30
|
-
...paddingStyle(
|
|
39
|
+
...paddingStyle(props, card ? insets(SPACE.large) : void 0),
|
|
40
|
+
...boxStyle(props, theme, card ? CARD_LOOK : void 0),
|
|
31
41
|
cursor: onTap ? "pointer" : void 0
|
|
32
42
|
};
|
|
43
|
+
if (endsWithFooter(children)) style.paddingBottom = 0;
|
|
33
44
|
if (grow) {
|
|
34
45
|
style.flexGrow = 1;
|
|
35
46
|
style.minWidth = 0;
|
|
36
47
|
}
|
|
37
|
-
if (card) {
|
|
38
|
-
style.background = colors.surface;
|
|
39
|
-
style.border = `1px solid ${colors.border}`;
|
|
40
|
-
style.borderRadius = radius * CARD_RADIUS_SCALE;
|
|
41
|
-
}
|
|
42
48
|
const press = onTap ? pressable(() => onTap(createEvent("tap"))) : void 0;
|
|
43
49
|
return /* @__PURE__ */ jsx("div", {
|
|
44
50
|
className: "dot-view",
|
|
@@ -47,5 +53,9 @@ const View$1 = ({ direction = "column", gap = "medium", align = "stretch", justi
|
|
|
47
53
|
children
|
|
48
54
|
});
|
|
49
55
|
};
|
|
56
|
+
function endsWithFooter(children) {
|
|
57
|
+
const last = Children.toArray(children).at(-1);
|
|
58
|
+
return isValidElement(last) && last.type === Footer$1;
|
|
59
|
+
}
|
|
50
60
|
//#endregion
|
|
51
61
|
export { View$1 as View };
|
package/dist/index.d.ts
CHANGED
|
@@ -2,11 +2,13 @@ import { Wrapper } from "./root.js";
|
|
|
2
2
|
import { BuiltinReactComponents, ReactComponent, ReactComponents } from "./types.js";
|
|
3
3
|
import { CreateReactRendererOptions, ReactRendererOptions, createReactRenderer, reactRenderer } from "./renderer.js";
|
|
4
4
|
import { AmountInput } from "./components/amount-input.js";
|
|
5
|
+
import { Avatar } from "./components/avatar.js";
|
|
5
6
|
import { Button } from "./components/button.js";
|
|
6
7
|
import { Carousel } from "./components/carousel.js";
|
|
7
8
|
import { Chip } from "./components/chip.js";
|
|
8
9
|
import { CodeInput } from "./components/code-input.js";
|
|
9
10
|
import { DetailRow } from "./components/detail-row.js";
|
|
11
|
+
import { Disclosure } from "./components/disclosure.js";
|
|
10
12
|
import { Divider } from "./components/divider.js";
|
|
11
13
|
import { EmptyState } from "./components/empty-state.js";
|
|
12
14
|
import { Badge, Notice, ProgressBar } from "./components/feedback.js";
|
|
@@ -18,12 +20,18 @@ import { Input } from "./components/input.js";
|
|
|
18
20
|
import { Link } from "./components/link.js";
|
|
19
21
|
import { List, ListItem } from "./components/list.js";
|
|
20
22
|
import { Option } from "./components/option.js";
|
|
23
|
+
import { Bullet, BulletList, Prose, Quote } from "./components/prose.js";
|
|
21
24
|
import { QRCode } from "./components/qr-code.js";
|
|
25
|
+
import { RichText } from "./components/rich-text.js";
|
|
22
26
|
import { Scroll } from "./components/scroll.js";
|
|
23
27
|
import { Select } from "./components/select.js";
|
|
24
28
|
import { Sheet } from "./components/sheet.js";
|
|
25
29
|
import { Skeleton } from "./components/skeleton.js";
|
|
30
|
+
import { Slider } from "./components/slider.js";
|
|
26
31
|
import { Spinner } from "./components/spinner.js";
|
|
32
|
+
import { Stack } from "./components/stack.js";
|
|
33
|
+
import { Step, Steps } from "./components/steps.js";
|
|
34
|
+
import { Stepper } from "./components/stepper.js";
|
|
27
35
|
import { Tab, Tabs } from "./components/tabs.js";
|
|
28
36
|
import { Text } from "./components/text.js";
|
|
29
37
|
import { TextArea } from "./components/text-area.js";
|
|
@@ -32,4 +40,4 @@ import { Checkbox, Radio, RadioGroup, Switch } from "./components/toggles.js";
|
|
|
32
40
|
import { View } from "./components/view.js";
|
|
33
41
|
import "./components/index.js";
|
|
34
42
|
import { ResolvedColors, ResolvedTheme, resolveTheme, useTheme } from "./theme.js";
|
|
35
|
-
export { AmountInput, Badge, type BuiltinReactComponents, Button, Carousel, Checkbox, Chip, CodeInput, type CreateReactRendererOptions, DetailRow, Divider, EmptyState, Footer, Grid, GridItem, Icon, Image, Input, Link, List, ListItem, Notice, Option, ProgressBar, QRCode, Radio, RadioGroup, type ReactComponent, type ReactComponents, type ReactRendererOptions, type ResolvedColors, type ResolvedTheme, Scroll, Select, Sheet, Skeleton, Spinner, Switch, Tab, Tabs, Text, TextArea, Toast, View, type Wrapper, createReactRenderer, reactRenderer as default, resolveTheme, useTheme };
|
|
43
|
+
export { AmountInput, Avatar, Badge, type BuiltinReactComponents, Bullet, BulletList, Button, Carousel, Checkbox, Chip, CodeInput, type CreateReactRendererOptions, DetailRow, Disclosure, Divider, EmptyState, Footer, Grid, GridItem, Icon, Image, Input, Link, List, ListItem, Notice, Option, ProgressBar, Prose, QRCode, Quote, Radio, RadioGroup, type ReactComponent, type ReactComponents, type ReactRendererOptions, type ResolvedColors, type ResolvedTheme, RichText, Scroll, Select, Sheet, Skeleton, Slider, Spinner, Stack, Step, Stepper, Steps, Switch, Tab, Tabs, Text, TextArea, Toast, View, type Wrapper, createReactRenderer, reactRenderer as default, resolveTheme, useTheme };
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { resolveTheme, useTheme } from "./theme.js";
|
|
2
2
|
import { AmountInput } from "./components/amount-input.js";
|
|
3
|
+
import { Avatar } from "./components/avatar.js";
|
|
3
4
|
import { Spinner } from "./components/spinner.js";
|
|
4
5
|
import { Button } from "./components/button.js";
|
|
5
6
|
import { Carousel } from "./components/carousel.js";
|
|
@@ -7,6 +8,7 @@ import { Icon } from "./components/icon.js";
|
|
|
7
8
|
import { Chip } from "./components/chip.js";
|
|
8
9
|
import { CodeInput } from "./components/code-input.js";
|
|
9
10
|
import { DetailRow } from "./components/detail-row.js";
|
|
11
|
+
import { Disclosure } from "./components/disclosure.js";
|
|
10
12
|
import { Divider } from "./components/divider.js";
|
|
11
13
|
import { EmptyState } from "./components/empty-state.js";
|
|
12
14
|
import { Badge, Notice, ProgressBar } from "./components/feedback.js";
|
|
@@ -17,13 +19,19 @@ import { Input } from "./components/input.js";
|
|
|
17
19
|
import { Link } from "./components/link.js";
|
|
18
20
|
import { List, ListItem } from "./components/list.js";
|
|
19
21
|
import { Option } from "./components/option.js";
|
|
22
|
+
import { Bullet, BulletList, Prose, Quote } from "./components/prose.js";
|
|
20
23
|
import { QRCode } from "./components/qr-code.js";
|
|
24
|
+
import { Text } from "./components/text.js";
|
|
25
|
+
import { RichText } from "./components/rich-text.js";
|
|
21
26
|
import { Scroll } from "./components/scroll.js";
|
|
22
27
|
import { Sheet } from "./components/sheet.js";
|
|
23
28
|
import { Select } from "./components/select.js";
|
|
24
29
|
import { Skeleton } from "./components/skeleton.js";
|
|
30
|
+
import { Slider } from "./components/slider.js";
|
|
31
|
+
import { Stack } from "./components/stack.js";
|
|
32
|
+
import { Step, Steps } from "./components/steps.js";
|
|
33
|
+
import { Stepper } from "./components/stepper.js";
|
|
25
34
|
import { Tab, Tabs } from "./components/tabs.js";
|
|
26
|
-
import { Text } from "./components/text.js";
|
|
27
35
|
import { TextArea } from "./components/text-area.js";
|
|
28
36
|
import { Toast } from "./components/toast.js";
|
|
29
37
|
import { Checkbox, Radio, RadioGroup, Switch } from "./components/toggles.js";
|
|
@@ -32,4 +40,4 @@ import { createReactRenderer, reactRenderer } from "./renderer.js";
|
|
|
32
40
|
//#region src/index.ts
|
|
33
41
|
var src_default = reactRenderer;
|
|
34
42
|
//#endregion
|
|
35
|
-
export { AmountInput, Badge, Button, Carousel, Checkbox, Chip, CodeInput, DetailRow, Divider, EmptyState, Footer, Grid, GridItem, Icon, Image, Input, Link, List, ListItem, Notice, Option, ProgressBar, QRCode, Radio, RadioGroup, Scroll, Select, Sheet, Skeleton, Spinner, Switch, Tab, Tabs, Text, TextArea, Toast, View, createReactRenderer, src_default as default, resolveTheme, useTheme };
|
|
43
|
+
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, createReactRenderer, src_default as default, resolveTheme, useTheme };
|