@castui/cast-ui 4.2.1 → 4.2.2

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 CHANGED
@@ -10,6 +10,9 @@ so what designers see in Figma is what ships in the app. Every component
10
10
  supports light and dark mode, three spacing densities, and your own brand
11
11
  colours — all switchable while the app is running, with no rebuild.
12
12
 
13
+ Browse every component live in the
14
+ [hosted Storybook](https://main--6990f00d7b8682c18d2ed5f3.chromatic.com).
15
+
13
16
  ## Installation
14
17
 
15
18
  ```bash
@@ -33,6 +36,45 @@ export function App() {
33
36
  }
34
37
  ```
35
38
 
39
+ ## Fonts
40
+
41
+ Cast UI ships no font files. Typography asks for **Inter** and the Icon
42
+ component asks for **Material Symbols Outlined** — if a font isn't loaded
43
+ there is no error: text quietly falls back to the system font, and icons
44
+ render as their literal names ("star" instead of the glyph). Load both once
45
+ at app start-up.
46
+
47
+ **Expo (iOS, Android, and web)** — one `useFonts` call covers all three
48
+ platforms:
49
+
50
+ ```tsx
51
+ import { useFonts } from 'expo-font';
52
+
53
+ const [fontsLoaded] = useFonts({
54
+ Inter: require('./assets/Inter.ttf'),
55
+ MaterialSymbolsOutlined: require('./assets/MaterialSymbolsOutlined.ttf'),
56
+ });
57
+ ```
58
+
59
+ **Plain web** — add the Google Fonts stylesheets to your HTML head:
60
+
61
+ ```html
62
+ <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet" />
63
+ <link href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200&display=swap" rel="stylesheet" />
64
+ ```
65
+
66
+ **Bare React Native** — link the `.ttf` files as font assets
67
+ (`react-native.config.js` + `npx react-native-asset`), keeping the family
68
+ names `Inter` and `MaterialSymbolsOutlined`.
69
+
70
+ Download both from Google Fonts:
71
+ [Inter](https://fonts.google.com/specimen/Inter) and
72
+ [Material Symbols](https://fonts.google.com/icons). The Material Symbols
73
+ variable font is ~10 MB — fine for web, where it's served from a CDN and
74
+ cached, but worth slimming for production native builds by subsetting it to
75
+ the icons you use (e.g. `pyftsubset` from
76
+ [fonttools](https://github.com/fonttools/fonttools)).
77
+
36
78
  ## Components
37
79
 
38
80
  | Component | Description |
@@ -108,7 +150,9 @@ comfortable app. Your own components can read the active theme with the
108
150
  `useTheme` hook, and all the underlying values (colours, typography scales,
109
151
  density spacing) are exported for direct use.
110
152
 
111
- The full guide lives in Storybook under **Guides → Customisation**.
153
+ The full guide lives in the
154
+ [hosted Storybook](https://main--6990f00d7b8682c18d2ed5f3.chromatic.com)
155
+ under **Guides → Customisation**.
112
156
 
113
157
  ## Theming from Figma — the cast-sync plugin
114
158
 
@@ -10,10 +10,13 @@
10
10
  * runtime dependencies (no per-icon SVG packages, no vector-icons dep).
11
11
  *
12
12
  * Rendering uses font ligatures: the `name` text (e.g. "chevron_right") is
13
- * shaped into the glyph by the font. Requires the font to be loaded:
13
+ * shaped into the glyph by the font. Requires the font to be loaded — on web
14
+ * both the `MaterialSymbolsOutlined` and `Material Symbols Outlined` family
15
+ * names are accepted, so any one of these paths works:
14
16
  * - Web: Google Fonts CSS import (see .storybook/preview-head.html), or
15
17
  * self-host the same `Material Symbols Outlined` family.
16
- * - Expo: load `MaterialSymbolsOutlined` via expo-font / useFonts.
18
+ * - Expo (iOS, Android, and web): load `MaterialSymbolsOutlined` via
19
+ * expo-font / useFonts — one registration covers all three platforms.
17
20
  * - Bare RN: link the .ttf as a font asset (react-native.config.js / Xcode).
18
21
  *
19
22
  * The fill / weight / grade / opticalSize axes are applied via CSS
@@ -3,8 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Icon = Icon;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_native_1 = require("react-native");
6
+ // Web accepts both family names so the Google-Fonts CSS path (spaced name)
7
+ // and the expo-font/useFonts path (unspaced key) work without consumer
8
+ // configuration. Fonts registered via expo-font on web keep their object key
9
+ // as the family name.
6
10
  const FONT_FAMILY = react_native_1.Platform.select({
7
- web: '"Material Symbols Outlined", sans-serif',
11
+ web: 'MaterialSymbolsOutlined, "Material Symbols Outlined", sans-serif',
8
12
  default: 'MaterialSymbolsOutlined',
9
13
  });
10
14
  function Icon({ name, size = 20, color = '#374151', fill = false, weight = 400, grade = 0, opticalSize, style, }) {
@@ -19,6 +19,11 @@ const jsx_runtime_1 = require("react/jsx-runtime");
19
19
  const react_1 = require("react");
20
20
  const react_native_1 = require("react-native");
21
21
  const theme_1 = require("../../theme");
22
+ // ---------------------------------------------------------------------------
23
+ // Constants
24
+ // ---------------------------------------------------------------------------
25
+ // react-native-web has no native driver and warns if asked for one.
26
+ const USE_NATIVE_DRIVER = react_native_1.Platform.OS !== 'web';
22
27
  /** Default size + corner radius per shape (radius/2, surface/overlay/radius, radius/full). */
23
28
  const SHAPE_DEFAULTS = {
24
29
  text: { width: 120, height: 12, radius: 4 },
@@ -42,12 +47,12 @@ function Skeleton({ shape = 'text', width, height, radius, animated = true, styl
42
47
  react_native_1.Animated.timing(opacity, {
43
48
  toValue: 0.5,
44
49
  duration: 700,
45
- useNativeDriver: true,
50
+ useNativeDriver: USE_NATIVE_DRIVER,
46
51
  }),
47
52
  react_native_1.Animated.timing(opacity, {
48
53
  toValue: 1,
49
54
  duration: 700,
50
- useNativeDriver: true,
55
+ useNativeDriver: USE_NATIVE_DRIVER,
51
56
  }),
52
57
  ]));
53
58
  loop.start();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@castui/cast-ui",
3
- "version": "4.2.1",
3
+ "version": "4.2.2",
4
4
  "description": "A cross-platform design system for React Native (iOS, Android, Web) with multi-theme support.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",