diff --git a/.changeset/input-component.md b/.changeset/input-component.md new file mode 100644 index 000000000..acee9001f --- /dev/null +++ b/.changeset/input-component.md @@ -0,0 +1,8 @@ +--- +"@cypress-design/react-button": patch +"@cypress-design/react-input": patch +"@cypress-design/vue-input": patch +"@cypress-design/constants-input": patch +--- + +feat: input component diff --git a/components/Button/assertions.ts b/components/Button/assertions.ts index 19fdcec66..ba999e0db 100644 --- a/components/Button/assertions.ts +++ b/components/Button/assertions.ts @@ -26,7 +26,6 @@ export default function assertions( 'text-decoration-line', 'underline' ) - cy }) it('renders variants', () => { diff --git a/components/Button/react/ReadMe.md b/components/Button/react/ReadMe.md index df44a7679..e9d564331 100644 --- a/components/Button/react/ReadMe.md +++ b/components/Button/react/ReadMe.md @@ -49,10 +49,11 @@ export default () => { backgroundColor: variant === 'outline-dark' ? '#1a202c' : 'white', color: variant === 'outline-dark' ? 'white' : 'black', }} + key={variant} > {variant} {Object.keys(SizeClassesTable).map((size) => ( -
+
{size} + )} + {searchResults && ( +

+ {searchResults.match} of {searchResults.total} {searchResults.entity} +

+ )} +
+ ) +} + +export default Input diff --git a/components/Input/react/InputReact.cy.tsx b/components/Input/react/InputReact.cy.tsx new file mode 100644 index 000000000..d8c3510e8 --- /dev/null +++ b/components/Input/react/InputReact.cy.tsx @@ -0,0 +1,13 @@ +/// + +import * as React from 'react' +import { mount } from 'cypress/react18' +import InputStory from './Input.rootstory' +import assertions from '../assertions' + +describe('Input', () => { + function mountStory(options: Parameters[0] = {}) { + mount() + } + assertions(mountStory) +}) diff --git a/components/Input/react/ReadMe.md b/components/Input/react/ReadMe.md new file mode 100644 index 000000000..b65506bb0 --- /dev/null +++ b/components/Input/react/ReadMe.md @@ -0,0 +1,94 @@ +# Input + +## Install + +```bash +npm install @cypress-design/react-input +``` + +or with yarn + +```bash +yarn add @cypress-design/react-input +``` + +## Usage + +```ts +import Input from '@cypress-design/react-input' +``` + +```jsx live +import { + default as Input, + VariantClassesTable, + SizeClassesTable, +} from '@cypress-design/react-input' + +const Contrast = ({ children }) => ( +
{children}
+) + +export const InputComp = () => { + return ( + + null} + // customIcon={IconComponentVar} + isSearch // adds MagnifyingGlass icon + onReset={() => console.log('reset...')} + placeholder="Search specs" + searchResults={{ + match: 7, + total: 124, + entity: 'specs', + }} + /> + + ) +} +``` + +## Possible variants + +```tsx live +import { + default as Input, + SizeClassesTable, + VariantClassesTable, +} from '@cypress-design/react-input' + +export default () => { + return ( +
+ {Object.keys(VariantClassesTable).map((variant) => ( +
+

{variant}

+ {Object.keys(SizeClassesTable).map((size) => { + return ( +
+ {size} + +
+ ) + })} +
+ ))} +
+ ) +} +``` diff --git a/components/Input/react/index.ts b/components/Input/react/index.ts new file mode 100644 index 000000000..067923874 --- /dev/null +++ b/components/Input/react/index.ts @@ -0,0 +1,5 @@ +export { default } from './Input' +export { + VariantClassesTable, + SizeClassesTable, +} from '@cypress-design/constants-input' diff --git a/components/Input/react/package.json b/components/Input/react/package.json new file mode 100644 index 000000000..121623652 --- /dev/null +++ b/components/Input/react/package.json @@ -0,0 +1,30 @@ +{ + "name": "@cypress-design/react-input", + "version": "0.0.0", + "files": [ + "*" + ], + "typings": "./dist/index.d.ts", + "module": "./dist/index.es.mjs", + "main": "./dist/index.umd.js", + "exports": { + ".": { + "import": "./dist/index.es.mjs", + "require": "./dist/index.umd.js" + } + }, + "scripts": { + "build": "yarn build:module && yarn build:types", + "build:module": "rollup -c ./rollup.config.mjs", + "build:types": "tsc --project ./tsconfig.build.json" + }, + "dependencies": { + "@cypress-design/constants-input": "*", + "@cypress-design/react-icon": "*", + "clsx": "*" + }, + "devDependencies": { + "@cypress-design/css": "*" + }, + "license": "MIT" +} \ No newline at end of file diff --git a/components/Input/react/rollup.config.mjs b/components/Input/react/rollup.config.mjs new file mode 100644 index 000000000..a7bd5b69a --- /dev/null +++ b/components/Input/react/rollup.config.mjs @@ -0,0 +1,3 @@ +import rootRollupConfig from '../../root.rollup.config.mjs' + +export default rootRollupConfig({ input: './index.ts' }) diff --git a/components/Input/react/tsconfig.build.json b/components/Input/react/tsconfig.build.json new file mode 100644 index 000000000..d3d35c0f3 --- /dev/null +++ b/components/Input/react/tsconfig.build.json @@ -0,0 +1,8 @@ +{ + "extends": "../../../tsconfig.react.build.json", + "include": ["./Input.tsx", "./index.ts"], + "compilerOptions": { + "sourceRoot": "./", + "outDir": "dist" + } +} diff --git a/components/Input/react/tsconfig.json b/components/Input/react/tsconfig.json new file mode 100644 index 000000000..1b2a34ec1 --- /dev/null +++ b/components/Input/react/tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "../../../tsconfig.react.json", + "compilerOptions": { + "rootDir": "../../../" + }, + "include": ["*.tsx", "*.ts", "../*.ts", "../../../cypress/support/*.ts"] +} diff --git a/components/Input/vue/CHANGELOG.md b/components/Input/vue/CHANGELOG.md new file mode 100644 index 000000000..1f8267877 --- /dev/null +++ b/components/Input/vue/CHANGELOG.md @@ -0,0 +1 @@ +# @cypress-design/vue-input diff --git a/components/Input/vue/Input.rootstory.tsx b/components/Input/vue/Input.rootstory.tsx new file mode 100644 index 000000000..bbc507de6 --- /dev/null +++ b/components/Input/vue/Input.rootstory.tsx @@ -0,0 +1,6 @@ +import Input from './Input.vue' + +export default (options: { id?: string }) => { + const { id = 'foo', ...rest } = options + return +} diff --git a/components/Input/vue/Input.vue b/components/Input/vue/Input.vue new file mode 100644 index 000000000..ebcb4be25 --- /dev/null +++ b/components/Input/vue/Input.vue @@ -0,0 +1,109 @@ + + + diff --git a/components/Input/vue/InputVue.cy.tsx b/components/Input/vue/InputVue.cy.tsx new file mode 100644 index 000000000..7e43ecabb --- /dev/null +++ b/components/Input/vue/InputVue.cy.tsx @@ -0,0 +1,11 @@ +/// +import { mount } from 'cypress/vue' +import assertions from '../assertions' +import InputStory from './Input.rootstory' + +describe('', () => { + function mountStory(options: Parameters[0] = {}) { + mount(() => ) + } + // assertions(mountStory) +}) diff --git a/components/Input/vue/ReadMe.md b/components/Input/vue/ReadMe.md new file mode 100644 index 000000000..0aa7f18e6 --- /dev/null +++ b/components/Input/vue/ReadMe.md @@ -0,0 +1,36 @@ +# Input + +## Install + +```bash +npm install @cypress-design/vue-input +``` + +or with yarn + +```bash +yarn add @cypress-design/vue-input +``` + +## Usage + +```js +import Input from '@cypress-design/vue-input' +``` + +```vue live + +``` diff --git a/components/Input/vue/index.ts b/components/Input/vue/index.ts new file mode 100644 index 000000000..2033ab143 --- /dev/null +++ b/components/Input/vue/index.ts @@ -0,0 +1,5 @@ +export { default } from './Input.vue' +export { + VariantClassesTable, + SizeClassesTable, +} from '@cypress-design/constants-input' diff --git a/components/Input/vue/package.json b/components/Input/vue/package.json new file mode 100644 index 000000000..cf1aeb708 --- /dev/null +++ b/components/Input/vue/package.json @@ -0,0 +1,26 @@ +{ + "name": "@cypress-design/vue-input", + "version": "0.0.0", + "files": [ + "*" + ], + "typings": "./dist/vue/index.d.ts", + "module": "./dist/index.es.mjs", + "main": "./dist/index.umd.js", + "exports": { + ".": { + "import": "./dist/index.es.mjs", + "require": "./dist/index.umd.js" + } + }, + "scripts": { + "build": "yarn build:module && yarn build:types", + "build:module": "yarn vite build", + "build:types": "yarn vue-tsc --project ./tsconfig.build.json" + }, + "dependencies": { + "@cypress-design/vue-icon": "*", + "@cypress-design/constants-input": "*" + }, + "license": "MIT" +} \ No newline at end of file diff --git a/components/Input/vue/tsconfig.build.json b/components/Input/vue/tsconfig.build.json new file mode 100644 index 000000000..428a301b1 --- /dev/null +++ b/components/Input/vue/tsconfig.build.json @@ -0,0 +1,8 @@ +{ + "extends": "../../../tsconfig.vue.json", + "include": ["./*.vue", "./index.ts"], + "compilerOptions": { + "outDir": "dist", + "composite": false + } +} diff --git a/components/Input/vue/tsconfig.json b/components/Input/vue/tsconfig.json new file mode 100644 index 000000000..ff6953fa2 --- /dev/null +++ b/components/Input/vue/tsconfig.json @@ -0,0 +1,14 @@ +{ + "extends": "../../../tsconfig.vue.json", + "compilerOptions": { + "rootDir": "../../../" + }, + "exclude": ["vite.config.ts"], + "include": [ + "*.vue", + "*.ts", + "*.tsx", + "../*.ts", + "../../../cypress/support/*.ts" + ] +} diff --git a/components/Input/vue/vite.config.ts b/components/Input/vue/vite.config.ts new file mode 100644 index 000000000..47fe70ae1 --- /dev/null +++ b/components/Input/vue/vite.config.ts @@ -0,0 +1,7 @@ +import * as path from 'path' +import generateViteConfig from '../../root.vite.config' + +export default generateViteConfig({ + entry: path.resolve(__dirname, './index.ts'), + name: 'Input', +}) diff --git a/package.json b/package.json index ebeef36ab..8bf33e131 100644 --- a/package.json +++ b/package.json @@ -88,7 +88,7 @@ "rollup": "^3.21.6", "rollup-plugin-postcss": "^4.0.2", "rollup-plugin-sourcemaps": "^0.6.3", - "turbo": "^1.9.4", + "turbo": "^1.9.6", "typescript": "5.0.4", "universal-cookie": "^4.0.4", "vite": "4.3.5", diff --git a/yarn.lock b/yarn.lock index 4ce015f85..32e83f838 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10122,47 +10122,47 @@ tunnel-agent@^0.6.0: dependencies: safe-buffer "^5.0.1" -turbo-darwin-64@1.9.4: - version "1.9.4" - resolved "https://registry.yarnpkg.com/turbo-darwin-64/-/turbo-darwin-64-1.9.4.tgz#3f40cba2dcc13011f4c51101ba03f4c1aa511daf" - integrity sha512-kCmDmxyUWWI+BstTZQKNM87UbNx40C0ZHUTFqs9tmeH7d5+gA2QhqrSoBuwQYw7YYNLpbkqu1ObbppsUlIFPdQ== - -turbo-darwin-arm64@1.9.4: - version "1.9.4" - resolved "https://registry.yarnpkg.com/turbo-darwin-arm64/-/turbo-darwin-arm64-1.9.4.tgz#257e67438033d1bfb75650b5ca8664d0a00e0ccb" - integrity sha512-Of64jMEaDDHx0dzU7RwdOuh1lP021vtQun9wmEHhT0Hk/TQF+kDCywoHcY7R5nlSRcssFjysVyhCeZW6CkWrrA== - -turbo-linux-64@1.9.4: - version "1.9.4" - resolved "https://registry.yarnpkg.com/turbo-linux-64/-/turbo-linux-64-1.9.4.tgz#a4d7a06b8b786144d3c967a8f647561a71d8057a" - integrity sha512-kajvUnXlUNtgVzLW3Y/RoHrC64G+G0Ky/o1F+oP6QK/T85H8NwNHXq2F6hyIrZPNGbKpPgpetuQ1waIibxJ0rA== - -turbo-linux-arm64@1.9.4: - version "1.9.4" - resolved "https://registry.yarnpkg.com/turbo-linux-arm64/-/turbo-linux-arm64-1.9.4.tgz#5426bd72ef2a80cad390ecf4220779824faab41f" - integrity sha512-11P9Y8MoimqUzib3SU3md4g1loLF0FRHpYCbPzUTWPT3beOcdM2nop2u/yFHyBnbSxz1rTWczRJPnNoAki0B/Q== - -turbo-windows-64@1.9.4: - version "1.9.4" - resolved "https://registry.yarnpkg.com/turbo-windows-64/-/turbo-windows-64-1.9.4.tgz#b6458e3f715f0b0ab0b1bf1ded3ed6f2a8e0f1f9" - integrity sha512-2tFcFhuqs1c1DGFAk2wjU0TXrOXKoPdma9vxrTVdwvtz5Nc8XPF8RNW+1jbmRjpumGUkXou6Pe973GSvPjvD5w== - -turbo-windows-arm64@1.9.4: - version "1.9.4" - resolved "https://registry.yarnpkg.com/turbo-windows-arm64/-/turbo-windows-arm64-1.9.4.tgz#d4959a8b81dc5c3561b8e22355ab74b05d47f803" - integrity sha512-wJfEwUyWXxn6VKD2Vbycke6cm99gJ0llkr9gUnbR06eaRu1TiLY24FcFqN95/wftp0n5nne7b6K7Wz1TLh1fJQ== - -turbo@^1.9.4: - version "1.9.4" - resolved "https://registry.yarnpkg.com/turbo/-/turbo-1.9.4.tgz#d9a3e350767dc894a5f5b427144d20d435c22032" - integrity sha512-PqhlMCmu6sOqcVswt1tYL0TV/O0uQ8kUZWfmlEl0EHPusc2R3nzg7KVXrZbXTHXzQH5HE2oJm9iUI0mYz31i7Q== +turbo-darwin-64@1.9.6: + version "1.9.6" + resolved "https://registry.yarnpkg.com/turbo-darwin-64/-/turbo-darwin-64-1.9.6.tgz#fb391943b8b4c5e72cd6aaebc57d177a26b5d98e" + integrity sha512-9jmxyCAcPrJiPD/EmtK2tObrPGblmyORCgNgtcw1iozcfC7kqungWTfbnHrvTNUfUmVhH0sA3BGzshpuslbQHg== + +turbo-darwin-arm64@1.9.6: + version "1.9.6" + resolved "https://registry.yarnpkg.com/turbo-darwin-arm64/-/turbo-darwin-arm64-1.9.6.tgz#852aa7c97f5688082df06607cbdf7b9623eff782" + integrity sha512-5f8ajEi8mOdAZ0AXavu/TzkHGEUi7tw+paefff7KK+XTUrdeyTlf8ULiTI+r97uH1jsYeTeL4JPu9IsEx+bL6g== + +turbo-linux-64@1.9.6: + version "1.9.6" + resolved "https://registry.yarnpkg.com/turbo-linux-64/-/turbo-linux-64-1.9.6.tgz#c716247e27a9e8a53ab240272cd189bf0d8a6f08" + integrity sha512-UrCDMl2Nqd/kxNEJonqvDg8nmZU4UggVQTmqcdYyuOiCA3H98jxggQqZh1VGeF23XDbCWHSQjnbkLeoUvQJWKw== + +turbo-linux-arm64@1.9.6: + version "1.9.6" + resolved "https://registry.yarnpkg.com/turbo-linux-arm64/-/turbo-linux-arm64-1.9.6.tgz#0c4aad0a502e79494d13775a81348d17bb9f581c" + integrity sha512-oOxAT6lNiMpYVZPWzFNsUvC2LQgKYyH4aBnkeoBnjuAUk8BK5AhUWSWl4QlfTcBWW4LnjDPeZQKrbnxvHhPVsw== + +turbo-windows-64@1.9.6: + version "1.9.6" + resolved "https://registry.yarnpkg.com/turbo-windows-64/-/turbo-windows-64-1.9.6.tgz#8852355f0ab51582cb85ba1393fe6a9b91773ee4" + integrity sha512-65UxLL1vb5RItzJYNerO5c+yPMzSnD+GvJxfBZIvAwSnb+4ulhPRHzQOYinVq4PZ2DosBZOorWPRf97POmhvog== + +turbo-windows-arm64@1.9.6: + version "1.9.6" + resolved "https://registry.yarnpkg.com/turbo-windows-arm64/-/turbo-windows-arm64-1.9.6.tgz#971e33503388ae53a6af7f4356ec579c604ef5f6" + integrity sha512-aF9VzYT+vaKNbZGDccN7AYrNhph4gr6yOFN7GtTr777IwS5FGW7evku7RScsua5r2HwVKvBO2WjyadpbXuoOOQ== + +turbo@^1.9.6: + version "1.9.6" + resolved "https://registry.yarnpkg.com/turbo/-/turbo-1.9.6.tgz#48924ba8afba760b5c4ff6a6e1c48129df338c38" + integrity sha512-mLbCIAYNbSm60kVhBiAr+YA1BYpPObS/y7rqw1hjh36ZdJDp35lUSeqdBs6oGt0Y4hnmN4ZeIXu8zMVRR03/vw== optionalDependencies: - turbo-darwin-64 "1.9.4" - turbo-darwin-arm64 "1.9.4" - turbo-linux-64 "1.9.4" - turbo-linux-arm64 "1.9.4" - turbo-windows-64 "1.9.4" - turbo-windows-arm64 "1.9.4" + turbo-darwin-64 "1.9.6" + turbo-darwin-arm64 "1.9.6" + turbo-linux-64 "1.9.6" + turbo-linux-arm64 "1.9.6" + turbo-windows-64 "1.9.6" + turbo-windows-arm64 "1.9.6" tweetnacl@^0.14.3, tweetnacl@~0.14.0: version "0.14.5"