From 05fbafa205e24cfa9bd14599245db844fbfbb6d2 Mon Sep 17 00:00:00 2001 From: Andrey Morozov Date: Tue, 11 Jun 2024 21:20:17 +0300 Subject: [PATCH] feat: add PinInput docs --- package-lock.json | 8 +-- package.json | 2 +- .../components/uikit/PinInput/index.ts | 63 +++++++++++++++++++ src/content/components/uikit/index.ts | 2 + 4 files changed, 70 insertions(+), 5 deletions(-) create mode 100644 src/content/components/uikit/PinInput/index.ts diff --git a/package-lock.json b/package-lock.json index c9df54f51cc8..705309b4adec 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,7 +13,7 @@ "@gravity-ui/date-components": "^2.0.1", "@gravity-ui/icons": "^2.8.1", "@gravity-ui/page-constructor": "^5.2.0", - "@gravity-ui/uikit": "^6.15.0", + "@gravity-ui/uikit": "^6.17.0", "@mdx-js/mdx": "^2.3.0", "@mdx-js/react": "^2.3.0", "@testing-library/jest-dom": "^5.16.5", @@ -2471,9 +2471,9 @@ "dev": true }, "node_modules/@gravity-ui/uikit": { - "version": "6.15.0", - "resolved": "https://registry.npmjs.org/@gravity-ui/uikit/-/uikit-6.15.0.tgz", - "integrity": "sha512-UYy1iDgsqbN3y+RKVEZHlPwxwAnrD3YzFgNtg+q/l8g4Inz9uK1W/8WBAKyvbp7cqdoSGONq0t0UsoAtJhybfg==", + "version": "6.17.0", + "resolved": "https://registry.npmjs.org/@gravity-ui/uikit/-/uikit-6.17.0.tgz", + "integrity": "sha512-aelbGQh0DxgZ/b3hbjZNBPc417mmoL4P5vq6yYOvUol/4GKimofgs7kOB2IjIVOAaEYivGgoVjmLQxREJfM15A==", "dependencies": { "@bem-react/classname": "^1.6.0", "@gravity-ui/i18n": "^1.3.0", diff --git a/package.json b/package.json index 27d2d74c3569..d032ee0b0d4b 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "@gravity-ui/date-components": "^2.0.1", "@gravity-ui/icons": "^2.8.1", "@gravity-ui/page-constructor": "^5.2.0", - "@gravity-ui/uikit": "^6.15.0", + "@gravity-ui/uikit": "^6.17.0", "@mdx-js/mdx": "^2.3.0", "@mdx-js/react": "^2.3.0", "@testing-library/jest-dom": "^5.16.5", diff --git a/src/content/components/uikit/PinInput/index.ts b/src/content/components/uikit/PinInput/index.ts new file mode 100644 index 000000000000..d34e3e6c5727 --- /dev/null +++ b/src/content/components/uikit/PinInput/index.ts @@ -0,0 +1,63 @@ +import dynamic from 'next/dynamic'; + +import {Repos} from '../../../../types/common'; +import {getGithubUrl, getReadmeUrl, mappingOptions} from '../../utils'; + +const getterOptions = {repoName: Repos.Uikit, componentName: 'PinInput'}; + +export const pinInputConfig = { + id: 'pin-input', + title: 'PinInput', + githubUrl: getGithubUrl(getterOptions), + isSupportRTL: true, + content: { + readmeUrl: getReadmeUrl(getterOptions), + }, + sandbox: { + component: dynamic(() => import('@gravity-ui/uikit').then((mod) => mod.PinInput)), + props: { + size: { + type: 'radioButton', + values: mappingOptions(['s', 'm', 'l', 'xl']), + defaultValue: 'm', + }, + type: { + type: 'radioButton', + values: mappingOptions(['numeric', 'alphanumeric']), + defaultValue: 'numeric', + }, + length: { + type: 'radioButton', + values: mappingOptions(['4', '6']), + defaultValue: '4', + }, + placeholder: { + type: 'input', + }, + note: { + type: 'input', + }, + validationState: { + type: 'radioButton', + values: mappingOptions(['normal', 'invalid']), + defaultValue: 'normal', + }, + errorMessage: { + type: 'input', + defaultValue: 'PIN incorrect', + }, + disabled: { + type: 'switch', + defaultValue: false, + }, + otp: { + type: 'switch', + defaultValue: false, + }, + mask: { + type: 'switch', + defaultValue: false, + }, + }, + }, +}; diff --git a/src/content/components/uikit/index.ts b/src/content/components/uikit/index.ts index e0fb1a266c4f..29e303f68637 100644 --- a/src/content/components/uikit/index.ts +++ b/src/content/components/uikit/index.ts @@ -20,6 +20,7 @@ import {menuConfig} from './Menu'; import {modalConfig} from './Modal'; import {paginationConfig} from './Pagination'; import {paletteConfig} from './Palette'; +import {pinInputConfig} from './PinInput'; import {popupConfig} from './Popup'; import {portalConfig} from './Portal'; import {progressConfig} from './Progress'; @@ -62,6 +63,7 @@ const uikitComponents: Component[] = [ modalConfig, paginationConfig, paletteConfig, + pinInputConfig, popupConfig, portalConfig, progressConfig,