@frosted-ui/react-native 0.0.1-canary.91
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 +102 -0
- package/dist/components/accordion.d.ts +21 -0
- package/dist/components/accordion.d.ts.map +1 -0
- package/dist/components/accordion.js +94 -0
- package/dist/components/accordion.js.map +1 -0
- package/dist/components/alert-dialog.d.ts +67 -0
- package/dist/components/alert-dialog.d.ts.map +1 -0
- package/dist/components/alert-dialog.js +170 -0
- package/dist/components/alert-dialog.js.map +1 -0
- package/dist/components/aspect-ratio.d.ts +4 -0
- package/dist/components/aspect-ratio.d.ts.map +1 -0
- package/dist/components/aspect-ratio.js +4 -0
- package/dist/components/aspect-ratio.js.map +1 -0
- package/dist/components/avatar.d.ts +23 -0
- package/dist/components/avatar.d.ts.map +1 -0
- package/dist/components/avatar.js +143 -0
- package/dist/components/avatar.js.map +1 -0
- package/dist/components/badge.d.ts +17 -0
- package/dist/components/badge.d.ts.map +1 -0
- package/dist/components/badge.js +95 -0
- package/dist/components/badge.js.map +1 -0
- package/dist/components/button.d.ts +14 -0
- package/dist/components/button.d.ts.map +1 -0
- package/dist/components/button.js +85 -0
- package/dist/components/button.js.map +1 -0
- package/dist/components/callout.d.ts +25 -0
- package/dist/components/callout.d.ts.map +1 -0
- package/dist/components/callout.js +146 -0
- package/dist/components/callout.js.map +1 -0
- package/dist/components/card.d.ts +10 -0
- package/dist/components/card.d.ts.map +1 -0
- package/dist/components/card.js +41 -0
- package/dist/components/card.js.map +1 -0
- package/dist/components/checkbox.d.ts +13 -0
- package/dist/components/checkbox.d.ts.map +1 -0
- package/dist/components/checkbox.js +116 -0
- package/dist/components/checkbox.js.map +1 -0
- package/dist/components/code.d.ts +20 -0
- package/dist/components/code.d.ts.map +1 -0
- package/dist/components/code.js +83 -0
- package/dist/components/code.js.map +1 -0
- package/dist/components/context-menu.d.ts +65 -0
- package/dist/components/context-menu.d.ts.map +1 -0
- package/dist/components/context-menu.js +441 -0
- package/dist/components/context-menu.js.map +1 -0
- package/dist/components/dialog.d.ts +49 -0
- package/dist/components/dialog.d.ts.map +1 -0
- package/dist/components/dialog.js +141 -0
- package/dist/components/dialog.js.map +1 -0
- package/dist/components/dropdown-menu.d.ts +65 -0
- package/dist/components/dropdown-menu.d.ts.map +1 -0
- package/dist/components/dropdown-menu.js +441 -0
- package/dist/components/dropdown-menu.js.map +1 -0
- package/dist/components/heading.d.ts +15 -0
- package/dist/components/heading.d.ts.map +1 -0
- package/dist/components/heading.js +8 -0
- package/dist/components/heading.js.map +1 -0
- package/dist/components/hover-card.d.ts +24 -0
- package/dist/components/hover-card.d.ts.map +1 -0
- package/dist/components/hover-card.js +49 -0
- package/dist/components/hover-card.js.map +1 -0
- package/dist/components/icon-button.d.ts +14 -0
- package/dist/components/icon-button.d.ts.map +1 -0
- package/dist/components/icon-button.js +85 -0
- package/dist/components/icon-button.js.map +1 -0
- package/dist/components/icon.d.ts +28 -0
- package/dist/components/icon.d.ts.map +1 -0
- package/dist/components/icon.js +45 -0
- package/dist/components/icon.js.map +1 -0
- package/dist/components/index.d.ts +33 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +45 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/label.d.ts +8 -0
- package/dist/components/label.d.ts.map +1 -0
- package/dist/components/label.js +26 -0
- package/dist/components/label.js.map +1 -0
- package/dist/components/native-only-animated-view.d.ts +223 -0
- package/dist/components/native-only-animated-view.d.ts.map +1 -0
- package/dist/components/native-only-animated-view.js +26 -0
- package/dist/components/native-only-animated-view.js.map +1 -0
- package/dist/components/popover.d.ts +24 -0
- package/dist/components/popover.d.ts.map +1 -0
- package/dist/components/popover.js +52 -0
- package/dist/components/popover.js.map +1 -0
- package/dist/components/progress.d.ts +15 -0
- package/dist/components/progress.d.ts.map +1 -0
- package/dist/components/progress.js +68 -0
- package/dist/components/progress.js.map +1 -0
- package/dist/components/radio-group.d.ts +19 -0
- package/dist/components/radio-group.d.ts.map +1 -0
- package/dist/components/radio-group.js +138 -0
- package/dist/components/radio-group.js.map +1 -0
- package/dist/components/segmented-control.d.ts +21 -0
- package/dist/components/segmented-control.d.ts.map +1 -0
- package/dist/components/segmented-control.js +113 -0
- package/dist/components/segmented-control.js.map +1 -0
- package/dist/components/select.d.ts +58 -0
- package/dist/components/select.d.ts.map +1 -0
- package/dist/components/select.js +493 -0
- package/dist/components/select.js.map +1 -0
- package/dist/components/separator.d.ts +12 -0
- package/dist/components/separator.d.ts.map +1 -0
- package/dist/components/separator.js +64 -0
- package/dist/components/separator.js.map +1 -0
- package/dist/components/skeleton.d.ts +28 -0
- package/dist/components/skeleton.d.ts.map +1 -0
- package/dist/components/skeleton.js +153 -0
- package/dist/components/skeleton.js.map +1 -0
- package/dist/components/spinner.d.ts +17 -0
- package/dist/components/spinner.d.ts.map +1 -0
- package/dist/components/spinner.js +199 -0
- package/dist/components/spinner.js.map +1 -0
- package/dist/components/switch.d.ts +13 -0
- package/dist/components/switch.d.ts.map +1 -0
- package/dist/components/switch.js +204 -0
- package/dist/components/switch.js.map +1 -0
- package/dist/components/tabs.d.ts +25 -0
- package/dist/components/tabs.d.ts.map +1 -0
- package/dist/components/tabs.js +124 -0
- package/dist/components/tabs.js.map +1 -0
- package/dist/components/text-area.d.ts +16 -0
- package/dist/components/text-area.d.ts.map +1 -0
- package/dist/components/text-area.js +117 -0
- package/dist/components/text-area.js.map +1 -0
- package/dist/components/text-field.d.ts +35 -0
- package/dist/components/text-field.d.ts.map +1 -0
- package/dist/components/text-field.js +256 -0
- package/dist/components/text-field.js.map +1 -0
- package/dist/components/text.d.ts +23 -0
- package/dist/components/text.d.ts.map +1 -0
- package/dist/components/text.js +33 -0
- package/dist/components/text.js.map +1 -0
- package/dist/components/tooltip.d.ts +24 -0
- package/dist/components/tooltip.d.ts.map +1 -0
- package/dist/components/tooltip.js +63 -0
- package/dist/components/tooltip.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/button-styles.d.ts +13 -0
- package/dist/lib/button-styles.d.ts.map +1 -0
- package/dist/lib/button-styles.js +131 -0
- package/dist/lib/button-styles.js.map +1 -0
- package/dist/lib/color-utils.d.ts +21 -0
- package/dist/lib/color-utils.d.ts.map +1 -0
- package/dist/lib/color-utils.js +84 -0
- package/dist/lib/color-utils.js.map +1 -0
- package/dist/lib/dialog-styles.d.ts +42 -0
- package/dist/lib/dialog-styles.d.ts.map +1 -0
- package/dist/lib/dialog-styles.js +162 -0
- package/dist/lib/dialog-styles.js.map +1 -0
- package/dist/lib/native-colors.d.ts +8 -0
- package/dist/lib/native-colors.d.ts.map +1 -0
- package/dist/lib/native-colors.js +67 -0
- package/dist/lib/native-colors.js.map +1 -0
- package/dist/lib/panel-styles.d.ts +32 -0
- package/dist/lib/panel-styles.d.ts.map +1 -0
- package/dist/lib/panel-styles.js +96 -0
- package/dist/lib/panel-styles.js.map +1 -0
- package/dist/lib/text-input-styles.d.ts +35 -0
- package/dist/lib/text-input-styles.d.ts.map +1 -0
- package/dist/lib/text-input-styles.js +107 -0
- package/dist/lib/text-input-styles.js.map +1 -0
- package/dist/lib/theme-vars.d.ts +222 -0
- package/dist/lib/theme-vars.d.ts.map +1 -0
- package/dist/lib/theme-vars.js +173 -0
- package/dist/lib/theme-vars.js.map +1 -0
- package/dist/lib/theme.d.ts +57 -0
- package/dist/lib/theme.d.ts.map +1 -0
- package/dist/lib/theme.js +80 -0
- package/dist/lib/theme.js.map +1 -0
- package/dist/lib/types.d.ts +14 -0
- package/dist/lib/types.d.ts.map +1 -0
- package/dist/lib/types.js +2 -0
- package/dist/lib/types.js.map +1 -0
- package/dist/lib/use-theme-vars.d.ts +325 -0
- package/dist/lib/use-theme-vars.d.ts.map +1 -0
- package/dist/lib/use-theme-vars.js +17 -0
- package/dist/lib/use-theme-vars.js.map +1 -0
- package/dist/lib/utils.d.ts +3 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/lib/utils.js +17 -0
- package/dist/lib/utils.js.map +1 -0
- package/global.css +1813 -0
- package/package.json +114 -0
- package/tailwind-preset.js +310 -0
package/package.json
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@frosted-ui/react-native",
|
|
3
|
+
"version": "0.0.1-canary.91",
|
|
4
|
+
"main": "expo-router/entry",
|
|
5
|
+
"types": "./dist/index.d.ts",
|
|
6
|
+
"module": "./dist/index.js",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"default": "./dist/index.js"
|
|
11
|
+
},
|
|
12
|
+
"./global.css": "./global.css",
|
|
13
|
+
"./tailwind-preset": "./tailwind-preset.js"
|
|
14
|
+
},
|
|
15
|
+
"sideEffects": false,
|
|
16
|
+
"license": "MIT",
|
|
17
|
+
"files": [
|
|
18
|
+
"dist",
|
|
19
|
+
"global.css",
|
|
20
|
+
"tailwind-preset.js"
|
|
21
|
+
],
|
|
22
|
+
"peerDependencies": {
|
|
23
|
+
"react": ">=18.0.0",
|
|
24
|
+
"react-native": ">=0.70.0",
|
|
25
|
+
"nativewind": "^4.0.0",
|
|
26
|
+
"react-native-reanimated": ">=3.0.0",
|
|
27
|
+
"react-native-safe-area-context": ">=4.0.0",
|
|
28
|
+
"react-native-screens": ">=3.0.0",
|
|
29
|
+
"react-native-svg": ">=13.0.0",
|
|
30
|
+
"lucide-react-native": ">=0.300.0"
|
|
31
|
+
},
|
|
32
|
+
"scripts": {
|
|
33
|
+
"dev": "expo start -c",
|
|
34
|
+
"android": "expo start -c --android",
|
|
35
|
+
"ios": "expo start -c --ios",
|
|
36
|
+
"web": "expo start -c --web",
|
|
37
|
+
"build": "pnpm clean:dist && tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json",
|
|
38
|
+
"clean": "rm -rf .expo node_modules",
|
|
39
|
+
"clean:dist": "rm -rf dist",
|
|
40
|
+
"generate:global-css": "node scripts/generate-global-css.js",
|
|
41
|
+
"release": "turbo-module publish"
|
|
42
|
+
},
|
|
43
|
+
"dependencies": {
|
|
44
|
+
"@frosted-ui/colors": "workspace:*",
|
|
45
|
+
"@rn-primitives/accordion": "^1.2.0",
|
|
46
|
+
"@rn-primitives/alert-dialog": "^1.2.0",
|
|
47
|
+
"@rn-primitives/aspect-ratio": "^1.2.0",
|
|
48
|
+
"@rn-primitives/avatar": "^1.2.0",
|
|
49
|
+
"@rn-primitives/checkbox": "^1.2.0",
|
|
50
|
+
"@rn-primitives/collapsible": "^1.2.0",
|
|
51
|
+
"@rn-primitives/context-menu": "^1.2.0",
|
|
52
|
+
"@rn-primitives/dialog": "^1.2.0",
|
|
53
|
+
"@rn-primitives/dropdown-menu": "^1.2.0",
|
|
54
|
+
"@rn-primitives/hover-card": "^1.2.0",
|
|
55
|
+
"@rn-primitives/label": "^1.2.0",
|
|
56
|
+
"@rn-primitives/menubar": "^1.2.0",
|
|
57
|
+
"@rn-primitives/popover": "^1.2.0",
|
|
58
|
+
"@rn-primitives/portal": "~1.3.0",
|
|
59
|
+
"@rn-primitives/progress": "^1.2.0",
|
|
60
|
+
"@rn-primitives/radio-group": "^1.2.0",
|
|
61
|
+
"@rn-primitives/select": "^1.2.0",
|
|
62
|
+
"@rn-primitives/separator": "^1.2.0",
|
|
63
|
+
"@rn-primitives/slot": "^1.2.0",
|
|
64
|
+
"@rn-primitives/switch": "^1.2.0",
|
|
65
|
+
"@rn-primitives/tabs": "^1.2.0",
|
|
66
|
+
"@rn-primitives/toggle": "^1.2.0",
|
|
67
|
+
"@rn-primitives/toggle-group": "^1.2.0",
|
|
68
|
+
"@rn-primitives/tooltip": "^1.2.0",
|
|
69
|
+
"class-variance-authority": "^0.7.1",
|
|
70
|
+
"clsx": "^2.1.1",
|
|
71
|
+
"tailwind-merge": "^3.3.1"
|
|
72
|
+
},
|
|
73
|
+
"devDependencies": {
|
|
74
|
+
"@babel/core": "^7.26.0",
|
|
75
|
+
"@react-navigation/native": "^7.0.0",
|
|
76
|
+
"@types/react": "~19.1.10",
|
|
77
|
+
"expo": "^54.0.26",
|
|
78
|
+
"expo-linking": "~8.0.9",
|
|
79
|
+
"expo-router": "~6.0.16",
|
|
80
|
+
"expo-splash-screen": "~31.0.11",
|
|
81
|
+
"expo-status-bar": "~3.0.8",
|
|
82
|
+
"expo-system-ui": "~6.0.8",
|
|
83
|
+
"lucide-react-native": "^0.545.0",
|
|
84
|
+
"nativewind": "^4.2.1",
|
|
85
|
+
"prettier": "^3.6.2",
|
|
86
|
+
"prettier-plugin-tailwindcss": "^0.6.14",
|
|
87
|
+
"react": "19.1.0",
|
|
88
|
+
"react-dom": "19.1.0",
|
|
89
|
+
"react-native": "0.81.5",
|
|
90
|
+
"react-native-css-interop": "^0.2.1",
|
|
91
|
+
"react-native-reanimated": "~4.1.1",
|
|
92
|
+
"react-native-safe-area-context": "~5.6.0",
|
|
93
|
+
"react-native-screens": "~4.16.0",
|
|
94
|
+
"react-native-svg": "15.12.1",
|
|
95
|
+
"react-native-web": "^0.21.0",
|
|
96
|
+
"react-native-worklets": "0.5.1",
|
|
97
|
+
"tailwindcss": "^3.4.14",
|
|
98
|
+
"tailwindcss-animate": "^1.0.7",
|
|
99
|
+
"tsc-alias": "^1.8.16",
|
|
100
|
+
"typescript": "~5.9.2",
|
|
101
|
+
"@whop-sdk/turbo-module": "^0.0.5"
|
|
102
|
+
},
|
|
103
|
+
"publishConfig": {
|
|
104
|
+
"access": "public"
|
|
105
|
+
},
|
|
106
|
+
"homepage": "https://github.com/whopio/frosted-ui",
|
|
107
|
+
"repository": {
|
|
108
|
+
"type": "git",
|
|
109
|
+
"url": "git+https://github.com/whopio/frosted-ui.git"
|
|
110
|
+
},
|
|
111
|
+
"bugs": {
|
|
112
|
+
"url": "https://github.com/whopio/frosted-ui/issues"
|
|
113
|
+
}
|
|
114
|
+
}
|
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
/* eslint-env node */
|
|
2
|
+
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Frosted UI Tailwind Preset for React Native / NativeWind
|
|
6
|
+
*
|
|
7
|
+
* Usage in your tailwind.config.js:
|
|
8
|
+
*
|
|
9
|
+
* const { frostedPreset } = require('@frosted-ui/react-native/tailwind-preset');
|
|
10
|
+
*
|
|
11
|
+
* module.exports = {
|
|
12
|
+
* content: ['./App.{js,jsx,ts,tsx}', './src/**\/*.{js,jsx,ts,tsx}'],
|
|
13
|
+
* presets: [require('nativewind/preset'), frostedPreset],
|
|
14
|
+
* // your custom theme extensions...
|
|
15
|
+
* };
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
const { hairlineWidth } = require('nativewind/theme');
|
|
19
|
+
const frostedColors = require('@frosted-ui/colors');
|
|
20
|
+
|
|
21
|
+
// ============================================================================
|
|
22
|
+
// Semantic color tokens (CSS variable references)
|
|
23
|
+
// ============================================================================
|
|
24
|
+
|
|
25
|
+
const semanticColorVars = {
|
|
26
|
+
background: 'var(--color-background)',
|
|
27
|
+
overlay: 'var(--color-overlay)',
|
|
28
|
+
'panel-solid': 'var(--color-panel-solid)',
|
|
29
|
+
'panel-translucent': 'var(--color-panel-translucent)',
|
|
30
|
+
surface: 'var(--color-surface)',
|
|
31
|
+
stroke: 'var(--color-stroke)',
|
|
32
|
+
'gray-2-translucent': 'var(--gray-2-translucent)',
|
|
33
|
+
'mauve-2-translucent': 'var(--mauve-2-translucent)',
|
|
34
|
+
'slate-2-translucent': 'var(--slate-2-translucent)',
|
|
35
|
+
'sage-2-translucent': 'var(--sage-2-translucent)',
|
|
36
|
+
'olive-2-translucent': 'var(--olive-2-translucent)',
|
|
37
|
+
'sand-2-translucent': 'var(--sand-2-translucent)',
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
// ============================================================================
|
|
41
|
+
// Typography scale (CSS variable references)
|
|
42
|
+
// ============================================================================
|
|
43
|
+
|
|
44
|
+
const typographyScale = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9].reduce(
|
|
45
|
+
(acc, step) => ({
|
|
46
|
+
...acc,
|
|
47
|
+
[`${step}`]: [
|
|
48
|
+
`var(--font-size-${step})`,
|
|
49
|
+
{
|
|
50
|
+
lineHeight: `var(--line-height-${step})`,
|
|
51
|
+
letterSpacing: `var(--letter-spacing-${step})`,
|
|
52
|
+
},
|
|
53
|
+
],
|
|
54
|
+
}),
|
|
55
|
+
{}
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
const fontWeightScale = {
|
|
59
|
+
thin: '100',
|
|
60
|
+
extralight: '200',
|
|
61
|
+
light: 'var(--font-weight-light)',
|
|
62
|
+
normal: 'var(--font-weight-regular)',
|
|
63
|
+
medium: 'var(--font-weight-medium)',
|
|
64
|
+
semibold: '600',
|
|
65
|
+
bold: 'var(--font-weight-bold)',
|
|
66
|
+
extrabold: '800',
|
|
67
|
+
black: '900',
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
const lineHeightScale = {
|
|
71
|
+
none: '1',
|
|
72
|
+
tight: '1.25',
|
|
73
|
+
snug: '1.375',
|
|
74
|
+
normal: '1.5',
|
|
75
|
+
relaxed: '1.625',
|
|
76
|
+
loose: '2',
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
const letterSpacingScale = {
|
|
80
|
+
tighter: '-0.05em',
|
|
81
|
+
tight: '-0.025em',
|
|
82
|
+
normal: '0',
|
|
83
|
+
wide: '0.025em',
|
|
84
|
+
wider: '0.05em',
|
|
85
|
+
widest: '0.1em',
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
// ============================================================================
|
|
89
|
+
// Color tokens
|
|
90
|
+
// ============================================================================
|
|
91
|
+
|
|
92
|
+
const contrastColorNames = [
|
|
93
|
+
'tomato',
|
|
94
|
+
'red',
|
|
95
|
+
'ruby',
|
|
96
|
+
'crimson',
|
|
97
|
+
'pink',
|
|
98
|
+
'plum',
|
|
99
|
+
'purple',
|
|
100
|
+
'violet',
|
|
101
|
+
'iris',
|
|
102
|
+
'cyan',
|
|
103
|
+
'teal',
|
|
104
|
+
'jade',
|
|
105
|
+
'green',
|
|
106
|
+
'grass',
|
|
107
|
+
'brown',
|
|
108
|
+
'sky',
|
|
109
|
+
'mint',
|
|
110
|
+
'yellow',
|
|
111
|
+
'amber',
|
|
112
|
+
'gold',
|
|
113
|
+
'bronze',
|
|
114
|
+
'gray',
|
|
115
|
+
'blue',
|
|
116
|
+
'orange',
|
|
117
|
+
'indigo',
|
|
118
|
+
'magenta',
|
|
119
|
+
'lemon',
|
|
120
|
+
'lime',
|
|
121
|
+
];
|
|
122
|
+
|
|
123
|
+
const contrastColorTokens = contrastColorNames.reduce((acc, name) => {
|
|
124
|
+
acc[`${name}-9-contrast`] = `var(--${name}-9-contrast)`;
|
|
125
|
+
return acc;
|
|
126
|
+
}, {});
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Creates color tokens from @frosted-ui/colors exports
|
|
130
|
+
*/
|
|
131
|
+
const createFrostedColorTokens = (paletteExports) =>
|
|
132
|
+
Object.entries(paletteExports).reduce((acc, [paletteName, paletteValues]) => {
|
|
133
|
+
const isObjectPalette =
|
|
134
|
+
paletteValues && typeof paletteValues === 'object' && !Array.isArray(paletteValues);
|
|
135
|
+
const isAlphaPalette = paletteName.endsWith('A');
|
|
136
|
+
const baseName = (isAlphaPalette ? paletteName.slice(0, -1) : paletteName) || '';
|
|
137
|
+
const normalizedBase = baseName.toLowerCase();
|
|
138
|
+
const isSupportedName = /^[a-z]+$/.test(normalizedBase) && !paletteName.includes('P3');
|
|
139
|
+
|
|
140
|
+
if (!isObjectPalette || !isSupportedName) {
|
|
141
|
+
return acc;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
Object.entries(paletteValues).forEach(([shadeKey]) => {
|
|
145
|
+
const stepMatch = shadeKey.match(/(\d+)$/);
|
|
146
|
+
|
|
147
|
+
if (!stepMatch) {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
const variantSuffix = `${isAlphaPalette ? 'a' : ''}${stepMatch[1]}`;
|
|
152
|
+
const cssVarName = `--${normalizedBase}-${variantSuffix}`;
|
|
153
|
+
acc[`${normalizedBase}-${variantSuffix}`] = `var(${cssVarName})`;
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
return acc;
|
|
157
|
+
}, {});
|
|
158
|
+
|
|
159
|
+
const frostedColorTokens = createFrostedColorTokens(frostedColors);
|
|
160
|
+
|
|
161
|
+
// Accent color tokens (defaults to blue, overridable via CSS variables)
|
|
162
|
+
const accentColorTokens = {
|
|
163
|
+
1: 'var(--accent-1)',
|
|
164
|
+
2: 'var(--accent-2)',
|
|
165
|
+
3: 'var(--accent-3)',
|
|
166
|
+
4: 'var(--accent-4)',
|
|
167
|
+
5: 'var(--accent-5)',
|
|
168
|
+
6: 'var(--accent-6)',
|
|
169
|
+
7: 'var(--accent-7)',
|
|
170
|
+
8: 'var(--accent-8)',
|
|
171
|
+
9: 'var(--accent-9)',
|
|
172
|
+
'9-contrast': 'var(--accent-9-contrast)',
|
|
173
|
+
10: 'var(--accent-10)',
|
|
174
|
+
11: 'var(--accent-11)',
|
|
175
|
+
12: 'var(--accent-12)',
|
|
176
|
+
a1: 'var(--accent-a1)',
|
|
177
|
+
a2: 'var(--accent-a2)',
|
|
178
|
+
a3: 'var(--accent-a3)',
|
|
179
|
+
a4: 'var(--accent-a4)',
|
|
180
|
+
a5: 'var(--accent-a5)',
|
|
181
|
+
a6: 'var(--accent-a6)',
|
|
182
|
+
a7: 'var(--accent-a7)',
|
|
183
|
+
a8: 'var(--accent-a8)',
|
|
184
|
+
a9: 'var(--accent-a9)',
|
|
185
|
+
a10: 'var(--accent-a10)',
|
|
186
|
+
a11: 'var(--accent-a11)',
|
|
187
|
+
a12: 'var(--accent-a12)',
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
// ============================================================================
|
|
191
|
+
// Frosted UI Preset
|
|
192
|
+
// ============================================================================
|
|
193
|
+
|
|
194
|
+
/** @type {import('tailwindcss').Config} */
|
|
195
|
+
const frostedPreset = {
|
|
196
|
+
darkMode: 'class',
|
|
197
|
+
theme: {
|
|
198
|
+
fontSize: typographyScale,
|
|
199
|
+
lineHeight: lineHeightScale,
|
|
200
|
+
letterSpacing: letterSpacingScale,
|
|
201
|
+
fontWeight: fontWeightScale,
|
|
202
|
+
colors: {
|
|
203
|
+
transparent: 'transparent',
|
|
204
|
+
current: 'currentColor',
|
|
205
|
+
inherit: 'inherit',
|
|
206
|
+
accent: accentColorTokens,
|
|
207
|
+
...frostedColorTokens,
|
|
208
|
+
...contrastColorTokens,
|
|
209
|
+
...semanticColorVars,
|
|
210
|
+
},
|
|
211
|
+
extend: {
|
|
212
|
+
borderRadius: {
|
|
213
|
+
lg: 'var(--radius)',
|
|
214
|
+
md: 'calc(var(--radius) - 2px)',
|
|
215
|
+
sm: 'calc(var(--radius) - 4px)',
|
|
216
|
+
},
|
|
217
|
+
borderWidth: {
|
|
218
|
+
hairline: hairlineWidth(),
|
|
219
|
+
},
|
|
220
|
+
keyframes: {
|
|
221
|
+
'accordion-down': {
|
|
222
|
+
from: { height: '0' },
|
|
223
|
+
to: { height: 'var(--radix-accordion-content-height)' },
|
|
224
|
+
},
|
|
225
|
+
'accordion-up': {
|
|
226
|
+
from: { height: 'var(--radix-accordion-content-height)' },
|
|
227
|
+
to: { height: '0' },
|
|
228
|
+
},
|
|
229
|
+
},
|
|
230
|
+
animation: {
|
|
231
|
+
'accordion-down': 'accordion-down 0.2s ease-out',
|
|
232
|
+
'accordion-up': 'accordion-up 0.2s ease-out',
|
|
233
|
+
},
|
|
234
|
+
},
|
|
235
|
+
},
|
|
236
|
+
future: {
|
|
237
|
+
hoverOnlyWhenSupported: true,
|
|
238
|
+
},
|
|
239
|
+
plugins: [require('tailwindcss-animate')],
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
// ============================================================================
|
|
243
|
+
// Helper to create content paths for frosted-ui components
|
|
244
|
+
// ============================================================================
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* Returns the content paths needed for Tailwind to scan frosted-ui components.
|
|
248
|
+
* Add these to your tailwind.config.js content array.
|
|
249
|
+
*
|
|
250
|
+
* @example
|
|
251
|
+
* content: [
|
|
252
|
+
* './App.{js,jsx,ts,tsx}',
|
|
253
|
+
* ...getFrostedUIContentPaths(),
|
|
254
|
+
* ],
|
|
255
|
+
*/
|
|
256
|
+
function getFrostedUIContentPaths() {
|
|
257
|
+
return [
|
|
258
|
+
'./node_modules/@frosted-ui/react-native/dist/**/*.js',
|
|
259
|
+
// Also include src for development/linking scenarios
|
|
260
|
+
'./node_modules/@frosted-ui/react-native/src/**/*.{ts,tsx}',
|
|
261
|
+
];
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
/**
|
|
265
|
+
* Utility to merge your Tailwind config with Frosted UI preset.
|
|
266
|
+
* This is an alternative to using presets if you need more control.
|
|
267
|
+
*
|
|
268
|
+
* @param {import('tailwindcss').Config} userConfig - Your Tailwind config
|
|
269
|
+
* @returns {import('tailwindcss').Config} - Merged config with Frosted UI theme
|
|
270
|
+
*
|
|
271
|
+
* @example
|
|
272
|
+
* const { withFrostedUI } = require('@frosted-ui/react-native/tailwind-preset');
|
|
273
|
+
*
|
|
274
|
+
* module.exports = withFrostedUI({
|
|
275
|
+
* content: ['./App.{js,jsx,ts,tsx}'],
|
|
276
|
+
* theme: {
|
|
277
|
+
* extend: {
|
|
278
|
+
* // your customizations
|
|
279
|
+
* },
|
|
280
|
+
* },
|
|
281
|
+
* });
|
|
282
|
+
*/
|
|
283
|
+
function withFrostedUI(userConfig = {}) {
|
|
284
|
+
const contentPaths = getFrostedUIContentPaths();
|
|
285
|
+
|
|
286
|
+
return {
|
|
287
|
+
...userConfig,
|
|
288
|
+
darkMode: userConfig.darkMode || 'class',
|
|
289
|
+
content: [...(userConfig.content || []), ...contentPaths],
|
|
290
|
+
presets: [require('nativewind/preset'), frostedPreset, ...(userConfig.presets || [])],
|
|
291
|
+
theme: {
|
|
292
|
+
...userConfig.theme,
|
|
293
|
+
extend: {
|
|
294
|
+
...frostedPreset.theme.extend,
|
|
295
|
+
...(userConfig.theme?.extend || {}),
|
|
296
|
+
},
|
|
297
|
+
},
|
|
298
|
+
future: {
|
|
299
|
+
...frostedPreset.future,
|
|
300
|
+
...(userConfig.future || {}),
|
|
301
|
+
},
|
|
302
|
+
plugins: [...(frostedPreset.plugins || []), ...(userConfig.plugins || [])],
|
|
303
|
+
};
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
module.exports = {
|
|
307
|
+
frostedPreset,
|
|
308
|
+
getFrostedUIContentPaths,
|
|
309
|
+
withFrostedUI,
|
|
310
|
+
};
|