pixelize-native-library 1.0.6 → 1.0.7
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/lib/module/core/icon/index.js +68 -1
- package/lib/module/core/icon/index.js.map +1 -1
- package/lib/module/modules/bottom-nav/BottomNav.js +25 -15
- package/lib/module/modules/bottom-nav/BottomNav.js.map +1 -1
- package/lib/module/modules/bottom-nav/BottomNav.variants.js +65 -0
- package/lib/module/modules/bottom-nav/BottomNav.variants.js.map +1 -1
- package/lib/module/modules/bottom-nav/BottomNavIconWithBadge.js +75 -0
- package/lib/module/modules/bottom-nav/BottomNavIconWithBadge.js.map +1 -0
- package/lib/module/modules/bottom-nav/BottomNavOverflowSheet.js +13 -6
- package/lib/module/modules/bottom-nav/BottomNavOverflowSheet.js.map +1 -1
- package/lib/module/modules/bottom-nav/MODULE.md +25 -10
- package/lib/module/modules/charts/BarList.js +79 -0
- package/lib/module/modules/charts/BarList.js.map +1 -0
- package/lib/module/modules/charts/Charts.variants.js +59 -0
- package/lib/module/modules/charts/Charts.variants.js.map +1 -0
- package/lib/module/modules/charts/DonutChart.js +98 -0
- package/lib/module/modules/charts/DonutChart.js.map +1 -0
- package/lib/module/modules/charts/MODULE.md +52 -0
- package/lib/module/modules/charts/Sparkline.js +79 -0
- package/lib/module/modules/charts/Sparkline.js.map +1 -0
- package/lib/module/modules/charts/index.js +12 -0
- package/lib/module/modules/charts/index.js.map +1 -0
- package/lib/module/modules/list-item/ListItem.js +75 -0
- package/lib/module/modules/list-item/ListItem.js.map +1 -0
- package/lib/module/modules/list-item/ListItem.variants.js +53 -0
- package/lib/module/modules/list-item/ListItem.variants.js.map +1 -0
- package/lib/module/modules/list-item/MODULE.md +47 -0
- package/lib/module/modules/list-item/index.js +10 -0
- package/lib/module/modules/list-item/index.js.map +1 -0
- package/lib/module/modules/markdown/MODULE.md +44 -0
- package/lib/module/modules/markdown/Markdown.js +149 -0
- package/lib/module/modules/markdown/Markdown.js.map +1 -0
- package/lib/module/modules/markdown/Markdown.variants.js +68 -0
- package/lib/module/modules/markdown/Markdown.variants.js.map +1 -0
- package/lib/module/modules/markdown/index.js +11 -0
- package/lib/module/modules/markdown/index.js.map +1 -0
- package/lib/module/modules/markdown/parseMarkdown.js +153 -0
- package/lib/module/modules/markdown/parseMarkdown.js.map +1 -0
- package/lib/module/modules/multi-select/MODULE.md +1 -1
- package/lib/module/modules/multi-select/MultiSelect.js +1 -1
- package/lib/module/modules/multi-select/MultiSelect.js.map +1 -1
- package/lib/module/modules/select/MODULE.md +1 -1
- package/lib/module/modules/select/Select.js +13 -10
- package/lib/module/modules/select/Select.js.map +1 -1
- package/lib/module/modules/select/Select.variants.js +11 -0
- package/lib/module/modules/select/Select.variants.js.map +1 -1
- package/lib/module/modules/stat-tile/MODULE.md +44 -0
- package/lib/module/modules/stat-tile/StatTile.js +87 -0
- package/lib/module/modules/stat-tile/StatTile.js.map +1 -0
- package/lib/module/modules/stat-tile/StatTile.variants.js +55 -0
- package/lib/module/modules/stat-tile/StatTile.variants.js.map +1 -0
- package/lib/module/modules/stat-tile/index.js +10 -0
- package/lib/module/modules/stat-tile/index.js.map +1 -0
- package/lib/module/modules/timeline/MODULE.md +10 -1
- package/lib/module/modules/timeline/Timeline.js +4 -1
- package/lib/module/modules/timeline/Timeline.js.map +1 -1
- package/lib/module/theme/tokens/builders/accentText.js +9 -0
- package/lib/module/theme/tokens/builders/accentText.js.map +1 -1
- package/lib/typescript/core/icon/index.d.ts +38 -1
- package/lib/typescript/core/icon/index.d.ts.map +1 -1
- package/lib/typescript/modules/bottom-nav/BottomNav.d.ts +5 -1
- package/lib/typescript/modules/bottom-nav/BottomNav.d.ts.map +1 -1
- package/lib/typescript/modules/bottom-nav/BottomNav.variants.d.ts +50 -0
- package/lib/typescript/modules/bottom-nav/BottomNav.variants.d.ts.map +1 -1
- package/lib/typescript/modules/bottom-nav/BottomNavIconWithBadge.d.ts +25 -0
- package/lib/typescript/modules/bottom-nav/BottomNavIconWithBadge.d.ts.map +1 -0
- package/lib/typescript/modules/bottom-nav/BottomNavOverflowSheet.d.ts.map +1 -1
- package/lib/typescript/modules/charts/BarList.d.ts +18 -0
- package/lib/typescript/modules/charts/BarList.d.ts.map +1 -0
- package/lib/typescript/modules/charts/Charts.variants.d.ts +26 -0
- package/lib/typescript/modules/charts/Charts.variants.d.ts.map +1 -0
- package/lib/typescript/modules/charts/DonutChart.d.ts +18 -0
- package/lib/typescript/modules/charts/DonutChart.d.ts.map +1 -0
- package/lib/typescript/modules/charts/Sparkline.d.ts +13 -0
- package/lib/typescript/modules/charts/Sparkline.d.ts.map +1 -0
- package/lib/typescript/modules/charts/index.d.ts +13 -0
- package/lib/typescript/modules/charts/index.d.ts.map +1 -0
- package/lib/typescript/modules/list-item/ListItem.d.ts +15 -0
- package/lib/typescript/modules/list-item/ListItem.d.ts.map +1 -0
- package/lib/typescript/modules/list-item/ListItem.variants.d.ts +29 -0
- package/lib/typescript/modules/list-item/ListItem.variants.d.ts.map +1 -0
- package/lib/typescript/modules/list-item/index.d.ts +8 -0
- package/lib/typescript/modules/list-item/index.d.ts.map +1 -0
- package/lib/typescript/modules/markdown/Markdown.d.ts +10 -0
- package/lib/typescript/modules/markdown/Markdown.d.ts.map +1 -0
- package/lib/typescript/modules/markdown/Markdown.variants.d.ts +27 -0
- package/lib/typescript/modules/markdown/Markdown.variants.d.ts.map +1 -0
- package/lib/typescript/modules/markdown/index.d.ts +10 -0
- package/lib/typescript/modules/markdown/index.d.ts.map +1 -0
- package/lib/typescript/modules/markdown/parseMarkdown.d.ts +43 -0
- package/lib/typescript/modules/markdown/parseMarkdown.d.ts.map +1 -0
- package/lib/typescript/modules/multi-select/MultiSelect.d.ts +6 -0
- package/lib/typescript/modules/multi-select/MultiSelect.d.ts.map +1 -1
- package/lib/typescript/modules/select/Select.d.ts +6 -0
- package/lib/typescript/modules/select/Select.d.ts.map +1 -1
- package/lib/typescript/modules/select/Select.variants.d.ts +3 -0
- package/lib/typescript/modules/select/Select.variants.d.ts.map +1 -1
- package/lib/typescript/modules/stat-tile/StatTile.d.ts +16 -0
- package/lib/typescript/modules/stat-tile/StatTile.d.ts.map +1 -0
- package/lib/typescript/modules/stat-tile/StatTile.variants.d.ts +34 -0
- package/lib/typescript/modules/stat-tile/StatTile.variants.d.ts.map +1 -0
- package/lib/typescript/modules/stat-tile/index.d.ts +9 -0
- package/lib/typescript/modules/stat-tile/index.d.ts.map +1 -0
- package/lib/typescript/modules/timeline/Timeline.d.ts +4 -0
- package/lib/typescript/modules/timeline/Timeline.d.ts.map +1 -1
- package/lib/typescript/theme/tokens/builders/accentText.d.ts +6 -0
- package/lib/typescript/theme/tokens/builders/accentText.d.ts.map +1 -1
- package/package.json +22 -1
- package/registry.json +20 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createThemedVariants","LIST_ITEM_DOT_SIZE","LIST_ITEM_MIN_HEIGHT","resolveListItemColors","colors","unread","background","bg","surface","undefined","pressed","sunken","title","fg","default","subtitle","muted","dot","accent","solid","resolveListItemAccessibility","input","parts","push","accessibilityLabel","join","listItemStructure","theme","base","flexDirection","alignItems","columnGap","space","minHeight","paddingVertical","paddingHorizontal","listItemBodyStructure","flex","rowGap","listItemDotStructure","width","height","borderRadius","radii","full"],"sourceRoot":"../../../../src","sources":["modules/list-item/ListItem.variants.ts"],"mappings":";;AAAA;AACA;AACA;AACA;;AAGA,SAASA,oBAAoB,QAAQ,2BAAkB;AAEvD,OAAO,MAAMC,kBAAkB,GAAG,CAAC;AACnC,OAAO,MAAMC,oBAAoB,GAAG,EAAE;AAWtC,OAAO,SAASC,qBAAqBA,CAACC,MAAkB,EAAEC,MAAe,EAAkB;EACzF,OAAO;IACLC,UAAU,EAAED,MAAM,GAAGD,MAAM,CAACG,EAAE,CAACC,OAAO,GAAGC,SAAS;IAClD;IACA;IACAC,OAAO,EAAEN,MAAM,CAACG,EAAE,CAACI,MAAM;IACzBC,KAAK,EAAER,MAAM,CAAC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gB,KAAK,CAACC;EAC5B;AACF,CAAC,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# list-item/ — a generic pressable row (leading / title / subtitle / trailing, unread state)
|
|
2
|
+
|
|
3
|
+
`ListItem` renders one row for notification lists, inboxes, and settings screens: optional
|
|
4
|
+
`leading`/`trailing` nodes around a title + subtitle column. `unread` adds an `accent.solid` dot
|
|
5
|
+
and a `bg.surface` row emphasis (plus a semibold title) — `bg.surface`, not `bg.selected`, because
|
|
6
|
+
`fg.muted` is only measured AA against surface/hover. A `Pressable` when `onPress` is set
|
|
7
|
+
(`bg.sunken` pressed fill — measured, `fg.default` fails AA on `bg.hover` on 4 light brands),
|
|
8
|
+
a plain `View` otherwise.
|
|
9
|
+
|
|
10
|
+
## Files
|
|
11
|
+
|
|
12
|
+
| File | Role |
|
|
13
|
+
|------|------|
|
|
14
|
+
| `ListItem.tsx` | The component. |
|
|
15
|
+
| `ListItem.variants.ts` | Pure resolvers (`resolveListItemColors`, `resolveListItemAccessibility`) + themed structure. No React. |
|
|
16
|
+
| `index.ts` | Public surface: `ListItem`, `ListItemProps`. |
|
|
17
|
+
| `__tests__/ListItem.test.ts` | Pure: WCAG contrast (all brands × modes) + a11y label contract. |
|
|
18
|
+
| `__tests__/ListItem.render.test.tsx` | Render: unread dot/bg, press, leading/trailing slots. |
|
|
19
|
+
|
|
20
|
+
## Props
|
|
21
|
+
|
|
22
|
+
| Prop | Type | Default | Notes |
|
|
23
|
+
|------|------|---------|-------|
|
|
24
|
+
| `leading` | `ReactNode` | — | E.g. an `Avatar` or icon; carries its own semantics. |
|
|
25
|
+
| `title` | `string` | — | `fg.default`, semibold when `unread`. |
|
|
26
|
+
| `subtitle` | `string` | — | `fg.muted`, max 2 lines. |
|
|
27
|
+
| `trailing` | `ReactNode` | — | E.g. a timestamp `Text` or `Badge`. |
|
|
28
|
+
| `unread` | `boolean` | `false` | Accent dot (decorative, hidden from AT — "unread" is announced in the label instead) + `bg.surface` fill. |
|
|
29
|
+
| `onPress` | `() => void` | — | Row becomes a `button`-role Pressable, min 44dp tall. |
|
|
30
|
+
| `style` | `LayoutStyle` | — | Layout-only, outermost, applied exactly once, last. |
|
|
31
|
+
| `testID` | `string` | — | Also derives the `-dot` sub-id. |
|
|
32
|
+
|
|
33
|
+
## Accessibility
|
|
34
|
+
|
|
35
|
+
- Pressable rows carry `accessibilityLabel = "title, subtitle, unread?"` so the dot never has to
|
|
36
|
+
speak for itself; non-pressable rows leave the text nodes in the normal tree.
|
|
37
|
+
- Title/subtitle are measured ≥ 4.5:1 against the canvas, the `bg.surface` unread fill, and the
|
|
38
|
+
`bg.sunken` pressed fill for all 8 brands × both modes (`ListItem.test.ts`).
|
|
39
|
+
|
|
40
|
+
## Known gaps
|
|
41
|
+
|
|
42
|
+
- `leading`/`trailing` are `ReactNode` slots (per the generic-row spec) — the nodes' own contrast
|
|
43
|
+
and touch-target concerns belong to the consumer.
|
|
44
|
+
|
|
45
|
+
## Performance
|
|
46
|
+
|
|
47
|
+
Wrapped in `React.memo`; the Pressable style function is `useCallback`'d.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Public surface of `pixelize-native-library/list-item`. Value exports and type exports are split
|
|
5
|
+
* for `verbatimModuleSyntax`. The resolvers stay internal — a consumer configures a ListItem
|
|
6
|
+
* through its props, never by importing its internals.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
export { ListItem } from "./ListItem.js";
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["ListItem"],"sourceRoot":"../../../../src","sources":["modules/list-item/index.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;;AAEA,SAASA,QAAQ,QAAQ,eAAY","ignoreList":[]}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# markdown/ — a dependency-free markdown renderer
|
|
2
|
+
|
|
3
|
+
`Markdown` parses and renders a markdown string with a small hand-rolled parser — no third-party
|
|
4
|
+
markdown/renderer dependency. Supported: h1–h3, bold, italic, inline code, fenced code blocks
|
|
5
|
+
(monospace block on a `bg.sunken` fill, no copy button), unordered/ordered lists, links,
|
|
6
|
+
blockquotes, paragraphs. The parser never throws: malformed input degrades to literal text, an
|
|
7
|
+
unclosed fence swallows the rest of the input as code.
|
|
8
|
+
|
|
9
|
+
## Files
|
|
10
|
+
|
|
11
|
+
| File | Role |
|
|
12
|
+
|------|------|
|
|
13
|
+
| `parseMarkdown.ts` | Pure parser: `parseMarkdown(content) → MarkdownBlockNode[]`. No imports at all. |
|
|
14
|
+
| `Markdown.tsx` | The renderer. Parse memoized on `content`. |
|
|
15
|
+
| `Markdown.variants.ts` | Pure resolvers (`resolveMarkdownColors`, heading specs) + themed structure. No React. |
|
|
16
|
+
| `index.ts` | Public surface: `Markdown`, `MarkdownProps`, `parseMarkdown`, node types. |
|
|
17
|
+
| `__tests__/parseMarkdown.test.ts` | Pure: every block/inline form + malformed-input robustness. |
|
|
18
|
+
| `__tests__/Markdown.test.ts` | Pure: WCAG contrast for text/link/quote roles (all brands × modes). |
|
|
19
|
+
| `__tests__/Markdown.render.test.tsx` | Render: headings, lists, code, link press wiring. |
|
|
20
|
+
|
|
21
|
+
## Props
|
|
22
|
+
|
|
23
|
+
| Prop | Type | Default | Notes |
|
|
24
|
+
|------|------|---------|-------|
|
|
25
|
+
| `content` | `string` | — | The markdown source. |
|
|
26
|
+
| `onLinkPress` | `(url: string) => void` | — | Links render underlined `accent.text`; without this, a link is styled but inert (the library never opens URLs itself). |
|
|
27
|
+
| `style` | `LayoutStyle` | — | Layout-only, outermost, applied exactly once, last. |
|
|
28
|
+
| `testID` | `string` | — | |
|
|
29
|
+
|
|
30
|
+
## Rendering roles
|
|
31
|
+
|
|
32
|
+
Body/list text `fg.default`, blockquote `fg.muted` behind a `border.default` left rule
|
|
33
|
+
(decorative, Divider's reasoning), code on `bg.sunken`, links `accent.text` + underline
|
|
34
|
+
(`link` a11y role), headings `2xl bold` / `xl semibold` / `lg semibold` with the `header` a11y
|
|
35
|
+
role. Monospace is the platform face (Menlo/monospace) — the token layer has no mono family.
|
|
36
|
+
|
|
37
|
+
## Known gaps
|
|
38
|
+
|
|
39
|
+
- No nesting inside bold/italic spans, no images, no tables, no task lists — out of scope for a
|
|
40
|
+
chat/notes body renderer; unsupported syntax renders as its literal text.
|
|
41
|
+
|
|
42
|
+
## Performance
|
|
43
|
+
|
|
44
|
+
Wrapped in `React.memo`; the parse is `useMemo`'d on `content`.
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { Fragment, memo, useMemo } from "react";
|
|
4
|
+
import { Platform, StyleSheet, Text, View } from "react-native";
|
|
5
|
+
import { useTheme } from "../../theme/index.js";
|
|
6
|
+
import { markdownBlockquoteStructure, markdownCodeBlockStructure, markdownListRowStructure, markdownListStructure, markdownStructure, resolveMarkdownColors, resolveMarkdownHeading } from "./Markdown.variants.js";
|
|
7
|
+
import { parseMarkdown } from "./parseMarkdown.js";
|
|
8
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
|
+
const MONO_FONT = Platform.select({
|
|
10
|
+
ios: "Menlo",
|
|
11
|
+
default: "monospace"
|
|
12
|
+
});
|
|
13
|
+
function renderInline(nodes, theme, colors, onLinkPress) {
|
|
14
|
+
return nodes.map((node, index) => {
|
|
15
|
+
switch (node.type) {
|
|
16
|
+
case "bold":
|
|
17
|
+
return /*#__PURE__*/_jsx(Text, {
|
|
18
|
+
style: theme.fontStyleForWeight(theme.fontWeights.bold),
|
|
19
|
+
children: node.content
|
|
20
|
+
}, index);
|
|
21
|
+
case "italic":
|
|
22
|
+
return /*#__PURE__*/_jsx(Text, {
|
|
23
|
+
style: styles.italic,
|
|
24
|
+
children: node.content
|
|
25
|
+
}, index);
|
|
26
|
+
case "code":
|
|
27
|
+
return /*#__PURE__*/_jsx(Text, {
|
|
28
|
+
style: [styles.mono, {
|
|
29
|
+
backgroundColor: colors.codeBackground,
|
|
30
|
+
color: colors.code
|
|
31
|
+
}],
|
|
32
|
+
children: node.content
|
|
33
|
+
}, index);
|
|
34
|
+
case "link":
|
|
35
|
+
return /*#__PURE__*/_jsx(Text, {
|
|
36
|
+
accessibilityRole: "link",
|
|
37
|
+
onPress: onLinkPress === undefined ? undefined : () => onLinkPress(node.url),
|
|
38
|
+
style: [styles.link, {
|
|
39
|
+
color: colors.link
|
|
40
|
+
}],
|
|
41
|
+
children: node.content
|
|
42
|
+
}, index);
|
|
43
|
+
default:
|
|
44
|
+
return /*#__PURE__*/_jsx(Fragment, {
|
|
45
|
+
children: node.content
|
|
46
|
+
}, index);
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
function renderBlock(block, index, theme, colors, onLinkPress) {
|
|
51
|
+
switch (block.type) {
|
|
52
|
+
case "heading":
|
|
53
|
+
{
|
|
54
|
+
const spec = resolveMarkdownHeading(theme, block.level);
|
|
55
|
+
return /*#__PURE__*/_jsx(Text, {
|
|
56
|
+
accessibilityRole: "header",
|
|
57
|
+
style: [theme.fontStyleForWeight(theme.fontWeights[spec.fontWeight]), {
|
|
58
|
+
fontSize: spec.fontSize,
|
|
59
|
+
color: colors.heading
|
|
60
|
+
}],
|
|
61
|
+
children: renderInline(block.children, theme, colors, onLinkPress)
|
|
62
|
+
}, index);
|
|
63
|
+
}
|
|
64
|
+
case "code-block":
|
|
65
|
+
return /*#__PURE__*/_jsx(View, {
|
|
66
|
+
style: [markdownCodeBlockStructure(theme), {
|
|
67
|
+
backgroundColor: colors.codeBackground
|
|
68
|
+
}],
|
|
69
|
+
children: /*#__PURE__*/_jsx(Text, {
|
|
70
|
+
style: [styles.mono, {
|
|
71
|
+
fontSize: theme.fontSizes.sm,
|
|
72
|
+
color: colors.code
|
|
73
|
+
}],
|
|
74
|
+
children: block.content
|
|
75
|
+
})
|
|
76
|
+
}, index);
|
|
77
|
+
case "blockquote":
|
|
78
|
+
return /*#__PURE__*/_jsx(View, {
|
|
79
|
+
style: [markdownBlockquoteStructure(theme), {
|
|
80
|
+
borderLeftColor: colors.quoteBorder
|
|
81
|
+
}],
|
|
82
|
+
children: /*#__PURE__*/_jsx(Text, {
|
|
83
|
+
style: [theme.fontStyleForWeight(theme.fontWeights.regular), {
|
|
84
|
+
fontSize: theme.fontSizes.md,
|
|
85
|
+
color: colors.quoteText
|
|
86
|
+
}],
|
|
87
|
+
children: renderInline(block.children, theme, colors, onLinkPress)
|
|
88
|
+
})
|
|
89
|
+
}, index);
|
|
90
|
+
case "list":
|
|
91
|
+
return /*#__PURE__*/_jsx(View, {
|
|
92
|
+
style: markdownListStructure(theme),
|
|
93
|
+
children: block.items.map((item, itemIndex) => /*#__PURE__*/_jsxs(View, {
|
|
94
|
+
style: markdownListRowStructure(theme),
|
|
95
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
96
|
+
style: [theme.fontStyleForWeight(theme.fontWeights.regular), {
|
|
97
|
+
fontSize: theme.fontSizes.md,
|
|
98
|
+
color: colors.listMarker
|
|
99
|
+
}],
|
|
100
|
+
children: block.ordered ? `${itemIndex + 1}.` : "•"
|
|
101
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
102
|
+
style: [theme.fontStyleForWeight(theme.fontWeights.regular), styles.listContent, {
|
|
103
|
+
fontSize: theme.fontSizes.md,
|
|
104
|
+
color: colors.text
|
|
105
|
+
}],
|
|
106
|
+
children: renderInline(item, theme, colors, onLinkPress)
|
|
107
|
+
})]
|
|
108
|
+
}, itemIndex))
|
|
109
|
+
}, index);
|
|
110
|
+
default:
|
|
111
|
+
return /*#__PURE__*/_jsx(Text, {
|
|
112
|
+
style: [theme.fontStyleForWeight(theme.fontWeights.regular), {
|
|
113
|
+
fontSize: theme.fontSizes.md,
|
|
114
|
+
color: colors.text
|
|
115
|
+
}],
|
|
116
|
+
children: renderInline(block.children, theme, colors, onLinkPress)
|
|
117
|
+
}, index);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
export const Markdown = /*#__PURE__*/memo(function Markdown({
|
|
121
|
+
content,
|
|
122
|
+
onLinkPress,
|
|
123
|
+
style,
|
|
124
|
+
testID
|
|
125
|
+
}) {
|
|
126
|
+
const theme = useTheme();
|
|
127
|
+
const colors = resolveMarkdownColors(theme.colors);
|
|
128
|
+
const blocks = useMemo(() => parseMarkdown(content), [content]);
|
|
129
|
+
return /*#__PURE__*/_jsx(View, {
|
|
130
|
+
testID: testID,
|
|
131
|
+
style: [markdownStructure(theme), style],
|
|
132
|
+
children: blocks.map((block, index) => renderBlock(block, index, theme, colors, onLinkPress))
|
|
133
|
+
});
|
|
134
|
+
});
|
|
135
|
+
const styles = StyleSheet.create({
|
|
136
|
+
italic: {
|
|
137
|
+
fontStyle: "italic"
|
|
138
|
+
},
|
|
139
|
+
mono: {
|
|
140
|
+
fontFamily: MONO_FONT
|
|
141
|
+
},
|
|
142
|
+
link: {
|
|
143
|
+
textDecorationLine: "underline"
|
|
144
|
+
},
|
|
145
|
+
listContent: {
|
|
146
|
+
flex: 1
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
//# sourceMappingURL=Markdown.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Fragment","memo","useMemo","Platform","StyleSheet","Text","View","useTheme","markdownBlockquoteStructure","markdownCodeBlockStructure","markdownListRowStructure","markdownListStructure","markdownStructure","resolveMarkdownColors","resolveMarkdownHeading","parseMarkdown","jsx","_jsx","jsxs","_jsxs","MONO_FONT","select","ios","default","renderInline","nodes","theme","colors","onLinkPress","map","node","index","type","style","fontStyleForWeight","fontWeights","bold","children","content","styles","italic","mono","backgroundColor","codeBackground","color","code","accessibilityRole","onPress","undefined","url","link","renderBlock","block","spec","level","fontWeight","fontSize","heading","fontSizes","sm","borderLeftColor","quoteBorder","regular","md","quoteText","items","item","itemIndex","listMarker","ordered","listContent","text","Markdown","testID","blocks","create","fontStyle","fontFamily","textDecorationLine","flex"],"sourceRoot":"../../../../src","sources":["modules/markdown/Markdown.tsx"],"mappings":";;AAAA,SAASA,QAAQ,EAAEC,IAAI,EAAEC,OAAO,QAAQ,OAAO;AAC/C,SAASC,QAAQ,EAAEC,UAAU,EAAEC,IAAI,EAAEC,IAAI,QAAQ,cAAc;AAG/D,SAASC,QAAQ,QAAQ,sBAAa;AAGtC,SACEC,2BAA2B,EAC3BC,0BAA0B,EAC1BC,wBAAwB,EACxBC,qBAAqB,EACrBC,iBAAiB,EACjBC,qBAAqB,EACrBC,sBAAsB,QACjB,wBAAqB;AAE5B,SAASC,aAAa,QAAQ,oBAAiB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAWhD,MAAMC,SAAS,GAAGjB,QAAQ,CAACkB,MAAM,CAAC;EAAEC,GAAG,EAAE,OAAO;EAAEC,OAAO,EAAE;AAAY,CAAC,CAAC;AAEzE,SAASC,YAAYA,CACnBC,KAAoC,EACpCC,KAAY,EACZC,MAAsB,EACtBC,WAAgD,EAChD;EACA,OAAOH,KAAK,CAACI,GAAG,CAAC,CAACC,IAAI,EAAEC,KAAK,KAAK;IAChC,QAAQD,IAAI,CAACE,IAAI;MACf,KAAK,MAAM;QACT,oBACEf,IAAA,CAACZ,IAAI;UAAa4B,KAAK,EAAEP,KAAK,CAACQ,kBAAkB,CAACR,KAAK,CAACS,WAAW,CAACC,IAAI,CAAE;UAAAC,QAAA,EACvEP,IAAI,CAACQ;QAAO,GADJP,KAEL,CAAC;MAEX,KAAK,QAAQ;QACX,oBACEd,IAAA,CAACZ,IAAI;UAAa4B,KAAK,EAAEM,MAAM,CAACC,MAAO;UAAAH,QAAA,EACpCP,IAAI,CAACQ;QAAO,GADJP,KAEL,CAAC;MAEX,KAAK,MAAM;QACT,oBACEd,IAAA,CAACZ,IAAI;UAAa4B,KAAK,EAAE,CAACM,MAAM,CAACE,IAAI,EAAE;YA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SAASuE,QAAQA,CAAC;EAAElC,OAAO;EAAEV,WAAW;EAAEK,KAAK;EAAEwC;AAAsB,CAAC,EAAE;EACrG,MAAM/C,KAAK,GAAGnB,QAAQ,CAAC,CAAC;EACxB,MAAMoB,MAAM,GAAGd,qBAAqB,CAACa,KAAK,CAACC,MAAM,CAAC;EAClD,MAAM+C,MAAM,GAAGxE,OAAO,CAAC,MAAMa,aAAa,CAACuB,OAAO,CAAC,EAAE,CAACA,OAAO,CAAC,CAAC;EAE/D,oBACErB,IAAA,CAACX,IAAI;IAACmE,MAAM,EAAEA,MAAO;IAACxC,KAAK,EAAE,CAACrB,iBAAiB,CAACc,KAAK,CAAC,EAAEO,KAAK,CAAE;IAAAI,QAAA,EAC5DqC,MAAM,CAAC7C,GAAG,CAAC,CAACuB,KAAK,EAAErB,KAAK,KAAKoB,WAAW,CAACC,KAAK,EAAErB,KAAK,EAAEL,KAAK,EAAEC,MAAM,EAAEC,WAAW,CAAC;EAAC,CAChF,CAAC;AAEX,CAAC,CAAC;AAEF,MAAMW,MAAM,GAAGnC,UAAU,CAACuE,MAAM,CAAC;EAC/BnC,MAAM,EAAE;IAAEoC,SAAS,EAAE;EAAS,CAAC;EAC/BnC,IAAI,EAAE;IAAEoC,UAAU,EAAEzD;EAAU,CAAC;EAC/B8B,IAAI,EAAE;IAAE4B,kBAAkB,EAAE;EAAY,CAAC;EACzCR,WAAW,EAAE;IAAES,IAAI,EAAE;EAAE;AACzB,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Pure resolvers for Markdown — no React, so the WCAG tests import this directly (mocking only
|
|
5
|
+
* `react-native`'s `StyleSheet`, as every sibling module's tests do).
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { createThemedVariants } from "../../core/style/index.js";
|
|
9
|
+
export function resolveMarkdownColors(colors) {
|
|
10
|
+
return {
|
|
11
|
+
text: colors.fg.default,
|
|
12
|
+
heading: colors.fg.default,
|
|
13
|
+
codeBackground: colors.bg.sunken,
|
|
14
|
+
code: colors.fg.default,
|
|
15
|
+
link: colors.accent.text,
|
|
16
|
+
quoteBorder: colors.border.default,
|
|
17
|
+
quoteText: colors.fg.muted,
|
|
18
|
+
listMarker: colors.fg.muted
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export function resolveMarkdownHeading(theme, level) {
|
|
22
|
+
switch (level) {
|
|
23
|
+
case 1:
|
|
24
|
+
return {
|
|
25
|
+
fontSize: theme.fontSizes["2xl"],
|
|
26
|
+
fontWeight: "bold"
|
|
27
|
+
};
|
|
28
|
+
case 2:
|
|
29
|
+
return {
|
|
30
|
+
fontSize: theme.fontSizes.xl,
|
|
31
|
+
fontWeight: "semibold"
|
|
32
|
+
};
|
|
33
|
+
case 3:
|
|
34
|
+
return {
|
|
35
|
+
fontSize: theme.fontSizes.lg,
|
|
36
|
+
fontWeight: "semibold"
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
export const markdownStructure = createThemedVariants(theme => ({
|
|
41
|
+
base: {
|
|
42
|
+
rowGap: theme.space[3]
|
|
43
|
+
}
|
|
44
|
+
}));
|
|
45
|
+
export const markdownCodeBlockStructure = createThemedVariants(theme => ({
|
|
46
|
+
base: {
|
|
47
|
+
borderRadius: theme.radii.base,
|
|
48
|
+
padding: theme.space[3]
|
|
49
|
+
}
|
|
50
|
+
}));
|
|
51
|
+
export const markdownBlockquoteStructure = createThemedVariants(theme => ({
|
|
52
|
+
base: {
|
|
53
|
+
borderLeftWidth: theme.borderWidths.thick,
|
|
54
|
+
paddingLeft: theme.space[3]
|
|
55
|
+
}
|
|
56
|
+
}));
|
|
57
|
+
export const markdownListStructure = createThemedVariants(theme => ({
|
|
58
|
+
base: {
|
|
59
|
+
rowGap: theme.space[1]
|
|
60
|
+
}
|
|
61
|
+
}));
|
|
62
|
+
export const markdownListRowStructure = createThemedVariants(theme => ({
|
|
63
|
+
base: {
|
|
64
|
+
flexDirection: "row",
|
|
65
|
+
columnGap: theme.space[2]
|
|
66
|
+
}
|
|
67
|
+
}));
|
|
68
|
+
//# sourceMappingURL=Markdown.variants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createThemedVariants","resolveMarkdownColors","colors","text","fg","default","heading","codeBackground","bg","sunken","code","link","accent","quoteBorder","border","quoteText","muted","listMarker","resolveMarkdownHeading","theme","level","fontSize","fontSizes","fontWeight","xl","lg","markdownStructure","base","rowGap","space","markdownCodeBlockStructure","borderRadius","radii","padding","markdownBlockquoteStructure","borderLeftWidth","borderWidths","thick","paddingLeft","markdownListStructure","markdownListRowStructure","flexDirection","columnGap"],"sourceRoot":"../../../../src","sources":["modules/markdown/Markdown.variants.ts"],"mappings":";;AAAA;AACA;AACA;AACA;;AAGA,SAASA,oBAAoB,QAAQ,2BAAkB;AAavD,OAAO,SAASC,qBAAqBA,CAACC,MAAkB,EAAkB;EACxE,OAAO;IACLC,IAAI,EAAED,MAAM,CAACE,EAAE,CAACC,OAAO;IACvBC,OAAO,EAAEJ,MAAM,CAACE,EAAE,CAACC,OAAO;IAC1BE,cAAc,EAAEL,MAAM,CAACM,EAAE,CAACC,MAAM;IAChCC,IAAI,EAAER,MAAM,CAACE,EAAE,CAACC,OAAO;IACvBM,IAAI,EAAET,MAAM,CAACU,MAAM,CAACT,IAAI;IACxBU,WAAW,EAAEX,MAAM,CAACY,MAAM,CAACT,OAAO;IAClCU,SAAS,EAAEb,MAAM,CAACE,EAAE,CAACY,KAAK;IAC1BC,UAAU,EAAEf,MAAM,CAACE,EAAE,CAACY;EACxB,CAAC;AACH;AAOA,OAAO,SAASE,sBAAsBA,CAACC,KAAY,EAAEC,KAAgB,EAAuB;EAC1F,QAAQA,KAAK;IACX,KAAK,CAAC;MACJ,OAAO;QAAEC,QAAQ,EAAEF,KAAK,CAACG,SAAS,CAAC,KAAK,CAAC;QAAEC,UAAU,EAAE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1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Public surface of `pixelize-native-library/markdown`. Value exports and type exports are split
|
|
5
|
+
* for `verbatimModuleSyntax`. The parser is exported for consumers that need the node tree
|
|
6
|
+
* (e.g. extracting plain text); the style resolvers stay internal.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
export { Markdown } from "./Markdown.js";
|
|
10
|
+
export { parseMarkdown } from "./parseMarkdown.js";
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Markdown","parseMarkdown"],"sourceRoot":"../../../../src","sources":["modules/markdown/index.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;;AAEA,SAASA,QAAQ,QAAQ,eAAY;AAGrC,SAASC,aAAa,QAAQ,oBAAiB","ignoreList":[]}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A small hand-rolled markdown parser — no dependencies, never throws. Supports the subset the
|
|
5
|
+
* renderer draws: h1–h3, bold, italic, inline code, fenced code blocks, unordered/ordered lists,
|
|
6
|
+
* links, blockquotes, paragraphs. Anything malformed degrades to literal text.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
const HEADING_RE = /^(#{1,3})\s+(.*)$/;
|
|
10
|
+
const UNORDERED_RE = /^\s*[-*+]\s+(.*)$/;
|
|
11
|
+
const ORDERED_RE = /^\s*\d+[.)]\s+(.*)$/;
|
|
12
|
+
const BLOCKQUOTE_RE = /^\s*>\s?(.*)$/;
|
|
13
|
+
const FENCE_RE = /^\s*```/;
|
|
14
|
+
const INLINE_RE = /`([^`\n]+)`|\[([^\]\n]+)\]\(([^()\s]+)\)|\*\*([^*\n]+)\*\*|__([^_\n]+)__|\*([^*\n]+)\*|_([^_\n]+)_/g;
|
|
15
|
+
export function parseInline(text) {
|
|
16
|
+
const nodes = [];
|
|
17
|
+
let last = 0;
|
|
18
|
+
INLINE_RE.lastIndex = 0;
|
|
19
|
+
for (let match = INLINE_RE.exec(text); match !== null; match = INLINE_RE.exec(text)) {
|
|
20
|
+
if (match.index > last) nodes.push({
|
|
21
|
+
type: "text",
|
|
22
|
+
content: text.slice(last, match.index)
|
|
23
|
+
});
|
|
24
|
+
const [, code, linkText, linkUrl, bold, boldAlt, italic, italicAlt] = match;
|
|
25
|
+
if (code !== undefined) nodes.push({
|
|
26
|
+
type: "code",
|
|
27
|
+
content: code
|
|
28
|
+
});else if (linkText !== undefined && linkUrl !== undefined) nodes.push({
|
|
29
|
+
type: "link",
|
|
30
|
+
content: linkText,
|
|
31
|
+
url: linkUrl
|
|
32
|
+
});else if (bold !== undefined) nodes.push({
|
|
33
|
+
type: "bold",
|
|
34
|
+
content: bold
|
|
35
|
+
});else if (boldAlt !== undefined) nodes.push({
|
|
36
|
+
type: "bold",
|
|
37
|
+
content: boldAlt
|
|
38
|
+
});else if (italic !== undefined) nodes.push({
|
|
39
|
+
type: "italic",
|
|
40
|
+
content: italic
|
|
41
|
+
});else if (italicAlt !== undefined) nodes.push({
|
|
42
|
+
type: "italic",
|
|
43
|
+
content: italicAlt
|
|
44
|
+
});
|
|
45
|
+
last = match.index + match[0].length;
|
|
46
|
+
}
|
|
47
|
+
if (last < text.length) nodes.push({
|
|
48
|
+
type: "text",
|
|
49
|
+
content: text.slice(last)
|
|
50
|
+
});
|
|
51
|
+
return nodes;
|
|
52
|
+
}
|
|
53
|
+
function parseBlocks(content) {
|
|
54
|
+
const lines = content.split(/\r?\n/);
|
|
55
|
+
const blocks = [];
|
|
56
|
+
let paragraph = [];
|
|
57
|
+
const flushParagraph = () => {
|
|
58
|
+
if (paragraph.length === 0) return;
|
|
59
|
+
blocks.push({
|
|
60
|
+
type: "paragraph",
|
|
61
|
+
children: parseInline(paragraph.join(" "))
|
|
62
|
+
});
|
|
63
|
+
paragraph = [];
|
|
64
|
+
};
|
|
65
|
+
let i = 0;
|
|
66
|
+
while (i < lines.length) {
|
|
67
|
+
const line = lines[i] ?? "";
|
|
68
|
+
if (FENCE_RE.test(line)) {
|
|
69
|
+
flushParagraph();
|
|
70
|
+
const body = [];
|
|
71
|
+
i += 1;
|
|
72
|
+
// An unclosed fence swallows the rest of the input rather than failing.
|
|
73
|
+
while (i < lines.length && !FENCE_RE.test(lines[i] ?? "")) {
|
|
74
|
+
body.push(lines[i] ?? "");
|
|
75
|
+
i += 1;
|
|
76
|
+
}
|
|
77
|
+
i += 1;
|
|
78
|
+
blocks.push({
|
|
79
|
+
type: "code-block",
|
|
80
|
+
content: body.join("\n")
|
|
81
|
+
});
|
|
82
|
+
continue;
|
|
83
|
+
}
|
|
84
|
+
const heading = HEADING_RE.exec(line);
|
|
85
|
+
if (heading !== null) {
|
|
86
|
+
flushParagraph();
|
|
87
|
+
const level = Math.min((heading[1] ?? "#").length, 3);
|
|
88
|
+
blocks.push({
|
|
89
|
+
type: "heading",
|
|
90
|
+
level,
|
|
91
|
+
children: parseInline(heading[2] ?? "")
|
|
92
|
+
});
|
|
93
|
+
i += 1;
|
|
94
|
+
continue;
|
|
95
|
+
}
|
|
96
|
+
if (BLOCKQUOTE_RE.test(line)) {
|
|
97
|
+
flushParagraph();
|
|
98
|
+
const quoted = [];
|
|
99
|
+
while (i < lines.length) {
|
|
100
|
+
const quote = BLOCKQUOTE_RE.exec(lines[i] ?? "");
|
|
101
|
+
if (quote === null) break;
|
|
102
|
+
quoted.push(quote[1] ?? "");
|
|
103
|
+
i += 1;
|
|
104
|
+
}
|
|
105
|
+
blocks.push({
|
|
106
|
+
type: "blockquote",
|
|
107
|
+
children: parseInline(quoted.join(" ").trim())
|
|
108
|
+
});
|
|
109
|
+
continue;
|
|
110
|
+
}
|
|
111
|
+
if (UNORDERED_RE.test(line) || ORDERED_RE.test(line)) {
|
|
112
|
+
flushParagraph();
|
|
113
|
+
const ordered = ORDERED_RE.test(line) && !UNORDERED_RE.test(line);
|
|
114
|
+
const itemRe = ordered ? ORDERED_RE : UNORDERED_RE;
|
|
115
|
+
const items = [];
|
|
116
|
+
while (i < lines.length) {
|
|
117
|
+
const item = itemRe.exec(lines[i] ?? "");
|
|
118
|
+
if (item === null) break;
|
|
119
|
+
items.push(parseInline(item[1] ?? ""));
|
|
120
|
+
i += 1;
|
|
121
|
+
}
|
|
122
|
+
blocks.push({
|
|
123
|
+
type: "list",
|
|
124
|
+
ordered,
|
|
125
|
+
items
|
|
126
|
+
});
|
|
127
|
+
continue;
|
|
128
|
+
}
|
|
129
|
+
if (line.trim() === "") {
|
|
130
|
+
flushParagraph();
|
|
131
|
+
i += 1;
|
|
132
|
+
continue;
|
|
133
|
+
}
|
|
134
|
+
paragraph.push(line.trim());
|
|
135
|
+
i += 1;
|
|
136
|
+
}
|
|
137
|
+
flushParagraph();
|
|
138
|
+
return blocks;
|
|
139
|
+
}
|
|
140
|
+
export function parseMarkdown(content) {
|
|
141
|
+
try {
|
|
142
|
+
return parseBlocks(content);
|
|
143
|
+
} catch {
|
|
144
|
+
return [{
|
|
145
|
+
type: "paragraph",
|
|
146
|
+
children: [{
|
|
147
|
+
type: "text",
|
|
148
|
+
content
|
|
149
|
+
}]
|
|
150
|
+
}];
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
//# sourceMappingURL=parseMarkdown.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["HEADING_RE","UNORDERED_RE","ORDERED_RE","BLOCKQUOTE_RE","FENCE_RE","INLINE_RE","parseInline","text","nodes","last","lastIndex","match","exec","index","push","type","content","slice","code","linkText","linkUrl","bold","boldAlt","italic","italicAlt","undefined","url","length","parseBlocks","lines","split","blocks","paragraph","flushParagraph","children","join","i","line","test","body","heading","level","Math","min","quoted","quote","trim","ordered","itemRe","items","item","parseMarkdown"],"sourceRoot":"../../../../src","sources":["modules/markdown/parseMarkdown.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;;AAoBA,MAAMA,UAAU,GAA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CAAC,KAAK,EAAE,EAAE;MACtBb,cAAc,CAAC,CAAC;MAChBG,CAAC,IAAI,CAAC;MACN;IACF;IAEAJ,SAAS,CAAClB,IAAI,CAACuB,IAAI,CAACS,IAAI,CAAC,CAAC,CAAC;IAC3BV,CAAC,IAAI,CAAC;EACR;EAEAH,cAAc,CAAC,CAAC;EAChB,OAAOF,MAAM;AACf;AAEA,OAAO,SAASoB,aAAaA,CAACnC,OAAe,EAAuB;EAClE,IAAI;IACF,OAAOY,WAAW,CAACZ,OAAO,CAAC;EAC7B,CAAC,CAAC,MAAM;IACN,OAAO,CAAC;MAAED,IAAI,EAAE,WAAW;MAAEmB,QAAQ,EAAE,CAAC;QAAEnB,IAAI,EAAE,MAAM;QAAEC;MAAQ,CAAC;IAAE,CAAC,CAAC;EACvE;AACF","ignoreList":[]}
|
|
@@ -28,7 +28,7 @@ context + a stateless helper with no React-tree footprint of its own, not a depe
|
|
|
28
28
|
|
|
29
29
|
| Prop | Type | Default | Notes |
|
|
30
30
|
|------|------|---------|-------|
|
|
31
|
-
| `options` | `{ label: string; value: string }[]` | — | Required. |
|
|
31
|
+
| `options` | `{ label: string; value: string; leading?: ReactNode }[]` | — | Required. `leading` is an optional fixed-size adornment (e.g. an avatar) rendered between the checkbox indicator and the row label — the ReactNode content-slot precedent set by `ListItem`'s `leading`. Rows only; the trigger keeps its text-only summary. |
|
|
32
32
|
| `values` | `string[]` | — | Required. The currently selected `value`s. |
|
|
33
33
|
| `onValuesChange` | `(values: string[]) => void` | — | Required. Fired immediately on row press with the next array — no separate Apply/Cancel. |
|
|
34
34
|
| `placeholder` | `string` | — | Shown when `values` is empty. |
|
|
@@ -120,7 +120,7 @@ export const MultiSelect = /*#__PURE__*/memo(function MultiSelect({
|
|
|
120
120
|
color: rowColors.indicatorIcon,
|
|
121
121
|
strokeWidth: ICON_STROKE
|
|
122
122
|
})
|
|
123
|
-
}), /*#__PURE__*/_jsx(Text, {
|
|
123
|
+
}), option.leading, /*#__PURE__*/_jsx(Text, {
|
|
124
124
|
numberOfLines: 1,
|
|
125
125
|
style: [theme.fontStyleForWeight(theme.fontWeights.regular), {
|
|
126
126
|
flex: 1,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["memo","useContext","useState","Modal","Platform","Pressable","ScrollView","StyleSheet","Text","View","useReducedMotion","Icon","useTheme","ModalPortalContext","renderWebPortal","MULTI_SELECT_CLOSE_BUTTON_HIT_SLOP","MULTI_SELECT_CLOSE_ICON_SIZE","MULTI_SELECT_ROW_ICON_SIZE","MULTI_SELECT_SIZES","multiSelectCloseButtonStructure","multiSelectHeaderStructure","multiSelectOverlayStructure","multiSelectRowIndicatorStructure","multiSelectRowStructure","multiSelectSheetStructure","multiSelectTriggerStructure","resolveMultiSelectAccessibility","resolveMultiSelectRowColors","resolveMultiSelectTriggerColors","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","ICON_STROKE","BACKDROP_SCRIM","MultiSelect","options","values","onValuesChange","placeholder","label","disabled","size","containerStyle","testID","theme","reducedMotion","portalContainer","open","setOpen","focused","setFocused","spec","selectedCount","length","isPlaceholder","singleLabel","find","option","value","undefined","displayText","triggerColors","colors","rowColors","a11y","accessibleName","openMenu","closeMenu","toggleValue","next","includes","filter","v","sheet","children","accessible","style","absoluteFill","backgroundColor","onPress","pointerEvents","bg","surface","accessibilityRole","accessibilityLabel","hitSlop","name","color","text","strokeWidth","bounces","map","checked","accessibilityState","background","borderColor","indicatorFill","indicatorBorder","indicatorIcon","numberOfLines","fontStyleForWeight","fontWeights","regular","flex","fontSize","fontSizes","md","menu","OS","visible","transparent","animationType","onRequestClose","styles","container","medium","sm","fg","muted","marginBottom","space","onFocus","onBlur","border","dimmed","flexShrink","iconSize","icon","create","alignSelf","opacity"],"sourceRoot":"../../../../src","sources":["modules/multi-select/MultiSelect.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;
|
|
1
|
+
{"version":3,"names":["memo","useContext","useState","Modal","Platform","Pressable","ScrollView","StyleSheet","Text","View","useReducedMotion","Icon","useTheme","ModalPortalContext","renderWebPortal","MULTI_SELECT_CLOSE_BUTTON_HIT_SLOP","MULTI_SELECT_CLOSE_ICON_SIZE","MULTI_SELECT_ROW_ICON_SIZE","MULTI_SELECT_SIZES","multiSelectCloseButtonStructure","multiSelectHeaderStructure","multiSelectOverlayStructure","multiSelectRowIndicatorStructure","multiSelectRowStructure","multiSelectSheetStructure","multiSelectTriggerStructure","resolveMultiSelectAccessibility","resolveMultiSelectRowColors","resolveMultiSelectTriggerColors","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","ICON_STROKE","BACKDROP_SCRIM","MultiSelect","options","values","onValuesChange","placeholder","label","disabled","size","containerStyle","testID","theme","reducedMotion","portalContainer","open","setOpen","focused","setFocused","spec","selectedCount","length","isPlaceholder","singleLabel","find","option","value","undefined","displayText","triggerColors","colors","rowColors","a11y","accessibleName","openMenu","closeMenu","toggleValue","next","includes","filter","v","sheet","children","accessible","style","absoluteFill","backgroundColor","onPress","pointerEvents","bg","surface","accessibilityRole","accessibilityLabel","hitSlop","name","color","text","strokeWidth","bounces","map","checked","accessibilityState","background","borderColor","indicatorFill","indicatorBorder","indicatorIcon","leading","numberOfLines","fontStyleForWeight","fontWeights","regular","flex","fontSize","fontSizes","md","menu","OS","visible","transparent","animationType","onRequestClose","styles","container","medium","sm","fg","muted","marginBottom","space","onFocus","onBlur","border","dimmed","flexShrink","iconSize","icon","create","alignSelf","opacity"],"sourceRoot":"../../../../src","sources":["modules/multi-select/MultiSelect.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,IAAI,EAAEC,UAAU,EAAEC,QAAQ,QAAQ,OAAO;AAClD,SAASC,KAAK,EAAEC,QAAQ,EAAEC,SAAS,EAAEC,UAAU,EAAEC,UAAU,EAAEC,IAAI,EAAEC,IAAI,QAAQ,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/Bd,SAAS,EAAE;IAAEe,SAAS,EAAE;EAAU,CAAC;EACnC;EACAL,MAAM,EAAE;IAAEM,OAAO,EAAE;EAAI;AACzB,CAAC,CAAC","ignoreList":[]}
|
|
@@ -25,7 +25,7 @@ context + a stateless helper with no React-tree footprint of its own, not a depe
|
|
|
25
25
|
|
|
26
26
|
| Prop | Type | Default | Notes |
|
|
27
27
|
|------|------|---------|-------|
|
|
28
|
-
| `options` | `{ label: string; value: string }[]` | — | Required. |
|
|
28
|
+
| `options` | `{ label: string; value: string; leading?: ReactNode }[]` | — | Required. `leading` is an optional fixed-size adornment (status chip / priority glyph / avatar) rendered before the row label AND on the trigger while that option is selected — the ReactNode content-slot precedent set by `ListItem`'s `leading`. |
|
|
29
29
|
| `value` | `string` | — | The currently selected option's `value`. |
|
|
30
30
|
| `onValueChange` | `(value: string) => void` | — | Required. Fired on row press; the menu closes right after. |
|
|
31
31
|
| `placeholder` | `string` | — | Shown when `value` matches no option. |
|