@girumtech/gs-design-system-native 0.1.4

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 ADDED
@@ -0,0 +1,146 @@
1
+ # @girumtech/gs-design-system-native
2
+
3
+ React Native entry point for GsDesignSystem, a TypeScript design system built with Tamagui. It exports shared components and themes, native SVG icons, and curated React Native-compatible layout primitives.
4
+
5
+ ## Requirements
6
+
7
+ - React 19 or newer
8
+ - React Native 0.81 or newer
9
+ - Tamagui 2.7
10
+ - React Native SVG 15 or newer
11
+
12
+ ## Installation
13
+
14
+ ```bash
15
+ npm install @girumtech/gs-design-system-native tamagui react-native-svg
16
+ ```
17
+
18
+ For a bare React Native iOS application, install CocoaPods after adding the dependencies:
19
+
20
+ ```bash
21
+ cd ios
22
+ pod install
23
+ cd ..
24
+ ```
25
+
26
+ ## Application setup
27
+
28
+ Add `GsProvider` once near the application root. It supplies the Tamagui configuration, tokens, and default theme.
29
+
30
+ ```tsx
31
+ // App.tsx
32
+ import { Button, GsProvider, ScrollView, Text, YStack } from '@girumtech/gs-design-system-native'
33
+
34
+ export default function App() {
35
+ return (
36
+ <GsProvider defaultTheme="blue">
37
+ <ScrollView backgroundColor="$background">
38
+ <YStack padding="$4" gap="$4">
39
+ <Text variant="title">My application</Text>
40
+ <Text tone="muted">Built with GsDesignSystem.</Text>
41
+ <Button onPress={() => console.log('Pressed')}>Continue</Button>
42
+ </YStack>
43
+ </ScrollView>
44
+ </GsProvider>
45
+ )
46
+ }
47
+ ```
48
+
49
+ Available themes are `red`, `red_dark`, `blue`, and `blue_dark`.
50
+
51
+ `GsProvider` does not have to live directly in `App.tsx`, but it should appear once above components that use theme tokens. It can be placed in a dedicated application providers component or in the registered root component.
52
+
53
+ ## Components
54
+
55
+ ```tsx
56
+ import { Button, Field, Text, XStack, YStack } from '@girumtech/gs-design-system-native'
57
+
58
+ export function ProfileForm() {
59
+ return (
60
+ <YStack padding="$4" gap="$4" backgroundColor="$background">
61
+ <Text variant="title">Profile</Text>
62
+
63
+ <Field
64
+ id="display-name"
65
+ label="Display name"
66
+ placeholder="Your name"
67
+ helperText="This name is visible to your team."
68
+ />
69
+
70
+ <XStack gap="$3">
71
+ <Button onPress={() => console.log('Saved')}>Save</Button>
72
+ <Button intent="secondary">Cancel</Button>
73
+ </XStack>
74
+ </YStack>
75
+ )
76
+ }
77
+ ```
78
+
79
+ Buttons and inputs use the active theme accent for their border by default. Override it with the standard Tamagui `borderColor` prop:
80
+
81
+ ```tsx
82
+ <Button borderColor="#7C3AED">Custom border</Button>
83
+ <Field id="code" label="Code" borderColor="#7C3AED" />
84
+ ```
85
+
86
+ ## Switching themes
87
+
88
+ Use the exported `Theme` component when the selected theme changes at runtime:
89
+
90
+ ```tsx
91
+ import { useState } from 'react'
92
+ import {
93
+ Button,
94
+ GsProvider,
95
+ Text,
96
+ Theme,
97
+ YStack,
98
+ type GsThemeName,
99
+ } from '@girumtech/gs-design-system-native'
100
+
101
+ export function ThemeExample() {
102
+ const [theme, setTheme] = useState<GsThemeName>('blue')
103
+
104
+ return (
105
+ <GsProvider defaultTheme="blue">
106
+ <Theme name={theme}>
107
+ <YStack flex={1} padding="$4" gap="$4" backgroundColor="$background">
108
+ <Text variant="title">Current theme: {theme}</Text>
109
+ <Button onPress={() => setTheme('red')}>Use red</Button>
110
+ <Button onPress={() => setTheme('blue_dark')}>Use dark blue</Button>
111
+ </YStack>
112
+ </Theme>
113
+ </GsProvider>
114
+ )
115
+ }
116
+ ```
117
+
118
+ ## Icons
119
+
120
+ Built-in icons and custom path icons share the same native SVG API:
121
+
122
+ ```tsx
123
+ import { Icon, NamedIcon, type IconPath } from '@girumtech/gs-design-system-native'
124
+
125
+ const spark: readonly IconPath[] = [
126
+ {
127
+ d: 'M12 2 14.5 9.5 22 12l-7.5 2.5L12 22l-2.5-7.5L2 12l7.5-2.5L12 2Z',
128
+ fill: 'currentColor',
129
+ },
130
+ ]
131
+
132
+ export function Icons() {
133
+ return (
134
+ <>
135
+ <NamedIcon name="heart" size={28} color="#FC2B2B" label="Favorite" />
136
+ <Icon paths={spark} size={32} color="#2323F7" label="Spark" />
137
+ </>
138
+ )
139
+ }
140
+ ```
141
+
142
+ Decorative icons may omit `label`; meaningful icons should provide one for accessibility.
143
+
144
+ ## Exports
145
+
146
+ The package exports `GsProvider`, `Theme`, `Button`, `Input`, `Field`, `Text`, `Icon`, `NamedIcon`, tokens, themes, and the curated `Image`, `ScrollView`, `Separator`, `View`, `XStack`, `YStack`, and `ZStack` primitives.
@@ -0,0 +1,20 @@
1
+ import { IconPath, IconName } from '@girumtech/gs-design-system-core';
2
+ export * from '@girumtech/gs-design-system-core';
3
+ import * as react from 'react';
4
+ import { ComponentProps } from 'react';
5
+ import Svg from 'react-native-svg';
6
+ export { Image, ScrollView, Separator, View, XStack, YStack, ZStack } from 'tamagui';
7
+
8
+ interface IconProps extends Omit<ComponentProps<typeof Svg>, 'children'> {
9
+ paths: readonly IconPath[];
10
+ size?: number;
11
+ color?: string;
12
+ viewBox?: string;
13
+ label?: string;
14
+ }
15
+ declare function Icon({ paths, size, color, viewBox, label, ...props }: IconProps): react.JSX.Element;
16
+ declare function NamedIcon({ name, ...props }: Omit<IconProps, 'paths'> & {
17
+ name: IconName;
18
+ }): react.JSX.Element;
19
+
20
+ export { Icon, type IconProps, NamedIcon };
package/dist/index.js ADDED
@@ -0,0 +1,32 @@
1
+ // src/index.ts
2
+ export * from "@girumtech/gs-design-system-core";
3
+
4
+ // src/icon.tsx
5
+ import Svg, { Path } from "react-native-svg";
6
+ import { icons, normalizeIconPaths } from "@girumtech/gs-design-system-core";
7
+ import { useTheme } from "tamagui";
8
+ import { jsx } from "react/jsx-runtime";
9
+ function Icon({ paths, size = 24, color = "currentColor", viewBox = "0 0 24 24", label, ...props }) {
10
+ const theme = useTheme();
11
+ const themeColor = color.startsWith("$") ? theme[color.slice(1)]?.get() ?? color : color;
12
+ const normalized = normalizeIconPaths(paths, themeColor);
13
+ return /* @__PURE__ */ jsx(Svg, { width: size, height: size, viewBox, ...label ? { accessibilityLabel: label, accessible: true } : { "aria-hidden": true }, ...props, children: normalized.map((path, index) => /* @__PURE__ */ jsx(Path, { ...path }, `${path.d}-${index}`)) });
14
+ }
15
+ function NamedIcon({ name, ...props }) {
16
+ return /* @__PURE__ */ jsx(Icon, { paths: icons[name], ...props });
17
+ }
18
+
19
+ // src/index.ts
20
+ import { Image, ScrollView, Separator, View, XStack, YStack, ZStack } from "tamagui";
21
+ export {
22
+ Icon,
23
+ Image,
24
+ NamedIcon,
25
+ ScrollView,
26
+ Separator,
27
+ View,
28
+ XStack,
29
+ YStack,
30
+ ZStack
31
+ };
32
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts","../src/icon.tsx"],"sourcesContent":["export * from '@girumtech/gs-design-system-core'\nexport { Icon, NamedIcon, type IconProps } from './icon'\nexport { Image, ScrollView, Separator, View, XStack, YStack, ZStack } from 'tamagui'\n","import type { ComponentProps } from 'react'\nimport Svg, { Path } from 'react-native-svg'\nimport { icons, normalizeIconPaths, type IconName, type IconPath } from '@girumtech/gs-design-system-core'\nimport { useTheme } from 'tamagui'\n\nexport interface IconProps extends Omit<ComponentProps<typeof Svg>, 'children'> {\n paths: readonly IconPath[]\n size?: number\n color?: string\n viewBox?: string\n label?: string\n}\n\nexport function Icon({ paths, size = 24, color = 'currentColor', viewBox = '0 0 24 24', label, ...props }: IconProps) {\n const theme = useTheme()\n const themeColor = color.startsWith('$')\n ? (theme[color.slice(1) as keyof typeof theme]?.get() as string | undefined) ?? color\n : color\n const normalized = normalizeIconPaths(paths, themeColor)\n return (\n <Svg width={size} height={size} viewBox={viewBox} {...(label ? { accessibilityLabel: label, accessible: true } : { 'aria-hidden': true })} {...props}>\n {normalized.map((path, index) => <Path key={`${path.d}-${index}`} {...path} />)}\n </Svg>\n )\n}\n\nexport function NamedIcon({ name, ...props }: Omit<IconProps, 'paths'> & { name: IconName }) {\n return <Icon paths={icons[name]} {...props} />\n}\n"],"mappings":";AAAA,cAAc;;;ACCd,OAAO,OAAO,YAAY;AAC1B,SAAS,OAAO,0BAAwD;AACxE,SAAS,gBAAgB;AAkBc;AARhC,SAAS,KAAK,EAAE,OAAO,OAAO,IAAI,QAAQ,gBAAgB,UAAU,aAAa,OAAO,GAAG,MAAM,GAAc;AACpH,QAAM,QAAQ,SAAS;AACvB,QAAM,aAAa,MAAM,WAAW,GAAG,IAClC,MAAM,MAAM,MAAM,CAAC,CAAuB,GAAG,IAAI,KAA4B,QAC9E;AACJ,QAAM,aAAa,mBAAmB,OAAO,UAAU;AACvD,SACE,oBAAC,OAAI,OAAO,MAAM,QAAQ,MAAM,SAAmB,GAAI,QAAQ,EAAE,oBAAoB,OAAO,YAAY,KAAK,IAAI,EAAE,eAAe,KAAK,GAAK,GAAG,OAC5I,qBAAW,IAAI,CAAC,MAAM,UAAU,oBAAC,QAAiC,GAAG,QAA1B,GAAG,KAAK,CAAC,IAAI,KAAK,EAAc,CAAE,GAChF;AAEJ;AAEO,SAAS,UAAU,EAAE,MAAM,GAAG,MAAM,GAAkD;AAC3F,SAAO,oBAAC,QAAK,OAAO,MAAM,IAAI,GAAI,GAAG,OAAO;AAC9C;;;AD1BA,SAAS,OAAO,YAAY,WAAW,MAAM,QAAQ,QAAQ,cAAc;","names":[]}
package/package.json ADDED
@@ -0,0 +1,39 @@
1
+ {
2
+ "name": "@girumtech/gs-design-system-native",
3
+ "version": "0.1.4",
4
+ "description": "React Native entry point for GsDesignSystem",
5
+ "type": "module",
6
+ "sideEffects": false,
7
+ "files": [
8
+ "dist",
9
+ "README.md"
10
+ ],
11
+ "main": "./dist/index.js",
12
+ "module": "./dist/index.js",
13
+ "types": "./dist/index.d.ts",
14
+ "react-native": "./dist/index.js",
15
+ "exports": {
16
+ ".": {
17
+ "types": "./dist/index.d.ts",
18
+ "react-native": "./dist/index.js",
19
+ "import": "./dist/index.js",
20
+ "default": "./dist/index.js"
21
+ }
22
+ },
23
+ "scripts": {
24
+ "build": "tsup",
25
+ "typecheck": "tsc -p tsconfig.json"
26
+ },
27
+ "dependencies": {
28
+ "@girumtech/gs-design-system-core": "0.1.4"
29
+ },
30
+ "peerDependencies": {
31
+ "react": ">=19",
32
+ "react-native": ">=0.81",
33
+ "react-native-svg": ">=15",
34
+ "tamagui": ">=2.7.0 <3"
35
+ },
36
+ "publishConfig": {
37
+ "access": "public"
38
+ }
39
+ }