Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "Node.js",
"image": "mcr.microsoft.com/devcontainers/javascript-node:22"
}
75 changes: 75 additions & 0 deletions samples/inputs/highlight/helper-text/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
// https://www.robertcooper.me/using-eslint-and-prettier-in-a-typescript-project
module.exports = {
parser: "@typescript-eslint/parser", // Specifies the ESLint parser
parserOptions: {
ecmaVersion: 2020, // Allows for the parsing of modern ECMAScript features
sourceType: "module", // Allows for the use of imports
ecmaFeatures: {
jsx: true // Allows for the parsing of JSX
}
},
settings: {
react: {
version: "999.999.999" // Tells eslint-plugin-react to automatically detect the version of React to use
}
},
extends: [
"eslint:recommended",
"plugin:react/recommended", // Uses the recommended rules from @eslint-plugin-react
"plugin:@typescript-eslint/recommended" // Uses the recommended rules from @typescript-eslint/eslint-plugin
],
rules: {
// Place to specify ESLint rules. Can be used to overwrite rules specified from the extended configs
"default-case": "off",
"no-undef": "off",
"no-unused-vars": "off",
"no-extend-native": "off",
"no-throw-literal": "off",
"no-useless-concat": "off",
"no-mixed-operators": "off",
"no-prototype-builtins": "off",
"prefer-const": "off",
"prefer-rest-params": "off",
"jsx-a11y/alt-text": "off",
"jsx-a11y/iframe-has-title": "off",
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-inferrable-types": "off",
"@typescript-eslint/no-useless-constructor": "off",
"@typescript-eslint/no-use-before-define": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/interface-name-prefix": "off",
"@typescript-eslint/prefer-namespace-keyword": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/explicit-module-boundary-types": "off"
},
"overrides": [
{
"files": ["*.ts", "*.tsx"],
"rules": {
"default-case": "off",
"no-undef": "off",
"no-unused-vars": "off",
"no-extend-native": "off",
"no-throw-literal": "off",
"no-useless-concat": "off",
"no-mixed-operators": "off",
"no-prototype-builtins": "off",
"prefer-const": "off",
"prefer-rest-params": "off",
"jsx-a11y/alt-text": "off",
"jsx-a11y/iframe-has-title": "off",
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-inferrable-types": "off",
"@typescript-eslint/no-useless-constructor": "off",
"@typescript-eslint/no-use-before-define": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/interface-name-prefix": "off",
"@typescript-eslint/prefer-namespace-keyword": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/explicit-module-boundary-types": "off"
}
}
]
};
56 changes: 56 additions & 0 deletions samples/inputs/highlight/helper-text/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<!-- NOTE: do not change this file because it's auto re-generated from template: -->
<!-- https://github.com/IgniteUI/igniteui-react-examples/tree/vnext/templates/sample/ReadMe.md -->

This folder contains implementation of React application with example of Helper Text feature using [Highlight](https://www.infragistics.com/products/ignite-ui-react/react/components/general-getting-started.html) component.


<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<body>
<a target="_blank" href="https://www.infragistics.com/products/ignite-ui-react/react/components/general-getting-started.html" rel="noopener noreferrer">
<img height="40px" style="border-radius: 0rem" alt="View Docs" src="https://dl.infragistics.com/x/img/browsers/button-docs.png"/>
</a>
<a target="_blank" href="./src/index.tsx" rel="noopener noreferrer">
<img height="40px" style="border-radius: 0rem; max-width: 100%;" alt="View Code" src="https://dl.infragistics.com/x/img/browsers/button-code.png"/>
</a>
<a target="_blank" href="https://www.infragistics.com/react-demos/samples/inputs/highlight/helper-text" rel="noopener noreferrer">
<img height="40px" style="border-radius: 0rem; max-width: 100%;" alt="Run Sample" src="https://dl.infragistics.com/x/img/browsers/button-run.png"/>
</a>
<a target="_blank" href="https://codesandbox.io/s/github/IgniteUI/igniteui-react-examples/tree/master/samples/inputs/highlight/helper-text?fontsize=14&hidenavigation=1&theme=dark&view=preview&file=/src/index.tsx" rel="noopener noreferrer">
<img height="40px" style="border-radius: 0rem; max-width: 100%;" alt="Run Sample" src="https://dl.infragistics.com/x/img/browsers/button-sandbox.png"/>
</a>
</body>
</html>

## Branches

> **_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.

## Instructions

Follow these instructions to run this example:


```
git clone https://github.com/IgniteUI/igniteui-react-examples.git
git checkout master
cd ./igniteui-react-examples
cd ./samples/inputs/highlight/helper-text
```

open above folder in VS Code or type:
```
code .
```

In terminal window, run:
```
npm install --legacy-peer-deps
npm run-script start
```

Then open http://localhost:4200/ in your browser


## Learn More

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).
11 changes: 11 additions & 0 deletions samples/inputs/highlight/helper-text/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Highlight Helper Text</title>
<link href="https://dl.infragistics.com/x/css/samples/shared.v8.css" rel="stylesheet" />
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/index.tsx"></script>
</body>
</html>
42 changes: 42 additions & 0 deletions samples/inputs/highlight/helper-text/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"name": "react-highlight-helper-text",
"description": "This project provides example of Highlight Helper Text using Infragistics React components",
"author": "Infragistics",
"homepage": ".",
"version": "1.4.0",
"private": true,
"scripts": {
"start": "vite --port 4200",
"build": "tsc && node --max-old-space-size=4096 node_modules/vite/bin/vite build",
"preview": "vite preview",
"test": "vitest"
},
"dependencies": {
"igniteui-dockmanager": "^1.17.0",
"igniteui-react": "^19.6.2",
"igniteui-react-core": "19.6.0-beta.0",
"igniteui-webcomponents": "^7.1.3",
"react": "^19.2.0",
"react-dom": "^19.2.0",
"tslib": "^2.4.0"
},
"devDependencies": {
"@types/jest": "^29.2.0",
"@types/node": "^24.7.1",
"@types/react": "^18.0.24",
"@types/react-dom": "^18.0.8",
"@vitejs/plugin-react": "^5.0.4",
"@vitest/browser": "^3.2.4",
"typescript": "^4.8.4",
"vite": "^7.1.9",
"vitest": "^3.2.4",
"vitest-canvas-mock": "^0.3.3",
"worker-loader": "^3.0.8"
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
]
}
5 changes: 5 additions & 0 deletions samples/inputs/highlight/helper-text/sandbox.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"infiniteLoopProtection": false,
"hardReloadOnChange": false,
"view": "browser"
}
2 changes: 2 additions & 0 deletions samples/inputs/highlight/helper-text/src/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/* shared styles are loaded from: */
/* https://dl.infragistics.com/x/css/samples/shared.v8.css */
89 changes: 89 additions & 0 deletions samples/inputs/highlight/helper-text/src/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
import React from 'react';
import ReactDOM from 'react-dom/client';
import { IgrInput, IgrHighlight, IgrIconButton, IgrDivider, IgrExpansionPanel } from 'igniteui-react';
import 'igniteui-webcomponents/themes/light/bootstrap.css';

export default class HighlightHelperText extends React.Component<any, any> {
private highlightRef = React.createRef<IgrHighlight>();
private statusRef = React.createRef<HTMLParagraphElement>();

private updateStatus() {
const highlight = this.highlightRef.current;
const status = this.statusRef.current;
if (!highlight || !status) return;

status.textContent = highlight.size
? `${highlight.current + 1} of ${highlight.size} match${highlight.size === 1 ? '' : 'es'}`
: '';
}

private onInput = ({ detail }: CustomEvent<string>) => {
if (!this.highlightRef.current) return;
this.highlightRef.current.searchText = detail;
this.updateStatus();
};

private prev = () => {
this.highlightRef.current?.previous({preventScroll: true});
this.updateStatus();
};

private next = () => {
this.highlightRef.current?.next({preventScroll: true});
this.updateStatus();
};

public render(): JSX.Element {
return (
<div className="sample">
<div className="search-bar">
<IgrInput label="Search" onigcInput={this.onInput as any}>
<IgrIconButton variant="flat" name="navigate_before" collection="internal" slot="suffix" onClick={this.prev}></IgrIconButton>
<IgrIconButton variant="flat" name="navigate_next" collection="internal" slot="suffix" onClick={this.next}></IgrIconButton>
<p ref={this.statusRef} slot="helper-text"></p>
</IgrInput>
</div>
<IgrDivider></IgrDivider>
<IgrHighlight ref={this.highlightRef}>
<h1>Document Object Model</h1>
<IgrExpansionPanel open>
<h2 slot="title">Overview</h2>
<section>
<p>
The Document Object Model (DOM) is a cross-platform and
language-independent interface that treats an HTML or XML document
as a tree structure wherein each node is an object representing a
part of the document. The DOM represents a document with a logical
tree. Each branch of the tree ends in a node, and each node
contains objects. DOM methods allow programmatic access to the
tree; with them one can change the structure, style or content of
a document. Nodes can have event handlers (also known as event
listeners) attached to them. Once an event is triggered, the event
handlers get executed.
</p>
<p>
The principal standardization of the DOM was handled by the World
Wide Web Consortium (W3C), which last developed a recommendation
in 2004. WHATWG took over the development of the standard,
publishing it as a living document. The W3C now publishes stable
snapshots of the WHATWG standard.
</p>
<p>In HTML DOM (Document Object Model), every element is a node:</p>
<ul>
<li>A document is a document node.</li>
<li>All HTML elements are element nodes.</li>
<li>All HTML attributes are attribute nodes.</li>
<li>Text inserted into HTML elements are text nodes.</li>
<li>Comments are comment nodes.</li>
</ul>
</section>
</IgrExpansionPanel>
</IgrHighlight>
</div>
);
}
}

// rendering above class to the React DOM
const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(<HighlightHelperText/>);
44 changes: 44 additions & 0 deletions samples/inputs/highlight/helper-text/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"compilerOptions": {
"resolveJsonModule": true,
"esModuleInterop": true,
"baseUrl": ".",
"outDir": "build/dist",
"module": "esnext",
"target": "es5",
"lib": [
"es6",
"dom"
],
"sourceMap": true,
"allowJs": true,
"jsx": "react",
"moduleResolution": "node",
"rootDir": "src",
"forceConsistentCasingInFileNames": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"noImplicitAny": true,
"noUnusedLocals": false,
"importHelpers": true,
"allowSyntheticDefaultImports": true,
"skipLibCheck": true,
"strict": false,
"isolatedModules": true,
"noEmit": true
},
"exclude": [
"node_modules",
"build",
"scripts",
"acceptance-tests",
"webpack",
"jest",
"src/setupTests.ts",
"**/odatajs-4.0.0.js",
"config-overrides.js"
],
"include": [
"src"
]
}
12 changes: 12 additions & 0 deletions samples/inputs/highlight/helper-text/vite.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';

export default defineConfig({
plugins: [react()],
build: {
outDir: 'build'
},
server: {
open: false
},
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "Node.js",
"image": "mcr.microsoft.com/devcontainers/javascript-node:22"
}
Loading
Loading