diff --git a/.github/workflows/issues-metrics.yml b/.github/workflows/issues-metrics.yml new file mode 100644 index 000000000..4c2500064 --- /dev/null +++ b/.github/workflows/issues-metrics.yml @@ -0,0 +1,43 @@ +name: Monthly issue metrics +on: + workflow_dispatch: + schedule: + - cron: '3 2 1 * *' + +permissions: + issues: write + pull-requests: read + +jobs: + build: + name: issue metrics + runs-on: ubuntu-latest + + steps: + + - name: Get dates for last month + shell: bash + run: | + # Calculate the first day of the previous month + first_day=$(date -d "last month" +%Y-%m-01) + + # Calculate the last day of the previous month + last_day=$(date -d "$first_day +1 month -1 day" +%Y-%m-%d) + + #Set an environment variable with the date range + echo "$first_day..$last_day" + echo "last_month=$first_day..$last_day" >> "$GITHUB_ENV" + + - name: Run issue-metrics tool + uses: github/issue-metrics@v2 + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SEARCH_QUERY: 'repo:shapeitapp/shapeitapp created:${{ env.last_month }}' + + - name: Create issue + uses: peter-evans/create-issue-from-file@v4 + with: + title: Monthly issue metrics report + token: ${{ secrets.GITHUB_TOKEN }} + content-filepath: ./issue_metrics.md + assignees: Amzani diff --git a/.sonarcloud.properties b/.sonarcloud.properties new file mode 100644 index 000000000..298f574f2 --- /dev/null +++ b/.sonarcloud.properties @@ -0,0 +1,4 @@ +# Disable specific file since it would introduce more complexity to reduce it - mainly code complexity and complex template literals +sonar.exclusions=apps/studio/public/js/monaco/**,apps/studio/src/tailwind.css,apps/studio/src/components/SplitPane/** +# Disable duplicate code in tests since it would introduce more complexity to reduce it. +sonar.cpd.exclusions=apps/studio/public/js/monaco/**,apps/studio/src/components/Template/HTMLWrapper.tsx,apps/studio/src/components/Visualiser/Visualiser.tsx,apps/studio/src/components/Navigationv3.tsx,apps/studio/src/components/Navigation.tsx \ No newline at end of file diff --git a/apps/design-system/src/components/ChipInput.stories.tsx b/apps/design-system/src/components/ChipInput.stories.tsx new file mode 100644 index 000000000..fa129f7f3 --- /dev/null +++ b/apps/design-system/src/components/ChipInput.stories.tsx @@ -0,0 +1,76 @@ +import { useState } from "react"; +import { ChipInput } from "@asyncapi/studio-ui"; + +const meta = { + component: ChipInput, + parameters: { + layout: 'fullscreen', + backgrounds: { + default: 'light' + } + }, +}; + +export default meta; + +export const Default = () => { + const [currentChips, setCurrentChips] = useState([]); + + return ( +
+ +
+ ); +}; + +export const WithTags = () => { + const [currentChips, setCurrentChips] = useState(['production', 'platform']); + + return ( +
+ +
+ ); + }; + +export const WithSomeDefaultText = () => { + const [currentChips, setCurrentChips] = useState(['production', 'platform']); + + return ( +
+ +
+ ); +}; + +export const WithCustomPlaceholder = () => { + const [currentChips, setCurrentChips] = useState([]); + + return ( +
+ +
+ ); +}; diff --git a/apps/studio/.sonarcloud.properties b/apps/studio/.sonarcloud.properties deleted file mode 100644 index 255c7994e..000000000 --- a/apps/studio/.sonarcloud.properties +++ /dev/null @@ -1,4 +0,0 @@ -# Disable specific file since it would introduce more complexity to reduce it - mainly code complexity and complex template literals -sonar.exclusions=public/js/monaco/**,src/tailwind.css,src/components/SplitPane/** -# Disable duplicate code in tests since it would introduce more complexity to reduce it. -sonar.cpd.exclusions=public/js/monaco/**,src/components/Template/HTMLWrapper.tsx,src/components/Visualiser/Visualiser.tsx \ No newline at end of file diff --git a/apps/studio/CHANGELOG.md b/apps/studio/CHANGELOG.md index 1eb28bf47..750f2b9dd 100644 --- a/apps/studio/CHANGELOG.md +++ b/apps/studio/CHANGELOG.md @@ -1,5 +1,11 @@ # @asyncapi/studio +## 0.19.1 + +### Patch Changes + +- 9187c17: fix studio breaking when trying to generate code/document + ## 0.19.0 ### Minor Changes diff --git a/apps/studio/package.json b/apps/studio/package.json index b0cc65305..3a1867f88 100644 --- a/apps/studio/package.json +++ b/apps/studio/package.json @@ -1,6 +1,6 @@ { "name": "@asyncapi/studio", - "version": "0.19.0", + "version": "0.19.1", "private": true, "description": "One place that allows you to develop an AsyncAPI document, validate it, convert it to the latest version, preview the documentation and visualize the events flow.", "license": "Apache-2.0", @@ -75,12 +75,12 @@ }, "devDependencies": { "@asyncapi/dotnet-nats-template": "^0.12.1", - "@asyncapi/go-watermill-template": "^0.2.40", + "@asyncapi/go-watermill-template": "^0.2.43", "@asyncapi/html-template": "^0.28.4", "@asyncapi/java-spring-cloud-stream-template": "^0.13.4", - "@asyncapi/java-spring-template": "^1.2.0", + "@asyncapi/java-spring-template": "^1.4.0", "@asyncapi/java-template": "^0.2.1", - "@asyncapi/markdown-template": "^1.3.3", + "@asyncapi/markdown-template": "^1.4.0", "@asyncapi/nodejs-template": "^1.0.0", "@asyncapi/nodejs-ws-template": "^0.9.33", "@asyncapi/python-paho-template": "^0.2.13", diff --git a/apps/studio/src/components/Modals/Generator/TemplateParameters.tsx b/apps/studio/src/components/Modals/Generator/TemplateParameters.tsx index afc4b97ff..862f7e783 100644 --- a/apps/studio/src/components/Modals/Generator/TemplateParameters.tsx +++ b/apps/studio/src/components/Modals/Generator/TemplateParameters.tsx @@ -106,7 +106,7 @@ export const TemplateParametersSans: ForwardRefRenderFunction { - if (supportedProtocols.includes(server.protocol())) availableServers.push(serverName); + if (server.protocol && supportedProtocols.includes(server.protocol())) availableServers.push(serverName); }); if (supportedProtocols.length && availableServers.length === 0) { diff --git a/package-lock.json b/package-lock.json index bdf51e2e4..67a5e5100 100644 --- a/package-lock.json +++ b/package-lock.json @@ -494,7 +494,7 @@ }, "apps/studio": { "name": "@asyncapi/studio", - "version": "0.19.0", + "version": "0.19.1", "license": "Apache-2.0", "dependencies": { "@asyncapi/avro-schema-parser": "^3.0.2", @@ -522,12 +522,12 @@ }, "devDependencies": { "@asyncapi/dotnet-nats-template": "^0.12.1", - "@asyncapi/go-watermill-template": "^0.2.40", + "@asyncapi/go-watermill-template": "^0.2.43", "@asyncapi/html-template": "^0.28.4", "@asyncapi/java-spring-cloud-stream-template": "^0.13.4", - "@asyncapi/java-spring-template": "^1.2.0", + "@asyncapi/java-spring-template": "^1.4.0", "@asyncapi/java-template": "^0.2.1", - "@asyncapi/markdown-template": "^1.3.3", + "@asyncapi/markdown-template": "^1.4.0", "@asyncapi/nodejs-template": "^1.0.0", "@asyncapi/nodejs-ws-template": "^0.9.33", "@asyncapi/python-paho-template": "^0.2.13", @@ -1184,15 +1184,62 @@ } }, "node_modules/@asyncapi/go-watermill-template": { - "version": "0.2.40", - "resolved": "https://registry.npmjs.org/@asyncapi/go-watermill-template/-/go-watermill-template-0.2.40.tgz", - "integrity": "sha512-4YwaRlLJ42xMh3qHRD3VaIJXNtozB8VyHaKLIuk4jcwqYby5AXkgXxbpr/x7P1EatGqKx0rgt7Y5t2K3OEy5SA==", + "version": "0.2.43", + "resolved": "https://registry.npmjs.org/@asyncapi/go-watermill-template/-/go-watermill-template-0.2.43.tgz", + "integrity": "sha512-lV4O/wTXShZN1jCnH8jpAbVWp7fdNrNDaiGK8wd4Haw2nHbKVKOdCFVmhi0Ufn6tclTM164Vf9sXHmQ/u7/eyw==", "dev": true, "dependencies": { "@asyncapi/generator-filters": "^2.0.0", "@asyncapi/generator-hooks": "^0.1.0", "@asyncapi/generator-react-sdk": "^0.2.23", - "@asyncapi/modelina": "^1.9.0" + "@asyncapi/modelina": "^2.0.1" + } + }, + "node_modules/@asyncapi/go-watermill-template/node_modules/@asyncapi/modelina": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@asyncapi/modelina/-/modelina-2.0.1.tgz", + "integrity": "sha512-ypXgAh4D5nIhoLoKPTnI/qBSoWo9aG28+ONOyZN29j68JswAoMeEm7ga9HGIQ+J+j4LmcojuJlttO83m4SJTZg==", + "dev": true, + "dependencies": { + "@apidevtools/json-schema-ref-parser": "^9.0.9", + "@apidevtools/swagger-parser": "^10.0.3", + "@asyncapi/avro-schema-parser": "^3.0.2", + "@asyncapi/openapi-schema-parser": "^3.0.5", + "@asyncapi/parser": "^2.1.0", + "@asyncapi/raml-dt-schema-parser": "^4.0.4", + "@swc/core": "^1.3.5", + "@swc/jest": "^0.2.23", + "@types/node": "^20.3.3", + "alterschema": "^1.1.2", + "change-case": "^4.1.2", + "cross-env": "^7.0.3", + "openapi-types": "9.3.0", + "typescript-json-schema": "^0.58.1" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@asyncapi/go-watermill-template/node_modules/@asyncapi/openapi-schema-parser": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/@asyncapi/openapi-schema-parser/-/openapi-schema-parser-3.0.5.tgz", + "integrity": "sha512-2CPP0arkI/ibXTdae6DqeQyor3xuSf0GOyh0+yFPqVkbiYPBkC8K2UNbQ610vt8KpcEFeijX+7YuV+FTuQ5CHg==", + "dev": true, + "dependencies": { + "@asyncapi/parser": "^2.1.1", + "@openapi-contrib/openapi-schema-to-json-schema": "~3.2.0", + "ajv": "^8.11.0", + "ajv-errors": "^3.0.0", + "ajv-formats": "^2.1.1" + } + }, + "node_modules/@asyncapi/go-watermill-template/node_modules/@types/node": { + "version": "20.8.7", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.8.7.tgz", + "integrity": "sha512-21TKHHh3eUHIi2MloeptJWALuCu5H7HQTdTrWIFReA8ad+aggoX+lRes3ex7/FtpC+sVUpFMQ+QTfYr74mruiQ==", + "dev": true, + "dependencies": { + "undici-types": "~5.25.1" } }, "node_modules/@asyncapi/html-template": { @@ -1387,9 +1434,9 @@ } }, "node_modules/@asyncapi/java-spring-template": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@asyncapi/java-spring-template/-/java-spring-template-1.2.0.tgz", - "integrity": "sha512-aCt18PnX24rgqZOvBoIC2Fi3rISB0vey/Kuk/VLAs4Ox89bcnIkZFZFB7u/h70IO+cI0I/GldyzpwluTGfJeeg==", + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@asyncapi/java-spring-template/-/java-spring-template-1.4.0.tgz", + "integrity": "sha512-8fRosWeK7F6fk9kYIaHVfv53GdkqunpWkaF1q4wOInlXt5NV3JJt9iVqRcSQis79X/cy9E3jP3VnbDmwl5btCQ==", "dev": true, "dependencies": { "@asyncapi/generator-filters": "^2.1.0", @@ -1428,14 +1475,12 @@ } }, "node_modules/@asyncapi/markdown-template": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/@asyncapi/markdown-template/-/markdown-template-1.3.3.tgz", - "integrity": "sha512-7gRo1yVMf6TCrOJOi8q8HxkZOJGWtQHQOElXTi9gUbl710b/3SYxlPN8hiS8JuX7d9oOD5JHg0MvRXlq4YxiLw==", + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@asyncapi/markdown-template/-/markdown-template-1.4.0.tgz", + "integrity": "sha512-mvghEtlCi/2DxSnBRMn5nRD+lD2P/HOfodnLMPav1SM0th9eiwizovTQzfuUByjFxVRj9x54ywXObm/fzo3oBQ==", "dev": true, "dependencies": { - "@asyncapi/generator-filters": "^2.1.0", "@asyncapi/generator-react-sdk": "^1.0.0", - "@asyncapi/parser": "^2.1.0", "openapi-sampler": "^1.3.0", "yaml": "^1.10.2" } @@ -1530,9 +1575,9 @@ } }, "node_modules/@asyncapi/modelina": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/@asyncapi/modelina/-/modelina-1.9.0.tgz", - "integrity": "sha512-bvzdMD16JjxzRTs4PwpXoeM3ZFczGwuCfMm8rYryOSg232+eN+9B3TgbrJ0BH70l0+1ilIzJC+dAHUohy4R32A==", + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/@asyncapi/modelina/-/modelina-1.9.1.tgz", + "integrity": "sha512-Uik1951dm0MGduKsPzzJmeHZ/IINevR1Qx+QHIRfj9B4ayEAFMNV7sOBJ9eqtEvDohGvXgeFsnNMGAXshed1GQ==", "dev": true, "dependencies": { "@apidevtools/json-schema-ref-parser": "^9.0.9", @@ -1570,11 +1615,6 @@ "node": ">=12" } }, - "node_modules/@asyncapi/modelina/node_modules/path-equal": { - "version": "1.2.5", - "dev": true, - "license": "MIT" - }, "node_modules/@asyncapi/modelina/node_modules/safe-stable-stringify": { "version": "2.4.3", "dev": true, @@ -1661,15 +1701,20 @@ } }, "node_modules/@asyncapi/parser": { - "version": "2.1.0", - "license": "Apache-2.0", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@asyncapi/parser/-/parser-2.1.1.tgz", + "integrity": "sha512-FnJ5Du9iMu9MEb5mF90gF7z1ZkdnazisBsm3GHVFr7VaiF8luAoB+bklGYFwoMb+9QWKWr1099orY5VyXULAcQ==", "dependencies": { "@asyncapi/specs": "^5.1.0", "@openapi-contrib/openapi-schema-to-json-schema": "~3.2.0", + "@stoplight/json": "^3.20.2", + "@stoplight/json-ref-readers": "^1.2.2", "@stoplight/json-ref-resolver": "^3.1.5", "@stoplight/spectral-core": "^1.16.1", "@stoplight/spectral-functions": "^1.7.2", "@stoplight/spectral-parsers": "^1.0.2", + "@stoplight/spectral-ref-resolver": "^1.0.3", + "@stoplight/types": "^13.12.0", "@types/json-schema": "^7.0.11", "@types/urijs": "^1.19.19", "ajv": "^8.11.0", @@ -26212,6 +26257,12 @@ "tslib": "^2.0.3" } }, + "node_modules/path-equal": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/path-equal/-/path-equal-1.2.5.tgz", + "integrity": "sha512-i73IctDr3F2W+bsOWDyyVm/lqsXO47aY9nsFZUjTT/aljSbkxHxxCoyZ9UUrM8jK0JVod+An+rl48RCsvWM+9g==", + "dev": true + }, "node_modules/path-exists": { "version": "4.0.0", "license": "MIT", @@ -32402,6 +32453,81 @@ "node": ">=4.2.0" } }, + "node_modules/typescript-json-schema": { + "version": "0.58.1", + "resolved": "https://registry.npmjs.org/typescript-json-schema/-/typescript-json-schema-0.58.1.tgz", + "integrity": "sha512-EcmquhfGEmEJOAezLZC6CzY0rPNzfXuky+Z3zoXULEEncW8e13aAjmC2r8ppT1bvvDekJj1TJ4xVhOdkjYtkUA==", + "dev": true, + "dependencies": { + "@types/json-schema": "^7.0.9", + "@types/node": "^16.9.2", + "glob": "^7.1.7", + "path-equal": "^1.2.5", + "safe-stable-stringify": "^2.2.0", + "ts-node": "^10.9.1", + "typescript": "~4.9.5", + "yargs": "^17.1.1" + }, + "bin": { + "typescript-json-schema": "bin/typescript-json-schema" + } + }, + "node_modules/typescript-json-schema/node_modules/@types/node": { + "version": "16.18.59", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.59.tgz", + "integrity": "sha512-PJ1w2cNeKUEdey4LiPra0ZuxZFOGvetswE8qHRriV/sUkL5Al4tTmPV9D2+Y/TPIxTHHgxTfRjZVKWhPw/ORhQ==", + "dev": true + }, + "node_modules/typescript-json-schema/node_modules/cliui": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "dev": true, + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/typescript-json-schema/node_modules/safe-stable-stringify": { + "version": "2.4.3", + "resolved": "https://registry.npmjs.org/safe-stable-stringify/-/safe-stable-stringify-2.4.3.tgz", + "integrity": "sha512-e2bDA2WJT0wxseVd4lsDP4+3ONX6HpMXQa1ZhFQ7SU+GjvORCmShbCMltrtIDfkYhVHrOcPtj+KhmDBdPdZD1g==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/typescript-json-schema/node_modules/yargs": { + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", + "dev": true, + "dependencies": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/typescript-json-schema/node_modules/yargs-parser": { + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "dev": true, + "engines": { + "node": ">=12" + } + }, "node_modules/uc.micro": { "version": "1.0.6", "dev": true, @@ -32464,6 +32590,12 @@ "ieee754": "^1.1.13" } }, + "node_modules/undici-types": { + "version": "5.25.3", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.25.3.tgz", + "integrity": "sha512-Ga1jfYwRn7+cP9v8auvEXN1rX3sWqlayd4HP7OKk4mZWylEmu3KzXDUGrQUN6Ol7qo1gPvB2e5gX6udnyEPgdA==", + "dev": true + }, "node_modules/unfetch": { "version": "4.2.0", "dev": true, @@ -34662,15 +34794,61 @@ } }, "@asyncapi/go-watermill-template": { - "version": "0.2.40", - "resolved": "https://registry.npmjs.org/@asyncapi/go-watermill-template/-/go-watermill-template-0.2.40.tgz", - "integrity": "sha512-4YwaRlLJ42xMh3qHRD3VaIJXNtozB8VyHaKLIuk4jcwqYby5AXkgXxbpr/x7P1EatGqKx0rgt7Y5t2K3OEy5SA==", + "version": "0.2.43", + "resolved": "https://registry.npmjs.org/@asyncapi/go-watermill-template/-/go-watermill-template-0.2.43.tgz", + "integrity": "sha512-lV4O/wTXShZN1jCnH8jpAbVWp7fdNrNDaiGK8wd4Haw2nHbKVKOdCFVmhi0Ufn6tclTM164Vf9sXHmQ/u7/eyw==", "dev": true, "requires": { "@asyncapi/generator-filters": "^2.0.0", "@asyncapi/generator-hooks": "^0.1.0", "@asyncapi/generator-react-sdk": "^0.2.23", - "@asyncapi/modelina": "^1.9.0" + "@asyncapi/modelina": "^2.0.1" + }, + "dependencies": { + "@asyncapi/modelina": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@asyncapi/modelina/-/modelina-2.0.1.tgz", + "integrity": "sha512-ypXgAh4D5nIhoLoKPTnI/qBSoWo9aG28+ONOyZN29j68JswAoMeEm7ga9HGIQ+J+j4LmcojuJlttO83m4SJTZg==", + "dev": true, + "requires": { + "@apidevtools/json-schema-ref-parser": "^9.0.9", + "@apidevtools/swagger-parser": "^10.0.3", + "@asyncapi/avro-schema-parser": "^3.0.2", + "@asyncapi/openapi-schema-parser": "^3.0.5", + "@asyncapi/parser": "^2.1.0", + "@asyncapi/raml-dt-schema-parser": "^4.0.4", + "@swc/core": "^1.3.5", + "@swc/jest": "^0.2.23", + "@types/node": "^20.3.3", + "alterschema": "^1.1.2", + "change-case": "^4.1.2", + "cross-env": "^7.0.3", + "openapi-types": "9.3.0", + "typescript-json-schema": "^0.58.1" + } + }, + "@asyncapi/openapi-schema-parser": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/@asyncapi/openapi-schema-parser/-/openapi-schema-parser-3.0.5.tgz", + "integrity": "sha512-2CPP0arkI/ibXTdae6DqeQyor3xuSf0GOyh0+yFPqVkbiYPBkC8K2UNbQ610vt8KpcEFeijX+7YuV+FTuQ5CHg==", + "dev": true, + "requires": { + "@asyncapi/parser": "^2.1.1", + "@openapi-contrib/openapi-schema-to-json-schema": "~3.2.0", + "ajv": "^8.11.0", + "ajv-errors": "^3.0.0", + "ajv-formats": "^2.1.1" + } + }, + "@types/node": { + "version": "20.8.7", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.8.7.tgz", + "integrity": "sha512-21TKHHh3eUHIi2MloeptJWALuCu5H7HQTdTrWIFReA8ad+aggoX+lRes3ex7/FtpC+sVUpFMQ+QTfYr74mruiQ==", + "dev": true, + "requires": { + "undici-types": "~5.25.1" + } + } } }, "@asyncapi/html-template": { @@ -34837,9 +35015,9 @@ } }, "@asyncapi/java-spring-template": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@asyncapi/java-spring-template/-/java-spring-template-1.2.0.tgz", - "integrity": "sha512-aCt18PnX24rgqZOvBoIC2Fi3rISB0vey/Kuk/VLAs4Ox89bcnIkZFZFB7u/h70IO+cI0I/GldyzpwluTGfJeeg==", + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@asyncapi/java-spring-template/-/java-spring-template-1.4.0.tgz", + "integrity": "sha512-8fRosWeK7F6fk9kYIaHVfv53GdkqunpWkaF1q4wOInlXt5NV3JJt9iVqRcSQis79X/cy9E3jP3VnbDmwl5btCQ==", "dev": true, "requires": { "@asyncapi/generator-filters": "^2.1.0", @@ -34872,14 +35050,12 @@ } }, "@asyncapi/markdown-template": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/@asyncapi/markdown-template/-/markdown-template-1.3.3.tgz", - "integrity": "sha512-7gRo1yVMf6TCrOJOi8q8HxkZOJGWtQHQOElXTi9gUbl710b/3SYxlPN8hiS8JuX7d9oOD5JHg0MvRXlq4YxiLw==", + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@asyncapi/markdown-template/-/markdown-template-1.4.0.tgz", + "integrity": "sha512-mvghEtlCi/2DxSnBRMn5nRD+lD2P/HOfodnLMPav1SM0th9eiwizovTQzfuUByjFxVRj9x54ywXObm/fzo3oBQ==", "dev": true, "requires": { - "@asyncapi/generator-filters": "^2.1.0", "@asyncapi/generator-react-sdk": "^1.0.0", - "@asyncapi/parser": "^2.1.0", "openapi-sampler": "^1.3.0", "yaml": "^1.10.2" }, @@ -34959,9 +35135,9 @@ } }, "@asyncapi/modelina": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/@asyncapi/modelina/-/modelina-1.9.0.tgz", - "integrity": "sha512-bvzdMD16JjxzRTs4PwpXoeM3ZFczGwuCfMm8rYryOSg232+eN+9B3TgbrJ0BH70l0+1ilIzJC+dAHUohy4R32A==", + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/@asyncapi/modelina/-/modelina-1.9.1.tgz", + "integrity": "sha512-Uik1951dm0MGduKsPzzJmeHZ/IINevR1Qx+QHIRfj9B4ayEAFMNV7sOBJ9eqtEvDohGvXgeFsnNMGAXshed1GQ==", "dev": true, "requires": { "@apidevtools/json-schema-ref-parser": "^9.0.9", @@ -34991,10 +35167,6 @@ "wrap-ansi": "^7.0.0" } }, - "path-equal": { - "version": "1.2.5", - "dev": true - }, "safe-stable-stringify": { "version": "2.4.3", "dev": true @@ -35066,14 +35238,20 @@ } }, "@asyncapi/parser": { - "version": "2.1.0", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@asyncapi/parser/-/parser-2.1.1.tgz", + "integrity": "sha512-FnJ5Du9iMu9MEb5mF90gF7z1ZkdnazisBsm3GHVFr7VaiF8luAoB+bklGYFwoMb+9QWKWr1099orY5VyXULAcQ==", "requires": { "@asyncapi/specs": "^5.1.0", "@openapi-contrib/openapi-schema-to-json-schema": "~3.2.0", + "@stoplight/json": "^3.20.2", + "@stoplight/json-ref-readers": "^1.2.2", "@stoplight/json-ref-resolver": "^3.1.5", "@stoplight/spectral-core": "^1.16.1", "@stoplight/spectral-functions": "^1.7.2", "@stoplight/spectral-parsers": "^1.0.2", + "@stoplight/spectral-ref-resolver": "^1.0.3", + "@stoplight/types": "^13.12.0", "@types/json-schema": "^7.0.11", "@types/urijs": "^1.19.19", "ajv": "^8.11.0", @@ -35225,12 +35403,12 @@ "@asyncapi/avro-schema-parser": "^3.0.2", "@asyncapi/converter": "^1.3.1", "@asyncapi/dotnet-nats-template": "^0.12.1", - "@asyncapi/go-watermill-template": "^0.2.40", + "@asyncapi/go-watermill-template": "^0.2.43", "@asyncapi/html-template": "^0.28.4", "@asyncapi/java-spring-cloud-stream-template": "^0.13.4", - "@asyncapi/java-spring-template": "^1.2.0", + "@asyncapi/java-spring-template": "^1.4.0", "@asyncapi/java-template": "^0.2.1", - "@asyncapi/markdown-template": "^1.3.3", + "@asyncapi/markdown-template": "^1.4.0", "@asyncapi/nodejs-template": "^1.0.0", "@asyncapi/nodejs-ws-template": "^0.9.33", "@asyncapi/openapi-schema-parser": "^3.0.4", @@ -51492,6 +51670,12 @@ "tslib": "^2.0.3" } }, + "path-equal": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/path-equal/-/path-equal-1.2.5.tgz", + "integrity": "sha512-i73IctDr3F2W+bsOWDyyVm/lqsXO47aY9nsFZUjTT/aljSbkxHxxCoyZ9UUrM8jK0JVod+An+rl48RCsvWM+9g==", + "dev": true + }, "path-exists": { "version": "4.0.0" }, @@ -55352,6 +55536,68 @@ "version": "4.9.5", "dev": true }, + "typescript-json-schema": { + "version": "0.58.1", + "resolved": "https://registry.npmjs.org/typescript-json-schema/-/typescript-json-schema-0.58.1.tgz", + "integrity": "sha512-EcmquhfGEmEJOAezLZC6CzY0rPNzfXuky+Z3zoXULEEncW8e13aAjmC2r8ppT1bvvDekJj1TJ4xVhOdkjYtkUA==", + "dev": true, + "requires": { + "@types/json-schema": "^7.0.9", + "@types/node": "^16.9.2", + "glob": "^7.1.7", + "path-equal": "^1.2.5", + "safe-stable-stringify": "^2.2.0", + "ts-node": "^10.9.1", + "typescript": "~4.9.5", + "yargs": "^17.1.1" + }, + "dependencies": { + "@types/node": { + "version": "16.18.59", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.59.tgz", + "integrity": "sha512-PJ1w2cNeKUEdey4LiPra0ZuxZFOGvetswE8qHRriV/sUkL5Al4tTmPV9D2+Y/TPIxTHHgxTfRjZVKWhPw/ORhQ==", + "dev": true + }, + "cliui": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "dev": true, + "requires": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^7.0.0" + } + }, + "safe-stable-stringify": { + "version": "2.4.3", + "resolved": "https://registry.npmjs.org/safe-stable-stringify/-/safe-stable-stringify-2.4.3.tgz", + "integrity": "sha512-e2bDA2WJT0wxseVd4lsDP4+3ONX6HpMXQa1ZhFQ7SU+GjvORCmShbCMltrtIDfkYhVHrOcPtj+KhmDBdPdZD1g==", + "dev": true + }, + "yargs": { + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", + "dev": true, + "requires": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + } + }, + "yargs-parser": { + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "dev": true + } + } + }, "uc.micro": { "version": "1.0.6", "dev": true @@ -55388,6 +55634,12 @@ } } }, + "undici-types": { + "version": "5.25.3", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.25.3.tgz", + "integrity": "sha512-Ga1jfYwRn7+cP9v8auvEXN1rX3sWqlayd4HP7OKk4mZWylEmu3KzXDUGrQUN6Ol7qo1gPvB2e5gX6udnyEPgdA==", + "dev": true + }, "unfetch": { "version": "4.2.0", "dev": true diff --git a/packages/ui/components/ChipInput.tsx b/packages/ui/components/ChipInput.tsx new file mode 100644 index 000000000..f3d45c694 --- /dev/null +++ b/packages/ui/components/ChipInput.tsx @@ -0,0 +1,80 @@ +import { FunctionComponent, KeyboardEvent, useRef } from 'react'; + +interface ChipInputProps { + name: string; + id: string; + className?: string; + chips: string[]; + onChange: (chips: string[]) => void; + isDisabled?: boolean; + placeholder?: string; + defaultValue?: string; +} + +export const ChipInput: FunctionComponent = ({ + name, + id, + className, + chips, + onChange, + isDisabled = false, + placeholder = 'Add Tags', + defaultValue = '' +}) => { + const inputRef = useRef(null); + const firstChipRef = useRef(null); + + const handleKeyDown = (event: KeyboardEvent) => { + if (event.key === 'Enter' && event.currentTarget.value.trim()) { + onChange([...chips, event.currentTarget.value.trim()]); + event.currentTarget.value = ''; + } else if (event.key === 'Backspace' && !event.currentTarget.value) { + onChange(chips.slice(0, -1)); + } else if (event.key === 'Tab' && !event.shiftKey) { + event.preventDefault(); + firstChipRef.current?.focus(); + } + }; + + const handleChipKeyDown = (index: number) => (event: KeyboardEvent) => { + if (event.key === 'Backspace') { + const updatedChips = [...chips]; + updatedChips.splice(index, 1); + onChange(updatedChips); + } + }; + + const handleDelete = (chipToDelete: string) => () => { + const updatedChips = chips.filter(chip => chip !== chipToDelete); + onChange(updatedChips); + }; + + return ( +
+ {chips.map((chip, index) => ( +
+ {chip} + +
+ ))} + +
+ ); +}; diff --git a/packages/ui/components/index.tsx b/packages/ui/components/index.tsx index 50e048646..a1058b7ad 100644 --- a/packages/ui/components/index.tsx +++ b/packages/ui/components/index.tsx @@ -2,6 +2,7 @@ import './styles.css' // components +export * from './ChipInput' export * from './EditorSwitch' export * from './DropdownMenu' export * from './Logo'