cpk-ui 0.1.0 → 0.1.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
@@ -2,25 +2,164 @@
2
2
 
3
3
  React Native UI components for [Expo](https://expo.dev).
4
4
 
5
- [![Npm Version](http://img.shields.io/npm/v/CPK-UI.svg?style=flat-square)](https://npmjs.org/package/CPK-UI)
6
- [![Downloads](http://img.shields.io/npm/dm/CPK-UI.svg?style=flat-square)](https://npmjs.org/package/CPK-UI)
7
- [![CI](https://github.com/crossplatformkorea/CPK-UI/actions/workflows/ci.yml/badge.svg)](https://github.com/crossplatformkorea/CPK-UI/actions/workflows/ci.yml)
5
+ [![Npm Version](http://img.shields.io/npm/v/cpk-ui.svg?style=flat-square)](https://npmjs.org/package/cpk-ui)
6
+ [![Downloads](http://img.shields.io/npm/dm/cpk-ui.svg?style=flat-square)](https://npmjs.org/package/cpk-ui)
7
+ [![CI](https://github.com/crossplatformkorea/cpk-ui/actions/workflows/ci.yml/badge.svg)](https://github.com/crossplatformkorea/cpk-ui/actions/workflows/ci.yml)
8
8
  [![codecov](https://codecov.io/gh/crossplatformkorea/cpk-ui/graph/badge.svg?token=LWZI4U369L)](https://codecov.io/gh/crossplatformkorea/cpk-ui)
9
- [![Publish](https://github.com/crossplatformkorea/CPK-UI/actions/workflows/publish.yml/badge.svg)](https://github.com/crossplatformkorea/CPK-UI/actions/workflows/publish.yml)
9
+ [![Publish](https://github.com/crossplatformkorea/cpk-ui/actions/workflows/publish.yml/badge.svg)](https://github.com/crossplatformkorea/cpk-ui/actions/workflows/publish.yml)
10
10
  [![Sponsor](https://opencollective.com/crossplatformkorea/tiers/badge.svg?style=shield)](https://opencollective.com/crossplatformkorea/tiers/badge.svg)
11
11
 
12
- <img src="https://private-user-images.githubusercontent.com/27461460/398448953-c31ac1c2-cc0e-4f13-a542-c35045c266cd.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzUwNTk1ODcsIm5iZiI6MTczNTA1OTI4NywicGF0aCI6Ii8yNzQ2MTQ2MC8zOTg0NDg5NTMtYzMxYWMxYzItY2MwZS00ZjEzLWE1NDItYzM1MDQ1YzI2NmNkLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDEyMjQlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQxMjI0VDE2NTQ0N1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTcxN2ExN2YwZTEzZWEzZmVmZmQ4NDQ2OGJhN2E5ODIyZWI4MjJiM2RhNzI3YTRmZDYzNWZjODU5ZmJiZWJhY2MmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.QUUg_5gLMfBXDxQybO9ZA4zTS8no_0ZqXlFXEvuUhmk" width="320"/>
12
+ <img src="https://github.com/user-attachments/assets/c31ac1c2-cc0e-4f13-a542-c35045c266cd" width="320"/>
13
13
 
14
- ## Documentation
14
+ ## Demo
15
15
 
16
16
  Check out [ui.crossplatformkorea.com](https://ui.crossplatformkorea.com)
17
17
 
18
- > Not all ui components are written in documents. Currently working :construction_worker:. Please see the [Demo](https://github.com/ui.crossplatformkorea/CPK-UI#demo) to see all components.
18
+ ## Introduction
19
19
 
20
- ## Demo
20
+ `cpk-ui` is a foundational design system and UI components library managed by Cross-Platform Korea. It is built using our preferred technologies, including [emotion](https://emotion.sh/docs/@emotion/native), [typescript](https://www.typescriptlang.org/), [jest](https://jestjs.io), [react-native-testing-library](https://github.com/callstack/react-native-testing-library), [expo](https://expo.io), and [storybook](https://storybook.js.org).
21
+
22
+ ### Philosophy
23
+
24
+ `cpk-ui` aims to provide user-friendly, lightweight, and adaptable UI components. It emphasizes customizable `theme` variations and a responsive layout to enhance developer experience.
25
+
26
+ ### Installation
27
+
28
+ #### For Expo
29
+
30
+ ```sh
31
+ expo install cpk-ui @emotion/react @emotion/native @expo/vector-icons react-native-gesture-handler react-native-svg expo-screen-orientation @expo/match-media
32
+ ```
33
+
34
+ #### For React Native CLI
35
+
36
+ ```sh
37
+ # Using yarn
38
+ yarn add cpk-ui @emotion/react @emotion/native @expo/vector-icons react-native-gesture-handler react-native-svg expo-screen-orientation @expo/match-media
39
+
40
+ # Install expo modules
41
+ npx install-expo-modules@latest
42
+ ```
43
+
44
+ ### Usage
45
+
46
+ We focus on supporting `iOS`, `Android`, and `web` platforms, enabling [expo](https://expo.io) users to write efficient and reliable cross-platform code. For more insights into the project’s direction, refer to the [cpk-ui strategy](https://github.com/hyochan/cpk-ui/issues).
47
+
48
+ ```tsx
49
+ import {CpkProvider} from 'cpk-ui';
50
+
51
+ <CpkProvider>
52
+ <App />
53
+ </CpkProvider>;
54
+ ```
55
+
56
+ ## Theming
57
+
58
+ > The embedded `theme` module functionality provides the ability to create `light` and `dark` themes.
59
+
60
+ ### Customizing Theme
61
+
62
+ #### 1. Define colors for `light` and `dark` theme
63
+
64
+ The `light` and `dark` theme color definitions are provided as examples above. They are objects that contain color properties for different UI components and states.
65
+
66
+ #### 2. Integrating with `CpkProvider`
67
+
68
+ When integrating with `CpkProvider`, you will provide your defined light and dark themes as the custom theme:
69
+
70
+ ```tsx
71
+ <CpkProvider customTheme={{light, dark}}>
72
+ <App />
73
+ </CpkProvider>
74
+ ```
75
+
76
+ ### Fonts
77
+
78
+ `cpk-ui` uses [Pretendard](https://github.com/orioncactus/pretendard) as its default font. The fonts are automatically installed with `cpk-ui`, but you must confirm they are loaded using `assetLoaded` from `useCPK`.
79
+
80
+ ```tsx
81
+ import {useCPK} from 'cpk-ui';
82
+
83
+ const {assetLoaded} = useCPK();
84
+
85
+ if (!assetLoaded) {
86
+ return <Loading />;
87
+ }
88
+
89
+ return <Main />;
90
+ ```
91
+
92
+ ### Icons
93
+
94
+ Integrate [Phosphoricons](https://phosphoricons.com) easily using the `Icon` component.
95
+
96
+ ```tsx
97
+ import {Icon} from 'cpk-ui';
98
+
99
+ <Icon name="..." color="#AAA" size={32} />;
100
+ ```
101
+
102
+ ### Installing Fonts (Recommended)
103
+
104
+ `cpk-ui` uses [Pretendard](https://github.com/orioncactus/pretendard) as its default font. The font families include `Pretendard`, `Pretendard-Bold`, and `Pretendard-Thin`. From version `0.2.1`, these fonts are automatically installed when you add `cpk-ui`. However, it is important to ensure that the fonts are loaded properly using `assetLoaded` from the `CpkProvider`.
105
+
106
+ ```tsx
107
+ import {useCPK} from 'cpk-ui';
108
+
109
+ const {assetLoaded} = useCPK();
110
+
111
+ if (!assetLoaded) {
112
+ // Render loading state
113
+ return ...;
114
+ }
115
+
116
+ return <Main/>
117
+ ```
118
+
119
+ ### Compatibility
120
+
121
+ | Package | Version |
122
+ | :----------------: | :------: |
123
+ | react | >=16.13 |
124
+ | react-native | >=0.58 |
125
+ | emotion | >=11.0.0 |
126
+ | emotion/react | >=11.0.0 |
127
+ | emotion/native | >=11.0.0 |
128
+ | @expo/vector-icons | \* |
129
+
130
+ ### Troubleshooting
131
+
132
+ #### Resolving Issues with "cpk-ui" on Expo Web
133
+
134
+ If you encounter errors when using "cpk-ui" with expo-web, follow these steps to configure webpack:
135
+
136
+ 1. **Install `@expo/webpack-config`**
137
+
138
+ ```sh
139
+ yarn add @expo/webpack-config
140
+ ```
141
+
142
+ 2. **Configure Webpack**
143
+
144
+ Create a `webpack.config.js` file in your project root and add the following configuration:
145
+
146
+ ```javascript
147
+ const createExpoWebpackConfigAsync = require('@expo/webpack-config');
21
148
 
22
- You can see live example at [https://crossplatformkorea.github.io/CPK-UI](https://crossplatformkorea.github.io/CPK-UI).
149
+ module.exports = async function (env, argv) {
150
+ const config = await createExpoWebpackConfigAsync(
151
+ {
152
+ ...env,
153
+ babel: {
154
+ dangerouslyAddModulePathsToTranspile: ['cpk-ui'],
155
+ },
156
+ },
157
+ argv,
158
+ );
159
+ return config;
160
+ };
161
+ ```
23
162
 
24
- To run the storybook in your local environments. Follow [Contributing Guide](./Contributing).
163
+ ### Contributing
25
164
 
26
- > `Documentation` is not identical to `Demo`. `Demo` is just a playground whereas `documentation` is for the customers. Documentations are missing many features yet.
165
+ Read the [Contributing Guide](./CONTRIBUTING.md) before submitting pull requests. Thank you to everyone contributing to this project!
@@ -21,7 +21,7 @@ export type SnackbarType =
21
21
  | 'danger';
22
22
 
23
23
  // 기본 theme 설정 함수
24
- const resolveTheme = (theme?: CpkTheme) =>
24
+ const resolveTheme = (theme?: CpkTheme & any) =>
25
25
  isEmptyObject(theme) ? light : theme!;
26
26
 
27
27
  // ButtonWrapper Component
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cpk-ui",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "main": "index",
5
5
  "react-native": "index",
6
6
  "module": "index",