panelui-native 0.28.1 → 0.30.0

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.
Files changed (82) hide show
  1. package/README.md +18 -1
  2. package/lib/module/components/calendar/index.js +350 -115
  3. package/lib/module/components/calendar/index.js.map +1 -1
  4. package/lib/module/components/code-block/highlight.js +363 -0
  5. package/lib/module/components/code-block/highlight.js.map +1 -0
  6. package/lib/module/components/code-block/index.js +313 -0
  7. package/lib/module/components/code-block/index.js.map +1 -0
  8. package/lib/module/components/date-picker/index.js +8 -1
  9. package/lib/module/components/date-picker/index.js.map +1 -1
  10. package/lib/module/components/menu/index.js +714 -0
  11. package/lib/module/components/menu/index.js.map +1 -0
  12. package/lib/module/components/plan/index.js +296 -0
  13. package/lib/module/components/plan/index.js.map +1 -0
  14. package/lib/module/components/popover/index.js +35 -4
  15. package/lib/module/components/popover/index.js.map +1 -1
  16. package/lib/module/components/radio-group/index.js +13 -8
  17. package/lib/module/components/radio-group/index.js.map +1 -1
  18. package/lib/module/components/reasoning/index.js +244 -0
  19. package/lib/module/components/reasoning/index.js.map +1 -0
  20. package/lib/module/components/sources/index.js +221 -0
  21. package/lib/module/components/sources/index.js.map +1 -0
  22. package/lib/module/components/task/index.js +300 -0
  23. package/lib/module/components/task/index.js.map +1 -0
  24. package/lib/module/components/textarea/index.js +295 -0
  25. package/lib/module/components/textarea/index.js.map +1 -0
  26. package/lib/module/components/tooltip/index.js +179 -23
  27. package/lib/module/components/tooltip/index.js.map +1 -1
  28. package/lib/module/icons/index.js +139 -0
  29. package/lib/module/icons/index.js.map +1 -1
  30. package/lib/module/index.js +8 -0
  31. package/lib/module/index.js.map +1 -1
  32. package/lib/module/primitives/collapse.js +112 -0
  33. package/lib/module/primitives/collapse.js.map +1 -0
  34. package/lib/typescript/src/components/calendar/index.d.ts +68 -3
  35. package/lib/typescript/src/components/calendar/index.d.ts.map +1 -1
  36. package/lib/typescript/src/components/code-block/highlight.d.ts +39 -0
  37. package/lib/typescript/src/components/code-block/highlight.d.ts.map +1 -0
  38. package/lib/typescript/src/components/code-block/index.d.ts +113 -0
  39. package/lib/typescript/src/components/code-block/index.d.ts.map +1 -0
  40. package/lib/typescript/src/components/date-picker/index.d.ts +7 -1
  41. package/lib/typescript/src/components/date-picker/index.d.ts.map +1 -1
  42. package/lib/typescript/src/components/menu/index.d.ts +261 -0
  43. package/lib/typescript/src/components/menu/index.d.ts.map +1 -0
  44. package/lib/typescript/src/components/plan/index.d.ts +127 -0
  45. package/lib/typescript/src/components/plan/index.d.ts.map +1 -0
  46. package/lib/typescript/src/components/popover/index.d.ts +35 -1
  47. package/lib/typescript/src/components/popover/index.d.ts.map +1 -1
  48. package/lib/typescript/src/components/radio-group/index.d.ts.map +1 -1
  49. package/lib/typescript/src/components/reasoning/index.d.ts +97 -0
  50. package/lib/typescript/src/components/reasoning/index.d.ts.map +1 -0
  51. package/lib/typescript/src/components/sources/index.d.ts +85 -0
  52. package/lib/typescript/src/components/sources/index.d.ts.map +1 -0
  53. package/lib/typescript/src/components/task/index.d.ts +103 -0
  54. package/lib/typescript/src/components/task/index.d.ts.map +1 -0
  55. package/lib/typescript/src/components/textarea/index.d.ts +175 -0
  56. package/lib/typescript/src/components/textarea/index.d.ts.map +1 -0
  57. package/lib/typescript/src/components/tooltip/index.d.ts +63 -8
  58. package/lib/typescript/src/components/tooltip/index.d.ts.map +1 -1
  59. package/lib/typescript/src/icons/index.d.ts +14 -0
  60. package/lib/typescript/src/icons/index.d.ts.map +1 -1
  61. package/lib/typescript/src/index.d.ts +10 -2
  62. package/lib/typescript/src/index.d.ts.map +1 -1
  63. package/lib/typescript/src/primitives/collapse.d.ts +42 -0
  64. package/lib/typescript/src/primitives/collapse.d.ts.map +1 -0
  65. package/package.json +1 -1
  66. package/src/components/calendar/index.tsx +389 -122
  67. package/src/components/code-block/highlight.ts +278 -0
  68. package/src/components/code-block/index.tsx +341 -0
  69. package/src/components/date-picker/index.tsx +19 -1
  70. package/src/components/menu/index.tsx +812 -0
  71. package/src/components/plan/index.tsx +325 -0
  72. package/src/components/popover/index.tsx +69 -2
  73. package/src/components/radio-group/index.tsx +11 -2
  74. package/src/components/reasoning/index.tsx +297 -0
  75. package/src/components/sources/index.tsx +278 -0
  76. package/src/components/task/index.tsx +329 -0
  77. package/src/components/textarea/index.tsx +381 -0
  78. package/src/components/tooltip/index.tsx +203 -20
  79. package/src/icons/index.tsx +102 -0
  80. package/src/index.ts +71 -0
  81. package/src/primitives/collapse.tsx +128 -0
  82. package/theme.css +112 -0
@@ -0,0 +1,244 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * Reasoning — the model's working, shown while it happens and folded away after.
5
+ *
6
+ * A reasoning trace is interesting for exactly as long as it is the only thing
7
+ * arriving. Once the answer starts, it is a wall of text above the thing the
8
+ * reader actually asked for. So it opens itself when the trace starts streaming
9
+ * and closes itself about a second after it stops — once, and only if it ever
10
+ * streamed, because a trace that arrives complete was never a live thing to
11
+ * watch and should not perform.
12
+ *
13
+ * The trigger changes with it: a shimmering "Thinking…" while the tokens are
14
+ * coming, and "Thought for 8 seconds" afterwards. The duration is measured from
15
+ * the first streaming frame rather than taken on trust, so it is the time the
16
+ * reader actually waited.
17
+ *
18
+ * ```tsx
19
+ * <Reasoning isStreaming={streaming}>
20
+ * <Reasoning.Trigger />
21
+ * <Reasoning.Content>{text}</Reasoning.Content>
22
+ * </Reasoning>
23
+ * ```
24
+ *
25
+ * ## Where the props come from
26
+ *
27
+ * With the AI SDK, `isStreaming` is whether the last part of the last message
28
+ * is a reasoning part while the request is still streaming, and the content is
29
+ * every `reasoning` part joined together. Joined, not one component each:
30
+ * some models emit a run of separate reasoning parts, and one component per
31
+ * part is a column of "Thinking…" rows for a single thought.
32
+ */
33
+ import { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState } from 'react';
34
+ import { Pressable, View } from 'react-native';
35
+ import Animated, { useAnimatedStyle, useReducedMotion, useSharedValue, withTiming } from 'react-native-reanimated';
36
+ import { tv } from 'tailwind-variants';
37
+ import { ChevronDownIcon, SparklesIcon } from "../../icons/index.js";
38
+ import { Collapse } from "../../primitives/collapse.js";
39
+ import { Text, textChildren } from "../../primitives/text.js";
40
+ import { cn } from "../../utils/cn.js";
41
+ import { Shimmer } from "../shimmer/index.js";
42
+
43
+ /**
44
+ * How long the finished trace stays open before folding away.
45
+ *
46
+ * Long enough that the fold reads as a consequence of the trace ending rather
47
+ * than as part of it, short enough that nobody is waiting on it.
48
+ */
49
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
50
+ const AUTO_CLOSE_DELAY = 1000;
51
+ const reasoningVariants = tv({
52
+ slots: {
53
+ root: 'w-full gap-2',
54
+ trigger: 'flex-row items-center gap-2 py-0.5',
55
+ label: 'text-sm text-muted-foreground',
56
+ content: 'gap-2 ps-6',
57
+ contentText: 'text-sm leading-relaxed text-muted-foreground'
58
+ }
59
+ });
60
+ const ReasoningContext = /*#__PURE__*/createContext(null);
61
+ function useReasoning(component) {
62
+ const context = useContext(ReasoningContext);
63
+ if (!context) {
64
+ throw new Error(`${component} must be used within a <Reasoning>`);
65
+ }
66
+ return context;
67
+ }
68
+ function ReasoningRoot({
69
+ className,
70
+ isStreaming = false,
71
+ duration: durationProp,
72
+ open: openProp,
73
+ defaultOpen,
74
+ onOpenChange,
75
+ children,
76
+ ...props
77
+ }) {
78
+ const {
79
+ root
80
+ } = reasoningVariants();
81
+ const [internalOpen, setInternalOpen] = useState(defaultOpen ?? isStreaming);
82
+ const [measured, setMeasured] = useState();
83
+ const isControlled = openProp !== undefined;
84
+ const open = isControlled ? openProp : internalOpen;
85
+ const setOpen = useCallback(next => {
86
+ if (!isControlled) setInternalOpen(next);
87
+ onOpenChange?.(next);
88
+ }, [isControlled, onOpenChange]);
89
+
90
+ /*
91
+ * A caller that said `defaultOpen={false}` meant it. Without this the panel
92
+ * would spring open the moment the trace started, which is the one thing that
93
+ * request was asking not to happen.
94
+ */
95
+ const optedOut = defaultOpen === false;
96
+ const everStreamed = useRef(isStreaming);
97
+ const startedAt = useRef(null);
98
+ const [autoClosed, setAutoClosed] = useState(false);
99
+
100
+ // Timed here rather than taken on trust: `duration` is optional, and the
101
+ // honest number is the wall clock between the first token and the last.
102
+ useEffect(() => {
103
+ if (isStreaming) {
104
+ everStreamed.current = true;
105
+ startedAt.current ??= Date.now();
106
+ return;
107
+ }
108
+ if (startedAt.current !== null) {
109
+ setMeasured(Math.max(1, Math.round((Date.now() - startedAt.current) / 1000)));
110
+ startedAt.current = null;
111
+ }
112
+ }, [isStreaming]);
113
+ useEffect(() => {
114
+ if (isStreaming && !open && !optedOut) setOpen(true);
115
+ }, [isStreaming, open, optedOut, setOpen]);
116
+
117
+ /*
118
+ * Once only. Without the latch, reopening a finished trace by hand would be
119
+ * undone a second later by the same effect, and the panel would refuse to
120
+ * stay open for the one reader who wanted to read it.
121
+ */
122
+ useEffect(() => {
123
+ if (!everStreamed.current || isStreaming || !open || autoClosed) return;
124
+ const timer = setTimeout(() => {
125
+ setOpen(false);
126
+ setAutoClosed(true);
127
+ }, AUTO_CLOSE_DELAY);
128
+ return () => clearTimeout(timer);
129
+ }, [isStreaming, open, autoClosed, setOpen]);
130
+ const context = useMemo(() => ({
131
+ isStreaming,
132
+ open,
133
+ setOpen,
134
+ duration: durationProp ?? measured
135
+ }), [isStreaming, open, setOpen, durationProp, measured]);
136
+ return /*#__PURE__*/_jsx(ReasoningContext.Provider, {
137
+ value: context,
138
+ children: /*#__PURE__*/_jsx(View, {
139
+ ...props,
140
+ className: cn(root(), className),
141
+ children: children
142
+ })
143
+ });
144
+ }
145
+ ReasoningRoot.displayName = 'Reasoning';
146
+ /** The row that says how long it thought, and folds the trace away. */
147
+ function ReasoningTrigger({
148
+ className,
149
+ label,
150
+ children,
151
+ onPress,
152
+ ...props
153
+ }) {
154
+ const {
155
+ isStreaming,
156
+ open,
157
+ setOpen,
158
+ duration
159
+ } = useReasoning('Reasoning.Trigger');
160
+ const {
161
+ trigger,
162
+ label: labelClass
163
+ } = reasoningVariants();
164
+ const reducedMotion = useReducedMotion();
165
+ const progress = useSharedValue(open ? 1 : 0);
166
+ useEffect(() => {
167
+ progress.value = reducedMotion ? open ? 1 : 0 : withTiming(open ? 1 : 0, {
168
+ duration: 180
169
+ });
170
+ }, [open, reducedMotion, progress]);
171
+ const chevronStyle = useAnimatedStyle(() => ({
172
+ transform: [{
173
+ rotate: `${progress.value * 180}deg`
174
+ }]
175
+ }));
176
+ const body = label ? label(isStreaming, duration) : isStreaming ? /*#__PURE__*/_jsx(Shimmer, {
177
+ textClassName: labelClass(),
178
+ children: "Thinking\u2026"
179
+ }) : /*#__PURE__*/_jsx(Text, {
180
+ className: labelClass(),
181
+ children: duration === undefined ? 'Thought for a few seconds' : `Thought for ${duration} ${duration === 1 ? 'second' : 'seconds'}`
182
+ });
183
+ return /*#__PURE__*/_jsx(Pressable, {
184
+ accessibilityRole: "button",
185
+ accessibilityState: {
186
+ expanded: open
187
+ },
188
+ onPress: event => {
189
+ onPress?.(event);
190
+ setOpen(!open);
191
+ },
192
+ className: cn(trigger(), className),
193
+ ...props,
194
+ children: children ?? /*#__PURE__*/_jsxs(_Fragment, {
195
+ children: [/*#__PURE__*/_jsx(SparklesIcon, {
196
+ size: 16
197
+ }), /*#__PURE__*/_jsx(View, {
198
+ className: "flex-1",
199
+ children: body
200
+ }), /*#__PURE__*/_jsx(Animated.View, {
201
+ style: chevronStyle,
202
+ children: /*#__PURE__*/_jsx(ChevronDownIcon, {
203
+ size: 16
204
+ })
205
+ })]
206
+ })
207
+ });
208
+ }
209
+ /**
210
+ * The trace itself.
211
+ *
212
+ * Kept mounted and collapsed to nothing rather than unmounted, because it is
213
+ * usually still growing while it is folded — and a body that remounts on every
214
+ * open would drop whatever the reader had scrolled to.
215
+ */
216
+ function ReasoningContent({
217
+ className,
218
+ children,
219
+ ...props
220
+ }) {
221
+ const {
222
+ open
223
+ } = useReasoning('Reasoning.Content');
224
+ const {
225
+ content,
226
+ contentText
227
+ } = reasoningVariants();
228
+ return /*#__PURE__*/_jsx(Collapse, {
229
+ open: open,
230
+ className: cn(content(), className),
231
+ ...props,
232
+ children: textChildren(children, text => /*#__PURE__*/_jsx(Text, {
233
+ className: contentText(),
234
+ children: text
235
+ }))
236
+ });
237
+ }
238
+ ReasoningTrigger.displayName = 'Reasoning.Trigger';
239
+ ReasoningContent.displayName = 'Reasoning.Content';
240
+ export const Reasoning = Object.assign(ReasoningRoot, {
241
+ Trigger: ReasoningTrigger,
242
+ Content: ReasoningContent
243
+ });
244
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createContext","useCallback","useContext","useEffect","useMemo","useRef","useState","Pressable","View","Animated","useAnimatedStyle","useReducedMotion","useSharedValue","withTiming","tv","ChevronDownIcon","SparklesIcon","Collapse","Text","textChildren","cn","Shimmer","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","AUTO_CLOSE_DELAY","reasoningVariants","slots","root","trigger","label","content","contentText","ReasoningContext","useReasoning","component","context","Error","ReasoningRoot","className","isStreaming","duration","durationProp","open","openProp","defaultOpen","onOpenChange","children","props","internalOpen","setInternalOpen","measured","setMeasured","isControlled","undefined","setOpen","next","optedOut","everStreamed","startedAt","autoClosed","setAutoClosed","current","Date","now","Math","max","round","timer","setTimeout","clearTimeout","Provider","value","displayName","ReasoningTrigger","onPress","labelClass","reducedMotion","progress","chevronStyle","transform","rotate","body","textClassName","accessibilityRole","accessibilityState","expanded","event","size","style","ReasoningContent","text","Reasoning","Object","assign","Trigger","Content"],"sourceRoot":"../../../../src","sources":["components/reasoning/index.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SACEA,aAAa,EACbC,WAAW,EACXC,UAAU,EACVC,SAAS,EACTC,OAAO,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AAI,iBAC3BvE,IAAA,CAACL,IAAI;MAACwB,SAAS,EAAEP,WAAW,CAAC,CAAE;MAAAe,QAAA,EAAE4C;IAAI,CAAO,CAC7C;EAAC,CACM,CAAC;AAEf;AAEAjB,gBAAgB,CAACD,WAAW,GAAG,mBAAmB;AAClDiB,gBAAgB,CAACjB,WAAW,GAAG,mBAAmB;AAElD,OAAO,MAAMmB,SAAS,GAAGC,MAAM,CAACC,MAAM,CAACxD,aAAa,EAAE;EACpDyD,OAAO,EAAErB,gBAAgB;EACzBsB,OAAO,EAAEN;AACX,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,221 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * Sources — where an answer came from, folded under a count.
5
+ *
6
+ * A cited answer usually cites more places than anyone wants listed above it,
7
+ * so the list opens from a single line: "Used 6 sources". Folded is the resting
8
+ * state, unlike `Reasoning`, because a citation list is a thing you go and
9
+ * check rather than a thing you watch arrive.
10
+ *
11
+ * ```tsx
12
+ * <Sources>
13
+ * <Sources.Trigger count={sources.length} />
14
+ * <Sources.Content>
15
+ * {sources.map((source) => (
16
+ * <Sources.Source key={source.url} href={source.url} title={source.title} />
17
+ * ))}
18
+ * </Sources.Content>
19
+ * </Sources>
20
+ * ```
21
+ *
22
+ * ## Where the props come from
23
+ *
24
+ * With the AI SDK these are the `source-url` parts of an assistant message:
25
+ * `part.url` is the `href` and `part.title` the `title`. A part carries no
26
+ * title of its own when the model did not supply one, in which case the host
27
+ * of the URL is a better label than the whole of it.
28
+ */
29
+ import { createContext, useCallback, useContext, useEffect, useMemo, useState } from 'react';
30
+ import { Linking, Pressable, View } from 'react-native';
31
+ import Animated, { useAnimatedStyle, useReducedMotion, useSharedValue, withTiming } from 'react-native-reanimated';
32
+ import { tv } from 'tailwind-variants';
33
+ import { ChevronDownIcon, LinkIcon } from "../../icons/index.js";
34
+ import { Collapse } from "../../primitives/collapse.js";
35
+ import { Text } from "../../primitives/text.js";
36
+ import { cn } from "../../utils/cn.js";
37
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
38
+ const sourcesVariants = tv({
39
+ slots: {
40
+ root: 'w-full gap-2',
41
+ trigger: 'flex-row items-center gap-2 py-0.5',
42
+ triggerLabel: 'text-sm font-medium text-muted-foreground',
43
+ content: 'gap-0.5',
44
+ source: 'flex-row items-center gap-2 rounded-xl px-2 py-2 active:bg-accent',
45
+ sourceTitle: 'flex-1 text-sm text-foreground',
46
+ sourceHost: 'text-xs text-muted-foreground'
47
+ }
48
+ });
49
+ const SourcesContext = /*#__PURE__*/createContext(null);
50
+ function useSources(component) {
51
+ const context = useContext(SourcesContext);
52
+ if (!context) {
53
+ throw new Error(`${component} must be used within a <Sources>`);
54
+ }
55
+ return context;
56
+ }
57
+ function SourcesRoot({
58
+ className,
59
+ open: openProp,
60
+ defaultOpen = false,
61
+ onOpenChange,
62
+ children,
63
+ ...props
64
+ }) {
65
+ const {
66
+ root
67
+ } = sourcesVariants();
68
+ const [internalOpen, setInternalOpen] = useState(defaultOpen);
69
+ const isControlled = openProp !== undefined;
70
+ const open = isControlled ? openProp : internalOpen;
71
+ const setOpen = useCallback(next => {
72
+ if (!isControlled) setInternalOpen(next);
73
+ onOpenChange?.(next);
74
+ }, [isControlled, onOpenChange]);
75
+ const context = useMemo(() => ({
76
+ open,
77
+ setOpen
78
+ }), [open, setOpen]);
79
+ return /*#__PURE__*/_jsx(SourcesContext.Provider, {
80
+ value: context,
81
+ children: /*#__PURE__*/_jsx(View, {
82
+ ...props,
83
+ className: cn(root(), className),
84
+ children: children
85
+ })
86
+ });
87
+ }
88
+ SourcesRoot.displayName = 'Sources';
89
+ function SourcesTrigger({
90
+ className,
91
+ count = 0,
92
+ children,
93
+ onPress,
94
+ ...props
95
+ }) {
96
+ const {
97
+ open,
98
+ setOpen
99
+ } = useSources('Sources.Trigger');
100
+ const {
101
+ trigger,
102
+ triggerLabel
103
+ } = sourcesVariants();
104
+ const reducedMotion = useReducedMotion();
105
+ const progress = useSharedValue(open ? 1 : 0);
106
+ useEffect(() => {
107
+ progress.value = reducedMotion ? open ? 1 : 0 : withTiming(open ? 1 : 0, {
108
+ duration: 180
109
+ });
110
+ }, [open, reducedMotion, progress]);
111
+ const chevronStyle = useAnimatedStyle(() => ({
112
+ transform: [{
113
+ rotate: `${progress.value * 180}deg`
114
+ }]
115
+ }));
116
+ return /*#__PURE__*/_jsx(Pressable, {
117
+ accessibilityRole: "button",
118
+ accessibilityState: {
119
+ expanded: open
120
+ },
121
+ onPress: event => {
122
+ onPress?.(event);
123
+ setOpen(!open);
124
+ },
125
+ className: cn(trigger(), className),
126
+ ...props,
127
+ children: children ?? /*#__PURE__*/_jsxs(_Fragment, {
128
+ children: [/*#__PURE__*/_jsxs(Text, {
129
+ className: triggerLabel(),
130
+ children: ["Used ", count, " ", count === 1 ? 'source' : 'sources']
131
+ }), /*#__PURE__*/_jsx(Animated.View, {
132
+ style: chevronStyle,
133
+ children: /*#__PURE__*/_jsx(ChevronDownIcon, {
134
+ size: 16
135
+ })
136
+ })]
137
+ })
138
+ });
139
+ }
140
+ function SourcesContent({
141
+ className,
142
+ children,
143
+ ...props
144
+ }) {
145
+ const {
146
+ open
147
+ } = useSources('Sources.Content');
148
+ const {
149
+ content
150
+ } = sourcesVariants();
151
+ return /*#__PURE__*/_jsx(Collapse, {
152
+ open: open,
153
+ className: cn(content(), className),
154
+ ...props,
155
+ children: children
156
+ });
157
+ }
158
+ /** One citation. */
159
+ function SourcesSource({
160
+ className,
161
+ href,
162
+ title,
163
+ icon,
164
+ children,
165
+ onPress,
166
+ ...props
167
+ }) {
168
+ const {
169
+ source,
170
+ sourceTitle,
171
+ sourceHost
172
+ } = sourcesVariants();
173
+ const host = useMemo(() => hostOf(href), [href]);
174
+ return /*#__PURE__*/_jsx(Pressable, {
175
+ accessibilityRole: "link",
176
+ accessibilityLabel: title ?? host ?? href,
177
+ onPress: event => {
178
+ onPress?.(event);
179
+ // No `canOpenURL` guard: it needs the scheme declared up front on iOS,
180
+ // and a source is always http(s), which is always openable.
181
+ if (href) void Linking.openURL(href).catch(() => undefined);
182
+ },
183
+ className: cn(source(), className),
184
+ ...props,
185
+ children: children ?? /*#__PURE__*/_jsxs(_Fragment, {
186
+ children: [icon ?? /*#__PURE__*/_jsx(LinkIcon, {
187
+ size: 14
188
+ }), /*#__PURE__*/_jsx(Text, {
189
+ numberOfLines: 1,
190
+ className: sourceTitle(),
191
+ children: title ?? host ?? href
192
+ }), title && host ? /*#__PURE__*/_jsx(Text, {
193
+ numberOfLines: 1,
194
+ className: sourceHost(),
195
+ children: host
196
+ }) : null]
197
+ })
198
+ });
199
+ }
200
+
201
+ /**
202
+ * The host of a URL, without a URL parser.
203
+ *
204
+ * `URL` exists in Hermes but throws on anything malformed, and a model's
205
+ * citation is not a thing to trust with an exception. A label is worth having
206
+ * even when the string it came from is not a URL at all.
207
+ */
208
+ function hostOf(href) {
209
+ if (!href) return undefined;
210
+ const match = /^[a-z][a-z0-9+.-]*:\/\/([^/?#]+)/i.exec(href);
211
+ return match?.[1]?.replace(/^www\./i, '');
212
+ }
213
+ SourcesTrigger.displayName = 'Sources.Trigger';
214
+ SourcesContent.displayName = 'Sources.Content';
215
+ SourcesSource.displayName = 'Sources.Source';
216
+ export const Sources = Object.assign(SourcesRoot, {
217
+ Trigger: SourcesTrigger,
218
+ Content: SourcesContent,
219
+ Source: SourcesSource
220
+ });
221
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createContext","useCallback","useContext","useEffect","useMemo","useState","Linking","Pressable","View","Animated","useAnimatedStyle","useReducedMotion","useSharedValue","withTiming","tv","ChevronDownIcon","LinkIcon","Collapse","Text","cn","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","sourcesVariants","slots","root","trigger","triggerLabel","content","source","sourceTitle","sourceHost","SourcesContext","useSources","component","context","Error","SourcesRoot","className","open","openProp","defaultOpen","onOpenChange","children","props","internalOpen","setInternalOpen","isControlled","undefined","setOpen","next","Provider","value","displayName","SourcesTrigger","count","onPress","reducedMotion","progress","duration","chevronStyle","transform","rotate","accessibilityRole","accessibilityState","expanded","event","style","size","SourcesContent","SourcesSource","href","title","icon","host","hostOf","accessibilityLabel","openURL","catch","numberOfLines","match","exec","replace","Sources","Object","assign","Trigger","Content","Source"],"sourceRoot":"../../../../src","sources":["components/sources/index.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SACEA,aAAa,EACbC,WAAW,EACXC,UAAU,EACVC,SAAS,EACTC,OAAO,EACPC,QAAQ,QAEH,OAAO;AACd,SACEC,OAAO,EACPC,SAAS,EACTC,IAAI,QAGC,cAAc;AACrB,OAAOC,QAAQ,IACbC,gBAAgB,EAChBC,gBAAgB,EAChBC,cAAc,EACdC,UAAU,QACL,yBAAyB;AAChC,SAASC,EAAE,QAAQ,mBAAmB;AACtC,SAASC,eAAe,EAAEC,QAAQ,QAAQ,sBAAa;AACvD,SAASC,QAAQ,QAAQ,8BAA2B;AACpD,SAASC,IAAI,QAAQ,0BAAuB;AAC5C,SAASC,EAAE,QAAQ,mBAAgB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA,EAAAC,QAAA,IAAAC,SAAA;AAEpC,MAAMC,eAAe,GAAGZ,EAAE,CAAC;EACzBa,KAAK,EAAE;IACLC,IAAI,EAAE,cAAc;IACpBC,OAAO,EAAE,oCAAoC;IAC7CC,YAAY,EAAE,2CAA2C;IACzDC,OAAO,EAAE,SAAS;IAClBC,MAAM,EAAE,mEAAmE;IAC3EC,WAAW,EAAE,gCAAgC;IAC7CC,UAAU,EAAE;EACd;AACF,CAAC,CAAC;AAOF,MAAMC,cAAc,gBAAGnC,aAAa,CAA6B,IAAI,CAAC;AAEtE,SAASoC,UAAUA,CAACC,SAAiB,EAAuB;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