@oxy.so/bloom 7.7.0 → 7.7.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/docs/admonition.mdx +12 -3
- package/docs/adoption-matrix.mdx +2 -2
- package/lib/commonjs/admonition/Admonition.js +53 -31
- package/lib/commonjs/admonition/Admonition.js.map +1 -1
- package/lib/module/admonition/Admonition.js +53 -31
- package/lib/module/admonition/Admonition.js.map +1 -1
- package/lib/typescript/commonjs/admonition/Admonition.d.ts.map +1 -1
- package/lib/typescript/module/admonition/Admonition.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/admonition/Admonition.tsx +49 -28
- package/src/__tests__/support/adoption-matrix.ts +0 -683
- package/src/__tests__/support/card-surface.ts +0 -25
- package/src/__tests__/support/collision-fixture-barrel.ts +0 -20
- package/src/__tests__/support/commerce-harness.tsx +0 -97
- package/src/__tests__/support/composite.ts +0 -68
- package/src/__tests__/support/constructed-style-sheets.ts +0 -68
- package/src/__tests__/support/messages-in.ts +0 -10
- package/src/__tests__/support/press-host.ts +0 -30
- package/src/__tests__/support/rendered-style.ts +0 -99
- package/src/__tests__/support/unread-hook-fixture.ts +0 -33
- package/src/__tests__/support/worklet-capture-fixture.tsx +0 -28
- package/src/agent-avatar/__tests__/artwork-golden.json +0 -774
- package/src/agent-creator/__tests__/support/character-runtime-fixture.tsx +0 -26
- package/src/theme/__tests__/__fixtures__/golden-resolved-tokens.json +0 -9346
- package/src/theme/__tests__/__fixtures__/tonal-glass-primary-failures.json +0 -69
- package/src/theme/__tests__/fixtures/color-engine-golden.json +0 -1
package/docs/admonition.mdx
CHANGED
|
@@ -40,16 +40,25 @@ import {
|
|
|
40
40
|
</AdmonitionRoot>
|
|
41
41
|
```
|
|
42
42
|
|
|
43
|
-
## `type` picks the icon and
|
|
43
|
+
## `type` picks the icon, tint and border together
|
|
44
44
|
|
|
45
45
|
| `type` | for |
|
|
46
46
|
| --------- | ------------------------------------------------------- |
|
|
47
|
-
| `info` |
|
|
48
|
-
| `tip` | a suggestion —
|
|
47
|
+
| `info` | an information note |
|
|
48
|
+
| `tip` | a suggestion — success tint and a lightbulb |
|
|
49
49
|
| `warning` | something that could go wrong if they continue |
|
|
50
50
|
| `error` | something that has gone wrong |
|
|
51
51
|
| `apology` | a limitation on our side, not the reader's mistake |
|
|
52
52
|
|
|
53
|
+
The shared design uses 16px padding and corners, a 12px icon gap, a soft
|
|
54
|
+
status surface and a subtle outline. The icon reads the matching text token;
|
|
55
|
+
text remains the normal foreground. The outline alone has 30% opacity, so
|
|
56
|
+
its token stays valid on native and web and never dims the content.
|
|
57
|
+
|
|
58
|
+
`AdmonitionContent` accepts rich content directly. Use the compound API for
|
|
59
|
+
a heading and Markdown blocks instead of putting block elements inside
|
|
60
|
+
`AdmonitionText`.
|
|
61
|
+
|
|
53
62
|
`AdmonitionIcon` reads the type from context, so the icon and the border cannot
|
|
54
63
|
disagree — which is how an `error` callout ends up with a warning icon when the
|
|
55
64
|
two are set by hand.
|
package/docs/adoption-matrix.mdx
CHANGED
|
@@ -112,7 +112,7 @@ The classification is an EQUALITY in `src/__tests__/adoption-matrix.test.ts`, no
|
|
|
112
112
|
| `activity-feed` | `@oxy.so/bloom/activity-feed` + barrel | universal | `activity-feed.mdx` | yes | 1 | | | | |
|
|
113
113
|
| `activity-heatmap` | `@oxy.so/bloom/activity-heatmap` + barrel | universal | `activity-heatmap.mdx` | yes | 1 | | | | |
|
|
114
114
|
| `address` | `@oxy.so/bloom/address` + barrel | universal | `address.mdx` | yes | 2 | n/a¹ | | | |
|
|
115
|
-
| `admonition` | `@oxy.so/bloom/admonition` + barrel | universal | `admonition.mdx` | yes |
|
|
115
|
+
| `admonition` | `@oxy.so/bloom/admonition` + barrel | universal | `admonition.mdx` | yes | 2 | | | | |
|
|
116
116
|
| `agent-avatar` | `@oxy.so/bloom/agent-avatar` + barrel | universal | `agent-avatar.mdx` | yes | 15 | | | | |
|
|
117
117
|
| `agent-chat` | `@oxy.so/bloom/agent-chat` + barrel | web fork | `agent-chat.mdx` | yes | 3 | n/a¹ | | | reads |
|
|
118
118
|
| `agent-creator` | `@oxy.so/bloom/agent-creator` + barrel | web fork | `agent-creator.mdx` | yes | 5 | reads | | | |
|
|
@@ -308,7 +308,7 @@ The classification is an EQUALITY in `src/__tests__/adoption-matrix.test.ts`, no
|
|
|
308
308
|
| `tenancy` | `@oxy.so/bloom/tenancy` + barrel | universal | `tenancy.mdx` | yes | 5 | | reads | | |
|
|
309
309
|
| `text-field` | `@oxy.so/bloom/text-field` + barrel | universal | `text-field.mdx` | yes | 17 | reads | reads | | |
|
|
310
310
|
| `textarea` | `@oxy.so/bloom/textarea` + barrel | universal | `textarea.mdx` | yes | 4 | reads | reads | | n/a¹ |
|
|
311
|
-
| `theme` | `@oxy.so/bloom/theme` + barrel | web fork | `theme.mdx` | yes |
|
|
311
|
+
| `theme` | `@oxy.so/bloom/theme` + barrel | web fork | `theme.mdx` | yes | 361 | | | n/a¹ | reads |
|
|
312
312
|
| `theme-toggle` | `@oxy.so/bloom/theme-toggle` + barrel | universal | `theme-toggle.mdx` | yes | 2 | n/a¹ | | | |
|
|
313
313
|
| `toast` | `@oxy.so/bloom/toast` + barrel | universal | `toast.mdx` | yes | 17 | | | | |
|
|
314
314
|
| `tooltip` | `@oxy.so/bloom/tooltip` + barrel | web fork | `tooltip.mdx` | yes | 1 | | | | |
|
|
@@ -16,7 +16,9 @@ var _useTheme = require("../theme/use-theme.js");
|
|
|
16
16
|
var _index = require("../typography/index.js");
|
|
17
17
|
var _button = require("../button");
|
|
18
18
|
var _RiInformationLine = require("../icons/remix/RiInformationLine.js");
|
|
19
|
-
var
|
|
19
|
+
var _RiForbidLine = require("../icons/remix/RiForbidLine.js");
|
|
20
|
+
var _RiLightbulbLine = require("../icons/remix/RiLightbulbLine.js");
|
|
21
|
+
var _accentColors = require("../theme/accent-colors.js");
|
|
20
22
|
var _RiAlertLine = require("../icons/remix/RiAlertLine.js");
|
|
21
23
|
var _RiEmotionUnhappyLine = require("../icons/remix/RiEmotionUnhappyLine.js");
|
|
22
24
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
@@ -27,27 +29,33 @@ const AdmonitionContext = /*#__PURE__*/(0, _react.createContext)({
|
|
|
27
29
|
AdmonitionContext.displayName = 'AdmonitionContext';
|
|
28
30
|
const ICON_MAP = {
|
|
29
31
|
info: _RiInformationLine.RiInformationLine,
|
|
30
|
-
tip:
|
|
32
|
+
tip: _RiLightbulbLine.RiLightbulbLine,
|
|
31
33
|
warning: _RiAlertLine.RiAlertLine,
|
|
32
|
-
error:
|
|
34
|
+
error: _RiForbidLine.RiForbidLine,
|
|
33
35
|
apology: _RiEmotionUnhappyLine.RiEmotionUnhappyLine
|
|
34
36
|
};
|
|
37
|
+
const TONE_MAP = {
|
|
38
|
+
info: 'info',
|
|
39
|
+
tip: 'success',
|
|
40
|
+
warning: 'warning',
|
|
41
|
+
error: 'error',
|
|
42
|
+
apology: 'default'
|
|
43
|
+
};
|
|
35
44
|
function AdmonitionIcon() {
|
|
36
45
|
const theme = (0, _useTheme.useTheme)();
|
|
37
46
|
const {
|
|
38
47
|
type
|
|
39
48
|
} = (0, _react.useContext)(AdmonitionContext);
|
|
40
49
|
const IconComponent = ICON_MAP[type];
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
size: "md"
|
|
50
|
+
const colors = (0, _accentColors.resolveAccentColors)(theme.colors, TONE_MAP[type], 'subtle');
|
|
51
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
52
|
+
"aria-hidden": true,
|
|
53
|
+
style: styles.icon,
|
|
54
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(IconComponent, {
|
|
55
|
+
fill: colors.foreground,
|
|
56
|
+
width: 20,
|
|
57
|
+
height: 20
|
|
58
|
+
})
|
|
51
59
|
});
|
|
52
60
|
}
|
|
53
61
|
AdmonitionIcon.displayName = 'AdmonitionIcon';
|
|
@@ -98,23 +106,24 @@ function AdmonitionRoot({
|
|
|
98
106
|
style
|
|
99
107
|
}) {
|
|
100
108
|
const theme = (0, _useTheme.useTheme)();
|
|
101
|
-
const
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
warning: theme.colors.warning,
|
|
105
|
-
error: theme.colors.error,
|
|
106
|
-
apology: theme.colors.border
|
|
107
|
-
};
|
|
109
|
+
const tone = TONE_MAP[type];
|
|
110
|
+
const colors = (0, _accentColors.resolveAccentColors)(theme.colors, tone, 'subtle');
|
|
111
|
+
const border = (0, _accentColors.resolveAccentColors)(theme.colors, tone, 'solid').border;
|
|
108
112
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(AdmonitionContext.Provider, {
|
|
109
113
|
value: {
|
|
110
114
|
type
|
|
111
115
|
},
|
|
112
|
-
children: /*#__PURE__*/(0, _jsxRuntime.
|
|
116
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
113
117
|
style: [styles.outer, {
|
|
114
|
-
|
|
115
|
-
backgroundColor: theme.colors.background
|
|
118
|
+
backgroundColor: colors.background
|
|
116
119
|
}, style],
|
|
117
|
-
children:
|
|
120
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
121
|
+
pointerEvents: "none",
|
|
122
|
+
"aria-hidden": true,
|
|
123
|
+
style: [styles.border, {
|
|
124
|
+
borderColor: border
|
|
125
|
+
}]
|
|
126
|
+
}), children]
|
|
118
127
|
})
|
|
119
128
|
});
|
|
120
129
|
}
|
|
@@ -145,26 +154,39 @@ function Admonition({
|
|
|
145
154
|
Admonition.displayName = 'Admonition';
|
|
146
155
|
const styles = _reactNative.StyleSheet.create({
|
|
147
156
|
outer: {
|
|
148
|
-
padding:
|
|
149
|
-
borderRadius:
|
|
150
|
-
|
|
157
|
+
padding: 16,
|
|
158
|
+
borderRadius: 16,
|
|
159
|
+
position: 'relative'
|
|
160
|
+
},
|
|
161
|
+
border: {
|
|
162
|
+
position: 'absolute',
|
|
163
|
+
top: 0,
|
|
164
|
+
right: 0,
|
|
165
|
+
bottom: 0,
|
|
166
|
+
left: 0,
|
|
167
|
+
borderRadius: 16,
|
|
168
|
+
borderWidth: 1,
|
|
169
|
+
opacity: 0.3
|
|
170
|
+
},
|
|
171
|
+
icon: {
|
|
172
|
+
flexShrink: 0
|
|
151
173
|
},
|
|
152
174
|
row: {
|
|
153
175
|
width: '100%',
|
|
154
176
|
flexDirection: 'row',
|
|
155
177
|
alignItems: 'flex-start',
|
|
156
|
-
gap:
|
|
178
|
+
gap: 12
|
|
157
179
|
},
|
|
158
180
|
content: {
|
|
159
|
-
gap:
|
|
181
|
+
gap: 4,
|
|
160
182
|
flex: 1,
|
|
183
|
+
minWidth: 0,
|
|
161
184
|
minHeight: 20,
|
|
162
185
|
justifyContent: 'center'
|
|
163
186
|
},
|
|
164
187
|
text: {
|
|
165
188
|
fontSize: 14,
|
|
166
|
-
lineHeight:
|
|
167
|
-
paddingRight: 12
|
|
189
|
+
lineHeight: 22
|
|
168
190
|
}
|
|
169
191
|
});
|
|
170
192
|
//# sourceMappingURL=Admonition.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_useTheme","_index","_button","_RiInformationLine","
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_useTheme","_index","_button","_RiInformationLine","_RiForbidLine","_RiLightbulbLine","_accentColors","_RiAlertLine","_RiEmotionUnhappyLine","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","AdmonitionContext","createContext","type","displayName","ICON_MAP","info","CircleInfoIcon","tip","LightbulbIcon","warning","WarningIcon","error","ForbidIcon","apology","EmojiSadIcon","TONE_MAP","AdmonitionIcon","theme","useTheme","useContext","IconComponent","colors","resolveAccentColors","jsx","View","style","styles","icon","children","fill","foreground","width","height","AdmonitionContent","content","AdmonitionText","Text","text","AdmonitionButton","props","Button","size","AdmonitionRow","row","AdmonitionRoot","tone","border","Provider","value","jsxs","outer","backgroundColor","background","pointerEvents","borderColor","Admonition","StyleSheet","create","padding","borderRadius","position","top","right","bottom","left","borderWidth","opacity","flexShrink","flexDirection","alignItems","gap","flex","minWidth","minHeight","justifyContent","fontSize","lineHeight"],"sourceRoot":"../../../src","sources":["admonition/Admonition.tsx"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,kBAAA,GAAAL,OAAA;AACA,IAAAM,aAAA,GAAAN,OAAA;AACA,IAAAO,gBAAA,GAAAP,OAAA;AACA,IAAAQ,aAAA,GAAAR,OAAA;AACA,IAAAS,YAAA,GAAAT,OAAA;AACA,IAAAU,qBAAA,GAAAV,OAAA;AAA2F,IAAAW,WAAA,GAAAX,OAAA;AAAA,SAAAD,wBAAAa,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAf,uBAAA,YAAAA,CAAAa,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM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;EACDpC,OAAO,EAAE;IACPoC,GAAG,EAAE,CAAC;IACNC,IAAI,EAAE,CAAC;IACPC,QAAQ,EAAE,CAAC;IACXC,SAAS,EAAE,EAAE;IACbC,cAAc,EAAE;EAClB,CAAC;EACDrC,IAAI,EAAE;IACJsC,QAAQ,EAAE,EAAE;IACZC,UAAU,EAAE;EACd;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -6,7 +6,9 @@ import { useTheme } from "../theme/use-theme.js";
|
|
|
6
6
|
import { Text as BaseText } from "../typography/index.js";
|
|
7
7
|
import { Button as BaseButton } from '../button';
|
|
8
8
|
import { RiInformationLine as CircleInfoIcon } from "../icons/remix/RiInformationLine.js";
|
|
9
|
-
import {
|
|
9
|
+
import { RiForbidLine as ForbidIcon } from "../icons/remix/RiForbidLine.js";
|
|
10
|
+
import { RiLightbulbLine as LightbulbIcon } from "../icons/remix/RiLightbulbLine.js";
|
|
11
|
+
import { resolveAccentColors } from "../theme/accent-colors.js";
|
|
10
12
|
import { RiAlertLine as WarningIcon } from "../icons/remix/RiAlertLine.js";
|
|
11
13
|
import { RiEmotionUnhappyLine as EmojiSadIcon } from "../icons/remix/RiEmotionUnhappyLine.js";
|
|
12
14
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -16,27 +18,33 @@ const AdmonitionContext = /*#__PURE__*/createContext({
|
|
|
16
18
|
AdmonitionContext.displayName = 'AdmonitionContext';
|
|
17
19
|
const ICON_MAP = {
|
|
18
20
|
info: CircleInfoIcon,
|
|
19
|
-
tip:
|
|
21
|
+
tip: LightbulbIcon,
|
|
20
22
|
warning: WarningIcon,
|
|
21
|
-
error:
|
|
23
|
+
error: ForbidIcon,
|
|
22
24
|
apology: EmojiSadIcon
|
|
23
25
|
};
|
|
26
|
+
const TONE_MAP = {
|
|
27
|
+
info: 'info',
|
|
28
|
+
tip: 'success',
|
|
29
|
+
warning: 'warning',
|
|
30
|
+
error: 'error',
|
|
31
|
+
apology: 'default'
|
|
32
|
+
};
|
|
24
33
|
export function AdmonitionIcon() {
|
|
25
34
|
const theme = useTheme();
|
|
26
35
|
const {
|
|
27
36
|
type
|
|
28
37
|
} = useContext(AdmonitionContext);
|
|
29
38
|
const IconComponent = ICON_MAP[type];
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
size: "md"
|
|
39
|
+
const colors = resolveAccentColors(theme.colors, TONE_MAP[type], 'subtle');
|
|
40
|
+
return /*#__PURE__*/_jsx(View, {
|
|
41
|
+
"aria-hidden": true,
|
|
42
|
+
style: styles.icon,
|
|
43
|
+
children: /*#__PURE__*/_jsx(IconComponent, {
|
|
44
|
+
fill: colors.foreground,
|
|
45
|
+
width: 20,
|
|
46
|
+
height: 20
|
|
47
|
+
})
|
|
40
48
|
});
|
|
41
49
|
}
|
|
42
50
|
AdmonitionIcon.displayName = 'AdmonitionIcon';
|
|
@@ -87,23 +95,24 @@ export function AdmonitionRoot({
|
|
|
87
95
|
style
|
|
88
96
|
}) {
|
|
89
97
|
const theme = useTheme();
|
|
90
|
-
const
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
warning: theme.colors.warning,
|
|
94
|
-
error: theme.colors.error,
|
|
95
|
-
apology: theme.colors.border
|
|
96
|
-
};
|
|
98
|
+
const tone = TONE_MAP[type];
|
|
99
|
+
const colors = resolveAccentColors(theme.colors, tone, 'subtle');
|
|
100
|
+
const border = resolveAccentColors(theme.colors, tone, 'solid').border;
|
|
97
101
|
return /*#__PURE__*/_jsx(AdmonitionContext.Provider, {
|
|
98
102
|
value: {
|
|
99
103
|
type
|
|
100
104
|
},
|
|
101
|
-
children: /*#__PURE__*/
|
|
105
|
+
children: /*#__PURE__*/_jsxs(View, {
|
|
102
106
|
style: [styles.outer, {
|
|
103
|
-
|
|
104
|
-
backgroundColor: theme.colors.background
|
|
107
|
+
backgroundColor: colors.background
|
|
105
108
|
}, style],
|
|
106
|
-
children:
|
|
109
|
+
children: [/*#__PURE__*/_jsx(View, {
|
|
110
|
+
pointerEvents: "none",
|
|
111
|
+
"aria-hidden": true,
|
|
112
|
+
style: [styles.border, {
|
|
113
|
+
borderColor: border
|
|
114
|
+
}]
|
|
115
|
+
}), children]
|
|
107
116
|
})
|
|
108
117
|
});
|
|
109
118
|
}
|
|
@@ -134,26 +143,39 @@ export function Admonition({
|
|
|
134
143
|
Admonition.displayName = 'Admonition';
|
|
135
144
|
const styles = StyleSheet.create({
|
|
136
145
|
outer: {
|
|
137
|
-
padding:
|
|
138
|
-
borderRadius:
|
|
139
|
-
|
|
146
|
+
padding: 16,
|
|
147
|
+
borderRadius: 16,
|
|
148
|
+
position: 'relative'
|
|
149
|
+
},
|
|
150
|
+
border: {
|
|
151
|
+
position: 'absolute',
|
|
152
|
+
top: 0,
|
|
153
|
+
right: 0,
|
|
154
|
+
bottom: 0,
|
|
155
|
+
left: 0,
|
|
156
|
+
borderRadius: 16,
|
|
157
|
+
borderWidth: 1,
|
|
158
|
+
opacity: 0.3
|
|
159
|
+
},
|
|
160
|
+
icon: {
|
|
161
|
+
flexShrink: 0
|
|
140
162
|
},
|
|
141
163
|
row: {
|
|
142
164
|
width: '100%',
|
|
143
165
|
flexDirection: 'row',
|
|
144
166
|
alignItems: 'flex-start',
|
|
145
|
-
gap:
|
|
167
|
+
gap: 12
|
|
146
168
|
},
|
|
147
169
|
content: {
|
|
148
|
-
gap:
|
|
170
|
+
gap: 4,
|
|
149
171
|
flex: 1,
|
|
172
|
+
minWidth: 0,
|
|
150
173
|
minHeight: 20,
|
|
151
174
|
justifyContent: 'center'
|
|
152
175
|
},
|
|
153
176
|
text: {
|
|
154
177
|
fontSize: 14,
|
|
155
|
-
lineHeight:
|
|
156
|
-
paddingRight: 12
|
|
178
|
+
lineHeight: 22
|
|
157
179
|
}
|
|
158
180
|
});
|
|
159
181
|
//# sourceMappingURL=Admonition.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","createContext","useContext","StyleSheet","View","useTheme","Text","BaseText","Button","BaseButton","RiInformationLine","CircleInfoIcon","
|
|
1
|
+
{"version":3,"names":["React","createContext","useContext","StyleSheet","View","useTheme","Text","BaseText","Button","BaseButton","RiInformationLine","CircleInfoIcon","RiForbidLine","ForbidIcon","RiLightbulbLine","LightbulbIcon","resolveAccentColors","RiAlertLine","WarningIcon","RiEmotionUnhappyLine","EmojiSadIcon","jsx","_jsx","jsxs","_jsxs","AdmonitionContext","type","displayName","ICON_MAP","info","tip","warning","error","apology","TONE_MAP","AdmonitionIcon","theme","IconComponent","colors","style","styles","icon","children","fill","foreground","width","height","AdmonitionContent","content","AdmonitionText","text","AdmonitionButton","props","size","AdmonitionRow","row","AdmonitionRoot","tone","border","Provider","value","outer","backgroundColor","background","pointerEvents","borderColor","Admonition","create","padding","borderRadius","position","top","right","bottom","left","borderWidth","opacity","flexShrink","flexDirection","alignItems","gap","flex","minWidth","minHeight","justifyContent","fontSize","lineHeight"],"sourceRoot":"../../../src","sources":["admonition/Admonition.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,aAAa,EAAEC,UAAU,QAAQ,OAAO;AACxD,SAASC,UAAU,EAAEC,IAAI,QAAwD,cAAc;AAE/F,SAASC,QAAQ,QAAQ,uBAAoB;AAC7C,SAASC,IAAI,IAAIC,QAAQ,QAAQ,wBAAe;AAChD,SAASC,MAAM,IAAIC,UAAU,QAA0B,WAAW;AAClE,SAASC,iBAAiB,IAAIC,cAAc,QAAQ,qCAAkC;AACtF,SAASC,YAAY,IAAIC,UAAU,QAAQ,gCAA6B;AACxE,SAASC,eAAe,IAAIC,aAAa,QAAQ,mCAAgC;AACjF,SAASC,mBAAmB,QAAyB,2BAAwB;AAC7E,SAASC,WAAW,IAAIC,WAAW,QAAQ,+BAA4B;AACvE,SAASC,oBAAoB,IAAIC,YAAY,QAAQ,wCAAqC;AAAC,SAAAC,GAAA,IAAAC,IAAA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ACDZ,MAAM,EAAE;IACNY,QAAQ,EAAE,UAAU;IACpBC,GAAG,EAAE,CAAC;IACNC,KAAK,EAAE,CAAC;IACRC,MAAM,EAAE,CAAC;IACTC,IAAI,EAAE,CAAC;IACPL,YAAY,EAAE,EAAE;IAChBM,WAAW,EAAE,CAAC;IACdC,OAAO,EAAE;EACX,CAAC;EACDnC,IAAI,EAAE;IACJoC,UAAU,EAAE;EACd,CAAC;EACDtB,GAAG,EAAE;IACHV,KAAK,EAAE,MAAM;IACbiC,aAAa,EAAE,KAAK;IACpBC,UAAU,EAAE,YAAY;IACxBC,GAAG,EAAE;EACP,CAAC;EACDhC,OAAO,EAAE;IACPgC,GAAG,EAAE,CAAC;IACNC,IAAI,EAAE,CAAC;IACPC,QAAQ,EAAE,CAAC;IACXC,SAAS,EAAE,EAAE;IACbC,cAAc,EAAE;EAClB,CAAC;EACDlC,IAAI,EAAE;IACJmC,QAAQ,EAAE,EAAE;IACZC,UAAU,EAAE;EACd;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Admonition.d.ts","sourceRoot":"","sources":["../../../../src/admonition/Admonition.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoC,MAAM,OAAO,CAAC;AACzD,OAAO,EAAoB,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAIhG,OAAO,EAAwB,KAAK,WAAW,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"Admonition.d.ts","sourceRoot":"","sources":["../../../../src/admonition/Admonition.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoC,MAAM,OAAO,CAAC;AACzD,OAAO,EAAoB,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAIhG,OAAO,EAAwB,KAAK,WAAW,EAAE,MAAM,WAAW,CAAC;AAQnE,KAAK,cAAc,GAA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,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B,2CAWA;yBAnBe,UAAU"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Admonition.d.ts","sourceRoot":"","sources":["../../../../src/admonition/Admonition.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoC,MAAM,OAAO,CAAC;AACzD,OAAO,EAAoB,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAIhG,OAAO,EAAwB,KAAK,WAAW,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"Admonition.d.ts","sourceRoot":"","sources":["../../../../src/admonition/Admonition.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoC,MAAM,OAAO,CAAC;AACzD,OAAO,EAAoB,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAIhG,OAAO,EAAwB,KAAK,WAAW,EAAE,MAAM,WAAW,CAAC;AAQnE,KAAK,cAAc,GAAG,MAAM,GAAG,KAAK,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC;AA2BvE,wBAAgB,cAAc,4CAW7B;yBAXe,cAAc;;;AAc9B,wBAAgB,iBAAiB,CAAC,EAChC,QAAQ,EACR,KAAK,GACN,EAAE;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B,2CAMA;yBAZe,iBAAiB;;;AAejC,wBAAgB,cAAc,CAAC,EAC7B,QAAQ,EACR,KAAK,GACN,EAAE;IACD,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,KAAK,CAAC,EAAE,SAAS,CAAC;CACnB,2CAMA;yBAZe,cAAc;;;AAe9B,wBAAgB,gBAAgB,CAAC,EAC/B,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC,2CAM3B;yBATe,gBAAgB;;;AAYhC,wBAAgB,aAAa,CAAC,EAC5B,QAAQ,EACR,KAAK,GACN,EAAE;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B,2CAMA;yBAZe,aAAa;;;AAe7B,wBAAgB,cAAc,CAAC,EAC7B,QAAQ,EACR,IAAa,EACb,KAAK,GACN,EAAE;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B,2CA6BA;yBArCe,cAAc;;;AAwC9B;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,EACzB,QAAQ,EACR,IAAI,EACJ,KAAK,GACN,EAAE;IACD,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B,2CAWA;yBAnBe,UAAU"}
|
package/package.json
CHANGED
|
@@ -5,7 +5,9 @@ import { useTheme } from '../theme/use-theme';
|
|
|
5
5
|
import { Text as BaseText } from '../typography';
|
|
6
6
|
import { Button as BaseButton, type ButtonProps } from '../button';
|
|
7
7
|
import { RiInformationLine as CircleInfoIcon } from '../icons/remix/RiInformationLine';
|
|
8
|
-
import {
|
|
8
|
+
import { RiForbidLine as ForbidIcon } from '../icons/remix/RiForbidLine';
|
|
9
|
+
import { RiLightbulbLine as LightbulbIcon } from '../icons/remix/RiLightbulbLine';
|
|
10
|
+
import { resolveAccentColors, type AccentTone } from '../theme/accent-colors';
|
|
9
11
|
import { RiAlertLine as WarningIcon } from '../icons/remix/RiAlertLine';
|
|
10
12
|
import { RiEmotionUnhappyLine as EmojiSadIcon } from '../icons/remix/RiEmotionUnhappyLine';
|
|
11
13
|
|
|
@@ -22,27 +24,31 @@ AdmonitionContext.displayName = 'AdmonitionContext';
|
|
|
22
24
|
|
|
23
25
|
const ICON_MAP = {
|
|
24
26
|
info: CircleInfoIcon,
|
|
25
|
-
tip:
|
|
27
|
+
tip: LightbulbIcon,
|
|
26
28
|
warning: WarningIcon,
|
|
27
|
-
error:
|
|
29
|
+
error: ForbidIcon,
|
|
28
30
|
apology: EmojiSadIcon,
|
|
29
31
|
} as const;
|
|
30
32
|
|
|
33
|
+
const TONE_MAP: Record<AdmonitionType, AccentTone> = {
|
|
34
|
+
info: 'info',
|
|
35
|
+
tip: 'success',
|
|
36
|
+
warning: 'warning',
|
|
37
|
+
error: 'error',
|
|
38
|
+
apology: 'default',
|
|
39
|
+
};
|
|
40
|
+
|
|
31
41
|
export function AdmonitionIcon() {
|
|
32
42
|
const theme = useTheme();
|
|
33
43
|
const { type } = useContext(AdmonitionContext);
|
|
34
|
-
|
|
35
44
|
const IconComponent = ICON_MAP[type];
|
|
45
|
+
const colors = resolveAccentColors(theme.colors, TONE_MAP[type], 'subtle');
|
|
36
46
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
apology: theme.colors.textSecondary,
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
return <IconComponent fill={fillMap[type]} size="md" />;
|
|
47
|
+
return (
|
|
48
|
+
<View aria-hidden style={styles.icon}>
|
|
49
|
+
<IconComponent fill={colors.foreground} width={20} height={20} />
|
|
50
|
+
</View>
|
|
51
|
+
);
|
|
46
52
|
}
|
|
47
53
|
AdmonitionIcon.displayName = 'AdmonitionIcon';
|
|
48
54
|
|
|
@@ -114,13 +120,9 @@ export function AdmonitionRoot({
|
|
|
114
120
|
}) {
|
|
115
121
|
const theme = useTheme();
|
|
116
122
|
|
|
117
|
-
const
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
warning: theme.colors.warning,
|
|
121
|
-
error: theme.colors.error,
|
|
122
|
-
apology: theme.colors.border,
|
|
123
|
-
};
|
|
123
|
+
const tone = TONE_MAP[type];
|
|
124
|
+
const colors = resolveAccentColors(theme.colors, tone, 'subtle');
|
|
125
|
+
const border = resolveAccentColors(theme.colors, tone, 'solid').border;
|
|
124
126
|
|
|
125
127
|
return (
|
|
126
128
|
<AdmonitionContext.Provider value={{ type }}>
|
|
@@ -128,12 +130,18 @@ export function AdmonitionRoot({
|
|
|
128
130
|
style={[
|
|
129
131
|
styles.outer,
|
|
130
132
|
{
|
|
131
|
-
|
|
132
|
-
backgroundColor: theme.colors.background,
|
|
133
|
+
backgroundColor: colors.background,
|
|
133
134
|
},
|
|
134
135
|
style,
|
|
135
136
|
]}
|
|
136
137
|
>
|
|
138
|
+
{/* Separate opacity preserves the token's native colour syntax and
|
|
139
|
+
keeps the content fully opaque on both native and web. */}
|
|
140
|
+
<View
|
|
141
|
+
pointerEvents="none"
|
|
142
|
+
aria-hidden
|
|
143
|
+
style={[styles.border, { borderColor: border }]}
|
|
144
|
+
/>
|
|
137
145
|
{children}
|
|
138
146
|
</View>
|
|
139
147
|
</AdmonitionContext.Provider>
|
|
@@ -170,25 +178,38 @@ Admonition.displayName = 'Admonition';
|
|
|
170
178
|
|
|
171
179
|
const styles = StyleSheet.create({
|
|
172
180
|
outer: {
|
|
173
|
-
padding:
|
|
174
|
-
borderRadius:
|
|
181
|
+
padding: 16,
|
|
182
|
+
borderRadius: 16,
|
|
183
|
+
position: 'relative',
|
|
184
|
+
},
|
|
185
|
+
border: {
|
|
186
|
+
position: 'absolute',
|
|
187
|
+
top: 0,
|
|
188
|
+
right: 0,
|
|
189
|
+
bottom: 0,
|
|
190
|
+
left: 0,
|
|
191
|
+
borderRadius: 16,
|
|
175
192
|
borderWidth: 1,
|
|
193
|
+
opacity: 0.3,
|
|
194
|
+
},
|
|
195
|
+
icon: {
|
|
196
|
+
flexShrink: 0,
|
|
176
197
|
},
|
|
177
198
|
row: {
|
|
178
199
|
width: '100%',
|
|
179
200
|
flexDirection: 'row',
|
|
180
201
|
alignItems: 'flex-start',
|
|
181
|
-
gap:
|
|
202
|
+
gap: 12,
|
|
182
203
|
},
|
|
183
204
|
content: {
|
|
184
|
-
gap:
|
|
205
|
+
gap: 4,
|
|
185
206
|
flex: 1,
|
|
207
|
+
minWidth: 0,
|
|
186
208
|
minHeight: 20,
|
|
187
209
|
justifyContent: 'center',
|
|
188
210
|
},
|
|
189
211
|
text: {
|
|
190
212
|
fontSize: 14,
|
|
191
|
-
lineHeight:
|
|
192
|
-
paddingRight: 12,
|
|
213
|
+
lineHeight: 22,
|
|
193
214
|
},
|
|
194
215
|
});
|