panelui-native 0.28.1 → 0.32.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.
- package/README.md +22 -3
- package/lib/module/components/calendar/index.js +450 -132
- package/lib/module/components/calendar/index.js.map +1 -1
- package/lib/module/components/code-block/highlight.js +363 -0
- package/lib/module/components/code-block/highlight.js.map +1 -0
- package/lib/module/components/code-block/index.js +313 -0
- package/lib/module/components/code-block/index.js.map +1 -0
- package/lib/module/components/date-picker/index.js +8 -1
- package/lib/module/components/date-picker/index.js.map +1 -1
- package/lib/module/components/heatmap-chart/index.js +9 -8
- package/lib/module/components/heatmap-chart/index.js.map +1 -1
- package/lib/module/components/map/index.js +50 -4
- package/lib/module/components/map/index.js.map +1 -1
- package/lib/module/components/menu/index.js +714 -0
- package/lib/module/components/menu/index.js.map +1 -0
- package/lib/module/components/plan/index.js +582 -0
- package/lib/module/components/plan/index.js.map +1 -0
- package/lib/module/components/popover/index.js +35 -4
- package/lib/module/components/popover/index.js.map +1 -1
- package/lib/module/components/post/index.js +992 -0
- package/lib/module/components/post/index.js.map +1 -0
- package/lib/module/components/radio-group/index.js +13 -8
- package/lib/module/components/radio-group/index.js.map +1 -1
- package/lib/module/components/reasoning/index.js +244 -0
- package/lib/module/components/reasoning/index.js.map +1 -0
- package/lib/module/components/response/index.js +296 -0
- package/lib/module/components/response/index.js.map +1 -0
- package/lib/module/components/response/markdown.js +463 -0
- package/lib/module/components/response/markdown.js.map +1 -0
- package/lib/module/components/select/index.js +97 -15
- package/lib/module/components/select/index.js.map +1 -1
- package/lib/module/components/sources/index.js +221 -0
- package/lib/module/components/sources/index.js.map +1 -0
- package/lib/module/components/table/index.js +632 -0
- package/lib/module/components/table/index.js.map +1 -0
- package/lib/module/components/task/index.js +300 -0
- package/lib/module/components/task/index.js.map +1 -0
- package/lib/module/components/textarea/index.js +295 -0
- package/lib/module/components/textarea/index.js.map +1 -0
- package/lib/module/components/tooltip/index.js +179 -23
- package/lib/module/components/tooltip/index.js.map +1 -1
- package/lib/module/icons/index.js +339 -0
- package/lib/module/icons/index.js.map +1 -1
- package/lib/module/index.js +12 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/primitives/collapse.js +112 -0
- package/lib/module/primitives/collapse.js.map +1 -0
- package/lib/module/utils/date.js +129 -22
- package/lib/module/utils/date.js.map +1 -1
- package/lib/typescript/src/components/calendar/index.d.ts +79 -5
- package/lib/typescript/src/components/calendar/index.d.ts.map +1 -1
- package/lib/typescript/src/components/code-block/highlight.d.ts +39 -0
- package/lib/typescript/src/components/code-block/highlight.d.ts.map +1 -0
- package/lib/typescript/src/components/code-block/index.d.ts +113 -0
- package/lib/typescript/src/components/code-block/index.d.ts.map +1 -0
- package/lib/typescript/src/components/date-picker/index.d.ts +7 -1
- package/lib/typescript/src/components/date-picker/index.d.ts.map +1 -1
- package/lib/typescript/src/components/heatmap-chart/index.d.ts.map +1 -1
- package/lib/typescript/src/components/map/index.d.ts +8 -1
- package/lib/typescript/src/components/map/index.d.ts.map +1 -1
- package/lib/typescript/src/components/menu/index.d.ts +261 -0
- package/lib/typescript/src/components/menu/index.d.ts.map +1 -0
- package/lib/typescript/src/components/plan/index.d.ts +238 -0
- package/lib/typescript/src/components/plan/index.d.ts.map +1 -0
- package/lib/typescript/src/components/popover/index.d.ts +35 -1
- package/lib/typescript/src/components/popover/index.d.ts.map +1 -1
- package/lib/typescript/src/components/post/index.d.ts +358 -0
- package/lib/typescript/src/components/post/index.d.ts.map +1 -0
- package/lib/typescript/src/components/radio-group/index.d.ts.map +1 -1
- package/lib/typescript/src/components/reasoning/index.d.ts +97 -0
- package/lib/typescript/src/components/reasoning/index.d.ts.map +1 -0
- package/lib/typescript/src/components/response/index.d.ts +91 -0
- package/lib/typescript/src/components/response/index.d.ts.map +1 -0
- package/lib/typescript/src/components/response/markdown.d.ts +88 -0
- package/lib/typescript/src/components/response/markdown.d.ts.map +1 -0
- package/lib/typescript/src/components/select/index.d.ts +27 -2
- package/lib/typescript/src/components/select/index.d.ts.map +1 -1
- package/lib/typescript/src/components/sources/index.d.ts +85 -0
- package/lib/typescript/src/components/sources/index.d.ts.map +1 -0
- package/lib/typescript/src/components/table/index.d.ts +274 -0
- package/lib/typescript/src/components/table/index.d.ts.map +1 -0
- package/lib/typescript/src/components/task/index.d.ts +103 -0
- package/lib/typescript/src/components/task/index.d.ts.map +1 -0
- package/lib/typescript/src/components/textarea/index.d.ts +175 -0
- package/lib/typescript/src/components/textarea/index.d.ts.map +1 -0
- package/lib/typescript/src/components/tooltip/index.d.ts +63 -8
- package/lib/typescript/src/components/tooltip/index.d.ts.map +1 -1
- package/lib/typescript/src/icons/index.d.ts +54 -1
- package/lib/typescript/src/icons/index.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +14 -3
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/primitives/collapse.d.ts +42 -0
- package/lib/typescript/src/primitives/collapse.d.ts.map +1 -0
- package/lib/typescript/src/utils/date.d.ts +49 -5
- package/lib/typescript/src/utils/date.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/calendar/index.tsx +519 -139
- package/src/components/code-block/highlight.ts +278 -0
- package/src/components/code-block/index.tsx +341 -0
- package/src/components/date-picker/index.tsx +19 -1
- package/src/components/heatmap-chart/index.tsx +9 -9
- package/src/components/map/index.tsx +53 -4
- package/src/components/menu/index.tsx +812 -0
- package/src/components/plan/index.tsx +648 -0
- package/src/components/popover/index.tsx +69 -2
- package/src/components/post/index.tsx +1116 -0
- package/src/components/radio-group/index.tsx +11 -2
- package/src/components/reasoning/index.tsx +297 -0
- package/src/components/response/index.tsx +390 -0
- package/src/components/response/markdown.ts +489 -0
- package/src/components/select/index.tsx +132 -12
- package/src/components/sources/index.tsx +278 -0
- package/src/components/table/index.tsx +747 -0
- package/src/components/task/index.tsx +329 -0
- package/src/components/textarea/index.tsx +381 -0
- package/src/components/tooltip/index.tsx +203 -20
- package/src/icons/index.tsx +264 -1
- package/src/index.ts +131 -0
- package/src/primitives/collapse.tsx +128 -0
- package/src/utils/date.ts +146 -22
- package/theme.css +112 -0
|
@@ -44,6 +44,7 @@ import {
|
|
|
44
44
|
} from 'react';
|
|
45
45
|
import {
|
|
46
46
|
Pressable,
|
|
47
|
+
ScrollView,
|
|
47
48
|
useWindowDimensions,
|
|
48
49
|
View,
|
|
49
50
|
type LayoutChangeEvent,
|
|
@@ -228,6 +229,40 @@ export interface PopoverContentProps extends ViewProps {
|
|
|
228
229
|
* content into a column.
|
|
229
230
|
*/
|
|
230
231
|
minWidth?: number;
|
|
232
|
+
/**
|
|
233
|
+
* Ceiling for the panel's height, in pixels. Always clamped to the room
|
|
234
|
+
* inside the safe area, which is also the default — a panel is never
|
|
235
|
+
* positioned so that part of it falls off the screen, because the part that
|
|
236
|
+
* falls off cannot be scrolled back into view.
|
|
237
|
+
*/
|
|
238
|
+
maxHeight?: number;
|
|
239
|
+
/**
|
|
240
|
+
* Scroll the panel's body when it is taller than `maxHeight`.
|
|
241
|
+
*
|
|
242
|
+
* Off by default, because a popover is usually a paragraph or a short form
|
|
243
|
+
* and a scroller around either one only adds a bounce. Worth turning on for
|
|
244
|
+
* a list of unknown length, which is the case where the cap actually bites.
|
|
245
|
+
*
|
|
246
|
+
* The spacing between children moves to the scroller's content when this is
|
|
247
|
+
* set; `className` still dresses the panel itself.
|
|
248
|
+
*/
|
|
249
|
+
scrollable?: boolean;
|
|
250
|
+
/**
|
|
251
|
+
* Drop the panel's own surface — its background, border, radius, padding and
|
|
252
|
+
* shadow — and keep only its position and its size. For a caller that draws
|
|
253
|
+
* the surface itself, so that something can be put *behind* the content
|
|
254
|
+
* rather than layered on top of a background that is already painted.
|
|
255
|
+
*
|
|
256
|
+
* The panel is still clipped to a rounded rectangle, because a surface drawn
|
|
257
|
+
* inside it has to have something to be clipped by.
|
|
258
|
+
*/
|
|
259
|
+
unstyled?: boolean;
|
|
260
|
+
/**
|
|
261
|
+
* A layer drawn inside the panel, behind its content — and, crucially,
|
|
262
|
+
* outside its scroller, so that a surface does not scroll away with the rows
|
|
263
|
+
* on top of it. Pair it with `unstyled` to own the panel's appearance.
|
|
264
|
+
*/
|
|
265
|
+
background?: ReactNode;
|
|
231
266
|
/** Tap outside the panel closes it. Default true. */
|
|
232
267
|
dismissible?: boolean;
|
|
233
268
|
/**
|
|
@@ -247,6 +282,10 @@ function PopoverContent({
|
|
|
247
282
|
alignOffset = 0,
|
|
248
283
|
width = 'content-fit',
|
|
249
284
|
minWidth,
|
|
285
|
+
maxHeight,
|
|
286
|
+
scrollable = false,
|
|
287
|
+
unstyled = false,
|
|
288
|
+
background,
|
|
250
289
|
dismissible = true,
|
|
251
290
|
blur = false,
|
|
252
291
|
children,
|
|
@@ -303,6 +342,17 @@ function PopoverContent({
|
|
|
303
342
|
? Math.min(Math.max(requestedWidth, minWidth), available)
|
|
304
343
|
: requestedWidth;
|
|
305
344
|
|
|
345
|
+
/*
|
|
346
|
+
* The cap is what keeps a tall panel reachable. `place` clamps the panel
|
|
347
|
+
* inside the bounds, but a panel taller than the bounds cannot be clamped
|
|
348
|
+
* into them — it gets pinned to the top edge and the rest runs off the
|
|
349
|
+
* bottom of the screen, where there is no way to get at it. Capping the
|
|
350
|
+
* height first means the clamp always has a solution, and `scrollable`
|
|
351
|
+
* hands the overflow back to the finger.
|
|
352
|
+
*/
|
|
353
|
+
const room = bounds.bottom - bounds.top;
|
|
354
|
+
const resolvedMaxHeight = maxHeight === undefined ? room : Math.min(maxHeight, room);
|
|
355
|
+
|
|
306
356
|
const position =
|
|
307
357
|
trigger && size
|
|
308
358
|
? place({ trigger, size, placement, align, offset, alignOffset, bounds })
|
|
@@ -434,6 +484,7 @@ function PopoverContent({
|
|
|
434
484
|
top: position?.top ?? -9999,
|
|
435
485
|
left: position?.left ?? -9999,
|
|
436
486
|
maxWidth: bounds.right - bounds.left,
|
|
487
|
+
maxHeight: resolvedMaxHeight,
|
|
437
488
|
width: resolvedWidth,
|
|
438
489
|
}}
|
|
439
490
|
>
|
|
@@ -441,12 +492,28 @@ function PopoverContent({
|
|
|
441
492
|
accessibilityViewIsModal
|
|
442
493
|
style={[panelStyle, style]}
|
|
443
494
|
className={cn(
|
|
444
|
-
|
|
495
|
+
// `unstyled` keeps the clip and drops everything that paints,
|
|
496
|
+
// so a caller can put its own layer underneath the content.
|
|
497
|
+
unstyled
|
|
498
|
+
? 'overflow-hidden rounded-2xl'
|
|
499
|
+
: 'rounded-2xl border border-border bg-popover p-4 shadow-lg',
|
|
500
|
+
// The gap belongs to whichever view actually holds the
|
|
501
|
+
// children — on the panel normally, on the scroller's content
|
|
502
|
+
// when there is one, since the scroller is then the panel's
|
|
503
|
+
// only child and a gap around it spaces nothing.
|
|
504
|
+
scrollable ? 'overflow-hidden' : 'gap-1.5',
|
|
445
505
|
className
|
|
446
506
|
)}
|
|
447
507
|
{...props}
|
|
448
508
|
>
|
|
449
|
-
{
|
|
509
|
+
{background}
|
|
510
|
+
{scrollable ? (
|
|
511
|
+
<ScrollView bounces={false} showsVerticalScrollIndicator={false}>
|
|
512
|
+
<View className="gap-1.5">{textChildren(children)}</View>
|
|
513
|
+
</ScrollView>
|
|
514
|
+
) : (
|
|
515
|
+
textChildren(children)
|
|
516
|
+
)}
|
|
450
517
|
</Animated.View>
|
|
451
518
|
</Animated.View>
|
|
452
519
|
</View>
|