panelui-native 0.22.6 → 0.28.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.
- package/README.md +1 -0
- package/lib/module/components/accordion/index.js +8 -8
- package/lib/module/components/accordion/index.js.map +1 -1
- package/lib/module/components/alert/index.js +2 -2
- package/lib/module/components/alert/index.js.map +1 -1
- package/lib/module/components/area-chart/index.js +958 -0
- package/lib/module/components/area-chart/index.js.map +1 -0
- package/lib/module/components/attachment/index.js +2 -1
- package/lib/module/components/attachment/index.js.map +1 -1
- package/lib/module/components/avatar/index.js +4 -4
- package/lib/module/components/avatar/index.js.map +1 -1
- package/lib/module/components/badge/index.js +4 -4
- package/lib/module/components/badge/index.js.map +1 -1
- package/lib/module/components/bar-chart/index.js +994 -0
- package/lib/module/components/bar-chart/index.js.map +1 -0
- package/lib/module/components/bottom-sheet/index.js +213 -24
- package/lib/module/components/bottom-sheet/index.js.map +1 -1
- package/lib/module/components/breadcrumb/index.js +275 -0
- package/lib/module/components/breadcrumb/index.js.map +1 -0
- package/lib/module/components/button/index.js +11 -6
- package/lib/module/components/button/index.js.map +1 -1
- package/lib/module/components/calendar/index.js +557 -0
- package/lib/module/components/calendar/index.js.map +1 -0
- package/lib/module/components/carousel/index.js +680 -0
- package/lib/module/components/carousel/index.js.map +1 -0
- package/lib/module/components/chip/index.js +6 -6
- package/lib/module/components/chip/index.js.map +1 -1
- package/lib/module/components/date-picker/index.js +158 -0
- package/lib/module/components/date-picker/index.js.map +1 -0
- package/lib/module/components/dialog/index.js +7 -2
- package/lib/module/components/dialog/index.js.map +1 -1
- package/lib/module/components/direction/index.js +15 -20
- package/lib/module/components/direction/index.js.map +1 -1
- package/lib/module/components/empty-state/index.js +2 -2
- package/lib/module/components/empty-state/index.js.map +1 -1
- package/lib/module/components/field/index.js +5 -5
- package/lib/module/components/field/index.js.map +1 -1
- package/lib/module/components/flow/index.js +3 -3
- package/lib/module/components/flow/index.js.map +1 -1
- package/lib/module/components/frame/index.js +22 -5
- package/lib/module/components/frame/index.js.map +1 -1
- package/lib/module/components/heatmap-chart/index.js +28 -8
- package/lib/module/components/heatmap-chart/index.js.map +1 -1
- package/lib/module/components/input-group/index.js +5 -4
- package/lib/module/components/input-group/index.js.map +1 -1
- package/lib/module/components/item/index.js +9 -9
- package/lib/module/components/item/index.js.map +1 -1
- package/lib/module/components/label/index.js +4 -4
- package/lib/module/components/label/index.js.map +1 -1
- package/lib/module/components/line-chart/index.js +165 -184
- package/lib/module/components/line-chart/index.js.map +1 -1
- package/lib/module/components/loader/index.js +758 -0
- package/lib/module/components/loader/index.js.map +1 -0
- package/lib/module/components/map/basemap.js +265 -0
- package/lib/module/components/map/basemap.js.map +1 -0
- package/lib/module/components/map/index.js +850 -0
- package/lib/module/components/map/index.js.map +1 -0
- package/lib/module/components/map/maplibre.js +87 -0
- package/lib/module/components/map/maplibre.js.map +1 -0
- package/lib/module/components/marker/index.js +3 -3
- package/lib/module/components/marker/index.js.map +1 -1
- package/lib/module/components/message/index.js +15 -14
- package/lib/module/components/message/index.js.map +1 -1
- package/lib/module/components/message-scroller/index.js +5 -4
- package/lib/module/components/message-scroller/index.js.map +1 -1
- package/lib/module/components/otp-input/index.js +2 -2
- package/lib/module/components/popover/index.js +39 -7
- package/lib/module/components/popover/index.js.map +1 -1
- package/lib/module/components/progress/index.js +8 -2
- package/lib/module/components/progress/index.js.map +1 -1
- package/lib/module/components/radio-group/index.js +2 -2
- package/lib/module/components/radio-group/index.js.map +1 -1
- package/lib/module/components/ring-chart/index.js +423 -0
- package/lib/module/components/ring-chart/index.js.map +1 -0
- package/lib/module/components/section-rail/index.js +6 -6
- package/lib/module/components/section-rail/index.js.map +1 -1
- package/lib/module/components/select/index.js +10 -4
- package/lib/module/components/select/index.js.map +1 -1
- package/lib/module/components/separator/index.js +76 -22
- package/lib/module/components/separator/index.js.map +1 -1
- package/lib/module/components/shimmer/index.js +10 -1
- package/lib/module/components/shimmer/index.js.map +1 -1
- package/lib/module/components/slider/index.js +19 -5
- package/lib/module/components/slider/index.js.map +1 -1
- package/lib/module/components/steps/index.js +5 -5
- package/lib/module/components/steps/index.js.map +1 -1
- package/lib/module/components/switch/index.js +6 -1
- package/lib/module/components/switch/index.js.map +1 -1
- package/lib/module/components/tabs/index.js +7 -7
- package/lib/module/components/tabs/index.js.map +1 -1
- package/lib/module/components/timeline/index.js +4 -4
- package/lib/module/components/timeline/index.js.map +1 -1
- package/lib/module/components/toast/index.js +2 -2
- package/lib/module/components/toast/index.js.map +1 -1
- package/lib/module/components/toggle-button/index.js +5 -5
- package/lib/module/components/toggle-button/index.js.map +1 -1
- package/lib/module/components/tooltip/index.js +492 -0
- package/lib/module/components/tooltip/index.js.map +1 -0
- package/lib/module/components/typography/index.js +7 -2
- package/lib/module/components/typography/index.js.map +1 -1
- package/lib/module/hooks/index.js +1 -0
- package/lib/module/hooks/index.js.map +1 -1
- package/lib/module/hooks/use-back-handler.js +37 -0
- package/lib/module/hooks/use-back-handler.js.map +1 -0
- package/lib/module/hooks/use-direction.js +43 -0
- package/lib/module/hooks/use-direction.js.map +1 -0
- package/lib/module/icons/index.js +180 -2
- package/lib/module/icons/index.js.map +1 -1
- package/lib/module/index.js +12 -2
- package/lib/module/index.js.map +1 -1
- package/lib/module/primitives/keyboard-avoider.js +2 -1
- package/lib/module/primitives/keyboard-avoider.js.map +1 -1
- package/lib/module/primitives/text.js +55 -11
- package/lib/module/primitives/text.js.map +1 -1
- package/lib/module/utils/chart.js +279 -0
- package/lib/module/utils/chart.js.map +1 -0
- package/lib/module/utils/date.js +386 -0
- package/lib/module/utils/date.js.map +1 -0
- package/lib/typescript/src/components/accordion/index.d.ts.map +1 -1
- package/lib/typescript/src/components/alert/index.d.ts.map +1 -1
- package/lib/typescript/src/components/area-chart/index.d.ts +237 -0
- package/lib/typescript/src/components/area-chart/index.d.ts.map +1 -0
- package/lib/typescript/src/components/attachment/index.d.ts.map +1 -1
- package/lib/typescript/src/components/bar-chart/index.d.ts +270 -0
- package/lib/typescript/src/components/bar-chart/index.d.ts.map +1 -0
- package/lib/typescript/src/components/bottom-sheet/index.d.ts +75 -4
- package/lib/typescript/src/components/bottom-sheet/index.d.ts.map +1 -1
- package/lib/typescript/src/components/breadcrumb/index.d.ts +100 -0
- package/lib/typescript/src/components/breadcrumb/index.d.ts.map +1 -0
- package/lib/typescript/src/components/button/index.d.ts.map +1 -1
- package/lib/typescript/src/components/calendar/index.d.ts +108 -0
- package/lib/typescript/src/components/calendar/index.d.ts.map +1 -0
- package/lib/typescript/src/components/carousel/index.d.ts +179 -0
- package/lib/typescript/src/components/carousel/index.d.ts.map +1 -0
- package/lib/typescript/src/components/chip/index.d.ts.map +1 -1
- package/lib/typescript/src/components/date-picker/index.d.ts +91 -0
- package/lib/typescript/src/components/date-picker/index.d.ts.map +1 -0
- package/lib/typescript/src/components/dialog/index.d.ts.map +1 -1
- package/lib/typescript/src/components/direction/index.d.ts +11 -10
- package/lib/typescript/src/components/direction/index.d.ts.map +1 -1
- package/lib/typescript/src/components/empty-state/index.d.ts.map +1 -1
- package/lib/typescript/src/components/field/index.d.ts.map +1 -1
- package/lib/typescript/src/components/frame/index.d.ts +17 -0
- package/lib/typescript/src/components/frame/index.d.ts.map +1 -1
- package/lib/typescript/src/components/heatmap-chart/index.d.ts +22 -3
- package/lib/typescript/src/components/heatmap-chart/index.d.ts.map +1 -1
- package/lib/typescript/src/components/input-group/index.d.ts.map +1 -1
- package/lib/typescript/src/components/item/index.d.ts.map +1 -1
- package/lib/typescript/src/components/label/index.d.ts.map +1 -1
- package/lib/typescript/src/components/line-chart/index.d.ts +42 -2
- package/lib/typescript/src/components/line-chart/index.d.ts.map +1 -1
- package/lib/typescript/src/components/loader/index.d.ts +38 -0
- package/lib/typescript/src/components/loader/index.d.ts.map +1 -0
- package/lib/typescript/src/components/map/basemap.d.ts +76 -0
- package/lib/typescript/src/components/map/basemap.d.ts.map +1 -0
- package/lib/typescript/src/components/map/index.d.ts +367 -0
- package/lib/typescript/src/components/map/index.d.ts.map +1 -0
- package/lib/typescript/src/components/map/maplibre.d.ts +193 -0
- package/lib/typescript/src/components/map/maplibre.d.ts.map +1 -0
- package/lib/typescript/src/components/marker/index.d.ts.map +1 -1
- package/lib/typescript/src/components/message/index.d.ts.map +1 -1
- package/lib/typescript/src/components/message-scroller/index.d.ts.map +1 -1
- package/lib/typescript/src/components/popover/index.d.ts.map +1 -1
- package/lib/typescript/src/components/progress/index.d.ts.map +1 -1
- package/lib/typescript/src/components/ring-chart/index.d.ts +156 -0
- package/lib/typescript/src/components/ring-chart/index.d.ts.map +1 -0
- package/lib/typescript/src/components/select/index.d.ts.map +1 -1
- package/lib/typescript/src/components/separator/index.d.ts +36 -1
- package/lib/typescript/src/components/separator/index.d.ts.map +1 -1
- package/lib/typescript/src/components/shimmer/index.d.ts.map +1 -1
- package/lib/typescript/src/components/slider/index.d.ts.map +1 -1
- package/lib/typescript/src/components/steps/index.d.ts.map +1 -1
- package/lib/typescript/src/components/switch/index.d.ts.map +1 -1
- package/lib/typescript/src/components/tabs/index.d.ts.map +1 -1
- package/lib/typescript/src/components/timeline/index.d.ts.map +1 -1
- package/lib/typescript/src/components/toast/index.d.ts.map +1 -1
- package/lib/typescript/src/components/toggle-button/index.d.ts.map +1 -1
- package/lib/typescript/src/components/tooltip/index.d.ts +125 -0
- package/lib/typescript/src/components/tooltip/index.d.ts.map +1 -0
- package/lib/typescript/src/components/typography/index.d.ts +6 -0
- package/lib/typescript/src/components/typography/index.d.ts.map +1 -1
- package/lib/typescript/src/hooks/index.d.ts +1 -0
- package/lib/typescript/src/hooks/index.d.ts.map +1 -1
- package/lib/typescript/src/hooks/use-back-handler.d.ts +19 -0
- package/lib/typescript/src/hooks/use-back-handler.d.ts.map +1 -0
- package/lib/typescript/src/hooks/use-direction.d.ts +20 -0
- package/lib/typescript/src/hooks/use-direction.d.ts.map +1 -0
- package/lib/typescript/src/icons/index.d.ts +8 -0
- package/lib/typescript/src/icons/index.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +14 -4
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/primitives/keyboard-avoider.d.ts.map +1 -1
- package/lib/typescript/src/primitives/text.d.ts +20 -0
- package/lib/typescript/src/primitives/text.d.ts.map +1 -1
- package/lib/typescript/src/utils/chart.d.ts +96 -0
- package/lib/typescript/src/utils/chart.d.ts.map +1 -0
- package/lib/typescript/src/utils/date.d.ts +116 -0
- package/lib/typescript/src/utils/date.d.ts.map +1 -0
- package/package.json +9 -1
- package/src/components/accordion/index.tsx +8 -12
- package/src/components/alert/index.tsx +2 -2
- package/src/components/area-chart/index.tsx +1147 -0
- package/src/components/attachment/index.tsx +2 -2
- package/src/components/avatar/index.tsx +4 -4
- package/src/components/badge/index.tsx +6 -6
- package/src/components/bar-chart/index.tsx +1208 -0
- package/src/components/bottom-sheet/index.tsx +282 -21
- package/src/components/breadcrumb/index.tsx +363 -0
- package/src/components/button/index.tsx +12 -8
- package/src/components/calendar/index.tsx +703 -0
- package/src/components/carousel/index.tsx +788 -0
- package/src/components/chip/index.tsx +6 -8
- package/src/components/date-picker/index.tsx +237 -0
- package/src/components/dialog/index.tsx +7 -2
- package/src/components/direction/index.tsx +22 -22
- package/src/components/empty-state/index.tsx +2 -2
- package/src/components/field/index.tsx +3 -5
- package/src/components/flow/index.tsx +3 -3
- package/src/components/frame/index.tsx +22 -7
- package/src/components/heatmap-chart/index.tsx +58 -11
- package/src/components/input-group/index.tsx +5 -4
- package/src/components/item/index.tsx +9 -9
- package/src/components/label/index.tsx +2 -2
- package/src/components/line-chart/index.tsx +194 -223
- package/src/components/loader/index.tsx +812 -0
- package/src/components/map/basemap.ts +304 -0
- package/src/components/map/index.tsx +1116 -0
- package/src/components/map/maplibre.ts +201 -0
- package/src/components/marker/index.tsx +3 -3
- package/src/components/message/index.tsx +15 -14
- package/src/components/message-scroller/index.tsx +5 -4
- package/src/components/otp-input/index.tsx +2 -2
- package/src/components/popover/index.tsx +43 -7
- package/src/components/progress/index.tsx +10 -2
- package/src/components/radio-group/index.tsx +2 -2
- package/src/components/ring-chart/index.tsx +543 -0
- package/src/components/section-rail/index.tsx +6 -6
- package/src/components/select/index.tsx +10 -4
- package/src/components/separator/index.tsx +77 -19
- package/src/components/shimmer/index.tsx +10 -1
- package/src/components/slider/index.tsx +20 -5
- package/src/components/steps/index.tsx +5 -5
- package/src/components/switch/index.tsx +6 -1
- package/src/components/tabs/index.tsx +7 -9
- package/src/components/timeline/index.tsx +4 -4
- package/src/components/toast/index.tsx +2 -2
- package/src/components/toggle-button/index.tsx +5 -7
- package/src/components/tooltip/index.tsx +610 -0
- package/src/components/typography/index.tsx +7 -2
- package/src/hooks/index.ts +1 -0
- package/src/hooks/use-back-handler.ts +37 -0
- package/src/hooks/use-direction.ts +45 -0
- package/src/icons/index.tsx +111 -0
- package/src/index.ts +129 -0
- package/src/primitives/keyboard-avoider.tsx +2 -1
- package/src/primitives/text.tsx +53 -8
- package/src/utils/chart.ts +355 -0
- package/src/utils/date.ts +446 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The reading direction in force.
|
|
3
|
+
*
|
|
4
|
+
* The context lives here rather than beside the `Direction` component so that
|
|
5
|
+
* anything can read it cheaply. `Text` in particular has to: `direction` is a
|
|
6
|
+
* Yoga *layout* property, and React Native resolves a paragraph's alignment
|
|
7
|
+
* from the process-wide `I18nManager.isRTL` instead — so without this, an
|
|
8
|
+
* Arabic paragraph inside `<Direction dir="rtl">` mirrors the furniture around
|
|
9
|
+
* it and then sits left-aligned inside it.
|
|
10
|
+
*
|
|
11
|
+
* Keeping it in a hook also keeps the dependency the right way round: a
|
|
12
|
+
* component that only needs to know the direction pulls in a hook, not the
|
|
13
|
+
* whole provider.
|
|
14
|
+
*/
|
|
15
|
+
import { createContext, useContext } from 'react';
|
|
16
|
+
import { I18nManager } from 'react-native';
|
|
17
|
+
|
|
18
|
+
export type DirectionValue = 'ltr' | 'rtl';
|
|
19
|
+
|
|
20
|
+
/** What the device is set to, for anything outside a provider. */
|
|
21
|
+
export const deviceDirection = (): DirectionValue =>
|
|
22
|
+
I18nManager.isRTL ? 'rtl' : 'ltr';
|
|
23
|
+
|
|
24
|
+
export const DirectionContext = createContext<DirectionValue | null>(null);
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* The reading direction in force, for a component that has to flip maths Yoga
|
|
28
|
+
* cannot flip for it. Safe with no provider mounted: it falls back to the
|
|
29
|
+
* device's own setting.
|
|
30
|
+
*/
|
|
31
|
+
export function useDirection(): DirectionValue {
|
|
32
|
+
return useContext(DirectionContext) ?? deviceDirection();
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* `-1` in a right-to-left subtree, `1` otherwise.
|
|
37
|
+
*
|
|
38
|
+
* The form most of the pixel maths actually wants. A drag translation, an
|
|
39
|
+
* indicator offset and a sweep are all a number that has to change sign, and
|
|
40
|
+
* writing `dir === 'rtl' ? -x : x` at every one of them is where the sign
|
|
41
|
+
* errors live.
|
|
42
|
+
*/
|
|
43
|
+
export function useDirectionSign(): 1 | -1 {
|
|
44
|
+
return useDirection() === 'rtl' ? -1 : 1;
|
|
45
|
+
}
|
package/src/icons/index.tsx
CHANGED
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
*/
|
|
19
19
|
import { createContext, useContext, type ReactNode } from 'react';
|
|
20
20
|
import Svg, { Circle, G, Path, type SvgProps } from 'react-native-svg';
|
|
21
|
+
import { useDirection } from '../hooks/use-direction';
|
|
21
22
|
|
|
22
23
|
export interface IconProps extends SvgProps {
|
|
23
24
|
size?: number;
|
|
@@ -102,6 +103,51 @@ export function MinusIcon({ size = 14, color, strokeWidth = 3, ...props }: IconP
|
|
|
102
103
|
);
|
|
103
104
|
}
|
|
104
105
|
|
|
106
|
+
export function ChevronUpIcon({ size = 16, color, ...props }: IconProps) {
|
|
107
|
+
const resolved = useResolvedColor(color, '#737373');
|
|
108
|
+
return (
|
|
109
|
+
<Svg width={size} height={size} viewBox="0 0 24 24" fill="none" {...props}>
|
|
110
|
+
<Path
|
|
111
|
+
d="m18 15-6-6-6 6"
|
|
112
|
+
stroke={resolved}
|
|
113
|
+
strokeWidth={2}
|
|
114
|
+
strokeLinecap="round"
|
|
115
|
+
strokeLinejoin="round"
|
|
116
|
+
/>
|
|
117
|
+
</Svg>
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export function CalendarIcon({ size = 16, color, ...props }: IconProps) {
|
|
122
|
+
const resolved = useResolvedColor(color, '#737373');
|
|
123
|
+
return (
|
|
124
|
+
<Svg width={size} height={size} viewBox="0 0 24 24" fill="none" {...props}>
|
|
125
|
+
<Path
|
|
126
|
+
d="M8 2v4M16 2v4M3 10h18M5 4h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2Z"
|
|
127
|
+
stroke={resolved}
|
|
128
|
+
strokeWidth={2}
|
|
129
|
+
strokeLinecap="round"
|
|
130
|
+
strokeLinejoin="round"
|
|
131
|
+
/>
|
|
132
|
+
</Svg>
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export function BookmarkIcon({ size = 16, color, ...props }: IconProps) {
|
|
137
|
+
const resolved = useResolvedColor(color, '#737373');
|
|
138
|
+
return (
|
|
139
|
+
<Svg width={size} height={size} viewBox="0 0 24 24" fill="none" {...props}>
|
|
140
|
+
<Path
|
|
141
|
+
d="m19 21-7-5-7 5V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2Z"
|
|
142
|
+
stroke={resolved}
|
|
143
|
+
strokeWidth={2}
|
|
144
|
+
strokeLinecap="round"
|
|
145
|
+
strokeLinejoin="round"
|
|
146
|
+
/>
|
|
147
|
+
</Svg>
|
|
148
|
+
);
|
|
149
|
+
}
|
|
150
|
+
|
|
105
151
|
export function ChevronDownIcon({ size = 16, color, ...props }: IconProps) {
|
|
106
152
|
const resolved = useResolvedColor(color, '#737373');
|
|
107
153
|
return (
|
|
@@ -117,8 +163,26 @@ export function ChevronDownIcon({ size = 16, color, ...props }: IconProps) {
|
|
|
117
163
|
);
|
|
118
164
|
}
|
|
119
165
|
|
|
166
|
+
/**
|
|
167
|
+
* Mirrors a directional glyph in a right-to-left subtree.
|
|
168
|
+
*
|
|
169
|
+
* Yoga moves a chevron to the other end of its row, but it cannot turn the
|
|
170
|
+
* glyph around — so an RTL list row ends up with a right-pointing chevron on
|
|
171
|
+
* its left edge, pointing back at the text. These arrows mean "onward" and
|
|
172
|
+
* "back", and which way that is depends on which way you read.
|
|
173
|
+
*
|
|
174
|
+
* Only for glyphs whose meaning *is* a direction. An icon that happens to be
|
|
175
|
+
* asymmetric — a pencil, a magnifier — means the same thing either way round,
|
|
176
|
+
* and flipping it is just a wrong drawing.
|
|
177
|
+
*/
|
|
178
|
+
function useFlip(): { transform?: string } {
|
|
179
|
+
const rtl = useDirection() === 'rtl';
|
|
180
|
+
return rtl ? { transform: 'scale(-1 1) translate(-24 0)' } : {};
|
|
181
|
+
}
|
|
182
|
+
|
|
120
183
|
export function ChevronLeftIcon({ size = 16, color, ...props }: IconProps) {
|
|
121
184
|
const resolved = useResolvedColor(color, '#737373');
|
|
185
|
+
const flip = useFlip();
|
|
122
186
|
return (
|
|
123
187
|
<Svg width={size} height={size} viewBox="0 0 24 24" fill="none" {...props}>
|
|
124
188
|
<Path
|
|
@@ -127,6 +191,7 @@ export function ChevronLeftIcon({ size = 16, color, ...props }: IconProps) {
|
|
|
127
191
|
strokeWidth={2}
|
|
128
192
|
strokeLinecap="round"
|
|
129
193
|
strokeLinejoin="round"
|
|
194
|
+
{...flip}
|
|
130
195
|
/>
|
|
131
196
|
</Svg>
|
|
132
197
|
);
|
|
@@ -134,6 +199,7 @@ export function ChevronLeftIcon({ size = 16, color, ...props }: IconProps) {
|
|
|
134
199
|
|
|
135
200
|
export function ChevronRightIcon({ size = 16, color, ...props }: IconProps) {
|
|
136
201
|
const resolved = useResolvedColor(color, '#737373');
|
|
202
|
+
const flip = useFlip();
|
|
137
203
|
return (
|
|
138
204
|
<Svg width={size} height={size} viewBox="0 0 24 24" fill="none" {...props}>
|
|
139
205
|
<Path
|
|
@@ -142,11 +208,23 @@ export function ChevronRightIcon({ size = 16, color, ...props }: IconProps) {
|
|
|
142
208
|
strokeWidth={2}
|
|
143
209
|
strokeLinecap="round"
|
|
144
210
|
strokeLinejoin="round"
|
|
211
|
+
{...flip}
|
|
145
212
|
/>
|
|
146
213
|
</Svg>
|
|
147
214
|
);
|
|
148
215
|
}
|
|
149
216
|
|
|
217
|
+
export function EllipsisIcon({ size = 16, color, ...props }: IconProps) {
|
|
218
|
+
const resolved = useResolvedColor(color, '#737373');
|
|
219
|
+
return (
|
|
220
|
+
<Svg width={size} height={size} viewBox="0 0 24 24" fill="none" {...props}>
|
|
221
|
+
<Circle cx={5} cy={12} r={1.6} fill={resolved} />
|
|
222
|
+
<Circle cx={12} cy={12} r={1.6} fill={resolved} />
|
|
223
|
+
<Circle cx={19} cy={12} r={1.6} fill={resolved} />
|
|
224
|
+
</Svg>
|
|
225
|
+
);
|
|
226
|
+
}
|
|
227
|
+
|
|
150
228
|
export function XIcon({ size = 16, color, ...props }: IconProps) {
|
|
151
229
|
const resolved = useResolvedColor(color, '#737373');
|
|
152
230
|
return (
|
|
@@ -720,6 +798,39 @@ export function MaximizeIcon({ size = 16, color, ...props }: IconProps) {
|
|
|
720
798
|
);
|
|
721
799
|
}
|
|
722
800
|
|
|
801
|
+
/** Crosshairs on a centre dot — put me where I actually am. */
|
|
802
|
+
export function CrosshairIcon({ size = 16, color, ...props }: IconProps) {
|
|
803
|
+
const resolved = useResolvedColor(color, '#737373');
|
|
804
|
+
return (
|
|
805
|
+
<Svg width={size} height={size} viewBox="0 0 24 24" fill="none" {...props}>
|
|
806
|
+
<Circle cx={12} cy={12} r={7} stroke={resolved} strokeWidth={2} />
|
|
807
|
+
<Path
|
|
808
|
+
d="M12 2v3M12 19v3M2 12h3M19 12h3"
|
|
809
|
+
stroke={resolved}
|
|
810
|
+
strokeWidth={2}
|
|
811
|
+
strokeLinecap="round"
|
|
812
|
+
/>
|
|
813
|
+
<Circle cx={12} cy={12} r={1.5} fill={resolved} />
|
|
814
|
+
</Svg>
|
|
815
|
+
);
|
|
816
|
+
}
|
|
817
|
+
|
|
818
|
+
/** A compass needle — which way is north. */
|
|
819
|
+
export function CompassIcon({ size = 16, color, ...props }: IconProps) {
|
|
820
|
+
const resolved = useResolvedColor(color, '#737373');
|
|
821
|
+
return (
|
|
822
|
+
<Svg width={size} height={size} viewBox="0 0 24 24" fill="none" {...props}>
|
|
823
|
+
<Circle cx={12} cy={12} r={9} stroke={resolved} strokeWidth={2} />
|
|
824
|
+
<Path
|
|
825
|
+
d="M15.5 8.5l-2 5-5 2 2-5 5-2z"
|
|
826
|
+
stroke={resolved}
|
|
827
|
+
strokeWidth={2}
|
|
828
|
+
strokeLinejoin="round"
|
|
829
|
+
/>
|
|
830
|
+
</Svg>
|
|
831
|
+
);
|
|
832
|
+
}
|
|
833
|
+
|
|
723
834
|
/** A closed padlock — the thing behind it cannot be moved. */
|
|
724
835
|
export function LockIcon({ size = 16, color, ...props }: IconProps) {
|
|
725
836
|
const resolved = useResolvedColor(color, '#737373');
|
package/src/index.ts
CHANGED
|
@@ -73,12 +73,56 @@ export {
|
|
|
73
73
|
type AttachmentActionProps,
|
|
74
74
|
type AttachmentState,
|
|
75
75
|
} from './components/attachment';
|
|
76
|
+
export {
|
|
77
|
+
AreaChart,
|
|
78
|
+
useAreaChart,
|
|
79
|
+
type AreaChartProps,
|
|
80
|
+
type AreaChartHandle,
|
|
81
|
+
type AreaChartGridProps,
|
|
82
|
+
type AreaChartHeaderProps,
|
|
83
|
+
type AreaChartAreaProps,
|
|
84
|
+
type AreaChartXAxisProps,
|
|
85
|
+
type AreaChartYAxisProps,
|
|
86
|
+
type AreaChartTooltipProps,
|
|
87
|
+
type AreaChartLegendProps,
|
|
88
|
+
type AreaChartDatum,
|
|
89
|
+
type AreaChartStatus,
|
|
90
|
+
} from './components/area-chart';
|
|
76
91
|
export { Badge, type BadgeProps } from './components/badge';
|
|
92
|
+
export {
|
|
93
|
+
BarChart,
|
|
94
|
+
useBarChart,
|
|
95
|
+
type BarChartProps,
|
|
96
|
+
type BarChartHandle,
|
|
97
|
+
type BarChartHeaderProps,
|
|
98
|
+
type BarChartGridProps,
|
|
99
|
+
type BarChartBarProps,
|
|
100
|
+
type BarChartXAxisProps,
|
|
101
|
+
type BarChartYAxisProps,
|
|
102
|
+
type BarChartTooltipProps,
|
|
103
|
+
type BarChartLegendProps,
|
|
104
|
+
type BarChartDatum,
|
|
105
|
+
type BarChartStatus,
|
|
106
|
+
type BarChartOrientation,
|
|
107
|
+
} from './components/bar-chart';
|
|
77
108
|
export {
|
|
78
109
|
BottomSheet,
|
|
79
110
|
type BottomSheetProps,
|
|
80
111
|
type BottomSheetContentProps,
|
|
112
|
+
type BottomSheetHeaderProps,
|
|
113
|
+
type BottomSheetBodyProps,
|
|
114
|
+
type BottomSheetFooterProps,
|
|
81
115
|
} from './components/bottom-sheet';
|
|
116
|
+
export {
|
|
117
|
+
Breadcrumb,
|
|
118
|
+
type BreadcrumbProps,
|
|
119
|
+
type BreadcrumbListProps,
|
|
120
|
+
type BreadcrumbItemProps,
|
|
121
|
+
type BreadcrumbLinkProps,
|
|
122
|
+
type BreadcrumbPageProps,
|
|
123
|
+
type BreadcrumbSeparatorProps,
|
|
124
|
+
type BreadcrumbEllipsisProps,
|
|
125
|
+
} from './components/breadcrumb';
|
|
82
126
|
export { Button, type ButtonProps } from './components/button';
|
|
83
127
|
export {
|
|
84
128
|
ToggleButton,
|
|
@@ -91,6 +135,11 @@ export {
|
|
|
91
135
|
type ToggleButtonVariant,
|
|
92
136
|
type ToggleSelectionMode,
|
|
93
137
|
} from './components/toggle-button';
|
|
138
|
+
export {
|
|
139
|
+
DatePicker,
|
|
140
|
+
type DatePickerProps,
|
|
141
|
+
type DatePickerMode,
|
|
142
|
+
} from './components/date-picker';
|
|
94
143
|
export {
|
|
95
144
|
Dialog,
|
|
96
145
|
type DialogProps,
|
|
@@ -105,6 +154,7 @@ export {
|
|
|
105
154
|
export {
|
|
106
155
|
Direction,
|
|
107
156
|
useDirection,
|
|
157
|
+
useDirectionSign,
|
|
108
158
|
type DirectionProps,
|
|
109
159
|
type DirectionValue,
|
|
110
160
|
} from './components/direction';
|
|
@@ -156,6 +206,30 @@ export {
|
|
|
156
206
|
type HeatmapCell,
|
|
157
207
|
type HeatmapLayout,
|
|
158
208
|
} from './components/heatmap-chart';
|
|
209
|
+
export {
|
|
210
|
+
Map,
|
|
211
|
+
useMap,
|
|
212
|
+
hasMapLibre,
|
|
213
|
+
CARTO_SOURCE,
|
|
214
|
+
type MapProps,
|
|
215
|
+
type MapHandle,
|
|
216
|
+
type MapMarkerProps,
|
|
217
|
+
type MapLabelProps,
|
|
218
|
+
type MapPopupProps,
|
|
219
|
+
type MapControlsProps,
|
|
220
|
+
type MapControlsPosition,
|
|
221
|
+
type MapRouteProps,
|
|
222
|
+
type MapArcProps,
|
|
223
|
+
type MapGeoJSONProps,
|
|
224
|
+
type MapClusterProps,
|
|
225
|
+
type MapHeatmapProps,
|
|
226
|
+
type MapUserLocationProps,
|
|
227
|
+
type BasemapSource,
|
|
228
|
+
type BasemapTokens,
|
|
229
|
+
type LngLat,
|
|
230
|
+
type LngLatBounds,
|
|
231
|
+
type ViewState,
|
|
232
|
+
} from './components/map';
|
|
159
233
|
export {
|
|
160
234
|
Select,
|
|
161
235
|
type SelectProps,
|
|
@@ -179,6 +253,30 @@ export {
|
|
|
179
253
|
type TabsTriggerProps,
|
|
180
254
|
type TabsContentProps,
|
|
181
255
|
} from './components/tabs';
|
|
256
|
+
export {
|
|
257
|
+
Carousel,
|
|
258
|
+
useCarouselState,
|
|
259
|
+
type CarouselProps,
|
|
260
|
+
type CarouselHandle,
|
|
261
|
+
type CarouselContentProps,
|
|
262
|
+
type CarouselItemProps,
|
|
263
|
+
type CarouselCaptionProps,
|
|
264
|
+
type CarouselDotsProps,
|
|
265
|
+
type CarouselArrowProps,
|
|
266
|
+
type CarouselControlsProps,
|
|
267
|
+
type CarouselVariant,
|
|
268
|
+
type CarouselOrientation,
|
|
269
|
+
type CarouselAlign,
|
|
270
|
+
} from './components/carousel';
|
|
271
|
+
export {
|
|
272
|
+
Calendar,
|
|
273
|
+
type CalendarProps,
|
|
274
|
+
type CalendarMode,
|
|
275
|
+
type CalendarCaptionLayout,
|
|
276
|
+
type CalendarDisabled,
|
|
277
|
+
type CalendarSelection,
|
|
278
|
+
type DateRange,
|
|
279
|
+
} from './components/calendar';
|
|
182
280
|
export { Card, type CardProps } from './components/card';
|
|
183
281
|
export { Checkbox, type CheckboxProps } from './components/checkbox';
|
|
184
282
|
export {
|
|
@@ -253,6 +351,7 @@ export {
|
|
|
253
351
|
useLineChart,
|
|
254
352
|
type LineChartProps,
|
|
255
353
|
type LineChartHandle,
|
|
354
|
+
type LineChartHeaderProps,
|
|
256
355
|
type LineChartGridProps,
|
|
257
356
|
type LineChartLineProps,
|
|
258
357
|
type LineChartAreaProps,
|
|
@@ -264,6 +363,12 @@ export {
|
|
|
264
363
|
type LineChartStatus,
|
|
265
364
|
type LineChartCurve,
|
|
266
365
|
} from './components/line-chart';
|
|
366
|
+
export {
|
|
367
|
+
Loader,
|
|
368
|
+
type LoaderProps,
|
|
369
|
+
type LoaderVariant,
|
|
370
|
+
type LoaderSize,
|
|
371
|
+
} from './components/loader';
|
|
267
372
|
export {
|
|
268
373
|
Marker,
|
|
269
374
|
type MarkerProps,
|
|
@@ -316,6 +421,16 @@ export {
|
|
|
316
421
|
type RatingColor,
|
|
317
422
|
type RatingSize,
|
|
318
423
|
} from './components/rating';
|
|
424
|
+
export {
|
|
425
|
+
RingChart,
|
|
426
|
+
useRingChart,
|
|
427
|
+
type RingChartProps,
|
|
428
|
+
type RingChartHandle,
|
|
429
|
+
type RingChartRingProps,
|
|
430
|
+
type RingChartCenterProps,
|
|
431
|
+
type RingChartLegendProps,
|
|
432
|
+
type RingDatum,
|
|
433
|
+
} from './components/ring-chart';
|
|
319
434
|
export {
|
|
320
435
|
ScrollFade,
|
|
321
436
|
type ScrollFadeProps,
|
|
@@ -387,6 +502,16 @@ export {
|
|
|
387
502
|
type ToastIndicatorProps,
|
|
388
503
|
type ToastCloseProps,
|
|
389
504
|
} from './components/toast';
|
|
505
|
+
export {
|
|
506
|
+
Tooltip,
|
|
507
|
+
type TooltipProps,
|
|
508
|
+
type TooltipTriggerProps,
|
|
509
|
+
type TooltipContentProps,
|
|
510
|
+
type TooltipArrowProps,
|
|
511
|
+
type TooltipPlacement,
|
|
512
|
+
type TooltipAlign,
|
|
513
|
+
type TooltipOpenOn,
|
|
514
|
+
} from './components/tooltip';
|
|
390
515
|
export {
|
|
391
516
|
Typography,
|
|
392
517
|
type TypographyProps,
|
|
@@ -402,13 +527,17 @@ export {
|
|
|
402
527
|
AppleIcon,
|
|
403
528
|
ArrowUpRightIcon,
|
|
404
529
|
BellIcon,
|
|
530
|
+
BookmarkIcon,
|
|
531
|
+
CalendarIcon,
|
|
405
532
|
CardIcon,
|
|
406
533
|
CheckCircleIcon,
|
|
407
534
|
CheckIcon,
|
|
408
535
|
ChevronDownIcon,
|
|
409
536
|
ChevronLeftIcon,
|
|
410
537
|
ChevronRightIcon,
|
|
538
|
+
ChevronUpIcon,
|
|
411
539
|
DownloadIcon,
|
|
540
|
+
EllipsisIcon,
|
|
412
541
|
FacebookIcon,
|
|
413
542
|
FileIcon,
|
|
414
543
|
GoogleIcon,
|
|
@@ -27,6 +27,7 @@ import {
|
|
|
27
27
|
useKeyboardAvoidance,
|
|
28
28
|
type KeyboardAvoidanceMode,
|
|
29
29
|
} from '../hooks/use-keyboard-avoidance';
|
|
30
|
+
import { textChildren } from './text';
|
|
30
31
|
|
|
31
32
|
export interface KeyboardAvoiderProps extends ViewProps {
|
|
32
33
|
className?: string;
|
|
@@ -86,7 +87,7 @@ export function KeyboardAvoider({
|
|
|
86
87
|
className={className}
|
|
87
88
|
style={[style, avoidance.animatedStyle]}
|
|
88
89
|
>
|
|
89
|
-
{children}
|
|
90
|
+
{textChildren(children)}
|
|
90
91
|
</Animated.View>
|
|
91
92
|
);
|
|
92
93
|
}
|
package/src/primitives/text.tsx
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { forwardRef } from 'react';
|
|
1
|
+
import { Children, forwardRef, type ReactElement, type ReactNode } from 'react';
|
|
2
2
|
import { Text as RNText, type Text as RNTextType, type TextProps as RNTextProps } from 'react-native';
|
|
3
3
|
import { tv, type VariantProps } from 'tailwind-variants';
|
|
4
|
+
import { useDirection } from '../hooks/use-direction';
|
|
4
5
|
|
|
5
6
|
const textVariants = tv({
|
|
6
7
|
base: 'text-foreground',
|
|
@@ -35,13 +36,57 @@ export interface TextProps extends RNTextProps, VariantProps<typeof textVariants
|
|
|
35
36
|
}
|
|
36
37
|
|
|
37
38
|
export const Text = forwardRef<RNTextType, TextProps>(
|
|
38
|
-
({ className, size, weight, muted, ...props }, ref) =>
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
39
|
+
({ className, size, weight, muted, style, ...props }, ref) => {
|
|
40
|
+
/*
|
|
41
|
+
* `direction` is a Yoga *layout* property, and React Native resolves a
|
|
42
|
+
* paragraph's own alignment from the process-wide `I18nManager.isRTL`
|
|
43
|
+
* instead — so a `<Direction dir="rtl">` mirrors the furniture around this
|
|
44
|
+
* text and leaves the text itself left-aligned inside it. Setting
|
|
45
|
+
* `writingDirection` is what closes that gap, and it also puts bidi
|
|
46
|
+
* punctuation on the correct end of a mixed line.
|
|
47
|
+
*
|
|
48
|
+
* Only the direction, not the alignment: `textAlign` stays whatever the
|
|
49
|
+
* caller asked for, or unset. A component that centres its label means it
|
|
50
|
+
* in both directions.
|
|
51
|
+
*/
|
|
52
|
+
const direction = useDirection();
|
|
53
|
+
|
|
54
|
+
return (
|
|
55
|
+
<RNText
|
|
56
|
+
ref={ref}
|
|
57
|
+
className={textVariants({ size, weight, muted, className })}
|
|
58
|
+
style={[{ writingDirection: direction }, style]}
|
|
59
|
+
{...props}
|
|
60
|
+
/>
|
|
61
|
+
);
|
|
62
|
+
}
|
|
45
63
|
);
|
|
46
64
|
|
|
47
65
|
Text.displayName = 'Text';
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Wraps the bare text among `children` so it can live in a plain view.
|
|
69
|
+
*
|
|
70
|
+
* React Native will not render a string outside a `<Text>`, and a component
|
|
71
|
+
* that takes `children` has no say in whether it is handed one — so anything
|
|
72
|
+
* putting `children` into a `View`, a `Pressable` or a scroller has to allow
|
|
73
|
+
* for it. Every part in the library that does runs its children through here.
|
|
74
|
+
*
|
|
75
|
+
* Per child, and not all-or-nothing. A part is nearly always given an element
|
|
76
|
+
* and some text together — an icon and a label, an arrow and a line of text —
|
|
77
|
+
* which makes `children` an *array*, so a `typeof children === 'string'` check
|
|
78
|
+
* never matches and the text underneath reaches the view bare. That is the
|
|
79
|
+
* shape this exists to make impossible.
|
|
80
|
+
*
|
|
81
|
+
* `render` is there because the wrapper is rarely the plain default: a button
|
|
82
|
+
* wants its own label variant, a sheet header wants a heading. Pass one, and
|
|
83
|
+
* the text arrives dressed the way the part would have dressed it anyway.
|
|
84
|
+
*/
|
|
85
|
+
export function textChildren(
|
|
86
|
+
children: ReactNode,
|
|
87
|
+
render: (text: string | number) => ReactElement = (text) => <Text>{text}</Text>
|
|
88
|
+
): ReactNode {
|
|
89
|
+
return Children.map(children, (child) =>
|
|
90
|
+
typeof child === 'string' || typeof child === 'number' ? render(child) : child
|
|
91
|
+
);
|
|
92
|
+
}
|