diff --git a/.storybook/main.ts b/.storybook/main.ts index caa3123..61d497e 100644 --- a/.storybook/main.ts +++ b/.storybook/main.ts @@ -15,7 +15,10 @@ const config: StorybookConfig = { const newConfig = mergeConfig(config, { css: { postcss: { - plugins: [tailwindcss(), autoprefixer()], + plugins: [ + tailwindcss({ config: './tailwind.storybook.config.ts' }), + autoprefixer(), + ], }, }, build: { diff --git a/.storybook/storybook.css b/.storybook/storybook.css index e984168..03fdbd3 100644 --- a/.storybook/storybook.css +++ b/.storybook/storybook.css @@ -1,3 +1,9 @@ +html, +body, #storybook-root { height: 100%; } + +@tailwind base; +@tailwind components; +@tailwind utilities; diff --git a/package-lock.json b/package-lock.json index 5b93d0a..d225356 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,22 +1,24 @@ { "name": "@koupr/ui", - "version": "1.10.3", + "version": "1.10.4", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@koupr/ui", - "version": "1.10.3", + "version": "1.10.4", "license": "MIT", "dependencies": { "@chakra-ui/react": "2.10.3", - "@chakra-ui/system": "2.6.2", "@chakra-ui/theme-tools": "2.2.6", "@emotion/css": "11.13.4", "@emotion/react": "11.13.3", "@emotion/styled": "11.13.0", + "chakra-react-select": "5.0.2", "classnames": "2.5.1", + "dateformat": "5.0.3", "framer-motion": "11.11.11", + "javascript-time-ago": "2.5.11", "react": "18.3.1", "react-dom": "18.3.1", "react-router-dom": "6.27.0" @@ -25,7 +27,6 @@ "@rollup/plugin-commonjs": "28.0.1", "@rollup/plugin-node-resolve": "15.3.0", "@rollup/plugin-strip": "3.0.4", - "@rollup/plugin-terser": "0.4.4", "@rollup/plugin-typescript": "12.1.1", "@rollup/pluginutils": "5.1.3", "@storybook/addon-controls": "8.4.1", @@ -34,6 +35,7 @@ "@storybook/react-vite": "8.4.1", "@storybook/test": "8.4.1", "@trivago/prettier-plugin-sort-imports": "4.3.0", + "@types/dateformat": "5.0.2", "@types/react": "18.3.12", "@types/react-dom": "18.3.1", "autoprefixer": "10.4.20", @@ -61,6 +63,21 @@ }, "engines": { "node": ">=20.x" + }, + "peerDependencies": { + "@chakra-ui/react": ">= 2.10.3 < 3.0.0", + "@chakra-ui/theme-tools": ">= 2.2.6 < 3.0.0", + "@emotion/css": ">= 11.13.4 < 12.0.0", + "@emotion/react": ">= 11.13.3 < 12.0.0", + "@emotion/styled": ">= 11.13.0 < 12.0.0", + "chakra-react-select": ">= 5.0.2 < 6.0.0", + "classnames": ">= 2.5.1 < 3.0.0", + "dateformat": ">= 5.0.3 < 6.0.0", + "framer-motion": ">= 11.11.11 < 12.0.0", + "javascript-time-ago": ">= 2.5.11 < 3.0.0", + "react": ">= 18.3.1 < 19.0.0", + "react-dom": ">= 18.3.1 < 19.0.0", + "react-router-dom": ">= 6.27.0 < 7.0.0" } }, "node_modules/@adobe/css-tools": { @@ -405,18 +422,6 @@ "integrity": "sha512-fFIYN7L276gw0Q7/ikMMlZxP7mvnjRaWJ7f3Jsf9VtDOi6eAYIBRrhQe6+SZ0PGmoOkRaBc7gSE5oeIbgFFyrw==", "license": "MIT" }, - "node_modules/@chakra-ui/color-mode": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/@chakra-ui/color-mode/-/color-mode-2.2.0.tgz", - "integrity": "sha512-niTEA8PALtMWRI9wJ4LL0CSBDo8NBfLNp4GD6/0hstcm3IlbBHTVKxN6HwSaoNYfphDQLxCjT4yG+0BJA5tFpg==", - "license": "MIT", - "dependencies": { - "@chakra-ui/react-use-safe-layout-effect": "2.1.0" - }, - "peerDependencies": { - "react": ">=18" - } - }, "node_modules/@chakra-ui/hooks": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/@chakra-ui/hooks/-/hooks-2.4.2.tgz", @@ -432,12 +437,6 @@ "react": ">=18" } }, - "node_modules/@chakra-ui/object-utils": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/@chakra-ui/object-utils/-/object-utils-2.1.0.tgz", - "integrity": "sha512-tgIZOgLHaoti5PYGPTwK3t/cqtcycW0owaiOXoZOcpwwX/vlVb+H1jFsQyWiiwQVPt9RkoSLtxzXamx+aHH+bQ==", - "license": "MIT" - }, "node_modules/@chakra-ui/react": { "version": "2.10.3", "resolved": "https://registry.npmjs.org/@chakra-ui/react/-/react-2.10.3.tgz", @@ -463,54 +462,6 @@ "react-dom": ">=18" } }, - "node_modules/@chakra-ui/react-use-safe-layout-effect": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/@chakra-ui/react-use-safe-layout-effect/-/react-use-safe-layout-effect-2.1.0.tgz", - "integrity": "sha512-Knbrrx/bcPwVS1TorFdzrK/zWA8yuU/eaXDkNj24IrKoRlQrSBFarcgAEzlCHtzuhufP3OULPkELTzz91b0tCw==", - "license": "MIT", - "peerDependencies": { - "react": ">=18" - } - }, - "node_modules/@chakra-ui/react-utils": { - "version": "2.0.12", - "resolved": "https://registry.npmjs.org/@chakra-ui/react-utils/-/react-utils-2.0.12.tgz", - "integrity": "sha512-GbSfVb283+YA3kA8w8xWmzbjNWk14uhNpntnipHCftBibl0lxtQ9YqMFQLwuFOO0U2gYVocszqqDWX+XNKq9hw==", - "license": "MIT", - "dependencies": { - "@chakra-ui/utils": "2.0.15" - }, - "peerDependencies": { - "react": ">=18" - } - }, - "node_modules/@chakra-ui/react-utils/node_modules/@chakra-ui/utils": { - "version": "2.0.15", - "resolved": "https://registry.npmjs.org/@chakra-ui/utils/-/utils-2.0.15.tgz", - "integrity": "sha512-El4+jL0WSaYYs+rJbuYFDbjmfCcfGDmRY95GO4xwzit6YAPZBLcR65rOEwLps+XWluZTy1xdMrusg/hW0c1aAA==", - "license": "MIT", - "dependencies": { - "@types/lodash.mergewith": "4.6.7", - "css-box-model": "1.2.1", - "framesync": "6.1.2", - "lodash.mergewith": "4.6.2" - } - }, - "node_modules/@chakra-ui/react-utils/node_modules/@types/lodash.mergewith": { - "version": "4.6.7", - "resolved": "https://registry.npmjs.org/@types/lodash.mergewith/-/lodash.mergewith-4.6.7.tgz", - "integrity": "sha512-3m+lkO5CLRRYU0fhGRp7zbsGi6+BZj0uTVSwvcKU+nSlhjA9/QRNfuSGnD2mX6hQA7ZbmcCkzk5h4ZYGOtk14A==", - "license": "MIT", - "dependencies": { - "@types/lodash": "*" - } - }, - "node_modules/@chakra-ui/shared-utils": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/@chakra-ui/shared-utils/-/shared-utils-2.0.5.tgz", - "integrity": "sha512-4/Wur0FqDov7Y0nCXl7HbHzCg4aq86h+SXdoUeuCMD3dSj7dpsVnStLYhng1vxvlbUnLpdF4oz5Myt3i/a7N3Q==", - "license": "MIT" - }, "node_modules/@chakra-ui/styled-system": { "version": "2.12.0", "resolved": "https://registry.npmjs.org/@chakra-ui/styled-system/-/styled-system-2.12.0.tgz", @@ -521,58 +472,6 @@ "csstype": "^3.1.2" } }, - "node_modules/@chakra-ui/system": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/@chakra-ui/system/-/system-2.6.2.tgz", - "integrity": "sha512-EGtpoEjLrUu4W1fHD+a62XR+hzC5YfsWm+6lO0Kybcga3yYEij9beegO0jZgug27V+Rf7vns95VPVP6mFd/DEQ==", - "license": "MIT", - "dependencies": { - "@chakra-ui/color-mode": "2.2.0", - "@chakra-ui/object-utils": "2.1.0", - "@chakra-ui/react-utils": "2.0.12", - "@chakra-ui/styled-system": "2.9.2", - "@chakra-ui/theme-utils": "2.0.21", - "@chakra-ui/utils": "2.0.15", - "react-fast-compare": "3.2.2" - }, - "peerDependencies": { - "@emotion/react": "^11.0.0", - "@emotion/styled": "^11.0.0", - "react": ">=18" - } - }, - "node_modules/@chakra-ui/system/node_modules/@chakra-ui/styled-system": { - "version": "2.9.2", - "resolved": "https://registry.npmjs.org/@chakra-ui/styled-system/-/styled-system-2.9.2.tgz", - "integrity": "sha512-To/Z92oHpIE+4nk11uVMWqo2GGRS86coeMmjxtpnErmWRdLcp1WVCVRAvn+ZwpLiNR+reWFr2FFqJRsREuZdAg==", - "license": "MIT", - "dependencies": { - "@chakra-ui/shared-utils": "2.0.5", - "csstype": "^3.1.2", - "lodash.mergewith": "4.6.2" - } - }, - "node_modules/@chakra-ui/system/node_modules/@chakra-ui/utils": { - "version": "2.0.15", - "resolved": "https://registry.npmjs.org/@chakra-ui/utils/-/utils-2.0.15.tgz", - "integrity": "sha512-El4+jL0WSaYYs+rJbuYFDbjmfCcfGDmRY95GO4xwzit6YAPZBLcR65rOEwLps+XWluZTy1xdMrusg/hW0c1aAA==", - "license": "MIT", - "dependencies": { - "@types/lodash.mergewith": "4.6.7", - "css-box-model": "1.2.1", - "framesync": "6.1.2", - "lodash.mergewith": "4.6.2" - } - }, - "node_modules/@chakra-ui/system/node_modules/@types/lodash.mergewith": { - "version": "4.6.7", - "resolved": "https://registry.npmjs.org/@types/lodash.mergewith/-/lodash.mergewith-4.6.7.tgz", - "integrity": "sha512-3m+lkO5CLRRYU0fhGRp7zbsGi6+BZj0uTVSwvcKU+nSlhjA9/QRNfuSGnD2mX6hQA7ZbmcCkzk5h4ZYGOtk14A==", - "license": "MIT", - "dependencies": { - "@types/lodash": "*" - } - }, "node_modules/@chakra-ui/theme": { "version": "3.4.6", "resolved": "https://registry.npmjs.org/@chakra-ui/theme/-/theme-3.4.6.tgz", @@ -601,63 +500,6 @@ "@chakra-ui/styled-system": ">=2.0.0" } }, - "node_modules/@chakra-ui/theme-utils": { - "version": "2.0.21", - "resolved": "https://registry.npmjs.org/@chakra-ui/theme-utils/-/theme-utils-2.0.21.tgz", - "integrity": "sha512-FjH5LJbT794r0+VSCXB3lT4aubI24bLLRWB+CuRKHijRvsOg717bRdUN/N1fEmEpFnRVrbewttWh/OQs0EWpWw==", - "license": "MIT", - "dependencies": { - "@chakra-ui/shared-utils": "2.0.5", - "@chakra-ui/styled-system": "2.9.2", - "@chakra-ui/theme": "3.3.1", - "lodash.mergewith": "4.6.2" - } - }, - "node_modules/@chakra-ui/theme-utils/node_modules/@chakra-ui/anatomy": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/@chakra-ui/anatomy/-/anatomy-2.2.2.tgz", - "integrity": "sha512-MV6D4VLRIHr4PkW4zMyqfrNS1mPlCTiCXwvYGtDFQYr+xHFfonhAuf9WjsSc0nyp2m0OdkSLnzmVKkZFLo25Tg==", - "license": "MIT" - }, - "node_modules/@chakra-ui/theme-utils/node_modules/@chakra-ui/styled-system": { - "version": "2.9.2", - "resolved": "https://registry.npmjs.org/@chakra-ui/styled-system/-/styled-system-2.9.2.tgz", - "integrity": "sha512-To/Z92oHpIE+4nk11uVMWqo2GGRS86coeMmjxtpnErmWRdLcp1WVCVRAvn+ZwpLiNR+reWFr2FFqJRsREuZdAg==", - "license": "MIT", - "dependencies": { - "@chakra-ui/shared-utils": "2.0.5", - "csstype": "^3.1.2", - "lodash.mergewith": "4.6.2" - } - }, - "node_modules/@chakra-ui/theme-utils/node_modules/@chakra-ui/theme": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/@chakra-ui/theme/-/theme-3.3.1.tgz", - "integrity": "sha512-Hft/VaT8GYnItGCBbgWd75ICrIrIFrR7lVOhV/dQnqtfGqsVDlrztbSErvMkoPKt0UgAkd9/o44jmZ6X4U2nZQ==", - "license": "MIT", - "dependencies": { - "@chakra-ui/anatomy": "2.2.2", - "@chakra-ui/shared-utils": "2.0.5", - "@chakra-ui/theme-tools": "2.1.2" - }, - "peerDependencies": { - "@chakra-ui/styled-system": ">=2.8.0" - } - }, - "node_modules/@chakra-ui/theme-utils/node_modules/@chakra-ui/theme-tools": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/@chakra-ui/theme-tools/-/theme-tools-2.1.2.tgz", - "integrity": "sha512-Qdj8ajF9kxY4gLrq7gA+Azp8CtFHGO9tWMN2wfF9aQNgG9AuMhPrUzMq9AMQ0MXiYcgNq/FD3eegB43nHVmXVA==", - "license": "MIT", - "dependencies": { - "@chakra-ui/anatomy": "2.2.2", - "@chakra-ui/shared-utils": "2.0.5", - "color2k": "^2.0.2" - }, - "peerDependencies": { - "@chakra-ui/styled-system": ">=2.0.0" - } - }, "node_modules/@chakra-ui/utils": { "version": "2.2.2", "resolved": "https://registry.npmjs.org/@chakra-ui/utils/-/utils-2.2.2.tgz", @@ -1375,6 +1217,31 @@ "node": "^18.18.0 || ^20.9.0 || >=21.1.0" } }, + "node_modules/@floating-ui/core": { + "version": "1.6.8", + "resolved": "https://registry.npmjs.org/@floating-ui/core/-/core-1.6.8.tgz", + "integrity": "sha512-7XJ9cPU+yI2QeLS+FCSlqNFZJq8arvswefkZrYI1yQBbftw6FyrZOxYSh+9S7z7TpeWlRt9zJ5IhM1WIL334jA==", + "license": "MIT", + "dependencies": { + "@floating-ui/utils": "^0.2.8" + } + }, + "node_modules/@floating-ui/dom": { + "version": "1.6.12", + "resolved": "https://registry.npmjs.org/@floating-ui/dom/-/dom-1.6.12.tgz", + "integrity": "sha512-NP83c0HjokcGVEMeoStg317VD9W7eDlGK7457dMBANbKA6GJZdc7rjujdgqzTaz93jkGgc5P/jeWbaCHnMNc+w==", + "license": "MIT", + "dependencies": { + "@floating-ui/core": "^1.6.0", + "@floating-ui/utils": "^0.2.8" + } + }, + "node_modules/@floating-ui/utils": { + "version": "0.2.8", + "resolved": "https://registry.npmjs.org/@floating-ui/utils/-/utils-0.2.8.tgz", + "integrity": "sha512-kym7SodPp8/wloecOpcmSnWJsK7M0E5Wg8UcFA+uO4B9s5d0ywXOEro/8HM9x0rW+TljRzul/14UYz3TleT3ig==", + "license": "MIT" + }, "node_modules/@humanfs/core": { "version": "0.19.1", "resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.1.tgz", @@ -1532,6 +1399,8 @@ "integrity": "sha512-1ZJTZebgqllO79ue2bm3rIGud/bOe0pP5BjSRCRxxYkEZS8STV7zN84UBbiYu7jy+eCKSnVIUgoWWE/tt+shMQ==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "@jridgewell/gen-mapping": "^0.3.5", "@jridgewell/trace-mapping": "^0.3.25" @@ -1727,29 +1596,6 @@ } } }, - "node_modules/@rollup/plugin-terser": { - "version": "0.4.4", - "resolved": "https://registry.npmjs.org/@rollup/plugin-terser/-/plugin-terser-0.4.4.tgz", - "integrity": "sha512-XHeJC5Bgvs8LfukDwWZp7yeqin6ns8RTl2B9avbejt6tZqsqvVoWI7ZTQrcNsfKEDWBTnTxM8nMDkO2IFFbd0A==", - "dev": true, - "license": "MIT", - "dependencies": { - "serialize-javascript": "^6.0.1", - "smob": "^1.0.0", - "terser": "^5.17.4" - }, - "engines": { - "node": ">=14.0.0" - }, - "peerDependencies": { - "rollup": "^2.0.0||^3.0.0||^4.0.0" - }, - "peerDependenciesMeta": { - "rollup": { - "optional": true - } - } - }, "node_modules/@rollup/plugin-typescript": { "version": "12.1.1", "resolved": "https://registry.npmjs.org/@rollup/plugin-typescript/-/plugin-typescript-12.1.1.tgz", @@ -2848,6 +2694,13 @@ "@babel/types": "^7.20.7" } }, + "node_modules/@types/dateformat": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/@types/dateformat/-/dateformat-5.0.2.tgz", + "integrity": "sha512-M95hNBMa/hnwErH+a+VOD/sYgTmo15OTYTM2Hr52/e0OdOuY+Crag+kd3/ioZrhg0WGbl9Sm3hR7UU+MH6rfOw==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/doctrine": { "version": "0.0.9", "resolved": "https://registry.npmjs.org/@types/doctrine/-/doctrine-0.0.9.tgz", @@ -2929,14 +2782,12 @@ "version": "15.7.13", "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.13.tgz", "integrity": "sha512-hCZTSvwbzWGvhqxp/RqVqwU999pBf2vp7hzIjiYOsl8wqOmUxkQ6ddw1cV3l8811+kdUFus/q4d1Y3E3SyEifA==", - "devOptional": true, "license": "MIT" }, "node_modules/@types/react": { "version": "18.3.12", "resolved": "https://registry.npmjs.org/@types/react/-/react-18.3.12.tgz", "integrity": "sha512-D2wOSq/d6Agt28q7rSI3jhU7G6aiuzljDGZ2hTZHIkrTLUI+AF3WMeKkEZ9nN2fkBAlcktT6vcZjDFiIhMYEQw==", - "devOptional": true, "license": "MIT", "dependencies": { "@types/prop-types": "*", @@ -2953,6 +2804,15 @@ "@types/react": "*" } }, + "node_modules/@types/react-transition-group": { + "version": "4.4.11", + "resolved": "https://registry.npmjs.org/@types/react-transition-group/-/react-transition-group-4.4.11.tgz", + "integrity": "sha512-RM05tAniPZ5DZPzzNFP+DmrcOdD0efDUxMy3145oljWSl3x9ZV5vhme98gTxFrj2lhXvmGNnUiuDyJgY9IKkNA==", + "license": "MIT", + "dependencies": { + "@types/react": "*" + } + }, "node_modules/@types/resolve": { "version": "1.20.2", "resolved": "https://registry.npmjs.org/@types/resolve/-/resolve-1.20.2.tgz", @@ -3799,7 +3659,9 @@ "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", "dev": true, - "license": "MIT" + "license": "MIT", + "optional": true, + "peer": true }, "node_modules/call-bind": { "version": "1.0.7", @@ -3891,6 +3753,21 @@ "node": ">=12" } }, + "node_modules/chakra-react-select": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/chakra-react-select/-/chakra-react-select-5.0.2.tgz", + "integrity": "sha512-DI82ICGya/yu99Np8Uk8rW14o4NIt45i4qHDm/h0eRFVTHsRJqE+My99A9cPGJ72V5tM/WK1EeWxYUxWxhzxkA==", + "license": "MIT", + "dependencies": { + "react-select": "5.8.x" + }, + "peerDependencies": { + "@chakra-ui/react": "2.x", + "@emotion/react": "^11.8.1", + "react": "^18.0.0", + "react-dom": "^18.0.0" + } + }, "node_modules/chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", @@ -4085,15 +3962,6 @@ "node": ">= 8" } }, - "node_modules/css-box-model": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/css-box-model/-/css-box-model-1.2.1.tgz", - "integrity": "sha512-a7Vr4Q/kd/aw96bnJG332W9V9LkJO69JRcaCYDUqjp6/z0w6VcZjgAcTbgFxEPfBgdnAwlh3iwu+hLopa+flJw==", - "license": "MIT", - "dependencies": { - "tiny-invariant": "^1.0.6" - } - }, "node_modules/css-declaration-sorter": { "version": "6.4.1", "resolved": "https://registry.npmjs.org/css-declaration-sorter/-/css-declaration-sorter-6.4.1.tgz", @@ -4333,6 +4201,15 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/dateformat": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-5.0.3.tgz", + "integrity": "sha512-Kvr6HmPXUMerlLcLF+Pwq3K7apHpYmGDVqrxcDasBg86UcKeTSNWbEzU8bwdXnxnR44FtMhJAxI4Bov6Y/KUfA==", + "license": "MIT", + "engines": { + "node": ">=12.20" + } + }, "node_modules/debug": { "version": "4.3.7", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz", @@ -4473,6 +4350,16 @@ "dev": true, "license": "MIT" }, + "node_modules/dom-helpers": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/dom-helpers/-/dom-helpers-5.2.1.tgz", + "integrity": "sha512-nRCa7CK3VTrM2NmGkIy4cbK7IZlgBE/PYMn55rrXefr5xXDP0LdtfPnblFDoVdcAfslJ7or6iqAUnx0CCGIWQA==", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.8.7", + "csstype": "^3.0.2" + } + }, "node_modules/dom-serializer": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-1.4.1.tgz", @@ -6353,6 +6240,15 @@ "dev": true, "license": "MIT" }, + "node_modules/javascript-time-ago": { + "version": "2.5.11", + "resolved": "https://registry.npmjs.org/javascript-time-ago/-/javascript-time-ago-2.5.11.tgz", + "integrity": "sha512-Zeyf5R7oM1fSMW9zsU3YgAYwE0bimEeF54Udn2ixGd8PUwu+z1Yc5t4Y8YScJDMHD6uCx6giLt3VJR5K4CMwbg==", + "license": "MIT", + "dependencies": { + "relative-time-format": "^1.1.6" + } + }, "node_modules/jiti": { "version": "1.21.6", "resolved": "https://registry.npmjs.org/jiti/-/jiti-1.21.6.tgz", @@ -6644,6 +6540,12 @@ "dev": true, "license": "CC0-1.0" }, + "node_modules/memoize-one": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/memoize-one/-/memoize-one-6.0.0.tgz", + "integrity": "sha512-rkpe71W0N0c0Xz6QD0eJETuWAJGnJ9afsl1srmwPrI+yBCkge5EycXXbYRyvL29zZVUWQCY7InPRCv3GDXuZNw==", + "license": "MIT" + }, "node_modules/memoizerific": { "version": "1.11.3", "resolved": "https://registry.npmjs.org/memoizerific/-/memoizerific-1.11.3.tgz", @@ -8068,16 +7970,6 @@ ], "license": "MIT" }, - "node_modules/randombytes": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", - "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "safe-buffer": "^5.1.0" - } - }, "node_modules/react": { "version": "18.3.1", "resolved": "https://registry.npmjs.org/react/-/react-18.3.1.tgz", @@ -8274,6 +8166,27 @@ "react-dom": ">=16.8" } }, + "node_modules/react-select": { + "version": "5.8.2", + "resolved": "https://registry.npmjs.org/react-select/-/react-select-5.8.2.tgz", + "integrity": "sha512-a/LkOckoI62710gGPQSQqUp7A10fGbH/ya3/IR49qaq3XoBvwymgD5mJgtiHxBDsutyEQfdKNycWVh8Cg8UCjw==", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.12.0", + "@emotion/cache": "^11.4.0", + "@emotion/react": "^11.8.1", + "@floating-ui/dom": "^1.0.1", + "@types/react-transition-group": "^4.4.0", + "memoize-one": "^6.0.0", + "prop-types": "^15.6.0", + "react-transition-group": "^4.3.0", + "use-isomorphic-layout-effect": "^1.1.2" + }, + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0 || ^18.0.0", + "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0" + } + }, "node_modules/react-style-singleton": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/react-style-singleton/-/react-style-singleton-2.2.1.tgz", @@ -8297,6 +8210,22 @@ } } }, + "node_modules/react-transition-group": { + "version": "4.4.5", + "resolved": "https://registry.npmjs.org/react-transition-group/-/react-transition-group-4.4.5.tgz", + "integrity": "sha512-pZcd1MCJoiKiBR2NRxeCRg13uCXbydPnmB4EOeRrY7480qNWO8IIgQG6zlDkm6uRMsURXPuKq0GWtiM59a5Q6g==", + "license": "BSD-3-Clause", + "dependencies": { + "@babel/runtime": "^7.5.5", + "dom-helpers": "^5.0.1", + "loose-envify": "^1.4.0", + "prop-types": "^15.6.2" + }, + "peerDependencies": { + "react": ">=16.6.0", + "react-dom": ">=16.6.0" + } + }, "node_modules/read-cache": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/read-cache/-/read-cache-1.0.0.tgz", @@ -8434,6 +8363,12 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/relative-time-format": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/relative-time-format/-/relative-time-format-1.1.6.tgz", + "integrity": "sha512-aCv3juQw4hT1/P/OrVltKWLlp15eW1GRcwP1XdxHrPdZE9MtgqFpegjnTjLhi2m2WI9MT/hQQtE+tjEWG1hgkQ==", + "license": "MIT" + }, "node_modules/resolve": { "version": "1.22.8", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz", @@ -8751,27 +8686,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "MIT" - }, "node_modules/safe-identifier": { "version": "0.4.2", "resolved": "https://registry.npmjs.org/safe-identifier/-/safe-identifier-0.4.2.tgz", @@ -8816,16 +8730,6 @@ "semver": "bin/semver.js" } }, - "node_modules/serialize-javascript": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.2.tgz", - "integrity": "sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g==", - "dev": true, - "license": "BSD-3-Clause", - "dependencies": { - "randombytes": "^2.1.0" - } - }, "node_modules/set-function-length": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz", @@ -8915,13 +8819,6 @@ "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/smob": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/smob/-/smob-1.5.0.tgz", - "integrity": "sha512-g6T+p7QO8npa+/hNx9ohv1E5pVCmWrVCUzUXJyLdMmftX6ER0oiWY/w9knEonLpnOp6b6FenKnMfR8gqwWdwig==", - "dev": true, - "license": "MIT" - }, "node_modules/source-map": { "version": "0.5.7", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", @@ -8947,6 +8844,8 @@ "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "buffer-from": "^1.0.0", "source-map": "^0.6.0" @@ -8958,6 +8857,8 @@ "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", "dev": true, "license": "BSD-3-Clause", + "optional": true, + "peer": true, "engines": { "node": ">=0.10.0" } @@ -9568,6 +9469,8 @@ "integrity": "sha512-IYV9eNMuFAV4THUspIRXkLakHnV6XO7FEdtKjf/mDyrnqUg9LnlOn6/RwRvM9SZjR4GUq8Nk8zj67FzVARr74w==", "dev": true, "license": "BSD-2-Clause", + "optional": true, + "peer": true, "dependencies": { "@jridgewell/source-map": "^0.3.3", "acorn": "^8.8.2", @@ -9586,7 +9489,9 @@ "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", "dev": true, - "license": "MIT" + "license": "MIT", + "optional": true, + "peer": true }, "node_modules/text-table": { "version": "0.2.0", @@ -9622,6 +9527,7 @@ "version": "1.3.3", "resolved": "https://registry.npmjs.org/tiny-invariant/-/tiny-invariant-1.3.3.tgz", "integrity": "sha512-+FbBPE1o9QAYvviau/qC5SE3caw21q3xkvWKBtja5vgqOWIHHJ3ioaq1VPfn/Szqctz2bU/oYeKd9/z5BL+PVg==", + "dev": true, "license": "MIT" }, "node_modules/tinyrainbow": { @@ -9990,6 +9896,20 @@ } } }, + "node_modules/use-isomorphic-layout-effect": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/use-isomorphic-layout-effect/-/use-isomorphic-layout-effect-1.1.2.tgz", + "integrity": "sha512-49L8yCO3iGT/ZF9QttjwLF/ZD9Iwto5LnH5LmEdk/6cFmXddqi2ulF0edxTwjj+7mqvpVVGQWvbXZdn32wRSHA==", + "license": "MIT", + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0 || ^18.0.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, "node_modules/use-sidecar": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/use-sidecar/-/use-sidecar-1.1.2.tgz", diff --git a/package.json b/package.json index 08a6e23..937060b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@koupr/ui", - "version": "1.10.3", + "version": "1.10.4", "license": "MIT", "type": "module", "source": "src/index.ts", @@ -24,22 +24,38 @@ }, "dependencies": { "@chakra-ui/react": "2.10.3", - "@chakra-ui/system": "2.6.2", "@chakra-ui/theme-tools": "2.2.6", "@emotion/css": "11.13.4", "@emotion/react": "11.13.3", "@emotion/styled": "11.13.0", + "chakra-react-select": "5.0.2", "classnames": "2.5.1", + "dateformat": "5.0.3", "framer-motion": "11.11.11", + "javascript-time-ago": "2.5.11", "react": "18.3.1", "react-dom": "18.3.1", "react-router-dom": "6.27.0" }, + "peerDependencies": { + "@chakra-ui/react": ">= 2.10.3 < 3.0.0", + "@chakra-ui/theme-tools": ">= 2.2.6 < 3.0.0", + "@emotion/css": ">= 11.13.4 < 12.0.0", + "@emotion/react": ">= 11.13.3 < 12.0.0", + "@emotion/styled": ">= 11.13.0 < 12.0.0", + "chakra-react-select": ">= 5.0.2 < 6.0.0", + "classnames": ">= 2.5.1 < 3.0.0", + "dateformat": ">= 5.0.3 < 6.0.0", + "framer-motion": ">= 11.11.11 < 12.0.0", + "javascript-time-ago": ">= 2.5.11 < 3.0.0", + "react": ">= 18.3.1 < 19.0.0", + "react-dom": ">= 18.3.1 < 19.0.0", + "react-router-dom": ">= 6.27.0 < 7.0.0" + }, "devDependencies": { "@rollup/plugin-commonjs": "28.0.1", "@rollup/plugin-node-resolve": "15.3.0", "@rollup/plugin-strip": "3.0.4", - "@rollup/plugin-terser": "0.4.4", "@rollup/plugin-typescript": "12.1.1", "@rollup/pluginutils": "5.1.3", "@storybook/addon-controls": "8.4.1", @@ -48,6 +64,7 @@ "@storybook/react-vite": "8.4.1", "@storybook/test": "8.4.1", "@trivago/prettier-plugin-sort-imports": "4.3.0", + "@types/dateformat": "5.0.2", "@types/react": "18.3.12", "@types/react-dom": "18.3.1", "autoprefixer": "10.4.20", diff --git a/rollup.config.js b/rollup.config.js index f3ced5f..c330416 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -1,7 +1,6 @@ import commonjs from '@rollup/plugin-commonjs' import resolve from '@rollup/plugin-node-resolve' import strip from '@rollup/plugin-strip' -import terser from '@rollup/plugin-terser' import typescript from '@rollup/plugin-typescript' import { createFilter } from '@rollup/pluginutils' import { createRequire } from 'module' @@ -49,8 +48,8 @@ export default [ ], external: [ '@chakra-ui/react', - '@chakra-ui/system', '@chakra-ui/theme-tools', + 'chakra-react-select', '@emotion/css', '@emotion/react', '@emotion/styled', @@ -64,15 +63,15 @@ export default [ peerDepsExternal(), resolve(), commonjs(), - typescript(), + typescript({ + tsconfig: 'tsconfig.rollup.json', + }), svg(), postcss({ extract: true, - minimize: true, }), injectCssImportPlugin(), strip(), - terser(), ], }, { diff --git a/src/components/account-menu.tsx b/src/components/account-menu.tsx index f662d30..3e972f9 100644 --- a/src/components/account-menu.tsx +++ b/src/components/account-menu.tsx @@ -9,7 +9,7 @@ import { Portal, SkeletonCircle, } from '@chakra-ui/react' -import { forwardRef } from '@chakra-ui/system' +import { forwardRef } from '@chakra-ui/react' import cx from 'classnames' import { truncateEnd, truncateMiddle } from '../helpers' import { variables } from '../variables' @@ -48,11 +48,11 @@ export const AccountMenu = ({
-
+
{name ? ( {truncateEnd(name, 50)} ) : null} {email ? ( - + {truncateMiddle(email, 50)} ) : null} @@ -110,7 +112,7 @@ type ActiveCircleProps = { const ActiveCircle = ({ isActive, children }: ActiveCircleProps) => ( {children} @@ -126,16 +128,22 @@ type AvatarButtonProps = { const AvatarButton = forwardRef( ({ name, picture, isActive, hasBadge, ...props }, ref) => ( -
+
diff --git a/src/components/app-bar.tsx b/src/components/app-bar.tsx index 5f3c683..c6b809b 100644 --- a/src/components/app-bar.tsx +++ b/src/components/app-bar.tsx @@ -9,19 +9,34 @@ export type AppBarProps = { export const AppBar = ({ bar, buttons }: AppBarProps) => (
-
+
{bar}
-
+
{buttons}
diff --git a/src/components/auxiliary-drawer.tsx b/src/components/auxiliary-drawer.tsx index c278076..883bba8 100644 --- a/src/components/auxiliary-drawer.tsx +++ b/src/components/auxiliary-drawer.tsx @@ -10,7 +10,7 @@ import { IconButton, } from '@chakra-ui/react' import cx from 'classnames' -import { NotificationBadge } from '../components' +import { NotificationBadge } from '../components/notification-badge' export type AuxiliaryDrawerProps = { icon: ReactElement @@ -55,7 +55,7 @@ export const AuxiliaryDrawer = ({ {header} - {body} + {body} {footer} diff --git a/src/components/data-table.tsx b/src/components/data-table.tsx index c329b1f..096a457 100644 --- a/src/components/data-table.tsx +++ b/src/components/data-table.tsx @@ -31,7 +31,11 @@ export interface DataTableAction { label: string icon?: ReactElement isDestructive?: boolean + isDestructiveFn?: (item: T) => boolean isDisabled?: boolean + isDisabledFn?: (item: T) => boolean + isHidden?: boolean + isHiddenFn?: (item: T) => boolean onClick?: (item: T) => void } @@ -43,6 +47,7 @@ export function DataTable({ items, columns, actions }: DataTableProps) { {columns.map((column, columnIndex) => ( {column.title} ))} + {actions ? : null} @@ -54,7 +59,7 @@ export function DataTable({ items, columns, actions }: DataTableProps) { ))} {actions ? ( - + ({ items, columns, actions }: DataTableProps) { /> - {actions?.map((action, actionIndex) => ( - action.onClick?.(item)} - > - {action.label} - - ))} + {actions + ?.filter( + (action) => + !!(!action.isHidden && !action.isHiddenFn?.(item)), + ) + .map((action, actionIndex) => ( + action.onClick?.(item)} + > + {action.label} + + ))} diff --git a/src/components/form.tsx b/src/components/form.tsx index fab97a3..d2c892b 100644 --- a/src/components/form.tsx +++ b/src/components/form.tsx @@ -9,6 +9,7 @@ export type FormProps = { export type FormSection = { title: string rows?: FormRow[] + content?: ReactElement } export type FormRow = { @@ -17,20 +18,28 @@ export type FormRow = { } export const Form = ({ sections }: FormProps) => ( -
+
{sections?.map((section, sectionIndex) => ( -
- {section.title} +
+ {section.title} + {section.content} {section.rows?.map((row, rowIndex) => (
{row.label} diff --git a/src/components/icons.tsx b/src/components/icons.tsx index 0585f44..d38e652 100644 --- a/src/components/icons.tsx +++ b/src/components/icons.tsx @@ -447,6 +447,46 @@ export const IconSwapVerticalCircle = ({ ) +export const IconFrontHand = ({ className, filled, ...props }: IconProps) => ( + + front_hand + +) + +export const IconHandshake = ({ className, filled, ...props }: IconProps) => ( + + handshake + +) + +export const IconRemoveModerator = ({ + className, + filled, + ...props +}: IconProps) => ( + + remove_moderator + +) + +export const IconShield = ({ className, filled, ...props }: IconProps) => ( + + shield + +) + +export const IconThumbUp = ({ className, filled, ...props }: IconProps) => ( + + thumb_up + +) + +export const IconThumbDown = ({ className, filled, ...props }: IconProps) => ( + + thumb_down + +) + type GetClassNameOptions = { filled?: boolean className?: string @@ -454,9 +494,9 @@ type GetClassNameOptions = { function getClassName({ filled, className }: GetClassNameOptions) { return cx( - 'material-symbols-rounded', - { 'material-symbols-rounded__filled': filled }, - 'text-[16px]', + 'koupr-material-symbols-rounded', + { 'koupr-material-symbols-rounded__filled': filled }, + 'koupr-text-[16px]', className, ) } diff --git a/src/components/index.ts b/src/components/index.ts index 5f6d312..490ef41 100644 --- a/src/components/index.ts +++ b/src/components/index.ts @@ -20,3 +20,5 @@ export * from './search-bar' export * from './account-menu' export * from './form' export * from './data-table' +export * from './select' +export * from './relative-date' diff --git a/src/components/logo/logo.tsx b/src/components/logo/logo.tsx index 744ee30..a717b97 100644 --- a/src/components/logo/logo.tsx +++ b/src/components/logo/logo.tsx @@ -36,16 +36,21 @@ export const Logo = ({ type, size, isGlossy = false }: LogoProps) => { return (
) diff --git a/src/components/nav-bar.tsx b/src/components/nav-bar.tsx index 43c1146..3bea745 100644 --- a/src/components/nav-bar.tsx +++ b/src/components/nav-bar.tsx @@ -15,7 +15,7 @@ export type NavItem = { export const NavBar = ({ items, pathnameFn, navigateFn }: NavBarProps) => { return ( -
+
{items?.map((item, index) => ( { navigateFn?.(href)} diff --git a/src/components/notification-badge.tsx b/src/components/notification-badge.tsx index 53512f1..28b97bb 100644 --- a/src/components/notification-badge.tsx +++ b/src/components/notification-badge.tsx @@ -12,13 +12,18 @@ export const NotificationBadge = ({ children, }: NotificationBadgeProps) => { return ( -
-
- {children} - {hasBadge ? ( - - ) : null} -
+
+ {children} + {hasBadge ? ( + + ) : null}
) } diff --git a/src/components/number-tag.tsx b/src/components/number-tag.tsx index dba1f09..ebfd2d6 100644 --- a/src/components/number-tag.tsx +++ b/src/components/number-tag.tsx @@ -42,7 +42,7 @@ export const NumberTag = ({ isActive, className, children }: TabTagProps) => { }, [isActive, colorMode]) return ( - + {children} ) diff --git a/src/components/page-pagination.tsx b/src/components/page-pagination.tsx index 5dcdfbe..0475e29 100644 --- a/src/components/page-pagination.tsx +++ b/src/components/page-pagination.tsx @@ -46,10 +46,15 @@ export const PagePagination = ({ ) return ( -
+ <> {!hasPageSwitcher && !hasSizeSelector ? null : (
{hasPageSwitcher ? ( @@ -73,6 +78,6 @@ export const PagePagination = ({ ) : null}
)} -
+ ) } diff --git a/src/components/relative-date.tsx b/src/components/relative-date.tsx new file mode 100644 index 0000000..45d6876 --- /dev/null +++ b/src/components/relative-date.tsx @@ -0,0 +1,12 @@ +import { Tooltip } from '@chakra-ui/react' +import { prettyDate, relativeDate } from '../helpers' + +export type RelativeDateProps = { + date: Date +} + +export const RelativeDate = ({ date }: RelativeDateProps) => ( + + {relativeDate(date)} + +) diff --git a/src/components/search-bar.tsx b/src/components/search-bar.tsx index 7f28ddd..6409d12 100644 --- a/src/components/search-bar.tsx +++ b/src/components/search-bar.tsx @@ -75,10 +75,17 @@ export const SearchBar = ({ }, []) return ( -
+
- + - - + + (
-
- - {text} +
+ + {text}
) diff --git a/src/components/section-placeholder.tsx b/src/components/section-placeholder.tsx index 72e711c..fab07fd 100644 --- a/src/components/section-placeholder.tsx +++ b/src/components/section-placeholder.tsx @@ -13,10 +13,23 @@ export const SectionPlaceholder = ({ height = '300px', }: SectionPlaceholderProps) => (
-
+
{text} {content}
diff --git a/src/components/section-spinner.tsx b/src/components/section-spinner.tsx index 5c1ae34..b6c6159 100644 --- a/src/components/section-spinner.tsx +++ b/src/components/section-spinner.tsx @@ -7,7 +7,13 @@ export type SectionSpinnerProps = { export const SectionSpinner = ({ height = '300px' }: SectionSpinnerProps) => (
diff --git a/src/components/select.tsx b/src/components/select.tsx new file mode 100644 index 0000000..a4631cc --- /dev/null +++ b/src/components/select.tsx @@ -0,0 +1,60 @@ +import { ComponentProps, useMemo } from 'react' +import { SystemStyleObject, useColorMode } from '@chakra-ui/react' +import { + Select as ChakraReactSelect, + ChakraStylesConfig, +} from 'chakra-react-select' +import { GroupBase } from 'react-select' + +export const Select = < + Option = unknown, + IsMulti extends boolean = false, + Group extends GroupBase