panelui-native 0.41.0 → 0.44.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 +3 -2
- package/lib/module/components/card/index.js +8 -154
- package/lib/module/components/card/index.js.map +1 -1
- package/lib/module/components/color-picker/index.js +1395 -0
- package/lib/module/components/color-picker/index.js.map +1 -0
- package/lib/module/components/combobox/index.js +87 -19
- package/lib/module/components/combobox/index.js.map +1 -1
- package/lib/module/components/kpi-chart/index.js +648 -0
- package/lib/module/components/kpi-chart/index.js.map +1 -0
- package/lib/module/components/menu/index.js +40 -10
- package/lib/module/components/menu/index.js.map +1 -1
- package/lib/module/components/radar-chart/index.js +704 -0
- package/lib/module/components/radar-chart/index.js.map +1 -0
- package/lib/module/components/section-rail/index.js +32 -7
- package/lib/module/components/section-rail/index.js.map +1 -1
- package/lib/module/components/slider/index.js +240 -39
- package/lib/module/components/slider/index.js.map +1 -1
- package/lib/module/components/tabs/index.js +194 -10
- package/lib/module/components/tabs/index.js.map +1 -1
- package/lib/module/index.js +4 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/theme/use-theme.js +1 -1
- package/lib/module/utils/chart.js +44 -0
- package/lib/module/utils/chart.js.map +1 -1
- package/lib/module/utils/color.js +268 -0
- package/lib/module/utils/color.js.map +1 -0
- package/lib/typescript/src/components/card/index.d.ts +0 -20
- package/lib/typescript/src/components/card/index.d.ts.map +1 -1
- package/lib/typescript/src/components/color-picker/index.d.ts +258 -0
- package/lib/typescript/src/components/color-picker/index.d.ts.map +1 -0
- package/lib/typescript/src/components/combobox/index.d.ts.map +1 -1
- package/lib/typescript/src/components/kpi-chart/index.d.ts +490 -0
- package/lib/typescript/src/components/kpi-chart/index.d.ts.map +1 -0
- package/lib/typescript/src/components/menu/index.d.ts.map +1 -1
- package/lib/typescript/src/components/radar-chart/index.d.ts +214 -0
- package/lib/typescript/src/components/radar-chart/index.d.ts.map +1 -0
- package/lib/typescript/src/components/section-rail/index.d.ts +8 -1
- package/lib/typescript/src/components/section-rail/index.d.ts.map +1 -1
- package/lib/typescript/src/components/slider/index.d.ts +19 -0
- package/lib/typescript/src/components/slider/index.d.ts.map +1 -1
- package/lib/typescript/src/components/tabs/index.d.ts +11 -1
- package/lib/typescript/src/components/tabs/index.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +5 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/utils/chart.d.ts +21 -0
- package/lib/typescript/src/utils/chart.d.ts.map +1 -1
- package/lib/typescript/src/utils/color.d.ts +74 -0
- package/lib/typescript/src/utils/color.d.ts.map +1 -0
- package/package.json +2 -1
- package/src/components/card/index.tsx +7 -209
- package/src/components/color-picker/index.tsx +1618 -0
- package/src/components/combobox/index.tsx +89 -19
- package/src/components/kpi-chart/index.tsx +719 -0
- package/src/components/menu/index.tsx +51 -6
- package/src/components/radar-chart/index.tsx +910 -0
- package/src/components/section-rail/index.tsx +42 -8
- package/src/components/slider/index.tsx +283 -41
- package/src/components/tabs/index.tsx +263 -8
- package/src/index.ts +61 -1
- package/src/theme/use-theme.ts +1 -1
- package/src/utils/chart.ts +52 -0
- package/src/utils/color.ts +246 -0
- 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 {
|
|
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={
|
|
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
|
-
|
|
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
|
-
<
|
|
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
|
-
<
|
|
761
|
+
<Chevron
|
|
762
|
+
size={16}
|
|
763
|
+
strokeWidth={INDICATOR_STROKE}
|
|
764
|
+
color={chevronTint ?? INDICATOR_FALLBACK}
|
|
765
|
+
/>
|
|
721
766
|
</Animated.View>
|
|
722
767
|
}
|
|
723
768
|
onSelect={() => {
|