panelui-native 0.16.0 → 0.20.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.
Files changed (76) hide show
  1. package/lib/module/components/bottom-sheet/index.js +38 -10
  2. package/lib/module/components/bottom-sheet/index.js.map +1 -1
  3. package/lib/module/components/checkbox/index.js +24 -11
  4. package/lib/module/components/checkbox/index.js.map +1 -1
  5. package/lib/module/components/field/index.js +337 -0
  6. package/lib/module/components/field/index.js.map +1 -0
  7. package/lib/module/components/flow/flow-paths.js +378 -0
  8. package/lib/module/components/flow/flow-paths.js.map +1 -0
  9. package/lib/module/components/flow/index.js +1598 -0
  10. package/lib/module/components/flow/index.js.map +1 -0
  11. package/lib/module/components/form/index.js +77 -0
  12. package/lib/module/components/form/index.js.map +1 -0
  13. package/lib/module/components/form/use-field.js +50 -0
  14. package/lib/module/components/form/use-field.js.map +1 -0
  15. package/lib/module/components/form/use-form.js +217 -0
  16. package/lib/module/components/form/use-form.js.map +1 -0
  17. package/lib/module/components/frame/index.js +124 -22
  18. package/lib/module/components/frame/index.js.map +1 -1
  19. package/lib/module/components/otp-input/index.js +303 -0
  20. package/lib/module/components/otp-input/index.js.map +1 -0
  21. package/lib/module/components/rating/index.js +339 -0
  22. package/lib/module/components/rating/index.js.map +1 -0
  23. package/lib/module/components/signature/index.js +500 -0
  24. package/lib/module/components/signature/index.js.map +1 -0
  25. package/lib/module/components/slider/index.js +14 -1
  26. package/lib/module/components/slider/index.js.map +1 -1
  27. package/lib/module/icons/index.js +247 -0
  28. package/lib/module/icons/index.js.map +1 -1
  29. package/lib/module/index.js +7 -1
  30. package/lib/module/index.js.map +1 -1
  31. package/lib/typescript/src/components/bottom-sheet/index.d.ts +15 -1
  32. package/lib/typescript/src/components/bottom-sheet/index.d.ts.map +1 -1
  33. package/lib/typescript/src/components/checkbox/index.d.ts +8 -0
  34. package/lib/typescript/src/components/checkbox/index.d.ts.map +1 -1
  35. package/lib/typescript/src/components/field/index.d.ts +94 -0
  36. package/lib/typescript/src/components/field/index.d.ts.map +1 -0
  37. package/lib/typescript/src/components/flow/flow-paths.d.ts +89 -0
  38. package/lib/typescript/src/components/flow/flow-paths.d.ts.map +1 -0
  39. package/lib/typescript/src/components/flow/index.d.ts +310 -0
  40. package/lib/typescript/src/components/flow/index.d.ts.map +1 -0
  41. package/lib/typescript/src/components/form/index.d.ts +64 -0
  42. package/lib/typescript/src/components/form/index.d.ts.map +1 -0
  43. package/lib/typescript/src/components/form/use-field.d.ts +16 -0
  44. package/lib/typescript/src/components/form/use-field.d.ts.map +1 -0
  45. package/lib/typescript/src/components/form/use-form.d.ts +37 -0
  46. package/lib/typescript/src/components/form/use-form.d.ts.map +1 -0
  47. package/lib/typescript/src/components/frame/index.d.ts +39 -2
  48. package/lib/typescript/src/components/frame/index.d.ts.map +1 -1
  49. package/lib/typescript/src/components/otp-input/index.d.ts +141 -0
  50. package/lib/typescript/src/components/otp-input/index.d.ts.map +1 -0
  51. package/lib/typescript/src/components/rating/index.d.ts +122 -0
  52. package/lib/typescript/src/components/rating/index.d.ts.map +1 -0
  53. package/lib/typescript/src/components/signature/index.d.ts +254 -0
  54. package/lib/typescript/src/components/signature/index.d.ts.map +1 -0
  55. package/lib/typescript/src/components/slider/index.d.ts +6 -0
  56. package/lib/typescript/src/components/slider/index.d.ts.map +1 -1
  57. package/lib/typescript/src/icons/index.d.ts +25 -0
  58. package/lib/typescript/src/icons/index.d.ts.map +1 -1
  59. package/lib/typescript/src/index.d.ts +8 -2
  60. package/lib/typescript/src/index.d.ts.map +1 -1
  61. package/package.json +9 -1
  62. package/src/components/bottom-sheet/index.tsx +50 -12
  63. package/src/components/checkbox/index.tsx +40 -12
  64. package/src/components/field/index.tsx +329 -0
  65. package/src/components/flow/flow-paths.ts +348 -0
  66. package/src/components/flow/index.tsx +1924 -0
  67. package/src/components/form/index.tsx +85 -0
  68. package/src/components/form/use-field.ts +65 -0
  69. package/src/components/form/use-form.ts +252 -0
  70. package/src/components/frame/index.tsx +162 -14
  71. package/src/components/otp-input/index.tsx +396 -0
  72. package/src/components/rating/index.tsx +416 -0
  73. package/src/components/signature/index.tsx +681 -0
  74. package/src/components/slider/index.tsx +20 -1
  75. package/src/icons/index.tsx +185 -0
  76. package/src/index.ts +78 -0
@@ -36,6 +36,7 @@ import Animated, {
36
36
  import { tv, type VariantProps } from 'tailwind-variants';
37
37
  import { getNativeUI } from '../../native';
38
38
  import { Text } from '../../primitives/text';
39
+ import { selectionTick } from '../../utils/haptics';
39
40
 
40
41
  /**
41
42
  * Springs the thumb onto its resting step after a drag or a track tap. Drags
@@ -127,6 +128,12 @@ export interface SliderProps extends Omit<SliderVariantProps, 'disabled'> {
127
128
  showValue?: boolean;
128
129
  /** Format the shown value. Defaults to the rounded number. */
129
130
  formatValue?: (value: number) => string;
131
+ /**
132
+ * A tick under the finger each time a drag crosses onto a new step, and once
133
+ * more when the drag ends. Off by default — needs the optional `expo-haptics`,
134
+ * and is silent without it.
135
+ */
136
+ haptics?: boolean;
130
137
  /** Extra classes for the caption row. */
131
138
  headerClassName?: string;
132
139
  /** Extra classes for the unfilled track. */
@@ -170,6 +177,7 @@ export const Slider = forwardRef<View, SliderProps>(
170
177
  label,
171
178
  showValue = false,
172
179
  formatValue,
180
+ haptics = false,
173
181
  color = 'primary',
174
182
  size = 'md',
175
183
  },
@@ -197,6 +205,9 @@ export const Slider = forwardRef<View, SliderProps>(
197
205
  changeRef.current = onValueChange;
198
206
  const commitRef = useRef(onValueCommit);
199
207
  commitRef.current = onValueCommit;
208
+ // The last step a drag ticked on, so haptics fire once per step, not per
209
+ // pixel of movement within it.
210
+ const lastTick = useRef(value);
200
211
 
201
212
  const emitChange = useCallback(
202
213
  (next: number) => {
@@ -223,10 +234,14 @@ export const Slider = forwardRef<View, SliderProps>(
223
234
  (p: number, commit: boolean) => {
224
235
  const raw = min + p * (max - min);
225
236
  const snapped = snap(raw, min, max, step);
237
+ if (haptics && snapped !== lastTick.current) {
238
+ lastTick.current = snapped;
239
+ selectionTick();
240
+ }
226
241
  emitChange(snapped);
227
242
  if (commit) emitCommit(snapped);
228
243
  },
229
- [min, max, step, emitChange, emitCommit]
244
+ [min, max, step, haptics, emitChange, emitCommit]
230
245
  );
231
246
 
232
247
  const pan = Gesture.Pan()
@@ -280,6 +295,10 @@ export const Slider = forwardRef<View, SliderProps>(
280
295
  const nudge = (dir: 1 | -1) => {
281
296
  const next = snap(value + dir * (step || 1), min, max, step);
282
297
  if (next === value) return;
298
+ if (haptics) {
299
+ lastTick.current = next;
300
+ selectionTick();
301
+ }
283
302
  progress.value = withSpring(max > min ? (next - min) / (max - min) : 0, SPRING);
284
303
  emitChange(next);
285
304
  emitCommit(next);
@@ -80,6 +80,21 @@ export function CheckIcon({ size = 14, color, ...props }: IconProps) {
80
80
  );
81
81
  }
82
82
 
83
+ export function MinusIcon({ size = 14, color, ...props }: IconProps) {
84
+ const resolved = useResolvedColor(color, '#fff');
85
+ return (
86
+ <Svg width={size} height={size} viewBox="0 0 24 24" fill="none" {...props}>
87
+ <Path
88
+ d="M5 12h14"
89
+ stroke={resolved}
90
+ strokeWidth={3}
91
+ strokeLinecap="round"
92
+ strokeLinejoin="round"
93
+ />
94
+ </Svg>
95
+ );
96
+ }
97
+
83
98
  export function ChevronDownIcon({ size = 16, color, ...props }: IconProps) {
84
99
  const resolved = useResolvedColor(color, '#737373');
85
100
  return (
@@ -546,3 +561,173 @@ export function PauseIcon({ size = 16, color, ...props }: IconProps) {
546
561
  </Svg>
547
562
  );
548
563
  }
564
+
565
+ /**
566
+ * A five-pointed star — the mark of a Rating. `filled` paints the interior;
567
+ * left hollow it is the outline of an unearned star. Both share the same
568
+ * geometry, so a filled star clipped over an empty one lines up to the pixel.
569
+ */
570
+ export function StarIcon({
571
+ size = 20,
572
+ color,
573
+ filled = false,
574
+ ...props
575
+ }: IconProps & { filled?: boolean }) {
576
+ const resolved = useResolvedColor(color, '#737373');
577
+ return (
578
+ <Svg width={size} height={size} viewBox="0 0 24 24" fill="none" {...props}>
579
+ <Path
580
+ d="M12 2.5l2.9 5.88 6.49.94-4.7 4.58 1.11 6.46L12 17.82 6.2 20.86l1.11-6.46-4.7-4.58 6.49-.94z"
581
+ fill={filled ? resolved : 'none'}
582
+ stroke={resolved}
583
+ strokeWidth={1.6}
584
+ strokeLinejoin="round"
585
+ strokeLinecap="round"
586
+ />
587
+ </Svg>
588
+ );
589
+ }
590
+
591
+ /** A pencil at an angle — draw, sign, edit by hand. */
592
+ export function PencilIcon({ size = 16, color, ...props }: IconProps) {
593
+ const resolved = useResolvedColor(color, '#737373');
594
+ return (
595
+ <Svg width={size} height={size} viewBox="0 0 24 24" fill="none" {...props}>
596
+ <Path
597
+ d="M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4z"
598
+ stroke={resolved}
599
+ strokeWidth={2}
600
+ strokeLinecap="round"
601
+ strokeLinejoin="round"
602
+ />
603
+ </Svg>
604
+ );
605
+ }
606
+
607
+ /** An arrow curling anticlockwise — undo, reset, start over. */
608
+ export function RotateCcwIcon({ size = 16, color, ...props }: IconProps) {
609
+ const resolved = useResolvedColor(color, '#737373');
610
+ return (
611
+ <Svg width={size} height={size} viewBox="0 0 24 24" fill="none" {...props}>
612
+ <Path
613
+ d="M3 12a9 9 0 1 0 2.64-6.36L3 8"
614
+ stroke={resolved}
615
+ strokeWidth={2}
616
+ strokeLinecap="round"
617
+ strokeLinejoin="round"
618
+ />
619
+ <Path
620
+ d="M3 3v5h5"
621
+ stroke={resolved}
622
+ strokeWidth={2}
623
+ strokeLinecap="round"
624
+ strokeLinejoin="round"
625
+ />
626
+ </Svg>
627
+ );
628
+ }
629
+
630
+ /** A bin — discard what is there. */
631
+ export function TrashIcon({ size = 16, color, ...props }: IconProps) {
632
+ const resolved = useResolvedColor(color, '#737373');
633
+ return (
634
+ <Svg width={size} height={size} viewBox="0 0 24 24" fill="none" {...props}>
635
+ <Path
636
+ d="M4 7h16M10 4h4M6 7l1 13h10l1-13"
637
+ stroke={resolved}
638
+ strokeWidth={2}
639
+ strokeLinecap="round"
640
+ strokeLinejoin="round"
641
+ />
642
+ </Svg>
643
+ );
644
+ }
645
+
646
+ /** An arrow into a tray — save the thing to a file. */
647
+ export function DownloadIcon({ size = 16, color, ...props }: IconProps) {
648
+ const resolved = useResolvedColor(color, '#737373');
649
+ return (
650
+ <Svg width={size} height={size} viewBox="0 0 24 24" fill="none" {...props}>
651
+ <Path
652
+ d="M12 3v12m0 0 4-4m-4 4-4-4M4 19h16"
653
+ stroke={resolved}
654
+ strokeWidth={2}
655
+ strokeLinecap="round"
656
+ strokeLinejoin="round"
657
+ />
658
+ </Svg>
659
+ );
660
+ }
661
+
662
+ /** A cross of two strokes — zoom in, add. Pairs with MinusIcon. */
663
+ export function PlusIcon({ size = 16, color, ...props }: IconProps) {
664
+ const resolved = useResolvedColor(color, '#737373');
665
+ return (
666
+ <Svg width={size} height={size} viewBox="0 0 24 24" fill="none" {...props}>
667
+ <Path
668
+ d="M12 5v14M5 12h14"
669
+ stroke={resolved}
670
+ strokeWidth={2}
671
+ strokeLinecap="round"
672
+ />
673
+ </Svg>
674
+ );
675
+ }
676
+
677
+ /** Four corners pushing outward — fit everything into view. */
678
+ export function MaximizeIcon({ size = 16, color, ...props }: IconProps) {
679
+ const resolved = useResolvedColor(color, '#737373');
680
+ return (
681
+ <Svg width={size} height={size} viewBox="0 0 24 24" fill="none" {...props}>
682
+ <Path
683
+ d="M8 3H3v5M16 3h5v5M8 21H3v-5M16 21h5v-5"
684
+ stroke={resolved}
685
+ strokeWidth={2}
686
+ strokeLinecap="round"
687
+ strokeLinejoin="round"
688
+ />
689
+ </Svg>
690
+ );
691
+ }
692
+
693
+ /** A closed padlock — the thing behind it cannot be moved. */
694
+ export function LockIcon({ size = 16, color, ...props }: IconProps) {
695
+ const resolved = useResolvedColor(color, '#737373');
696
+ return (
697
+ <Svg width={size} height={size} viewBox="0 0 24 24" fill="none" {...props}>
698
+ <Path
699
+ d="M5 11h14v10H5z"
700
+ stroke={resolved}
701
+ strokeWidth={2}
702
+ strokeLinejoin="round"
703
+ />
704
+ <Path
705
+ d="M8 11V7a4 4 0 0 1 8 0v4"
706
+ stroke={resolved}
707
+ strokeWidth={2}
708
+ strokeLinecap="round"
709
+ />
710
+ </Svg>
711
+ );
712
+ }
713
+
714
+ /** The same padlock with its shackle swung open — freely movable. */
715
+ export function UnlockIcon({ size = 16, color, ...props }: IconProps) {
716
+ const resolved = useResolvedColor(color, '#737373');
717
+ return (
718
+ <Svg width={size} height={size} viewBox="0 0 24 24" fill="none" {...props}>
719
+ <Path
720
+ d="M5 11h14v10H5z"
721
+ stroke={resolved}
722
+ strokeWidth={2}
723
+ strokeLinejoin="round"
724
+ />
725
+ <Path
726
+ d="M8 11V7a4 4 0 0 1 7.5-2"
727
+ stroke={resolved}
728
+ strokeWidth={2}
729
+ strokeLinecap="round"
730
+ />
731
+ </Svg>
732
+ );
733
+ }
package/src/index.ts CHANGED
@@ -104,6 +104,24 @@ export {
104
104
  type DirectionProps,
105
105
  type DirectionValue,
106
106
  } from './components/direction';
107
+ export {
108
+ Flow,
109
+ type FlowProps,
110
+ type FlowNodeProps,
111
+ type FlowHandleProps,
112
+ type FlowEdgeProps,
113
+ type FlowGroupProps,
114
+ type FlowBackgroundProps,
115
+ type FlowControlsProps,
116
+ type FlowMiniMapProps,
117
+ type FlowConnection,
118
+ type FlowViewport,
119
+ type FlowNodePosition,
120
+ type FlowEdgeVariant,
121
+ type FlowSide,
122
+ type FlowRect,
123
+ type FlowPoint,
124
+ } from './components/flow';
107
125
  export {
108
126
  Frame,
109
127
  type FrameProps,
@@ -111,6 +129,11 @@ export {
111
129
  type FramePanelProps,
112
130
  type FrameRowProps,
113
131
  type FrameSectionProps,
132
+ type FrameHeaderProps,
133
+ type FrameActionProps,
134
+ type FrameMediaProps,
135
+ type FrameContentProps,
136
+ type FrameActionsProps,
114
137
  type FrameVariant,
115
138
  } from './components/frame';
116
139
  export {
@@ -167,6 +190,34 @@ export {
167
190
  type EmptyStateProps,
168
191
  type EmptyStateMediaProps,
169
192
  } from './components/empty-state';
193
+ export {
194
+ Field,
195
+ type FieldProps,
196
+ type FieldContentProps,
197
+ type FieldLabelProps,
198
+ type FieldDescriptionProps,
199
+ type FieldErrorProps,
200
+ type FieldSetProps,
201
+ type FieldLegendProps,
202
+ type FieldGroupProps,
203
+ type FieldSeparatorProps,
204
+ type FieldTitleProps,
205
+ } from './components/field';
206
+ export {
207
+ Form,
208
+ useForm,
209
+ useField,
210
+ type FormProps,
211
+ type FormFieldProps,
212
+ type FormApi,
213
+ type FieldErrors,
214
+ type FieldTouched,
215
+ type FieldState,
216
+ type UseFormOptions,
217
+ type Validator,
218
+ type FormFieldRenderProps,
219
+ type UseFieldOptions,
220
+ } from './components/form';
170
221
  export { Input, type InputProps } from './components/input';
171
222
  export {
172
223
  InputGroup,
@@ -174,6 +225,7 @@ export {
174
225
  type InputGroupInputProps,
175
226
  type InputGroupDecoratorProps,
176
227
  } from './components/input-group';
228
+ export { OtpInput, type OtpInputProps } from './components/otp-input';
177
229
  export {
178
230
  Item,
179
231
  type ItemProps,
@@ -250,11 +302,28 @@ export {
250
302
  type RadioGroupProps,
251
303
  type RadioGroupItemProps,
252
304
  } from './components/radio-group';
305
+ export {
306
+ Rating,
307
+ type RatingProps,
308
+ type RatingColor,
309
+ type RatingSize,
310
+ } from './components/rating';
253
311
  export {
254
312
  ScrollFade,
255
313
  type ScrollFadeProps,
256
314
  } from './components/scroll-fade';
257
315
  export { Separator, type SeparatorProps } from './components/separator';
316
+ export {
317
+ Signature,
318
+ hasSignatureFileSystem,
319
+ hasSignatureRaster,
320
+ type SignatureProps,
321
+ type SignatureHandle,
322
+ type SignatureFile,
323
+ type SignatureSaveOptions,
324
+ type SignatureToolbarProps,
325
+ type SignatureButtonProps,
326
+ } from './components/signature';
258
327
  export { Shimmer, type ShimmerProps } from './components/shimmer';
259
328
  export {
260
329
  ScrollText,
@@ -331,26 +400,35 @@ export {
331
400
  ChevronDownIcon,
332
401
  ChevronLeftIcon,
333
402
  ChevronRightIcon,
403
+ DownloadIcon,
334
404
  FacebookIcon,
335
405
  FileIcon,
336
406
  GoogleIcon,
337
407
  IconColorProvider,
338
408
  InfoIcon,
339
409
  ImageIcon,
410
+ LockIcon,
411
+ MaximizeIcon,
340
412
  MicIcon,
413
+ MinusIcon,
341
414
  MoonIcon,
342
415
  PackageIcon,
343
416
  PaperclipIcon,
344
417
  PauseIcon,
418
+ PencilIcon,
345
419
  PlayIcon,
420
+ PlusIcon,
346
421
  PlusSquareIcon,
347
422
  ReceiptIcon,
423
+ RotateCcwIcon,
348
424
  SearchIcon,
349
425
  SendIcon,
350
426
  ShareNodesIcon,
351
427
  ShieldAlertIcon,
352
428
  ShieldCheckIcon,
353
429
  SunIcon,
430
+ TrashIcon,
431
+ UnlockIcon,
354
432
  XIcon,
355
433
  useIconColor,
356
434
  type IconProps,