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" + ] +}