Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/Wizleap-Inc/wiz-ui into cho…
Browse files Browse the repository at this point in the history
…re/input-disabled-color
  • Loading branch information
ichi-h committed Oct 31, 2024
2 parents c8a907d + b3ba477 commit f9178c8
Show file tree
Hide file tree
Showing 168 changed files with 4,535 additions and 1,690 deletions.
4 changes: 4 additions & 0 deletions examples/react/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"root": true,
"extends": ["../../.eslintrc.json", "../../.eslintrc.react.json"]
}
24 changes: 24 additions & 0 deletions examples/react/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
17 changes: 17 additions & 0 deletions examples/react/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# @wizleap-inc/wiz-ui-example-react

## 1.0.0

### Major Changes

- [#1366](https://github.com/Wizleap-Inc/wiz-ui/pull/1366) [`022fd19b634b91733ad32d6eeeb1725dcdbe8fd2`](https://github.com/Wizleap-Inc/wiz-ui/commit/022fd19b634b91733ad32d6eeeb1725dcdbe8fd2) Thanks [@RyushiAok](https://github.com/RyushiAok)! - feat(input): value の generics 対応

- (BREAKING) WizSelectBox, WizSearchInput, WizSearchSelector の value に generics 対応
- 基本的には props で渡した options や value の型から T が推論される
- ただし、`typeof WizSelectBox`, `typeof WizSearchInput`, `typeof WizSearchSelector` のように指定している場合、T が unknown の型が得られるため、`typeof WizSelectBox<number>`, `typeof WizSearchInput<number>`, `typeof WizSearchSelector<number>` と指定する必要がある

### Patch Changes

- Updated dependencies [[`d0e8556a47433c4e40226fe171b638e593103061`](https://github.com/Wizleap-Inc/wiz-ui/commit/d0e8556a47433c4e40226fe171b638e593103061), [`022fd19b634b91733ad32d6eeeb1725dcdbe8fd2`](https://github.com/Wizleap-Inc/wiz-ui/commit/022fd19b634b91733ad32d6eeeb1725dcdbe8fd2)]:
- @wizleap-inc/wiz-ui-react@1.0.0
- @wizleap-inc/wiz-ui-constants@0.32.0
27 changes: 27 additions & 0 deletions examples/react/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# React + TypeScript + Vite

This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.

Currently, two official plugins are available:

- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh

## Expanding the ESLint configuration

If you are developing a production application, we recommend updating the configuration to enable type aware lint rules:

- Configure the top-level `parserOptions` property like this:

```js
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
project: ['./tsconfig.json', './tsconfig.node.json'],
tsconfigRootDir: __dirname,
},
```

- Replace `plugin:@typescript-eslint/recommended` to `plugin:@typescript-eslint/recommended-type-checked` or `plugin:@typescript-eslint/strict-type-checked`
- Optionally add `plugin:@typescript-eslint/stylistic-type-checked`
- Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and add `plugin:react/recommended` & `plugin:react/jsx-runtime` to the `extends` list
13 changes: 13 additions & 0 deletions examples/react/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Wiz UI Playground in React</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
26 changes: 26 additions & 0 deletions examples/react/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"name": "@wizleap-inc/wiz-ui-example-react",
"private": true,
"version": "1.0.0",
"type": "module",
"scripts": {
"dev": "vite --host",
"build": "tsc && vite build",
"preview": "vite preview"
},
"dependencies": {
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router-dom": "^6.22.3",
"@wizleap-inc/wiz-ui-constants": "workspace:",
"@wizleap-inc/wiz-ui-react": "workspace:",
"@wizleap-inc/wiz-ui-utils": "workspace:"
},
"devDependencies": {
"@types/react": "^18.0.31",
"@types/react-dom": "^18.2.25",
"@vitejs/plugin-react": "^4.3.1",
"typescript": "^5.0.2",
"vite": "^5.3.5"
}
}
1 change: 1 addition & 0 deletions examples/react/public/vite.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions examples/react/src/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { AppRoutes } from "./routes";

function App() {
return <AppRoutes />;
}

export default App;
1 change: 1 addition & 0 deletions examples/react/src/assets/react.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
102 changes: 102 additions & 0 deletions examples/react/src/components/layout/navigation/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
import {
WizAnchor,
WizIAssignment,
WizIBusinessCenter,
WizIChat,
WizIDashboard,
WizIHelp,
WizIOpenInNew,
WizNavigationContainer,
WizNavigationItem,
WizVStack,
} from "@wizleap-inc/wiz-ui-react";

const navItems = [
{
icon: WizIDashboard,
label: "Home",
href: "/",
},
{
icon: WizIAssignment,
label: "About",
href: "/about",
},
{
icon: WizIBusinessCenter,
label: "Contact",
href: "/contact",
},
{
icon: WizIChat,
label: "Chat",
href: "/chat",
},
{
icon: WizIHelp,
label: "Help",
href: "https://wizleap.co.jp",
},
];

const Footer = () => (
<WizVStack>
<WizAnchor
href="https://wizleap.co.jp"
icon={WizIOpenInNew}
iconPosition="right"
color="gray.700"
fontSize="sm"
openInNewTab
nowrap
>
会社概要
</WizAnchor>
<WizAnchor
href="https://wizleap.co.jp/services/"
icon={WizIOpenInNew}
iconPosition="right"
color="gray.700"
fontSize="sm"
openInNewTab
nowrap
>
サービス
</WizAnchor>
<WizAnchor
href="https://wizleap.co.jp/news/"
icon={WizIOpenInNew}
iconPosition="right"
color="gray.700"
fontSize="sm"
openInNewTab
nowrap
>
ニュース
</WizAnchor>
</WizVStack>
);

type NavigationProps = {
isOpen: boolean;
};

export const Navigation = ({ isOpen }: NavigationProps) => {
return (
<WizNavigationContainer
style={{ display: "flex", height: "90vh" }}
isOpen={isOpen}
footer={<Footer />}
>
{navItems.map((path) => (
<WizNavigationItem
key={`path-${path.label}`}
icon={path.icon}
label={path.label}
href={path.href}
active={false}
/>
))}
</WizNavigationContainer>
);
};
4 changes: 4 additions & 0 deletions examples/react/src/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
body {
margin: 0;
overflow-y: scroll;
}
13 changes: 13 additions & 0 deletions examples/react/src/main.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import React from "react";
import ReactDOM from "react-dom/client";

import "@wizleap-inc/wiz-ui-react/dist/style.css";
import App from "./App.tsx";
import "./index.css";

// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
ReactDOM.createRoot(document.getElementById("root")!).render(
<React.StrictMode>
<App />
</React.StrictMode>
);
7 changes: 7 additions & 0 deletions examples/react/src/pages/about/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export const About = () => {
return (
<div>
<h1>About</h1>
</div>
);
};
7 changes: 7 additions & 0 deletions examples/react/src/pages/chat/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export const Chat = () => {
return (
<div>
<h1>Chat</h1>
</div>
);
};
7 changes: 7 additions & 0 deletions examples/react/src/pages/contact/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export const Contact = () => {
return (
<div>
<h1>Contact</h1>
</div>
);
};
7 changes: 7 additions & 0 deletions examples/react/src/pages/help/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export const Help = () => {
return (
<div>
<h1>Help</h1>
</div>
);
};
24 changes: 24 additions & 0 deletions examples/react/src/pages/home/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { WizVStack } from "@wizleap-inc/wiz-ui-react";

import { SearchInputNum, SearchInputStr } from "./selects/search-input";
import {
SearchSelectorNum,
SearchSelectorStr,
} from "./selects/search-selector";
import { SelectBoxNum, SelectBoxStr } from "./selects/selectbox";

export const Home = () => {
return (
<div>
<h1>Home</h1>
<WizVStack>
<SearchSelectorNum />
<SearchSelectorStr />
<SearchInputNum />
<SearchInputStr />
<SelectBoxNum />
<SelectBoxStr />
</WizVStack>
</div>
);
};
42 changes: 42 additions & 0 deletions examples/react/src/pages/home/selects/search-input.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { WizSearchInput } from "@wizleap-inc/wiz-ui-react";
import { useState } from "react";

const normalOptions = [
{ label: "Option 1", value: 1 },
{ label: "Option 2", value: 2 },
{ label: "Option 3", value: 3 },
];

export const SearchInputNum = () => {
const [values, setValues] = useState<number[]>([]);
return (
<div>
<div>Selected number values: [{values.join(", ")}]</div>
<WizSearchInput
options={normalOptions}
values={values}
onChangeValues={(changed) => setValues(changed)}
/>
</div>
);
};

export const SearchInputStr = () => {
const stringOptions = normalOptions.map((option) => ({
...option,
value: option.value.toString().padStart(4, "0"),
}));

const [values, setValues] = useState<string[]>([]);

return (
<div>
<div>Selected string values: [{values.join(", ")}]</div>
<WizSearchInput
options={stringOptions}
values={values}
onChangeValues={(changed) => setValues(changed)}
/>
</div>
);
};
Loading

0 comments on commit f9178c8

Please sign in to comment.