Skip to content

Commit 91fb188

Browse files
committed
feat: add select component
1 parent e252c00 commit 91fb188

20 files changed

+240
-1
lines changed

docs/ROADMAP.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ This roadmap is our plan for building a complete front-end framework. Each item
4040

4141
[ ] **Form Field:** Boxes where people type stuff or pick options.
4242

43-
[ ] **Select:** A drop-down menu to choose things.
43+
[x] **Select:** A drop-down menu to choose things.
4444

4545
[ ] **Textarea:** A big box for writing lots of stuff.
4646

package-lock.json

Lines changed: 23 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# RCK | React Select Component
2+
3+
> :warning: **WARNING**: This component library is being updated frequently and it's currently unstable due to being in it's early stages, we advice you to use only in production environments only after version **2.0.0**.
4+
5+
The React Select component in the React-CK library is a fundamental tool for empowering user interactions in React applications. It provides an elegant and user-friendly way to handle selections, offering a polished experience for users to pick from a predefined set of options.
6+
7+
Developers can utilize this component to create various types of select fields, including single and multiple selections, with customizable styles and behaviors. Dive into the customization pool and define attributes like placeholder text, default values, and option groups to tailor the select component to suit your application's needs.
8+
9+
### Installation
10+
11+
To integrate the this component into your React apps, you can install it using npm or yarn: `npm i --save @react-ck/select` or `yarn add @react-ck/select`.
12+
13+
You will also need to set up the theme provider, install it using npm or yarn: `npm i --save @react-ck/theme` or `yarn add @react-ck/theme`.
14+
15+
Wrap your app root with the theme provider and use this component:
16+
17+
```tsx
18+
import { ThemeProvider } from "@react-ck/theme";
19+
import { Select } from "@react-ck/select";
20+
21+
const myApp = () => (
22+
<ThemeProvider>
23+
<Select ... />
24+
</ThemeProvider>
25+
);
26+
```
27+
28+
<!-- storybook-ignore -->
29+
30+
---
31+
32+
Check the documentation website - [react-ck.js.org](https://react-ck.js.org).
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
extends: "@react-ck/babel-config",
3+
};
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
declare module "*.module.scss" {
2+
const content: Record<string, string>;
3+
export default content;
4+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// Hack for module resolution of non built packages
2+
export * from "./src/index";
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { config as default } from "@react-ck/jest-config";
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"name": "@react-ck/select",
3+
"private": false,
4+
"version": "1.0.0",
5+
"main": "dist/index.js",
6+
"types": "dist/index.d.ts",
7+
"files": [
8+
"/dist"
9+
],
10+
"homepage": "https://github.com/abelflopes/react-ck/tree/master/packages/components/select#readme",
11+
"repository": {
12+
"type": "git",
13+
"url": "git+https://github.com/abelflopes/react-ck.git"
14+
},
15+
"scripts": {
16+
"build": "NODE_ENV=production webpack",
17+
"lint:typescript": "tsc --noEmit",
18+
"test": "npx -y npm-run-all -s test:*",
19+
"test:unit": "jest --testPathPattern=\".unit.*\"",
20+
"test:snapshot": "jest --testPathPattern=\".snapshot.*\"",
21+
"test:snapshot:update": "jest --testPathPattern=\".snapshot.*\" -u"
22+
},
23+
"devDependencies": {
24+
"@react-ck/babel-config": "^1.0.0",
25+
"@react-ck/jest-config": "^1.0.0",
26+
"@react-ck/typescript-config": "^1.0.0",
27+
"@react-ck/webpack-config": "^1.0.0",
28+
"@types/react": "^18.2.33"
29+
},
30+
"peerDependencies": {
31+
"react": "^18.2.0"
32+
},
33+
"dependencies": {
34+
"@react-ck/scss-utils": "^1.1.2",
35+
"@react-ck/theme": "^1.3.0",
36+
"classnames": "^2.3.2"
37+
}
38+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`Snapshot Select renders correctly 1`] = `
4+
<select
5+
className="root"
6+
/>
7+
`;
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import React from "react";
2+
import { Select } from "../src/index";
3+
import renderer from "react-test-renderer";
4+
5+
describe("Snapshot Select", () => {
6+
test("renders correctly", async () => {
7+
const tree = renderer.create(<Select />).toJSON();
8+
expect(tree).toMatchSnapshot();
9+
});
10+
});

0 commit comments

Comments
 (0)