├── .editorconfig ├── .eslintignore ├── .eslintrc ├── .github └── workflows │ └── gh-pages.yaml ├── .gitignore ├── .npmrc ├── .prettierignore ├── .prettierrc ├── .vscode ├── extensions.json └── launch.json ├── README.md ├── examples ├── react │ ├── index.html │ ├── package.json │ ├── public │ │ └── spanch-bob.webp │ ├── src │ │ ├── App.tsx │ │ ├── index.tsx │ │ └── vite-env.d.ts │ ├── tsconfig.json │ └── vite.config.ts ├── vanilla │ ├── index.html │ ├── package.json │ ├── src │ │ ├── index.ts │ │ ├── style.css │ │ └── vite-env.d.ts │ └── tsconfig.json └── vue │ ├── README.md │ ├── index.html │ ├── package.json │ ├── src │ ├── App.vue │ ├── assets │ │ ├── base.css │ │ ├── logo.svg │ │ └── main.css │ ├── main.ts │ └── vite-env.d.ts │ ├── tsconfig.config.json │ ├── tsconfig.json │ └── vite.config.ts ├── package.json ├── packages ├── react │ ├── README.md │ ├── package.json │ ├── src │ │ └── index.tsx │ ├── tsconfig.json │ └── vite.config.ts ├── selectable-grid │ ├── .gitignore │ ├── README.md │ ├── package.json │ ├── src │ │ ├── index.ts │ │ ├── selectable-grid.ts │ │ ├── types.ts │ │ ├── utils.ts │ │ └── vite-env.d.ts │ ├── tsconfig.json │ └── vite.config.ts └── vue │ ├── .eslintrc.cjs │ ├── .gitignore │ ├── README.md │ ├── package.json │ ├── src │ ├── SelectableGrid.vue │ ├── index.ts │ └── vite-env.d.ts │ ├── tsconfig.json │ └── vite.config.ts ├── pnpm-lock.yaml ├── pnpm-workspace.yaml ├── turbo.json └── website ├── index.html ├── package.json ├── public ├── CNAME └── patrik.png ├── src ├── App.tsx ├── index.css ├── index.tsx └── vite-env.d.ts ├── tsconfig.json └── vite.config.ts /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | **/dist 2 | **/node_modules 3 | *.config.ts 4 | -------------------------------------------------------------------------------- /.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "root": true, 3 | "parser": "@typescript-eslint/parser", 4 | "extends": [ 5 | "prettier", 6 | "standard", 7 | "plugin:prettier/recommended", 8 | "plugin:@typescript-eslint/eslint-recommended", 9 | "plugin:@typescript-eslint/recommended", 10 | "plugin:@typescript-eslint/recommended-requiring-type-checking", 11 | "eslint:recommended" 12 | ], 13 | "env": { 14 | "node": true, 15 | "browser": true 16 | }, 17 | "parserOptions": { 18 | "ecmaVersion": 2020, 19 | "ecmaFeatures": { 20 | "legacyDecorators": true, 21 | "jsx": true 22 | }, 23 | "project": [ 24 | "./packages/*/tsconfig.json", 25 | "./examples/*/tsconfig.json", 26 | "./website/tsconfig.json" 27 | ] 28 | }, 29 | "settings": { 30 | "react": { 31 | "version": "16" 32 | } 33 | }, 34 | "plugins": ["react-hooks", "@typescript-eslint"], 35 | "rules": { 36 | "space-before-function-paren": 0, 37 | "react/prop-types": 0, 38 | "react/jsx-handler-names": 0, 39 | "react/jsx-fragments": 0, 40 | "react/no-unused-prop-types": 0, 41 | "import/export": 0, 42 | "react-hooks/exhaustive-deps": "warn", 43 | "semi": ["warn", "never"], 44 | "@typescript-eslint/member-delimiter-style": "off", 45 | "@typescript-eslint/explicit-function-return-type": "off", 46 | "@typescript-eslint/no-unsafe-assignment": "off", 47 | "no-unused-vars": "warn" 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /.github/workflows/gh-pages.yaml: -------------------------------------------------------------------------------- 1 | name: github-pages 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | - v2 8 | 9 | jobs: 10 | cache-and-install: 11 | runs-on: ubuntu-latest 12 | steps: 13 | - name: Checkout 14 | uses: actions/checkout@v3 15 | 16 | - name: Cache PNPM 17 | uses: actions/cache@v3 18 | with: 19 | path: ~/.pnpm-store 20 | key: ${{ runner.os }}-node-${{ hashFiles('**/pnpm-lock.yaml') }} 21 | restore-keys: | 22 | ${{ runner.os }}-node- 23 | - name: Setup Node 24 | uses: actions/setup-node@v3 25 | with: 26 | node-version: 16 27 | 28 | - name: Installing packages 29 | uses: pnpm/action-setup@v2.2.2 30 | with: 31 | version: 7.x.x 32 | run_install: | 33 | - args: [--frozen-lockfile] 34 | - name: Build website 35 | run: pnpm build:website 36 | 37 | - name: Deploy to GitHub Pages 38 | uses: JamesIves/github-pages-deploy-action@4.1.5 39 | with: 40 | branch: gh-pages 41 | folder: ./website/dist 42 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | **/node_modules 2 | **/dist 3 | *.tgz 4 | *.log 5 | .turbo 6 | build/** 7 | -------------------------------------------------------------------------------- /.npmrc: -------------------------------------------------------------------------------- 1 | auto-install-peers=true 2 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | dist 3 | .github 4 | *.yaml 5 | *.yml 6 | *.json 7 | *.md 8 | .*ignore 9 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": true, 3 | "jsxSingleQuote": true, 4 | "semi": false, 5 | "tabWidth": 2, 6 | "bracketSpacing": true, 7 | "jsxBracketSameLine": false, 8 | "arrowParens": "always", 9 | "trailingComma": "none" 10 | } 11 | -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": [ 3 | "vue.volar", 4 | "esbenp.prettier-vscode" 5 | ] 6 | } 7 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 3 | "version": "0.2.0", 4 | "configurations": [ 5 | { 6 | "type": "pwa-node", 7 | "request": "launch", 8 | "name": "Debug Current Test File", 9 | "autoAttachChildProcesses": true, 10 | "skipFiles": ["/**", "**/node_modules/**"], 11 | "program": "${workspaceRoot}/node_modules/vitest/vitest.mjs", 12 | "args": ["run", "${relativeFile}"], 13 | "smartStep": true, 14 | "console": "integratedTerminal" 15 | } 16 | ] 17 | } 18 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | selectable-grid 3 |

4 | 5 | ## Small description 6 | 7 | A React component library that allows you to select the desired area within a container and get the dimensions and coordinates of the selected area 8 | 9 | ## [Live demo](https://pisyukaev.github.io/selectable-grid/) 10 | * * * 11 | 12 | 13 | ## Example 14 | 15 | - Example for select area 16 | 17 | ![patrick](https://i.ibb.co/hBbts3M/patrik.gif) 18 | 19 | - Example for responsive grid 20 | 21 | ![responsive patrick](https://i.ibb.co/ypRYKYt/ezgif-com-gif-maker.webp) 22 | 23 | * * * 24 | 25 | ## Packages 26 | | Package | Version | Description | 27 | |---------|--------|-------------| 28 | | [selectable-grid](https://github.com/Pisyukaev/selectable-grid/tree/main/packages/selectable-grid) | [![NPM](https://img.shields.io/npm/v/selectable-grid.svg)](https://www.npmjs.com/package/selectable-grid) | Vanilla | 29 | | [@selectable-grid/react](https://github.com/Pisyukaev/selectable-grid/tree/main/packages/react) | [![NPM](https://img.shields.io/npm/v/selectable-grid.svg)](https://www.npmjs.com/package/@selectable-grid/react) | React | 30 | | [@selectable-grid/vue](https://github.com/Pisyukaev/selectable-grid/tree/main/packages/vue) | [![NPM](https://img.shields.io/npm/v/selectable-grid.svg)](https://www.npmjs.com/package/@selectable-grid/vue) | Vue | 31 | 32 | ## License 33 | 34 | MIT © [Pisyukaev](https://github.com/Pisyukaev) 35 | -------------------------------------------------------------------------------- /examples/react/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | @selectable-grid/react 8 | 9 | 10 |
11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /examples/react/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "example-react", 3 | "private": true, 4 | "version": "0.0.0", 5 | "scripts": { 6 | "dev": "vite", 7 | "build": "vite build" 8 | }, 9 | "dependencies": { 10 | "@selectable-grid/react": "workspace:*", 11 | "react": "18.2.0", 12 | "react-dom": "18.2.0" 13 | }, 14 | "devDependencies": { 15 | "@types/react": "18.0.26", 16 | "@types/react-dom": "18.0.10", 17 | "@vitejs/plugin-react": "3.0.1", 18 | "typescript": "4.9.4", 19 | "vite": "4.0.4" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /examples/react/public/spanch-bob.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pisyukaev/selectable-grid/eb67ae9b7e9ba33f914087bd2398bbf154ff9f88/examples/react/public/spanch-bob.webp -------------------------------------------------------------------------------- /examples/react/src/App.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import SelectableGrid from '@selectable-grid/react' 3 | 4 | const App = () => { 5 | return ( 6 |
7 | 16 |
17 | ) 18 | } 19 | 20 | export default App 21 | -------------------------------------------------------------------------------- /examples/react/src/index.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import { createRoot } from 'react-dom/client' 3 | 4 | import App from './App' 5 | 6 | const app = document.getElementById('app') 7 | 8 | createRoot(app).render( 9 | 10 | 11 | 12 | ) 13 | -------------------------------------------------------------------------------- /examples/react/src/vite-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | -------------------------------------------------------------------------------- /examples/react/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "jsx": "react", 4 | "moduleResolution": "node", 5 | "esModuleInterop": true, 6 | "noUncheckedIndexedAccess": false, 7 | "outDir": "dist", 8 | "target": "ES2015" 9 | }, 10 | "include": ["src"] 11 | } 12 | -------------------------------------------------------------------------------- /examples/react/vite.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vite' 2 | import react from '@vitejs/plugin-react' 3 | 4 | // https://vitejs.dev/config/ 5 | export default defineConfig({ 6 | plugins: [react()] 7 | }) 8 | -------------------------------------------------------------------------------- /examples/vanilla/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | selectable-grid 9 | 10 | 11 |
12 |
13 | 14 |
15 |
16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /examples/vanilla/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "example-vanilla", 3 | "private": true, 4 | "version": "0.0.0", 5 | "type": "module", 6 | "scripts": { 7 | "dev": "vite", 8 | "build": "tsc && vite build", 9 | "preview": "vite preview" 10 | }, 11 | "dependencies": { 12 | "selectable-grid": "workspace:*" 13 | }, 14 | "devDependencies": { 15 | "typescript": "4.9.4", 16 | "vite": "4.0.4" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /examples/vanilla/src/index.ts: -------------------------------------------------------------------------------- 1 | import SelectableGrid from 'selectable-grid' 2 | 3 | const init = () => { 4 | const img = document.querySelector('img') 5 | 6 | if (!img) { 7 | return 8 | } 9 | 10 | img.addEventListener('load', () => { 11 | // eslint-disable-next-line no-new 12 | new SelectableGrid({ 13 | container: img, 14 | cellCount: 15, 15 | mouseDown: () => { 16 | console.log('down') 17 | }, 18 | mouseMove: () => { 19 | console.log('move') 20 | }, 21 | mouseUp: () => { 22 | console.log('up') 23 | }, 24 | gridStyles: { 25 | strokeStyle: '#000' 26 | }, 27 | // cellsStyles: { 28 | // fillStyle: '#ff0000' 29 | // } 30 | areaStyles: { 31 | // fillStyle: '#ff0000', 32 | strokeStyle: '#0000ff' 33 | } 34 | }) 35 | }) 36 | } 37 | 38 | init() 39 | -------------------------------------------------------------------------------- /examples/vanilla/src/style.css: -------------------------------------------------------------------------------- 1 | #app { 2 | display: flex; 3 | flex-direction: column; 4 | justify-content: center; 5 | align-items: center; 6 | } 7 | 8 | .img-container { 9 | position: relative; 10 | resize: both; 11 | overflow: scroll; 12 | } 13 | 14 | #img { 15 | width: 100%; 16 | } 17 | -------------------------------------------------------------------------------- /examples/vanilla/src/vite-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | -------------------------------------------------------------------------------- /examples/vanilla/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ESNext", 4 | "useDefineForClassFields": true, 5 | "module": "ESNext", 6 | "lib": ["ESNext", "DOM"], 7 | "moduleResolution": "Node", 8 | "strict": true, 9 | "sourceMap": true, 10 | "resolveJsonModule": true, 11 | "isolatedModules": true, 12 | "esModuleInterop": true, 13 | "noEmit": true, 14 | "noUnusedLocals": true, 15 | "noUnusedParameters": true, 16 | "noImplicitReturns": true, 17 | "skipLibCheck": true 18 | }, 19 | "include": ["src"] 20 | } 21 | -------------------------------------------------------------------------------- /examples/vue/README.md: -------------------------------------------------------------------------------- 1 | # . 2 | 3 | This template should help get you started developing with Vue 3 in Vite. 4 | 5 | ## Recommended IDE Setup 6 | 7 | [VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur) + [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin). 8 | 9 | ## Type Support for `.vue` Imports in TS 10 | 11 | TypeScript cannot handle type information for `.vue` imports by default, so we replace the `tsc` CLI with `vue-tsc` for type checking. In editors, we need [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin) to make the TypeScript language service aware of `.vue` types. 12 | 13 | If the standalone TypeScript plugin doesn't feel fast enough to you, Volar has also implemented a [Take Over Mode](https://github.com/johnsoncodehk/volar/discussions/471#discussioncomment-1361669) that is more performant. You can enable it by the following steps: 14 | 15 | 1. Disable the built-in TypeScript Extension 16 | 1) Run `Extensions: Show Built-in Extensions` from VSCode's command palette 17 | 2) Find `TypeScript and JavaScript Language Features`, right click and select `Disable (Workspace)` 18 | 2. Reload the VSCode window by running `Developer: Reload Window` from the command palette. 19 | 20 | ## Customize configuration 21 | 22 | See [Vite Configuration Reference](https://vitejs.dev/config/). 23 | 24 | ## Project Setup 25 | 26 | ```sh 27 | pnpm install 28 | ``` 29 | 30 | ### Compile and Hot-Reload for Development 31 | 32 | ```sh 33 | pnpm dev 34 | ``` 35 | 36 | ### Type-Check, Compile and Minify for Production 37 | 38 | ```sh 39 | pnpm build 40 | ``` 41 | 42 | ### Lint with [ESLint](https://eslint.org/) 43 | 44 | ```sh 45 | pnpm lint 46 | ``` 47 | -------------------------------------------------------------------------------- /examples/vue/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | @selectable-grid/vue 8 | 9 | 10 |
11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /examples/vue/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "example-vue", 3 | "private": true, 4 | "version": "0.0.0", 5 | "scripts": { 6 | "dev": "vite", 7 | "build": "vite build", 8 | "preview": "vite preview" 9 | }, 10 | "dependencies": { 11 | "@selectable-grid/vue": "workspace:*", 12 | "vue": "3.2.45" 13 | }, 14 | "devDependencies": { 15 | "@vitejs/plugin-vue": "4.0.0", 16 | "@vitejs/plugin-vue-jsx": "^3.0.0", 17 | "@vue/tsconfig": "0.1.3", 18 | "typescript": "4.9.4", 19 | "vite": "4.0.4" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /examples/vue/src/App.vue: -------------------------------------------------------------------------------- 1 | 19 | 20 | 25 | 26 | 31 | -------------------------------------------------------------------------------- /examples/vue/src/assets/base.css: -------------------------------------------------------------------------------- 1 | /* color palette from */ 2 | :root { 3 | --vt-c-white: #ffffff; 4 | --vt-c-white-soft: #f8f8f8; 5 | --vt-c-white-mute: #f2f2f2; 6 | 7 | --vt-c-black: #181818; 8 | --vt-c-black-soft: #222222; 9 | --vt-c-black-mute: #282828; 10 | 11 | --vt-c-indigo: #2c3e50; 12 | 13 | --vt-c-divider-light-1: rgba(60, 60, 60, 0.29); 14 | --vt-c-divider-light-2: rgba(60, 60, 60, 0.12); 15 | --vt-c-divider-dark-1: rgba(84, 84, 84, 0.65); 16 | --vt-c-divider-dark-2: rgba(84, 84, 84, 0.48); 17 | 18 | --vt-c-text-light-1: var(--vt-c-indigo); 19 | --vt-c-text-light-2: rgba(60, 60, 60, 0.66); 20 | --vt-c-text-dark-1: var(--vt-c-white); 21 | --vt-c-text-dark-2: rgba(235, 235, 235, 0.64); 22 | } 23 | 24 | /* semantic color variables for this project */ 25 | :root { 26 | --color-background: var(--vt-c-white); 27 | --color-background-soft: var(--vt-c-white-soft); 28 | --color-background-mute: var(--vt-c-white-mute); 29 | 30 | --color-border: var(--vt-c-divider-light-2); 31 | --color-border-hover: var(--vt-c-divider-light-1); 32 | 33 | --color-heading: var(--vt-c-text-light-1); 34 | --color-text: var(--vt-c-text-light-1); 35 | 36 | --section-gap: 160px; 37 | } 38 | 39 | @media (prefers-color-scheme: dark) { 40 | :root { 41 | --color-background: var(--vt-c-black); 42 | --color-background-soft: var(--vt-c-black-soft); 43 | --color-background-mute: var(--vt-c-black-mute); 44 | 45 | --color-border: var(--vt-c-divider-dark-2); 46 | --color-border-hover: var(--vt-c-divider-dark-1); 47 | 48 | --color-heading: var(--vt-c-text-dark-1); 49 | --color-text: var(--vt-c-text-dark-2); 50 | } 51 | } 52 | 53 | *, 54 | *::before, 55 | *::after { 56 | box-sizing: border-box; 57 | margin: 0; 58 | position: relative; 59 | font-weight: normal; 60 | } 61 | 62 | body { 63 | min-height: 100vh; 64 | color: var(--color-text); 65 | background: var(--color-background); 66 | transition: color 0.5s, background-color 0.5s; 67 | line-height: 1.6; 68 | font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, 69 | Cantarell, 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif; 70 | font-size: 15px; 71 | text-rendering: optimizeLegibility; 72 | -webkit-font-smoothing: antialiased; 73 | -moz-osx-font-smoothing: grayscale; 74 | } 75 | -------------------------------------------------------------------------------- /examples/vue/src/assets/logo.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /examples/vue/src/assets/main.css: -------------------------------------------------------------------------------- 1 | @import './base.css'; 2 | 3 | #app { 4 | max-width: 1280px; 5 | margin: 0 auto; 6 | padding: 2rem; 7 | 8 | font-weight: normal; 9 | } 10 | 11 | a, 12 | .green { 13 | text-decoration: none; 14 | color: hsla(160, 100%, 37%, 1); 15 | transition: 0.4s; 16 | } 17 | 18 | @media (hover: hover) { 19 | a:hover { 20 | background-color: hsla(160, 100%, 37%, 0.2); 21 | } 22 | } 23 | 24 | @media (min-width: 1024px) { 25 | body { 26 | display: flex; 27 | place-items: center; 28 | } 29 | 30 | #app { 31 | display: grid; 32 | grid-template-columns: 1fr 1fr; 33 | padding: 0 2rem; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /examples/vue/src/main.ts: -------------------------------------------------------------------------------- 1 | import { createApp } from "vue"; 2 | import App from "./App.vue"; 3 | 4 | import "./assets/main.css"; 5 | 6 | createApp(App).mount("#app"); 7 | -------------------------------------------------------------------------------- /examples/vue/src/vite-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | 3 | declare module '*.vue' { 4 | import type { DefineComponent } from 'vue' 5 | const component: DefineComponent<{}, {}, any> 6 | export default component 7 | } 8 | -------------------------------------------------------------------------------- /examples/vue/tsconfig.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@vue/tsconfig/tsconfig.node.json", 3 | "include": ["vite.config.*", "vitest.config.*"], 4 | "compilerOptions": { 5 | "composite": true, 6 | "types": ["node"] 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /examples/vue/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@vue/tsconfig/tsconfig.web.json", 3 | "include": ["env.d.ts", "src/**/*", "src/**/*.vue"], 4 | "compilerOptions": { 5 | "baseUrl": ".", 6 | "paths": { 7 | "@/*": ["./src/*"] 8 | } 9 | }, 10 | 11 | "references": [ 12 | { 13 | "path": "./tsconfig.config.json" 14 | } 15 | ] 16 | } 17 | -------------------------------------------------------------------------------- /examples/vue/vite.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from "vite"; 2 | import vue from "@vitejs/plugin-vue"; 3 | import vueJsx from "@vitejs/plugin-vue-jsx"; 4 | 5 | // https://vitejs.dev/config/ 6 | export default defineConfig({ 7 | plugins: [vue(), vueJsx()] 8 | }); 9 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@selectable-grid/monorepo", 3 | "version": "1.1.4", 4 | "private": true, 5 | "description": "selectable-grid", 6 | "author": "Pisyukaev", 7 | "license": "MIT", 8 | "repository": "Pisyukaev/selectable-grid", 9 | "packageManager": "pnpm@7.5.0", 10 | "workspaces": [ 11 | "packages/*", 12 | "apps/*" 13 | ], 14 | "scripts": { 15 | "dev": "turbo run dev --filter=./packages/*", 16 | "build": "turbo run build --filter=./packages/*", 17 | "dev:website": "turbo run dev --filter=./website", 18 | "build:website": "turbo run build --filter=./website", 19 | "dev:examples": "turbo run dev --filter=./examples/*", 20 | "build:examples": "turbo run build --filter=./examples/*", 21 | "prepare": "pnpm build" 22 | }, 23 | "devDependencies": { 24 | "@babel/eslint-parser": "7.19.1", 25 | "@testing-library/jest-dom": "5.16.5", 26 | "@testing-library/user-event": "14.4.3", 27 | "@types/node": "18.11.18", 28 | "@typescript-eslint/eslint-plugin": "5.48.1", 29 | "@typescript-eslint/parser": "5.48.1", 30 | "@vitest/ui": "0.27.1", 31 | "eslint": "8.31.0", 32 | "eslint-config-prettier": "8.6.0", 33 | "eslint-config-standard": "17.0.0", 34 | "eslint-plugin-import": "2.27.4", 35 | "eslint-plugin-node": "11.1.0", 36 | "eslint-plugin-prettier": "4.2.1", 37 | "eslint-plugin-promise": "6.1.1", 38 | "eslint-plugin-react": "7.32.0", 39 | "eslint-plugin-react-hooks": "4.6.0", 40 | "jsdom": "21.0.0", 41 | "prettier": "2.8.2", 42 | "turbo": "1.7.0", 43 | "typescript": "4.9.4", 44 | "vitest": "0.27.1" 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /packages/react/README.md: -------------------------------------------------------------------------------- 1 | # @selectable-grid/react 2 | 3 | ## Install 4 | 5 | ```bash 6 | npm install --save @selectable-grid/react 7 | ``` 8 | 9 | ## Usage example 10 | 11 | ```jsx 12 | import React from 'react' 13 | import SelectableGrid from '@selectable-grid/react' 14 | 15 | const App = () => { 16 | return ( 17 |
18 | 25 |
26 | ) 27 | } 28 | 29 | export default App 30 | ``` 31 | 32 | ## Properties 33 | 34 | | Property | Required | Type | Description | 35 | |----------|----------|------|-------------| 36 | | `type` | `true` | `'img'` \| `'video'` | name of html tag | 37 | | `containerProps` | `true` | `object` | if prop `type` is equal `'img'` `containerProps` is HTML Attributes of the `` tag, else prop `type` is equal `'video'` `containerProps` is HTML Attributes of the `