panelui-native 0.41.0 → 0.43.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 (58) hide show
  1. package/README.md +3 -2
  2. package/lib/module/components/color-picker/index.js +1395 -0
  3. package/lib/module/components/color-picker/index.js.map +1 -0
  4. package/lib/module/components/combobox/index.js +87 -19
  5. package/lib/module/components/combobox/index.js.map +1 -1
  6. package/lib/module/components/kpi-chart/index.js +648 -0
  7. package/lib/module/components/kpi-chart/index.js.map +1 -0
  8. package/lib/module/components/menu/index.js +40 -10
  9. package/lib/module/components/menu/index.js.map +1 -1
  10. package/lib/module/components/radar-chart/index.js +704 -0
  11. package/lib/module/components/radar-chart/index.js.map +1 -0
  12. package/lib/module/components/section-rail/index.js +32 -7
  13. package/lib/module/components/section-rail/index.js.map +1 -1
  14. package/lib/module/components/slider/index.js +240 -39
  15. package/lib/module/components/slider/index.js.map +1 -1
  16. package/lib/module/components/tabs/index.js +194 -10
  17. package/lib/module/components/tabs/index.js.map +1 -1
  18. package/lib/module/index.js +4 -0
  19. package/lib/module/index.js.map +1 -1
  20. package/lib/module/theme/use-theme.js +1 -1
  21. package/lib/module/utils/chart.js +44 -0
  22. package/lib/module/utils/chart.js.map +1 -1
  23. package/lib/module/utils/color.js +268 -0
  24. package/lib/module/utils/color.js.map +1 -0
  25. package/lib/typescript/src/components/color-picker/index.d.ts +258 -0
  26. package/lib/typescript/src/components/color-picker/index.d.ts.map +1 -0
  27. package/lib/typescript/src/components/combobox/index.d.ts.map +1 -1
  28. package/lib/typescript/src/components/kpi-chart/index.d.ts +490 -0
  29. package/lib/typescript/src/components/kpi-chart/index.d.ts.map +1 -0
  30. package/lib/typescript/src/components/menu/index.d.ts.map +1 -1
  31. package/lib/typescript/src/components/radar-chart/index.d.ts +214 -0
  32. package/lib/typescript/src/components/radar-chart/index.d.ts.map +1 -0
  33. package/lib/typescript/src/components/section-rail/index.d.ts +8 -1
  34. package/lib/typescript/src/components/section-rail/index.d.ts.map +1 -1
  35. package/lib/typescript/src/components/slider/index.d.ts +19 -0
  36. package/lib/typescript/src/components/slider/index.d.ts.map +1 -1
  37. package/lib/typescript/src/components/tabs/index.d.ts +11 -1
  38. package/lib/typescript/src/components/tabs/index.d.ts.map +1 -1
  39. package/lib/typescript/src/index.d.ts +4 -0
  40. package/lib/typescript/src/index.d.ts.map +1 -1
  41. package/lib/typescript/src/utils/chart.d.ts +21 -0
  42. package/lib/typescript/src/utils/chart.d.ts.map +1 -1
  43. package/lib/typescript/src/utils/color.d.ts +74 -0
  44. package/lib/typescript/src/utils/color.d.ts.map +1 -0
  45. package/package.json +2 -1
  46. package/src/components/color-picker/index.tsx +1618 -0
  47. package/src/components/combobox/index.tsx +89 -19
  48. package/src/components/kpi-chart/index.tsx +719 -0
  49. package/src/components/menu/index.tsx +51 -6
  50. package/src/components/radar-chart/index.tsx +910 -0
  51. package/src/components/section-rail/index.tsx +42 -8
  52. package/src/components/slider/index.tsx +283 -41
  53. package/src/components/tabs/index.tsx +263 -8
  54. package/src/index.ts +60 -0
  55. package/src/theme/use-theme.ts +1 -1
  56. package/src/utils/chart.ts +52 -0
  57. package/src/utils/color.ts +246 -0
  58. package/theme.css +125 -112
@@ -57,9 +57,9 @@ import Animated, {
57
57
  } from 'react-native-reanimated';
58
58
  import { tv } from 'tailwind-variants';
59
59
  import { useCSSVariable } from 'uniwind';
60
- import { CheckIcon, ChevronRightIcon } from '../../icons';
60
+ import { Check, ChevronLeft, ChevronRight, Circle } from 'lucide-react-native';
61
61
  import { Text, textChildren } from '../../primitives/text';
62
- import { useDirectionSign } from '../../hooks/use-direction';
62
+ import { useDirection, useDirectionSign } from '../../hooks/use-direction';
63
63
  import { selectionTick } from '../../utils/haptics';
64
64
  import { cn } from '../../utils/cn';
65
65
  import { Popover, type PopoverContentProps, type PopoverProps } from '../popover';
@@ -79,6 +79,19 @@ function useTint(variable: string): string | undefined {
79
79
  return typeof raw === 'string' ? raw : undefined;
80
80
  }
81
81
 
82
+ /**
83
+ * The colour an indicator falls back to before the stylesheet has been read.
84
+ *
85
+ * The glyphs here are drawn by a general-purpose icon set rather than by this
86
+ * library's own, and that set defaults an unset colour to `currentColor` —
87
+ * which React Native cannot resolve and refuses to paint. A neutral mid grey
88
+ * is legible on either a light or a dark panel for the frame or two it lasts.
89
+ */
90
+ const INDICATOR_FALLBACK = '#737373';
91
+
92
+ /** Icon stroke, matched to the weight this library's own glyphs are drawn at. */
93
+ const INDICATOR_STROKE = 2;
94
+
82
95
  /** How long a row takes to light up under a finger, and to let go again. */
83
96
  const PRESS_IN_DURATION = 90;
84
97
  const PRESS_OUT_DURATION = 160;
@@ -544,7 +557,17 @@ function MenuCheckboxItem({
544
557
  // An empty column rather than no column: the mark comes and goes as the
545
558
  // row is toggled, and a row whose label steps sideways each time reads
546
559
  // as a different row rather than the same one in a new state.
547
- icon={checked ? <CheckIcon size={16} color={tint} /> : <MenuIndicatorSpacer />}
560
+ icon={
561
+ checked ? (
562
+ <Check
563
+ size={16}
564
+ strokeWidth={INDICATOR_STROKE}
565
+ color={tint ?? INDICATOR_FALLBACK}
566
+ />
567
+ ) : (
568
+ <MenuIndicatorSpacer />
569
+ )
570
+ }
548
571
  onSelect={() => {
549
572
  onCheckedChange?.(!checked);
550
573
  onSelect?.();
@@ -616,9 +639,22 @@ function MenuRadioItem({
616
639
  icon={
617
640
  selected ? (
618
641
  indicator === 'dot' ? (
619
- <View className="h-2 w-2 rounded-full bg-popover-foreground" />
642
+ // A filled circle, not a bare View: the dot is an indicator like
643
+ // the tick beside it, and drawing one of the two as a rounded box
644
+ // is what makes them optically different sizes at the same nominal
645
+ // one.
646
+ <Circle
647
+ size={8}
648
+ strokeWidth={INDICATOR_STROKE}
649
+ color={tint ?? INDICATOR_FALLBACK}
650
+ fill={tint ?? INDICATOR_FALLBACK}
651
+ />
620
652
  ) : (
621
- <CheckIcon size={16} color={tint} />
653
+ <Check
654
+ size={16}
655
+ strokeWidth={INDICATOR_STROKE}
656
+ color={tint ?? INDICATOR_FALLBACK}
657
+ />
622
658
  )
623
659
  ) : (
624
660
  // Held open, so the options stay in one column as the choice moves
@@ -690,8 +726,13 @@ export interface MenuSubTriggerProps
690
726
  function MenuSubTrigger({ className, children, icon, onSelect, ...props }: MenuSubTriggerProps) {
691
727
  const { open, toggle } = useMenuSub('Menu.SubTrigger');
692
728
  const sign = useDirectionSign();
729
+ const direction = useDirection();
693
730
  const reducedMotion = useReducedMotion();
694
731
  const chevronTint = useTint('--color-muted-foreground');
732
+ // The glyph mirrors by being the other glyph. A `scaleX` flip would work on
733
+ // a chevron, but it also flips the rotation below with it — and this one is
734
+ // already being rotated.
735
+ const Chevron = direction === 'rtl' ? ChevronLeft : ChevronRight;
695
736
  const progress = useSharedValue(open ? 1 : 0);
696
737
 
697
738
  useEffect(() => {
@@ -717,7 +758,11 @@ function MenuSubTrigger({ className, children, icon, onSelect, ...props }: MenuS
717
758
  className={className}
718
759
  trailing={
719
760
  <Animated.View style={chevronStyle}>
720
- <ChevronRightIcon size={16} color={chevronTint} />
761
+ <Chevron
762
+ size={16}
763
+ strokeWidth={INDICATOR_STROKE}
764
+ color={chevronTint ?? INDICATOR_FALLBACK}
765
+ />
721
766
  </Animated.View>
722
767
  }
723
768
  onSelect={() => {