Skip to content

Commit 326ff00

Browse files
Merge pull request #463 from IgniteUI/thristodorova/stepper-samples
Add stepper samples
2 parents 8cbdbe2 + f3581c2 commit 326ff00

36 files changed

Lines changed: 1387 additions & 0 deletions
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
// https://www.robertcooper.me/using-eslint-and-prettier-in-a-typescript-project
2+
module.exports = {
3+
parser: "@typescript-eslint/parser", // Specifies the ESLint parser
4+
parserOptions: {
5+
ecmaVersion: 2020, // Allows for the parsing of modern ECMAScript features
6+
sourceType: "module", // Allows for the use of imports
7+
ecmaFeatures: {
8+
jsx: true // Allows for the parsing of JSX
9+
}
10+
},
11+
settings: {
12+
react: {
13+
version: "999.999.999" // Tells eslint-plugin-react to automatically detect the version of React to use
14+
}
15+
},
16+
extends: [
17+
"eslint:recommended",
18+
"plugin:react/recommended", // Uses the recommended rules from @eslint-plugin-react
19+
"plugin:@typescript-eslint/recommended" // Uses the recommended rules from @typescript-eslint/eslint-plugin
20+
],
21+
rules: {
22+
// Place to specify ESLint rules. Can be used to overwrite rules specified from the extended configs
23+
"default-case": "off",
24+
"no-undef": "off",
25+
"no-unused-vars": "off",
26+
"no-extend-native": "off",
27+
"no-throw-literal": "off",
28+
"no-useless-concat": "off",
29+
"no-mixed-operators": "off",
30+
"no-prototype-builtins": "off",
31+
"prefer-const": "off",
32+
"prefer-rest-params": "off",
33+
"jsx-a11y/alt-text": "off",
34+
"jsx-a11y/iframe-has-title": "off",
35+
"@typescript-eslint/no-unused-vars": "off",
36+
"@typescript-eslint/no-explicit-any": "off",
37+
"@typescript-eslint/no-inferrable-types": "off",
38+
"@typescript-eslint/no-useless-constructor": "off",
39+
"@typescript-eslint/no-use-before-define": "off",
40+
"@typescript-eslint/no-non-null-assertion": "off",
41+
"@typescript-eslint/interface-name-prefix": "off",
42+
"@typescript-eslint/prefer-namespace-keyword": "off",
43+
"@typescript-eslint/explicit-function-return-type": "off",
44+
"@typescript-eslint/explicit-module-boundary-types": "off"
45+
},
46+
"overrides": [
47+
{
48+
"files": ["*.ts", "*.tsx"],
49+
"rules": {
50+
"default-case": "off",
51+
"no-undef": "off",
52+
"no-unused-vars": "off",
53+
"no-extend-native": "off",
54+
"no-throw-literal": "off",
55+
"no-useless-concat": "off",
56+
"no-mixed-operators": "off",
57+
"no-prototype-builtins": "off",
58+
"prefer-const": "off",
59+
"prefer-rest-params": "off",
60+
"jsx-a11y/alt-text": "off",
61+
"jsx-a11y/iframe-has-title": "off",
62+
"@typescript-eslint/no-unused-vars": "off",
63+
"@typescript-eslint/no-explicit-any": "off",
64+
"@typescript-eslint/no-inferrable-types": "off",
65+
"@typescript-eslint/no-useless-constructor": "off",
66+
"@typescript-eslint/no-use-before-define": "off",
67+
"@typescript-eslint/no-non-null-assertion": "off",
68+
"@typescript-eslint/interface-name-prefix": "off",
69+
"@typescript-eslint/prefer-namespace-keyword": "off",
70+
"@typescript-eslint/explicit-function-return-type": "off",
71+
"@typescript-eslint/explicit-module-boundary-types": "off"
72+
}
73+
}
74+
]
75+
};
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<!-- NOTE: do not change this file because it's auto re-generated from template: -->
2+
<!-- https://github.com/IgniteUI/igniteui-react-examples/tree/vnext/templates/sample/ReadMe.md -->
3+
4+
This folder contains implementation of React application with example of Group feature using [Radio](https://www.infragistics.com/products/ignite-ui-react/react/components/general-getting-started.html) component.
5+
6+
7+
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
8+
<body>
9+
<a target="_blank" href="https://www.infragistics.com/products/ignite-ui-react/react/components/general-getting-started.html" rel="noopener noreferrer">
10+
<img height="40px" style="border-radius: 0rem" alt="View Docs" src="https://github.com/IgniteUI/igniteui-blazor-examples/raw/vnext/templates/sample/images/button-docs.png"/>
11+
</a>
12+
<a target="_blank" href="./src/index.tsx" rel="noopener noreferrer">
13+
<img height="40px" style="border-radius: 0rem; max-width: 100%;" alt="View Code" src="https://github.com/IgniteUI/igniteui-blazor-examples/raw/vnext/templates/sample/images/button-code.png"/>
14+
</a>
15+
<a target="_blank" href="https://www.infragistics.com/react-demos/samples/inputs/radio/group" rel="noopener noreferrer">
16+
<img height="40px" style="border-radius: 0rem; max-width: 100%;" alt="Run Sample" src="https://github.com/IgniteUI/igniteui-blazor-examples/raw/vnext/templates/sample/images/button-run.png"/>
17+
</a>
18+
<a target="_blank" href="https://codesandbox.io/s/github/IgniteUI/igniteui-react-examples/tree/master/samples/inputs/radio/group?fontsize=14&hidenavigation=1&theme=dark&view=preview&file=/src/index.tsx" rel="noopener noreferrer">
19+
<img height="40px" style="border-radius: 0rem; max-width: 100%;" alt="Run Sample" src="https://github.com/IgniteUI/igniteui-blazor-examples/raw/vnext/templates/sample/images/button-sandbox.png"/>
20+
</a>
21+
</body>
22+
</html>
23+
24+
## Branches
25+
26+
> **_NOTE:_** You should use [master](https://github.com/IgniteUI/igniteui-react-examples/tree/master) branch of this repository if you want to run samples on your computer. Use the [vnext](https://github.com/IgniteUI/igniteui-react-examples/tree/vnext) branch only when you want to contribute new samples to this repository.
27+
28+
## Instructions
29+
30+
Follow these instructions to run this example:
31+
32+
33+
```
34+
git clone https://github.com/IgniteUI/igniteui-react-examples.git
35+
git checkout master
36+
cd ./igniteui-react-examples
37+
cd ./samples/inputs/radio/group
38+
```
39+
40+
open above folder in VS Code or type:
41+
```
42+
code .
43+
```
44+
45+
In terminal window, run:
46+
```
47+
npm install --legacy-peer-deps
48+
npm run-script start
49+
```
50+
51+
Then open http://localhost:4200/ in your browser
52+
53+
54+
## Learn More
55+
56+
To learn more about **Ignite UI for React** components, check out the [React documentation](https://www.infragistics.com/products/ignite-ui-react/react/components/general-getting-started.html).
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"name": "react-radio-group",
3+
"description": "This project provides example of Radio Group using Infragistics React components",
4+
"author": "Infragistics",
5+
"homepage": ".",
6+
"version": "1.4.0",
7+
"private": true,
8+
"scripts": {
9+
"start": "set PORT=4200 && react-scripts --max_old_space_size=10240 start",
10+
"build": "react-scripts --max_old_space_size=10240 build ",
11+
"test": "react-scripts test --env=jsdom",
12+
"eject": "react-scripts eject"
13+
},
14+
"dependencies": {
15+
"igniteui-dockmanager": "1.14.2",
16+
"igniteui-react": "18.5.1",
17+
"igniteui-react-core": "18.5.1",
18+
"react": "^18.2.0",
19+
"react-dom": "^18.2.0",
20+
"react-scripts": "^5.0.1",
21+
"tslib": "^2.4.0"
22+
},
23+
"devDependencies": {
24+
"@types/jest": "^29.2.0",
25+
"@types/node": "^18.11.7",
26+
"@types/react": "^18.0.24",
27+
"@types/react-dom": "^18.0.8",
28+
"react-app-rewired": "^2.2.1",
29+
"typescript": "^4.8.4",
30+
"worker-loader": "^3.0.8"
31+
},
32+
"browserslist": [
33+
">0.2%",
34+
"not dead",
35+
"not ie <= 11",
36+
"not op_mini all"
37+
]
38+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<title>StepperAnimations</title>
5+
<link href="https://static.infragistics.com/xplatform/css/samples/shared.v8.css" rel="stylesheet" />
6+
</head>
7+
<body>
8+
<div id="root"></div>
9+
</body>
10+
</html>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"infiniteLoopProtection": false,
3+
"hardReloadOnChange": false,
4+
"view": "browser"
5+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/* shared styles are loaded from: */
2+
/* https://static.infragistics.com/xplatform/css/samples */
3+
4+
.settings {
5+
display: grid;
6+
grid-template-columns: repeat(4, 1fr);
7+
gap: 1.125rem;
8+
background: hsl(var(--ig-gray-100));
9+
padding: 1.125rem;
10+
border: 1px solid hsl(var(--ig-gray-300));
11+
border-radius: .25rem;
12+
margin-bottom: 2rem;
13+
}
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
import React from 'react';
2+
import ReactDOM from 'react-dom/client';
3+
import './index.css';
4+
import {
5+
IgrStepper, IgrStep, IgrStepperModule, IgrRadio, IgrRadioGroup, IgrRadioModule, IgrRadioGroupModule,
6+
IgrButton, IgrButtonModule, IgrInput, IgrInputModule, IgrSelect, IgrSelectItem, IgrSelectModule, IgrDropdown,
7+
IgrDropdownItemComponentEventArgs, IgrComponentValueChangedEventArgs
8+
} from 'igniteui-react';
9+
import 'igniteui-webcomponents/themes/light/bootstrap.css';
10+
11+
IgrStepperModule.register();
12+
IgrInputModule.register();
13+
IgrRadioModule.register();
14+
IgrRadioGroupModule.register();
15+
IgrButtonModule.register();
16+
IgrSelectModule.register();
17+
18+
export default class StepperAnimations extends React.Component<any, any> {
19+
private stepperRef = React.createRef<IgrStepper>();
20+
constructor(props: any) {
21+
super(props);
22+
this.state = { orientation: 'horizontal', horizontalAnimation: 'slide', verticalAnimation: 'grow', animationDuration: "320" };
23+
this.orientationChange = this.orientationChange.bind(this);
24+
this.horizontalAnimationChange = this.horizontalAnimationChange.bind(this);
25+
this.verticalAnimationChange = this.verticalAnimationChange.bind(this);
26+
this.animationDurationChange = this.animationDurationChange.bind(this);
27+
}
28+
29+
public render(): JSX.Element {
30+
return (
31+
<div className="container sample">
32+
<article className="settings">
33+
<IgrSelect label="Orienation" change={this.orientationChange}>
34+
<IgrSelectItem key="horizontal-item" value="horizontal" selected><span key="horizontal">Horizontal</span></IgrSelectItem>
35+
<IgrSelectItem key="vertical-item" value="vertical"><span key="vertical">Vertical</span></IgrSelectItem>
36+
</IgrSelect>
37+
<IgrSelect label="Vertical Animation" change={this.horizontalAnimationChange}>
38+
<IgrSelectItem key="grow-item" value="grow" selected><span key="grow">Grow</span></IgrSelectItem>
39+
<IgrSelectItem key="vertical-fade-item" value="fade"><span key="vertical-fade">Fade</span></IgrSelectItem>
40+
<IgrSelectItem key="vertical-none-item" value="none" selected><span key="vertical-none">None</span></IgrSelectItem>
41+
</IgrSelect>
42+
<IgrSelect label="Horizontal Animation" change={this.verticalAnimationChange}>
43+
<IgrSelectItem key="slide-item" value="slide" selected><span key="slide">Slide</span></IgrSelectItem>
44+
<IgrSelectItem key="horizontal-fade-item" value="fade"><span key="horizontal-fade">Fade</span></IgrSelectItem>
45+
<IgrSelectItem key="horizontal-none-item" value="none" selected><span key="horizontal-none">None</span></IgrSelectItem>
46+
</IgrSelect>
47+
<IgrInput type="number" value="320" label="Duration" change={this.animationDurationChange}>
48+
<span key="duration-suffix" slot="suffix">ms</span>
49+
</IgrInput>
50+
</article>
51+
52+
{/* TO DO: bind the animation properties when they are available */}
53+
<IgrStepper ref={this.stepperRef} orientation={this.state.orientation} >
54+
<IgrStep key="info">
55+
<span key="info-title" slot="title">Personal Info</span>
56+
<form key="info-form">
57+
<IgrInput key="full-name" label="Full Name" type="text" name="fullName"></IgrInput>
58+
<IgrInput key="email" label="Email" type="email" name="email"></IgrInput>
59+
60+
<IgrButton key="info-next" clicked={() => { this.stepperRef.current.next(); }}><span>NEXT</span></IgrButton>
61+
</form>
62+
</IgrStep>
63+
<IgrStep key="address">
64+
<span key="address-title" slot="title">Delivery address</span>
65+
<form key="address-form">
66+
<IgrInput key="city" label="City" type="text" name="city"></IgrInput>
67+
<IgrInput key="street" label="Street" type="text" name="street"></IgrInput>
68+
69+
<IgrButton key="address-prev" clicked={() => { this.stepperRef.current.prev(); }}><span>PREVIOUS</span></IgrButton>
70+
<IgrButton key="address-next" clicked={() => { this.stepperRef.current.next(); }}><span>NEXT</span></IgrButton>
71+
</form>
72+
</IgrStep>
73+
<IgrStep key="payment">
74+
<span key="payment-title" slot="title">Payment</span>
75+
<IgrRadioGroup key="payment-options">
76+
<IgrRadio key="pay-pal-radio" name="payment" checked><span key="pay-pal">PayPal (n@mail.com; 18/02/2021)</span></IgrRadio>
77+
<IgrRadio key="visa-radio" name="payment"><span key="visa">Visa (**** **** **** 1234; 12/23)</span></IgrRadio>
78+
<IgrRadio key="master-card-radio" name="payment"><span key="master-card">MasterCard (**** **** **** 5678; 12/24)</span></IgrRadio>
79+
</IgrRadioGroup>
80+
81+
<IgrButton key="payment-prev" clicked={() => { this.stepperRef.current.prev(); }}><span>PREVIOUS</span></IgrButton>
82+
<IgrButton key="payment-next" clicked={() => { this.stepperRef.current.next(); }}><span>SUBMIT</span></IgrButton>
83+
</IgrStep>
84+
<IgrStep key="status">
85+
<span key="status-title" slot="title">Delivery status</span>
86+
<p key="status-text">Your order is on its way. Expect delivery on 25th September 2021. Delivery address: San Jose, CA 94243.</p>
87+
88+
<IgrButton key="status-prev" clicked={() => { this.stepperRef.current.prev(); }}><span>PREVIOUS</span></IgrButton>
89+
<IgrButton key="status-reset" clicked={() => { this.stepperRef.current.reset(); }}><span>RESET</span></IgrButton>
90+
</IgrStep>
91+
</IgrStepper>
92+
</div>
93+
);
94+
}
95+
96+
public orientationChange(s: IgrDropdown, e: IgrDropdownItemComponentEventArgs){
97+
const selectedValue = e.detail.value;
98+
this.setState({orientation: selectedValue});
99+
}
100+
public horizontalAnimationChange(s: IgrDropdown, e: IgrDropdownItemComponentEventArgs){
101+
const selectedValue = e.detail.value;
102+
this.setState({horizontalAnimation: selectedValue});
103+
}
104+
public verticalAnimationChange(s: IgrDropdown, e: IgrDropdownItemComponentEventArgs){
105+
const selectedValue = e.detail.value;
106+
this.setState({verticalAnimation: selectedValue});
107+
}
108+
public animationDurationChange(s: IgrInput, e: IgrComponentValueChangedEventArgs){
109+
const animationDuration = e.detail;
110+
this.setState({animationDuration: animationDuration});
111+
}
112+
}
113+
114+
// rendering above class to the React DOM
115+
const root = ReactDOM.createRoot(document.getElementById('root'));
116+
root.render(<StepperAnimations />);
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/// <reference types="react-scripts" />
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{
2+
"compilerOptions": {
3+
"resolveJsonModule": true,
4+
"esModuleInterop": true,
5+
"baseUrl": ".",
6+
"outDir": "build/dist",
7+
"module": "esnext",
8+
"target": "es5",
9+
"lib": [
10+
"es6",
11+
"dom"
12+
],
13+
"sourceMap": true,
14+
"allowJs": true,
15+
"jsx": "react",
16+
"moduleResolution": "node",
17+
"rootDir": "src",
18+
"forceConsistentCasingInFileNames": true,
19+
"noImplicitReturns": true,
20+
"noImplicitThis": true,
21+
"noImplicitAny": true,
22+
"noUnusedLocals": false,
23+
"importHelpers": true,
24+
"suppressImplicitAnyIndexErrors": true,
25+
"allowSyntheticDefaultImports": true,
26+
"skipLibCheck": true,
27+
"strict": false,
28+
"isolatedModules": true,
29+
"noEmit": true
30+
},
31+
"exclude": [
32+
"node_modules",
33+
"build",
34+
"scripts",
35+
"acceptance-tests",
36+
"webpack",
37+
"jest",
38+
"src/setupTests.ts",
39+
"**/odatajs-4.0.0.js",
40+
"config-overrides.js"
41+
],
42+
"include": [
43+
"src"
44+
]
45+
}

0 commit comments

Comments
 (0)