@retray-dev/ui-kit 2.6.0 → 2.7.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/COMPONENTS.md +94 -1
- package/README.md +18 -0
- package/dist/index.d.mts +76 -1
- package/dist/index.d.ts +76 -1
- package/dist/index.js +79 -13
- package/dist/index.mjs +75 -14
- package/package.json +1 -1
- package/src/index.ts +17 -0
- package/src/tokens.ts +69 -0
- package/src/utils/haptics.ts +18 -12
package/COMPONENTS.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# @retray-dev/ui-kit — Component Reference (v2.
|
|
1
|
+
# @retray-dev/ui-kit — Component Reference (v2.7.0)
|
|
2
2
|
|
|
3
3
|
This file is the AI reference for this package. It is shipped inside the npm package so consuming projects can import it into their `CLAUDE.md` with:
|
|
4
4
|
|
|
@@ -105,6 +105,99 @@ import type { ThemeColors } from '@retray-dev/ui-kit'
|
|
|
105
105
|
|
|
106
106
|
---
|
|
107
107
|
|
|
108
|
+
## Design Tokens
|
|
109
|
+
|
|
110
|
+
Static structural constants exported from the package root — no context or provider needed. Use these instead of hardcoding values.
|
|
111
|
+
|
|
112
|
+
```ts
|
|
113
|
+
import { SPACING, ICON_SIZES, RADIUS, SHADOWS, BREAKPOINTS } from '@retray-dev/ui-kit'
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### SPACING
|
|
117
|
+
|
|
118
|
+
8pt-grid spacing scale.
|
|
119
|
+
|
|
120
|
+
| Key | Value |
|
|
121
|
+
|-----|-------|
|
|
122
|
+
| `xs` | 4 |
|
|
123
|
+
| `sm` | 8 |
|
|
124
|
+
| `md` | 12 |
|
|
125
|
+
| `lg` | 16 |
|
|
126
|
+
| `xl` | 24 |
|
|
127
|
+
| `2xl` | 32 |
|
|
128
|
+
| `3xl` | 48 |
|
|
129
|
+
|
|
130
|
+
**Types:** `Spacing`, `SpacingKey`
|
|
131
|
+
|
|
132
|
+
```tsx
|
|
133
|
+
<View style={{ gap: SPACING.md, padding: SPACING.lg }} />
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### ICON_SIZES
|
|
137
|
+
|
|
138
|
+
Semantic icon size scale aligned to HIG roles.
|
|
139
|
+
|
|
140
|
+
| Key | Value |
|
|
141
|
+
|-----|-------|
|
|
142
|
+
| `sm` | 14 |
|
|
143
|
+
| `md` | 18 |
|
|
144
|
+
| `lg` | 22 |
|
|
145
|
+
| `xl` | 28 |
|
|
146
|
+
| `2xl` | 32 |
|
|
147
|
+
|
|
148
|
+
**Types:** `IconSize`, `IconSizeKey`
|
|
149
|
+
|
|
150
|
+
```tsx
|
|
151
|
+
<Icon name="home" size={ICON_SIZES.md} color={colors.foreground} />
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### RADIUS
|
|
155
|
+
|
|
156
|
+
Border radius scale used throughout the library.
|
|
157
|
+
|
|
158
|
+
| Key | Value | Used in |
|
|
159
|
+
|-----|-------|---------|
|
|
160
|
+
| `sm` | 4 | — |
|
|
161
|
+
| `md` | 8 | Inputs, Buttons, Checkboxes, Toggles, Tabs |
|
|
162
|
+
| `lg` | 12 | Cards, AlertBanner, Toast, EmptyState, Select list |
|
|
163
|
+
| `xl` | 16 | Sheet top corners |
|
|
164
|
+
| `full` | 9999 | Pills, circular elements |
|
|
165
|
+
|
|
166
|
+
**Types:** `Radius`, `RadiusKey`
|
|
167
|
+
|
|
168
|
+
```tsx
|
|
169
|
+
<View style={{ borderRadius: RADIUS.lg }} />
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### SHADOWS
|
|
173
|
+
|
|
174
|
+
Cross-platform shadow presets (RN `shadow*` properties + `elevation`).
|
|
175
|
+
|
|
176
|
+
| Key | Height | Opacity | Radius | Elevation |
|
|
177
|
+
|-----|--------|---------|--------|-----------|
|
|
178
|
+
| `sm` | 1 | 0.08 | 4 | 2 |
|
|
179
|
+
| `md` | 3 | 0.12 | 8 | 5 |
|
|
180
|
+
| `lg` | 6 | 0.20 | 16 | 10 |
|
|
181
|
+
| `xl` | 12 | 0.28 | 24 | 18 |
|
|
182
|
+
|
|
183
|
+
```tsx
|
|
184
|
+
<View style={[styles.card, SHADOWS.md]} />
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
### BREAKPOINTS
|
|
188
|
+
|
|
189
|
+
Layout breakpoints.
|
|
190
|
+
|
|
191
|
+
| Key | Value |
|
|
192
|
+
|-----|-------|
|
|
193
|
+
| `wide` | 700 |
|
|
194
|
+
|
|
195
|
+
```tsx
|
|
196
|
+
const isWide = width >= BREAKPOINTS.wide
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
---
|
|
200
|
+
|
|
108
201
|
## Components
|
|
109
202
|
|
|
110
203
|
---
|
package/README.md
CHANGED
|
@@ -95,6 +95,24 @@ const { colors, colorScheme } = useTheme()
|
|
|
95
95
|
|
|
96
96
|
**Available tokens:** `background`, `foreground`, `card`, `cardForeground`, `primary`, `primaryForeground`, `secondary`, `secondaryForeground`, `muted`, `mutedForeground`, `accent`, `accentForeground`, `destructive`, `destructiveForeground`, `border`, `input`, `ring`, `success`, `successForeground`
|
|
97
97
|
|
|
98
|
+
## Design Tokens
|
|
99
|
+
|
|
100
|
+
Static structural constants — no provider required:
|
|
101
|
+
|
|
102
|
+
```ts
|
|
103
|
+
import { SPACING, ICON_SIZES, RADIUS, SHADOWS, BREAKPOINTS } from '@retray-dev/ui-kit'
|
|
104
|
+
|
|
105
|
+
<View style={{ gap: SPACING.md, padding: SPACING.lg, borderRadius: RADIUS.lg, ...SHADOWS.sm }} />
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
| Token | Keys |
|
|
109
|
+
|-------|------|
|
|
110
|
+
| `SPACING` | `xs` (4), `sm` (8), `md` (12), `lg` (16), `xl` (24), `2xl` (32), `3xl` (48) |
|
|
111
|
+
| `ICON_SIZES` | `sm` (14), `md` (18), `lg` (22), `xl` (28), `2xl` (32) |
|
|
112
|
+
| `RADIUS` | `sm` (4), `md` (8), `lg` (12), `xl` (16), `full` (9999) |
|
|
113
|
+
| `SHADOWS` | `sm`, `md`, `lg`, `xl` — cross-platform shadow presets |
|
|
114
|
+
| `BREAKPOINTS` | `wide` (700) |
|
|
115
|
+
|
|
98
116
|
## Components
|
|
99
117
|
|
|
100
118
|
| Category | Components |
|
package/dist/index.d.mts
CHANGED
|
@@ -615,4 +615,79 @@ interface IconProps {
|
|
|
615
615
|
declare function Icon({ name, size, color, family }: IconProps): React.ReactElement | null;
|
|
616
616
|
declare function renderIcon(name: string, size: number, color: string): React.ReactElement | null;
|
|
617
617
|
|
|
618
|
-
|
|
618
|
+
declare const SPACING: {
|
|
619
|
+
readonly xs: 4;
|
|
620
|
+
readonly sm: 8;
|
|
621
|
+
readonly md: 12;
|
|
622
|
+
readonly lg: 16;
|
|
623
|
+
readonly xl: 24;
|
|
624
|
+
readonly '2xl': 32;
|
|
625
|
+
readonly '3xl': 48;
|
|
626
|
+
};
|
|
627
|
+
declare const ICON_SIZES: {
|
|
628
|
+
readonly sm: 14;
|
|
629
|
+
readonly md: 18;
|
|
630
|
+
readonly lg: 22;
|
|
631
|
+
readonly xl: 28;
|
|
632
|
+
readonly '2xl': 32;
|
|
633
|
+
};
|
|
634
|
+
declare const RADIUS: {
|
|
635
|
+
readonly sm: 4;
|
|
636
|
+
readonly md: 8;
|
|
637
|
+
readonly lg: 12;
|
|
638
|
+
readonly xl: 16;
|
|
639
|
+
readonly full: 9999;
|
|
640
|
+
};
|
|
641
|
+
declare const SHADOWS: {
|
|
642
|
+
readonly sm: {
|
|
643
|
+
readonly shadowColor: "#000";
|
|
644
|
+
readonly shadowOffset: {
|
|
645
|
+
readonly width: 0;
|
|
646
|
+
readonly height: 1;
|
|
647
|
+
};
|
|
648
|
+
readonly shadowOpacity: 0.08;
|
|
649
|
+
readonly shadowRadius: 4;
|
|
650
|
+
readonly elevation: 2;
|
|
651
|
+
};
|
|
652
|
+
readonly md: {
|
|
653
|
+
readonly shadowColor: "#000";
|
|
654
|
+
readonly shadowOffset: {
|
|
655
|
+
readonly width: 0;
|
|
656
|
+
readonly height: 3;
|
|
657
|
+
};
|
|
658
|
+
readonly shadowOpacity: 0.12;
|
|
659
|
+
readonly shadowRadius: 8;
|
|
660
|
+
readonly elevation: 5;
|
|
661
|
+
};
|
|
662
|
+
readonly lg: {
|
|
663
|
+
readonly shadowColor: "#000";
|
|
664
|
+
readonly shadowOffset: {
|
|
665
|
+
readonly width: 0;
|
|
666
|
+
readonly height: 6;
|
|
667
|
+
};
|
|
668
|
+
readonly shadowOpacity: 0.2;
|
|
669
|
+
readonly shadowRadius: 16;
|
|
670
|
+
readonly elevation: 10;
|
|
671
|
+
};
|
|
672
|
+
readonly xl: {
|
|
673
|
+
readonly shadowColor: "#000";
|
|
674
|
+
readonly shadowOffset: {
|
|
675
|
+
readonly width: 0;
|
|
676
|
+
readonly height: 12;
|
|
677
|
+
};
|
|
678
|
+
readonly shadowOpacity: 0.28;
|
|
679
|
+
readonly shadowRadius: 24;
|
|
680
|
+
readonly elevation: 18;
|
|
681
|
+
};
|
|
682
|
+
};
|
|
683
|
+
declare const BREAKPOINTS: {
|
|
684
|
+
readonly wide: 700;
|
|
685
|
+
};
|
|
686
|
+
type Spacing = typeof SPACING;
|
|
687
|
+
type SpacingKey = keyof Spacing;
|
|
688
|
+
type IconSize = typeof ICON_SIZES;
|
|
689
|
+
type IconSizeKey = keyof IconSize;
|
|
690
|
+
type Radius = typeof RADIUS;
|
|
691
|
+
type RadiusKey = keyof Radius;
|
|
692
|
+
|
|
693
|
+
export { Accordion, type AccordionItem, type AccordionProps, AlertBanner, type AlertBannerProps, type AlertBannerVariant, Avatar, type AvatarProps, type AvatarSize, BREAKPOINTS, Badge, type BadgeProps, type BadgeVariant, Button, type ButtonProps, type ButtonSize, type ButtonVariant, Card, CardContent, type CardContentProps, CardDescription, type CardDescriptionProps, CardFooter, type CardFooterProps, CardHeader, type CardHeaderProps, type CardProps, CardTitle, type CardTitleProps, Checkbox, type CheckboxProps, Chip, ChipGroup, type ChipGroupProps, type ChipOption, type ChipProps, type ColorScheme, ConfirmDialog, type ConfirmDialogProps, CurrencyDisplay, type CurrencyDisplayProps, CurrencyInput, CurrencyInput as CurrencyInputLarge, type CurrencyInputProps, EmptyState, type EmptyStateProps, ICON_SIZES, Icon, type IconFamily, type IconProps, type IconSize, type IconSizeKey, Input, type InputProps, LabelValue, type LabelValueProps, ListItem, type ListItemProps, MonthPicker, type MonthPickerProps, type MonthPickerValue, Progress, type ProgressProps, RADIUS, RadioGroup, type RadioGroupProps, type RadioOption, type Radius, type RadiusKey, SHADOWS, SPACING, Select, type SelectOption, type SelectProps, Separator, type SeparatorProps, Sheet, type SheetProps, Skeleton, type SkeletonProps, Slider, type SliderProps, type Spacing, type SpacingKey, Spinner, type SpinnerProps, type SpinnerSize, Switch, type SwitchProps, type TabItem, Tabs, TabsContent, type TabsContentProps, type TabsProps, Text, type TextProps, type TextVariant, Textarea, type TextareaProps, type Theme, type ThemeColors, ThemeProvider, type ThemeProviderProps, type ToastItem, ToastProvider, type ToastProviderProps, type ToastVariant, Toggle, type ToggleProps, type ToggleSize, type ToggleVariant, defaultDark, defaultLight, renderIcon, useTheme, useToast };
|
package/dist/index.d.ts
CHANGED
|
@@ -615,4 +615,79 @@ interface IconProps {
|
|
|
615
615
|
declare function Icon({ name, size, color, family }: IconProps): React.ReactElement | null;
|
|
616
616
|
declare function renderIcon(name: string, size: number, color: string): React.ReactElement | null;
|
|
617
617
|
|
|
618
|
-
|
|
618
|
+
declare const SPACING: {
|
|
619
|
+
readonly xs: 4;
|
|
620
|
+
readonly sm: 8;
|
|
621
|
+
readonly md: 12;
|
|
622
|
+
readonly lg: 16;
|
|
623
|
+
readonly xl: 24;
|
|
624
|
+
readonly '2xl': 32;
|
|
625
|
+
readonly '3xl': 48;
|
|
626
|
+
};
|
|
627
|
+
declare const ICON_SIZES: {
|
|
628
|
+
readonly sm: 14;
|
|
629
|
+
readonly md: 18;
|
|
630
|
+
readonly lg: 22;
|
|
631
|
+
readonly xl: 28;
|
|
632
|
+
readonly '2xl': 32;
|
|
633
|
+
};
|
|
634
|
+
declare const RADIUS: {
|
|
635
|
+
readonly sm: 4;
|
|
636
|
+
readonly md: 8;
|
|
637
|
+
readonly lg: 12;
|
|
638
|
+
readonly xl: 16;
|
|
639
|
+
readonly full: 9999;
|
|
640
|
+
};
|
|
641
|
+
declare const SHADOWS: {
|
|
642
|
+
readonly sm: {
|
|
643
|
+
readonly shadowColor: "#000";
|
|
644
|
+
readonly shadowOffset: {
|
|
645
|
+
readonly width: 0;
|
|
646
|
+
readonly height: 1;
|
|
647
|
+
};
|
|
648
|
+
readonly shadowOpacity: 0.08;
|
|
649
|
+
readonly shadowRadius: 4;
|
|
650
|
+
readonly elevation: 2;
|
|
651
|
+
};
|
|
652
|
+
readonly md: {
|
|
653
|
+
readonly shadowColor: "#000";
|
|
654
|
+
readonly shadowOffset: {
|
|
655
|
+
readonly width: 0;
|
|
656
|
+
readonly height: 3;
|
|
657
|
+
};
|
|
658
|
+
readonly shadowOpacity: 0.12;
|
|
659
|
+
readonly shadowRadius: 8;
|
|
660
|
+
readonly elevation: 5;
|
|
661
|
+
};
|
|
662
|
+
readonly lg: {
|
|
663
|
+
readonly shadowColor: "#000";
|
|
664
|
+
readonly shadowOffset: {
|
|
665
|
+
readonly width: 0;
|
|
666
|
+
readonly height: 6;
|
|
667
|
+
};
|
|
668
|
+
readonly shadowOpacity: 0.2;
|
|
669
|
+
readonly shadowRadius: 16;
|
|
670
|
+
readonly elevation: 10;
|
|
671
|
+
};
|
|
672
|
+
readonly xl: {
|
|
673
|
+
readonly shadowColor: "#000";
|
|
674
|
+
readonly shadowOffset: {
|
|
675
|
+
readonly width: 0;
|
|
676
|
+
readonly height: 12;
|
|
677
|
+
};
|
|
678
|
+
readonly shadowOpacity: 0.28;
|
|
679
|
+
readonly shadowRadius: 24;
|
|
680
|
+
readonly elevation: 18;
|
|
681
|
+
};
|
|
682
|
+
};
|
|
683
|
+
declare const BREAKPOINTS: {
|
|
684
|
+
readonly wide: 700;
|
|
685
|
+
};
|
|
686
|
+
type Spacing = typeof SPACING;
|
|
687
|
+
type SpacingKey = keyof Spacing;
|
|
688
|
+
type IconSize = typeof ICON_SIZES;
|
|
689
|
+
type IconSizeKey = keyof IconSize;
|
|
690
|
+
type Radius = typeof RADIUS;
|
|
691
|
+
type RadiusKey = keyof Radius;
|
|
692
|
+
|
|
693
|
+
export { Accordion, type AccordionItem, type AccordionProps, AlertBanner, type AlertBannerProps, type AlertBannerVariant, Avatar, type AvatarProps, type AvatarSize, BREAKPOINTS, Badge, type BadgeProps, type BadgeVariant, Button, type ButtonProps, type ButtonSize, type ButtonVariant, Card, CardContent, type CardContentProps, CardDescription, type CardDescriptionProps, CardFooter, type CardFooterProps, CardHeader, type CardHeaderProps, type CardProps, CardTitle, type CardTitleProps, Checkbox, type CheckboxProps, Chip, ChipGroup, type ChipGroupProps, type ChipOption, type ChipProps, type ColorScheme, ConfirmDialog, type ConfirmDialogProps, CurrencyDisplay, type CurrencyDisplayProps, CurrencyInput, CurrencyInput as CurrencyInputLarge, type CurrencyInputProps, EmptyState, type EmptyStateProps, ICON_SIZES, Icon, type IconFamily, type IconProps, type IconSize, type IconSizeKey, Input, type InputProps, LabelValue, type LabelValueProps, ListItem, type ListItemProps, MonthPicker, type MonthPickerProps, type MonthPickerValue, Progress, type ProgressProps, RADIUS, RadioGroup, type RadioGroupProps, type RadioOption, type Radius, type RadiusKey, SHADOWS, SPACING, Select, type SelectOption, type SelectProps, Separator, type SeparatorProps, Sheet, type SheetProps, Skeleton, type SkeletonProps, Slider, type SliderProps, type Spacing, type SpacingKey, Spinner, type SpinnerProps, type SpinnerSize, Switch, type SwitchProps, type TabItem, Tabs, TabsContent, type TabsContentProps, type TabsProps, Text, type TextProps, type TextVariant, Textarea, type TextareaProps, type Theme, type ThemeColors, ThemeProvider, type ThemeProviderProps, type ToastItem, ToastProvider, type ToastProviderProps, type ToastVariant, Toggle, type ToggleProps, type ToggleSize, type ToggleVariant, defaultDark, defaultLight, renderIcon, useTheme, useToast };
|
package/dist/index.js
CHANGED
|
@@ -31,12 +31,7 @@ var Ionicons__default = /*#__PURE__*/_interopDefault(Ionicons);
|
|
|
31
31
|
var Animated10__default = /*#__PURE__*/_interopDefault(Animated10);
|
|
32
32
|
var RNSlider__default = /*#__PURE__*/_interopDefault(RNSlider);
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
36
|
-
}) : x)(function(x) {
|
|
37
|
-
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
38
|
-
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
39
|
-
});
|
|
34
|
+
// src/theme/ThemeProvider.tsx
|
|
40
35
|
|
|
41
36
|
// src/theme/colors.ts
|
|
42
37
|
var defaultLight = {
|
|
@@ -104,21 +99,29 @@ function useTheme() {
|
|
|
104
99
|
}
|
|
105
100
|
return context;
|
|
106
101
|
}
|
|
107
|
-
var
|
|
108
|
-
|
|
109
|
-
|
|
102
|
+
var _haptics = null;
|
|
103
|
+
async function getHaptics() {
|
|
104
|
+
if (reactNative.Platform.OS === "web") return null;
|
|
105
|
+
if (!_haptics) {
|
|
106
|
+
_haptics = await import('expo-haptics');
|
|
107
|
+
}
|
|
108
|
+
return _haptics;
|
|
110
109
|
}
|
|
111
110
|
function selectionAsync() {
|
|
112
|
-
|
|
111
|
+
if (reactNative.Platform.OS === "web") return;
|
|
112
|
+
getHaptics().then((h) => h?.selectionAsync());
|
|
113
113
|
}
|
|
114
114
|
function impactLight() {
|
|
115
|
-
|
|
115
|
+
if (reactNative.Platform.OS === "web") return;
|
|
116
|
+
getHaptics().then((h) => h?.impactAsync(h.ImpactFeedbackStyle.Light));
|
|
116
117
|
}
|
|
117
118
|
function notificationSuccess() {
|
|
118
|
-
|
|
119
|
+
if (reactNative.Platform.OS === "web") return;
|
|
120
|
+
getHaptics().then((h) => h?.notificationAsync(h.NotificationFeedbackType.Success));
|
|
119
121
|
}
|
|
120
122
|
function notificationError() {
|
|
121
|
-
|
|
123
|
+
if (reactNative.Platform.OS === "web") return;
|
|
124
|
+
getHaptics().then((h) => h?.notificationAsync(h.NotificationFeedbackType.Error));
|
|
122
125
|
}
|
|
123
126
|
var isWeb = reactNative.Platform.OS === "web";
|
|
124
127
|
var s = isWeb ? (n) => n : reactNativeSizeMatters.scale;
|
|
@@ -2526,6 +2529,64 @@ var styles27 = reactNative.StyleSheet.create({
|
|
|
2526
2529
|
}
|
|
2527
2530
|
});
|
|
2528
2531
|
|
|
2532
|
+
// src/tokens.ts
|
|
2533
|
+
var SPACING = {
|
|
2534
|
+
xs: 4,
|
|
2535
|
+
sm: 8,
|
|
2536
|
+
md: 12,
|
|
2537
|
+
lg: 16,
|
|
2538
|
+
xl: 24,
|
|
2539
|
+
"2xl": 32,
|
|
2540
|
+
"3xl": 48
|
|
2541
|
+
};
|
|
2542
|
+
var ICON_SIZES = {
|
|
2543
|
+
sm: 14,
|
|
2544
|
+
md: 18,
|
|
2545
|
+
lg: 22,
|
|
2546
|
+
xl: 28,
|
|
2547
|
+
"2xl": 32
|
|
2548
|
+
};
|
|
2549
|
+
var RADIUS = {
|
|
2550
|
+
sm: 4,
|
|
2551
|
+
md: 8,
|
|
2552
|
+
lg: 12,
|
|
2553
|
+
xl: 16,
|
|
2554
|
+
full: 9999
|
|
2555
|
+
};
|
|
2556
|
+
var SHADOWS = {
|
|
2557
|
+
sm: {
|
|
2558
|
+
shadowColor: "#000",
|
|
2559
|
+
shadowOffset: { width: 0, height: 1 },
|
|
2560
|
+
shadowOpacity: 0.08,
|
|
2561
|
+
shadowRadius: 4,
|
|
2562
|
+
elevation: 2
|
|
2563
|
+
},
|
|
2564
|
+
md: {
|
|
2565
|
+
shadowColor: "#000",
|
|
2566
|
+
shadowOffset: { width: 0, height: 3 },
|
|
2567
|
+
shadowOpacity: 0.12,
|
|
2568
|
+
shadowRadius: 8,
|
|
2569
|
+
elevation: 5
|
|
2570
|
+
},
|
|
2571
|
+
lg: {
|
|
2572
|
+
shadowColor: "#000",
|
|
2573
|
+
shadowOffset: { width: 0, height: 6 },
|
|
2574
|
+
shadowOpacity: 0.2,
|
|
2575
|
+
shadowRadius: 16,
|
|
2576
|
+
elevation: 10
|
|
2577
|
+
},
|
|
2578
|
+
xl: {
|
|
2579
|
+
shadowColor: "#000",
|
|
2580
|
+
shadowOffset: { width: 0, height: 12 },
|
|
2581
|
+
shadowOpacity: 0.28,
|
|
2582
|
+
shadowRadius: 24,
|
|
2583
|
+
elevation: 18
|
|
2584
|
+
}
|
|
2585
|
+
};
|
|
2586
|
+
var BREAKPOINTS = {
|
|
2587
|
+
wide: 700
|
|
2588
|
+
};
|
|
2589
|
+
|
|
2529
2590
|
Object.defineProperty(exports, "BottomSheetModalProvider", {
|
|
2530
2591
|
enumerable: true,
|
|
2531
2592
|
get: function () { return bottomSheet.BottomSheetModalProvider; }
|
|
@@ -2533,6 +2594,7 @@ Object.defineProperty(exports, "BottomSheetModalProvider", {
|
|
|
2533
2594
|
exports.Accordion = Accordion;
|
|
2534
2595
|
exports.AlertBanner = AlertBanner;
|
|
2535
2596
|
exports.Avatar = Avatar;
|
|
2597
|
+
exports.BREAKPOINTS = BREAKPOINTS;
|
|
2536
2598
|
exports.Badge = Badge;
|
|
2537
2599
|
exports.Button = Button;
|
|
2538
2600
|
exports.Card = Card;
|
|
@@ -2549,13 +2611,17 @@ exports.CurrencyDisplay = CurrencyDisplay;
|
|
|
2549
2611
|
exports.CurrencyInput = CurrencyInput;
|
|
2550
2612
|
exports.CurrencyInputLarge = CurrencyInput;
|
|
2551
2613
|
exports.EmptyState = EmptyState;
|
|
2614
|
+
exports.ICON_SIZES = ICON_SIZES;
|
|
2552
2615
|
exports.Icon = Icon;
|
|
2553
2616
|
exports.Input = Input;
|
|
2554
2617
|
exports.LabelValue = LabelValue;
|
|
2555
2618
|
exports.ListItem = ListItem;
|
|
2556
2619
|
exports.MonthPicker = MonthPicker;
|
|
2557
2620
|
exports.Progress = Progress;
|
|
2621
|
+
exports.RADIUS = RADIUS;
|
|
2558
2622
|
exports.RadioGroup = RadioGroup;
|
|
2623
|
+
exports.SHADOWS = SHADOWS;
|
|
2624
|
+
exports.SPACING = SPACING;
|
|
2559
2625
|
exports.Select = Select;
|
|
2560
2626
|
exports.Separator = Separator;
|
|
2561
2627
|
exports.Sheet = Sheet;
|
package/dist/index.mjs
CHANGED
|
@@ -18,12 +18,7 @@ import { scheduleOnRN } from 'react-native-worklets';
|
|
|
18
18
|
import { Gesture, GestureDetector } from 'react-native-gesture-handler';
|
|
19
19
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
23
|
-
}) : x)(function(x) {
|
|
24
|
-
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
25
|
-
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
26
|
-
});
|
|
21
|
+
// src/theme/ThemeProvider.tsx
|
|
27
22
|
|
|
28
23
|
// src/theme/colors.ts
|
|
29
24
|
var defaultLight = {
|
|
@@ -91,21 +86,29 @@ function useTheme() {
|
|
|
91
86
|
}
|
|
92
87
|
return context;
|
|
93
88
|
}
|
|
94
|
-
var
|
|
95
|
-
|
|
96
|
-
|
|
89
|
+
var _haptics = null;
|
|
90
|
+
async function getHaptics() {
|
|
91
|
+
if (Platform.OS === "web") return null;
|
|
92
|
+
if (!_haptics) {
|
|
93
|
+
_haptics = await import('expo-haptics');
|
|
94
|
+
}
|
|
95
|
+
return _haptics;
|
|
97
96
|
}
|
|
98
97
|
function selectionAsync() {
|
|
99
|
-
|
|
98
|
+
if (Platform.OS === "web") return;
|
|
99
|
+
getHaptics().then((h) => h?.selectionAsync());
|
|
100
100
|
}
|
|
101
101
|
function impactLight() {
|
|
102
|
-
|
|
102
|
+
if (Platform.OS === "web") return;
|
|
103
|
+
getHaptics().then((h) => h?.impactAsync(h.ImpactFeedbackStyle.Light));
|
|
103
104
|
}
|
|
104
105
|
function notificationSuccess() {
|
|
105
|
-
|
|
106
|
+
if (Platform.OS === "web") return;
|
|
107
|
+
getHaptics().then((h) => h?.notificationAsync(h.NotificationFeedbackType.Success));
|
|
106
108
|
}
|
|
107
109
|
function notificationError() {
|
|
108
|
-
|
|
110
|
+
if (Platform.OS === "web") return;
|
|
111
|
+
getHaptics().then((h) => h?.notificationAsync(h.NotificationFeedbackType.Error));
|
|
109
112
|
}
|
|
110
113
|
var isWeb = Platform.OS === "web";
|
|
111
114
|
var s = isWeb ? (n) => n : scale;
|
|
@@ -2513,4 +2516,62 @@ var styles27 = StyleSheet.create({
|
|
|
2513
2516
|
}
|
|
2514
2517
|
});
|
|
2515
2518
|
|
|
2516
|
-
|
|
2519
|
+
// src/tokens.ts
|
|
2520
|
+
var SPACING = {
|
|
2521
|
+
xs: 4,
|
|
2522
|
+
sm: 8,
|
|
2523
|
+
md: 12,
|
|
2524
|
+
lg: 16,
|
|
2525
|
+
xl: 24,
|
|
2526
|
+
"2xl": 32,
|
|
2527
|
+
"3xl": 48
|
|
2528
|
+
};
|
|
2529
|
+
var ICON_SIZES = {
|
|
2530
|
+
sm: 14,
|
|
2531
|
+
md: 18,
|
|
2532
|
+
lg: 22,
|
|
2533
|
+
xl: 28,
|
|
2534
|
+
"2xl": 32
|
|
2535
|
+
};
|
|
2536
|
+
var RADIUS = {
|
|
2537
|
+
sm: 4,
|
|
2538
|
+
md: 8,
|
|
2539
|
+
lg: 12,
|
|
2540
|
+
xl: 16,
|
|
2541
|
+
full: 9999
|
|
2542
|
+
};
|
|
2543
|
+
var SHADOWS = {
|
|
2544
|
+
sm: {
|
|
2545
|
+
shadowColor: "#000",
|
|
2546
|
+
shadowOffset: { width: 0, height: 1 },
|
|
2547
|
+
shadowOpacity: 0.08,
|
|
2548
|
+
shadowRadius: 4,
|
|
2549
|
+
elevation: 2
|
|
2550
|
+
},
|
|
2551
|
+
md: {
|
|
2552
|
+
shadowColor: "#000",
|
|
2553
|
+
shadowOffset: { width: 0, height: 3 },
|
|
2554
|
+
shadowOpacity: 0.12,
|
|
2555
|
+
shadowRadius: 8,
|
|
2556
|
+
elevation: 5
|
|
2557
|
+
},
|
|
2558
|
+
lg: {
|
|
2559
|
+
shadowColor: "#000",
|
|
2560
|
+
shadowOffset: { width: 0, height: 6 },
|
|
2561
|
+
shadowOpacity: 0.2,
|
|
2562
|
+
shadowRadius: 16,
|
|
2563
|
+
elevation: 10
|
|
2564
|
+
},
|
|
2565
|
+
xl: {
|
|
2566
|
+
shadowColor: "#000",
|
|
2567
|
+
shadowOffset: { width: 0, height: 12 },
|
|
2568
|
+
shadowOpacity: 0.28,
|
|
2569
|
+
shadowRadius: 24,
|
|
2570
|
+
elevation: 18
|
|
2571
|
+
}
|
|
2572
|
+
};
|
|
2573
|
+
var BREAKPOINTS = {
|
|
2574
|
+
wide: 700
|
|
2575
|
+
};
|
|
2576
|
+
|
|
2577
|
+
export { Accordion, AlertBanner, Avatar, BREAKPOINTS, Badge, Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, Chip, ChipGroup, ConfirmDialog, CurrencyDisplay, CurrencyInput, CurrencyInput as CurrencyInputLarge, EmptyState, ICON_SIZES, Icon, Input, LabelValue, ListItem, MonthPicker, Progress, RADIUS, RadioGroup, SHADOWS, SPACING, Select, Separator, Sheet, Skeleton, Slider, Spinner, Switch, Tabs, TabsContent, Text2 as Text, Textarea, ThemeProvider, ToastProvider, Toggle, defaultDark, defaultLight, renderIcon, useTheme, useToast };
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -40,3 +40,20 @@ export * from './components/MonthPicker'
|
|
|
40
40
|
// Icon utility
|
|
41
41
|
export { Icon, renderIcon } from './utils/icons'
|
|
42
42
|
export type { IconProps, IconFamily } from './utils/icons'
|
|
43
|
+
|
|
44
|
+
// Design tokens
|
|
45
|
+
export {
|
|
46
|
+
SPACING,
|
|
47
|
+
ICON_SIZES,
|
|
48
|
+
RADIUS,
|
|
49
|
+
SHADOWS,
|
|
50
|
+
BREAKPOINTS,
|
|
51
|
+
} from './tokens'
|
|
52
|
+
export type {
|
|
53
|
+
Spacing,
|
|
54
|
+
SpacingKey,
|
|
55
|
+
IconSize,
|
|
56
|
+
IconSizeKey,
|
|
57
|
+
Radius,
|
|
58
|
+
RadiusKey,
|
|
59
|
+
} from './tokens'
|
package/src/tokens.ts
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
export const SPACING = {
|
|
2
|
+
xs: 4,
|
|
3
|
+
sm: 8,
|
|
4
|
+
md: 12,
|
|
5
|
+
lg: 16,
|
|
6
|
+
xl: 24,
|
|
7
|
+
'2xl': 32,
|
|
8
|
+
'3xl': 48,
|
|
9
|
+
} as const
|
|
10
|
+
|
|
11
|
+
export const ICON_SIZES = {
|
|
12
|
+
sm: 14,
|
|
13
|
+
md: 18,
|
|
14
|
+
lg: 22,
|
|
15
|
+
xl: 28,
|
|
16
|
+
'2xl': 32,
|
|
17
|
+
} as const
|
|
18
|
+
|
|
19
|
+
export const RADIUS = {
|
|
20
|
+
sm: 4,
|
|
21
|
+
md: 8,
|
|
22
|
+
lg: 12,
|
|
23
|
+
xl: 16,
|
|
24
|
+
full: 9999,
|
|
25
|
+
} as const
|
|
26
|
+
|
|
27
|
+
export const SHADOWS = {
|
|
28
|
+
sm: {
|
|
29
|
+
shadowColor: '#000',
|
|
30
|
+
shadowOffset: { width: 0, height: 1 },
|
|
31
|
+
shadowOpacity: 0.08,
|
|
32
|
+
shadowRadius: 4,
|
|
33
|
+
elevation: 2,
|
|
34
|
+
},
|
|
35
|
+
md: {
|
|
36
|
+
shadowColor: '#000',
|
|
37
|
+
shadowOffset: { width: 0, height: 3 },
|
|
38
|
+
shadowOpacity: 0.12,
|
|
39
|
+
shadowRadius: 8,
|
|
40
|
+
elevation: 5,
|
|
41
|
+
},
|
|
42
|
+
lg: {
|
|
43
|
+
shadowColor: '#000',
|
|
44
|
+
shadowOffset: { width: 0, height: 6 },
|
|
45
|
+
shadowOpacity: 0.2,
|
|
46
|
+
shadowRadius: 16,
|
|
47
|
+
elevation: 10,
|
|
48
|
+
},
|
|
49
|
+
xl: {
|
|
50
|
+
shadowColor: '#000',
|
|
51
|
+
shadowOffset: { width: 0, height: 12 },
|
|
52
|
+
shadowOpacity: 0.28,
|
|
53
|
+
shadowRadius: 24,
|
|
54
|
+
elevation: 18,
|
|
55
|
+
},
|
|
56
|
+
} as const
|
|
57
|
+
|
|
58
|
+
export const BREAKPOINTS = {
|
|
59
|
+
wide: 700,
|
|
60
|
+
} as const
|
|
61
|
+
|
|
62
|
+
export type Spacing = typeof SPACING
|
|
63
|
+
export type SpacingKey = keyof Spacing
|
|
64
|
+
|
|
65
|
+
export type IconSize = typeof ICON_SIZES
|
|
66
|
+
export type IconSizeKey = keyof IconSize
|
|
67
|
+
|
|
68
|
+
export type Radius = typeof RADIUS
|
|
69
|
+
export type RadiusKey = keyof Radius
|
package/src/utils/haptics.ts
CHANGED
|
@@ -1,32 +1,38 @@
|
|
|
1
1
|
import { Platform } from 'react-native'
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
* Web-safe haptics helpers. All calls are no-ops on web since expo-haptics
|
|
5
|
-
* is a native-only module and throws on web.
|
|
6
|
-
*/
|
|
3
|
+
type HapticsModule = typeof import('expo-haptics')
|
|
7
4
|
|
|
8
|
-
let
|
|
5
|
+
let _haptics: HapticsModule | null = null
|
|
9
6
|
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
async function getHaptics(): Promise<HapticsModule | null> {
|
|
8
|
+
if (Platform.OS === 'web') return null
|
|
9
|
+
if (!_haptics) {
|
|
10
|
+
_haptics = await import('expo-haptics')
|
|
11
|
+
}
|
|
12
|
+
return _haptics
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
export function selectionAsync(): void {
|
|
15
|
-
|
|
16
|
+
if (Platform.OS === 'web') return
|
|
17
|
+
getHaptics().then(h => h?.selectionAsync())
|
|
16
18
|
}
|
|
17
19
|
|
|
18
20
|
export function impactLight(): void {
|
|
19
|
-
|
|
21
|
+
if (Platform.OS === 'web') return
|
|
22
|
+
getHaptics().then(h => h?.impactAsync(h.ImpactFeedbackStyle.Light))
|
|
20
23
|
}
|
|
21
24
|
|
|
22
25
|
export function impactMedium(): void {
|
|
23
|
-
|
|
26
|
+
if (Platform.OS === 'web') return
|
|
27
|
+
getHaptics().then(h => h?.impactAsync(h.ImpactFeedbackStyle.Medium))
|
|
24
28
|
}
|
|
25
29
|
|
|
26
30
|
export function notificationSuccess(): void {
|
|
27
|
-
|
|
31
|
+
if (Platform.OS === 'web') return
|
|
32
|
+
getHaptics().then(h => h?.notificationAsync(h.NotificationFeedbackType.Success))
|
|
28
33
|
}
|
|
29
34
|
|
|
30
35
|
export function notificationError(): void {
|
|
31
|
-
|
|
36
|
+
if (Platform.OS === 'web') return
|
|
37
|
+
getHaptics().then(h => h?.notificationAsync(h.NotificationFeedbackType.Error))
|
|
32
38
|
}
|