diff --git a/browser/package-lock.json b/browser/package-lock.json index dc9e176d4c..2300e4dd97 100644 --- a/browser/package-lock.json +++ b/browser/package-lock.json @@ -16,19 +16,19 @@ "file-saver": "1.3.8", "igniteui-dockmanager": "1.16.1", "igniteui-react": "19.0.2", - "igniteui-react-charts": "19.0.0-alpha.2", - "igniteui-react-core": "19.0.0-alpha.2", - "igniteui-react-dashboards": "19.0.0-alpha.2", - "igniteui-react-data-grids": "19.0.0-alpha.2", - "igniteui-react-datasources": "19.0.0-alpha.2", - "igniteui-react-excel": "19.0.0-alpha.2", - "igniteui-react-gauges": "19.0.0-alpha.2", + "igniteui-react-charts": "19.0.0", + "igniteui-react-core": "19.0.0", + "igniteui-react-dashboards": "19.0.0", + "igniteui-react-data-grids": "19.0.0", + "igniteui-react-datasources": "19.0.0", + "igniteui-react-excel": "19.0.0", + "igniteui-react-gauges": "19.0.0", "igniteui-react-grids": "19.0.2", - "igniteui-react-inputs": "19.0.0-alpha.2", - "igniteui-react-layouts": "19.0.0-alpha.2", - "igniteui-react-maps": "19.0.0-alpha.2", - "igniteui-react-spreadsheet": "19.0.0-alpha.2", - "igniteui-react-spreadsheet-chart-adapter": "19.0.0-alpha.2", + "igniteui-react-inputs": "19.0.0", + "igniteui-react-layouts": "19.0.0", + "igniteui-react-maps": "19.0.0", + "igniteui-react-spreadsheet": "19.0.0", + "igniteui-react-spreadsheet-chart-adapter": "19.0.0", "igniteui-webcomponents": "6.0.0", "lit-html": "^3.2.0", "prop-types": "15.7.2", @@ -13009,94 +13009,87 @@ } }, "node_modules/igniteui-react-charts": { - "version": "19.0.0-alpha.2", - "resolved": "https://registry.npmjs.org/igniteui-react-charts/-/igniteui-react-charts-19.0.0-alpha.2.tgz", - "integrity": "sha512-HgcP4Usa+6mg1shgnD1rAPvM0dvdyCv9LqeufT6xJqRoMqpzgi0BlUWOoiH4VxK9vdwZs75r/P6zUBYqnA6vdg==", - "license": "Infragistics(R) Ultimate license (http://www.infragistics.com/legal/ultimate/license/)", + "version": "19.0.0", + "resolved": "https://registry.npmjs.org/igniteui-react-charts/-/igniteui-react-charts-19.0.0.tgz", + "integrity": "sha512-7Vtrga4q69kzN0fxWVLRTvZfUjd1rySwQW3OC7YKxI/oUFh5SfF/khYpbVYIJzrKwfS731k+jbADo0AoFxrSFQ==", "dependencies": { "tslib": "^2.3.1" }, "peerDependencies": { - "igniteui-react-core": "19.0.0-alpha.2" + "igniteui-react-core": "19.0.0" } }, "node_modules/igniteui-react-core": { - "version": "19.0.0-alpha.2", - "resolved": "https://registry.npmjs.org/igniteui-react-core/-/igniteui-react-core-19.0.0-alpha.2.tgz", - "integrity": "sha512-vpHJ5FuwE7b9wloHl5eMhNJNRu2764IITyUPG5VaW6WYqPT58X1q9VJBQN8moOQE5Cet/hXyh0C8rjlaMEpWsw==", - "license": "Infragistics(R) Ultimate license (http://www.infragistics.com/legal/ultimate/license/)", + "version": "19.0.0", + "resolved": "https://registry.npmjs.org/igniteui-react-core/-/igniteui-react-core-19.0.0.tgz", + "integrity": "sha512-cyO9t1jEcGyw+ifuOACXU+M1tqg/QT6k3q13f5C2M2mIEwJwB1ooLMDIkkmIdU6uYC9AvGScUztpu8oQ6QbhSw==", "dependencies": { "tslib": "^2.3.1" } }, "node_modules/igniteui-react-dashboards": { - "version": "19.0.0-alpha.2", - "resolved": "https://registry.npmjs.org/igniteui-react-dashboards/-/igniteui-react-dashboards-19.0.0-alpha.2.tgz", - "integrity": "sha512-1Ul39JI1ExkWL15DjABp/0WSPzf+OJ4dc563elyRntD/3+HyMLAC8GXjCJglwI+M5AfyoqvqxrvomkL/G+QfIA==", - "license": "Infragistics(R) Ultimate license (http://www.infragistics.com/legal/ultimate/license/)", + "version": "19.0.0", + "resolved": "https://registry.npmjs.org/igniteui-react-dashboards/-/igniteui-react-dashboards-19.0.0.tgz", + "integrity": "sha512-uTc1EQ8pS3+MtzhB6+PV9rMWGUlwLXxMnlndHe8Z7jnIX2d+ZZSkxOU7H/wkXVGl6qvERO5ms2xPJDflQxFF9w==", "dependencies": { "tslib": "^2.3.1" }, "peerDependencies": { - "igniteui-react-charts": "19.0.0-alpha.2", - "igniteui-react-core": "19.0.0-alpha.2", - "igniteui-react-data-grids": "19.0.0-alpha.2", - "igniteui-react-gauges": "19.0.0-alpha.2", - "igniteui-react-inputs": "19.0.0-alpha.2", - "igniteui-react-layouts": "19.0.0-alpha.2", - "igniteui-react-maps": "19.0.0-alpha.2" + "igniteui-react-charts": "19.0.0", + "igniteui-react-core": "19.0.0", + "igniteui-react-data-grids": "19.0.0", + "igniteui-react-gauges": "19.0.0", + "igniteui-react-inputs": "19.0.0", + "igniteui-react-layouts": "19.0.0", + "igniteui-react-maps": "19.0.0" } }, "node_modules/igniteui-react-data-grids": { - "version": "19.0.0-alpha.2", - "resolved": "https://registry.npmjs.org/igniteui-react-data-grids/-/igniteui-react-data-grids-19.0.0-alpha.2.tgz", - "integrity": "sha512-IcJSAOneBA2+c7A/yQLe7wKU/fweNb79xGsuJspxofxVYtKkKsDZTYGIPH/gjfvma2sjuOsTnLE9eV0ErtTCbQ==", - "license": "Infragistics(R) Ultimate license (http://www.infragistics.com/legal/ultimate/license/)", + "version": "19.0.0", + "resolved": "https://registry.npmjs.org/igniteui-react-data-grids/-/igniteui-react-data-grids-19.0.0.tgz", + "integrity": "sha512-pZ/VjYRVCFwu4fp/XWgMp0f/R50MVhx6ASK/f1SqQYcSvrcFMTKOjZPo0NyOL5hzdwrZtRb5G566UySV1ZjVWA==", "dependencies": { "tslib": "^2.3.1" }, "peerDependencies": { - "igniteui-react-core": "19.0.0-alpha.2", - "igniteui-react-inputs": "19.0.0-alpha.2", - "igniteui-react-layouts": "19.0.0-alpha.2" + "igniteui-react-core": "19.0.0", + "igniteui-react-inputs": "19.0.0", + "igniteui-react-layouts": "19.0.0" } }, "node_modules/igniteui-react-datasources": { - "version": "19.0.0-alpha.2", - "resolved": "https://registry.npmjs.org/igniteui-react-datasources/-/igniteui-react-datasources-19.0.0-alpha.2.tgz", - "integrity": "sha512-sujEz7Ud56oQJyhuTBIPbOSb2ugR4L4VHunLzVU6tnLo6Qv1DCEMoVSkwUdGFueTd+60ivCjO+GkpE/hDm2lAw==", - "license": "MIT", + "version": "19.0.0", + "resolved": "https://registry.npmjs.org/igniteui-react-datasources/-/igniteui-react-datasources-19.0.0.tgz", + "integrity": "sha512-WxBJcYg/BDIfs7AIhZDymHGdgJlPQQnNfG6eSJP3d+HRyesClXizvbt8Cooq88T8X8Bda/tUrT3JkXn7fflO5g==", "dependencies": { "tslib": "^2.3.1" }, "peerDependencies": { - "igniteui-react-core": "19.0.0-alpha.2" + "igniteui-react-core": "19.0.0" } }, "node_modules/igniteui-react-excel": { - "version": "19.0.0-alpha.2", - "resolved": "https://registry.npmjs.org/igniteui-react-excel/-/igniteui-react-excel-19.0.0-alpha.2.tgz", - "integrity": "sha512-5SCxLpvMiG3pd1XBp/bbG3EJTS1ZoNULDrnHslRq7rtLGLHLQ/0t3mSKIkpL2ocwxmVRHc6wu8G8DtS38tdqaw==", - "license": "Infragistics(R) Ultimate license (http://www.infragistics.com/legal/ultimate/license/)", + "version": "19.0.0", + "resolved": "https://registry.npmjs.org/igniteui-react-excel/-/igniteui-react-excel-19.0.0.tgz", + "integrity": "sha512-N7hQnuuk4YqzlDBpRd0YPKEhVMQAeGazubieSsc4tsJRIrHYtjY7/wrKGW76OmXtVQDpi5sTAYRIEMhHO8i4Yg==", "dependencies": { "jszip": "^3.1.5", "pako": "^1.0.6", "tslib": "^2.3.1" }, "peerDependencies": { - "igniteui-react-core": "19.0.0-alpha.2" + "igniteui-react-core": "19.0.0" } }, "node_modules/igniteui-react-gauges": { - "version": "19.0.0-alpha.2", - "resolved": "https://registry.npmjs.org/igniteui-react-gauges/-/igniteui-react-gauges-19.0.0-alpha.2.tgz", - "integrity": "sha512-LCraVmYes9LQFp+l9tVjnk4UHCp8sla6so3D7hKDfnbOaka6JpFclY5Qfyb7qrJcuNH2pXgUyy6xnbJU7DayNw==", - "license": "Infragistics(R) Ultimate license (http://www.infragistics.com/legal/ultimate/license/)", + "version": "19.0.0", + "resolved": "https://registry.npmjs.org/igniteui-react-gauges/-/igniteui-react-gauges-19.0.0.tgz", + "integrity": "sha512-mWQISDUkaiPP8uk+hLr832+xGGNuzjdOLsnhkESXPJaxHW4j06klncOOzbBpQy63ODF1yGUhvoHJi9s071YgpQ==", "dependencies": { "tslib": "^2.3.1" }, "peerDependencies": { - "igniteui-react-core": "19.0.0-alpha.2" + "igniteui-react-core": "19.0.0" } }, "node_modules/igniteui-react-grids": { @@ -13110,69 +13103,64 @@ } }, "node_modules/igniteui-react-inputs": { - "version": "19.0.0-alpha.2", - "resolved": "https://registry.npmjs.org/igniteui-react-inputs/-/igniteui-react-inputs-19.0.0-alpha.2.tgz", - "integrity": "sha512-2qT0qImg4yxygSv3fla5z3I6Ij7VycIVPn0/e7PctsdLpF4cHlJx2OQjy1m/3naVZcGR95v4ycghaT3MJtZKMw==", - "license": "Infragistics(R) Ultimate license (http://www.infragistics.com/legal/ultimate/license/)", + "version": "19.0.0", + "resolved": "https://registry.npmjs.org/igniteui-react-inputs/-/igniteui-react-inputs-19.0.0.tgz", + "integrity": "sha512-YJIfBLbFlp1QeCQhKEWMnNP5zvwdEJYSNCbsahVEhej0MRJ3u16RqAARCbZKlyWIZxj+bg5bXE+pLqwgFJUhJg==", "dependencies": { "tslib": "^2.3.1" }, "peerDependencies": { - "igniteui-react-core": "19.0.0-alpha.2" + "igniteui-react-core": "19.0.0" } }, "node_modules/igniteui-react-layouts": { - "version": "19.0.0-alpha.2", - "resolved": "https://registry.npmjs.org/igniteui-react-layouts/-/igniteui-react-layouts-19.0.0-alpha.2.tgz", - "integrity": "sha512-Ibgo7S0OB/kEseUuQuCKa0uQsxF/o5pjWyp+HxY5UcV0AYEgTgHVH0fFW+amhpplqUe3KBKw9gOE13S/wDNlkw==", - "license": "Infragistics(R) Ultimate license (http://www.infragistics.com/legal/ultimate/license/)", + "version": "19.0.0", + "resolved": "https://registry.npmjs.org/igniteui-react-layouts/-/igniteui-react-layouts-19.0.0.tgz", + "integrity": "sha512-4/pTd9ZLSlye3Wpwz8Cmb9QQnt2IqyBBweZSxPkTyI0K7gCu4mhiX5Od8W3CHmSlGa5gUfgrdYnZoVuLzX64dw==", "dependencies": { "tslib": "^2.3.1" }, "peerDependencies": { - "igniteui-react-core": "19.0.0-alpha.2", - "igniteui-react-inputs": "19.0.0-alpha.2" + "igniteui-react-core": "19.0.0", + "igniteui-react-inputs": "19.0.0" } }, "node_modules/igniteui-react-maps": { - "version": "19.0.0-alpha.2", - "resolved": "https://registry.npmjs.org/igniteui-react-maps/-/igniteui-react-maps-19.0.0-alpha.2.tgz", - "integrity": "sha512-ZMx2Vz3jHZ+8ShrVEWNinRefO4cyOugDzAfsz6lq9+NdVs45PdaxowmxHulzL7nnjAT8N+2M2t4hbjyCjt64Uw==", - "license": "Infragistics(R) Ultimate license (http://www.infragistics.com/legal/ultimate/license/)", + "version": "19.0.0", + "resolved": "https://registry.npmjs.org/igniteui-react-maps/-/igniteui-react-maps-19.0.0.tgz", + "integrity": "sha512-tkLnoeXcGbMMn7FtdgJjiqe7A7TaI/CE5pjUURbWNkjm8AEj+gWs5HWWcZBjwrJWTLUd4TwIjzdls0Q6MkeoGA==", "dependencies": { "tslib": "^2.3.1" }, "peerDependencies": { - "igniteui-react-charts": "19.0.0-alpha.2", - "igniteui-react-core": "19.0.0-alpha.2" + "igniteui-react-charts": "19.0.0", + "igniteui-react-core": "19.0.0" } }, "node_modules/igniteui-react-spreadsheet": { - "version": "19.0.0-alpha.2", - "resolved": "https://registry.npmjs.org/igniteui-react-spreadsheet/-/igniteui-react-spreadsheet-19.0.0-alpha.2.tgz", - "integrity": "sha512-i63RpTPhtwotuT1CXetq5QtqPo+mZcETXEQ+oXk1CMY/43KDIDIJ9uVSg5ttHt2tLaKsItuyJ8zdLxTtP65Sow==", - "license": "Infragistics(R) Ultimate license (http://www.infragistics.com/legal/ultimate/license/)", + "version": "19.0.0", + "resolved": "https://registry.npmjs.org/igniteui-react-spreadsheet/-/igniteui-react-spreadsheet-19.0.0.tgz", + "integrity": "sha512-b2fkIeZRfXSlbUzTQ4kAdmejM4Mvos2jdxoVJHSO6P7XEEMeMQulT/XoxC4dF6aAV7hKiGwN4BWl4aYabfpb7w==", "dependencies": { "tslib": "^2.3.1" }, "peerDependencies": { - "igniteui-react-core": "19.0.0-alpha.2", - "igniteui-react-excel": "19.0.0-alpha.2" + "igniteui-react-core": "19.0.0", + "igniteui-react-excel": "19.0.0" } }, "node_modules/igniteui-react-spreadsheet-chart-adapter": { - "version": "19.0.0-alpha.2", - "resolved": "https://registry.npmjs.org/igniteui-react-spreadsheet-chart-adapter/-/igniteui-react-spreadsheet-chart-adapter-19.0.0-alpha.2.tgz", - "integrity": "sha512-BqMvIYyI7htOUCwNw/fv/cD7X/4SiQYsa3jSNJx38IBrn690FlnSXaTkWiVu4GrxoXAOh9WZiK+b2LwhjCo9TA==", - "license": "Infragistics(R) Ultimate license (http://www.infragistics.com/legal/ultimate/license/)", + "version": "19.0.0", + "resolved": "https://registry.npmjs.org/igniteui-react-spreadsheet-chart-adapter/-/igniteui-react-spreadsheet-chart-adapter-19.0.0.tgz", + "integrity": "sha512-rMke5j9Vb/qb1IYts//miCCcdkcl5uL6nSJYXrsMiJeVjnB87vWrRQUNgFepNB/8iemhZPHtC0RHTrqXb1yUVw==", "dependencies": { "tslib": "^2.3.1" }, "peerDependencies": { - "igniteui-react-charts": "19.0.0-alpha.2", - "igniteui-react-core": "19.0.0-alpha.2", - "igniteui-react-excel": "19.0.0-alpha.2", - "igniteui-react-spreadsheet": "19.0.0-alpha.2" + "igniteui-react-charts": "19.0.0", + "igniteui-react-core": "19.0.0", + "igniteui-react-excel": "19.0.0", + "igniteui-react-spreadsheet": "19.0.0" } }, "node_modules/igniteui-trial-watermark": { diff --git a/browser/tasks/Transformer.ts b/browser/tasks/Transformer.ts index 6adee69b4f..911a9b983f 100644 --- a/browser/tasks/Transformer.ts +++ b/browser/tasks/Transformer.ts @@ -806,12 +806,12 @@ class PackageDependency { } class CodeViewer { - public path: string; public hasRelativeAssetsUrls: boolean; - public content: string; public isMain: boolean; + public path: string; public fileExtension: string; public fileHeader: string; + public content: string; constructor(filePath: string, content: string, fileExtension: string, fileHeader: string, isMain: boolean) { @@ -819,10 +819,10 @@ class CodeViewer { // jsonContent = jsonContent.replace(/\/\//g, "/"); this.hasRelativeAssetsUrls = false; - this.path = filePath; - this.content = jsonContent; this.isMain = isMain; this.fileExtension = fileExtension; this.fileHeader = fileHeader; + this.path = filePath; + this.content = jsonContent; } } diff --git a/browser/tasks/gulp-samples.js b/browser/tasks/gulp-samples.js index 88c9d4c7a3..1f79f1ed8c 100644 --- a/browser/tasks/gulp-samples.js +++ b/browser/tasks/gulp-samples.js @@ -40,6 +40,7 @@ var sampleSource = [ // igConfig.SampleCopyPath + '/charts/data-chart/chart-performance/package.json', // igConfig.SampleCopyPath + '/charts/financial-chart/high-frequency/package.json', // igConfig.SampleCopyPath + '/charts/financial-chart/high-volume/package.json', + // igConfig.SampleCopyPath + '/charts/data-chart/data-annotation-multiple-with-stocks/package.json', // including samples for specific components: // igConfig.SampleCopyPath + '/charts/category-chart/**/package.json', @@ -636,6 +637,7 @@ function updateCodeViewer(cb) { var content = "{\r\n \"sampleFiles\":\r\n"; + var dataFiles = []; var contentItems = []; var tsxItem = new CodeViewer(sample.SampleFilePath, sample.SampleFileSourceCode, "tsx", "tsx", true); @@ -650,10 +652,26 @@ function updateCodeViewer(cb) { else if (file.indexOf(".ts") > 0 && file.indexOf("index.tsx") === -1) { var tsContent = fs.readFileSync(file, "utf8"); var tsItem = new CodeViewer(file, tsContent, "ts", "DATA", true); - contentItems.push(tsItem); + dataFiles.push(tsItem); } } + if (dataFiles.length === 1) { + contentItems.push(dataFiles[0]); + } else if (dataFiles.length > 1) { + // combining multiple data files into one data source + var dataPath = dataFiles[0].path; + var dataFolder = dataPath.substring(0, dataPath.lastIndexOf("/")); + var dataContent = "// NOTE this file contains multiple data sources:\r\n"; + for (let i = 0; i < dataFiles.length; i++) { + const data = dataFiles[i]; + dataContent += "\r\n\r\n" + "// Data Source #" + (i+1) + "\r\n"; + dataContent += data.content + "\r\n"; + } + var dataItem = new CodeViewer(dataFolder + "/DataSources.ts", dataContent, "ts", "DATA", true); + contentItems.push(dataItem); + } + content += JSON.stringify(contentItems, null, ' '); content += "\r\n}"; diff --git a/samples/grids/grid/data-searching/src/index.tsx b/samples/grids/grid/data-searching/src/index.tsx index d7496ffd76..dd17cdd658 100644 --- a/samples/grids/grid/data-searching/src/index.tsx +++ b/samples/grids/grid/data-searching/src/index.tsx @@ -1,25 +1,19 @@ import React, { KeyboardEvent, useEffect, useRef, useState } from "react"; import ReactDOM from "react-dom/client"; import "./index.css"; - -import { IgrGridModule } from "igniteui-react-grids"; import { IgrGrid, IgrColumn } from "igniteui-react-grids"; import { MarketData } from "./MarketData"; - import "igniteui-react-grids/grids/themes/light/bootstrap.css"; import { IgrChip, - IgrChipModule, + IgrComponentBoolValueChangedEventArgs, IgrComponentValueChangedEventArgs, IgrIconButton, IgrInput, - IgrInputModule, - IgrIconButtonModule, + IgrRipple, registerIconFromText, } from "igniteui-react"; -const mods: any[] = [IgrGridModule, IgrChipModule, IgrInputModule, IgrIconButtonModule]; -mods.forEach((m) => m.register()); const searchIconText = ""; @@ -34,9 +28,8 @@ const data = new MarketData(); export default function Sample() { const gridRef = useRef(null); - const caseSensitiveChipRef = useRef(null); - const exactMatchChipRef = useRef(null); - + const [caseSensitiveSelected, setCaseSensitiveSelected] = useState(false); + const [exactMatchSelected, setExactMatchSelected] = useState(false); const [searchText, setSearchText] = useState(''); useEffect(() => { @@ -46,32 +39,42 @@ export default function Sample() { registerIconFromText("next", nextIconText, "material"); }, []); - function handleOnSearchChange(event: IgrComponentValueChangedEventArgs) { + const handleOnSearchChange = (event: IgrComponentValueChangedEventArgs) => { setSearchText(event.detail); - gridRef.current.findNext(event.detail, caseSensitiveChipRef.current.selected, exactMatchChipRef.current.selected); + nextSearch(event.detail, caseSensitiveSelected, exactMatchSelected); } - function clearSearch() { + const clearSearch = () => { setSearchText(''); gridRef.current.clearSearch(); } - function prevSearch() { - gridRef.current.findPrev(searchText, caseSensitiveChipRef.current.selected, exactMatchChipRef.current.selected); + const searchKeyDown = (e: KeyboardEvent) => { + if (e.key === 'Enter' || e.key === 'ArrowDown') { + e.preventDefault(); + nextSearch(searchText, caseSensitiveSelected, exactMatchSelected); + } else if (e.key === 'ArrowUp' || e.key === 'ArrowLeft') { + e.preventDefault(); + prevSearch(searchText, caseSensitiveSelected, exactMatchSelected); + } } - function nextSearch() { - gridRef.current.findNext(searchText, caseSensitiveChipRef.current.selected, exactMatchChipRef.current.selected); + const handleCaseSensitiveChange = (event: IgrComponentBoolValueChangedEventArgs) => { + setCaseSensitiveSelected(event.detail); + nextSearch(searchText, event.detail, exactMatchSelected); } - function searchKeyDown(e: KeyboardEvent) { - if (e.key === 'Enter' || e.key === 'ArrowDown') { - e.preventDefault(); - gridRef.current.findNext(searchText, caseSensitiveChipRef.current.selected, exactMatchChipRef.current.selected); - } else if (e.key === 'ArrowUp' || e.key === 'ArrowLeft') { - e.preventDefault(); - gridRef.current.findPrev(searchText, caseSensitiveChipRef.current.selected, exactMatchChipRef.current.selected); - } + const handleExactMatchChange = (event: IgrComponentBoolValueChangedEventArgs) => { + setExactMatchSelected(event.detail); + nextSearch(searchText, caseSensitiveSelected, event.detail); + } + + const prevSearch = (text: string, caseSensitive: boolean, exactMatch: boolean) => { + gridRef.current.findPrev(text, caseSensitive, exactMatch); + } + + const nextSearch = (text: string, caseSensitive: boolean, exactMatch: boolean) => { + gridRef.current.findNext(text, caseSensitive, exactMatch); } return ( @@ -80,17 +83,15 @@ export default function Sample() {
-
+
{searchText.length === 0 ? ( ) : ( )}
- -
- - Case Sensitive + +
+ + Case Sensitive - - Exact Match + + Exact Match
-
+
+ onClick={() => prevSearch(searchText, caseSensitiveSelected, exactMatchSelected)} + > + + + onClick={() => nextSearch(searchText, caseSensitiveSelected, exactMatchSelected)} + > + +
- - - - - + + + + +
diff --git a/samples/grids/grid/disabled-summaries/src/index.tsx b/samples/grids/grid/disabled-summaries/src/index.tsx index 25dc5c2263..1c6f605c0c 100644 --- a/samples/grids/grid/disabled-summaries/src/index.tsx +++ b/samples/grids/grid/disabled-summaries/src/index.tsx @@ -1,314 +1,510 @@ -import React from 'react'; -import ReactDOM from 'react-dom/client'; -import './index.css'; - -import { IgrButton, IgrDialog, IgrCheckbox } from 'igniteui-react'; -import { IgrButtonModule, IgrDialogModule, IgrCheckboxModule } from 'igniteui-react'; -import { IgrGridModule, IgrSummaryOperand, IgrSummaryResult } from 'igniteui-react-grids'; -import { IgrGrid, IgrColumn } from "igniteui-react-grids"; -import NwindData from './NwindData.json'; - -import 'igniteui-react-grids/grids/themes/light/bootstrap.css'; - -IgrGridModule.register(); -IgrButtonModule.register(); -IgrDialogModule.register(); -IgrCheckboxModule.register(); +import React, { useEffect, useState } from "react"; +import ReactDOM from "react-dom/client"; +import "./index.css"; + +import { IgrButton, IgrDialog, IgrCheckbox } from "igniteui-react"; +import { + IgrGrid, + IgrColumn, + IgrSummaryOperand, + IgrSummaryResult, +} from "igniteui-react-grids"; +import NwindData from "./NwindData.json"; + +import "igniteui-react-grids/grids/combined"; +import "igniteui-react-grids/grids/themes/light/bootstrap.css"; class UnitsInStockSummary extends IgrSummaryOperand { - operate(data: any[] = [], allData: any[] = [], fieldName: string = "", summaryResult: any = null): IgrSummaryResult[] { - const result: IgrSummaryResult[] = []; - const values = allData.map((item) => item[fieldName] ?? 0).filter((value) => value !== null); - - const discontinuedItems = allData.filter((item) => item["Discontinued"] === true); - const discontinuedValues = discontinuedItems.map((item) => item[fieldName] ?? 0).filter((value) => !isNaN(value)); - - result.push({ key: "count", label: "Count", summaryResult: values.length }); - result.push({ key: "min", label: "Min", summaryResult: values.length > 0 ? Math.min(...values) : "N/A" }); - result.push({ key: "max", label: "Max", summaryResult: values.length > 0 ? Math.max(...values) : "N/A" }); - result.push({ key: "sum", label: "Sum", summaryResult: values.reduce((a, b) => a + b, 0) }); - result.push({ - key: "average", - label: "Average", - summaryResult: values.length > 0 ? values.reduce((a, b) => a + b, 0) / values.length : "N/A" - }); - result.push({ - key: "median", - label: "Median", - summaryResult: - values.length > 0 - ? (() => { - const sortedValues = values.slice().sort((a, b) => a - b); - return sortedValues.length % 2 === 0 ? (sortedValues[sortedValues.length / 2 - 1] + sortedValues[sortedValues.length / 2]) / 2 : sortedValues[Math.floor(sortedValues.length / 2)]; - })() - : "N/A" - }); - result.push({ key: "range", label: "Range", summaryResult: values.length > 0 ? Math.max(...values) - Math.min(...values) : "N/A" }); - result.push({ key: "discontinued", label: "Discontinued Products", summaryResult: discontinuedItems.length }); - result.push({ key: "totalDiscontinued", label: "Total Discontinued Items", summaryResult: discontinuedValues.length > 0 ? discontinuedValues.reduce((a, b) => a + b, 0) : 0 }); - - return result; - } + operate( + data: any[] = [], + allData: any[] = [], + fieldName: string = "", + summaryResult: any = null + ): IgrSummaryResult[] { + const result: IgrSummaryResult[] = []; + const values = allData + .map((item) => item[fieldName] ?? 0) + .filter((value) => value !== null); + + const discontinuedItems = allData.filter( + (item) => item["Discontinued"] === true + ); + const discontinuedValues = discontinuedItems + .map((item) => item[fieldName] ?? 0) + .filter((value) => !isNaN(value)); + + result.push({ key: "count", label: "Count", summaryResult: values.length }); + result.push({ + key: "min", + label: "Min", + summaryResult: values.length > 0 ? Math.min(...values) : "N/A", + }); + result.push({ + key: "max", + label: "Max", + summaryResult: values.length > 0 ? Math.max(...values) : "N/A", + }); + result.push({ + key: "sum", + label: "Sum", + summaryResult: values.reduce((a, b) => a + b, 0), + }); + result.push({ + key: "average", + label: "Average", + summaryResult: + values.length > 0 + ? values.reduce((a, b) => a + b, 0) / values.length + : "N/A", + }); + result.push({ + key: "median", + label: "Median", + summaryResult: + values.length > 0 + ? (() => { + const sortedValues = values.slice().sort((a, b) => a - b); + return sortedValues.length % 2 === 0 + ? (sortedValues[sortedValues.length / 2 - 1] + + sortedValues[sortedValues.length / 2]) / + 2 + : sortedValues[Math.floor(sortedValues.length / 2)]; + })() + : "N/A", + }); + result.push({ + key: "range", + label: "Range", + summaryResult: + values.length > 0 ? Math.max(...values) - Math.min(...values) : "N/A", + }); + result.push({ + key: "discontinued", + label: "Discontinued Products", + summaryResult: discontinuedItems.length, + }); + result.push({ + key: "totalDiscontinued", + label: "Total Discontinued Items", + summaryResult: + discontinuedValues.length > 0 + ? discontinuedValues.reduce((a, b) => a + b, 0) + : 0, + }); + + return result; + } } class DiscontinuedSummary extends IgrSummaryOperand { - operate(data: any[] = [], allData: any[] = [], fieldName: string = ""): IgrSummaryResult[] { - const result: IgrSummaryResult[] = []; - result.push({ key: "count", label: "Count", summaryResult: allData.length }); - result.push({ key: "true", label: "True", summaryResult: allData.filter((item) => item[fieldName] === true).length }); - result.push({ key: "false", label: "False", summaryResult: allData.filter((item) => item[fieldName] === false).length }); - return result; - } + operate( + data: any[] = [], + allData: any[] = [], + fieldName: string = "" + ): IgrSummaryResult[] { + const result: IgrSummaryResult[] = []; + result.push({ + key: "count", + label: "Count", + summaryResult: allData.length, + }); + result.push({ + key: "true", + label: "True", + summaryResult: allData.filter((item) => item[fieldName] === true).length, + }); + result.push({ + key: "false", + label: "False", + summaryResult: allData.filter((item) => item[fieldName] === false).length, + }); + return result; + } +} + +interface SummaryColumn { + field: string; + header: string; + hasSummary: boolean; + dataType?: string; + summaries?: any; + disabledSummaries: string[]; } -export default class Sample extends React.Component { - private grid: IgrGrid; - private dialog: IgrDialog; - - constructor(props: any) { - super(props); - - this.state = { - currentColumn: null, - disableAllBtnDisabled: false, - enableAllBtnDisabled: false, - checkboxStates: [], - columns: [ - { field: "ProductID", header: "ProductID", hasSummary: true, disabledSummaries: [] }, - { field: "ProductName", header: "Product Name", hasSummary: true, disabledSummaries: [] }, - { field: "UnitPrice", header: "Unit Price", hasSummary: true, dataType: "number", disabledSummaries: [] }, - { field: "UnitsInStock", header: "Units In Stock", hasSummary: true, dataType: "number", summaries: UnitsInStockSummary, disabledSummaries: [] }, - { field: "Discontinued", header: "Discontinued", hasSummary: true, summaries: DiscontinuedSummary, disabledSummaries: [] }, - { field: "OrderDate", header: "Order Date", hasSummary: true, dataType: "date", disabledSummaries: [] }, - ], - }; - - this.gridRef = this.gridRef.bind(this); - this.dialogRef = this.dialogRef.bind(this); - this.openDialog = this.openDialog.bind(this); - this.updateCheckboxes = this.updateCheckboxes.bind(this); - this.toggleSummary = this.toggleSummary.bind(this); - this.disableAllSummaries = this.disableAllSummaries.bind(this); - this.enableAllSummaries = this.enableAllSummaries.bind(this); +export default function DisabledSummariesSample() { + // State + const [nwindData, setNwindData] = useState([]); + const [currentColumn, setCurrentColumn] = useState( + null + ); + const [currentColumnSource, setCurrentColumnSource] = useState< + "dialog" | "toggle" | null + >(null); + const [pendingUpdateType, setPendingUpdateType] = useState< + null | "disableAll" | "enableAll" + >(null); + const [disableAllBtnDisabled, setDisableAllBtnDisabled] = useState(false); + const [enableAllBtnDisabled, setEnableAllBtnDisabled] = useState(false); + const [checkboxStates, setCheckboxStates] = useState([]); + const [columns, setColumns] = useState([ + { + field: "ProductID", + header: "ProductID", + hasSummary: true, + disabledSummaries: [], + }, + { + field: "ProductName", + header: "Product Name", + hasSummary: true, + disabledSummaries: [], + }, + { + field: "UnitPrice", + header: "Unit Price", + hasSummary: true, + dataType: "number", + disabledSummaries: [], + }, + { + field: "UnitsInStock", + header: "Units In Stock", + hasSummary: true, + dataType: "number", + summaries: UnitsInStockSummary, + disabledSummaries: [], + }, + { + field: "Discontinued", + header: "Discontinued", + hasSummary: true, + summaries: DiscontinuedSummary, + disabledSummaries: [], + }, + { + field: "OrderDate", + header: "Order Date", + hasSummary: true, + dataType: "date", + disabledSummaries: [], + }, + ]); + + // Refs + let grid: IgrGrid; + const gridRef = (ref: IgrGrid) => { + grid = ref; + }; + let dialog: IgrDialog; + const dialogRef = (ref: IgrDialog) => { + dialog = ref; + if (dialog) { + dialog.closeOnOutsideClick = true; + dialog.keepOpenOnEscape = false; } + }; - gridRef = (ref: IgrGrid) => { - this.grid = ref; - }; + useEffect(() => { + setNwindData(NwindData); + }, []); - dialogRef = (ref: IgrDialog) => { - this.dialog = ref; - if (this.dialog) { - this.dialog.closeOnOutsideClick = true; - this.dialog.keepOpenOnEscape = false; - } - }; + useEffect(() => { + if (!currentColumn) return; - private _nwindData: any[] = NwindData; - public get nwindData(): any[] { - return this._nwindData; - } + const shouldShowDialog = currentColumnSource === "dialog"; + const shouldMarkForCheck = + currentColumnSource === "toggle" || + pendingUpdateType === "disableAll" || + pendingUpdateType === "enableAll"; - openDialog = (column: any) => { - const columnState: any | undefined = this.state.columns.find((c: any) => c.field === column.field); - - this.setState({ - currentColumn: columnState!, - checkboxStates: [], - }, () => { - this.updateCheckboxes(); - this.dialog?.show(); - }); - }; - - getSummaryResults(operand: any, data: any[], field: string): IgrSummaryResult[] { - if (typeof operand === "function") { - operand = new operand(); - } - if (operand instanceof IgrSummaryOperand) { - return operand.operate([], data, field, null); - } else if (!operand) { - return new IgrSummaryOperand().operate([], data, field, null); - } - return []; + if (shouldShowDialog) { + updateCheckboxes(); + dialog?.show(); + setCurrentColumnSource(null); } - getDefaultSummaries(data: any[], field: string): IgrSummaryResult[] { - const columnInstance = this.grid.columns.find(c => c.field === field); - if (columnInstance && columnInstance.summaries && typeof columnInstance.summaries.operate === 'function') { - return columnInstance.summaries.operate([], data, field, null); - } - return []; + if (shouldMarkForCheck && grid) { + updateCheckboxes(); + grid.markForCheck(); + setPendingUpdateType(null); + setCurrentColumnSource(null); } - - updateCheckboxes() { - if (!this.state.currentColumn || !this.grid) return; - - const gridData: any[] = this.grid.data; - let allSummaries: IgrSummaryResult[] = []; - if (this.state.currentColumn.summaries) { - allSummaries = this.getSummaryResults(this.state.currentColumn.summaries, gridData, this.state.currentColumn.field); - } else { - allSummaries = this.getDefaultSummaries(gridData, this.state.currentColumn.field); - } - - let allDisabled: boolean = true; - let allEnabled: boolean = true; - - const checkboxStates: any[] = allSummaries.map(summary => { - const isDisabled = this.state.currentColumn.disabledSummaries.includes(summary.key); - if (isDisabled) { - allEnabled = false; - } else { - allDisabled = false; - } - return { - label: summary.label, - key: summary.key, - checked: isDisabled, - }; - }); - - this.setState({ - checkboxStates, - disableAllBtnDisabled: allDisabled, - enableAllBtnDisabled: allEnabled, - }); + }, [currentColumn, currentColumnSource, pendingUpdateType, grid]); + + const openDialog = (column: any) => { + const columnState = columns.find((c) => c.field === column.field); + setCurrentColumn(columnState!); + setCurrentColumnSource("dialog"); + setCheckboxStates([]); + }; + + const getSummaryResults = ( + operand: any, + data: any[], + field: string + ): IgrSummaryResult[] => { + if (typeof operand === "function") { + operand = new operand(); + } + if (operand instanceof IgrSummaryOperand) { + return operand.operate([], data, field, null); + } else if (!operand) { + return new IgrSummaryOperand().operate([], data, field, null); + } + return []; + }; + + const getDefaultSummaries = ( + data: any[], + field: string + ): IgrSummaryResult[] => { + const columnInstance = grid.columns.find((c) => c.field === field); + if ( + columnInstance && + columnInstance.summaries && + typeof columnInstance.summaries.operate === "function" + ) { + return columnInstance.summaries.operate([], data, field, null); + } + return []; + }; + + const updateCheckboxes = () => { + if (!currentColumn || !grid) return; + + const gridData: any[] = grid.data; + let allSummaries: IgrSummaryResult[] = []; + if (currentColumn.summaries) { + allSummaries = getSummaryResults( + currentColumn.summaries, + gridData, + currentColumn.field + ); + } else { + allSummaries = getDefaultSummaries(gridData, currentColumn.field); } - toggleSummary = (summaryKey: string) => { - if (!this.state.currentColumn || !this.grid) return; - const { currentColumn, columns } = this.state; - - const updatedDisabledSummaries: string[] = currentColumn.disabledSummaries.includes(summaryKey) - ? currentColumn.disabledSummaries.filter((key: any) => key !== summaryKey) - : [...currentColumn.disabledSummaries, summaryKey]; - - const updatedColumns: any[] = columns.map((col: any) => - col.field === currentColumn.field - ? { ...col, disabledSummaries: updatedDisabledSummaries } - : col - ); - - this.setState({ - currentColumn: { ...currentColumn, disabledSummaries: updatedDisabledSummaries }, - columns: updatedColumns, - }, () => { - this.grid.markForCheck(); - }); - }; - - disableAllSummaries = () => { - if (!this.state.currentColumn || !this.grid) return; - - const gridData: any[] = this.grid.data; - let allSummaries: IgrSummaryResult[] = []; - if (this.state.currentColumn.summaries) { - allSummaries = this.getSummaryResults(this.state.currentColumn.summaries, gridData, this.state.currentColumn.field); - } else { - allSummaries = this.getDefaultSummaries(gridData, this.state.currentColumn.field); + let allDisabled: boolean = true; + let allEnabled: boolean = true; + + const newCheckboxStates: any[] = allSummaries.map((summary) => { + const isDisabled = currentColumn.disabledSummaries.includes(summary.key); + if (isDisabled) { + allEnabled = false; + } else { + allDisabled = false; + } + return { + label: summary.label, + key: summary.key, + checked: isDisabled, + }; + }); + + setCheckboxStates(newCheckboxStates); + setDisableAllBtnDisabled(allDisabled); + setEnableAllBtnDisabled(allEnabled); + }; + + const toggleSummary = (summaryKey: string) => { + if (!currentColumn || !grid) return; + + const updatedDisabledSummaries = currentColumn.disabledSummaries.includes( + summaryKey + ) + ? currentColumn.disabledSummaries.filter((key: any) => key !== summaryKey) + : [...currentColumn.disabledSummaries, summaryKey]; + + const updatedColumns = columns.map((col: any) => + col.field === currentColumn.field + ? { ...col, disabledSummaries: updatedDisabledSummaries } + : col + ); + + setCurrentColumn((prev) => ({ + ...prev, + disabledSummaries: updatedDisabledSummaries, + })); + setColumns(updatedColumns); + setCurrentColumnSource("toggle"); + }; + + const disableAllSummaries = () => { + if (!currentColumn || !grid) return; + + const gridData: any[] = grid.data; + let allSummaries: IgrSummaryResult[] = currentColumn.summaries + ? getSummaryResults( + currentColumn.summaries, + gridData, + currentColumn.field + ) + : getDefaultSummaries(gridData, currentColumn.field); + + const allSummaryKeys: string[] = allSummaries.map((s) => s.key); + + const updatedColumns = columns.map((col: any) => + col.field === currentColumn.field + ? { ...col, disabledSummaries: allSummaryKeys } + : col + ); + + setCurrentColumn((prev) => ({ + ...prev, + disabledSummaries: allSummaryKeys, + })); + setColumns(updatedColumns); + setDisableAllBtnDisabled(true); + setEnableAllBtnDisabled(false); + + setPendingUpdateType("disableAll"); + }; + + const enableAllSummaries = () => { + if (!currentColumn || !grid) return; + + const updatedColumns = columns.map((col: any) => + col.field === currentColumn.field + ? { ...col, disabledSummaries: [] } + : col + ); + + setCurrentColumn((prev) => ({ ...prev, disabledSummaries: [] })); + setColumns(updatedColumns); + setDisableAllBtnDisabled(false); + setEnableAllBtnDisabled(true); + + setPendingUpdateType("enableAll"); + }; + + return ( +
+
+

Disable Summaries for Column:

+ {columns.map((col: any) => ( + openDialog({ field: col.field, header: col.header })} + > + {col.header} + + ))} +
+ s.key); - - const updatedColumns: any[] = this.state.columns.map((col: any) => - col.field === this.state.currentColumn!.field - ? { ...col, disabledSummaries: allSummaryKeys } - : col - ); - - this.setState((prevState: any) => ({ - currentColumn: { ...prevState.currentColumn!, disabledSummaries: allSummaryKeys }, - columns: updatedColumns, - disableAllBtnDisabled: true, - enableAllBtnDisabled: false, - }), () => { - this.updateCheckboxes(); - this.grid.markForCheck(); - }); - }; - - enableAllSummaries = () => { - if (!this.state.currentColumn || !this.grid) return; - - const updatedColumns: any[] = this.state.columns.map((col: any) => - col.field === this.state.currentColumn!.field - ? { ...col, disabledSummaries: [] } - : col - ); - - this.setState((prevState: any) => ({ - currentColumn: { ...prevState.currentColumn!, disabledSummaries: [] }, - columns: updatedColumns, - disableAllBtnDisabled: false, - enableAllBtnDisabled: true, - }), () => { - this.updateCheckboxes(); - this.grid.markForCheck(); - }); - }; - - public render(): JSX.Element { - return ( -
-
-

Disable Summaries for Column:

- {this.state.columns.map((col: any) => ( - this.openDialog({ field: col.field, header: col.header })} - > - {col.header} - - ))} -
- -
- {this.state.currentColumn && this.state.checkboxStates.map((checkbox: any) => ( - this.toggleSummary(checkbox.key)} - > - {checkbox.label} - - ))} -
- Disable All - Enable All -
- -
- - col.field === "ProductID")?.disabledSummaries}> - col.field === "ProductName")?.disabledSummaries}> - col.field === "UnitPrice")?.disabledSummaries}> - col.field === "UnitsInStock")?.disabledSummaries}> - col.field === "Discontinued")?.disabledSummaries}> - col.field === "OrderDate")?.disabledSummaries}> - -
-
- ); - } + > +
+ {currentColumn && + checkboxStates.map((checkbox: any) => ( + toggleSummary(checkbox.key)} + > + {checkbox.label} + + ))} +
+ + Disable All + + + Enable All + +
+ +
+ + col.field === "ProductID") + ?.disabledSummaries + } + > + col.field === "ProductName") + ?.disabledSummaries + } + > + col.field === "UnitPrice") + ?.disabledSummaries + } + > + col.field === "UnitsInStock") + ?.disabledSummaries + } + > + col.field === "Discontinued") + ?.disabledSummaries + } + > + col.field === "OrderDate") + ?.disabledSummaries + } + > + +
+
+ ); } // rendering above component in the React DOM -const root = ReactDOM.createRoot(document.getElementById('root')); -root.render(); \ No newline at end of file +const root = ReactDOM.createRoot(document.getElementById("root")); +root.render(); diff --git a/samples/grids/grid/finjs/src/index.tsx b/samples/grids/grid/finjs/src/index.tsx index cdcc50c604..606aedafd5 100644 --- a/samples/grids/grid/finjs/src/index.tsx +++ b/samples/grids/grid/finjs/src/index.tsx @@ -121,7 +121,7 @@ export default function FinjsSample() { const rowData = gridRef.current.getRowData(cell.id.rowID); const isValueUp: boolean = trends.positive(rowData); const icon = isValueUp ? "trending_up" : "trending_down"; - const value = cell.value.toFixed(4); + const value = parseFloat(cell.value).toFixed(4); return (
diff --git a/samples/grids/grid/paste/src/index.tsx b/samples/grids/grid/paste/src/index.tsx index 92bf6fd47e..6d4661a00b 100644 --- a/samples/grids/grid/paste/src/index.tsx +++ b/samples/grids/grid/paste/src/index.tsx @@ -313,4 +313,4 @@ export default class Sample extends React.Component { // rendering above component in the React DOM const root = ReactDOM.createRoot(document.getElementById('root')); -root.render(); \ No newline at end of file +root.render(); diff --git a/samples/grids/grid/remote-paging-grid/src/index.tsx b/samples/grids/grid/remote-paging-grid/src/index.tsx index e301fba9ef..e7a1ca6192 100644 --- a/samples/grids/grid/remote-paging-grid/src/index.tsx +++ b/samples/grids/grid/remote-paging-grid/src/index.tsx @@ -1,6 +1,8 @@ import React, { useEffect, useRef, useState } from "react"; import ReactDOM from "react-dom/client"; -import { IgrColumn, IgrGrid, IgrPaginator } from "igniteui-react-grids"; +import { IgrGrid, IgrPaginator } from "igniteui-react-grids"; +import { IgrColumn } from "igniteui-react-grids"; +import "igniteui-react-grids/grids/combined"; import "igniteui-react-grids/grids/themes/light/bootstrap.css"; import { RemoteService } from "./RemotePagingService"; import { CustomersWithPageResponseModel } from "./CustomersWithPageResponseModel"; diff --git a/samples/grids/hierarchical-grid/disabled-summaries/src/index.tsx b/samples/grids/hierarchical-grid/disabled-summaries/src/index.tsx index c39e9fcc3a..0379d23059 100644 --- a/samples/grids/hierarchical-grid/disabled-summaries/src/index.tsx +++ b/samples/grids/hierarchical-grid/disabled-summaries/src/index.tsx @@ -1,20 +1,13 @@ -import React from 'react'; +import React, { useEffect, useState } from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; import { IgrButton, IgrDialog, IgrCheckbox } from 'igniteui-react'; -import { IgrButtonModule, IgrDialogModule, IgrCheckboxModule } from 'igniteui-react'; -import { IgrHierarchicalGridModule, IgrSummaryOperand, IgrSummaryResult, IgrNumberSummaryOperand } from 'igniteui-react-grids'; -import { IgrHierarchicalGrid, IgrRowIsland, IgrColumn } from "igniteui-react-grids"; +import { IgrSummaryOperand, IgrSummaryResult, IgrHierarchicalGrid, IgrRowIsland, IgrColumn } from 'igniteui-react-grids'; import SingersData from './SingersData.json'; import 'igniteui-react-grids/grids/themes/light/bootstrap.css'; -IgrHierarchicalGridModule.register(); -IgrButtonModule.register(); -IgrDialogModule.register(); -IgrCheckboxModule.register(); - export class GrammySummary extends IgrSummaryOperand { operate(data: any[] = [], allData: any[] = [], fieldName: string = ""): IgrSummaryResult[] { const result: IgrSummaryResult[] = []; @@ -53,237 +46,264 @@ export class GrammySummary extends IgrSummaryOperand { } } -export default class Sample extends React.Component { - private hierarchicalGrid: IgrHierarchicalGrid; - private dialog: IgrDialog; - - constructor(props: any) { - super(props); - - this.state = { - currentColumn: null, - disableAllBtnDisabled: false, - enableAllBtnDisabled: false, - checkboxStates: [], - columns: [ - { field: "Artist", header: "Artist", hasSummary: true, disabledSummaries: [] }, - { field: "Photo", header: "Photo", dataType: "image", hasSummary: true, summaries: GrammySummary, disabledSummaries: [] }, - { field: "Debut", header: "Debut", hasSummary: true, disabledSummaries: [] }, - { field: "GrammyNominations", header: "Grammy Nominations", dataType: "number", hasSummary: true, disabledSummaries: [] }, - { field: "GrammyAwards", header: "Grammy Awards", dataType: "number", hasSummary: true, disabledSummaries: [] } - ] - }; - - this.hierarchicalGridRef = this.hierarchicalGridRef.bind(this); - this.dialogRef = this.dialogRef.bind(this); - this.openDialog = this.openDialog.bind(this); - this.updateCheckboxes = this.updateCheckboxes.bind(this); - this.toggleSummary = this.toggleSummary.bind(this); - this.disableAllSummaries = this.disableAllSummaries.bind(this); - this.enableAllSummaries = this.enableAllSummaries.bind(this); - } - - hierarchicalGridRef = (ref: IgrHierarchicalGrid) => { - this.hierarchicalGrid = ref; +interface SummaryColumn { + field: string; + header: string; + hasSummary: boolean; + dataType?: string; + summaries?: any; + disabledSummaries: string[]; +} + +export default function DisabledSummariesHierarchicalGridSample() { + // State + const [singersData, setSingersData] = useState([]); + const [currentColumn, setCurrentColumn] = useState(null); + const [currentColumnSource, setCurrentColumnSource] = useState<"dialog" | "toggle" | null>(null); + const [pendingUpdateType, setPendingUpdateType] = useState(null); + const [disableAllBtnDisabled, setDisableAllBtnDisabled] = useState(false); + const [enableAllBtnDisabled, setEnableAllBtnDisabled] = useState(false); + const [checkboxStates, setCheckboxStates] = useState([]); + + const [columns, setColumns] = useState([ + { field: "Artist", header: "Artist", hasSummary: true, disabledSummaries: [] }, + { field: "Photo", header: "Photo", dataType: "image", hasSummary: true, summaries: GrammySummary, disabledSummaries: [] }, + { field: "Debut", header: "Debut", hasSummary: true, disabledSummaries: [] }, + { field: "GrammyNominations", header: "Grammy Nominations", dataType: "number", hasSummary: true, disabledSummaries: [] }, + { field: "GrammyAwards", header: "Grammy Awards", dataType: "number", hasSummary: true, disabledSummaries: [] } + ]); + + // Refs + let hierarchicalGrid: IgrHierarchicalGrid; + const hierarchicalGridRef = (ref: IgrHierarchicalGrid) => { + hierarchicalGrid = ref; }; - - dialogRef = (ref: IgrDialog) => { - this.dialog = ref; - if (this.dialog) { - this.dialog.closeOnOutsideClick = true; - this.dialog.keepOpenOnEscape = false; + let dialog: IgrDialog; + const dialogRef = (ref: IgrDialog) => { + dialog = ref; + if (dialog) { + dialog.closeOnOutsideClick = true; + dialog.keepOpenOnEscape = false; } }; - private _singersData: any[] = SingersData; - public get singersData(): any[] { - return this._singersData; - } - - openDialog = (column: any) => { - const columnState: any | undefined = this.state.columns.find((c: any) => c.field === column.field); + useEffect(() => { + setSingersData(SingersData); + }, []); + + useEffect(() => { + if (!currentColumn) return; + + const shouldShowDialog = currentColumnSource === "dialog"; + const shouldMarkForCheck = + currentColumnSource === "toggle" || + pendingUpdateType === "disableAll" || + pendingUpdateType === "enableAll"; + + if (shouldShowDialog) { + updateCheckboxes(); + dialog?.show(); + setCurrentColumnSource(null); + } + + if (shouldMarkForCheck && hierarchicalGrid) { + updateCheckboxes(); + hierarchicalGrid.markForCheck(); + setPendingUpdateType(null); + setCurrentColumnSource(null); + } + }, [currentColumn, currentColumnSource, pendingUpdateType, hierarchicalGrid]); - this.setState({ - currentColumn: columnState!, - checkboxStates: [], - }, () => { - this.updateCheckboxes(); - this.dialog?.show(); - }); + const openDialog = (column: any) => { + const columnState = columns.find((c) => c.field === column.field); + setCurrentColumn(columnState!); + setCurrentColumnSource("dialog"); + setCheckboxStates([]); }; - getSummaryResults(operand: any, data: any[], field: string): IgrSummaryResult[] { + const getSummaryResults = ( + operand: any, + data: any[], + field: string + ): IgrSummaryResult[] => { if (typeof operand === "function") { - operand = new operand(); + operand = new operand(); } if (operand instanceof IgrSummaryOperand) { - return operand.operate([], data, field, null); - } else if (!operand) { - return new IgrSummaryOperand().operate([], data, field, null); + return operand.operate([], data, field, null); + } else if (!operand) { + return new IgrSummaryOperand().operate([], data, field, null); } return []; - } + }; - getDefaultSummaries(data: any[], field: string): IgrSummaryResult[] { - const columnInstance = this.hierarchicalGrid.columns.find((c: any) => c.field === field); - if (columnInstance && columnInstance.summaries && typeof columnInstance.summaries.operate === 'function') { + const getDefaultSummaries = ( + data: any[], + field: string + ): IgrSummaryResult[] => { + const columnInstance = hierarchicalGrid.columns.find((c) => c.field === field); + if ( + columnInstance && + columnInstance.summaries && + typeof columnInstance.summaries.operate === "function" + ) { return columnInstance.summaries.operate([], data, field, null); } return []; - } - - updateCheckboxes() { - if (!this.state.currentColumn || !this.hierarchicalGrid) return; + }; - const gridData: any[] = this.hierarchicalGrid.data; + const updateCheckboxes = () => { + if (!currentColumn || !hierarchicalGrid) return; + + const gridData: any[] = hierarchicalGrid.data; let allSummaries: IgrSummaryResult[] = []; - if (this.state.currentColumn.summaries) { - allSummaries = this.getSummaryResults(this.state.currentColumn.summaries, gridData, this.state.currentColumn.field); - } else { - allSummaries = this.getDefaultSummaries(gridData, this.state.currentColumn.field); + if (currentColumn.summaries) { + allSummaries = getSummaryResults( + currentColumn.summaries, + gridData, + currentColumn.field + ); + } else { + allSummaries = getDefaultSummaries(gridData, currentColumn.field); } - + let allDisabled: boolean = true; let allEnabled: boolean = true; - - const checkboxStates: any[] = allSummaries.map(summary => { - const isDisabled = this.state.currentColumn.disabledSummaries.includes(summary.key); - if (isDisabled) { - allEnabled = false; - } else { - allDisabled = false; - } - return { - label: summary.label, - key: summary.key, - checked: isDisabled, - }; + + const newCheckboxStates: any[] = allSummaries.map((summary) => { + const isDisabled = currentColumn.disabledSummaries.includes(summary.key); + if (isDisabled) { + allEnabled = false; + } else { + allDisabled = false; + } + return { + label: summary.label, + key: summary.key, + checked: isDisabled, + }; }); + + setCheckboxStates(newCheckboxStates); + setDisableAllBtnDisabled(allDisabled); + setEnableAllBtnDisabled(allEnabled); + }; - this.setState({ - checkboxStates, - disableAllBtnDisabled: allDisabled, - enableAllBtnDisabled: allEnabled, - }); - } - - toggleSummary = (summaryKey: string) => { - if (!this.state.currentColumn || !this.hierarchicalGrid) return; - const { currentColumn, columns } = this.state; - - const updatedDisabledSummaries: string[] = currentColumn.disabledSummaries.includes(summaryKey) - ? currentColumn.disabledSummaries.filter((key: any) => key !== summaryKey) - : [...currentColumn.disabledSummaries, summaryKey]; - - const updatedColumns: any[] = columns.map((col: any) => - col.field === currentColumn.field - ? { ...col, disabledSummaries: updatedDisabledSummaries } - : col + const toggleSummary = (summaryKey: string) => { + if (!currentColumn || !hierarchicalGrid) return; + + const updatedDisabledSummaries = currentColumn.disabledSummaries.includes( + summaryKey + ) + ? currentColumn.disabledSummaries.filter((key: any) => key !== summaryKey) + : [...currentColumn.disabledSummaries, summaryKey]; + + const updatedColumns = columns.map((col: any) => + col.field === currentColumn.field + ? { ...col, disabledSummaries: updatedDisabledSummaries } + : col ); - - this.setState({ - currentColumn: { ...currentColumn, disabledSummaries: updatedDisabledSummaries }, - columns: updatedColumns, - }, () => { - this.hierarchicalGrid.markForCheck(); - }); + + setCurrentColumn((prev) => ({ + ...prev, + disabledSummaries: updatedDisabledSummaries, + })); + setColumns(updatedColumns); + setCurrentColumnSource("toggle"); }; - disableAllSummaries = () => { - if (!this.state.currentColumn || !this.hierarchicalGrid) return; - - const gridData: any[] = this.hierarchicalGrid.data; - let allSummaries: IgrSummaryResult[] = []; - if (this.state.currentColumn.summaries) { - allSummaries = this.getSummaryResults(this.state.currentColumn.summaries, gridData, this.state.currentColumn.field); - } else { - allSummaries = this.getDefaultSummaries(gridData, this.state.currentColumn.field); - } - - const allSummaryKeys: string[] = allSummaries.map(s => s.key); - - const updatedColumns: any[] = this.state.columns.map((col: any) => - col.field === this.state.currentColumn!.field - ? { ...col, disabledSummaries: allSummaryKeys } - : col + const disableAllSummaries = () => { + if (!currentColumn || !hierarchicalGrid) return; + + const gridData: any[] = hierarchicalGrid.data; + let allSummaries: IgrSummaryResult[] = currentColumn.summaries + ? getSummaryResults( + currentColumn.summaries, + gridData, + currentColumn.field + ) + : getDefaultSummaries(gridData, currentColumn.field); + + const allSummaryKeys: string[] = allSummaries.map((s) => s.key); + + const updatedColumns = columns.map((col: any) => + col.field === currentColumn.field + ? { ...col, disabledSummaries: allSummaryKeys } + : col ); - - this.setState((prevState: any) => ({ - currentColumn: { ...prevState.currentColumn!, disabledSummaries: allSummaryKeys }, - columns: updatedColumns, - disableAllBtnDisabled: true, - enableAllBtnDisabled: false, - }), () => { - this.updateCheckboxes(); - this.hierarchicalGrid.markForCheck(); - }); + + setCurrentColumn((prev) => ({ + ...prev, + disabledSummaries: allSummaryKeys, + })); + setColumns(updatedColumns); + setDisableAllBtnDisabled(true); + setEnableAllBtnDisabled(false); + + setPendingUpdateType("disableAll"); }; - enableAllSummaries = () => { - if (!this.state.currentColumn || !this.hierarchicalGrid) return; - - const updatedColumns: any[] = this.state.columns.map((col: any) => - col.field === this.state.currentColumn!.field - ? { ...col, disabledSummaries: [] } - : col + const enableAllSummaries = () => { + if (!currentColumn || !hierarchicalGrid) return; + + const updatedColumns = columns.map((col: any) => + col.field === currentColumn.field + ? { ...col, disabledSummaries: [] } + : col ); - - this.setState((prevState: any) => ({ - currentColumn: { ...prevState.currentColumn!, disabledSummaries: [] }, - columns: updatedColumns, - disableAllBtnDisabled: false, - enableAllBtnDisabled: true, - }), () => { - this.updateCheckboxes(); - this.hierarchicalGrid.markForCheck(); - }); + + setCurrentColumn((prev) => ({ ...prev, disabledSummaries: [] })); + setColumns(updatedColumns); + setDisableAllBtnDisabled(false); + setEnableAllBtnDisabled(true); + + setPendingUpdateType("enableAll"); }; - public render(): JSX.Element { - return ( -
+ return ( +

Disable Summaries for Column:

- {this.state.columns.map((col: any) => ( + {columns.map((col: any) => ( this.openDialog({ field: col.field, header: col.header })} + onClick={() => openDialog({ field: col.field, header: col.header })} > {col.header} ))}
- +
- {this.state.currentColumn && this.state.checkboxStates.map((checkbox: any) => ( + {currentColumn && checkboxStates.map((checkbox: any) => ( this.toggleSummary(checkbox.key)} + onClick={() => toggleSummary(checkbox.key)} > {checkbox.label} ))}
- Disable All - Enable All + Disable All + Enable All
col.field === "Artist")?.disabledSummaries}> + disabledSummaries={columns.find((col: any) => col.field === "Artist")?.disabledSummaries}> { dataType="image" hasSummary={true} summaries={GrammySummary} - disabledSummaries={this.state.columns.find((col: any) => col.field === "Photo")?.disabledSummaries}> + disabledSummaries={columns.find((col: any) => col.field === "Photo")?.disabledSummaries}> col.field === "Debut")?.disabledSummaries}> + disabledSummaries={columns.find((col: any) => col.field === "Debut")?.disabledSummaries}> col.field === "GrammyNominations")?.disabledSummaries}> + disabledSummaries={columns.find((col: any) => col.field === "GrammyNominations")?.disabledSummaries}> col.field === "GrammyAwards")?.disabledSummaries}> + disabledSummaries={columns.find((col: any) => col.field === "GrammyAwards")?.disabledSummaries}> {
-
- ); - } +
+ ); } // rendering above component in the React DOM const root = ReactDOM.createRoot(document.getElementById('root')); -root.render(); \ No newline at end of file +root.render(); \ No newline at end of file diff --git a/samples/grids/hierarchical-grid/remote-paging-hgrid/src/index.tsx b/samples/grids/hierarchical-grid/remote-paging-hgrid/src/index.tsx index ce74b5a0cf..a23d265f79 100644 --- a/samples/grids/hierarchical-grid/remote-paging-hgrid/src/index.tsx +++ b/samples/grids/hierarchical-grid/remote-paging-hgrid/src/index.tsx @@ -77,67 +77,71 @@ export default function App() { setPerPage(args.detail); } + const onCustomersGridCreatedHandler = (e: IgrGridCreatedEventArgs) => { + gridCreated(e, "Customers") + }; + + const onOrdersGridCreatedHandler = (e: IgrGridCreatedEventArgs) => { + gridCreated(e, "Orders") + }; + return ( -
-
- + + + + + + + + + + - - - - - - - + + + + + - gridCreated(e, "Customers") - } + childDataKey="Details" + primaryKey="productId" + onGridCreated={onOrdersGridCreatedHandler} + height="100%" > - - - - - - - - gridCreated(e, "Orders") - } - > - - - - - + + + + - -
+ +
); } diff --git a/samples/grids/list/add-list-items/src/index.tsx b/samples/grids/list/add-list-items/src/index.tsx index 05ccbdfc66..67d21a75b6 100644 --- a/samples/grids/list/add-list-items/src/index.tsx +++ b/samples/grids/list/add-list-items/src/index.tsx @@ -1,11 +1,9 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrList, IgrListItem, IgrListHeader, IgrListModule } from 'igniteui-react'; +import { IgrList, IgrListItem, IgrListHeader } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrListModule.register(); - export default class ListAddListItems extends React.Component { constructor(props: any) { diff --git a/samples/grids/list/list-item-content/src/index.tsx b/samples/grids/list/list-item-content/src/index.tsx index c1963666c2..3d58052ad2 100644 --- a/samples/grids/list/list-item-content/src/index.tsx +++ b/samples/grids/list/list-item-content/src/index.tsx @@ -1,11 +1,9 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrList, IgrListItem, IgrListHeader, IgrListModule } from 'igniteui-react'; +import { IgrList, IgrListItem, IgrListHeader } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrListModule.register(); - export default class ListItemContent extends React.Component { constructor(props: any) { diff --git a/samples/grids/list/overview/src/index.tsx b/samples/grids/list/overview/src/index.tsx index 09b3985a2e..e744c51aa4 100644 --- a/samples/grids/list/overview/src/index.tsx +++ b/samples/grids/list/overview/src/index.tsx @@ -1,16 +1,9 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrList, IgrListItem, IgrListHeader, IgrRadioGroup, IgrRadio, IgrAvatar, IgrButton, - IgrListModule, IgrRadioGroupModule, IgrRadioModule, IgrAvatarModule, IgrButtonModule } from 'igniteui-react'; +import { IgrList, IgrListItem, IgrListHeader, IgrRadioGroup, IgrRadio, IgrAvatar, IgrButton } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrAvatarModule.register(); -IgrButtonModule.register(); -IgrListModule.register(); -IgrRadioGroupModule.register(); -IgrRadioModule.register(); - export default class ListOverview extends React.Component { constructor(props: any) { @@ -23,13 +16,13 @@ export default class ListOverview extends React.Component { return (
- + Small - + Medium - + Large @@ -96,7 +89,7 @@ export default class ListOverview extends React.Component { public onRadioChange(e: any) { if (e.detail.checked == true) { - this.setState({ listSize: e.value }); + this.setState({ listSize: e.detail.value }); } } } diff --git a/samples/grids/list/styling/src/index.tsx b/samples/grids/list/styling/src/index.tsx index e9d66699c3..156fb51156 100644 --- a/samples/grids/list/styling/src/index.tsx +++ b/samples/grids/list/styling/src/index.tsx @@ -2,13 +2,9 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; import './ListStyling.css'; -import { IgrList, IgrListItem, IgrListHeader, IgrAvatar, IgrButton, IgrListModule, IgrAvatarModule, IgrButtonModule } from 'igniteui-react'; +import { IgrList, IgrListItem, IgrListHeader, IgrAvatar, IgrButton } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrAvatarModule.register(); -IgrButtonModule.register(); -IgrListModule.register(); - export default class ListStyling extends React.Component { constructor(props: any) { diff --git a/samples/grids/pivot-grid/data-selector/src/index.tsx b/samples/grids/pivot-grid/data-selector/src/index.tsx index 71a7baafb8..3e7ce5e3db 100644 --- a/samples/grids/pivot-grid/data-selector/src/index.tsx +++ b/samples/grids/pivot-grid/data-selector/src/index.tsx @@ -2,17 +2,10 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; import { SALES_DATA_NEW as pivotData } from './salesDataNew'; -import { IgrPivotConfiguration, IgrPivotDataSelector, IgrPivotDataSelectorModule, - IgrPivotGrid, IgrPivotGridModule } from 'igniteui-react-grids'; +import { IgrPivotConfiguration, IgrPivotDataSelector, IgrPivotDateDimension, IgrPivotGrid } from 'igniteui-react-grids'; import 'igniteui-react-grids/grids/themes/light/bootstrap.css'; -const mods: any[] = [ - IgrPivotGridModule, - IgrPivotDataSelectorModule -]; -mods.forEach((m) => m.register()); - export default function App() { let grid: IgrPivotGrid; const gridRef = (r: IgrPivotGrid) => { @@ -23,10 +16,10 @@ export default function App() { } const pivotConfiguration: IgrPivotConfiguration = { rows: [ - { + new IgrPivotDateDimension({ enabled: true, memberName: "Date", - }, + }) ], columns: [ { @@ -66,7 +59,7 @@ export default function App() {
- +
diff --git a/samples/grids/tree-grid/data-searching/src/index.tsx b/samples/grids/tree-grid/data-searching/src/index.tsx index 7f216776b2..219d1ac070 100644 --- a/samples/grids/tree-grid/data-searching/src/index.tsx +++ b/samples/grids/tree-grid/data-searching/src/index.tsx @@ -1,27 +1,19 @@ import React, { KeyboardEvent, useEffect, useRef, useState } from "react"; import ReactDOM from "react-dom/client"; import "./index.css"; - -import { IgrTreeGridModule } from "igniteui-react-grids"; import { IgrTreeGrid, IgrColumn } from "igniteui-react-grids"; import { EmployeesFlatData } from "./EmployeesFlatData"; - import "igniteui-react-grids/grids/themes/light/bootstrap.css"; import { IgrChip, - IgrChipModule, IgrComponentBoolValueChangedEventArgs, IgrComponentValueChangedEventArgs, IgrIconButton, - IgrIconButtonModule, IgrInput, - IgrInputModule, + IgrRipple, registerIconFromText, } from "igniteui-react"; -const mods: any[] = [IgrTreeGridModule, IgrChipModule, IgrIconButtonModule, IgrInputModule]; -mods.forEach((m) => m.register()); - const searchIconText = ""; const prevIconText = @@ -35,52 +27,53 @@ const data = new EmployeesFlatData(); export default function Sample() { const gridRef = useRef(null); - const caseSensitiveChipRef = useRef(null); - const exactMatchChipRef = useRef(null); - - const [searchText, setSearchText] = useState('') + const [caseSensitiveSelected, setCaseSensitiveSelected] = useState(false); + const [exactMatchSelected, setExactMatchSelected] = useState(false); + const [searchText, setSearchText] = useState(''); useEffect(() => { registerIconFromText("search", searchIconText, "material"); registerIconFromText("clear", clearIconText, "material"); - registerIconFromText("prev", prevIconText,"material"); + registerIconFromText("prev", prevIconText, "material"); registerIconFromText("next", nextIconText, "material"); }, []); - function handleOnSearchChange(event: IgrComponentValueChangedEventArgs) { + const handleOnSearchChange = (event: IgrComponentValueChangedEventArgs) => { setSearchText(event.detail); - gridRef.current.findNext(event.detail, caseSensitiveChipRef.current.selected, exactMatchChipRef.current.selected); + nextSearch(event.detail, caseSensitiveSelected, exactMatchSelected); } - function handleCaseSensitiveChange(event: IgrComponentBoolValueChangedEventArgs) { - gridRef.current.findNext(searchText, event.detail, exactMatchChipRef.current.selected); + const clearSearch = () => { + setSearchText(''); + gridRef.current.clearSearch(); } - function handleExactMatchChange(event: IgrComponentBoolValueChangedEventArgs) { - gridRef.current.findNext(searchText, caseSensitiveChipRef.current.selected, event.detail); + const searchKeyDown = (e: KeyboardEvent) => { + if (e.key === 'Enter' || e.key === 'ArrowDown') { + e.preventDefault(); + nextSearch(searchText, caseSensitiveSelected, exactMatchSelected); + } else if (e.key === 'ArrowUp') { + e.preventDefault(); + prevSearch(searchText, caseSensitiveSelected, exactMatchSelected); + } } - function clearSearch() { - setSearchText(''); - gridRef.current.clearSearch(); + const handleCaseSensitiveChange = (event: IgrComponentBoolValueChangedEventArgs) => { + setCaseSensitiveSelected(!caseSensitiveSelected); + nextSearch(searchText, event.detail, exactMatchSelected); } - function prevSearch() { - gridRef.current.findPrev(searchText, caseSensitiveChipRef.current.selected, exactMatchChipRef.current.selected); + const handleExactMatchChange = (event: IgrComponentBoolValueChangedEventArgs) => { + setExactMatchSelected(!exactMatchSelected); + nextSearch(searchText, caseSensitiveSelected, event.detail); } - function nextSearch() { - gridRef.current.findNext(searchText, caseSensitiveChipRef.current.selected, exactMatchChipRef.current.selected); + const prevSearch = (text: string, caseSensitive: boolean, exactMatch: boolean) => { + gridRef.current.findPrev(text, caseSensitive, exactMatch); } - function searchKeyDown(e: KeyboardEvent) { - if (e.key === 'Enter' || e.key === 'ArrowDown') { - e.preventDefault(); - gridRef.current.findNext(searchText, caseSensitiveChipRef.current.selected, exactMatchChipRef.current.selected); - } else if (e.key === 'ArrowUp') { - e.preventDefault(); - gridRef.current.findPrev(searchText, caseSensitiveChipRef.current.selected, exactMatchChipRef.current.selected); - } + const nextSearch = (text: string, caseSensitive: boolean, exactMatch: boolean) => { + gridRef.current.findNext(text, caseSensitive, exactMatch); } return ( @@ -89,17 +82,15 @@ export default function Sample() {
-
+
{searchText.length === 0 ? ( ) : ( )}
- -
- - Case Sensitive + +
+ + Case Sensitive - - Exact Match + + Exact Match
-
+
+ onClick={() => prevSearch(searchText, caseSensitiveSelected, exactMatchSelected)} + > + + + onClick={() => nextSearch(searchText, caseSensitiveSelected, exactMatchSelected)} + > + +
- - - - - - + + + + + +
diff --git a/samples/grids/tree-grid/disabled-summaries/src/index.tsx b/samples/grids/tree-grid/disabled-summaries/src/index.tsx index 769488c57a..b564bad4f4 100644 --- a/samples/grids/tree-grid/disabled-summaries/src/index.tsx +++ b/samples/grids/tree-grid/disabled-summaries/src/index.tsx @@ -1,19 +1,14 @@ -import React from 'react'; +import React, { useEffect, useState } from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; import { IgrButton, IgrDialog, IgrCheckbox } from 'igniteui-react'; -import { IgrButtonModule, IgrDialogModule, IgrCheckboxModule } from 'igniteui-react'; -import { IgrTreeGridModule, IgrSummaryOperand, IgrSummaryResult } from 'igniteui-react-grids'; -import { IgrTreeGrid, IgrColumn } from "igniteui-react-grids"; +import { IgrSummaryOperand, IgrSummaryResult, IgrTreeGrid, IgrColumn } from 'igniteui-react-grids'; import 'igniteui-react-grids/grids/themes/light/bootstrap.css'; import { OrdersTreeData } from './OrdersTreeData'; +import { get } from 'http'; -IgrTreeGridModule.register(); -IgrButtonModule.register(); -IgrDialogModule.register(); -IgrCheckboxModule.register(); export class UnitsSummary extends IgrSummaryOperand { operate(data: any[] = [], allData: any[] = [], fieldName: string = ""): IgrSummaryResult[] { @@ -124,236 +119,262 @@ export class DeliveredSummary extends IgrSummaryOperand { } } -export default class Sample extends React.Component { - private treeGrid: IgrTreeGrid; - private dialog: IgrDialog; - - constructor(props: any) { - super(props); - - this.state = { - currentColumn: null, - disableAllBtnDisabled: false, - enableAllBtnDisabled: false, - checkboxStates: [], - columns: [ - { field: "ID", header: "Order ID", hasSummary: true, disabledSummaries: [] }, - { field: "Name", header: "Order Product", hasSummary: true, disabledSummaries: [] }, - { field: "Units", header: "Units", hasSummary: true, dataType: "number", summaries: UnitsSummary, disabledSummaries: [] }, - { field: "UnitPrice", header: "Unit Price", hasSummary: true, dataType: "number", disabledSummaries: [] }, - { field: "Price", header: "Price", hasSummary: true, dataType: "number", disabledSummaries: [] }, - { field: "Delivered", header: "Delivered", hasSummary: true, summaries: DeliveredSummary, disabledSummaries: [] }, - { field: "OrderDate", header: "Order Date", hasSummary: true, dataType: "date", disabledSummaries: [] }, - ], - }; - - this.treeGridRef = this.treeGridRef.bind(this); - this.dialogRef = this.dialogRef.bind(this); - this.openDialog = this.openDialog.bind(this); - this.updateCheckboxes = this.updateCheckboxes.bind(this); - this.toggleSummary = this.toggleSummary.bind(this); - this.disableAllSummaries = this.disableAllSummaries.bind(this); - this.enableAllSummaries = this.enableAllSummaries.bind(this); - } +interface SummaryColumn { + field: string; + header: string; + hasSummary: boolean; + dataType?: string; + summaries?: any; + disabledSummaries: string[]; +} - treeGridRef = (ref: IgrTreeGrid) => { - this.treeGrid = ref; +export default function DisabledSummariesTreeGridSample() { + + // State + const [ordersTreeData, setOrdersTreeData] = useState([]); + const [currentColumn, setCurrentColumn] = useState(null); + const [currentColumnSource, setCurrentColumnSource] = useState<"dialog" | "toggle" | null>(null); + const [pendingUpdateType, setPendingUpdateType] = useState(null); + const [disableAllBtnDisabled, setDisableAllBtnDisabled] = useState(false); + const [enableAllBtnDisabled, setEnableAllBtnDisabled] = useState(false); + const [checkboxStates, setCheckboxStates] = useState([]); + const [columns, setColumns] = useState([ + { field: "ID", header: "Order ID", hasSummary: true, disabledSummaries: [] }, + { field: "Name", header: "Order Product", hasSummary: true, disabledSummaries: [] }, + { field: "Units", header: "Units", hasSummary: true, dataType: "number", summaries: UnitsSummary, disabledSummaries: [] }, + { field: "UnitPrice", header: "Unit Price", hasSummary: true, dataType: "number", disabledSummaries: [] }, + { field: "Price", header: "Price", hasSummary: true, dataType: "number", disabledSummaries: [] }, + { field: "Delivered", header: "Delivered", hasSummary: true, summaries: DeliveredSummary, disabledSummaries: [] }, + { field: "OrderDate", header: "Order Date", hasSummary: true, dataType: "date", disabledSummaries: [] }, + ]); + + // Refs + let treeGrid: IgrTreeGrid; + const treeGridRef = (ref: IgrTreeGrid) => { + treeGrid = ref; }; - - dialogRef = (ref: IgrDialog) => { - this.dialog = ref; - if (this.dialog) { - this.dialog.closeOnOutsideClick = true; - this.dialog.keepOpenOnEscape = false; + let dialog: IgrDialog; + const dialogRef = (ref: IgrDialog) => { + dialog = ref; + if (dialog) { + dialog.closeOnOutsideClick = true; + dialog.keepOpenOnEscape = false; } }; - private _ordersTreeData: OrdersTreeData = null; - public get ordersTreeData(): OrdersTreeData { - if (this._ordersTreeData == null) - { - this._ordersTreeData = new OrdersTreeData(); + useEffect(() => { + const data = new OrdersTreeData(); + setOrdersTreeData(data); + }, []); + + useEffect(() => { + if (!currentColumn) return; + + const shouldShowDialog = currentColumnSource === "dialog"; + const shouldMarkForCheck = + currentColumnSource === "toggle" || + pendingUpdateType === "disableAll" || + pendingUpdateType === "enableAll"; + + if (shouldShowDialog) { + updateCheckboxes(); + dialog?.show(); + setCurrentColumnSource(null); } - return this._ordersTreeData; - } - - openDialog = (column: any) => { - const columnState: any | undefined = this.state.columns.find((c: any) => c.field === column.field); - - this.setState({ - currentColumn: columnState!, - checkboxStates: [], - }, () => { - this.updateCheckboxes(); - this.dialog?.show(); - }); - }; - - getSummaryResults(operand: any, data: any[], field: string): IgrSummaryResult[] { + + if (shouldMarkForCheck && treeGrid) { + updateCheckboxes(); + treeGrid.markForCheck(); + setPendingUpdateType(null); + setCurrentColumnSource(null); + } + }, [currentColumn, currentColumnSource, pendingUpdateType, treeGrid]); + + const openDialog = (column: any) => { + const columnState = columns.find((c) => c.field === column.field); + setCurrentColumn(columnState!); + setCurrentColumnSource("dialog"); + setCheckboxStates([]); + }; + + const getSummaryResults = ( + operand: any, + data: any[], + field: string + ): IgrSummaryResult[] => { if (typeof operand === "function") { - operand = new operand(); + operand = new operand(); } if (operand instanceof IgrSummaryOperand) { - return operand.operate([], data, field, null); - } else if (!operand) { - return new IgrSummaryOperand().operate([], data, field, null); + return operand.operate([], data, field, null); + } else if (!operand) { + return new IgrSummaryOperand().operate([], data, field, null); } return []; - } - - getDefaultSummaries(data: any[], field: string): IgrSummaryResult[] { - const columnInstance = this.treeGrid.columns.find(c => c.field === field); - if (columnInstance && columnInstance.summaries && typeof columnInstance.summaries.operate === 'function') { + }; + + const getDefaultSummaries = ( + data: any[], + field: string + ): IgrSummaryResult[] => { + const columnInstance = treeGrid.columns.find((c) => c.field === field); + if ( + columnInstance && + columnInstance.summaries && + typeof columnInstance.summaries.operate === "function" + ) { return columnInstance.summaries.operate([], data, field, null); } return []; - } - - updateCheckboxes() { - if (!this.state.currentColumn || !this.treeGrid) return; - - const gridData: any[] = this.treeGrid.data; + }; + + const updateCheckboxes = () => { + if (!currentColumn || !treeGrid) return; + + const gridData: any[] = treeGrid.data; let allSummaries: IgrSummaryResult[] = []; - if (this.state.currentColumn.summaries) { - allSummaries = this.getSummaryResults(this.state.currentColumn.summaries, gridData, this.state.currentColumn.field); - } else { - allSummaries = this.getDefaultSummaries(gridData, this.state.currentColumn.field); + if (currentColumn.summaries) { + allSummaries = getSummaryResults( + currentColumn.summaries, + gridData, + currentColumn.field + ); + } else { + allSummaries = getDefaultSummaries(gridData, currentColumn.field); } - + let allDisabled: boolean = true; let allEnabled: boolean = true; - - const checkboxStates: any[] = allSummaries.map(summary => { - const isDisabled = this.state.currentColumn.disabledSummaries.includes(summary.key); - if (isDisabled) { - allEnabled = false; - } else { - allDisabled = false; - } - return { - label: summary.label, - key: summary.key, - checked: isDisabled, - }; - }); - - this.setState({ - checkboxStates, - disableAllBtnDisabled: allDisabled, - enableAllBtnDisabled: allEnabled, + + const newCheckboxStates: any[] = allSummaries.map((summary) => { + const isDisabled = currentColumn.disabledSummaries.includes(summary.key); + if (isDisabled) { + allEnabled = false; + } else { + allDisabled = false; + } + return { + label: summary.label, + key: summary.key, + checked: isDisabled, + }; }); - } - - toggleSummary = (summaryKey: string) => { - if (!this.state.currentColumn || !this.treeGrid) return; - const { currentColumn, columns } = this.state; - - const updatedDisabledSummaries: string[] = currentColumn.disabledSummaries.includes(summaryKey) - ? currentColumn.disabledSummaries.filter((key: any) => key !== summaryKey) - : [...currentColumn.disabledSummaries, summaryKey]; - - const updatedColumns: any[] = columns.map((col: any) => - col.field === currentColumn.field - ? { ...col, disabledSummaries: updatedDisabledSummaries } - : col + + setCheckboxStates(newCheckboxStates); + setDisableAllBtnDisabled(allDisabled); + setEnableAllBtnDisabled(allEnabled); + }; + + const toggleSummary = (summaryKey: string) => { + if (!currentColumn || !treeGrid) return; + + const updatedDisabledSummaries = currentColumn.disabledSummaries.includes( + summaryKey + ) + ? currentColumn.disabledSummaries.filter((key: any) => key !== summaryKey) + : [...currentColumn.disabledSummaries, summaryKey]; + + const updatedColumns = columns.map((col: any) => + col.field === currentColumn.field + ? { ...col, disabledSummaries: updatedDisabledSummaries } + : col ); - - this.setState({ - currentColumn: { ...currentColumn, disabledSummaries: updatedDisabledSummaries }, - columns: updatedColumns, - }, () => { - this.treeGrid.markForCheck(); - }); - }; - - disableAllSummaries = () => { - if (!this.state.currentColumn || !this.treeGrid) return; - - const gridData: any[] = this.treeGrid.data; - let allSummaries: IgrSummaryResult[] = []; - if (this.state.currentColumn.summaries) { - allSummaries = this.getSummaryResults(this.state.currentColumn.summaries, gridData, this.state.currentColumn.field); - } else { - allSummaries = this.getDefaultSummaries(gridData, this.state.currentColumn.field); - } - - const allSummaryKeys: string[] = allSummaries.map(s => s.key); - - const updatedColumns: any[] = this.state.columns.map((col: any) => - col.field === this.state.currentColumn!.field - ? { ...col, disabledSummaries: allSummaryKeys } - : col + + setCurrentColumn((prev) => ({ + ...prev, + disabledSummaries: updatedDisabledSummaries, + })); + setColumns(updatedColumns); + setCurrentColumnSource("toggle"); + }; + + const disableAllSummaries = () => { + if (!currentColumn || !treeGrid) return; + + const gridData: any[] = treeGrid.data; + let allSummaries: IgrSummaryResult[] = currentColumn.summaries + ? getSummaryResults( + currentColumn.summaries, + gridData, + currentColumn.field + ) + : getDefaultSummaries(gridData, currentColumn.field); + + const allSummaryKeys: string[] = allSummaries.map((s) => s.key); + + const updatedColumns = columns.map((col: any) => + col.field === currentColumn.field + ? { ...col, disabledSummaries: allSummaryKeys } + : col ); - - this.setState((prevState: any) => ({ - currentColumn: { ...prevState.currentColumn!, disabledSummaries: allSummaryKeys }, - columns: updatedColumns, - disableAllBtnDisabled: true, - enableAllBtnDisabled: false, - }), () => { - this.updateCheckboxes(); - this.treeGrid.markForCheck(); - }); - }; - - enableAllSummaries = () => { - if (!this.state.currentColumn || !this.treeGrid) return; - - const updatedColumns: any[] = this.state.columns.map((col: any) => - col.field === this.state.currentColumn!.field - ? { ...col, disabledSummaries: [] } - : col + + setCurrentColumn((prev) => ({ + ...prev, + disabledSummaries: allSummaryKeys, + })); + setColumns(updatedColumns); + setDisableAllBtnDisabled(true); + setEnableAllBtnDisabled(false); + + setPendingUpdateType("disableAll"); + }; + + const enableAllSummaries = () => { + if (!currentColumn || !treeGrid) return; + + const updatedColumns = columns.map((col: any) => + col.field === currentColumn.field + ? { ...col, disabledSummaries: [] } + : col ); - - this.setState((prevState: any) => ({ - currentColumn: { ...prevState.currentColumn!, disabledSummaries: [] }, - columns: updatedColumns, - disableAllBtnDisabled: false, - enableAllBtnDisabled: true, - }), () => { - this.updateCheckboxes(); - this.treeGrid.markForCheck(); - }); - }; - - public render(): JSX.Element { - return ( -
+ + setCurrentColumn((prev) => ({ ...prev, disabledSummaries: [] })); + setColumns(updatedColumns); + setDisableAllBtnDisabled(false); + setEnableAllBtnDisabled(true); + + setPendingUpdateType("enableAll"); + }; + + + + return ( +

Disable Summaries for Column:

- {this.state.columns.map((col: any) => ( + {columns.map((col: any) => ( this.openDialog({ field: col.field, header: col.header })} + onClick={() => openDialog({ field: col.field, header: col.header })} > {col.header} ))}
- +
- {this.state.currentColumn && this.state.checkboxStates.map((checkbox: any) => ( + {currentColumn && checkboxStates.map((checkbox: any) => ( this.toggleSummary(checkbox.key)} + onClick={() => toggleSummary(checkbox.key)} > {checkbox.label} ))}
- Disable All - Enable All + Disable All + Enable All
@@ -361,13 +382,13 @@ export default class Sample extends React.Component { field="ID" header="Order ID" hasSummary={true} - disabledSummaries={this.state.columns.find((col: any) => col.field === "ID")?.disabledSummaries}> + disabledSummaries={columns.find((col: any) => col.field === "ID")?.disabledSummaries}> col.field === "Name")?.disabledSummaries}> + disabledSummaries={columns.find((col: any) => col.field === "Name")?.disabledSummaries}> { dataType="number" hasSummary={true} summaries={UnitsSummary} - disabledSummaries={this.state.columns.find((col: any) => col.field === "Units")?.disabledSummaries}> + disabledSummaries={columns.find((col: any) => col.field === "Units")?.disabledSummaries}> col.field === "UnitPrice")?.disabledSummaries}> + disabledSummaries={columns.find((col: any) => col.field === "UnitPrice")?.disabledSummaries}> col.field === "Price")?.disabledSummaries}> + disabledSummaries={columns.find((col: any) => col.field === "Price")?.disabledSummaries}> { dataType="boolean" hasSummary={true} summaries={DeliveredSummary} - disabledSummaries={this.state.columns.find((col: any) => col.field === "Delivered")?.disabledSummaries}> + disabledSummaries={columns.find((col: any) => col.field === "Delivered")?.disabledSummaries}> col.field === "OrderDate")?.disabledSummaries}> + disabledSummaries={columns.find((col: any) => col.field === "OrderDate")?.disabledSummaries}>
-
- ); - } +
+ ); + } // rendering above component in the React DOM const root = ReactDOM.createRoot(document.getElementById('root')); -root.render(); \ No newline at end of file +root.render(); \ No newline at end of file diff --git a/samples/grids/tree/basic-example/src/index.tsx b/samples/grids/tree/basic-example/src/index.tsx index 9408292ba0..a2a40eb915 100644 --- a/samples/grids/tree/basic-example/src/index.tsx +++ b/samples/grids/tree/basic-example/src/index.tsx @@ -1,11 +1,9 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrTree, IgrTreeItem, IgrTreeModule } from 'igniteui-react'; +import { IgrTree, IgrTreeItem } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrTreeModule.register(); - export default class TreeBasicExample extends React.Component { constructor(props: any) { @@ -23,7 +21,7 @@ export default class TreeBasicExample extends React.Component { - + diff --git a/samples/inputs/badge/outlined/src/index.tsx b/samples/inputs/badge/outlined/src/index.tsx index 172f80028a..6c93b91a6f 100644 --- a/samples/inputs/badge/outlined/src/index.tsx +++ b/samples/inputs/badge/outlined/src/index.tsx @@ -1,11 +1,9 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrBadge, IgrBadgeModule } from 'igniteui-react'; +import { IgrBadge } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrBadgeModule.register(); - export default class BadgeOutlined extends React.Component { constructor(props: any) { diff --git a/samples/inputs/badge/shape/src/index.tsx b/samples/inputs/badge/shape/src/index.tsx index cc02159870..abe11d2fd9 100644 --- a/samples/inputs/badge/shape/src/index.tsx +++ b/samples/inputs/badge/shape/src/index.tsx @@ -1,11 +1,9 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrBadge, IgrBadgeModule } from 'igniteui-react'; +import { IgrBadge } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrBadgeModule.register(); - export default class BadgeShape extends React.Component { constructor(props: any) { diff --git a/samples/inputs/badge/variants/src/index.tsx b/samples/inputs/badge/variants/src/index.tsx index 78c0074caf..b036427cbc 100644 --- a/samples/inputs/badge/variants/src/index.tsx +++ b/samples/inputs/badge/variants/src/index.tsx @@ -1,11 +1,9 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrBadge, IgrBadgeModule } from 'igniteui-react'; +import { IgrBadge } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrBadgeModule.register(); - export default class BadgeVariants extends React.Component { constructor(props: any) { diff --git a/samples/inputs/button-group/alignment/src/index.tsx b/samples/inputs/button-group/alignment/src/index.tsx index 47f6b1baf4..b0721cb0d1 100644 --- a/samples/inputs/button-group/alignment/src/index.tsx +++ b/samples/inputs/button-group/alignment/src/index.tsx @@ -2,37 +2,33 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import { IgrButtonGroup, - IgrButtonGroupModule, IgrRipple, - IgrRippleModule, IgrToggleButton, } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/material.css'; import './ButtonGroupAlignment.css'; import './index.css'; -IgrButtonGroupModule.register(); -IgrRippleModule.register(); export default function ButtonGroupAlignment() { return (
- - Sofia - + + Sofia + - - London - + + London + - - New York - + + New York + - - Tokio - + + Tokio +
diff --git a/samples/inputs/button-group/overview/src/index.tsx b/samples/inputs/button-group/overview/src/index.tsx index 1a1cff07d6..a7ceedc44a 100644 --- a/samples/inputs/button-group/overview/src/index.tsx +++ b/samples/inputs/button-group/overview/src/index.tsx @@ -2,11 +2,8 @@ import React, { useEffect } from 'react'; import ReactDOM from 'react-dom/client'; import { IgrButtonGroup, - IgrButtonGroupModule, IgrIcon, - IgrIconModule, IgrRipple, - IgrRippleModule, IgrToggleButton, registerIconFromText, } from 'igniteui-react'; @@ -14,9 +11,6 @@ import 'igniteui-webcomponents/themes/light/material.css'; import './ButtonGroupOverview.css'; import './index.css'; -IgrButtonGroupModule.register(); -IgrIconModule.register(); -IgrRippleModule.register(); const icons = [ { @@ -47,21 +41,21 @@ export default function ButtonGroupOverview() { return (
- - - + + + - - - + + + - - - + + + - - - + + +
diff --git a/samples/inputs/button-group/selection/src/index.tsx b/samples/inputs/button-group/selection/src/index.tsx index 3fad699586..90e51f5ecb 100644 --- a/samples/inputs/button-group/selection/src/index.tsx +++ b/samples/inputs/button-group/selection/src/index.tsx @@ -3,15 +3,11 @@ import ReactDOM from 'react-dom/client'; import { ButtonGroupSelection, IgrButtonGroup, - IgrButtonGroupModule, IgrIcon, - IgrIconModule, IgrRadio, IgrRadioChangeEventArgs, IgrRadioGroup, - IgrRadioGroupModule, IgrRipple, - IgrRippleModule, IgrToggleButton, registerIconFromText, } from 'igniteui-react'; @@ -19,11 +15,6 @@ import 'igniteui-webcomponents/themes/light/material.css'; import './ButtonGroupSelection.css'; import './index.css'; -IgrButtonGroupModule.register(); -IgrRadioGroupModule.register(); -IgrIconModule.register(); -IgrRippleModule.register(); - const icons = [ { name: 'bold', @@ -58,29 +49,29 @@ export default function ButtonGroupSelectionSample() {
- - Single + + Single - - Single-Required + + Single-Required - - Multiple + + Multiple
- - - + + + - - - + + + - - - + + +
diff --git a/samples/inputs/button-group/size/src/index.tsx b/samples/inputs/button-group/size/src/index.tsx index 2f166cf304..969af56221 100644 --- a/samples/inputs/button-group/size/src/index.tsx +++ b/samples/inputs/button-group/size/src/index.tsx @@ -2,15 +2,12 @@ import React, { useState } from 'react'; import ReactDOM from 'react-dom/client'; import { IgrButtonGroup, - IgrButtonGroupModule, IgrComponentValueChangedEventArgs, IgrToggleButton, } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/material.css'; import './index.css'; -IgrButtonGroupModule.register(); - export default function ButtonGroupSize() { const [style, setStyle] = useState({ '--ig-size': 'var(--ig-size-large)' } as React.CSSProperties) @@ -23,14 +20,14 @@ export default function ButtonGroupSize() { return (
- - Small + + Small - - Medium + + Medium - - Large + + Large
diff --git a/samples/inputs/button-group/styling/src/index.tsx b/samples/inputs/button-group/styling/src/index.tsx index 59cf234c0a..936cd0af33 100644 --- a/samples/inputs/button-group/styling/src/index.tsx +++ b/samples/inputs/button-group/styling/src/index.tsx @@ -2,37 +2,32 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import { IgrButtonGroup, - IgrButtonGroupModule, IgrRipple, - IgrRippleModule, IgrToggleButton, } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/material.css'; import './ButtonGroupStyling.css'; import './index.css'; -IgrButtonGroupModule.register(); -IgrRippleModule.register(); - export default function ButtonGroupStyling() { return (
- - Sofia - + + Sofia + - - London - + + London + - - New York - + + New York + - - Tokio - + + Tokio +
diff --git a/samples/inputs/button/contained/src/index.tsx b/samples/inputs/button/contained/src/index.tsx index ec435763e6..dafc24a3e8 100644 --- a/samples/inputs/button/contained/src/index.tsx +++ b/samples/inputs/button/contained/src/index.tsx @@ -1,11 +1,9 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrButton, IgrButtonModule } from 'igniteui-react'; +import { IgrButton } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrButtonModule.register(); - export default class ButtonContained extends React.Component { constructor(props: any) { diff --git a/samples/inputs/button/download/src/index.tsx b/samples/inputs/button/download/src/index.tsx index 168bc6384c..9139fe801e 100644 --- a/samples/inputs/button/download/src/index.tsx +++ b/samples/inputs/button/download/src/index.tsx @@ -1,11 +1,9 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrButton, IgrButtonModule } from 'igniteui-react'; +import { IgrButton } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrButtonModule.register(); - export default class ButtonDownload extends React.Component { constructor(props: any) { diff --git a/samples/inputs/button/fab/src/index.tsx b/samples/inputs/button/fab/src/index.tsx index ae79ad5db0..84e995d1f2 100644 --- a/samples/inputs/button/fab/src/index.tsx +++ b/samples/inputs/button/fab/src/index.tsx @@ -1,11 +1,9 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrButton, IgrButtonModule } from 'igniteui-react'; +import { IgrButton } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrButtonModule.register(); - export default class ButtonFab extends React.Component { constructor(props: any) { diff --git a/samples/inputs/button/flat/src/index.tsx b/samples/inputs/button/flat/src/index.tsx index a59b15e9d6..319341db76 100644 --- a/samples/inputs/button/flat/src/index.tsx +++ b/samples/inputs/button/flat/src/index.tsx @@ -1,11 +1,9 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrButton, IgrButtonModule } from 'igniteui-react'; +import { IgrButton } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrButtonModule.register(); - export default class ButtonFlat extends React.Component { constructor(props: any) { diff --git a/samples/inputs/button/outlined/src/index.tsx b/samples/inputs/button/outlined/src/index.tsx index 24e9f88354..88a3b6cd3c 100644 --- a/samples/inputs/button/outlined/src/index.tsx +++ b/samples/inputs/button/outlined/src/index.tsx @@ -1,11 +1,9 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrButton, IgrButtonModule } from 'igniteui-react'; +import { IgrButton } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrButtonModule.register(); - export default class ButtonOutlined extends React.Component { constructor(props: any) { diff --git a/samples/inputs/button/overview/src/index.tsx b/samples/inputs/button/overview/src/index.tsx index 806fa14540..de65eed692 100644 --- a/samples/inputs/button/overview/src/index.tsx +++ b/samples/inputs/button/overview/src/index.tsx @@ -2,11 +2,9 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; import './ButtonOverviewStyle.css'; -import { IgrButton, IgrButtonModule } from 'igniteui-react'; +import { IgrButton } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrButtonModule.register(); - export default class ButtonOverview extends React.Component { constructor(props: any) { diff --git a/samples/inputs/button/size/src/index.tsx b/samples/inputs/button/size/src/index.tsx index 9e9265be9a..02dfd28212 100644 --- a/samples/inputs/button/size/src/index.tsx +++ b/samples/inputs/button/size/src/index.tsx @@ -2,13 +2,9 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; import './ButtonSizingStyle.css'; -import { IgrButton, IgrRadio, IgrRadioGroup, IgrButtonModule, IgrRadioModule, IgrRadioGroupModule } from 'igniteui-react'; +import { IgrButton, IgrRadio, IgrRadioGroup } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrButtonModule.register(); -IgrRadioGroupModule.register(); -IgrRadioModule.register(); - export default class ButtonSize extends React.Component { constructor(props: any) { @@ -21,10 +17,10 @@ export default class ButtonSize extends React.Component { return (
- + Small - + Medium diff --git a/samples/inputs/button/styling/src/index.tsx b/samples/inputs/button/styling/src/index.tsx index 1b073dc989..56b4a6d516 100644 --- a/samples/inputs/button/styling/src/index.tsx +++ b/samples/inputs/button/styling/src/index.tsx @@ -2,11 +2,9 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; import './ButtonStyle.css'; -import { IgrButton, IgrButtonModule } from 'igniteui-react'; +import { IgrButton } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrButtonModule.register(); - export default class ButtonStyling extends React.Component { constructor(props: any) { diff --git a/samples/inputs/checkbox/checking/src/index.tsx b/samples/inputs/checkbox/checking/src/index.tsx index 1745d94dd9..76cdf7abb6 100644 --- a/samples/inputs/checkbox/checking/src/index.tsx +++ b/samples/inputs/checkbox/checking/src/index.tsx @@ -1,11 +1,9 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrCheckbox, IgrCheckboxModule } from 'igniteui-react'; +import { IgrCheckbox } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrCheckboxModule.register(); - export default class CheckboxChecked extends React.Component { constructor(props: any) { @@ -16,7 +14,7 @@ export default class CheckboxChecked extends React.Component { return (
- Label + Label
); diff --git a/samples/inputs/checkbox/disabled/src/index.tsx b/samples/inputs/checkbox/disabled/src/index.tsx index a5970cb8dc..bee5314a60 100644 --- a/samples/inputs/checkbox/disabled/src/index.tsx +++ b/samples/inputs/checkbox/disabled/src/index.tsx @@ -1,11 +1,9 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrCheckbox, IgrCheckboxModule } from 'igniteui-react'; +import { IgrCheckbox } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrCheckboxModule.register(); - export default class CheckboxDisabled extends React.Component { constructor(props: any) { @@ -16,7 +14,7 @@ export default class CheckboxDisabled extends React.Component { return (
- Label + Label
); diff --git a/samples/inputs/checkbox/indeterminate/src/index.tsx b/samples/inputs/checkbox/indeterminate/src/index.tsx index 6a6246d6bd..990fdd25d6 100644 --- a/samples/inputs/checkbox/indeterminate/src/index.tsx +++ b/samples/inputs/checkbox/indeterminate/src/index.tsx @@ -4,8 +4,6 @@ import './index.css'; import { IgrCheckbox, IgrCheckboxModule } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrCheckboxModule.register(); - export default class CheckboxIndeterminate extends React.Component { constructor(props: any) { @@ -16,7 +14,7 @@ export default class CheckboxIndeterminate extends React.Component { return (
- Label + Label
); diff --git a/samples/inputs/checkbox/label/src/index.tsx b/samples/inputs/checkbox/label/src/index.tsx index 3633e57cea..1662d02b09 100644 --- a/samples/inputs/checkbox/label/src/index.tsx +++ b/samples/inputs/checkbox/label/src/index.tsx @@ -2,11 +2,9 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; import './CheckboxLabelStyles.css' -import { IgrCheckbox, IgrCheckboxModule } from 'igniteui-react'; +import { IgrCheckbox } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrCheckboxModule.register(); - export default class CheckboxLabel extends React.Component { constructor(props: any) { diff --git a/samples/inputs/checkbox/overview/src/index.tsx b/samples/inputs/checkbox/overview/src/index.tsx index 1d444a50e7..1cfec221ac 100644 --- a/samples/inputs/checkbox/overview/src/index.tsx +++ b/samples/inputs/checkbox/overview/src/index.tsx @@ -1,11 +1,9 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrCheckbox, IgrCheckboxModule } from 'igniteui-react'; +import { IgrCheckbox } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrCheckboxModule.register(); - export default class CheckboxOverview extends React.Component { constructor(props: any) { @@ -16,7 +14,7 @@ export default class CheckboxOverview extends React.Component { return (
- Checkbox + Checkbox
); diff --git a/samples/inputs/chip/multiple/src/index.tsx b/samples/inputs/chip/multiple/src/index.tsx index c4390d0859..b6626611d1 100644 --- a/samples/inputs/chip/multiple/src/index.tsx +++ b/samples/inputs/chip/multiple/src/index.tsx @@ -1,11 +1,14 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrChip, IgrIcon, IgrChipModule, IgrIconModule, registerIconFromText } from 'igniteui-react'; +import { IgrChip, IgrIcon, registerIconFromText } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrChipModule.register(); -IgrIconModule.register(); +const customSelectIconText = ''; +const customRemoveIconText = ' '; +const brushIconText = 'Brush IconA picture showing a painting brush.'; +const brickIconText = 'Brick Wall IconA picture depicting a wall made of bricks.'; +const dogIconText = ' '; const customSelectIconText = ''; const customRemoveIconText = ' '; diff --git a/samples/inputs/chip/overview/src/index.tsx b/samples/inputs/chip/overview/src/index.tsx index d26f48ed35..0a127f6bb0 100644 --- a/samples/inputs/chip/overview/src/index.tsx +++ b/samples/inputs/chip/overview/src/index.tsx @@ -1,11 +1,9 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrChip, IgrChipModule } from 'igniteui-react'; +import { IgrChip } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrChipModule.register(); - export default class ChipOverview extends React.Component { constructor(props: any) { diff --git a/samples/inputs/chip/size/src/index.tsx b/samples/inputs/chip/size/src/index.tsx index 45f390260e..b5934d2f12 100644 --- a/samples/inputs/chip/size/src/index.tsx +++ b/samples/inputs/chip/size/src/index.tsx @@ -1,11 +1,9 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrChip, IgrChipModule } from 'igniteui-react'; +import { IgrChip } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrChipModule.register(); - export default class ChipSize extends React.Component { constructor(props: any) { diff --git a/samples/inputs/chip/styling/src/index.tsx b/samples/inputs/chip/styling/src/index.tsx index f570a2007f..8bf0e56de2 100644 --- a/samples/inputs/chip/styling/src/index.tsx +++ b/samples/inputs/chip/styling/src/index.tsx @@ -2,11 +2,9 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; import './ChipStyle.css'; -import { IgrChip, IgrChipModule } from 'igniteui-react'; +import { IgrChip } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrChipModule.register(); - export default class ChipStyling extends React.Component { constructor(props: any) { diff --git a/samples/inputs/chip/variants/src/index.tsx b/samples/inputs/chip/variants/src/index.tsx index 8e8b31ee5d..376c79ea36 100644 --- a/samples/inputs/chip/variants/src/index.tsx +++ b/samples/inputs/chip/variants/src/index.tsx @@ -1,11 +1,9 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrChip, IgrChipModule } from 'igniteui-react'; +import { IgrChip } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrChipModule.register(); - export default class ChipVariants extends React.Component { constructor(props: any) { diff --git a/samples/inputs/combo/features/src/index.tsx b/samples/inputs/combo/features/src/index.tsx index b0939181dc..5f8feacaa9 100644 --- a/samples/inputs/combo/features/src/index.tsx +++ b/samples/inputs/combo/features/src/index.tsx @@ -1,33 +1,15 @@ -import React, { useRef } from "react"; +import React, { useState } from "react"; import ReactDOM from "react-dom/client"; -import { IgrCheckboxChangeEventArgs, IgrComboModule, IgrCombo, IgrSwitchModule, IgrSwitch } from "igniteui-react"; +import { IgrCombo, IgrSwitch } from "igniteui-react"; import "./index.css"; import "igniteui-webcomponents/themes/light/bootstrap.css"; import { Cities } from "./ComboData"; -IgrComboModule.register(); -IgrSwitchModule.register(); - export default function ComboFeatures() { - const comboRef = useRef(null); - const switchCaseSensitiveRef = useRef(null); - - const disableFiltering = (e: IgrCheckboxChangeEventArgs) => { - comboRef.current.disableFiltering = - switchCaseSensitiveRef.current.disabled = e.detail.checked; - }; - - const showCaseSencitiveIcon = (e: IgrCheckboxChangeEventArgs) => { - comboRef.current.caseSensitiveIcon = e.detail.checked; - }; - - const enableGrouping = (e: IgrCheckboxChangeEventArgs) => { - comboRef.current.groupKey = e.detail.checked ? "country" : undefined; - }; - - const disableCombo = (e: IgrCheckboxChangeEventArgs) => { - comboRef.current.disabled = e.detail.checked; - }; + const [disableFiltering, setDisableFiltering] = useState(false); + const [caseSensitiveIcon, setCaseSensitiveIcon] = useState(false); + const [groupingEnabled, setGroupingEnabled] = useState(false); + const [comboDisabled, setComboDisabled] = useState(false); return (
@@ -38,26 +20,29 @@ export default function ComboFeatures() { placeholder="Pick a city" placeholderSearch="Search for a city" data={Cities} - ref={comboRef} - > + disableFiltering={disableFiltering} + caseSensitiveIcon={caseSensitiveIcon} + groupKey={groupingEnabled ? "country" : undefined} + disabled={comboDisabled}> +
- - Disable Filtering + setDisableFiltering(e.detail.checked)}> + Disable Filtering - - Show Case-sensitive Icon + setCaseSensitiveIcon(e.detail.checked)}> + Show Case-sensitive Icon - - Enable Grouping + setGroupingEnabled(e.detail.checked)}> + Enable Grouping - - Disable Combo + setComboDisabled(e.detail.checked)}> + Disable Combo
); } -// rendering above class to the React DOM +// rendering above function to the React DOM const root = ReactDOM.createRoot(document.getElementById("root")); root.render(); diff --git a/samples/inputs/combo/overview/src/index.tsx b/samples/inputs/combo/overview/src/index.tsx index 1d5b3d88c0..ecbfa32dfa 100644 --- a/samples/inputs/combo/overview/src/index.tsx +++ b/samples/inputs/combo/overview/src/index.tsx @@ -1,10 +1,8 @@ import React from "react"; import ReactDOM from "react-dom/client"; -import { IgrComboModule, IgrCombo } from "igniteui-react"; +import { IgrCombo } from "igniteui-react"; import "igniteui-webcomponents/themes/light/bootstrap.css"; -IgrComboModule.register(); - interface City { id: string; name: string; diff --git a/samples/inputs/combo/selection/src/index.tsx b/samples/inputs/combo/selection/src/index.tsx index a5f1c0c962..20b6e2875e 100644 --- a/samples/inputs/combo/selection/src/index.tsx +++ b/samples/inputs/combo/selection/src/index.tsx @@ -1,13 +1,10 @@ import React, { useRef } from "react"; import ReactDOM from "react-dom/client"; -import { IgrComboModule, IgrCombo, IgrButtonModule, IgrButton } from "igniteui-react"; +import { IgrCombo, IgrButton } from "igniteui-react"; import "./index.css"; import "igniteui-webcomponents/themes/light/bootstrap.css"; import { Cities } from "./ComboData"; -IgrComboModule.register(); -IgrButtonModule.register(); - export default function ComboSelection() { const comboRef = useRef(null); @@ -40,16 +37,16 @@ export default function ComboSelection() { >
- Select UK Cities + Select UK Cities - Deselect UK Favorites + Deselect UK Favorites - Select All + Select All - Deselect All + Deselect All
diff --git a/samples/inputs/combo/simplified/src/index.tsx b/samples/inputs/combo/simplified/src/index.tsx index dc93894eda..5df07ff46d 100644 --- a/samples/inputs/combo/simplified/src/index.tsx +++ b/samples/inputs/combo/simplified/src/index.tsx @@ -1,23 +1,13 @@ -import React, { useRef } from "react"; +import React, { useState } from "react"; import ReactDOM from "react-dom/client"; -import { IgrCheckboxChangeEventArgs, IgrComboModule, IgrCombo, IgrSwitchModule, IgrSwitch } from "igniteui-react"; +import { IgrCheckboxChangeEventArgs, IgrCombo, IgrSwitch } from "igniteui-react"; import "./index.css"; import "igniteui-webcomponents/themes/light/bootstrap.css"; import { Cities } from "./ComboData"; -IgrComboModule.register(); -IgrSwitchModule.register(); - export default function ComboSingleSelection() { - const comboRef = useRef(null); - - const enableGrouping = (e: IgrCheckboxChangeEventArgs) => { - comboRef.current.groupKey = e.detail.checked ? "country" : undefined; - }; - - const disableCombo = (e: IgrCheckboxChangeEventArgs) => { - comboRef.current.disabled = e.detail.checked; - }; + const [groupingEnabled, setGroupingEnabled] = useState(false); + const [comboDisabled, setComboDisabled] = useState(false); return (
@@ -28,20 +18,25 @@ export default function ComboSingleSelection() { placeholder="Pick a city" singleSelect data={Cities} - ref={comboRef} + groupKey={groupingEnabled ? "country" : undefined} + disabled={comboDisabled} >
- - Enable Grouping + setGroupingEnabled(e.detail.checked)}> + Enable Grouping - - Disable Combo + setComboDisabled(e.detail.checked)}> + Disable Combo
); } -// rendering above class to the React DOM +// rendering above function to the React DOM const root = ReactDOM.createRoot(document.getElementById("root")); root.render(); diff --git a/samples/inputs/combo/styling/src/index.tsx b/samples/inputs/combo/styling/src/index.tsx index 413e307b6f..25f60770ef 100644 --- a/samples/inputs/combo/styling/src/index.tsx +++ b/samples/inputs/combo/styling/src/index.tsx @@ -1,13 +1,10 @@ import React, { useEffect } from "react"; import ReactDOM from "react-dom/client"; -import { IgrComboModule, IgrCombo, IgrIconModule, IgrIcon, registerIconFromText } from "igniteui-react"; +import { IgrCombo, IgrIcon, registerIconFromText } from "igniteui-react"; import "./index.css"; import "igniteui-webcomponents/themes/light/bootstrap.css"; import { Cities } from "./ComboData"; -IgrComboModule.register(); -IgrIconModule.register(); - const placeSvg = ''; @@ -27,8 +24,8 @@ export default function ComboStyling() { caseSensitiveIcon data={Cities} > - Choose the desired place - + Choose the desired place +
diff --git a/samples/inputs/combo/templates/.eslintrc.js b/samples/inputs/combo/templates/.eslintrc.js new file mode 100644 index 0000000000..b45160a9ee --- /dev/null +++ b/samples/inputs/combo/templates/.eslintrc.js @@ -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" + } + } + ] + }; \ No newline at end of file diff --git a/samples/inputs/combo/templates/README.md b/samples/inputs/combo/templates/README.md new file mode 100644 index 0000000000..386e26cdfd --- /dev/null +++ b/samples/inputs/combo/templates/README.md @@ -0,0 +1,56 @@ + + + +This folder contains implementation of React application with example of Templates feature using [Combo](https://www.infragistics.com/products/ignite-ui-react/react/components/general-getting-started.html) component. + + + + + + View Docs + + + View Code + + + Run Sample + + + Run Sample + + + + +## 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/combo/templates +``` + +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). diff --git a/samples/inputs/combo/templates/package.json b/samples/inputs/combo/templates/package.json new file mode 100644 index 0000000000..6833ffe105 --- /dev/null +++ b/samples/inputs/combo/templates/package.json @@ -0,0 +1,43 @@ +{ + "name": "react-combo-overview", + "description": "This project provides example of Combo Overview using Infragistics React components", + "author": "Infragistics", + "homepage": ".", + "version": "1.4.0", + "private": true, + "scripts": { + "start": "set PORT=4200 && react-scripts --max_old_space_size=10240 start", + "build": "react-scripts --max_old_space_size=10240 build ", + "test": "react-scripts test --env=jsdom", + "eject": "react-scripts eject" + }, + "dependencies": { + "igniteui-dockmanager": "1.16.1", + "igniteui-react": "19.0.2", + "igniteui-react-core": "19.0.0-alpha.0", + "igniteui-react-grids": "19.0.2", + "igniteui-react-inputs": "19.0.0-alpha.0", + "igniteui-react-layouts": "19.0.0-alpha.0", + "igniteui-webcomponents": "6.0.0", + "lit-html": "^3.2.0", + "react": "^19.1.0", + "react-dom": "^19.1.0", + "react-scripts": "^5.0.1", + "tslib": "^2.4.0" + }, + "devDependencies": { + "@types/jest": "^29.2.0", + "@types/node": "^18.11.7", + "@types/react": "^18.0.24", + "@types/react-dom": "^18.0.8", + "react-app-rewired": "^2.2.1", + "typescript": "^4.8.4", + "worker-loader": "^3.0.8" + }, + "browserslist": [ + ">0.2%", + "not dead", + "not ie <= 11", + "not op_mini all" + ] +} diff --git a/samples/inputs/combo/templates/public/index.html b/samples/inputs/combo/templates/public/index.html new file mode 100644 index 0000000000..2e48989a3b --- /dev/null +++ b/samples/inputs/combo/templates/public/index.html @@ -0,0 +1,10 @@ + + + + Combo Overview + + + +
+ + \ No newline at end of file diff --git a/samples/inputs/combo/templates/sandbox.config.json b/samples/inputs/combo/templates/sandbox.config.json new file mode 100644 index 0000000000..00acba0c10 --- /dev/null +++ b/samples/inputs/combo/templates/sandbox.config.json @@ -0,0 +1,5 @@ +{ + "infiniteLoopProtection": false, + "hardReloadOnChange": false, + "view": "browser" +} \ No newline at end of file diff --git a/samples/inputs/combo/templates/src/data.ts b/samples/inputs/combo/templates/src/data.ts new file mode 100644 index 0000000000..5809209978 --- /dev/null +++ b/samples/inputs/combo/templates/src/data.ts @@ -0,0 +1,33 @@ +export interface City { + id: string; + name: string; + country: string; + } + + export const Cities: City[] = [ + { name: "London", id: "UK01", country: "UK" }, + { name: "Manchester", id: "UK02", country: "UK" }, + { name: "Birmingham", id: "UK03", country: "UK" }, + { name: "Glasgow", id: "UK04", country: "UK" }, + { name: "Liverpool", id: "UK05", country: "UK" }, + { name: "New York", id: "US01", country: "USA" }, + { name: "Miami", id: "US02", country: "USA" }, + { name: "Philadelphia", id: "US03", country: "USA" }, + { name: "Chicago", id: "US04", country: "USA" }, + { name: "Springfield", id: "US05", country: "USA" }, + { name: "Los Angeles", id: "US06", country: "USA" }, + { name: "Houston", id: "US07", country: "USA" }, + { name: "Phoenix", id: "US08", country: "USA" }, + { name: "San Diego", id: "US09", country: "USA" }, + { name: "Dallas", id: "US010", country: "USA" }, + { name: "Sofia", id: "BG01", country: "Bulgaria" }, + { name: "Plovdiv", id: "BG02", country: "Bulgaria" }, + { name: "Varna", id: "BG03", country: "Bulgaria" }, + { name: "Burgas", id: "BG04", country: "Bulgaria" }, + { name: "Rome", id: "IT01", country: "Italy" }, + { name: "Milan", id: "IT02", country: "Italy" }, + { name: "Naples", id: "IT03", country: "Italy" }, + { name: "Turin", id: "IT04", country: "Italy" }, + { name: "Palermo", id: "IT05", country: "Italy" }, + { name: "Florence", id: "IT06", country: "Italy" }, + ]; \ No newline at end of file diff --git a/samples/inputs/combo/templates/src/index.css b/samples/inputs/combo/templates/src/index.css new file mode 100644 index 0000000000..c0938eecaa --- /dev/null +++ b/samples/inputs/combo/templates/src/index.css @@ -0,0 +1,6 @@ +/* shared styles are loaded from: */ +/* https://static.infragistics.com/xplatform/css/samples */ + +.combo-padding { + padding: 12px 16px; +} \ No newline at end of file diff --git a/samples/inputs/combo/templates/src/index.tsx b/samples/inputs/combo/templates/src/index.tsx new file mode 100644 index 0000000000..1f3e928b03 --- /dev/null +++ b/samples/inputs/combo/templates/src/index.tsx @@ -0,0 +1,68 @@ +import React, { useEffect } from "react"; +import ReactDOM from "react-dom/client"; +import { + IgrCombo, + ComboTemplateProps, + IgrIcon, + registerIconFromText +} from "igniteui-react"; +import "igniteui-webcomponents/themes/light/bootstrap.css"; +import { Cities, City } from "./data"; +import "./index.css"; + +export default function ComboTemplates() { + + const downIcon = ''; + const clearIcon = ''; + + useEffect(() => { + registerIconFromText("down", downIcon, "material"); + registerIconFromText("clear", clearIcon, "material"); + }, []); + + const renderGroupHeaderTemplate = (args: ComboTemplateProps) => { + return Country of {args.item.country}; + }; + + const renderItemTemplate = (args: ComboTemplateProps) => { + const item = args.item; + return ( + + {item.name} [{item.id}] - {item.country} + + ); + }; + + return ( +
+ +
+ Select a City +
List of countries and their most popular cities
+
+
+ + Tip: Start typing to find your city if you have troubles finding it. + +
+ + + + + + +
+
+ ); +} + +// rendering above function to the React DOM +const root = ReactDOM.createRoot(document.getElementById("root")); +root.render(); diff --git a/samples/inputs/combo/templates/src/react-app-env.d.ts b/samples/inputs/combo/templates/src/react-app-env.d.ts new file mode 100644 index 0000000000..6431bc5fc6 --- /dev/null +++ b/samples/inputs/combo/templates/src/react-app-env.d.ts @@ -0,0 +1 @@ +/// diff --git a/samples/inputs/combo/templates/tsconfig.json b/samples/inputs/combo/templates/tsconfig.json new file mode 100644 index 0000000000..e7db8a94f5 --- /dev/null +++ b/samples/inputs/combo/templates/tsconfig.json @@ -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" + ] +} diff --git a/samples/inputs/date-time-input/input-format-display-format/src/index.tsx b/samples/inputs/date-time-input/input-format-display-format/src/index.tsx index 95f2f5d1c4..736b8ce563 100644 --- a/samples/inputs/date-time-input/input-format-display-format/src/index.tsx +++ b/samples/inputs/date-time-input/input-format-display-format/src/index.tsx @@ -1,12 +1,9 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrIcon, IgrIconModule, IgrDateTimeInput, IgrDateTimeInputModule, DatePart, registerIconFromText } from 'igniteui-react'; +import { IgrIcon, IgrDateTimeInput, DatePart, registerIconFromText } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrIconModule.register(); -IgrDateTimeInputModule.register(); - const upIconText = ''; const downIconText = ''; const clearIconText = ''; @@ -25,13 +22,13 @@ export default class DateTimeInputInputFormatDisplayFormat extends React.Compone return (
- this.dateTimeInput.clear()}> + this.dateTimeInput.clear()}> - this.dateTimeInput.stepUp(DatePart.Date)}> + this.dateTimeInput.stepUp(DatePart.Date)}> - this.dateTimeInput.stepDown(DatePart.Date)}> + this.dateTimeInput.stepDown(DatePart.Date)}> diff --git a/samples/inputs/date-time-input/min-max-value/src/index.tsx b/samples/inputs/date-time-input/min-max-value/src/index.tsx index 42f7907577..3746b125df 100644 --- a/samples/inputs/date-time-input/min-max-value/src/index.tsx +++ b/samples/inputs/date-time-input/min-max-value/src/index.tsx @@ -1,11 +1,12 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrIcon, IgrIconModule, IgrDateTimeInput, IgrDateTimeInputModule, DatePart, registerIconFromText } from 'igniteui-react'; +import { IgrIcon, IgrDateTimeInput, DatePart, registerIconFromText } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrIconModule.register(); -IgrDateTimeInputModule.register(); +const upIconText = ''; +const downIconText = ''; +const clearIconText = ''; const upIconText = ''; const downIconText = ''; @@ -26,13 +27,13 @@ export default class DateTimeInputMinMaxValue extends React.Component return (
- this.dateTimeInput.clear()}> + this.dateTimeInput.clear()}> - this.dateTimeInput.stepUp(DatePart.Month)}> + this.dateTimeInput.stepUp(DatePart.Month)}> - this.dateTimeInput.stepDown(DatePart.Month)}> + this.dateTimeInput.stepDown(DatePart.Month)}> diff --git a/samples/inputs/date-time-input/overview/src/index.tsx b/samples/inputs/date-time-input/overview/src/index.tsx index 1e6bffccec..f1ef93b95c 100644 --- a/samples/inputs/date-time-input/overview/src/index.tsx +++ b/samples/inputs/date-time-input/overview/src/index.tsx @@ -1,11 +1,12 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrIcon, IgrIconModule, IgrDateTimeInput, IgrDateTimeInputModule, DatePart, registerIconFromText } from 'igniteui-react'; +import { IgrIcon, IgrDateTimeInput, DatePart, registerIconFromText } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrIconModule.register(); -IgrDateTimeInputModule.register(); +const upIconText = ''; +const downIconText = ''; +const clearIconText = ''; const upIconText = ''; const downIconText = ''; @@ -26,13 +27,13 @@ export default class DateTimeInputOverview extends React.Component { return (
- this.dateTimeInput.clear()}> + this.dateTimeInput.clear()}> - this.dateTimeInput.stepUp(DatePart.Month)}> + this.dateTimeInput.stepUp(DatePart.Month)}> - this.dateTimeInput.stepDown(DatePart.Month)}> + this.dateTimeInput.stepDown(DatePart.Month)}> diff --git a/samples/inputs/date-time-input/step-up-down/src/index.tsx b/samples/inputs/date-time-input/step-up-down/src/index.tsx index 4fefcca435..67446ea4cc 100644 --- a/samples/inputs/date-time-input/step-up-down/src/index.tsx +++ b/samples/inputs/date-time-input/step-up-down/src/index.tsx @@ -1,11 +1,12 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrIcon, IgrIconModule, IgrDateTimeInput, IgrDateTimeInputModule, DatePart, registerIconFromText } from 'igniteui-react'; +import { IgrIcon, IgrDateTimeInput, DatePart, registerIconFromText } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrIconModule.register(); -IgrDateTimeInputModule.register(); +const upIconText = ''; +const downIconText = ''; +const clearIconText = ''; const upIconText = ''; const downIconText = ''; @@ -27,13 +28,13 @@ export default class DateTimeInputStepUpDown extends React.Component { return (
- this.dateTimeInput.clear()}> + this.dateTimeInput.clear()}> - this.dateTimeInput.stepUp(DatePart.Month, 3)}> + this.dateTimeInput.stepUp(DatePart.Month, 3)}> - this.dateTimeInput.stepDown(DatePart.Date, 2)}> + this.dateTimeInput.stepDown(DatePart.Date, 2)}> diff --git a/samples/inputs/dropdown/group/src/index.tsx b/samples/inputs/dropdown/group/src/index.tsx index 0ec1e32c8b..8d9753a65f 100644 --- a/samples/inputs/dropdown/group/src/index.tsx +++ b/samples/inputs/dropdown/group/src/index.tsx @@ -1,13 +1,10 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrDropdown, IgrButton, IgrDropdownItem, IgrIcon, IgrDropdownModule, IgrButtonModule, IgrDropdownItemModule, IgrIconModule, IgrDropdownGroup, registerIconFromText } from 'igniteui-react'; +import { IgrDropdown, IgrButton, IgrDropdownItem, IgrIcon, IgrDropdownGroup, registerIconFromText } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrDropdownModule.register(); -IgrDropdownItemModule.register(); -IgrButtonModule.register(); -IgrIconModule.register(); +const placeIconText = ""; const placeIconText = ""; diff --git a/samples/inputs/dropdown/header/src/index.tsx b/samples/inputs/dropdown/header/src/index.tsx index b469f12b6d..0836ff1ace 100644 --- a/samples/inputs/dropdown/header/src/index.tsx +++ b/samples/inputs/dropdown/header/src/index.tsx @@ -1,13 +1,12 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrDropdown, IgrButton, IgrDropdownItem, IgrIcon, IgrDropdownModule, IgrButtonModule, IgrDropdownItemModule, IgrIconModule, IgrDropdownHeader, registerIconFromText } from 'igniteui-react'; +import { IgrDropdown, IgrButton, IgrDropdownItem, IgrIcon, IgrDropdownHeader, registerIconFromText } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrDropdownModule.register(); -IgrDropdownItemModule.register(); -IgrButtonModule.register(); -IgrIconModule.register(); +const ringIconText = ""; +const vibrateIconText = ""; +const silentIconText = ""; const ringIconText = ""; const vibrateIconText = ""; diff --git a/samples/inputs/dropdown/item/src/index.tsx b/samples/inputs/dropdown/item/src/index.tsx index ddc1d3ca47..f4633b918d 100644 --- a/samples/inputs/dropdown/item/src/index.tsx +++ b/samples/inputs/dropdown/item/src/index.tsx @@ -1,13 +1,12 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrDropdown, IgrButton, IgrDropdownItem, IgrIcon, IgrDropdownModule, IgrButtonModule, IgrDropdownItemModule, IgrIconModule, registerIconFromText } from 'igniteui-react'; +import { IgrDropdown, IgrButton, IgrDropdownItem, IgrIcon, registerIconFromText } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrDropdownModule.register(); -IgrDropdownItemModule.register(); -IgrButtonModule.register(); -IgrIconModule.register(); +const hotelIconText = ""; +const groceryIconText = ""; +const restaurantIconText = ""; const hotelIconText = ""; const groceryIconText = ""; diff --git a/samples/inputs/dropdown/overview/src/index.tsx b/samples/inputs/dropdown/overview/src/index.tsx index 41340327ca..25bae3b5f1 100644 --- a/samples/inputs/dropdown/overview/src/index.tsx +++ b/samples/inputs/dropdown/overview/src/index.tsx @@ -1,13 +1,9 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrDropdown, IgrButton, IgrDropdownItem, IgrDropdownModule, IgrButtonModule, IgrDropdownItemModule } from 'igniteui-react'; +import { IgrDropdown, IgrButton, IgrDropdownItem } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrDropdownModule.register(); -IgrDropdownItemModule.register(); -IgrButtonModule.register(); - export default class DropDownOverview extends React.Component { constructor(props: any) { diff --git a/samples/inputs/dropdown/position/src/index.tsx b/samples/inputs/dropdown/position/src/index.tsx index 91b0acb4fa..8ddabbdf6b 100644 --- a/samples/inputs/dropdown/position/src/index.tsx +++ b/samples/inputs/dropdown/position/src/index.tsx @@ -1,13 +1,9 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrDropdown, IgrButton, IgrDropdownItem, IgrDropdownModule, IgrButtonModule, IgrDropdownItemModule, DropdownPlacement } from 'igniteui-react'; +import { IgrDropdown, IgrButton, IgrDropdownItem } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrDropdownModule.register(); -IgrDropdownItemModule.register(); -IgrButtonModule.register(); - export default class DropDownPosition extends React.Component { public dropdownRef: IgrDropdown; diff --git a/samples/inputs/dropdown/styling/src/index.tsx b/samples/inputs/dropdown/styling/src/index.tsx index 80a0a5b445..8345678655 100644 --- a/samples/inputs/dropdown/styling/src/index.tsx +++ b/samples/inputs/dropdown/styling/src/index.tsx @@ -1,13 +1,10 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrDropdown, IgrButton, IgrDropdownItem, IgrIcon, IgrDropdownModule, IgrButtonModule, IgrDropdownItemModule, IgrIconModule, IgrDropdownGroup, registerIconFromText } from 'igniteui-react'; +import { IgrDropdown, IgrButton, IgrDropdownItem, IgrIcon, IgrDropdownGroup, registerIconFromText } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrDropdownModule.register(); -IgrDropdownItemModule.register(); -IgrButtonModule.register(); -IgrIconModule.register(); +const placeIconText = ""; const placeIconText = ""; diff --git a/samples/inputs/dropdown/target/src/index.tsx b/samples/inputs/dropdown/target/src/index.tsx index a06b72e6e7..f86463aae9 100644 --- a/samples/inputs/dropdown/target/src/index.tsx +++ b/samples/inputs/dropdown/target/src/index.tsx @@ -1,13 +1,9 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrDropdown, IgrButton, IgrDropdownItem, IgrDropdownModule, IgrButtonModule, IgrDropdownItemModule } from 'igniteui-react'; +import { IgrDropdown, IgrButton, IgrDropdownItem } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrDropdownModule.register(); -IgrDropdownItemModule.register(); -IgrButtonModule.register(); - export default class DropDownTarget extends React.Component { public dropdownRef: IgrDropdown; @@ -41,7 +37,7 @@ export default class DropDownTarget extends React.Component { public onClick(event: any) { if(this.dropdownRef){ - this.dropdownRef.toggle(event.i.nativeElement); + this.dropdownRef.toggle(event.currentTarget); } } } diff --git a/samples/inputs/icon-button/size/src/index.tsx b/samples/inputs/icon-button/size/src/index.tsx index 25953bfc4d..08bff40e33 100644 --- a/samples/inputs/icon-button/size/src/index.tsx +++ b/samples/inputs/icon-button/size/src/index.tsx @@ -1,10 +1,10 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrIconButton, IgrIconButtonModule, registerIconFromText } from 'igniteui-react'; +import { IgrIconButton, registerIconFromText } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrIconButtonModule.register(); +const iconText = ''; const iconText = ''; diff --git a/samples/inputs/icon-button/styling/src/index.tsx b/samples/inputs/icon-button/styling/src/index.tsx index a3135d4106..f8bb3c7253 100644 --- a/samples/inputs/icon-button/styling/src/index.tsx +++ b/samples/inputs/icon-button/styling/src/index.tsx @@ -1,11 +1,11 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrIconButton, IgrIconButtonModule, registerIconFromText } from 'igniteui-react'; +import { IgrIconButton, registerIconFromText } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; import "./IconButtonStyling.css"; -IgrIconButtonModule.register(); +const iconText = ''; const iconText = ''; diff --git a/samples/inputs/icon-button/variant/src/index.tsx b/samples/inputs/icon-button/variant/src/index.tsx index 53f7f30498..8d5aef4bb1 100644 --- a/samples/inputs/icon-button/variant/src/index.tsx +++ b/samples/inputs/icon-button/variant/src/index.tsx @@ -1,10 +1,10 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrIconButton, IgrIconButtonModule, registerIconFromText } from 'igniteui-react'; +import { IgrIconButton, registerIconFromText } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrIconButtonModule.register(); +const iconText = ''; const iconText = ''; diff --git a/samples/inputs/input/helper-text/src/index.tsx b/samples/inputs/input/helper-text/src/index.tsx index 8db24100ca..faee2b7bb9 100644 --- a/samples/inputs/input/helper-text/src/index.tsx +++ b/samples/inputs/input/helper-text/src/index.tsx @@ -1,11 +1,10 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrInput, IgrInputModule, IgrIcon, IgrIconModule, registerIconFromText } from 'igniteui-react'; +import { IgrInput, IgrIcon, registerIconFromText } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrInputModule.register(); -IgrIconModule.register(); +const phoneIconText = ''; const phoneIconText = ''; diff --git a/samples/inputs/input/overview/src/index.tsx b/samples/inputs/input/overview/src/index.tsx index 9d4d8a6d6d..a9c5ad8952 100644 --- a/samples/inputs/input/overview/src/index.tsx +++ b/samples/inputs/input/overview/src/index.tsx @@ -1,11 +1,9 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrInput, IgrInputModule } from 'igniteui-react'; +import { IgrInput } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrInputModule.register(); - export default class InputOverview extends React.Component { constructor(props: any) { diff --git a/samples/inputs/input/prefix-suffix/src/index.tsx b/samples/inputs/input/prefix-suffix/src/index.tsx index 6e2f7c2882..ad9f1ab625 100644 --- a/samples/inputs/input/prefix-suffix/src/index.tsx +++ b/samples/inputs/input/prefix-suffix/src/index.tsx @@ -1,11 +1,10 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrInput, IgrInputModule, IgrIcon, IgrIconModule, registerIconFromText } from 'igniteui-react'; +import { IgrInput, IgrIcon, registerIconFromText } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrInputModule.register(); -IgrIconModule.register(); +const phoneIconText = ''; const phoneIconText = ''; diff --git a/samples/inputs/input/size/src/index.tsx b/samples/inputs/input/size/src/index.tsx index f1cd4dd0fa..adcf3db012 100644 --- a/samples/inputs/input/size/src/index.tsx +++ b/samples/inputs/input/size/src/index.tsx @@ -2,18 +2,15 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; import './InputSizeStyling.css'; -import { IgrInput, IgrInputModule, IgrRadio, IgrRadioModule, IgrRadioGroup, IgrRadioGroupModule } from 'igniteui-react'; +import { IgrInput, IgrRadio, IgrRadioGroup } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrInputModule.register(); -IgrRadioModule.register(); - export default class InputSize extends React.Component { constructor(props: any) { - super(props); + super(props); this.onRadioChange = this.onRadioChange.bind(this); - this.state = { size: "medium"}; + this.state = { size: "medium" }; } public render(): JSX.Element { @@ -21,21 +18,21 @@ export default class InputSize extends React.Component {
- Small - Medium - Large + Small + Medium + Large
- - - + + +
); } public onRadioChange(e: any) { if (e.detail.checked == true) { - this.setState({ calendarSize: e.value }); + this.setState({ size: e.detail.value }); } } @@ -43,4 +40,4 @@ export default class InputSize extends React.Component { // rendering above class to the React DOM const root = ReactDOM.createRoot(document.getElementById('root')); -root.render(); +root.render(); diff --git a/samples/inputs/input/styling/src/index.tsx b/samples/inputs/input/styling/src/index.tsx index 1549a81c87..d3ad426b94 100644 --- a/samples/inputs/input/styling/src/index.tsx +++ b/samples/inputs/input/styling/src/index.tsx @@ -1,12 +1,10 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrInput, IgrInputModule, IgrIcon, IgrIconModule, registerIconFromText } from 'igniteui-react'; +import { IgrInput, IgrIcon, registerIconFromText } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; import './InputStyling.css'; - -IgrInputModule.register(); -IgrIconModule.register(); +const phoneIconText = ''; const phoneIconText = ''; diff --git a/samples/inputs/mask-input/applying-mask/src/index.tsx b/samples/inputs/mask-input/applying-mask/src/index.tsx index 6093eabbff..0377a347ec 100644 --- a/samples/inputs/mask-input/applying-mask/src/index.tsx +++ b/samples/inputs/mask-input/applying-mask/src/index.tsx @@ -1,15 +1,12 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrMaskInput, IgrIcon, IgrMaskInputModule, IgrIconModule, registerIconFromText } from 'igniteui-react'; +import { IgrMaskInput, IgrIcon, registerIconFromText } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrMaskInputModule.register(); -IgrIconModule.register(); - const phoneIconText = ''; -export default class MaskInputApplyingMask extends React.Component { +const phoneIconText = ''; constructor(props: any) { super(props); diff --git a/samples/inputs/mask-input/overview/src/index.tsx b/samples/inputs/mask-input/overview/src/index.tsx index 28142bf465..449b33c9f5 100644 --- a/samples/inputs/mask-input/overview/src/index.tsx +++ b/samples/inputs/mask-input/overview/src/index.tsx @@ -1,15 +1,12 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrMaskInput, IgrIcon, IgrMaskInputModule, IgrIconModule, registerIconFromText } from 'igniteui-react'; +import { IgrMaskInput, IgrIcon, registerIconFromText } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrMaskInputModule.register(); -IgrIconModule.register(); - const locationIconText = ' Location '; -export default class MaskInputOverview extends React.Component { +const locationIconText = ' Location '; constructor(props: any) { super(props); diff --git a/samples/inputs/mask-input/value-modes/src/index.tsx b/samples/inputs/mask-input/value-modes/src/index.tsx index 0963903556..17f8ddd9c1 100644 --- a/samples/inputs/mask-input/value-modes/src/index.tsx +++ b/samples/inputs/mask-input/value-modes/src/index.tsx @@ -1,14 +1,9 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrMaskInput, IgrIcon, IgrRadioGroup, IgrRadio, IgrMaskInputModule, IgrIconModule, IgrRadioGroupModule, IgrRadioModule, registerIconFromText } from 'igniteui-react'; +import { IgrMaskInput, IgrIcon, IgrRadioGroup, IgrRadio, registerIconFromText } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrMaskInputModule.register(); -IgrIconModule.register(); -IgrRadioGroupModule.register(); -IgrRadioModule.register(); - export default class MaskInputValueModes extends React.Component { public maskRef: IgrMaskInput; @@ -16,7 +11,7 @@ export default class MaskInputValueModes extends React.Component { constructor(props: any) { super(props); this.onMaskRef = this.onMaskRef.bind(this); - this.state = { value: "" }; + this.state = { value: "", mode: "raw" }; const fileIconText = ''; registerIconFromText("file", fileIconText, "material"); @@ -25,25 +20,25 @@ export default class MaskInputValueModes extends React.Component { public render(): JSX.Element { return (
- this.onInputChange(e)}> + this.onInputChange(e)}> -
- - this.onRadioChange(e)} checked>raw - this.onRadioChange(e)}>withFormatting +
+ + this.onRadioChange(e)} checked={this.state.mode === "raw"}>raw + this.onRadioChange(e)} checked={this.state.mode === "withFormatting"}>withFormatting - + Value: {this.state.value}
); } - public onMaskRef(mask: IgrMaskInput){ + public onMaskRef(mask: IgrMaskInput) { if (!mask) { return; } this.maskRef = mask; } @@ -51,14 +46,18 @@ export default class MaskInputValueModes extends React.Component { public onInputChange(event: any) { console.log(event) if (this.maskRef) { - this.setState({value: this.maskRef.value}) + this.setState({ value: this.maskRef.value }) } } public onRadioChange(event: any) { if (this.maskRef) { - this.maskRef.valueMode = event.detail.value; - this.setState({value: this.maskRef.value}); + const mode = event.detail.value; + this.maskRef.valueMode = mode; + this.setState({ + mode: mode, + value: this.maskRef.value + }); } } } diff --git a/samples/inputs/radio/alignment/src/index.tsx b/samples/inputs/radio/alignment/src/index.tsx index 55731f8a47..827b14d1c6 100644 --- a/samples/inputs/radio/alignment/src/index.tsx +++ b/samples/inputs/radio/alignment/src/index.tsx @@ -1,12 +1,9 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrRadio, IgrRadioGroup, IgrRadioModule, IgrRadioGroupModule } from 'igniteui-react'; +import { IgrRadio, IgrRadioGroup } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrRadioModule.register(); -IgrRadioGroupModule.register(); - export default class RadioAlignment extends React.Component { constructor(props: any) { diff --git a/samples/inputs/radio/disabled/src/index.tsx b/samples/inputs/radio/disabled/src/index.tsx index 8337d91023..99eda059ff 100644 --- a/samples/inputs/radio/disabled/src/index.tsx +++ b/samples/inputs/radio/disabled/src/index.tsx @@ -1,12 +1,9 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrRadio, IgrRadioGroup, IgrRadioModule, IgrRadioGroupModule } from 'igniteui-react'; +import { IgrRadio, IgrRadioGroup } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrRadioModule.register(); -IgrRadioGroupModule.register(); - export default class RadioDisabled extends React.Component { constructor(props: any) { diff --git a/samples/inputs/radio/group/src/index.tsx b/samples/inputs/radio/group/src/index.tsx index 5296e7724e..7f0964201b 100644 --- a/samples/inputs/radio/group/src/index.tsx +++ b/samples/inputs/radio/group/src/index.tsx @@ -1,12 +1,9 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrRadio, IgrRadioGroup, IgrRadioModule, IgrRadioGroupModule } from 'igniteui-react'; +import { IgrRadio, IgrRadioGroup } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrRadioModule.register(); -IgrRadioGroupModule.register(); - export default class RadioGroup extends React.Component { constructor(props: any) { diff --git a/samples/inputs/radio/invalid/src/index.tsx b/samples/inputs/radio/invalid/src/index.tsx index 8a4155ecba..89f7b49b49 100644 --- a/samples/inputs/radio/invalid/src/index.tsx +++ b/samples/inputs/radio/invalid/src/index.tsx @@ -1,11 +1,9 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrRadio, IgrRadioModule } from 'igniteui-react'; +import { IgrRadio } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrRadioModule.register(); - export default class RadioInvalid extends React.Component { constructor(props: any) { diff --git a/samples/inputs/radio/label/src/index.tsx b/samples/inputs/radio/label/src/index.tsx index 1f6af6f830..9fddfe2556 100644 --- a/samples/inputs/radio/label/src/index.tsx +++ b/samples/inputs/radio/label/src/index.tsx @@ -1,12 +1,9 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrRadio, IgrRadioGroup, IgrRadioModule, IgrRadioGroupModule } from 'igniteui-react'; +import { IgrRadio, IgrRadioGroup } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrRadioModule.register(); -IgrRadioGroupModule.register(); - export default class RadioLabel extends React.Component { constructor(props: any) { diff --git a/samples/inputs/radio/styling/src/index.tsx b/samples/inputs/radio/styling/src/index.tsx index 4aad45e21c..5bfa1353ee 100644 --- a/samples/inputs/radio/styling/src/index.tsx +++ b/samples/inputs/radio/styling/src/index.tsx @@ -1,12 +1,9 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; -import { IgrRadio, IgrRadioGroup, IgrRadioModule, IgrRadioGroupModule } from 'igniteui-react'; +import { IgrRadio, IgrRadioGroup } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; import './index.css'; -IgrRadioModule.register(); -IgrRadioGroupModule.register(); - export default class RadioStyling extends React.Component { constructor(props: any) { diff --git a/samples/inputs/rating/basic/src/index.tsx b/samples/inputs/rating/basic/src/index.tsx index f0139a8c1d..1ef035a618 100644 --- a/samples/inputs/rating/basic/src/index.tsx +++ b/samples/inputs/rating/basic/src/index.tsx @@ -1,11 +1,9 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrRating, IgrRatingModule,} from 'igniteui-react'; +import { IgrRating } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrRatingModule.register(); - export default class RatingOverview extends React.Component { constructor(props: any) { diff --git a/samples/inputs/rating/custom/src/index.tsx b/samples/inputs/rating/custom/src/index.tsx index abf0801391..d59e77cd3e 100644 --- a/samples/inputs/rating/custom/src/index.tsx +++ b/samples/inputs/rating/custom/src/index.tsx @@ -1,12 +1,11 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrRating, IgrRatingModule, IgrRatingSymbol, IgrRatingSymbolModule, IgrIcon, IgrIconModule, registerIconFromText } from 'igniteui-react'; +import { IgrRating, IgrRatingSymbol, IgrIcon, registerIconFromText } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrRatingModule.register(); -IgrRatingSymbolModule.register(); -IgrIconModule.register(); +const emptyHeart = ""; +const heartIcon = ' '; const emptyHeart = ""; const heartIcon = ' '; @@ -23,25 +22,25 @@ export default class RatingCustomSymbols extends React.Component { return (
- -
-
+ +
+
- -
-
+ +
+
- -
-
+ +
+
- -
-
+ +
+
- -
-
+ +
+
diff --git a/samples/inputs/rating/empty/src/index.tsx b/samples/inputs/rating/empty/src/index.tsx index 7d5f689129..081c5fb382 100644 --- a/samples/inputs/rating/empty/src/index.tsx +++ b/samples/inputs/rating/empty/src/index.tsx @@ -1,12 +1,11 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrRating, IgrRatingModule, IgrRatingSymbol, IgrRatingSymbolModule, IgrIcon, IgrIconModule, registerIconFromText } from 'igniteui-react'; +import { IgrRating, IgrRatingSymbol, IgrIcon, registerIconFromText } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrRatingModule.register(); -IgrRatingSymbolModule.register(); -IgrIconModule.register(); +const bandageIcon = 'Bandage IconA picture depicting a bandage.'; +const bacteriaIcon = 'Bacteria IconA picture depicting a bacteria.'; const bandageIcon = 'Bandage IconA picture depicting a bandage.'; const bacteriaIcon = 'Bacteria IconA picture depicting a bacteria.'; @@ -23,25 +22,25 @@ export default class RatingEmptyAndSelected extends React.Component { return (
- -
-
+ +
+
- -
-
+ +
+
- -
-
+ +
+
- -
-
+ +
+
- -
-
+ +
+
diff --git a/samples/inputs/rating/single-selection/src/index.tsx b/samples/inputs/rating/single-selection/src/index.tsx index d30e68a49d..22c5779788 100644 --- a/samples/inputs/rating/single-selection/src/index.tsx +++ b/samples/inputs/rating/single-selection/src/index.tsx @@ -1,12 +1,9 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrRating, IgrRatingModule, IgrRatingSymbol, IgrRatingSymbolModule, IgrIconModule } from 'igniteui-react'; +import { IgrRating, IgrRatingSymbol } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrRatingModule.register(); -IgrRatingSymbolModule.register(); -IgrIconModule.register(); export default class RatingSingleSelection extends React.Component { constructor(props: any) { @@ -17,25 +14,25 @@ export default class RatingSingleSelection extends React.Component { return (
- -
😣
-
😣
+ +
😣
+
😣
- -
😔
-
😔
+ +
😔
+
😔
- -
😐
-
😐
+ +
😐
+
😐
- -
🙂
-
🙂
+ +
🙂
+
🙂
- -
😆
-
😆
+ +
😆
+
😆
diff --git a/samples/inputs/rating/styling/src/index.tsx b/samples/inputs/rating/styling/src/index.tsx index 90ba0319e0..bb41096530 100644 --- a/samples/inputs/rating/styling/src/index.tsx +++ b/samples/inputs/rating/styling/src/index.tsx @@ -1,11 +1,9 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrRating, IgrRatingModule,} from 'igniteui-react'; +import { IgrRating } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrRatingModule.register(); - export default class RatingStyling extends React.Component { constructor(props: any) { diff --git a/samples/inputs/ripple/button/src/index.tsx b/samples/inputs/ripple/button/src/index.tsx index 90cca55cd2..d1b9c5d53f 100644 --- a/samples/inputs/ripple/button/src/index.tsx +++ b/samples/inputs/ripple/button/src/index.tsx @@ -1,30 +1,21 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrRipple, IgrRippleModule, IgrButton, IgrButtonModule } from 'igniteui-react'; +import { IgrRipple, IgrButton } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrRippleModule.register(); -IgrButtonModule.register(); +export default function RippleButton() { -export default class RippleButton extends React.Component { - - constructor(props: any) { - super(props); - } - - public render(): JSX.Element { - return ( -
- - - Ripple Button - -
- ); - } + return ( +
+ + + Ripple Button + +
+ ); } -// rendering above class to the React DOM +// rendering above component to the React DOM const root = ReactDOM.createRoot(document.getElementById('root')); root.render(); diff --git a/samples/inputs/ripple/color/src/index.tsx b/samples/inputs/ripple/color/src/index.tsx index dc93ebc170..6530c914bd 100644 --- a/samples/inputs/ripple/color/src/index.tsx +++ b/samples/inputs/ripple/color/src/index.tsx @@ -1,30 +1,21 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrRipple, IgrRippleModule, IgrButton, IgrButtonModule } from 'igniteui-react'; +import { IgrRipple, IgrButton } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrRippleModule.register(); -IgrButtonModule.register(); +export default function RippleColor() { -export default class RippleColor extends React.Component { - - constructor(props: any) { - super(props); - } - - public render(): JSX.Element { - return ( -
- - - Ripple Button - -
- ); - } + return ( +
+ + + Ripple Button + +
+ ); } -// rendering above class to the React DOM +// rendering above component to the React DOM const root = ReactDOM.createRoot(document.getElementById('root')); root.render(); diff --git a/samples/inputs/select/group/src/index.tsx b/samples/inputs/select/group/src/index.tsx index 7121dab1cc..06a24c6513 100644 --- a/samples/inputs/select/group/src/index.tsx +++ b/samples/inputs/select/group/src/index.tsx @@ -1,23 +1,15 @@ import React, { useEffect } from "react"; import ReactDOM from "react-dom/client"; import { - IgrSelectModule, - IgrSelectItemModule, - IgrIconModule, IgrSelect, IgrSelectItem, IgrIcon, - IgrSelectGroupModule, IgrSelectGroup, registerIconFromText, } from "igniteui-react"; import "./index.css"; import "igniteui-webcomponents/themes/light/bootstrap.css"; -IgrSelectModule.register(); -IgrSelectGroupModule.register(); -IgrSelectItemModule.register(); -IgrIconModule.register(); const placeSvg = ''; @@ -117,6 +109,6 @@ export default function SelectGroup() { ); } -// rendering above class to the React DOM +// rendering above component to the React DOM const root = ReactDOM.createRoot(document.getElementById("root")); root.render(); diff --git a/samples/inputs/select/header/src/index.tsx b/samples/inputs/select/header/src/index.tsx index 20123d0f3b..e8d78f9a30 100644 --- a/samples/inputs/select/header/src/index.tsx +++ b/samples/inputs/select/header/src/index.tsx @@ -1,19 +1,12 @@ import React from "react"; import ReactDOM from "react-dom/client"; import { - IgrSelectModule, - IgrSelectHeaderModule, - IgrSelectItemModule, IgrSelect, IgrSelectItem, IgrSelectHeader } from "igniteui-react"; import "igniteui-webcomponents/themes/light/bootstrap.css"; -IgrSelectModule.register(); -IgrSelectHeaderModule.register(); -IgrSelectItemModule.register(); - export default function SelectHeader() { return (
@@ -28,6 +21,6 @@ export default function SelectHeader() { ); } -// rendering above class to the React DOM +// rendering above component to the React DOM const root = ReactDOM.createRoot(document.getElementById("root")); root.render(); \ No newline at end of file diff --git a/samples/inputs/select/item/src/index.tsx b/samples/inputs/select/item/src/index.tsx index 95ab55c0fc..bcc367a448 100644 --- a/samples/inputs/select/item/src/index.tsx +++ b/samples/inputs/select/item/src/index.tsx @@ -1,9 +1,6 @@ import React, { useEffect } from "react"; import ReactDOM from "react-dom/client"; import { - IgrSelectModule, - IgrSelectItemModule, - IgrIconModule, IgrSelect, IgrSelectItem, IgrIcon, @@ -12,9 +9,6 @@ import { import "./index.css"; import "igniteui-webcomponents/themes/light/bootstrap.css"; -IgrSelectModule.register(); -IgrSelectItemModule.register(); -IgrIconModule.register(); const hotelSvg = ''; @@ -57,6 +51,6 @@ export default function SelectItem() { ); } -// rendering above class to the React DOM +// rendering above component to the React DOM const root = ReactDOM.createRoot(document.getElementById("root")); root.render(); diff --git a/samples/inputs/select/overview/src/index.tsx b/samples/inputs/select/overview/src/index.tsx index 3153c31ece..ac4cb262cd 100644 --- a/samples/inputs/select/overview/src/index.tsx +++ b/samples/inputs/select/overview/src/index.tsx @@ -1,10 +1,8 @@ import React from "react"; import ReactDOM from "react-dom/client"; -import { IgrSelectModule, IgrSelectItemModule, IgrSelect, IgrSelectItem } from "igniteui-react"; +import { IgrSelect, IgrSelectItem } from "igniteui-react"; import "igniteui-webcomponents/themes/light/bootstrap.css"; -IgrSelectModule.register(); -IgrSelectItemModule.register(); export default function SelectOverview() { return ( @@ -19,6 +17,6 @@ export default function SelectOverview() { ); } -// rendering above class to the React DOM +// rendering above component to the React DOM const root = ReactDOM.createRoot(document.getElementById("root")); root.render(); \ No newline at end of file diff --git a/samples/inputs/select/styling/src/index.tsx b/samples/inputs/select/styling/src/index.tsx index 1f90d0b9a3..433448598e 100644 --- a/samples/inputs/select/styling/src/index.tsx +++ b/samples/inputs/select/styling/src/index.tsx @@ -1,24 +1,15 @@ import React, { useEffect } from "react"; import ReactDOM from "react-dom/client"; import { - IgrSelectModule, - IgrSelectItemModule, - IgrIconModule, IgrSelect, IgrSelectItem, IgrIcon, - IgrSelectGroupModule, IgrSelectGroup, registerIconFromText, } from "igniteui-react"; import "./index.css"; import "igniteui-webcomponents/themes/light/bootstrap.css"; -IgrSelectModule.register(); -IgrSelectGroupModule.register(); -IgrSelectItemModule.register(); -IgrIconModule.register(); - const placeSvg = ''; @@ -90,6 +81,6 @@ export default function SelectGroup() { ); } -// rendering above class to the React DOM +// rendering above component to the React DOM const root = ReactDOM.createRoot(document.getElementById("root")); root.render(); diff --git a/samples/inputs/slider/constraints/src/index.tsx b/samples/inputs/slider/constraints/src/index.tsx index 7179bd6050..5fdbd5664e 100644 --- a/samples/inputs/slider/constraints/src/index.tsx +++ b/samples/inputs/slider/constraints/src/index.tsx @@ -1,27 +1,19 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrSlider, IgrSliderModule } from 'igniteui-react'; +import { IgrSlider } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; import './SliderConstraintsStyle.css'; -IgrSliderModule.register(); +export default function SliderConstraints() { -export default class SliderConstraints extends React.Component { - - constructor(props: any) { - super(props); - } - - public render(): JSX.Element { - return ( -
- -
- ); - } + return ( +
+ +
+ ); } -// rendering above class to the React DOM +// rendering above component to the React DOM const root = ReactDOM.createRoot(document.getElementById('root')); root.render(); diff --git a/samples/inputs/slider/disabled/src/index.tsx b/samples/inputs/slider/disabled/src/index.tsx index ae10b548d5..377a80dc53 100644 --- a/samples/inputs/slider/disabled/src/index.tsx +++ b/samples/inputs/slider/disabled/src/index.tsx @@ -1,27 +1,19 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrSlider, IgrSliderModule } from 'igniteui-react'; +import { IgrSlider } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; import './SliderDisabledStyle.css'; -IgrSliderModule.register(); +export default function SliderDisabled() { -export default class SliderDisabled extends React.Component { - - constructor(props: any) { - super(props); - } - - public render(): JSX.Element { - return ( -
- -
- ); - } + return ( +
+ +
+ ); } -// rendering above class to the React DOM +// rendering above component to the React DOM const root = ReactDOM.createRoot(document.getElementById('root')); root.render(); diff --git a/samples/inputs/slider/discrete/src/index.tsx b/samples/inputs/slider/discrete/src/index.tsx index 3edf8dcdaa..98b9cff87b 100644 --- a/samples/inputs/slider/discrete/src/index.tsx +++ b/samples/inputs/slider/discrete/src/index.tsx @@ -1,27 +1,19 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrSlider, IgrSliderModule } from 'igniteui-react'; +import { IgrSlider } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; import './SliderDiscreteStyle.css'; -IgrSliderModule.register(); +export default function SliderDiscrete() { -export default class SliderDiscrete extends React.Component { - - constructor(props: any) { - super(props); - } - - public render(): JSX.Element { - return ( -
- -
- ); - } + return ( +
+ +
+ ); } -// rendering above class to the React DOM +// rendering above component to the React DOM const root = ReactDOM.createRoot(document.getElementById('root')); root.render(); diff --git a/samples/inputs/slider/labels/src/index.tsx b/samples/inputs/slider/labels/src/index.tsx index d4347a6072..bd8c46e03e 100644 --- a/samples/inputs/slider/labels/src/index.tsx +++ b/samples/inputs/slider/labels/src/index.tsx @@ -1,32 +1,23 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrSlider, IgrSliderModule, IgrSliderLabel, IgrSliderLabelModule } from 'igniteui-react'; +import { IgrSlider, IgrSliderLabel } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; import './SliderLabelsStyle.css'; -IgrSliderModule.register(); -IgrSliderLabelModule.register(); +export default function SliderLabels() { -export default class SliderLabels extends React.Component { - - constructor(props: any) { - super(props); - } - - public render(): JSX.Element { - return ( -
- - Low - Medium - High - -
- ); - } + return ( +
+ + Low + Medium + High + +
+ ); } -// rendering above class to the React DOM +// rendering above component to the React DOM const root = ReactDOM.createRoot(document.getElementById('root')); root.render(); diff --git a/samples/inputs/slider/overview/src/index.tsx b/samples/inputs/slider/overview/src/index.tsx index 72e5a7dbfd..85d53cfe4e 100644 --- a/samples/inputs/slider/overview/src/index.tsx +++ b/samples/inputs/slider/overview/src/index.tsx @@ -1,33 +1,24 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrSlider, IgrSliderModule, IgrRangeSlider, IgrRangeSliderModule } from 'igniteui-react'; +import { IgrSlider, IgrRangeSlider } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; import './SliderOverviewStyle.css'; -IgrSliderModule.register(); -IgrRangeSliderModule.register(); +export default function SliderOverview() { -export default class SliderOverview extends React.Component { - - constructor(props: any) { - super(props); - } - - public render(): JSX.Element { - return ( -
-
- Slider - - Range Slider - -
+ return ( +
+
+ Slider + + Range Slider +
- ); - } +
+ ); } -// rendering above class to the React DOM +// rendering above component to the React DOM const root = ReactDOM.createRoot(document.getElementById('root')); root.render(); diff --git a/samples/inputs/slider/styling/src/index.tsx b/samples/inputs/slider/styling/src/index.tsx index e5da5de81f..3060d021e2 100644 --- a/samples/inputs/slider/styling/src/index.tsx +++ b/samples/inputs/slider/styling/src/index.tsx @@ -1,35 +1,27 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrSlider, IgrRangeSlider, IgrSliderModule } from 'igniteui-react'; +import { IgrSlider, IgrRangeSlider } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; import './SliderStyling.css'; -IgrSliderModule.register(); +export default function SliderStyling() { -export default class SliderStyling extends React.Component { - - constructor(props: any) { - super(props); - } - - public render(): JSX.Element { - return ( -
-
- Slider - -
-
- Range Slider - - -
+ return ( +
+
+ Slider + +
+
+ Range Slider + +
- ); - } +
+ ); } -// rendering above class to the React DOM +// rendering above component to the React DOM const root = ReactDOM.createRoot(document.getElementById('root')); root.render(); diff --git a/samples/inputs/slider/tick-labels/src/index.tsx b/samples/inputs/slider/tick-labels/src/index.tsx index fafed4500e..4776036e4a 100644 --- a/samples/inputs/slider/tick-labels/src/index.tsx +++ b/samples/inputs/slider/tick-labels/src/index.tsx @@ -1,32 +1,24 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrSlider, IgrSliderModule } from 'igniteui-react'; +import { IgrSlider } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrSliderModule.register(); +export default function SliderTickLabels() { -export default class SliderTickLabels extends React.Component { - - constructor(props: any) { - super(props); - } - - public render(): JSX.Element { - return ( -
- - -
- ); - } + return ( +
+ + +
+ ); } -// rendering above class to the React DOM +// rendering above component to the React DOM const root = ReactDOM.createRoot(document.getElementById('root')); root.render(); diff --git a/samples/inputs/slider/ticks/src/index.tsx b/samples/inputs/slider/ticks/src/index.tsx index 6cdc70e2c6..0391eb300c 100644 --- a/samples/inputs/slider/ticks/src/index.tsx +++ b/samples/inputs/slider/ticks/src/index.tsx @@ -1,28 +1,20 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrSlider, IgrSliderModule } from 'igniteui-react'; +import { IgrSlider } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrSliderModule.register(); +export default function SliderTicks() { -export default class SliderTicks extends React.Component { - - constructor(props: any) { - super(props); - } - - public render(): JSX.Element { - return ( -
- -
- ); - } + return ( +
+ +
+ ); } -// rendering above class to the React DOM +// rendering above component to the React DOM const root = ReactDOM.createRoot(document.getElementById('root')); root.render(); diff --git a/samples/inputs/slider/value-format/src/index.tsx b/samples/inputs/slider/value-format/src/index.tsx index 9650ae36a6..d3d397a949 100644 --- a/samples/inputs/slider/value-format/src/index.tsx +++ b/samples/inputs/slider/value-format/src/index.tsx @@ -1,48 +1,34 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrSlider, IgrSliderModule } from 'igniteui-react'; +import { IgrSlider, NumberFormatOptions } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrSliderModule.register(); - -export default class SliderValueFormat extends React.Component { - - public slider: IgrSlider; - public slider2: IgrSlider; - - constructor(props: any) { - super(props); - this.sliderRef = this.sliderRef.bind(this); - this.sliderRef2 = this.sliderRef.bind(this); - } - - public render(): JSX.Element { - return ( -
- - - -
- ); - } - - public sliderRef(slider: IgrSlider){ - if (!slider) { return; } - this.slider = slider; - this.slider.valueFormatOptions = { style: 'currency', currency: 'USD'}; - } - - public sliderRef2(slider: IgrSlider){ - if (!slider) { return; } - this.slider2 = slider; - this.slider2.valueFormatOptions = { minimumFractionDigits: 1}; - } +export default function SliderValueFormat() { + + const formatOptions1: NumberFormatOptions = { + style: "currency", + currency: "USD" + }; + const formatOptions2 = { minimumFractionDigits: 1}; + + return ( +
+ + + + +
+ ); } -// rendering above class to the React DOM +// rendering above component to the React DOM const root = ReactDOM.createRoot(document.getElementById('root')); root.render(); diff --git a/samples/inputs/slider/value/src/index.tsx b/samples/inputs/slider/value/src/index.tsx index 5c37af0e62..cda6392dab 100644 --- a/samples/inputs/slider/value/src/index.tsx +++ b/samples/inputs/slider/value/src/index.tsx @@ -1,77 +1,52 @@ -import React from 'react'; -import ReactDOM from 'react-dom/client'; -import './index.css'; -import { IgrSlider, IgrSliderModule, IgrRangeSlider, IgrRangeSliderModule } from 'igniteui-react'; -import 'igniteui-webcomponents/themes/light/bootstrap.css'; - -IgrSliderModule.register(); -IgrRangeSliderModule.register(); - -export default class SliderValue extends React.Component { - - public slider: IgrSlider; - public rangeSlider: IgrRangeSlider; - public sliderValueSpan: HTMLElement; - public sliderLowerSpan: HTMLElement; - public sliderUpperSpan: HTMLElement; - - constructor(props: any) { - super(props); - this.onInput = this.onInput.bind(this); - this.onRangeInput = this.onRangeInput.bind(this); - this.sliderRef = this.sliderRef.bind(this); - this.rangeSliderRef = this.rangeSliderRef.bind(this); - - this.sliderValueSpan = document.getElementById('slider-value') as HTMLElement; - this.sliderLowerSpan = document.getElementById('slider-lower') as HTMLElement; - this.sliderUpperSpan = document.getElementById('slider-upper') as HTMLElement; - - } - - public render(): JSX.Element { - return ( -
-
- -
- Value: - -
- - -
- Lower: - 20 - , Upper: - 70 -
-
-
- ); - } - - public sliderRef(slider: IgrSlider){ - if (!slider) { return; } - this.slider = slider; - } - - public rangeSliderRef(slider: IgrRangeSlider){ - if (!slider) { return; } - this.rangeSlider = slider; - } - - public onInput(ev: any){ - if(!ev) { return; } - //this.sliderValueSpan.innerHTML = ev.detail; - } - - public onRangeInput(ev: any){ - // this.sliderLowerSpan.innerHTML = ev.detail.lower; - // this.sliderUpperSpan.innerHTML = ev.detail.upper; - } - +import React, { useState } from "react"; +import ReactDOM from "react-dom/client"; +import "./index.css"; +import { IgrSlider, IgrRangeSlider } from "igniteui-react"; +import "igniteui-webcomponents/themes/light/bootstrap.css"; + +export default function SliderValue() { + + const [sliderVal, setSliderVal] = useState(40); + const [rangeLower, setRangeLower] = useState(20); + const [rangeUpper, setRangeUpper] = useState(70); + + const handleSliderInput = (event: any) => { + setSliderVal(event.detail); + }; + + const handleRangeInput = (event: any) => { + const { lower, upper } = event.detail; + setRangeLower(lower); + setRangeUpper(upper); + }; + + return ( +
+
+ +
+ Value: {sliderVal} +
+ + +
+ Lower: {rangeLower} + , Upper: {rangeUpper} +
+
+
+ ); } -// rendering above class to the React DOM -const root = ReactDOM.createRoot(document.getElementById('root')); -root.render(); +// rendering above component to the React DOM +const root = ReactDOM.createRoot(document.getElementById("root")); +root.render(); diff --git a/samples/inputs/switches/checking/src/index.tsx b/samples/inputs/switches/checking/src/index.tsx index ab9e912e07..2c7125cc24 100644 --- a/samples/inputs/switches/checking/src/index.tsx +++ b/samples/inputs/switches/checking/src/index.tsx @@ -1,26 +1,18 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrSwitch, IgrSwitchModule } from 'igniteui-react'; +import { IgrSwitch } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrSwitchModule.register(); +export default function SwitchOutlined() { -export default class SwitchOutlined extends React.Component { - - constructor(props: any) { - super(props); - } - - public render(): JSX.Element { - return ( -
- Label -
- ); - } + return ( +
+ Label +
+ ); } -// rendering above class to the React DOM +// rendering above component to the React DOM const root = ReactDOM.createRoot(document.getElementById('root')); root.render(); diff --git a/samples/inputs/switches/disabled/src/index.tsx b/samples/inputs/switches/disabled/src/index.tsx index 1dd1cb91e5..5ab9aa932f 100644 --- a/samples/inputs/switches/disabled/src/index.tsx +++ b/samples/inputs/switches/disabled/src/index.tsx @@ -1,26 +1,18 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrSwitch, IgrSwitchModule } from 'igniteui-react'; +import { IgrSwitch } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrSwitchModule.register(); +export default function SwitchDisabled() { -export default class SwitchDisabled extends React.Component { - - constructor(props: any) { - super(props); - } - - public render(): JSX.Element { - return ( -
- -
- ); - } + return ( +
+ +
+ ); } -// rendering above class to the React DOM +// rendering above component to the React DOM const root = ReactDOM.createRoot(document.getElementById('root')); root.render(); diff --git a/samples/inputs/switches/label/src/index.tsx b/samples/inputs/switches/label/src/index.tsx index 5a54d097bf..a6bb987604 100644 --- a/samples/inputs/switches/label/src/index.tsx +++ b/samples/inputs/switches/label/src/index.tsx @@ -1,26 +1,18 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrSwitch, IgrSwitchModule } from 'igniteui-react'; +import { IgrSwitch } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrSwitchModule.register(); +export default function SwitchLabel() { -export default class SwitchLabel extends React.Component { - - constructor(props: any) { - super(props); - } - - public render(): JSX.Element { - return ( -
- Label -
- ); - } + return ( +
+ Label +
+ ); } -// rendering above class to the React DOM +// rendering above component to the React DOM const root = ReactDOM.createRoot(document.getElementById('root')); root.render(); diff --git a/samples/inputs/switches/overview/src/index.tsx b/samples/inputs/switches/overview/src/index.tsx index 1f9221c552..ea33b4c482 100644 --- a/samples/inputs/switches/overview/src/index.tsx +++ b/samples/inputs/switches/overview/src/index.tsx @@ -1,26 +1,18 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrSwitch, IgrSwitchModule } from 'igniteui-react'; +import { IgrSwitch } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrSwitchModule.register(); +export default function SwitchOverview() { -export default class SwitchOverview extends React.Component { - - constructor(props: any) { - super(props); - } - - public render(): JSX.Element { - return ( -
- -
- ); - } + return ( +
+ +
+ ); } -// rendering above class to the React DOM +// rendering above component to the React DOM const root = ReactDOM.createRoot(document.getElementById('root')); root.render(); diff --git a/samples/inputs/textarea/form-integration/src/index.tsx b/samples/inputs/textarea/form-integration/src/index.tsx index 34ad21e145..53dcfa3eb8 100644 --- a/samples/inputs/textarea/form-integration/src/index.tsx +++ b/samples/inputs/textarea/form-integration/src/index.tsx @@ -1,52 +1,56 @@ -import React from 'react'; -import ReactDOM from 'react-dom/client'; -import './index.css'; -import { IgrTextarea, IgrTextareaModule, IgrButton, IgrButtonModule, IgrToast, IgrToastModule } from 'igniteui-react'; -import 'igniteui-webcomponents/themes/light/bootstrap.css'; - -IgrTextareaModule.register(); -IgrButtonModule.register(); -IgrToastModule.register(); - -export default class TextAreaFormIntegration extends React.Component { - - public toastRef: IgrToast; - - constructor(props: any) { - super(props); - this.onSubmitButtonClicked = this.onSubmitButtonClicked.bind(this); - this.onToastRef = this.onToastRef.bind(this); - } - - public render(): JSX.Element { - return ( -
-
- - -
- Submit review - Reset -
- Your review was submitted -
-
- ); - } - - public onToastRef(toast: IgrToast){ - if (!toast) { return; } - this.toastRef = toast; +import React from "react"; +import ReactDOM from "react-dom/client"; +import "./index.css"; +import { IgrTextarea, IgrButton, IgrToast } from "igniteui-react"; +import "igniteui-webcomponents/themes/light/bootstrap.css"; + +export default function TextAreaFormIntegration() { + let toastRef: IgrToast; + + const onToastRef = (toast: IgrToast) => { + if (!toast) { + return; } + toastRef = toast; + }; - public onSubmitButtonClicked(e:React.FormEvent) { - if(this.toastRef){ - e.preventDefault(); - this.toastRef.show(); - } + const onSubmitButtonClicked = (e: React.FormEvent) => { + if (toastRef) { + e.preventDefault(); + toastRef.show(); } + }; + + return ( +
+
+ +
+ + Submit review + + + Reset + +
+ + Your review was submitted + +
+
+ ); } // rendering above class to the React DOM -const root = ReactDOM.createRoot(document.getElementById('root')); -root.render(); +const root = ReactDOM.createRoot(document.getElementById("root")); +root.render(); diff --git a/samples/inputs/textarea/overview/src/index.tsx b/samples/inputs/textarea/overview/src/index.tsx index 5960335a05..6651edc5b4 100644 --- a/samples/inputs/textarea/overview/src/index.tsx +++ b/samples/inputs/textarea/overview/src/index.tsx @@ -1,26 +1,18 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrTextarea, IgrTextareaModule } from 'igniteui-react'; +import { IgrTextarea } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrTextareaModule.register(); +export default function TextAreaOverview() { -export default class TextAreaOverview extends React.Component { - - constructor(props: any) { - super(props); - } - - public render(): JSX.Element { - return ( -
- It was a dark and stormy night... -
- ); - } + return ( +
+ It was a dark and stormy night... +
+ ); } -// rendering above class to the React DOM +// rendering above component to the React DOM const root = ReactDOM.createRoot(document.getElementById('root')); root.render(); diff --git a/samples/inputs/textarea/resize/src/index.tsx b/samples/inputs/textarea/resize/src/index.tsx index 650a0009e8..1d13935d3b 100644 --- a/samples/inputs/textarea/resize/src/index.tsx +++ b/samples/inputs/textarea/resize/src/index.tsx @@ -1,34 +1,26 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrTextarea, IgrTextareaModule } from 'igniteui-react'; +import { IgrTextarea } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrTextareaModule.register(); +export default function TextAreaResize() { -export default class TextAreaResize extends React.Component { - - constructor(props: any) { - super(props); - } - - public render(): JSX.Element { - return ( -
- -

This textarea does not resize and uses a scroll bar to show overflow text.

-
- -

This textarea lets the user resize vertically.

-
- -

This textarea shows all the user input at once. Overflow text wraps onto a new line and expands the text area.

-
-
- ); - } + return ( +
+ +

This textarea does not resize and uses a scroll bar to show overflow text.

+
+ +

This textarea lets the user resize vertically.

+
+ +

This textarea shows all the user input at once. Overflow text wraps onto a new line and expands the text area.

+
+
+ ); } -// rendering above class to the React DOM +// rendering above component to the React DOM const root = ReactDOM.createRoot(document.getElementById('root')); root.render(); diff --git a/samples/inputs/textarea/slots/src/index.tsx b/samples/inputs/textarea/slots/src/index.tsx index 2a61436748..74961633dd 100644 --- a/samples/inputs/textarea/slots/src/index.tsx +++ b/samples/inputs/textarea/slots/src/index.tsx @@ -1,37 +1,30 @@ -import React from 'react'; +import React, { useEffect } from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrTextarea, IgrTextareaModule, IgrIcon, IgrIconModule, registerIconFromText } from 'igniteui-react'; +import { IgrTextarea, IgrIcon, registerIconFromText } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrTextareaModule.register(); -IgrIconModule.register(); +export default function TextAreaSlots() { -export default class TextAreaSlots extends React.Component { - - constructor(props: any) { - super(props); + useEffect(() => { registerIconFromText( "feedback", ``, "material"); - } + }, []); - public render(): JSX.Element { - return ( -
- - - - -

Give us a short description of what you liked/disliked

-
-
- ); - - } + return ( +
+ + + + +

Give us a short description of what you liked/disliked

+
+
+ ); } -// rendering above class to the React DOM +// rendering above component to the React DOM const root = ReactDOM.createRoot(document.getElementById('root')); root.render(); diff --git a/samples/inputs/textarea/styling/src/index.tsx b/samples/inputs/textarea/styling/src/index.tsx index f569bb5253..c008c8e047 100644 --- a/samples/inputs/textarea/styling/src/index.tsx +++ b/samples/inputs/textarea/styling/src/index.tsx @@ -1,34 +1,27 @@ -import React from 'react'; +import React, { useEffect } from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrTextarea, IgrTextareaModule, IgrIcon, IgrIconModule, registerIconFromText } from 'igniteui-react'; +import { IgrTextarea, IgrIcon, registerIconFromText } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrTextareaModule.register(); -IgrIconModule.register(); +export default function TextAreaStyling() { -export default class TextAreaStyling extends React.Component { - - constructor(props: any) { - super(props); + useEffect(() => { registerIconFromText( "feedback", ``, "material"); - } - - public render(): JSX.Element { - return ( -
- - - - -

Provide a detailed description of the steps that led to the issue you experienced

-
-
- ); - - } + }, []); + + return ( +
+ + + + +

Provide a detailed description of the steps that led to the issue you experienced

+
+
+ ); } diff --git a/samples/layouts/accordion/customization/src/index.tsx b/samples/layouts/accordion/customization/src/index.tsx index 5bc05a9f28..75a423073b 100644 --- a/samples/layouts/accordion/customization/src/index.tsx +++ b/samples/layouts/accordion/customization/src/index.tsx @@ -1,177 +1,224 @@ -import React from 'react'; -import ReactDOM from 'react-dom/client'; -import './index.css'; -import './AccordionCustomization.css'; +import React from "react"; +import ReactDOM from "react-dom/client"; +import "./index.css"; +import "./AccordionCustomization.css"; import { - IgrAccordion, IgrAccordionModule, IgrCheckbox, IgrCheckboxChangeEventArgs, IgrCheckboxModule, - IgrDateTimeInput, IgrDateTimeInputModule, IgrExpansionPanel, IgrExpansionPanelModule, IgrIcon, - IgrIconModule, IgrRadio, IgrRadioModule, IgrRadioGroup, IgrRadioGroupModule, IgrRating, - IgrRatingModule, IgrRangeSlider, IgrRangeSliderModule, IgrRadioChangeEventArgs, - IgrRangeSliderValueEventArgs, IgrComponentDateValueChangedEventArgs, registerIconFromText -} from 'igniteui-react'; -import 'igniteui-webcomponents/themes/light/bootstrap.css'; - -IgrAccordionModule.register(); -IgrCheckboxModule.register(); -IgrDateTimeInputModule.register(); -IgrExpansionPanelModule.register(); -IgrIconModule.register(); -IgrRadioModule.register(); -IgrRadioGroupModule.register(); -IgrRangeSliderModule.register(); -IgrRatingModule.register(); + IgrAccordion, + IgrCheckbox, + IgrCheckboxChangeEventArgs, + IgrDateTimeInput, + IgrExpansionPanel, + IgrIcon, + IgrRadio, + IgrRadioGroup, + IgrRating, + IgrRangeSlider, + IgrRadioChangeEventArgs, + IgrRangeSliderValueEventArgs, + IgrComponentDateValueChangedEventArgs, + registerIconFromText, +} from "igniteui-react"; +import "igniteui-webcomponents/themes/light/bootstrap.css"; type Category = { checked: boolean; type: string }; const clearIcon = - ""; + ""; const clockIcon = - ""; + ""; export default class AccordionCustomization extends React.Component { - private categories = [ - { checked: false, type: "Bike" }, - { checked: false, type: "Motorcycle" }, - { checked: false, type: "Car" }, - { checked: false, type: "Taxi" }, - { checked: false, type: "Public Transport" } - ]; - - private dateTimeInput: IgrDateTimeInput; - - constructor(props: any) { - super(props); - this.state = { - categories: this.categories, - cost: { lower: 200, upper: 800 }, - rating: '', - time: 'Time' - }; - - this.categoriesChange = this.categoriesChange.bind(this); - this.costRangeChange = this.costRangeChange.bind(this); - this.ratingChange = this.ratingChange.bind(this); - this.timeChange = this.timeChange.bind(this); - this.clearTime = this.clearTime.bind(this); - this.dateTimeInputRef = this.dateTimeInputRef.bind(this); - - registerIconFromText("clear", clearIcon, "material"); - registerIconFromText("clock", clockIcon, "material"); - } - - public render(): JSX.Element { - return ( -
-
- - -

- Categories - {this.state.categories.some((c: Category) => c.checked) && ': '} - {this.state.categories.filter((c: Category) => c.checked).map((c: Category) => c.type).join(', ')} -

- -
- {this.state.categories.map((c: Category) => { - return ( - this.categoriesChange(e, c.type)}> - {c.type} - - ); - })} -
-
-
- -

- Cost: ${this.state.cost.lower} to ${this.state.cost.upper} -

- - - - -
- -

Rating{this.state.rating && ': '}{this.state.rating}

- - - {[1, 2, 3, 4].map(rating => { - return ( - - 1 ? 's' : ''} or more`} max={5} value={rating + 0.5} - className="size-small" readOnly={true} key={`{r-${rating}}`}> - - - ); - })} - - -
- -

{this.state.time}

- - - - - - - - - - -
-
+ private categories = [ + { checked: false, type: "Bike" }, + { checked: false, type: "Motorcycle" }, + { checked: false, type: "Car" }, + { checked: false, type: "Taxi" }, + { checked: false, type: "Public Transport" }, + ]; + + private dateTimeInput: IgrDateTimeInput; + + constructor(props: any) { + super(props); + this.state = { + categories: this.categories, + cost: { lower: 200, upper: 800 }, + rating: "", + time: "Time", + }; + + this.categoriesChange = this.categoriesChange.bind(this); + this.costRangeChange = this.costRangeChange.bind(this); + this.ratingChange = this.ratingChange.bind(this); + this.timeChange = this.timeChange.bind(this); + this.clearTime = this.clearTime.bind(this); + this.dateTimeInputRef = this.dateTimeInputRef.bind(this); + + registerIconFromText("clear", clearIcon, "material"); + registerIconFromText("clock", clockIcon, "material"); + } + + public render(): JSX.Element { + return ( +
+
+ + +

+ Categories + {this.state.categories.some((c: Category) => c.checked) && ": "} + {this.state.categories + .filter((c: Category) => c.checked) + .map((c: Category) => c.type) + .join(", ")} +

+ +
+ {this.state.categories.map((c: Category) => { + return ( + + this.categoriesChange(e, c.type) + } + > + {c.type} + + ); + })}
-
- ); + + + +

+ Cost: ${this.state.cost.lower} to $ + {this.state.cost.upper} +

+ + + +
+ +

+ Rating{this.state.rating && ": "} + {this.state.rating} +

+ + + {[1, 2, 3, 4].map((rating) => { + return ( + + 1 ? "s" : "" + } or more`} + max={5} + value={rating + 0.5} + className="size-small" + readOnly={true} + > + + ); + })} + + +
+ +

+ {this.state.time} +

+ + + + + + + + + + +
+ +
+
+ ); + } + + public categoriesChange(e: IgrCheckboxChangeEventArgs, type: string) { + const categoryIndex = this.categories.findIndex((c) => c.type === type); + if (categoryIndex === -1) { + return; } - - public categoriesChange(e: IgrCheckboxChangeEventArgs, type: string) { - const categoryIndex = this.categories.findIndex(c => c.type === type); - if (categoryIndex === -1) { return; } - let categoriesCopy = this.state.categories; - categoriesCopy[categoryIndex].checked = e.detail.checked; - this.setState({ - categories: categoriesCopy - }); + let categoriesCopy = this.state.categories; + categoriesCopy[categoryIndex].checked = e.detail.checked; + this.setState({ + categories: categoriesCopy, + }); + } + + public costRangeChange(e: IgrRangeSliderValueEventArgs) { + this.setState({ + cost: { lower: e.detail.lower, upper: e.detail.upper }, + }); + } + + public ratingChange(e: IgrRadioChangeEventArgs) { + if (!e.detail.value) { + return; } - - public costRangeChange(e: IgrRangeSliderValueEventArgs) { - this.setState({ - cost: { lower: e.detail.lower, upper: e.detail.upper } - }); - } - - public ratingChange(e: IgrRadioChangeEventArgs) { - if (!e.detail.value) { return; } - this.setState({ - rating: `${+e.detail.value} star${+e.detail.value > 1 ? 's' : ''} or more` - }); - } - - public timeChange(e: IgrComponentDateValueChangedEventArgs) { - const s = e.target as IgrDateTimeInput; - const result = s.value !== null ? `Arrive before ${e.detail.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" })}` : 'Time'; - this.setState({ - time: result - }); - } - - public clearTime() { - this.dateTimeInput.clear(); this.setState({ - time: 'Time' - }); - } - - public dateTimeInputRef(input: IgrDateTimeInput) { - if (!input) { return; } - this.dateTimeInput = input; + this.setState({ + rating: `${+e.detail.value} star${ + +e.detail.value > 1 ? "s" : "" + } or more`, + }); + } + + public timeChange(e: IgrComponentDateValueChangedEventArgs) { + const s = e.target as IgrDateTimeInput; + const result = + s.value !== null + ? `Arrive before ${e.detail.toLocaleTimeString([], { + hour: "2-digit", + minute: "2-digit", + })}` + : "Time"; + this.setState({ + time: result, + }); + } + + public clearTime() { + this.dateTimeInput.clear(); + this.setState({ + time: "Time", + }); + } + + public dateTimeInputRef(input: IgrDateTimeInput) { + if (!input) { + return; } + this.dateTimeInput = input; + } } -// rendering above class to the React DOM -const root = ReactDOM.createRoot(document.getElementById('root')); +// rendering above component to the React DOM +const root = ReactDOM.createRoot(document.getElementById("root")); root.render(); diff --git a/samples/layouts/accordion/nested-scenario/src/index.tsx b/samples/layouts/accordion/nested-scenario/src/index.tsx index 58119cd516..74c68d0b5c 100644 --- a/samples/layouts/accordion/nested-scenario/src/index.tsx +++ b/samples/layouts/accordion/nested-scenario/src/index.tsx @@ -1,112 +1,102 @@ -import React from 'react'; +import React, { useState } from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; import './AccordionNestedScenario.css'; import { - IgrAccordion, IgrExpansionPanel, IgrSwitch, IgrAccordionModule, IgrExpansionPanelModule, IgrSwitchModule, + IgrAccordion, IgrExpansionPanel, IgrSwitch, IgrCheckboxChangeEventArgs } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrAccordionModule.register(); -IgrExpansionPanelModule.register(); -IgrSwitchModule.register(); +export default function AccordionNestedScenario() { -export default class AccordionNestedScenario extends React.Component { - - constructor(props: any) { - super(props); - this.state = { singleExpand: false }; - this.switchChange = this.switchChange.bind(this); + const [singleExpand, setSingleExpand] = useState(false); + + const switchChange = (e: IgrCheckboxChangeEventArgs) => { + setSingleExpand(e.detail.checked); } - public render(): JSX.Element { - return ( -
- Single Expand -
- - -

What has changed about subscription and pricing model?

- We have moved to a subscription-based pricing model for all our developer tools. This makes it easier - for you to manage your license subscriptions and allows us to provide a better level of service for you. We - updated our pricing and packages to provide you with flexible options and the best value. This includes Ignite UI - (formerly Ignite UI for JavaScript) which includes all of our JavaScript framework components for web development, - including: Angular, ASP.NET (Core and MVC), Blazor, JQuery, React and Web Components, as well as Infragistics Professional, - Infragistics Ultimate, our Ultimate UI products. We also offer multi-year subscriptions options with a built-in discount, - so you can see the value up front. With these updates we are confident that we are providing the best platforms and the best - price. -
- -

Who will the updated changes impact?

- The license updates will impact all new and current customers using Ignite UI, Infragistics Professional and - Infragistics Ultimate. Specifically, we have also made updates to our product and packaging for Ignite UI for JavaScript, - Ignite UI for Angular, Ignite UI for React and Ignite UI for Web components. For more information, please refer to this - blog: Announcement: Changes to Ignite UI Product & Packaging The pricing has been updated for all products and packages. - So, all new or additional licenses will be sold based on our new pricing and packages. All existing license agreements will - be honored and renewed based upon the current agreement. -
- -

What is the difference between your old model and your current subscription model for Ignite UI?

- For Ignite UI customers, we are moving away from NPM for licensed packages. The current NPM packages will be replaced with - packages that include a “Trial Version” watermark. Licensed packages for Ignite UI will be available from our cloud hosted ProGet - server. For more information, please refer to this article: Moving from Trial to Licensed Ignite UI NPM Packages -
- -

Common questions about renewal.

- - - -

What happens if I don't renew my subscription?

- Any unlicensed or trial versions of Ignite UI for Angular, React and Web Components will now include this watermark. -
- -

If I don't renew my subscription will I still have access to previous versions of Infragistics products?

- Any version of Infragistics software which you have downloaded can continue to be used perpetually. Access to download any new or - previous versions through our customer portal and package feeds will require maintaining an active subscription by continuing - to renew it. -
- -

Will I be automatically charged for my renewal/ Can I be automatically charged for renewal?

- Any new subscriptions purchased online, via our eCommerce system, will renew automatically. Subscription renewal can be canceled, - at any time, before the next automatic renewal date. Subscriptions purchased directly from Infragistics or Infragistics' partners are - subject to the renewal terms that were agreed upon as part of that purchase. -
-
-
-
- -

I split my work across two computers. Can I install on both using my single-user license?

- The Infragistics Ultimate license is tied to the user, and not the computer. That means you're welcome to install and use Ignite UI, - Infragistics Professional, and Infragistics Ultimate on any computer you use. However, if we notice a large number of activations using the - same license, we may contact you to verify this behavior. -
- -

I used up my trial for an earlier version of Infragistics Ultimate. Can I start a new trial when a major version is released?

- Yes! If you have tried a previous version in the past, and used up your 30-day trial, you can try the next major version for another 30 days! - You can do this in the following two ways: -
    -
  • If you have days remaining in your 30-day trial period for the current version (e.g., the - Version 15.1 Volume Release), use the Check for Update option inside the Platform Installer or - your account. You will be able to start a fresh trial for the next major version (e.g., 20.1 - Volume Release)
  • -
  • If you have used up the 30-day trial for the previous major version (e.g., the 19.2 Volume - Release), simply download and install Infragistics Ultimate from our website (This will also allow you - to start a new trial.)
  • -
-
-
-
+ return ( +
+ Single Expand +
+ + +

What has changed about subscription and pricing model?

+ We have moved to a subscription-based pricing model for all our developer tools. This makes it easier + for you to manage your license subscriptions and allows us to provide a better level of service for you. We + updated our pricing and packages to provide you with flexible options and the best value. This includes Ignite UI + (formerly Ignite UI for JavaScript) which includes all of our JavaScript framework components for web development, + including: Angular, ASP.NET (Core and MVC), Blazor, JQuery, React and Web Components, as well as Infragistics Professional, + Infragistics Ultimate, our Ultimate UI products. We also offer multi-year subscriptions options with a built-in discount, + so you can see the value up front. With these updates we are confident that we are providing the best platforms and the best + price. +
+ +

Who will the updated changes impact?

+ The license updates will impact all new and current customers using Ignite UI, Infragistics Professional and + Infragistics Ultimate. Specifically, we have also made updates to our product and packaging for Ignite UI for JavaScript, + Ignite UI for Angular, Ignite UI for React and Ignite UI for Web components. For more information, please refer to this + blog: Announcement: Changes to Ignite UI Product & Packaging The pricing has been updated for all products and packages. + So, all new or additional licenses will be sold based on our new pricing and packages. All existing license agreements will + be honored and renewed based upon the current agreement. +
+ +

What is the difference between your old model and your current subscription model for Ignite UI?

+ For Ignite UI customers, we are moving away from NPM for licensed packages. The current NPM packages will be replaced with + packages that include a “Trial Version” watermark. Licensed packages for Ignite UI will be available from our cloud hosted ProGet + server. For more information, please refer to this article: Moving from Trial to Licensed Ignite UI NPM Packages +
+ +

Common questions about renewal.

+ + + +

What happens if I don't renew my subscription?

+ Any unlicensed or trial versions of Ignite UI for Angular, React and Web Components will now include this watermark. +
+ +

If I don't renew my subscription will I still have access to previous versions of Infragistics products?

+ Any version of Infragistics software which you have downloaded can continue to be used perpetually. Access to download any new or + previous versions through our customer portal and package feeds will require maintaining an active subscription by continuing + to renew it. +
+ +

Will I be automatically charged for my renewal/ Can I be automatically charged for renewal?

+ Any new subscriptions purchased online, via our eCommerce system, will renew automatically. Subscription renewal can be canceled, + at any time, before the next automatic renewal date. Subscriptions purchased directly from Infragistics or Infragistics' partners are + subject to the renewal terms that were agreed upon as part of that purchase. +
+
+
+
+ +

I split my work across two computers. Can I install on both using my single-user license?

+ The Infragistics Ultimate license is tied to the user, and not the computer. That means you're welcome to install and use Ignite UI, + Infragistics Professional, and Infragistics Ultimate on any computer you use. However, if we notice a large number of activations using the + same license, we may contact you to verify this behavior. +
+ +

I used up my trial for an earlier version of Infragistics Ultimate. Can I start a new trial when a major version is released?

+ Yes! If you have tried a previous version in the past, and used up your 30-day trial, you can try the next major version for another 30 days! + You can do this in the following two ways: +
    +
  • If you have days remaining in your 30-day trial period for the current version (e.g., the + Version 15.1 Volume Release), use the Check for Update option inside the Platform Installer or + your account. You will be able to start a fresh trial for the next major version (e.g., 20.1 + Volume Release)
  • +
  • If you have used up the 30-day trial for the previous major version (e.g., the 19.2 Volume + Release), simply download and install Infragistics Ultimate from our website (This will also allow you + to start a new trial.)
  • +
+
+
- ); - } - - public switchChange(e: IgrCheckboxChangeEventArgs) { - this.setState({ singleExpand: e.detail.checked }) - } +
+ ); } -// rendering above class to the React DOM +// rendering above component to the React DOM const root = ReactDOM.createRoot(document.getElementById('root')); root.render(); diff --git a/samples/layouts/accordion/overview/src/index.tsx b/samples/layouts/accordion/overview/src/index.tsx index 03527ba6a3..222236d71d 100644 --- a/samples/layouts/accordion/overview/src/index.tsx +++ b/samples/layouts/accordion/overview/src/index.tsx @@ -1,77 +1,68 @@ -import React from 'react'; +import React, { useState } from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; import './AccordionOverview.css'; import { - IgrAccordion, IgrAccordionModule, IgrExpansionPanel, IgrExpansionPanelModule, IgrSwitch, IgrSwitchModule, + IgrAccordion, IgrExpansionPanel, IgrSwitch, IgrCheckboxChangeEventArgs } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrAccordionModule.register(); -IgrExpansionPanelModule.register(); -IgrSwitchModule.register(); +export default function AccordionOverview() { -export default class AccordionOverview extends React.Component { + const [singleExpand, setSingleExpand] = useState(false); - constructor(props: any) { - super(props); - this.state = { singleExpand: false }; - this.switchChange = this.switchChange.bind(this); + const switchChange = (e: IgrCheckboxChangeEventArgs) => { + setSingleExpand(e.detail.checked); } - - public render(): JSX.Element { - return ( -
- Single Expand -
- - -

What has changed about subscription and pricing model?

- We have moved to a subscription-based pricing model for all our developer tools. This makes it easier - for you to manage your license subscriptions and allows us to provide a better level of service for you. We - updated our pricing and packages to provide you with flexible options and the best value. This includes Ignite UI - (formerly Ignite UI for JavaScript) which includes all of our JavaScript framework components for web development, - including: Angular, ASP.NET (Core and MVC), Blazor, JQuery, React and Web Components, as well as Infragistics Professional, - Infragistics Ultimate, our Ultimate UI products. We also offer multi-year subscriptions options with a built-in discount, - so you can see the value up front. With these updates we are confident that we are providing the best platforms and the best - price. -
- -

Who will the updated changes impact?

- The license updates will impact all new and current customers using Ignite UI, Infragistics Professional and - Infragistics Ultimate. Specifically, we have also made updates to our product and packaging for Ignite UI for JavaScript, - Ignite UI for Angular, Ignite UI for React and Ignite UI for Web components. For more information, please refer to this - blog: Announcement: Changes to Ignite UI Product & Packaging The pricing has been updated for all products and packages. - So, all new or additional licenses will be sold based on our new pricing and packages. All existing license agreements will - be honored and renewed based upon the current agreement. -
- -

What is the difference between your old model and your current subscription model for Ignite UI?

- For Ignite UI customers, we are moving away from NPM for licensed packages. The current NPM packages will be replaced with - packages that include a “Trial Version” watermark. Licensed packages for Ignite UI will be available from our cloud hosted ProGet - server. For more information, please refer to this article: Moving from Trial to Licensed Ignite UI NPM Packages -
- -

What happens if I don't renew my subscription?

- Any unlicensed or trial versions of Ignite UI for Angular, React and Web Components will now include this watermark. -
- -

If I don't renew my subscription will I still have access to previous versions of Infragistics products?

- Any version of Infragistics software which you have downloaded can continue to be used perpetually. Access to download any new or - previous versions through our customer portal and package feeds will require maintaining an active subscription by continuing - to renew it. -
-
-
+ + return ( +
+ Single Expand +
+ + +

What has changed about subscription and pricing model?

+ We have moved to a subscription-based pricing model for all our developer tools. This makes it easier + for you to manage your license subscriptions and allows us to provide a better level of service for you. We + updated our pricing and packages to provide you with flexible options and the best value. This includes Ignite UI + (formerly Ignite UI for JavaScript) which includes all of our JavaScript framework components for web development, + including: Angular, ASP.NET (Core and MVC), Blazor, JQuery, React and Web Components, as well as Infragistics Professional, + Infragistics Ultimate, our Ultimate UI products. We also offer multi-year subscriptions options with a built-in discount, + so you can see the value up front. With these updates we are confident that we are providing the best platforms and the best + price. +
+ +

Who will the updated changes impact?

+ The license updates will impact all new and current customers using Ignite UI, Infragistics Professional and + Infragistics Ultimate. Specifically, we have also made updates to our product and packaging for Ignite UI for JavaScript, + Ignite UI for Angular, Ignite UI for React and Ignite UI for Web components. For more information, please refer to this + blog: Announcement: Changes to Ignite UI Product & Packaging The pricing has been updated for all products and packages. + So, all new or additional licenses will be sold based on our new pricing and packages. All existing license agreements will + be honored and renewed based upon the current agreement. +
+ +

What is the difference between your old model and your current subscription model for Ignite UI?

+ For Ignite UI customers, we are moving away from NPM for licensed packages. The current NPM packages will be replaced with + packages that include a “Trial Version” watermark. Licensed packages for Ignite UI will be available from our cloud hosted ProGet + server. For more information, please refer to this article: Moving from Trial to Licensed Ignite UI NPM Packages +
+ +

What happens if I don't renew my subscription?

+ Any unlicensed or trial versions of Ignite UI for Angular, React and Web Components will now include this watermark. +
+ +

If I don't renew my subscription will I still have access to previous versions of Infragistics products?

+ Any version of Infragistics software which you have downloaded can continue to be used perpetually. Access to download any new or + previous versions through our customer portal and package feeds will require maintaining an active subscription by continuing + to renew it. +
+
- ); - } - - public switchChange(e: IgrCheckboxChangeEventArgs) { - this.setState({ singleExpand: e.detail.checked }) - } +
+ + ); } -// rendering above class to the React DOM +// rendering above component to the React DOM const root = ReactDOM.createRoot(document.getElementById('root')); root.render(); diff --git a/samples/layouts/avatar/icon/src/index.tsx b/samples/layouts/avatar/icon/src/index.tsx index debca47c07..706a5ceac4 100644 --- a/samples/layouts/avatar/icon/src/index.tsx +++ b/samples/layouts/avatar/icon/src/index.tsx @@ -1,33 +1,28 @@ -import React from 'react'; +import React, { useEffect } from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrAvatarModule, IgrAvatar, IgrIcon, IgrIconModule, registerIconFromText } from 'igniteui-react'; +import { IgrAvatar, IgrIcon, registerIconFromText } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrAvatarModule.register(); -IgrIconModule.register(); const homeIcon = ''; -export default class AvatarIcon extends React.Component { +export default function AvatarIcon() { - constructor(props: any) { - super(props); + useEffect(() => { registerIconFromText("home", homeIcon, "material"); - } + }, []); - public render(): JSX.Element { - return ( -
- - - -
- ); - } + return ( +
+ + + +
+ ); } -// rendering above class to the React DOM +// rendering above component to the React DOM const root = ReactDOM.createRoot(document.getElementById('root')); root.render(); diff --git a/samples/layouts/avatar/image/src/index.tsx b/samples/layouts/avatar/image/src/index.tsx index 8be19f4e76..63af0576f9 100644 --- a/samples/layouts/avatar/image/src/index.tsx +++ b/samples/layouts/avatar/image/src/index.tsx @@ -1,26 +1,18 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrAvatarModule, IgrAvatar } from 'igniteui-react'; +import { IgrAvatar } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrAvatarModule.register(); +export default function AvatarImage() { -export default class AvatarImage extends React.Component { - - constructor(props: any) { - super(props); - } - - public render(): JSX.Element { - return ( -
- -
- ); - } + return ( +
+ +
+ ); } -// rendering above class to the React DOM +// rendering above component to the React DOM const root = ReactDOM.createRoot(document.getElementById('root')); root.render(); diff --git a/samples/layouts/avatar/initials/src/index.tsx b/samples/layouts/avatar/initials/src/index.tsx index dcd72d6d66..402d22ac49 100644 --- a/samples/layouts/avatar/initials/src/index.tsx +++ b/samples/layouts/avatar/initials/src/index.tsx @@ -1,26 +1,18 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrAvatarModule, IgrAvatar } from 'igniteui-react'; +import { IgrAvatar } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrAvatarModule.register(); +export default function AvatarInitials() { -export default class AvatarInitials extends React.Component { - - constructor(props: any) { - super(props); - } - - public render(): JSX.Element { - return ( -
- -
- ); - } + return ( +
+ +
+ ); } -// rendering above class to the React DOM +// rendering above component to the React DOM const root = ReactDOM.createRoot(document.getElementById('root')); root.render(); diff --git a/samples/layouts/avatar/shape/src/index.tsx b/samples/layouts/avatar/shape/src/index.tsx index 02aef5b645..62fe5a460a 100644 --- a/samples/layouts/avatar/shape/src/index.tsx +++ b/samples/layouts/avatar/shape/src/index.tsx @@ -1,33 +1,27 @@ -import React from 'react'; +import React, { useEffect } from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrAvatarModule, IgrAvatar, IgrIcon, IgrIconModule, registerIconFromText } from 'igniteui-react'; +import { IgrAvatar, IgrIcon, registerIconFromText } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrAvatarModule.register(); -IgrIconModule.register(); - const homeIcon = ''; -export default class AvatarShape extends React.Component { +export default function AvatarShape() { - constructor(props: any) { - super(props); + useEffect(() => { registerIconFromText("home", homeIcon, "material"); - } - - public render(): JSX.Element { - return ( -
- - - -
- ); - } + }, []); + + return ( +
+ + + +
+ ); } -// rendering above class to the React DOM +// rendering above component to the React DOM const root = ReactDOM.createRoot(document.getElementById('root')); root.render(); diff --git a/samples/layouts/avatar/size/src/index.tsx b/samples/layouts/avatar/size/src/index.tsx index 1fcaeff366..dfb5f9bb60 100644 --- a/samples/layouts/avatar/size/src/index.tsx +++ b/samples/layouts/avatar/size/src/index.tsx @@ -1,28 +1,20 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrAvatarModule, IgrAvatar } from 'igniteui-react'; +import { IgrAvatar } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrAvatarModule.register(); +export default function AvatarSize() { -export default class AvatarSize extends React.Component { - - constructor(props: any) { - super(props); - } - - public render(): JSX.Element { - return ( -
- - - -
- ); - } + return ( +
+ + + +
+ ); } -// rendering above class to the React DOM +// rendering above component to the React DOM const root = ReactDOM.createRoot(document.getElementById('root')); root.render(); diff --git a/samples/layouts/avatar/styling/.eslintrc.js b/samples/layouts/avatar/styling/.eslintrc.js new file mode 100644 index 0000000000..b45160a9ee --- /dev/null +++ b/samples/layouts/avatar/styling/.eslintrc.js @@ -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" + } + } + ] + }; \ No newline at end of file diff --git a/samples/layouts/avatar/styling/README.md b/samples/layouts/avatar/styling/README.md new file mode 100644 index 0000000000..fdd144568d --- /dev/null +++ b/samples/layouts/avatar/styling/README.md @@ -0,0 +1,56 @@ + + + +This folder contains implementation of React application with example of Styling feature using [Avatar](https://www.infragistics.com/products/ignite-ui-react/react/components/general-getting-started.html) component. + + + + + + View Docs + + + View Code + + + Run Sample + + + Run Sample + + + + +## 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/layouts/avatar/styling +``` + +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). diff --git a/samples/layouts/avatar/styling/package.json b/samples/layouts/avatar/styling/package.json new file mode 100644 index 0000000000..dd6da6303f --- /dev/null +++ b/samples/layouts/avatar/styling/package.json @@ -0,0 +1,38 @@ +{ + "name": "react-avatar-styling", + "description": "This project provides example of Avatar Size using Infragistics React components", + "author": "Infragistics", + "homepage": ".", + "version": "1.4.0", + "private": true, + "scripts": { + "start": "set PORT=4200 && react-scripts --max_old_space_size=10240 start", + "build": "react-scripts --max_old_space_size=10240 build ", + "test": "react-scripts test --env=jsdom", + "eject": "react-scripts eject" + }, + "dependencies": { + "igniteui-dockmanager": "1.16.1", + "igniteui-react": "19.0.2", + "igniteui-react-core": "19.0.0-alpha.1", + "react": "^18.2.0", + "react-dom": "^18.2.0", + "react-scripts": "^5.0.1", + "tslib": "^2.4.0" + }, + "devDependencies": { + "@types/jest": "^29.2.0", + "@types/node": "^18.11.7", + "@types/react": "^18.0.24", + "@types/react-dom": "^18.0.8", + "react-app-rewired": "^2.2.1", + "typescript": "^4.8.4", + "worker-loader": "^3.0.8" + }, + "browserslist": [ + ">0.2%", + "not dead", + "not ie <= 11", + "not op_mini all" + ] +} diff --git a/samples/layouts/avatar/styling/public/index.html b/samples/layouts/avatar/styling/public/index.html new file mode 100644 index 0000000000..6cbaae7d4e --- /dev/null +++ b/samples/layouts/avatar/styling/public/index.html @@ -0,0 +1,10 @@ + + + + AvatarStyling + + + +
+ + \ No newline at end of file diff --git a/samples/layouts/avatar/styling/sandbox.config.json b/samples/layouts/avatar/styling/sandbox.config.json new file mode 100644 index 0000000000..00acba0c10 --- /dev/null +++ b/samples/layouts/avatar/styling/sandbox.config.json @@ -0,0 +1,5 @@ +{ + "infiniteLoopProtection": false, + "hardReloadOnChange": false, + "view": "browser" +} \ No newline at end of file diff --git a/samples/layouts/avatar/styling/src/index.css b/samples/layouts/avatar/styling/src/index.css new file mode 100644 index 0000000000..aec0352f9e --- /dev/null +++ b/samples/layouts/avatar/styling/src/index.css @@ -0,0 +1,48 @@ +.sizes .size-small { + --ig-size: var(--ig-size-small); +} + +.sizes .size-medium { + --ig-size: var(--ig-size-medium); +} + +.sizes .size-large, +.size-large { + --ig-size: var(--ig-size-large); +} + +.sample { + display: flex; + flex-direction: row; + justify-content: space-around; + gap: 10px; + margin-top: 20px; +} + +.sizes { + display: flex; + flex-direction: row; + gap: 10px; +} + +igc-avatar::part(base) { + background: var(--ig-success-100); + border: 2px solid var(--ig-error-500); +} + +igc-avatar::part(initials) { + color: var(--ig-success-500-contrast); + background: var(--ig-error-500); + padding: 5px 10px; + margin: 10px; + border-radius: 50px; + /* border: 1px solid greenyellow; */ +} + +igc-avatar::part(image) { + border-radius: 20px; + padding: 5px; + border: 2px solid var(--ig-primary-500); +} + + diff --git a/samples/layouts/avatar/styling/src/index.tsx b/samples/layouts/avatar/styling/src/index.tsx new file mode 100644 index 0000000000..7c85c55918 --- /dev/null +++ b/samples/layouts/avatar/styling/src/index.tsx @@ -0,0 +1,36 @@ +import React, { useEffect } from 'react'; +import ReactDOM from 'react-dom/client'; +import './index.css'; +import { IgrAvatar, IgrIcon, registerIconFromText } from 'igniteui-react'; +import 'igniteui-webcomponents/themes/light/bootstrap.css'; + + +const homeIcon = + ''; + +export default function AvatarStyling() { + + useEffect(() => { + registerIconFromText("home", homeIcon, "material"); + }, []); + + return ( +
+ + + +
+ + + +
+
+ ); +} + +// rendering above component to the React DOM +const root = ReactDOM.createRoot(document.getElementById('root')); +root.render(); diff --git a/samples/layouts/avatar/styling/src/react-app-env.d.ts b/samples/layouts/avatar/styling/src/react-app-env.d.ts new file mode 100644 index 0000000000..6431bc5fc6 --- /dev/null +++ b/samples/layouts/avatar/styling/src/react-app-env.d.ts @@ -0,0 +1 @@ +/// diff --git a/samples/layouts/avatar/styling/tsconfig.json b/samples/layouts/avatar/styling/tsconfig.json new file mode 100644 index 0000000000..8c0d146f95 --- /dev/null +++ b/samples/layouts/avatar/styling/tsconfig.json @@ -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-jsx", + "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" + ] +} diff --git a/samples/layouts/card/horizontal/src/index.tsx b/samples/layouts/card/horizontal/src/index.tsx index 4e0a9c86ea..1c7a95184b 100644 --- a/samples/layouts/card/horizontal/src/index.tsx +++ b/samples/layouts/card/horizontal/src/index.tsx @@ -2,48 +2,40 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; import './CardHorizontal.css'; -import { IgrCard, IgrCardHeader, IgrCardContent, IgrCardActions, IgrCardModule } from 'igniteui-react'; +import { IgrCard, IgrCardHeader, IgrCardContent, IgrCardActions } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrCardModule.register(); +export default function CardHorizontal() { -export default class CardHorizontal extends React.Component { - - constructor(props: any) { - super(props); - } - - public render(): JSX.Element { - return ( -
-
- -
-
- - -
Rozes
-
Under the Grave (2016)
-
- -

As I have always said: I write what’s real and what’s true, - even if it means throwing myself under the bus.

-
-
-
- - skip_previous - play_arrow - skip_next - + return ( +
+
+ +
+
+ + +
Rozes
+
Under the Grave (2016)
+
+ +

As I have always said: I write what’s real and what’s true, + even if it means throwing myself under the bus.

+
- -
+
+ + skip_previous + play_arrow + skip_next + +
+
- ); - } +
+ ); } -// rendering above class to the React DOM +// rendering above component to the React DOM const root = ReactDOM.createRoot(document.getElementById('root')); root.render(); diff --git a/samples/layouts/card/overview/src/index.tsx b/samples/layouts/card/overview/src/index.tsx index 9785e25a85..22724a1e96 100644 --- a/samples/layouts/card/overview/src/index.tsx +++ b/samples/layouts/card/overview/src/index.tsx @@ -1,74 +1,74 @@ -import React from 'react'; -import ReactDOM from 'react-dom/client'; -import './index.css'; -import './CardOverview.css'; +import React, { useEffect } from "react"; +import ReactDOM from "react-dom/client"; +import "./index.css"; +import "./CardOverview.css"; import { - IgrCard, IgrCardMedia, IgrCardHeader, - IgrCardContent, IgrCardActions, IgrCardModule, - IgrIconButton, IgrIconButtonModule, IgrButton, - IgrButtonModule, IgrRipple, IgrRippleModule, - registerIconFromText, -} from 'igniteui-react'; -import 'igniteui-webcomponents/themes/light/bootstrap.css'; + IgrCard, + IgrCardMedia, + IgrCardHeader, + IgrCardContent, + IgrCardActions, + IgrIconButton, + IgrButton, + IgrRipple, + registerIconFromText, +} from "igniteui-react"; +import "igniteui-webcomponents/themes/light/bootstrap.css"; -IgrCardModule.register(); -IgrButtonModule.register(); -IgrIconButtonModule.register(); -IgrRippleModule.register(); +const twitterIcon = + ''; +const facebookIcon = + ''; -const twitterIcon = ''; -const facebookIcon = ''; +export default function CardOverview() { + useEffect(() => { + registerIconFromText("twitter", twitterIcon, "material"); + registerIconFromText("facebook", facebookIcon, "material"); + }, []); -export default class CardOverview extends React.Component { - - constructor(props: any) { - super(props); - registerIconFromText("twitter", twitterIcon, "material"); - registerIconFromText("facebook", facebookIcon, "material"); - } - - public render(): JSX.Element { - return ( -
-
- - - - - - -

New York City

-
City in New York
-
- - -

New York City comprises 5 boroughs sitting where the - Hudson River meets the Atlantic Ocean. At its core is Manhattan, - a densely populated borough that’s among the world’s major commercial, - financial and cultural centers.

-
- - - - Read more - - -
- - - - - - -
-
-
-
+ return ( +
+
+ + + + + +

New York City

+
City in New York
+
+ +

+ New York City comprises 5 boroughs sitting where the Hudson River + meets the Atlantic Ocean. At its core is Manhattan, a densely + populated borough that’s among the world’s major commercial, + financial and cultural centers. +

+
+ + + Read more + + +
+ + + + + +
- ); - } +
+
+
+
+ ); } -// rendering above class to the React DOM -const root = ReactDOM.createRoot(document.getElementById('root')); -root.render(); +// rendering above component to the React DOM +const root = ReactDOM.createRoot(document.getElementById("root")); +root.render(); diff --git a/samples/layouts/card/semi-horizontal/src/index.tsx b/samples/layouts/card/semi-horizontal/src/index.tsx index 1c4e1655e7..89922a5c6f 100644 --- a/samples/layouts/card/semi-horizontal/src/index.tsx +++ b/samples/layouts/card/semi-horizontal/src/index.tsx @@ -1,57 +1,58 @@ -import React from 'react'; -import ReactDOM from 'react-dom/client'; -import './index.css'; -import './CardSemiHorizontal.css'; -import { IgrCard, IgrCardHeader, IgrCardContent, IgrCardActions, IgrCardMedia, IgrAvatar, IgrButton, IgrAvatarModule, IgrButtonModule, IgrCardModule } from 'igniteui-react'; -import 'igniteui-webcomponents/themes/light/bootstrap.css'; +import React from "react"; +import ReactDOM from "react-dom/client"; +import "./index.css"; +import "./CardSemiHorizontal.css"; +import { + IgrCard, + IgrCardHeader, + IgrCardContent, + IgrCardActions, + IgrCardMedia, + IgrAvatar, + IgrButton, +} from "igniteui-react"; +import "igniteui-webcomponents/themes/light/bootstrap.css"; -IgrCardModule.register(); -IgrAvatarModule.register(); -IgrButtonModule.register(); +export default function CardSemiHorizontal() { + return ( +
+
+ +
+
+ + +
HERE
+
by Mellow D
+
-export default class CardSemiHorizontal extends React.Component { + +

+ Far far away, behind the word mountains, far from the + countries Vokalia and Consonantia, there live the blind texts. +

+
- constructor(props: any) { - super(props); - } - - public render(): JSX.Element { - return ( -
-
- -
-
- - -
HERE
-
by Mellow D
-
- - -

Far far away, behind the word mountains, - far from the countries Vokalia and Consonantia, - there live the blind texts.

-
- - - - Play Album - - -
- - - - -
-
-
+ + + Play Album + +
- ); - } + + + + +
+ +
+
+ ); } -// rendering above class to the React DOM -const root = ReactDOM.createRoot(document.getElementById('root')); -root.render(); +// rendering above component to the React DOM +const root = ReactDOM.createRoot(document.getElementById("root")); +root.render(); diff --git a/samples/layouts/card/styling/src/index.tsx b/samples/layouts/card/styling/src/index.tsx index 81b204272e..d3a5eb4e44 100644 --- a/samples/layouts/card/styling/src/index.tsx +++ b/samples/layouts/card/styling/src/index.tsx @@ -1,72 +1,71 @@ -import React from 'react'; -import ReactDOM from 'react-dom/client'; -import './index.css'; -import './CardStyling.css'; -import { IgrCard, IgrCardMedia, IgrCardHeader, IgrCardContent, IgrCardActions, IgrIconButton, IgrRipple, IgrCardModule, IgrIconButtonModule, IgrRippleModule, registerIconFromText } from 'igniteui-react'; -import 'igniteui-webcomponents/themes/light/bootstrap.css'; +import React, { useEffect } from "react"; +import ReactDOM from "react-dom/client"; +import "./index.css"; +import "./CardStyling.css"; +import { + IgrCard, + IgrCardMedia, + IgrCardHeader, + IgrCardContent, + IgrCardActions, + IgrIconButton, + IgrRipple, + registerIconFromText, +} from "igniteui-react"; +import "igniteui-webcomponents/themes/light/bootstrap.css"; -IgrCardModule.register(); -IgrIconButtonModule.register(); -IgrRippleModule.register(); +const twitterIcon = + ""; +const facebookIcon = + ""; +const instagramIcon = + ""; -const twitterIcon = ""; -const facebookIcon = ""; -const instagramIcon = ""; +export default function CardStyling() { + useEffect(() => { + registerIconFromText("facebook", facebookIcon, "material"); + registerIconFromText("twitter", twitterIcon, "material"); + registerIconFromText("instagram", instagramIcon, "material"); + }, []); -export default class CardStyling extends React.Component { - - constructor(props: any) { - super(props); - registerIconFromText("facebook", facebookIcon, "material"); - registerIconFromText("twitter", twitterIcon, "material"); - registerIconFromText("instagram", instagramIcon, "material"); - } - - public render(): JSX.Element { - return ( -
-
- - - - - - -

Jane Doe

-
Professional Photographer
-
- - -

Hi! I am Jane, photographer and filmmaker. - Photography is a way of feeling, of touching, - of loving. What you have caught on film is captured forever... - it remembers little things, long after you have - forgotten everything.

-
- - -
- - - - - - - - - - - -
-
- -
-
+ return ( +
+
+ + + + + +

Jane Doe

+
Professional Photographer
+
+ +

+ Hi! I am Jane, photographer and filmmaker. Photography is a way of + feeling, of touching, of loving. What you have caught on film is + captured forever... it remembers little things, long after you + have forgotten everything. +

+
+ +
+ + + + + + + + +
- ); - } +
+
+
+
+ ); } -// rendering above class to the React DOM -const root = ReactDOM.createRoot(document.getElementById('root')); -root.render(); +// rendering above component to the React DOM +const root = ReactDOM.createRoot(document.getElementById("root")); +root.render(); diff --git a/samples/layouts/carousel/animations/src/index.tsx b/samples/layouts/carousel/animations/src/index.tsx index c9ebfea43c..ead97cb2cb 100644 --- a/samples/layouts/carousel/animations/src/index.tsx +++ b/samples/layouts/carousel/animations/src/index.tsx @@ -1,45 +1,36 @@ -import React, { useRef } from "react"; +import React, { useRef, useState } from "react"; import ReactDOM from "react-dom/client"; import { - CarouselAnimationType, + HorizontalTransitionAnimation, IgrButton, - IgrButtonModule, IgrCard, IgrCardActions, IgrCardContent, IgrCardHeader, IgrCardMedia, - IgrCardModule, IgrCarousel, - IgrCarouselModule, IgrCarouselSlide, IgrCheckboxChangeEventArgs, IgrSelect, IgrSelectItem, - IgrSelectModule, IgrSwitch, - IgrSwitchModule, } from "igniteui-react"; import "igniteui-webcomponents/themes/light/bootstrap.css"; import "./CarouselAnimations.css"; import "./index.css"; -IgrButtonModule.register(); -IgrCarouselModule.register(); -IgrSelectModule.register(); -IgrSwitchModule.register(); -IgrCardModule.register(); - export default function CarouselComponents() { - const carouselRef = useRef(null); - function onSelectChange(e: CustomEvent) { - const value = e.detail.value as CarouselAnimationType; - carouselRef.current.animationType = value; + const [animationType, setAnimationType] = useState('slide'); + const [isCarouselVertical, setIsCarouselVertical] = useState(false); + + const onSelectChange = (e: CustomEvent) => { + const value = e.detail.value as HorizontalTransitionAnimation; + setAnimationType(value); } - function onSwitchChange(e: IgrCheckboxChangeEventArgs) { - carouselRef.current.vertical = e.detail.checked; + const onSwitchChange = (e: IgrCheckboxChangeEventArgs) => { + setIsCarouselVertical(e.detail.checked); } return ( @@ -48,14 +39,14 @@ export default function CarouselComponents() {
Animation type - - Slide + + Slide - - Fade + + Fade - - None + + None
@@ -64,108 +55,105 @@ export default function CarouselComponents() { onChange={onSwitchChange} labelPosition="before" > - Vertical alignment + Vertical alignment
- - -
+ + +
- -

+ +

Ignite UI for Angular

- -

+ +

30+ Material-based Angular components to code speedy web apps faster.

- + - + - Visit Page + Visit Page

- -
+ +
- -

+ +

Ignite UI for Javascript

- -

+ +

A complete JavaScript UI library empowering you to build data-rich responsive web apps.

- + - + - Visit Page + Visit Page

- -
+ +
- -

+ +

Ultimate UI for ASP.NET

- -

+ +

Build full-featured business apps with the most versatile set of ASP.NET AJAX UI controls.

- + - + - Visit Page + Visit Page @@ -176,6 +164,6 @@ export default function CarouselComponents() { ); } -// rendering above class to the React DOM +// rendering above component to the React DOM const root = ReactDOM.createRoot(document.getElementById("root")); root.render(); diff --git a/samples/layouts/carousel/components/src/index.tsx b/samples/layouts/carousel/components/src/index.tsx index 9c63b79794..b7455496d5 100644 --- a/samples/layouts/carousel/components/src/index.tsx +++ b/samples/layouts/carousel/components/src/index.tsx @@ -2,25 +2,16 @@ import React, { useEffect } from "react"; import ReactDOM from "react-dom/client"; import { IgrButton, - IgrButtonModule, IgrCarousel, - IgrCarouselModule, IgrCarouselSlide, IgrIcon, - IgrIconModule, IgrInput, - IgrInputModule, registerIconFromText, } from "igniteui-react"; import "igniteui-webcomponents/themes/light/bootstrap.css"; import "./CarouselComponents.css"; import "./index.css"; -IgrButtonModule.register(); -IgrCarouselModule.register(); -IgrIconModule.register(); -IgrInputModule.register(); - const icons = [ { name: "person", @@ -49,31 +40,31 @@ export default function CarouselComponents() { return (
- -
+ +
- + - + - Sign In + Sign In
- -
+ +
- + - Search + Search
@@ -83,6 +74,6 @@ export default function CarouselComponents() { ); } -// rendering above class to the React DOM +// rendering above component to the React DOM const root = ReactDOM.createRoot(document.getElementById("root")); root.render(); diff --git a/samples/layouts/carousel/overview/src/index.tsx b/samples/layouts/carousel/overview/src/index.tsx index 7b62deadbd..6674bfc595 100644 --- a/samples/layouts/carousel/overview/src/index.tsx +++ b/samples/layouts/carousel/overview/src/index.tsx @@ -2,31 +2,29 @@ import React from "react"; import ReactDOM from "react-dom/client"; import { IgrCarousel, - IgrCarouselModule, IgrCarouselSlide, } from "igniteui-react"; import "igniteui-webcomponents/themes/light/bootstrap.css"; import "./CarouselOverview.css"; import "./index.css"; -IgrCarouselModule.register(); export default function CarouselOverview() { return (
- -
+ +
- -
+ +
- -
+ +
@@ -35,6 +33,6 @@ export default function CarouselOverview() { ); } -// rendering above class to the React DOM +// rendering above component to the React DOM const root = ReactDOM.createRoot(document.getElementById("root")); root.render(); diff --git a/samples/layouts/carousel/thumbnail/src/index.tsx b/samples/layouts/carousel/thumbnail/src/index.tsx index fabd10a437..1304acdaf1 100644 --- a/samples/layouts/carousel/thumbnail/src/index.tsx +++ b/samples/layouts/carousel/thumbnail/src/index.tsx @@ -3,14 +3,12 @@ import ReactDOM from "react-dom/client"; import { IgrCarousel, IgrCarouselIndicator, - IgrCarouselModule, IgrCarouselSlide, } from "igniteui-react"; import "igniteui-webcomponents/themes/light/bootstrap.css"; import "./CarouselThumbnail.css"; import "./index.css"; -IgrCarouselModule.register(); export default function CarouselThumbnail() { const images = [ @@ -48,12 +46,11 @@ export default function CarouselThumbnail() { {images.map((image, index) => { return ( - - {image.alt} + + {image.alt} - + {`${image.alt} {`${image.alt}); diff --git a/samples/layouts/expansion-panel/component-customization/src/index.tsx b/samples/layouts/expansion-panel/component-customization/src/index.tsx index 44dea73092..f502cae493 100644 --- a/samples/layouts/expansion-panel/component-customization/src/index.tsx +++ b/samples/layouts/expansion-panel/component-customization/src/index.tsx @@ -2,12 +2,9 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; import './ExpansionPanelCustomization.css'; -import { IgrExpansionPanel, IgrButton, IgrButtonModule, IgrExpansionPanelModule } from 'igniteui-react'; +import { IgrExpansionPanel, IgrButton } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrButtonModule.register(); -IgrExpansionPanelModule.register(); - export default class ExpansionPanelComponentCustomization extends React.Component { constructor(props: any) { @@ -22,16 +19,16 @@ export default class ExpansionPanelComponentCustomization extends React.Componen return (
-

Golden Retriever

-

Medium-large gun dog

-
{this.state.expansionText}
- - The Golden Retriever is a medium-large gun dog that retrieves shot waterfowl, such as ducks +

Golden Retriever

+

Medium-large gun dog

+
{this.state.expansionText}
+ + The Golden Retriever is a medium-large gun dog that retrieves shot waterfowl, such as ducks and upland game birds, during hunting and shooting parties.[3] The name retriever refers to the breeds ability to retrieve shot game undamaged due to their soft mouth. Golden retrievers have an instinctive love of water, and are easy to train to basic or advanced obedience standards. - - Read more + + Read more
diff --git a/samples/layouts/expansion-panel/properties-and-events/src/index.tsx b/samples/layouts/expansion-panel/properties-and-events/src/index.tsx index 26d1530b4e..e2088cd40c 100644 --- a/samples/layouts/expansion-panel/properties-and-events/src/index.tsx +++ b/samples/layouts/expansion-panel/properties-and-events/src/index.tsx @@ -2,11 +2,9 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; import './ExpansionPanelPropsAndEvents.css'; -import { IgrExpansionPanel, IgrExpansionPanelModule } from 'igniteui-react'; +import { IgrExpansionPanel } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrExpansionPanelModule.register(); - export default class ExpansionPanelPropertiesAndEvents extends React.Component { constructor(props: any) { @@ -21,10 +19,10 @@ export default class ExpansionPanelPropertiesAndEvents extends React.Component -

Golden Retriever

-

Medium-large gun dog

-
{this.state.expansionText}
- The Golden Retriever is a medium-large gun dog that retrieves shot waterfowl, such as ducks +

Golden Retriever

+

Medium-large gun dog

+
{this.state.expansionText}
+ The Golden Retriever is a medium-large gun dog that retrieves shot waterfowl, such as ducks and upland game birds, during hunting and shooting parties.[3] The name retriever refers to the breeds ability to retrieve shot game undamaged due to their soft mouth. Golden retrievers have an instinctive love of water, and are easy to train to basic or advanced obedience standards. diff --git a/samples/layouts/expansion-panel/styling/src/index.tsx b/samples/layouts/expansion-panel/styling/src/index.tsx index e43830feaf..f5d96a9f18 100644 --- a/samples/layouts/expansion-panel/styling/src/index.tsx +++ b/samples/layouts/expansion-panel/styling/src/index.tsx @@ -2,12 +2,9 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; import './ExpansionPanelStyling.css'; -import { IgrExpansionPanel, IgrButton, IgrButtonModule, IgrExpansionPanelModule } from 'igniteui-react'; +import { IgrExpansionPanel, IgrButton } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrButtonModule.register(); -IgrExpansionPanelModule.register(); - export default class ExpansionPanelStyling extends React.Component { constructor(props: any) { @@ -18,15 +15,15 @@ export default class ExpansionPanelStyling extends React.Component { return (
-

Golden Retriever

-

Medium-large gun dog

- - The Golden Retriever is a medium-large gun dog that retrieves shot waterfowl, such as ducks +

Golden Retriever

+

Medium-large gun dog

+ + The Golden Retriever is a medium-large gun dog that retrieves shot waterfowl, such as ducks and upland game birds, during hunting and shooting parties.[3] The name retriever refers to the breeds ability to retrieve shot game undamaged due to their soft mouth. Golden retrievers have an instinctive love of water, and are easy to train to basic or advanced obedience standards. - - Read more + + Read more
diff --git a/samples/layouts/expansion-panel/usage/src/index.tsx b/samples/layouts/expansion-panel/usage/src/index.tsx index 28729d2d30..a27c1c5734 100644 --- a/samples/layouts/expansion-panel/usage/src/index.tsx +++ b/samples/layouts/expansion-panel/usage/src/index.tsx @@ -2,11 +2,9 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; import './ExpansionPanelUsage.css'; -import { IgrExpansionPanel, IgrExpansionPanelModule } from 'igniteui-react'; +import { IgrExpansionPanel } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrExpansionPanelModule.register(); - export default class ExpansionPanelUsage extends React.Component { constructor(props: any) { @@ -17,9 +15,9 @@ export default class ExpansionPanelUsage extends React.Component { return (
-

Golden Retriever

-

Medium-large gun dog

- The Golden Retriever is a medium-large gun dog that retrieves shot waterfowl, such as ducks +

Golden Retriever

+

Medium-large gun dog

+ The Golden Retriever is a medium-large gun dog that retrieves shot waterfowl, such as ducks and upland game birds, during hunting and shooting parties.[3] The name retriever refers to the breeds ability to retrieve shot game undamaged due to their soft mouth. Golden retrievers have an instinctive love of water, and are easy to train to basic or advanced obedience standards. diff --git a/samples/layouts/icon/sizing/src/index.tsx b/samples/layouts/icon/sizing/src/index.tsx index 4a7d648344..3e63dc1d8d 100644 --- a/samples/layouts/icon/sizing/src/index.tsx +++ b/samples/layouts/icon/sizing/src/index.tsx @@ -2,10 +2,11 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; import './IconSizing.css'; -import { IgrIcon, IgrIconModule, registerIconFromText } from 'igniteui-react'; +import { IgrIcon, registerIconFromText } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrIconModule.register(); +const buildIcon = + ''; const buildIcon = ''; diff --git a/samples/layouts/icon/styling/src/IconStyling.css b/samples/layouts/icon/styling/src/IconStyling.css index 949402bcbc..73b24e3db7 100644 --- a/samples/layouts/icon/styling/src/IconStyling.css +++ b/samples/layouts/icon/styling/src/IconStyling.css @@ -7,5 +7,5 @@ igc-icon { --size: 48px; - color: olive; + color: var(--ig-primary-500); } \ No newline at end of file diff --git a/samples/layouts/icon/styling/src/index.tsx b/samples/layouts/icon/styling/src/index.tsx index 84240dc4b0..8b22234c79 100644 --- a/samples/layouts/icon/styling/src/index.tsx +++ b/samples/layouts/icon/styling/src/index.tsx @@ -2,10 +2,11 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; import './IconStyling.css'; -import { IgrIcon, IgrIconModule, registerIconFromText } from 'igniteui-react'; +import { IgrIcon, registerIconFromText } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrIconModule.register(); +const searchIcon = + ''; const searchIcon = ''; diff --git a/samples/layouts/stepper/animations/src/index.tsx b/samples/layouts/stepper/animations/src/index.tsx index 0eaddb32f1..0ab51421c4 100644 --- a/samples/layouts/stepper/animations/src/index.tsx +++ b/samples/layouts/stepper/animations/src/index.tsx @@ -1,118 +1,206 @@ -import React from 'react'; -import ReactDOM from 'react-dom/client'; -import './index.css'; +import React, { useRef, useState } from "react"; +import ReactDOM from "react-dom/client"; +import "./index.css"; import { - IgrStepper, IgrStep, IgrStepperModule, IgrRadio, IgrRadioGroup, IgrRadioModule, IgrRadioGroupModule, - IgrButton, IgrButtonModule, IgrInput, IgrInputModule, IgrSelect, IgrSelectItem, IgrSelectModule, - IgrSelectItemComponentEventArgs, IgrComponentDataValueChangedEventArgs, - IgrComponentValueChangedEventArgs -} from 'igniteui-react'; -import 'igniteui-webcomponents/themes/light/bootstrap.css'; + IgrStepper, + IgrStep, + IgrRadio, + IgrRadioGroup, + IgrButton, + IgrInput, + IgrSelect, + IgrSelectItem, + IgrSelectItemComponentEventArgs, + IgrComponentValueChangedEventArgs, + StepperOrientation, + HorizontalTransitionAnimation, + StepperVerticalAnimation, +} from "igniteui-react"; +import "igniteui-webcomponents/themes/light/bootstrap.css"; -IgrStepperModule.register(); -IgrInputModule.register(); -IgrRadioModule.register(); -IgrRadioGroupModule.register(); -IgrButtonModule.register(); -IgrSelectModule.register(); +export default function StepperAnimations() { -export default class StepperAnimations extends React.Component { - private stepperRef = React.createRef(); - constructor(props: any) { - super(props); - this.state = { orientation: 'horizontal', horizontalAnimation: 'slide', verticalAnimation: 'grow', animationDuration: "320" }; - this.orientationChange = this.orientationChange.bind(this); - this.horizontalAnimationChange = this.horizontalAnimationChange.bind(this); - this.verticalAnimationChange = this.verticalAnimationChange.bind(this); - this.animationDurationChange = this.animationDurationChange.bind(this); + const stepperRef = useRef(null); + const [orientation, setOrientation] = useState("horizontal"); + const [horizontalAnimation, setHorizontalAnimation] = useState("slide"); + const [verticalAnimation, setVerticalAnimation] = useState("grow"); + const [animationDuration, setAnimationDuration] = useState("320"); + + + const orientationChange = (e: IgrSelectItemComponentEventArgs) => { + const selectedValue = e.detail.value as StepperOrientation; + setOrientation(selectedValue); } + + const horizontalAnimationChange = (e: IgrSelectItemComponentEventArgs) => { + const selectedValue = e.detail.value as HorizontalTransitionAnimation; + setHorizontalAnimation(selectedValue); - public render(): JSX.Element { - return ( -
-
- - Horizontal - Vertical - - - Grow - Fade - None - - - Slide - Fade - None - - - ms - -
+ } - - - Personal Info -
- - + const verticalAnimationChange = (e: IgrSelectItemComponentEventArgs) => { + const selectedValue = e.detail.value as StepperVerticalAnimation; + setVerticalAnimation(selectedValue); + } - { this.stepperRef.current.next(); }}>NEXT -
-
- - Delivery address -
- - + const animationDurationChange = (e: IgrComponentValueChangedEventArgs) => { + const animationDuration = e.detail; + setAnimationDuration(animationDuration); + } - { this.stepperRef.current.prev(); }}>PREVIOUS - { this.stepperRef.current.next(); }}>NEXT -
-
- - Payment - - PayPal (n@mail.com; 18/02/2021) - Visa (**** **** **** 1234; 12/23) - MasterCard (**** **** **** 5678; 12/24) - + return ( +
+
+ + + Horizontal + + + Vertical + + + + + Grow + + + Fade + + + None + + + + + Slide + + + Fade + + + None + + + + ms + +
- { this.stepperRef.current.prev(); }}>PREVIOUS - { this.stepperRef.current.next(); }}>SUBMIT - - - Delivery status -

Your order is on its way. Expect delivery on 25th September 2021. Delivery address: San Jose, CA 94243.

+ + + Personal Info +
+ + - { this.stepperRef.current.prev(); }}>PREVIOUS - { this.stepperRef.current.reset(); }}>RESET - - -
- ); - } + { + stepperRef.current.next(); + }} + > + NEXT + + +
+ + Delivery address +
+ + - public orientationChange(e: IgrSelectItemComponentEventArgs){ - const selectedValue = e.detail.value; - this.setState({orientation: selectedValue}); - } - public horizontalAnimationChange(e: IgrSelectItemComponentEventArgs){ - const selectedValue = e.detail.value; - this.setState({horizontalAnimation: selectedValue}); - } - public verticalAnimationChange(e: IgrSelectItemComponentEventArgs){ - const selectedValue = e.detail.value; - this.setState({verticalAnimation: selectedValue}); - } - public animationDurationChange(e: IgrComponentValueChangedEventArgs){ - const animationDuration = e.detail; - this.setState({animationDuration: animationDuration}); - } + { + stepperRef.current.prev(); + }} + > + PREVIOUS + + { + stepperRef.current.next(); + }} + > + NEXT + +
+
+ + Payment + + + PayPal (n@mail.com; 18/02/2021) + + + Visa (**** **** **** 1234; 12/23) + + + MasterCard (**** **** **** 5678; 12/24) + + + + { + stepperRef.current.prev(); + }} + > + PREVIOUS + + { + stepperRef.current.next(); + }} + > + SUBMIT + + + + Delivery status +

+ Your order is on its way. Expect delivery on 25th September 2021. + Delivery address: San Jose, CA 94243. +

+ + { + stepperRef.current.prev(); + }} + > + PREVIOUS + + { + stepperRef.current.reset(); + }} + > + RESET + +
+
+
+ ); } -// rendering above class to the React DOM -const root = ReactDOM.createRoot(document.getElementById('root')); +// rendering above component to the React DOM +const root = ReactDOM.createRoot(document.getElementById("root")); root.render(); diff --git a/samples/layouts/stepper/linear/src/index.tsx b/samples/layouts/stepper/linear/src/index.tsx index dccdad7e7a..43fb7ba84a 100644 --- a/samples/layouts/stepper/linear/src/index.tsx +++ b/samples/layouts/stepper/linear/src/index.tsx @@ -1,141 +1,267 @@ -import React from 'react'; -import ReactDOM from 'react-dom/client'; -import './index.css'; +import React from "react"; +import ReactDOM from "react-dom/client"; +import "./index.css"; import { - IgrStepper, IgrStep, IgrStepperModule, IgrRadio, IgrRadioGroup, IgrRadioModule, IgrRadioGroupModule, - IgrButton, IgrButtonModule, IgrSwitch, IgrSwitchModule, IgrCheckboxBase, IgrCheckboxChangeEventArgs, IgrComponentValueChangedEventArgs, - IgrInput, IgrInputModule -} from 'igniteui-react'; -import 'igniteui-webcomponents/themes/light/bootstrap.css'; - -IgrStepperModule.register(); -IgrSwitchModule.register(); -IgrInputModule.register(); -IgrRadioModule.register(); -IgrRadioGroupModule.register(); -IgrButtonModule.register(); + IgrStepper, + IgrStep, + IgrRadio, + IgrRadioGroup, + IgrButton, + IgrSwitch, + IgrCheckboxChangeEventArgs, + IgrComponentValueChangedEventArgs, + IgrInput, +} from "igniteui-react"; +import "igniteui-webcomponents/themes/light/bootstrap.css"; export default class LinearStepper extends React.Component { - private stepperRef = React.createRef(); - private InfoForm = React.createRef(); - private AddressForm = React.createRef(); - private activeStepIndex = 0; + private stepperRef = React.createRef(); + private InfoForm = React.createRef(); + private AddressForm = React.createRef(); + private activeStepIndex = 0; - constructor(props: any) { - super(props); - this.state = { linear: false, firstStepInvalid: true, secondStepInvalid: true }; - this.OnSwitchChange = this.OnSwitchChange.bind(this); - } + constructor(props: any) { + super(props); + this.state = { + linear: false, + firstStepInvalid: true, + secondStepInvalid: true, + }; + this.onSwitchChange = this.onSwitchChange.bind(this); + } - componentDidMount() { - this.InfoForm.current.addEventListener("igcInput", this.onInput.bind(this)); - this.AddressForm.current.addEventListener("igcInput", this.onInput.bind(this)); - } + componentDidMount() { + this.InfoForm.current.addEventListener("igcInput", this.onInput.bind(this)); + this.AddressForm.current.addEventListener( + "igcInput", + this.onInput.bind(this) + ); + } - public render(): JSX.Element { - return ( -
- Linear + public render(): JSX.Element { + return ( +
+ + Linear + - - - Personal Info -
- - + + + + Personal Info + + + + - { this.stepperRef.current.next(); }}>NEXT - - - - Delivery address -
- - - { this.stepperRef.current.prev(); }}>PREVIOUS - { this.stepperRef.current.next(); }}>NEXT -
-
- - Billing address - (optional) -
- - - { this.stepperRef.current.prev(); }}>PREVIOUS - { this.stepperRef.current.next(); }}>NEXT -
-
- - Payment - - PayPal (n@mail.com; 18/02/2021) - Visa (**** **** **** 1234; 12/23) - MasterCard (**** **** **** 5678; 12/24) - - { this.stepperRef.current.prev(); }}>PREVIOUS - { this.stepperRef.current.next(); }}>SUBMIT - - - Delivery status -

Your order is on its way. Expect delivery on 25th September 2021. Delivery address: San Jose, CA 94243.

- { this.stepperRef.current.prev(); }}>PREVIOUS - { this.stepperRef.current.reset(); }}>RESET -
-
-
- ); - } + { + this.stepperRef.current.next(); + }} + > + NEXT + + + + + + Delivery address + +
+ + + { + this.stepperRef.current.prev(); + }} + > + PREVIOUS + + { + this.stepperRef.current.next(); + }} + > + NEXT + +
+
+ + + Billing address + + + (optional) + +
+ + + { + this.stepperRef.current.prev(); + }} + > + PREVIOUS + + { + this.stepperRef.current.next(); + }} + > + NEXT + +
+
+ + + Payment + + + + PayPal (n@mail.com; 18/02/2021) + + + Visa (**** **** **** 1234; 12/23) + + + + MasterCard (**** **** **** 5678; 12/24) + + + + { + this.stepperRef.current.prev(); + }} + > + PREVIOUS + + { + this.stepperRef.current.next(); + }} + > + SUBMIT + + + + + Delivery status + +

+ Your order is on its way. Expect delivery on 25th September 2021. + Delivery address: San Jose, CA 94243. +

+ { + this.stepperRef.current.prev(); + }} + > + PREVIOUS + + { + this.stepperRef.current.reset(); + }} + > + RESET + +
+ +
+ ); + } - public OnSwitchChange(e: IgrCheckboxChangeEventArgs) { - this.setState({ linear: e.detail.checked }); - if(e.detail.checked){ - this.checkActiveStepValidity(); - } + public onSwitchChange(e: IgrCheckboxChangeEventArgs) { + this.setState({ linear: e.detail.checked }); + if (e.detail.checked) { + this.checkActiveStepValidity(); } + } - public onInput(s: IgrInput, e: IgrComponentValueChangedEventArgs) { - if(!this.state.linear) return; + public onInput(s: IgrInput, e: IgrComponentValueChangedEventArgs) { + if (!this.state.linear) return; - this.checkActiveStepValidity(); - } + this.checkActiveStepValidity(); + } - private checkActiveStepValidity(){ - const activeStep = this.activeStep; - if (activeStep && this.activeStepIndex === 0) { - const isInvalidForm = this.checkFormValidity(this.InfoForm); - this.setState({firstStepInvalid: isInvalidForm}); - } - if (activeStep && this.activeStepIndex === 1) { - const isInvalidForm = this.checkFormValidity(this.AddressForm); - this.setState({ secondStepInvalid: isInvalidForm }); - } + private checkActiveStepValidity() { + const activeStep = this.activeStep; + if (activeStep && this.activeStepIndex === 0) { + const isInvalidForm = this.checkFormValidity(this.InfoForm); + this.setState({ firstStepInvalid: isInvalidForm }); } + if (activeStep && this.activeStepIndex === 1) { + const isInvalidForm = this.checkFormValidity(this.AddressForm); + this.setState({ secondStepInvalid: isInvalidForm }); + } + } - private checkFormValidity(form: any){ - let isInvalidForm = false; - for (const element of form.current.children) { - if(element.tagName.toLowerCase() === 'igc-input' && element.value === ""){ - const oldInvalid = element.invalid; - const isElementInvalid = !element.checkValidity(); - element.invalid = oldInvalid; - if(isElementInvalid){ - isInvalidForm = true; - break; - } - } + private checkFormValidity(form: any) { + let isInvalidForm = false; + for (const element of form.current.children) { + if ( + element.tagName.toLowerCase() === "igc-input" && + element.value === "" + ) { + const oldInvalid = element.invalid; + const isElementInvalid = !element.checkValidity(); + element.invalid = oldInvalid; + if (isElementInvalid) { + isInvalidForm = true; + break; } - return isInvalidForm; + } } + return isInvalidForm; + } - private get activeStep(): IgrStep | undefined { - return this.stepperRef.current.steps.find((step: IgrStep, index: number) => { - this.activeStepIndex = index; - return step.active; - }); - } + private get activeStep(): IgrStep | undefined { + return this.stepperRef.current.steps.find( + (step: IgrStep, index: number) => { + this.activeStepIndex = index; + return step.active; + } + ); + } } // rendering above class to the React DOM -const root = ReactDOM.createRoot(document.getElementById('root')); +const root = ReactDOM.createRoot(document.getElementById("root")); root.render(); diff --git a/samples/layouts/stepper/steptypes/src/index.tsx b/samples/layouts/stepper/steptypes/src/index.tsx index 1ffcca0383..2e5cc6ee75 100644 --- a/samples/layouts/stepper/steptypes/src/index.tsx +++ b/samples/layouts/stepper/steptypes/src/index.tsx @@ -1,53 +1,45 @@ -import React from 'react'; +import React, { useState } from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrStepper, IgrStep, IgrStepperModule, StepperStepType, IgrRadio, IgrRadioGroup, IgrRadioChangeEventArgs, IgrRadioModule, IgrRadioGroupModule } from 'igniteui-react'; +import { IgrStepper, IgrStep, IgrRadio, IgrRadioGroup, StepperStepType, IgrRadioChangeEventArgs } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrStepperModule.register(); -IgrRadioModule.register(); -IgrRadioGroupModule.register(); -export default class StepperStepTypes extends React.Component { - constructor(props: any) { - super(props); - this.state = { stepType: "full" }; - this.onStepTypeChange = this.onStepTypeChange.bind(this); - } +export default function StepperStepTypes() { - public render(): JSX.Element { - return ( -
- -
- - Indicator - Title - Full - -
+ const [stepType, setStepType] = useState("full"); - - - Pricing Plan - - - Car Details - - - Payment - - -
- ); + const onStepTypeChange = (e: IgrRadioChangeEventArgs) => { + const newStepType = e.detail.value as StepperStepType; + setStepType(newStepType); } - public onStepTypeChange(e: IgrRadioChangeEventArgs) { - const newStepType = e.detail.value; - this.setState({ stepType: newStepType }); - } + + return ( +
+ +
+ + Indicator + Title + Full + +
+ + + Pricing Plan + + + Car Details + + + Payment + + +
+ ); } -// rendering above class to the React DOM +// rendering above component to the React DOM const root = ReactDOM.createRoot(document.getElementById('root')); root.render(); diff --git a/samples/layouts/stepper/styling/.eslintrc.js b/samples/layouts/stepper/styling/.eslintrc.js new file mode 100644 index 0000000000..b45160a9ee --- /dev/null +++ b/samples/layouts/stepper/styling/.eslintrc.js @@ -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" + } + } + ] + }; \ No newline at end of file diff --git a/samples/layouts/stepper/styling/README.md b/samples/layouts/stepper/styling/README.md new file mode 100644 index 0000000000..bbf0b6fa20 --- /dev/null +++ b/samples/layouts/stepper/styling/README.md @@ -0,0 +1,56 @@ + + + +This folder contains implementation of React application with example of Animations feature using [Stepper](https://www.infragistics.com/products/ignite-ui-react/react/components/general-getting-started.html) component. + + + + +
+ View Docs + + + View Code + + + Run Sample + + + Run Sample + + + + +## 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/layouts/stepper/animations +``` + +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). diff --git a/samples/layouts/stepper/styling/package.json b/samples/layouts/stepper/styling/package.json new file mode 100644 index 0000000000..050ab21b29 --- /dev/null +++ b/samples/layouts/stepper/styling/package.json @@ -0,0 +1,38 @@ +{ + "name": "react-stepper-styling", + "description": "This project provides example of Stepper Styling using Infragistics React components", + "author": "Infragistics", + "homepage": ".", + "version": "1.4.0", + "private": true, + "scripts": { + "start": "set PORT=4200 && react-scripts --max_old_space_size=10240 start", + "build": "react-scripts --max_old_space_size=10240 build ", + "test": "react-scripts test --env=jsdom", + "eject": "react-scripts eject" + }, + "dependencies": { + "igniteui-dockmanager": "1.16.1", + "igniteui-react": "19.0.2", + "igniteui-react-core": "19.0.0-alpha.1", + "react": "^18.2.0", + "react-dom": "^18.2.0", + "react-scripts": "^5.0.1", + "tslib": "^2.4.0" + }, + "devDependencies": { + "@types/jest": "^29.2.0", + "@types/node": "^18.11.7", + "@types/react": "^18.0.24", + "@types/react-dom": "^18.0.8", + "react-app-rewired": "^2.2.1", + "typescript": "^4.8.4", + "worker-loader": "^3.0.8" + }, + "browserslist": [ + ">0.2%", + "not dead", + "not ie <= 11", + "not op_mini all" + ] +} diff --git a/samples/layouts/stepper/styling/public/index.html b/samples/layouts/stepper/styling/public/index.html new file mode 100644 index 0000000000..662d6963c9 --- /dev/null +++ b/samples/layouts/stepper/styling/public/index.html @@ -0,0 +1,10 @@ + + + + StepperAnimations + + + +
+ + \ No newline at end of file diff --git a/samples/layouts/stepper/styling/sandbox.config.json b/samples/layouts/stepper/styling/sandbox.config.json new file mode 100644 index 0000000000..00acba0c10 --- /dev/null +++ b/samples/layouts/stepper/styling/sandbox.config.json @@ -0,0 +1,5 @@ +{ + "infiniteLoopProtection": false, + "hardReloadOnChange": false, + "view": "browser" +} \ No newline at end of file diff --git a/samples/layouts/stepper/styling/src/index.css b/samples/layouts/stepper/styling/src/index.css new file mode 100644 index 0000000000..a47c5463a7 --- /dev/null +++ b/samples/layouts/stepper/styling/src/index.css @@ -0,0 +1,62 @@ +/* shared styles are loaded from: */ +/* https://static.infragistics.com/xplatform/css/samples */ + +.settings { + display: grid; + grid-template-columns: repeat(4, 1fr); + gap: 1.125rem; + background: hsl(var(--ig-gray-100)); + padding: 1.125rem; + border: 1px solid hsl(var(--ig-gray-300)); + border-radius: .25rem; + margin-bottom: 2rem; +} + +:root { + --color-teal: rgba(77, 182, 172, 1); + --color-dark-navy: rgba(26, 35, 126, 1); + --color-aqua-gray: rgba(208, 236, 236, 1); + --color-white: rgba(255, 255, 255, 1); + + --color-teal-hover: rgba(26, 35, 126, 1); + --color-teal-shadow: rgba(77, 182, 172, 0.5); +} + +igc-button::part(base) { + margin: 1rem 0.5rem 0 0; + background-color: var(--color-teal); + color: var(--color-white); + font-weight: 600; + transition: background-color 0.25s ease, transform 0.1s ease; +} + +igc-button:hover::part(base) { + background-color: var(--color-dark-navy); +} + +igc-button:active::part(base) { + transform: scale(0.96); +} + +igc-step::part(title) { + color: var(--color-dark-navy); + font-variant: small-caps; + font-weight: bold; +} + +igc-step::part(indicator) { + border-radius: 12px 6px 12px 6px; + background-color: var(--color-aqua-gray); + color: var(--color-dark-navy); + transition: all 0.2s ease; +} + +igc-step[active]::part(indicator) { + background-color: var(--color-teal); + box-shadow: 0 2px 8px var(--color-teal-shadow); + transform: scale(1.04); +} + +igc-step[active]:active::part(indicator) { + transform: scale(1.08); +} \ No newline at end of file diff --git a/samples/layouts/stepper/styling/src/index.tsx b/samples/layouts/stepper/styling/src/index.tsx new file mode 100644 index 0000000000..522bb199b9 --- /dev/null +++ b/samples/layouts/stepper/styling/src/index.tsx @@ -0,0 +1,231 @@ +import React, { useEffect, useRef, useState } from "react"; +import ReactDOM from "react-dom/client"; +import "./index.css"; +import { + IgrStepper, + IgrStep, + IgrRadio, + IgrRadioGroup, + IgrButton, + IgrInput, + IgrSelect, + IgrSelectItem, + IgrSelectItemComponentEventArgs, + IgrComponentValueChangedEventArgs, + StepperOrientation, + HorizontalTransitionAnimation, + StepperVerticalAnimation, + IgrIcon, + registerIconFromText, +} from "igniteui-react"; +import "igniteui-webcomponents/themes/light/bootstrap.css"; + +const personalInfoIcon = + ''; +const addressIcon = + ''; +const paymentIcon = + ''; +const deliveryStatusIcon = + ''; + +export default function StepperStyling() { + const stepperRef = useRef(null); + const [orientation, setOrientation] = + useState("horizontal"); + const [horizontalAnimation, setHorizontalAnimation] = + useState("slide"); + const [verticalAnimation, setVerticalAnimation] = + useState("grow"); + const [animationDuration, setAnimationDuration] = useState("320"); + + useEffect(() => { + registerIconFromText("personal", personalInfoIcon, "material"); + registerIconFromText("address", addressIcon, "material"); + registerIconFromText("payment", paymentIcon, "material"); + registerIconFromText("delivery", deliveryStatusIcon, "material"); + }, []); + + const orientationChange = (e: IgrSelectItemComponentEventArgs) => { + const selectedValue = e.detail.value as StepperOrientation; + setOrientation(selectedValue); + }; + + const horizontalAnimationChange = (e: IgrSelectItemComponentEventArgs) => { + const selectedValue = e.detail.value as HorizontalTransitionAnimation; + setHorizontalAnimation(selectedValue); + }; + + const verticalAnimationChange = (e: IgrSelectItemComponentEventArgs) => { + const selectedValue = e.detail.value as StepperVerticalAnimation; + setVerticalAnimation(selectedValue); + }; + + const animationDurationChange = (e: IgrComponentValueChangedEventArgs) => { + const animationDuration = e.detail; + setAnimationDuration(animationDuration); + }; + + return ( +
+
+ + + Horizontal + + + Vertical + + + + + Grow + + + Fade + + + None + + + + + Slide + + + Fade + + + None + + + + ms + +
+ + + + +

Personal Info

+
+ + + + { + stepperRef.current.next(); + }} + > + NEXT + +
+
+ + + + Delivery address +
+ + + + { + stepperRef.current.prev(); + }} + > + PREVIOUS + + { + stepperRef.current.next(); + }} + > + NEXT + +
+
+ + + Payment + + + PayPal (n@mail.com; 18/02/2021) + + + Visa (**** **** **** 1234; 12/23) + + + MasterCard (**** **** **** 5678; 12/24) + + + + { + stepperRef.current.prev(); + }} + > + PREVIOUS + + { + stepperRef.current.next(); + }} + > + SUBMIT + + + + + Delivery status +

+ Your order is on its way. Expect delivery on 25th September 2021. + Delivery address: San Jose, CA 94243. +

+ + { + stepperRef.current.prev(); + }} + > + PREVIOUS + + { + stepperRef.current.reset(); + }} + > + RESET + +
+
+
+ ); +} + +// rendering above component to the React DOM +const root = ReactDOM.createRoot(document.getElementById("root")); +root.render(); diff --git a/samples/layouts/stepper/styling/src/react-app-env.d.ts b/samples/layouts/stepper/styling/src/react-app-env.d.ts new file mode 100644 index 0000000000..6431bc5fc6 --- /dev/null +++ b/samples/layouts/stepper/styling/src/react-app-env.d.ts @@ -0,0 +1 @@ +/// diff --git a/samples/layouts/stepper/styling/tsconfig.json b/samples/layouts/stepper/styling/tsconfig.json new file mode 100644 index 0000000000..e7db8a94f5 --- /dev/null +++ b/samples/layouts/stepper/styling/tsconfig.json @@ -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" + ] +} diff --git a/samples/menus/nav-bar/overview/src/index.tsx b/samples/menus/nav-bar/overview/src/index.tsx index 94c3aebf37..61c674a200 100644 --- a/samples/menus/nav-bar/overview/src/index.tsx +++ b/samples/menus/nav-bar/overview/src/index.tsx @@ -1,11 +1,13 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrNavbar, IgrIcon, IgrNavbarModule, IgrIconModule, registerIconFromText } from 'igniteui-react'; +import { IgrNavbar, IgrIcon, registerIconFromText } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrNavbarModule.register(); -IgrIconModule.register(); +const homeIcon = ''; +const searchIcon = ''; +const favoriteIcon = ''; +const moreVertIcon = ''; const homeIcon = ''; const searchIcon = ''; diff --git a/samples/menus/nav-drawer/add-drawer-items/src/index.tsx b/samples/menus/nav-drawer/add-drawer-items/src/index.tsx index 58b0148e10..7c2de0f6d4 100644 --- a/samples/menus/nav-drawer/add-drawer-items/src/index.tsx +++ b/samples/menus/nav-drawer/add-drawer-items/src/index.tsx @@ -1,13 +1,12 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrNavDrawer, IgrNavDrawerHeaderItem, IgrNavDrawerItem, IgrIcon, IgrNavDrawerModule, IgrIconModule, - IgrIconButton, IgrIconButtonModule, registerIconFromText } from 'igniteui-react'; +import { IgrNavDrawer, IgrNavDrawerHeaderItem, IgrNavDrawerItem, IgrIcon, IgrIconButton, registerIconFromText } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrNavDrawerModule.register(); -IgrIconModule.register(); -IgrIconButtonModule.register(); +const searchIcon = ''; +const homeIcon = ''; +const menuIcon = ''; const searchIcon = ''; const homeIcon = ''; @@ -30,30 +29,30 @@ export default class NavDrawerAddDrawerItems extends React.Component { public render(): JSX.Element { return (
- - + +
- - Sample Drawer + + Sample Drawer - -
+ +
- Home + Home
- -
+ +
- Search + Search
@@ -61,7 +60,7 @@ export default class NavDrawerAddDrawerItems extends React.Component { ); } - public navDrawerRef(navDrawer: IgrNavDrawer){ + public navDrawerRef(navDrawer: IgrNavDrawer) { if (!navDrawer) { return; } this.navDrawer = navDrawer; } @@ -74,20 +73,20 @@ export default class NavDrawerAddDrawerItems extends React.Component { public onNavDrawerClick(e: any) { const drawerItem: any = e.target.closest('igc-nav-drawer-item') ?? - (e.target.parentElement?.closest('igc-nav-drawer-item') ?? - null) + (e.target.parentElement?.closest('igc-nav-drawer-item') ?? + null) if (!drawerItem) { return; } drawerItem.active = true; const navDrawer = drawerItem.parentElement; Array.from(navDrawer.querySelectorAll('igc-nav-drawer-item')) - .filter((item: any) => item !== drawerItem) - .forEach((child: any) => child.active = false); + .filter((item: any) => item !== drawerItem) + .forEach((child: any) => child.active = false); } } // rendering above class to the React DOM const root = ReactDOM.createRoot(document.getElementById('root')); -root.render(); +root.render(); diff --git a/samples/menus/nav-drawer/add-mini/src/index.tsx b/samples/menus/nav-drawer/add-mini/src/index.tsx index 41a4780a1a..adecc2e635 100644 --- a/samples/menus/nav-drawer/add-mini/src/index.tsx +++ b/samples/menus/nav-drawer/add-mini/src/index.tsx @@ -1,12 +1,11 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrNavDrawer, IgrNavDrawerItem, IgrIcon, IgrButton, IgrNavDrawerModule, IgrIconModule, IgrButtonModule, registerIconFromText } from 'igniteui-react'; +import { IgrNavDrawer, IgrNavDrawerItem, IgrIcon, IgrButton, registerIconFromText } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrNavDrawerModule.register(); -IgrIconModule.register(); -IgrButtonModule.register(); +const searchIcon = ''; +const homeIcon = ''; const searchIcon = ''; const homeIcon = ''; @@ -29,34 +28,34 @@ export default class NavDrawerAddMini extends React.Component {
- Toggle + Toggle
- -
+ +
- Home + Home
- -
+ +
- Search + Search
-
- -
+
+ +
- -
+ +
@@ -74,16 +73,16 @@ export default class NavDrawerAddMini extends React.Component { public onNavDrawerClick(e: any) { const drawerItem: any = e.target.closest('igc-nav-drawer-item') ?? - (e.target.parentElement?.closest('igc-nav-drawer-item') ?? - null) + (e.target.parentElement?.closest('igc-nav-drawer-item') ?? + null) if (!drawerItem) { return; } drawerItem.active = true; const navDrawer = drawerItem.parentElement; Array.from(navDrawer.querySelectorAll('igc-nav-drawer-item')) - .filter((item: any) => item !== drawerItem) - .forEach((child: any) => child.active = false); + .filter((item: any) => item !== drawerItem) + .forEach((child: any) => child.active = false); const iconName = drawerItem.querySelector('igc-icon')!.name; const icons = document.querySelectorAll(`igc-icon`); diff --git a/samples/menus/nav-drawer/add-positions-navbar/src/index.tsx b/samples/menus/nav-drawer/add-positions-navbar/src/index.tsx index 52f73f2967..b8788c2b43 100644 --- a/samples/menus/nav-drawer/add-positions-navbar/src/index.tsx +++ b/samples/menus/nav-drawer/add-positions-navbar/src/index.tsx @@ -1,14 +1,12 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrNavbar, IgrNavDrawer, IgrNavDrawerHeaderItem, IgrNavDrawerItem, IgrIcon, IgrRadioGroup, IgrRadio, IgrNavDrawerModule, IgrNavbarModule, IgrRadioGroupModule, IgrRadioModule, IgrIconModule, registerIconFromText } from 'igniteui-react'; +import { IgrNavbar, IgrNavDrawer, IgrNavDrawerHeaderItem, IgrNavDrawerItem, IgrIcon, IgrRadioGroup, IgrRadio, registerIconFromText, IgrRadioChangeEventArgs } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrNavDrawerModule.register(); -IgrNavbarModule.register(); -IgrIconModule.register(); -IgrRadioGroupModule.register(); -IgrRadioModule.register(); +const searchIcon = ''; +const homeIcon = ''; +const menuIcon = ''; const searchIcon = ''; const homeIcon = ''; @@ -38,45 +36,45 @@ export default class NavDrawerAddPositionsNavbar extends React.Component
- - Sample Drawer + + Sample Drawer - -
+ +
- Home + Home
- -
+ +
- Search + Search
- - Start + + Start - - End + + End - - Top + + Top - - Bottom + + Bottom -
+
-

{this.state.title}

+

{this.state.title}

@@ -91,16 +89,16 @@ export default class NavDrawerAddPositionsNavbar extends React.Component item !== drawerItem) - .forEach((child: any) => child.active = false); + .filter((item: any) => item !== drawerItem) + .forEach((child: any) => child.active = false); this.setState({ title: drawerItem.textContent }); } @@ -110,9 +108,9 @@ export default class NavDrawerAddPositionsNavbar extends React.Component {
- - Sample Drawer + + Sample Drawer - -
+ +
- Home + Home
- -
+ +
- Search + Search
@@ -72,16 +69,16 @@ export default class NavDrawerStyling extends React.Component { public onNavDrawerClick(e: any) { const drawerItem: any = e.target.closest('igc-nav-drawer-item') ?? - (e.target.parentElement?.closest('igc-nav-drawer-item') ?? - null) + (e.target.parentElement?.closest('igc-nav-drawer-item') ?? + null) if (!drawerItem) { return; } drawerItem.active = true; const navDrawer = drawerItem.parentElement; Array.from(navDrawer.querySelectorAll('igc-nav-drawer-item')) - .filter((item: any) => item !== drawerItem) - .forEach((child: any) => child.active = false); + .filter((item: any) => item !== drawerItem) + .forEach((child: any) => child.active = false); } public navDrawerRef(navDrawer: IgrNavDrawer) { diff --git a/samples/notifications/banner/banner-advanced-sample/src/index.tsx b/samples/notifications/banner/banner-advanced-sample/src/index.tsx index 7b878fe8ce..ee3c68aaa5 100644 --- a/samples/notifications/banner/banner-advanced-sample/src/index.tsx +++ b/samples/notifications/banner/banner-advanced-sample/src/index.tsx @@ -2,33 +2,18 @@ import React, { useEffect, useRef, useState } from 'react'; import ReactDOM from 'react-dom/client'; import { IgrBanner, - IgrBannerModule, IgrButton, - IgrButtonModule, IgrCard, - IgrCardModule, IgrIcon, - IgrIconModule, IgrNavbar, - IgrNavbarModule, IgrRipple, - IgrRippleModule, IgrToast, - IgrToastModule, registerIconFromText, - } from 'igniteui-react'; +} from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; import './BannerAdvancedSample.css'; import './index.css'; -IgrBannerModule.register(); -IgrNavbarModule.register(); -IgrIconModule.register(); -IgrCardModule.register(); -IgrButtonModule.register(); -IgrRippleModule.register(); -IgrToastModule.register(); - const wifiOnIcon = ''; const wifiOffIcon = @@ -40,6 +25,7 @@ export default function BannerAdvancedSample() { const toastRef = useRef(null); const [wifiState, setWifiState] = useState(false); + const [iconName, setIconName] = useState("signal_wifi_off"); useEffect(() => { registerIconFromText('signal_wifi_off', wifiOffIcon); @@ -47,20 +33,21 @@ export default function BannerAdvancedSample() { bannerRef.current.open = true; }, []); - function refreshBanner() { - if (!wifiState) { - iconRef.current.name = 'signal_wifi_4_bar'; + const refreshBanner = () => { + const nextWifiState = !wifiState; + setWifiState(nextWifiState); + setIconName(nextWifiState ? "signal_wifi_4_bar" : "signal_wifi_off"); + + if (nextWifiState) { bannerRef.current.hide(); } else { - iconRef.current.name = 'signal_wifi_off'; bannerRef.current.show(); } - setWifiState(current => !current); showToast(); } - function showToast() { + const showToast = () => { toastRef.current.open = false; toastRef.current.show(); } @@ -69,37 +56,37 @@ export default function BannerAdvancedSample() {
-

Gallery

- refreshBanner()}> +

Gallery

+
- - You have lost connection to the internet. This app is offline. -
- bannerRef.current.hide()}> - - Continue Offline + + You have lost connection to the internet. This app is offline. +
+ bannerRef.current.hide()}> + + Continue Offline - refreshBanner()}> - - Turn On Wifi + + + Turn On Wifi
-
- +
+
-
- +
+
- {`Wifi is now ${wifiState ? 'on' : 'off'}`} + {`Wifi is now ${wifiState ? 'on' : 'off'}`}
@@ -108,4 +95,4 @@ export default function BannerAdvancedSample() { // rendering above class to the React DOM const root = ReactDOM.createRoot(document.getElementById('root')); -root.render(); +root.render(); diff --git a/samples/notifications/banner/banner-sample-1/src/index.tsx b/samples/notifications/banner/banner-sample-1/src/index.tsx index 637a946dd0..7d8b54d565 100644 --- a/samples/notifications/banner/banner-sample-1/src/index.tsx +++ b/samples/notifications/banner/banner-sample-1/src/index.tsx @@ -2,24 +2,15 @@ import React, { useEffect, useRef } from 'react'; import ReactDOM from 'react-dom/client'; import { IgrBanner, - IgrBannerModule, IgrCard, - IgrCardModule, IgrIcon, - IgrIconModule, IgrNavbar, - IgrNavbarModule, registerIconFromText, - } from 'igniteui-react'; +} from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; import './BannerSample1.css'; import './index.css'; -IgrBannerModule.register(); -IgrNavbarModule.register(); -IgrIconModule.register(); -IgrCardModule.register(); - const refreshIcon = ''; @@ -35,22 +26,22 @@ export default function BannerSample1() {
-

Gallery

- bannerRef.current.show()}> +

Gallery

+ bannerRef.current.show()}>
- You are currently offline. + You are currently offline. - + -
- +
+
-
- +
+
@@ -60,4 +51,4 @@ export default function BannerSample1() { // rendering above class to the React DOM const root = ReactDOM.createRoot(document.getElementById('root')); -root.render(); +root.render(); diff --git a/samples/notifications/banner/banner-sample-2/src/index.tsx b/samples/notifications/banner/banner-sample-2/src/index.tsx index 6f12872aed..9b0e616dca 100644 --- a/samples/notifications/banner/banner-sample-2/src/index.tsx +++ b/samples/notifications/banner/banner-sample-2/src/index.tsx @@ -2,30 +2,17 @@ import React, { useEffect, useRef } from 'react'; import ReactDOM from 'react-dom/client'; import { IgrBanner, - IgrBannerModule, IgrButton, - IgrButtonModule, IgrCard, - IgrCardModule, IgrIcon, - IgrIconModule, IgrNavbar, - IgrNavbarModule, IgrRipple, - IgrRippleModule, registerIconFromText, - } from 'igniteui-react'; +} from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; import './BannerSample2.css'; import './index.css'; -IgrBannerModule.register(); -IgrNavbarModule.register(); -IgrIconModule.register(); -IgrCardModule.register(); -IgrButtonModule.register(); -IgrRippleModule.register(); - const refreshIcon = ''; const wifiOffIcon = @@ -44,29 +31,29 @@ export default function BannerSample2() {
-

Gallery

- bannerRef.current.show()}> +

Gallery

+ bannerRef.current.show()}>
- - You have lost connection to the internet. This app is offline. -
- bannerRef.current.toggle()}> - - Toggle Banner + + You have lost connection to the internet. This app is offline. +
+ bannerRef.current.toggle()}> + + Toggle Banner
-
- +
+
-
- +
+
@@ -76,4 +63,4 @@ export default function BannerSample2() { // rendering above class to the React DOM const root = ReactDOM.createRoot(document.getElementById('root')); -root.render(); +root.render(); diff --git a/samples/notifications/banner/banner-styling/src/index.tsx b/samples/notifications/banner/banner-styling/src/index.tsx index 8cd3de5971..671d5ca5f4 100644 --- a/samples/notifications/banner/banner-styling/src/index.tsx +++ b/samples/notifications/banner/banner-styling/src/index.tsx @@ -2,33 +2,18 @@ import React, { useEffect, useRef, useState } from 'react'; import ReactDOM from 'react-dom/client'; import { IgrBanner, - IgrBannerModule, IgrButton, - IgrButtonModule, IgrCard, - IgrCardModule, IgrIcon, - IgrIconModule, IgrNavbar, - IgrNavbarModule, IgrRipple, - IgrRippleModule, IgrToast, - IgrToastModule, registerIconFromText, - } from 'igniteui-react'; +} from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; import './BannerStyling.css'; import './index.css'; -IgrBannerModule.register(); -IgrNavbarModule.register(); -IgrIconModule.register(); -IgrCardModule.register(); -IgrButtonModule.register(); -IgrRippleModule.register(); -IgrToastModule.register(); - const wifiOnIcon = ''; const wifiOffIcon = @@ -40,6 +25,7 @@ export default function BannerStyling() { const toastRef = useRef(null); const [wifiState, setWifiState] = useState(false); + const [iconName, setIconName] = useState("signal_wifi_off"); useEffect(() => { registerIconFromText('signal_wifi_off', wifiOffIcon); @@ -47,20 +33,21 @@ export default function BannerStyling() { bannerRef.current.open = true; }, []); - function refreshBanner() { - if (!wifiState) { - iconRef.current.name = 'signal_wifi_4_bar'; + const refreshBanner = () => { + const nextWifiState = !wifiState; + setWifiState(nextWifiState); + setIconName(nextWifiState ? "signal_wifi_4_bar" : "signal_wifi_off"); + + if (nextWifiState) { bannerRef.current.hide(); } else { - iconRef.current.name = 'signal_wifi_off'; bannerRef.current.show(); } - setWifiState(current => !current); showToast(); } - function showToast() { + const showToast = () => { toastRef.current.open = false; toastRef.current.show(); } @@ -69,37 +56,37 @@ export default function BannerStyling() {
-

Gallery

- refreshBanner()}> +

Gallery

+
- - You have lost connection to the internet. This app is offline. -
- bannerRef.current.hide()}> - - Continue Offline + + You have lost connection to the internet. This app is offline. +
+ bannerRef.current.hide()}> + + Continue Offline - refreshBanner()}> - - Turn On Wifi + + + Turn On Wifi
-
- +
+
-
- +
+
- {`Wifi is now ${wifiState ? 'on' : 'off'}`} + {`Wifi is now ${wifiState ? 'on' : 'off'}`}
@@ -108,4 +95,4 @@ export default function BannerStyling() { // rendering above class to the React DOM const root = ReactDOM.createRoot(document.getElementById('root')); -root.render(); +root.render(); diff --git a/samples/notifications/dialog/closing-variations/src/index.tsx b/samples/notifications/dialog/closing-variations/src/index.tsx index dd26263970..89e4dd701b 100644 --- a/samples/notifications/dialog/closing-variations/src/index.tsx +++ b/samples/notifications/dialog/closing-variations/src/index.tsx @@ -1,13 +1,9 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrButton, IgrDialog, IgrSwitch, IgrButtonModule, IgrDialogModule, IgrSwitchModule } from 'igniteui-react'; +import { IgrButton, IgrDialog, IgrSwitch } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrButtonModule.register(); -IgrDialogModule.register(); -IgrSwitchModule.register(); - export default class DialogClosingVariations extends React.Component { public dialogRef: IgrDialog; diff --git a/samples/notifications/dialog/form/src/index.tsx b/samples/notifications/dialog/form/src/index.tsx index ec7726e2e0..9bac4ce9dc 100644 --- a/samples/notifications/dialog/form/src/index.tsx +++ b/samples/notifications/dialog/form/src/index.tsx @@ -1,13 +1,11 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrButton, IgrDialog, IgrInput, IgrIcon, IgrButtonModule, IgrDialogModule, IgrInputModule, IgrIconModule,registerIconFromText } from 'igniteui-react'; +import { IgrButton, IgrDialog, IgrInput, IgrIcon,registerIconFromText } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrButtonModule.register(); -IgrDialogModule.register(); -IgrInputModule.register(); -IgrIconModule.register(); +const usernameIconText = ''; +const passwordIconText = ''; const usernameIconText = ''; const passwordIconText = ''; diff --git a/samples/notifications/dialog/overview/src/index.tsx b/samples/notifications/dialog/overview/src/index.tsx index 8df8069022..582e8eebd2 100644 --- a/samples/notifications/dialog/overview/src/index.tsx +++ b/samples/notifications/dialog/overview/src/index.tsx @@ -1,12 +1,9 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrButton, IgrDialog, IgrButtonModule, IgrDialogModule } from 'igniteui-react'; +import { IgrButton, IgrDialog } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrButtonModule.register(); -IgrDialogModule.register(); - export default class DialogOverview extends React.Component { public dialogRef: IgrDialog; diff --git a/samples/notifications/dialog/styling/src/index.tsx b/samples/notifications/dialog/styling/src/index.tsx index c2b6267607..488b6e4d37 100644 --- a/samples/notifications/dialog/styling/src/index.tsx +++ b/samples/notifications/dialog/styling/src/index.tsx @@ -1,12 +1,9 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrButton, IgrDialog, IgrButtonModule, IgrDialogModule } from 'igniteui-react'; +import { IgrButton, IgrDialog } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrButtonModule.register(); -IgrDialogModule.register(); - export default class DialogStyling extends React.Component { public dialogRef: IgrDialog; diff --git a/samples/notifications/snackbar/action-text/src/index.tsx b/samples/notifications/snackbar/action-text/src/index.tsx index e9c54bfd18..5ef4201cd9 100644 --- a/samples/notifications/snackbar/action-text/src/index.tsx +++ b/samples/notifications/snackbar/action-text/src/index.tsx @@ -1,55 +1,38 @@ -import React from 'react'; +import React, { useRef } from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrButton, IgrSnackbar, IgrButtonModule, IgrSnackbarModule } from 'igniteui-react'; +import { IgrButton, IgrSnackbar } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrButtonModule.register(); -IgrSnackbarModule.register(); - -export default class SnackbarActionText extends React.Component { - - public snackbarRef: IgrSnackbar; - - constructor(props: any) { - super(props); - this.onShowButtonClicked = this.onShowButtonClicked.bind(this); - this.onSnackbarRef = this.onSnackbarRef.bind(this); - this.onSnackbarActionClicked = this.onSnackbarActionClicked.bind(this); - } - - public render(): JSX.Element { - return ( -
- - Show Snackbar - - - - Snackbar with enabled keep-open option - -
- ); - } - - public onSnackbarRef(snackbar: IgrSnackbar){ - if (!snackbar) { return; } - this.snackbarRef = snackbar; - } - - public onSnackbarActionClicked() { - if (this.snackbarRef) { - this.snackbarRef.hide(); - } - } - - public onShowButtonClicked() { - if(this.snackbarRef){ - this.snackbarRef.show(); - } - } +export default function SnackbarActionText() { + const snackbarRef = useRef(null); + + const onShowButtonClicked = () => { + snackbarRef.current?.show(); + }; + + const onSnackbarActionClicked = () => { + snackbarRef.current?.hide(); + }; + + return ( +
+ + Show Snackbar + + + + Snackbar with enabled keep-open option + +
+ ); } -// rendering above class to the React DOM +// rendering above function to the React DOM const root = ReactDOM.createRoot(document.getElementById('root')); -root.render(); +root.render(); \ No newline at end of file diff --git a/samples/notifications/snackbar/display-time/src/index.tsx b/samples/notifications/snackbar/display-time/src/index.tsx index 7c7d490ab1..6cbea84901 100644 --- a/samples/notifications/snackbar/display-time/src/index.tsx +++ b/samples/notifications/snackbar/display-time/src/index.tsx @@ -1,48 +1,29 @@ -import React from 'react'; +import React, { useRef } from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrButton, IgrSnackbar, IgrButtonModule, IgrSnackbarModule } from 'igniteui-react'; +import { IgrButton, IgrSnackbar } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrButtonModule.register(); -IgrSnackbarModule.register(); +export default function SnackbarDisplayTime() { + const snackbarRef = useRef(null); -export default class SnackbarDisplayTime extends React.Component { + const onShowButtonClicked = () => { + snackbarRef.current?.show(); + }; - public snackbarRef: IgrSnackbar; + return ( +
+ + Show Snackbar + - constructor(props: any) { - super(props); - this.onShowButtonClicked = this.onShowButtonClicked.bind(this); - this.onSnackbarRef = this.onSnackbarRef.bind(this); - } - - public render(): JSX.Element { - return ( -
- - Show Snackbar - - - - Snackbar with different display time - -
- ); - } - - public onSnackbarRef(snackbar: IgrSnackbar){ - if (!snackbar) { return; } - this.snackbarRef = snackbar; - } - - public onShowButtonClicked() { - if(this.snackbarRef){ - this.snackbarRef.show(); - } - } + + Snackbar with different display time + +
+ ); } -// rendering above class to the React DOM +// rendering above function to the React DOM const root = ReactDOM.createRoot(document.getElementById('root')); -root.render(); +root.render(); \ No newline at end of file diff --git a/samples/notifications/snackbar/overview/src/index.tsx b/samples/notifications/snackbar/overview/src/index.tsx index b6a7b3aeed..fd04f4fd37 100644 --- a/samples/notifications/snackbar/overview/src/index.tsx +++ b/samples/notifications/snackbar/overview/src/index.tsx @@ -1,48 +1,29 @@ -import React from 'react'; +import React, { useRef } from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrButton, IgrSnackbar, IgrButtonModule, IgrSnackbarModule } from 'igniteui-react'; +import { IgrButton, IgrSnackbar } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrButtonModule.register(); -IgrSnackbarModule.register(); +export default function SnackbarOverview() { + const snackbarRef = useRef(null); -export default class SnackbarOverview extends React.Component { + const onShowButtonClicked = () => { + snackbarRef.current?.show(); + }; - public snackbarRef: IgrSnackbar; + return ( +
+ + Show Snackbar + - constructor(props: any) { - super(props); - this.onShowButtonClicked = this.onShowButtonClicked.bind(this); - this.onSnackbarRef = this.onSnackbarRef.bind(this); - } - - public render(): JSX.Element { - return ( -
- - Show Snackbar - - - - Snackbar Message - -
- ); - } - - public onSnackbarRef(snackbar: IgrSnackbar){ - if (!snackbar) { return; } - this.snackbarRef = snackbar; - } - - public onShowButtonClicked() { - if(this.snackbarRef){ - this.snackbarRef.show(); - } - } + + Snackbar Message + +
+ ); } -// rendering above class to the React DOM +// rendering above function to the React DOM const root = ReactDOM.createRoot(document.getElementById('root')); -root.render(); +root.render(); \ No newline at end of file diff --git a/samples/notifications/snackbar/styling/src/index.tsx b/samples/notifications/snackbar/styling/src/index.tsx index 8b13a8b54e..3ed2b97a86 100644 --- a/samples/notifications/snackbar/styling/src/index.tsx +++ b/samples/notifications/snackbar/styling/src/index.tsx @@ -1,49 +1,30 @@ -import React from 'react'; +import React, { useRef } from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; import './SnackbarStyling.css'; -import { IgrButton, IgrSnackbar, IgrButtonModule, IgrSnackbarModule } from 'igniteui-react'; +import { IgrButton, IgrSnackbar } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrButtonModule.register(); -IgrSnackbarModule.register(); +export default function SnackbarStyling() { + const snackbarRef = useRef(null); -export default class SnackbarStyling extends React.Component { + const onShowButtonClicked = () => { + snackbarRef.current?.show(); + }; - public snackbarRef: IgrSnackbar; + return ( +
+ + Show Snackbar + - constructor(props: any) { - super(props); - this.onShowButtonClicked = this.onShowButtonClicked.bind(this); - this.onSnackbarRef = this.onSnackbarRef.bind(this); - } - - public render(): JSX.Element { - return ( -
- - Show Snackbar - - - - Styled Snackbar - -
- ); - } - - public onSnackbarRef(snackbar: IgrSnackbar){ - if (!snackbar) { return; } - this.snackbarRef = snackbar; - } - - public onShowButtonClicked() { - if(this.snackbarRef){ - this.snackbarRef.show(); - } - } + + Styled Snackbar + +
+ ); } -// rendering above class to the React DOM +// rendering above function to the React DOM const root = ReactDOM.createRoot(document.getElementById('root')); -root.render(); +root.render(); \ No newline at end of file diff --git a/samples/notifications/toast/overview/src/index.tsx b/samples/notifications/toast/overview/src/index.tsx index c7cf3919cd..7db1a0ce1d 100644 --- a/samples/notifications/toast/overview/src/index.tsx +++ b/samples/notifications/toast/overview/src/index.tsx @@ -1,48 +1,29 @@ -import React from 'react'; +import React, { useRef } from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrButton, IgrToast, IgrButtonModule, IgrToastModule } from 'igniteui-react'; +import { IgrButton, IgrToast } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrButtonModule.register(); -IgrToastModule.register(); +export default function ToastOverview() { + const toastRef = useRef(null); -export default class ToastOverview extends React.Component { + const onShowButtonClicked = () => { + toastRef.current?.show(); + }; - public toastRef: IgrToast; + return ( +
+ + Show Toast + - constructor(props: any) { - super(props); - this.onShowButtonClicked = this.onShowButtonClicked.bind(this); - this.onToastRef = this.onToastRef.bind(this); - } - - public render(): JSX.Element { - return ( -
- - Show Toast - - - - Toast Message - -
- ); - } - - public onToastRef(toast: IgrToast){ - if (!toast) { return; } - this.toastRef = toast; - } - - public onShowButtonClicked() { - if(this.toastRef){ - this.toastRef.show(); - } - } + + Toast Message + +
+ ); } -// rendering above class to the React DOM +// rendering above function to the React DOM const root = ReactDOM.createRoot(document.getElementById('root')); -root.render(); +root.render(); \ No newline at end of file diff --git a/samples/notifications/toast/properties/src/index.tsx b/samples/notifications/toast/properties/src/index.tsx index 7681de8bc4..733a1ad526 100644 --- a/samples/notifications/toast/properties/src/index.tsx +++ b/samples/notifications/toast/properties/src/index.tsx @@ -1,70 +1,49 @@ -import React from 'react'; +import React, { useRef } from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrButton, IgrToast, IgrButtonModule, IgrToastModule } from 'igniteui-react'; +import { IgrButton, IgrToast } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrButtonModule.register(); -IgrToastModule.register(); +export default function ToastProperties() { + const toastRef = useRef(null); -export default class ToastProperties extends React.Component { + const onToggleButtonClicked = () => { + toastRef.current?.toggle(); + }; - public toastRef: IgrToast; - - constructor(props: any) { - super(props); - this.onToggleButtonClicked = this.onToggleButtonClicked.bind(this); - this.onKeepOpenButtonClicked = this.onKeepOpenButtonClicked.bind(this); - this.onDisplayTimeButtonClicked = this.onDisplayTimeButtonClicked.bind(this); - this.onToastRef = this.onToastRef.bind(this); - } - - public render(): JSX.Element { - return ( -
-
- - Toggle Toast - - - Toggle keepOpen Property - - - Set DisplayTime to 8000 - -
- - - Toast Message - -
- ); - } - - public onToastRef(toast: IgrToast){ - if (!toast) { return; } - this.toastRef = toast; - } - - public onToggleButtonClicked() { - if(this.toastRef){ - this.toastRef.toggle(); + const onKeepOpenButtonClicked = () => { + if (toastRef.current) { + toastRef.current.keepOpen = !toastRef.current.keepOpen; } - } + }; - public onKeepOpenButtonClicked() { - if(this.toastRef){ - this.toastRef.keepOpen = !this.toastRef.keepOpen; + const onDisplayTimeButtonClicked = () => { + if (toastRef.current) { + toastRef.current.displayTime = 8000; } - } + }; + + return ( +
+
+ + Toggle Toast + + + Toggle keepOpen Property + + + Set DisplayTime to 8000 + +
- public onDisplayTimeButtonClicked() { - if(this.toastRef){ - this.toastRef.displayTime = 8000; - } - } + + Toast Message + +
+ ); } -// rendering above class to the React DOM +// rendering above function to the React DOM const root = ReactDOM.createRoot(document.getElementById('root')); -root.render(); +root.render(); \ No newline at end of file diff --git a/samples/notifications/toast/styling/src/index.tsx b/samples/notifications/toast/styling/src/index.tsx index ae7e67c151..7463cc6e83 100644 --- a/samples/notifications/toast/styling/src/index.tsx +++ b/samples/notifications/toast/styling/src/index.tsx @@ -1,49 +1,30 @@ -import React from 'react'; +import React, { useRef } from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; import './ToastStyling.css'; -import { IgrButton, IgrToast, IgrButtonModule, IgrToastModule } from 'igniteui-react'; +import { IgrButton, IgrToast } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrButtonModule.register(); -IgrToastModule.register(); +export default function ToastStyling() { + const toastRef = useRef(null); -export default class ToastStyling extends React.Component { + const onShowButtonClicked = () => { + toastRef.current?.show(); + }; - public toastRef: IgrToast; + return ( +
+ + Show Styled Toast + - constructor(props: any) { - super(props); - this.onShowButtonClicked = this.onShowButtonClicked.bind(this); - this.onToastRef = this.onToastRef.bind(this); - } - - public render(): JSX.Element { - return ( -
- - Show Styled Toast - - - - Styled Message - -
- ); - } - - public onToastRef(toast: IgrToast){ - if (!toast) { return; } - this.toastRef = toast; - } - - public onShowButtonClicked() { - if(this.toastRef){ - this.toastRef.show(); - } - } + + Styled Message + +
+ ); } -// rendering above class to the React DOM +// rendering above function to the React DOM const root = ReactDOM.createRoot(document.getElementById('root')); -root.render(); +root.render(); \ No newline at end of file diff --git a/samples/scheduling/calendar/multiple-months/src/index.tsx b/samples/scheduling/calendar/multiple-months/src/index.tsx index 36026eb4e5..932e72735c 100644 --- a/samples/scheduling/calendar/multiple-months/src/index.tsx +++ b/samples/scheduling/calendar/multiple-months/src/index.tsx @@ -1,11 +1,9 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrCalendar, IgrCalendarModule } from 'igniteui-react'; +import { IgrCalendar } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrCalendarModule.register(); - export default class CalendarMultipleMonths extends React.Component { constructor(props: any) { diff --git a/samples/scheduling/calendar/multiple-selection/src/index.tsx b/samples/scheduling/calendar/multiple-selection/src/index.tsx index 31bf211be9..2325e78298 100644 --- a/samples/scheduling/calendar/multiple-selection/src/index.tsx +++ b/samples/scheduling/calendar/multiple-selection/src/index.tsx @@ -1,11 +1,9 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrCalendar, IgrCalendarModule } from 'igniteui-react'; +import { IgrCalendar } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrCalendarModule.register(); - export default class CalendarMultipleSelection extends React.Component { constructor(props: any) { diff --git a/samples/scheduling/calendar/overview/src/index.tsx b/samples/scheduling/calendar/overview/src/index.tsx index 5f66b5bcf9..e83a957901 100644 --- a/samples/scheduling/calendar/overview/src/index.tsx +++ b/samples/scheduling/calendar/overview/src/index.tsx @@ -1,11 +1,9 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrCalendar, IgrCalendarModule } from 'igniteui-react'; +import { IgrCalendar } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrCalendarModule.register(); - export default class CalendarOverview extends React.Component { constructor(props: any) { diff --git a/samples/scheduling/calendar/range-selection/src/index.tsx b/samples/scheduling/calendar/range-selection/src/index.tsx index 9a22a9c947..826e400e8c 100644 --- a/samples/scheduling/calendar/range-selection/src/index.tsx +++ b/samples/scheduling/calendar/range-selection/src/index.tsx @@ -1,11 +1,9 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrCalendar, IgrCalendarModule } from 'igniteui-react'; +import { IgrCalendar } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrCalendarModule.register(); - export default class CalendarRangeSelection extends React.Component { constructor(props: any) { diff --git a/samples/scheduling/calendar/size/src/index.tsx b/samples/scheduling/calendar/size/src/index.tsx index e91fc43ba5..071abc70de 100644 --- a/samples/scheduling/calendar/size/src/index.tsx +++ b/samples/scheduling/calendar/size/src/index.tsx @@ -1,13 +1,9 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrCalendar, IgrRadioGroup, IgrRadio, IgrCalendarModule, IgrRadioGroupModule, IgrRadioModule } from 'igniteui-react'; +import { IgrCalendar, IgrRadioGroup, IgrRadio } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrCalendarModule.register(); -IgrRadioGroupModule.register(); -IgrRadioModule.register(); - export default class CalendarSize extends React.Component { constructor(props: any) { @@ -20,17 +16,22 @@ export default class CalendarSize extends React.Component { return (
- + Small - + Medium - + Large -
); @@ -45,4 +46,4 @@ export default class CalendarSize extends React.Component { // rendering above class to the React DOM const root = ReactDOM.createRoot(document.getElementById('root')); -root.render(); +root.render(); diff --git a/samples/scheduling/calendar/styling/src/index.tsx b/samples/scheduling/calendar/styling/src/index.tsx index 852a060cf3..14c6b4b630 100644 --- a/samples/scheduling/calendar/styling/src/index.tsx +++ b/samples/scheduling/calendar/styling/src/index.tsx @@ -2,11 +2,9 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; import './CalendarStyling.css'; -import { IgrCalendar, IgrCalendarModule } from 'igniteui-react'; +import { IgrCalendar } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrCalendarModule.register(); - export default class CalendarStyling extends React.Component { constructor(props: any) { diff --git a/samples/scheduling/calendar/week-numbers/src/index.tsx b/samples/scheduling/calendar/week-numbers/src/index.tsx index f9dc2965c9..d5915bd26c 100644 --- a/samples/scheduling/calendar/week-numbers/src/index.tsx +++ b/samples/scheduling/calendar/week-numbers/src/index.tsx @@ -1,11 +1,9 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrCalendar, IgrCalendarModule } from 'igniteui-react'; +import { IgrCalendar } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrCalendarModule.register(); - export default class CalendarWeekNumbers extends React.Component { constructor(props: any) { diff --git a/samples/scheduling/date-picker/dialog-mode/src/index.tsx b/samples/scheduling/date-picker/dialog-mode/src/index.tsx index 4272751ed2..7bfe9f2298 100644 --- a/samples/scheduling/date-picker/dialog-mode/src/index.tsx +++ b/samples/scheduling/date-picker/dialog-mode/src/index.tsx @@ -1,12 +1,10 @@ import React, { useRef } from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrDatePicker, IgrDatePickerModule } from 'igniteui-react'; +import { IgrDatePicker } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrDatePickerModule.register(); - export default function App() { const datePickerRef = useRef(null); diff --git a/samples/scheduling/date-picker/form/src/index.tsx b/samples/scheduling/date-picker/form/src/index.tsx index bc706789f9..62b5fa441e 100644 --- a/samples/scheduling/date-picker/form/src/index.tsx +++ b/samples/scheduling/date-picker/form/src/index.tsx @@ -1,32 +1,22 @@ import React, { useRef, useState, useEffect } from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrButton, IgrDatePicker, IgrDatePickerModule } from 'igniteui-react'; - +import { IgrButton, IgrDatePicker } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrDatePickerModule.register(); - export default function App() { - const datePickerRef = useRef(null); const formRef = useRef(null); - const [datePickerValue, setDatePickerValue] = useState(new Date(2024, 4, 15)); + const initialDate = new Date(2024, 4, 15); + const minDate = new Date(initialDate.getFullYear(), initialDate.getMonth(), initialDate.getDate() - 10); + const maxDate = new Date(initialDate.getFullYear(), initialDate.getMonth(), initialDate.getDate() + 15); + + const [datePickerValue, setDatePickerValue] = useState(initialDate); const [formStatus, setFormStatus] = useState(''); useEffect(() => { - const date = new Date(2024, 4, 15); - const minDate = new Date(date.getFullYear(), date.getMonth(), date.getDate() - 10); - const maxDate = new Date(date.getFullYear(), date.getMonth(), date.getDate() + 15); - - if (datePickerRef.current) { - datePickerRef.current.value = date; - datePickerRef.current.min = minDate; - datePickerRef.current.max = maxDate; - } - updateFormStatus(); - }, []); + }, [datePickerValue]); const updateFormStatus = () => { if (formRef.current) { @@ -37,16 +27,12 @@ export default function App() { const handleDateChange = (e: any) => { const newValue = e.detail; setDatePickerValue(newValue); - updateFormStatus(); }; const handleReset = (event: React.MouseEvent) => { event.preventDefault(); - if (formRef.current) { - formRef.current.reset(); - setDatePickerValue(null); - setFormStatus('false'); - } + setDatePickerValue(null); + setFormStatus('false'); }; return ( @@ -54,7 +40,9 @@ export default function App() {
- + Reset
diff --git a/samples/scheduling/date-picker/format/src/index.tsx b/samples/scheduling/date-picker/format/src/index.tsx index 1b9b2cdaca..f856c16271 100644 --- a/samples/scheduling/date-picker/format/src/index.tsx +++ b/samples/scheduling/date-picker/format/src/index.tsx @@ -1,12 +1,10 @@ import React, { useRef } from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrDatePicker, IgrDatePickerModule } from 'igniteui-react'; +import { IgrDatePicker } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrDatePickerModule.register(); - export default function App() { const datePickerRef = useRef(null); diff --git a/samples/scheduling/date-picker/overview/src/index.tsx b/samples/scheduling/date-picker/overview/src/index.tsx index 8f7b4ba3f8..69ba2298f0 100644 --- a/samples/scheduling/date-picker/overview/src/index.tsx +++ b/samples/scheduling/date-picker/overview/src/index.tsx @@ -1,12 +1,10 @@ import React, { useRef } from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrDatePicker, IgrDatePickerModule } from 'igniteui-react'; +import { IgrDatePicker } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; -IgrDatePickerModule.register(); - export default function App() { const datePickerRef = useRef(null); diff --git a/samples/scheduling/date-picker/styling/src/index.tsx b/samples/scheduling/date-picker/styling/src/index.tsx index adebf9a21d..35ff0d8ea1 100644 --- a/samples/scheduling/date-picker/styling/src/index.tsx +++ b/samples/scheduling/date-picker/styling/src/index.tsx @@ -1,13 +1,11 @@ import React, { useRef } from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; -import { IgrDatePicker, IgrDatePickerModule } from 'igniteui-react'; +import { IgrDatePicker } from 'igniteui-react'; import 'igniteui-webcomponents/themes/light/bootstrap.css'; import './DatePickerStyling.css'; -IgrDatePickerModule.register(); - export default function App() { const datePickerRef = useRef(null);