Skip to content

Commit 87d0962

Browse files
authored
Merge pull request #1139 from IgniteUI/hhristov/update-single-selection-combo-samples
feat(single-combo): update single selection combo samples
2 parents 303ff06 + fc8429c commit 87d0962

81 files changed

Lines changed: 2764 additions & 134 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎samples/inputs/combo/simplified/src/ComboData.ts‎

Lines changed: 0 additions & 33 deletions
This file was deleted.

‎samples/inputs/combo/simplified/src/index.css‎

Lines changed: 0 additions & 9 deletions
This file was deleted.

‎samples/inputs/combo/simplified/src/index.tsx‎

Lines changed: 0 additions & 42 deletions
This file was deleted.

‎samples/inputs/combo/simplified/tsconfig.json‎

Lines changed: 0 additions & 44 deletions
This file was deleted.
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
This folder contains implementation of React application with example of Single Select Disabled feature using [Combo](https://www.infragistics.com/products/ignite-ui-react/react/components/general-getting-started.html) component.
2+
3+
4+
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
5+
<body>
6+
<a target="_blank" href="https://www.infragistics.com/products/ignite-ui-react/react/components/general-getting-started.html" rel="noopener noreferrer">
7+
<img height="40px" style="border-radius: 0rem" alt="View Docs" src="https://dl.infragistics.com/x/img/browsers/button-docs.png"/>
8+
</a>
9+
<a target="_blank" href="./src/index.tsx" rel="noopener noreferrer">
10+
<img height="40px" style="border-radius: 0rem; max-width: 100%;" alt="View Code" src="https://dl.infragistics.com/x/img/browsers/button-code.png"/>
11+
</a>
12+
<a target="_blank" href="https://www.infragistics.com/react-demos/samples/inputs/combo/single-select-disabled" rel="noopener noreferrer">
13+
<img height="40px" style="border-radius: 0rem; max-width: 100%;" alt="Run Sample" src="https://dl.infragistics.com/x/img/browsers/button-run.png"/>
14+
</a>
15+
</body>
16+
</html>
17+
18+
## Branches
19+
20+
> **_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.
21+
22+
## Instructions
23+
24+
Follow these instructions to run this example:
25+
26+
27+
```
28+
git clone https://github.com/IgniteUI/igniteui-react-examples.git
29+
cd ./igniteui-react-examples
30+
git checkout master
31+
cd ./samples/inputs/combo/single-select-disabled
32+
```
33+
34+
open above folder in VS Code or type:
35+
```
36+
code .
37+
```
38+
39+
In terminal window, run:
40+
```
41+
npm install
42+
npm start
43+
```
44+
45+
Then open http://localhost:4200/ in your browser
46+
47+
48+
## Learn More
49+
50+
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: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<title>Combo Single Select Disabled</title>
5+
<link href="https://dl.infragistics.com/x/css/samples/shared.v8.css" rel="stylesheet" />
6+
</head>
7+
<body>
8+
<div id="root"></div>
9+
<script type="module" src="/src/index.tsx"></script>
10+
</body>
11+
</html>
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{
2+
"name": "react-combo-single-select-disabled",
3+
"description": "This project provides an example of Combo single select disabled using Infragistics React components",
4+
"author": "Infragistics",
5+
"homepage": ".",
6+
"version": "1.4.0",
7+
"private": true,
8+
"scripts": {
9+
"start": "vite --port 4200",
10+
"build": "tsc && node --max-old-space-size=4096 node_modules/vite/bin/vite build",
11+
"preview": "vite preview",
12+
"test": "vitest"
13+
},
14+
"dependencies": {
15+
"igniteui-dockmanager": "^2.3.0",
16+
"igniteui-react": "19.11.0",
17+
"igniteui-react-core": "19.6.0",
18+
"igniteui-webcomponents": "~7.5.0",
19+
"react": "^19.3.0",
20+
"react-dom": "^19.3.0",
21+
"tslib": "^2.4.0"
22+
},
23+
"devDependencies": {
24+
"@types/jest": "^30.0.0",
25+
"@types/node": "^24.7.1",
26+
"@types/react": "^19.3.0",
27+
"@types/react-dom": "^19.3.0",
28+
"@vitejs/plugin-react": "^6.1.1",
29+
"@vitest/browser": "^5.0.2",
30+
"typescript": "^5.9.3",
31+
"vite": "^8.3.1",
32+
"vitest": "^5.0.2",
33+
"vitest-canvas-mock": "^1.2.0",
34+
"worker-loader": "^3.0.8"
35+
},
36+
"browserslist": [
37+
">0.2%",
38+
"not dead",
39+
"not ie <= 11",
40+
"not op_mini all"
41+
]
42+
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/* shared styles are loaded from: */
2+
/* https://dl.infragistics.com/x/css/samples/shared.v8.css */
3+
4+
.sample {
5+
display: flex;
6+
align-items: center;
7+
justify-content: center;
8+
height: 100%;
9+
padding: 1rem;
10+
container-name: sample;
11+
}
12+
13+
.states {
14+
display: grid;
15+
grid-template-columns: max-content repeat(2, minmax(0, 17.4375rem));
16+
width: 100%;
17+
justify-content: center;
18+
align-items: center;
19+
column-gap: 1.75rem;
20+
row-gap: 1.5rem;
21+
}
22+
23+
.states igc-combo {
24+
width: 100%;
25+
26+
/* the list shows a group header and three options */
27+
--item-count: 4;
28+
}
29+
30+
.group-start {
31+
margin-top: 1.5rem;
32+
}
33+
34+
/* the box type looks like the border type outside the Material theme, so the other themes show
35+
the border type alone */
36+
@container sample not style(--ig-theme: material) {
37+
.box-type {
38+
display: none;
39+
}
40+
}
41+
42+
.state-label {
43+
font: 400 13px / 20px "Aktiv Grotesk", sans-serif;
44+
letter-spacing: 0.3px;
45+
color: var(--ig-gray-600);
46+
}
47+
48+
.state-column {
49+
justify-self: center;
50+
}
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
import { Fragment } from 'react';
2+
import ReactDOM from 'react-dom/client';
3+
import './index.css';
4+
import { IgrCombo } from 'igniteui-react';
5+
import 'igniteui-webcomponents/themes/light/bootstrap.css';
6+
7+
interface Country {
8+
id: string;
9+
name: string;
10+
region: string;
11+
}
12+
13+
const countries: Country[] = [
14+
{ id: 'BY', name: 'Belarus', region: 'Europe' },
15+
{ id: 'BE', name: 'Belgium', region: 'Europe' },
16+
{ id: 'BG', name: 'Bulgaria', region: 'Europe' },
17+
];
18+
19+
const rows = [
20+
{ label: 'Idle', outlined: true, className: 'border-type', value: [] as string[] },
21+
{ label: 'Filled', outlined: true, className: 'border-type', value: ['BY'] },
22+
{ label: 'Idle', outlined: false, className: 'box-type group-start', value: [] as string[] },
23+
{ label: 'Filled', outlined: false, className: 'box-type', value: ['BY'] },
24+
];
25+
26+
export default function ComboSingleSelectDisabled() {
27+
const combo = (outlined: boolean, value: string[], disabled: boolean) => (
28+
<IgrCombo
29+
singleSelect
30+
outlined={outlined}
31+
disabled={disabled}
32+
placeholder="Country"
33+
valueKey="id"
34+
displayKey="name"
35+
groupKey="region"
36+
data={countries}
37+
value={value}
38+
/>
39+
);
40+
41+
return (
42+
<div className="sample">
43+
{/* the combos are display-only, so inert blocks pointer and keyboard interaction */}
44+
<div className="states" inert>
45+
<span />
46+
<span className="state-label state-column">Enabled</span>
47+
<span className="state-label state-column">Disabled</span>
48+
{rows.map((row, index) => (
49+
<Fragment key={index}>
50+
<span className={`state-label ${row.className}`}>{row.label}</span>
51+
<div className={row.className}>{combo(row.outlined, row.value, false)}</div>
52+
<div className={row.className}>{combo(row.outlined, row.value, true)}</div>
53+
</Fragment>
54+
))}
55+
</div>
56+
</div>
57+
);
58+
}
59+
60+
// rendering above component to the React DOM
61+
const root = ReactDOM.createRoot(document.getElementById('root')!);
62+
root.render(<ComboSingleSelectDisabled/>);
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"compilerOptions": {
3+
"target": "es2020",
4+
"lib": [
5+
"es2020",
6+
"dom",
7+
"dom.iterable"
8+
],
9+
"module": "esnext",
10+
"moduleResolution": "bundler",
11+
"jsx": "react-jsx",
12+
"types": [
13+
"vite/client"
14+
],
15+
"strict": true,
16+
"resolveJsonModule": true,
17+
"isolatedModules": true,
18+
"skipLibCheck": true,
19+
"noEmit": true
20+
},
21+
"include": [
22+
"src"
23+
]
24+
}

0 commit comments

Comments
 (0)