diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 00000000..32eef855 --- /dev/null +++ b/.eslintignore @@ -0,0 +1,2 @@ +rollup.config.ts +jest.config.js diff --git a/.storybook/preview.tsx b/.storybook/preview.tsx index 4ad61bbf..c639c46e 100644 --- a/.storybook/preview.tsx +++ b/.storybook/preview.tsx @@ -1,7 +1,6 @@ import { addDecorator, addParameters } from '@storybook/react' import { withInfo } from '@storybook/addon-info' import { DocsPage, DocsContainer } from '@storybook/addon-docs/blocks' -import 'semantic-ui-css/semantic.css' import React, { ReactNode } from 'react' const infoOptions = { diff --git a/package-lock.json b/package-lock.json index f451c881..2f5fc979 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,9 +1,52 @@ { "name": "@dassana-io/web-components", - "version": "0.1.6", + "version": "0.1.7", "lockfileVersion": 1, "requires": true, "dependencies": { + "@ant-design/colors": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/@ant-design/colors/-/colors-3.2.2.tgz", + "integrity": "sha512-YKgNbG2dlzqMhA9NtI3/pbY16m3Yl/EeWBRa+lB1X1YaYxHrxNexiQYCLTWO/uDvAjLFMEDU+zR901waBtMtjQ==", + "requires": { + "tinycolor2": "^1.4.1" + } + }, + "@ant-design/css-animation": { + "version": "1.7.3", + "resolved": "https://registry.npmjs.org/@ant-design/css-animation/-/css-animation-1.7.3.tgz", + "integrity": "sha512-LrX0OGZtW+W6iLnTAqnTaoIsRelYeuLZWsrmBJFUXDALQphPsN8cE5DCsmoSlL0QYb94BQxINiuS70Ar/8BNgA==" + }, + "@ant-design/icons": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/@ant-design/icons/-/icons-4.2.2.tgz", + "integrity": "sha512-DrVV+wcupnHS7PehJ6KiTcJtAR5c25UMgjGECCc6pUT9rsvw0AuYG+a4HDjfxEQuDqKTHwW+oX/nIvCymyLE8Q==", + "requires": { + "@ant-design/colors": "^3.1.0", + "@ant-design/icons-svg": "^4.0.0", + "@babel/runtime": "^7.10.4", + "classnames": "^2.2.6", + "insert-css": "^2.0.0", + "rc-util": "^5.0.1" + } + }, + "@ant-design/icons-svg": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/@ant-design/icons-svg/-/icons-svg-4.1.0.tgz", + "integrity": "sha512-Fi03PfuUqRs76aI3UWYpP864lkrfPo0hluwGqh7NJdLhvH4iRDc3jbJqZIvRDLHKbXrvAfPPV3+zjUccfFvWOQ==" + }, + "@ant-design/react-slick": { + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/@ant-design/react-slick/-/react-slick-0.27.0.tgz", + "integrity": "sha512-dq/p/1oKgew99cNrhT6/BA4v7c7nAhPlS6IcVGVTMsp175bYxbHBT1GfY5vxZyz97YaTnzJ8s2Wql4AOnFQ+9g==", + "requires": { + "@babel/runtime": "^7.10.4", + "classnames": "^2.2.5", + "json2mq": "^0.2.0", + "lodash": "^4.17.15", + "resize-observer-polyfill": "^1.5.0" + } + }, "@babel/code-frame": { "version": "7.10.4", "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.10.4.tgz", @@ -4706,6 +4749,15 @@ "resolved": "https://registry.npmjs.org/@types/color-name/-/color-name-1.1.1.tgz", "integrity": "sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==" }, + "@types/cssnano": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@types/cssnano/-/cssnano-4.0.0.tgz", + "integrity": "sha512-BC/2ibKZfPIaBLBNzkitdW1IvvX/LKW6/QXGc4Su/tAJ7mQ3f2CKBuGCCKaqGAnoKwzfuC7G/recpkARwdOwuA==", + "dev": true, + "requires": { + "postcss": "5 - 7" + } + }, "@types/enzyme": { "version": "3.10.5", "resolved": "https://registry.npmjs.org/@types/enzyme/-/enzyme-3.10.5.tgz", @@ -5772,6 +5824,57 @@ } } }, + "antd": { + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/antd/-/antd-4.5.4.tgz", + "integrity": "sha512-ToBwPaEfRXpDwkFZwEeQc8TynqVLMRX/P4V2IA2cfS4H+w4HXi89kQik4/Gx48UphHmt6fcfwtfm8QZIn3nerA==", + "requires": { + "@ant-design/css-animation": "^1.7.2", + "@ant-design/icons": "^4.2.1", + "@ant-design/react-slick": "~0.27.0", + "@babel/runtime": "^7.10.4", + "array-tree-filter": "^2.1.0", + "classnames": "^2.2.6", + "copy-to-clipboard": "^3.2.0", + "lodash": "^4.17.13", + "moment": "^2.25.3", + "omit.js": "^2.0.2", + "raf": "^3.4.1", + "rc-animate": "~3.1.0", + "rc-cascader": "~1.3.0", + "rc-checkbox": "~2.3.0", + "rc-collapse": "~2.0.0", + "rc-dialog": "~8.1.0", + "rc-drawer": "~4.1.0", + "rc-dropdown": "~3.1.2", + "rc-field-form": "~1.8.0", + "rc-input-number": "~6.0.0", + "rc-mentions": "~1.4.0", + "rc-menu": "~8.5.2", + "rc-motion": "^1.0.0", + "rc-notification": "~4.4.0", + "rc-pagination": "~2.4.5", + "rc-picker": "~1.15.1", + "rc-progress": "~3.0.0", + "rc-rate": "~2.8.2", + "rc-resize-observer": "^0.2.3", + "rc-select": "~11.0.12", + "rc-slider": "~9.3.0", + "rc-steps": "~4.1.0", + "rc-switch": "~3.2.0", + "rc-table": "~7.8.0", + "rc-tabs": "~11.5.0", + "rc-textarea": "~0.3.0", + "rc-tooltip": "~4.2.0", + "rc-tree": "~3.9.0", + "rc-tree-select": "~4.1.1", + "rc-trigger": "~4.4.0", + "rc-upload": "~3.2.0", + "rc-util": "^5.0.1", + "scroll-into-view-if-needed": "^2.2.25", + "warning": "^4.0.3" + } + }, "any-observable": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/any-observable/-/any-observable-0.3.0.tgz", @@ -5897,6 +6000,11 @@ "is-string": "^1.0.5" } }, + "array-tree-filter": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/array-tree-filter/-/array-tree-filter-2.1.0.tgz", + "integrity": "sha512-4ROwICNlNw/Hqa9v+rk5h22KjmzB1JGTMVKP2AKJBOCgb0yL0ASf0+YvCcLNNwquOHNX48jkeZIJ3a+oOQqKcw==" + }, "array-union": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/array-union/-/array-union-1.0.2.tgz", @@ -6059,6 +6167,11 @@ "retry": "0.12.0" } }, + "async-validator": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/async-validator/-/async-validator-3.4.0.tgz", + "integrity": "sha512-VrFk4eYiJAWKskEz115iiuCf9O0ftnMMPXrOFMqyzGH2KxO7YwncKyn/FgOOP+0MDHMfXL7gLExagCutaZGigA==" + }, "asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", @@ -9850,6 +9963,11 @@ } } }, + "compute-scroll-into-view": { + "version": "1.0.14", + "resolved": "https://registry.npmjs.org/compute-scroll-into-view/-/compute-scroll-into-view-1.0.14.tgz", + "integrity": "sha512-mKDjINe3tc6hGelUMNDzuhorIUZ7kS7BwyY0r2wQd2HOH2tRuJykiC06iSEX8y1TuhNzvz4GcJnK16mM2J1NMQ==" + }, "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", @@ -9984,7 +10102,6 @@ "version": "3.3.1", "resolved": "https://registry.npmjs.org/copy-to-clipboard/-/copy-to-clipboard-3.3.1.tgz", "integrity": "sha512-i13qo6kIHTTpCm8/Wup+0b1mVWETvu2kIMzKoK8FpkLkFxlt0znUAHcMzox+T8sPlqtZXq3CulEjQHsYiGFJUw==", - "dev": true, "requires": { "toggle-selection": "^1.0.6" } @@ -10469,6 +10586,11 @@ "integrity": "sha1-+v1Ej3IRXvHitzkVWukvK+bCjdE=", "dev": true }, + "dayjs": { + "version": "1.8.33", + "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.8.33.tgz", + "integrity": "sha512-881TDLZCdpJFKbraWRHcUG8zfMLLX400ENf9rFZDuWc5zYMss6xifo2PhlDX0ftOmR2NRmaIY47bAa4gKQfXqw==" + }, "de-indent": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/de-indent/-/de-indent-1.0.2.tgz", @@ -10819,6 +10941,11 @@ "resolved": "https://registry.npmjs.org/dom-accessibility-api/-/dom-accessibility-api-0.3.0.tgz", "integrity": "sha512-PzwHEmsRP3IGY4gv/Ug+rMeaTIyTJvadCb+ujYXYeIylbHJezIyNToe8KfEgHTCEYyC+/bUghYOGg8yMGlZ6vA==" }, + "dom-align": { + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/dom-align/-/dom-align-1.12.0.tgz", + "integrity": "sha512-YkoezQuhp3SLFGdOlr5xkqZ640iXrnHAwVYcDg8ZKRUtO7mSzSC2BA5V0VuyAwPSJA4CLIc6EDDJh4bEsD2+zA==" + }, "dom-converter": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/dom-converter/-/dom-converter-0.2.0.tgz", @@ -13355,7 +13482,6 @@ "version": "3.3.2", "resolved": "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz", "integrity": "sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw==", - "dev": true, "requires": { "react-is": "^16.7.0" } @@ -13787,6 +13913,11 @@ } } }, + "insert-css": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/insert-css/-/insert-css-2.0.0.tgz", + "integrity": "sha1-610Ql7dUL0x56jBg067gfQU4gPQ=" + }, "internal-ip": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/internal-ip/-/internal-ip-4.3.0.tgz", @@ -15037,6 +15168,14 @@ "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" }, + "json2mq": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/json2mq/-/json2mq-0.2.0.tgz", + "integrity": "sha1-tje9O6nqvhIsg+lyBIOusQ0skEo=", + "requires": { + "string-convert": "^0.2.0" + } + }, "json3": { "version": "3.3.3", "resolved": "https://registry.npmjs.org/json3/-/json3-3.3.3.tgz", @@ -16198,6 +16337,15 @@ } } }, + "mini-store": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/mini-store/-/mini-store-3.0.6.tgz", + "integrity": "sha512-YzffKHbYsMQGUWQRKdsearR79QsMzzJcDDmZKlJBqt5JNkqpyJHYlK6gP61O36X+sLf76sO9G6mhKBe83gIZIQ==", + "requires": { + "hoist-non-react-statics": "^3.3.2", + "shallowequal": "^1.0.2" + } + }, "minimalistic-assert": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", @@ -16335,8 +16483,7 @@ "moment": { "version": "2.27.0", "resolved": "https://registry.npmjs.org/moment/-/moment-2.27.0.tgz", - "integrity": "sha512-al0MUK7cpIcglMv3YF13qSgdAIqxHTO7brRtaz3DlSULbqfazqkc5kEjNrLDOM7fsjshoFIihnU8snrP7zUvhQ==", - "dev": true + "integrity": "sha512-al0MUK7cpIcglMv3YF13qSgdAIqxHTO7brRtaz3DlSULbqfazqkc5kEjNrLDOM7fsjshoFIihnU8snrP7zUvhQ==" }, "moo": { "version": "0.5.1", @@ -16844,6 +16991,11 @@ "resolved": "https://registry.npmjs.org/obuf/-/obuf-1.1.2.tgz", "integrity": "sha512-PX1wu0AmAdPqOL1mWhqmlOd8kOIZQwGZw6rh7uby9fTc5lhaOWFLX3I6R1hrF9k3zUY40e6igsLGkDXK92LJNg==" }, + "omit.js": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/omit.js/-/omit.js-2.0.2.tgz", + "integrity": "sha512-hJmu9D+bNB40YpL9jYebQl4lsTW6yEHRTroJzNLqQJYHm7c+NQnJGfZmIWh8S3q3KoaxV1aLhV6B3+0N0/kyJg==" + }, "on-finished": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", @@ -16983,6 +17135,16 @@ "aggregate-error": "^3.0.0" } }, + "p-queue": { + "version": "6.6.0", + "resolved": "https://registry.npmjs.org/p-queue/-/p-queue-6.6.0.tgz", + "integrity": "sha512-zPHXPNy9jZsiym0PpJjvnHQysx1fSd/QdaNVwiDRLU2KFChD6h9CkCB6b8i3U8lBwJyA+mHgNZCzcy77glUssQ==", + "dev": true, + "requires": { + "eventemitter3": "^4.0.4", + "p-timeout": "^3.1.0" + } + }, "p-reduce": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/p-reduce/-/p-reduce-1.0.0.tgz", @@ -16996,6 +17158,15 @@ "retry": "^0.12.0" } }, + "p-timeout": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-3.2.0.tgz", + "integrity": "sha512-rhIwUycgwwKcP9yTOOFK/AKsAopjjCakVqLHePO3CC6Mir1Z99xT+R63jZxAT5lFZLa2inS5h+ZS2GvR99/FBg==", + "dev": true, + "requires": { + "p-finally": "^1.0.0" + } + }, "p-try": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", @@ -18725,6 +18896,405 @@ "schema-utils": "^2.0.1" } }, + "rc-align": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/rc-align/-/rc-align-4.0.1.tgz", + "integrity": "sha512-RQ5Fhxl0LW+zsxbY8dxAcpXdaHkHH2jzRSSpvBTS7G9LMK3T+WRcn4ovjg/eqAESM6TdTx0hfqWF2S1pO75jxQ==", + "requires": { + "@babel/runtime": "^7.10.1", + "classnames": "2.x", + "dom-align": "^1.7.0", + "rc-util": "^5.0.1", + "resize-observer-polyfill": "^1.5.1" + } + }, + "rc-animate": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/rc-animate/-/rc-animate-3.1.0.tgz", + "integrity": "sha512-8FsM+3B1H+0AyTyGggY6JyVldHTs1CyYT8CfTmG/nGHHXlecvSLeICJhcKgRLjUiQlctNnRtB1rwz79cvBVmrw==", + "requires": { + "@ant-design/css-animation": "^1.7.2", + "classnames": "^2.2.6", + "raf": "^3.4.0", + "rc-util": "^5.0.1" + } + }, + "rc-cascader": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/rc-cascader/-/rc-cascader-1.3.0.tgz", + "integrity": "sha512-wayuMo/dSZixvdpiRFZB4Q6A3omKRXQcJ3CxN02+PNiTEcRnK2KDqKUzrx7GwgMsyH5tz90lUZ91lLaEPNFv0A==", + "requires": { + "array-tree-filter": "^2.1.0", + "rc-trigger": "^4.0.0", + "rc-util": "^5.0.1", + "warning": "^4.0.1" + } + }, + "rc-checkbox": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/rc-checkbox/-/rc-checkbox-2.3.1.tgz", + "integrity": "sha512-i290/iTqmZ0WtI2UPIryqT9rW6O99+an4KeZIyZDH3r+Jbb6YdddaWNdzq7g5m9zaNhJvgjf//wJtC4fvve2Tg==", + "requires": { + "@babel/runtime": "^7.10.1", + "classnames": "^2.2.1" + } + }, + "rc-collapse": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/rc-collapse/-/rc-collapse-2.0.0.tgz", + "integrity": "sha512-R5+Ge1uzwK9G1wZPRPhqQsed4FXTDmU0BKzsqfNBtZdk/wd+yey8ZutmJmSozYc5hQwjPkCvJHV7gOIRZKIlJg==", + "requires": { + "@ant-design/css-animation": "^1.7.2", + "classnames": "2.x", + "rc-animate": "3.x", + "react-is": "^16.7.0", + "shallowequal": "^1.1.0" + } + }, + "rc-dialog": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/rc-dialog/-/rc-dialog-8.1.0.tgz", + "integrity": "sha512-vMVAtyxpnokh/okFcDQVLO6ymIXfoTKYKtqJ/hMtf+0WcvRn4VgVDBvGyEk5zd94k0RgwEze9o2kGw8SyjivZg==", + "requires": { + "rc-animate": "3.x", + "rc-util": "^5.0.1" + } + }, + "rc-drawer": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/rc-drawer/-/rc-drawer-4.1.0.tgz", + "integrity": "sha512-kjeQFngPjdzAFahNIV0EvEBoIKMOnvUsAxpkSPELoD/1DuR4nLafom5ryma+TIxGwkFJ92W6yjsMi1U9aiOTeQ==", + "requires": { + "@babel/runtime": "^7.10.1", + "classnames": "^2.2.6", + "rc-util": "^5.0.1" + } + }, + "rc-dropdown": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/rc-dropdown/-/rc-dropdown-3.1.2.tgz", + "integrity": "sha512-s2W5jqvjTid5DxotGO5FlTBaQWeB+Bu7McQgjB8Ot3Wbl72AIKwLf11+lgbV4mA2vWC1H8DKyn6SW9TKLTi0xg==", + "requires": { + "@babel/runtime": "^7.10.1", + "classnames": "^2.2.6", + "rc-trigger": "^4.0.0" + } + }, + "rc-field-form": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/rc-field-form/-/rc-field-form-1.8.1.tgz", + "integrity": "sha512-OAMFhS+92+4o7Y0WyTfQ6E5EdBk7z7vEXf4dL5CpoZU2OEHv/INZP1xts2AIKNVOBligG/WcfMTuk+GvbyVsnA==", + "requires": { + "@babel/runtime": "^7.8.4", + "async-validator": "^3.0.3", + "rc-util": "^5.0.0" + } + }, + "rc-input-number": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/rc-input-number/-/rc-input-number-6.0.0.tgz", + "integrity": "sha512-vbe+g7HvR/joknSnvLkBTi9N9I+LsV4kljfuog8WNiS7OAF3aEN0QcHSOQ4+xk6+Hx9P1tU63z2+TyEx8W/j2Q==", + "requires": { + "@babel/runtime": "^7.10.1", + "classnames": "^2.2.5", + "rc-util": "^5.0.1" + } + }, + "rc-mentions": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/rc-mentions/-/rc-mentions-1.4.1.tgz", + "integrity": "sha512-MraFCsXlorfUj4/VUjRnITAnBzhM0gMH+2yj/3jmS5rIj0NjNJoTXyEUW3gTJxnw9DP22IMccMTdP3Fjz/2UgQ==", + "requires": { + "@babel/runtime": "^7.10.1", + "classnames": "^2.2.6", + "rc-menu": "^8.0.1", + "rc-textarea": "^0.3.0", + "rc-trigger": "^4.3.0", + "rc-util": "^5.0.1" + } + }, + "rc-menu": { + "version": "8.5.2", + "resolved": "https://registry.npmjs.org/rc-menu/-/rc-menu-8.5.2.tgz", + "integrity": "sha512-GPtr7qoCynVEkFgco/9cW0z/xU33GV89Q6r8FgEkrdhaQSJzuSC+v8pv+Bll5fVGQlJyJgOVqiKk7l2Knk1jYg==", + "requires": { + "@babel/runtime": "^7.10.1", + "classnames": "2.x", + "mini-store": "^3.0.1", + "omit.js": "^2.0.0", + "rc-motion": "^1.0.1", + "rc-trigger": "^4.4.0", + "rc-util": "^5.0.1", + "resize-observer-polyfill": "^1.5.0", + "shallowequal": "^1.1.0" + } + }, + "rc-motion": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/rc-motion/-/rc-motion-1.0.2.tgz", + "integrity": "sha512-FDmC9ZdzsXerlTZ+YLu+l5erjkMU98s85SFHdQac+pMy6zQ10RuON6Ntv3ZwP0+qY/YlIsK+0uMXIWOJ9LaLIg==", + "requires": { + "@babel/runtime": "^7.11.1", + "classnames": "^2.2.1", + "raf": "^3.4.1", + "rc-util": "^5.0.6" + }, + "dependencies": { + "@babel/runtime": { + "version": "7.11.2", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.11.2.tgz", + "integrity": "sha512-TeWkU52so0mPtDcaCTxNBI/IHiz0pZgr8VEFqXFtZWpYD08ZB6FaSwVAS8MKRQAP3bYKiVjwysOJgMFY28o6Tw==", + "requires": { + "regenerator-runtime": "^0.13.4" + } + } + } + }, + "rc-notification": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/rc-notification/-/rc-notification-4.4.0.tgz", + "integrity": "sha512-IDeNAFGVeOsy1tv4zNVqMAXB9tianR80ewQbtObaAQfjwAjWfONdqdyjFkEU6nc6UQhSUYA5OcTGb7kwwbnh0g==", + "requires": { + "@babel/runtime": "^7.10.1", + "classnames": "2.x", + "rc-animate": "3.x", + "rc-util": "^5.0.1" + } + }, + "rc-pagination": { + "version": "2.4.6", + "resolved": "https://registry.npmjs.org/rc-pagination/-/rc-pagination-2.4.6.tgz", + "integrity": "sha512-1ykd3Jti+JuOFdzEFXGfVpkuH+hKxLYz3FKV6BSwnnWXLr9Y8bbm7YiTSwBmdDcOg6tinH8b4IYaKzxBWRC6EA==", + "requires": { + "@babel/runtime": "^7.10.1", + "classnames": "^2.2.1" + } + }, + "rc-picker": { + "version": "1.15.3", + "resolved": "https://registry.npmjs.org/rc-picker/-/rc-picker-1.15.3.tgz", + "integrity": "sha512-+VfzcsZui6oOOA0W44qQ7TRC28FUCLrZLjowwyouJKMjvU4HtKdDlSMTJHZNvBbfQoAfED4+mzUG2xtcdW7M+g==", + "requires": { + "@babel/runtime": "^7.10.1", + "classnames": "^2.2.1", + "date-fns": "^2.15.0", + "dayjs": "^1.8.30", + "moment": "^2.24.0", + "rc-trigger": "^4.0.0", + "rc-util": "^5.0.1", + "react": "^16.0.0", + "shallowequal": "^1.1.0" + }, + "dependencies": { + "date-fns": { + "version": "2.15.0", + "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.15.0.tgz", + "integrity": "sha512-ZCPzAMJZn3rNUvvQIMlXhDr4A+Ar07eLeGsGREoWU19a3Pqf5oYa+ccd+B3F6XVtQY6HANMFdOQ8A+ipFnvJdQ==" + } + } + }, + "rc-progress": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/rc-progress/-/rc-progress-3.0.0.tgz", + "integrity": "sha512-dQv1KU3o6Vay604FMYMF4S0x4GNXAgXf1tbQ1QoxeIeQt4d5fUeB7Ri82YPu+G+aRvH/AtxYAlEcnxyVZ1/4Hw==", + "requires": { + "classnames": "^2.2.6" + } + }, + "rc-rate": { + "version": "2.8.2", + "resolved": "https://registry.npmjs.org/rc-rate/-/rc-rate-2.8.2.tgz", + "integrity": "sha512-f9T/D+ZwWQrWHkpidpQbnXpnVMGMC4eSRAkwuu88a8Qv1C/9LNc4AErazoh8tpnZBFqq19F3j0Glv+sDgkfEig==", + "requires": { + "@babel/runtime": "^7.10.1", + "classnames": "^2.2.5", + "rc-util": "^5.0.1" + } + }, + "rc-resize-observer": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/rc-resize-observer/-/rc-resize-observer-0.2.3.tgz", + "integrity": "sha512-dEPCGX15eRRnu+TNBIGyEghpzE24fTDW8pHdJPJS/kCR3lafFqBLqKzBgZW6pMUuM70/ZDyFQ0Kynx9kWsXRNw==", + "requires": { + "@babel/runtime": "^7.10.1", + "classnames": "^2.2.1", + "rc-util": "^5.0.0", + "resize-observer-polyfill": "^1.5.1" + } + }, + "rc-select": { + "version": "11.0.13", + "resolved": "https://registry.npmjs.org/rc-select/-/rc-select-11.0.13.tgz", + "integrity": "sha512-4/GDmBkGnDhYre3Dvq5UkIRXQJW8hbGdpdH8SjquSbCktAVitYV+opd/lKI28qMcBxCgjOHgYXwZ18TF+kP2VQ==", + "requires": { + "@babel/runtime": "^7.10.1", + "classnames": "2.x", + "rc-motion": "^1.0.1", + "rc-trigger": "^4.3.0", + "rc-util": "^5.0.1", + "rc-virtual-list": "^1.1.2", + "warning": "^4.0.3" + } + }, + "rc-slider": { + "version": "9.3.1", + "resolved": "https://registry.npmjs.org/rc-slider/-/rc-slider-9.3.1.tgz", + "integrity": "sha512-c52PWPyrfJWh28K6dixAm0906L3/4MUIxqrNQA4TLnC/Z+cBNycWJUZoJerpwSOE1HdM3XDwixCsmtFc/7aWlQ==", + "requires": { + "@babel/runtime": "^7.10.1", + "classnames": "^2.2.5", + "rc-tooltip": "^4.0.0", + "rc-util": "^5.0.0", + "shallowequal": "^1.1.0" + } + }, + "rc-steps": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/rc-steps/-/rc-steps-4.1.2.tgz", + "integrity": "sha512-kTPiojPtJi12Y7whRqlydRgJXQ1u9JlvGchI6xDrmOMZVpCTLpfc/18iu+aHCtCZaSnM2ENU/9lfm/naWVFcRw==", + "requires": { + "@babel/runtime": "^7.10.2", + "classnames": "^2.2.3", + "rc-util": "^5.0.1" + } + }, + "rc-switch": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/rc-switch/-/rc-switch-3.2.0.tgz", + "integrity": "sha512-WQZnRrWZ+KGh4Cd98FpP1ZgvMmebctoHzKAO2n1Xsry1FQBSGgIw4rQJRxET31VS/dR1LIKb5md/k0UzcXXc0g==", + "requires": { + "@babel/runtime": "^7.10.1", + "classnames": "^2.2.1", + "rc-util": "^5.0.1" + } + }, + "rc-table": { + "version": "7.8.6", + "resolved": "https://registry.npmjs.org/rc-table/-/rc-table-7.8.6.tgz", + "integrity": "sha512-rHRStVTO6FYlxs5Bk9S56Vo/Jn7pX3hOtHTHP+Vu++i9SF7DroOReMIi+OJ7RA9n3jVBxyT/9+NESXgTFvPbYA==", + "requires": { + "@babel/runtime": "^7.10.1", + "classnames": "^2.2.5", + "raf": "^3.4.1", + "rc-resize-observer": "^0.2.0", + "rc-util": "^5.0.0", + "shallowequal": "^1.1.0" + } + }, + "rc-tabs": { + "version": "11.5.6", + "resolved": "https://registry.npmjs.org/rc-tabs/-/rc-tabs-11.5.6.tgz", + "integrity": "sha512-Q2wqnt66SFksGXxNARLqGNMYIFH3KSm48+hMc4tq6qhgpsW104dedHcM86NUyqsQcvYWWiceUNu3TSnbe+XZnw==", + "requires": { + "@babel/runtime": "^7.10.1", + "classnames": "2.x", + "raf": "^3.4.1", + "rc-dropdown": "^3.1.0", + "rc-menu": "^8.2.1", + "rc-resize-observer": "^0.2.1", + "rc-trigger": "^4.2.1", + "rc-util": "^5.0.0" + } + }, + "rc-textarea": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/rc-textarea/-/rc-textarea-0.3.0.tgz", + "integrity": "sha512-vrTPkPT6wrO7EI8ouLFZZLXA1pFVrVRCnkmyyf0yRComFbcH1ogmFEGu85CjVT96rQqAiQFOe0QV3nKopZOJow==", + "requires": { + "@babel/runtime": "^7.10.1", + "classnames": "^2.2.1", + "omit.js": "^2.0.0", + "rc-resize-observer": "^0.2.3" + } + }, + "rc-tooltip": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/rc-tooltip/-/rc-tooltip-4.2.1.tgz", + "integrity": "sha512-oykuaGsHg7RFvPUaxUpxo7ScEqtH61C66x4JUmjlFlSS8gSx2L8JFtfwM1D68SLBxUqGqJObtxj4TED75gQTiA==", + "requires": { + "rc-trigger": "^4.2.1" + } + }, + "rc-tree": { + "version": "3.9.0", + "resolved": "https://registry.npmjs.org/rc-tree/-/rc-tree-3.9.0.tgz", + "integrity": "sha512-TYvIq2SKdVugS2mdOGC++CNWjj1VDBws4JZkFOAJVQfXFWg+BNW4rhuTzAs4ZY3KiE+1xG0u5cOVvIPr7qkxCA==", + "requires": { + "@babel/runtime": "^7.10.1", + "classnames": "2.x", + "rc-motion": "^1.0.0", + "rc-util": "^5.0.0", + "rc-virtual-list": "^1.1.0" + } + }, + "rc-tree-select": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/rc-tree-select/-/rc-tree-select-4.1.1.tgz", + "integrity": "sha512-pawxt/W1chLpjtAEQe8mXI9C9DYNMGS/BR6eBmOY8cJDK6OWSa6M88S6F0jXc+A10D/CLfHAfF1ZIj7VGse+5Q==", + "requires": { + "@babel/runtime": "^7.10.1", + "classnames": "2.x", + "rc-select": "^11.1.1", + "rc-tree": "^3.8.0", + "rc-util": "^5.0.5" + }, + "dependencies": { + "rc-select": { + "version": "11.1.3", + "resolved": "https://registry.npmjs.org/rc-select/-/rc-select-11.1.3.tgz", + "integrity": "sha512-Mf/EiYFmdWOoOget6RacSz1uAfn0hxf3wOa/YSOf7bw70EH6s80biDHQ4WPk8hNMxVRhzojlkktgmN4YxNQisQ==", + "requires": { + "@babel/runtime": "^7.10.1", + "classnames": "2.x", + "rc-motion": "^1.0.1", + "rc-trigger": "^4.3.0", + "rc-util": "^5.0.1", + "rc-virtual-list": "^1.1.2", + "warning": "^4.0.3" + } + } + } + }, + "rc-trigger": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/rc-trigger/-/rc-trigger-4.4.0.tgz", + "integrity": "sha512-09562wc5I1JUbCdWohcFYJeLTpjKjEqH+0lY7plDtyI9yFXRngrvmqsrSJyT6Nat+C35ymD7fhwCCPq3cfUI4g==", + "requires": { + "@babel/runtime": "^7.10.1", + "classnames": "^2.2.6", + "raf": "^3.4.1", + "rc-align": "^4.0.0", + "rc-motion": "^1.0.0", + "rc-util": "^5.0.1" + } + }, + "rc-upload": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/rc-upload/-/rc-upload-3.2.0.tgz", + "integrity": "sha512-/vyOGVxl5QVM3ZE7s+GqYPbCLC/Q/vJq0sjdwnvJw01KvAR5kVOC4jbHEaU56dMss7PFGDfNzc8zO5bWYLDzVQ==", + "requires": { + "classnames": "^2.2.5" + } + }, + "rc-util": { + "version": "5.0.6", + "resolved": "https://registry.npmjs.org/rc-util/-/rc-util-5.0.6.tgz", + "integrity": "sha512-uLGxF9WjbpJSjd6iDnIjl8ZeMUglpcuh1DwO26aaXh++yAmlB6eIAJMUwwJCuqJvo4quCvsDPg1VkqHILc4U0A==", + "requires": { + "react-is": "^16.12.0", + "shallowequal": "^1.1.0" + } + }, + "rc-virtual-list": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/rc-virtual-list/-/rc-virtual-list-1.1.6.tgz", + "integrity": "sha512-u3+izqWL8p8bQy8nYH48qWpiGyxR/ye8D2k0zJlXmfYeL55/xh83YrzHqiDzO78uj0Ewag3nXDA0JTVrYO7ygQ==", + "requires": { + "classnames": "^2.2.6", + "raf": "^3.4.1", + "rc-util": "^5.0.0" + } + }, "react": { "version": "16.13.1", "resolved": "https://registry.npmjs.org/react/-/react-16.13.1.tgz", @@ -20083,8 +20653,7 @@ "resize-observer-polyfill": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/resize-observer-polyfill/-/resize-observer-polyfill-1.5.1.tgz", - "integrity": "sha512-LwZrotdHOo12nQuZlHEmtuXdqGoOD0OhaxopaNFxWzInpEgaLWoVuAMbTzixuosCx2nEG58ngzW3vxdWoxIgdg==", - "dev": true + "integrity": "sha512-LwZrotdHOo12nQuZlHEmtuXdqGoOD0OhaxopaNFxWzInpEgaLWoVuAMbTzixuosCx2nEG58ngzW3vxdWoxIgdg==" }, "resolve": { "version": "1.15.0", @@ -20252,6 +20821,129 @@ "fsevents": "~2.1.2" } }, + "rollup-plugin-styles": { + "version": "3.10.0", + "resolved": "https://registry.npmjs.org/rollup-plugin-styles/-/rollup-plugin-styles-3.10.0.tgz", + "integrity": "sha512-J9oHllasTFjzooqJnZWDlxHeZgnh3CVtNWUoQ0mWYGNul592ll4T7zdFCFwNWljIh6ZI2UPZ4lbAEfvQ5Fv1DQ==", + "dev": true, + "requires": { + "@rollup/pluginutils": "^3.1.0", + "@types/cssnano": "^4.0.0", + "cosmiconfig": "^6.0.0", + "cssnano": "^4.1.10", + "fs-extra": "^9.0.1", + "icss-utils": "^4.1.1", + "mime-types": "^2.1.27", + "p-queue": "^6.4.0", + "postcss": "^7.0.32", + "postcss-modules-extract-imports": "^2.0.0", + "postcss-modules-local-by-default": "^3.0.2", + "postcss-modules-scope": "^2.2.0", + "postcss-modules-values": "^3.0.0", + "postcss-value-parser": "^4.1.0", + "resolve": "^1.17.0", + "source-map": "^0.7.3", + "tslib": "^2.0.0" + }, + "dependencies": { + "cosmiconfig": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-6.0.0.tgz", + "integrity": "sha512-xb3ZL6+L8b9JLLCx3ZdoZy4+2ECphCMo2PwqgP1tlfVq6M6YReyzBJtvWWtbDSpNr9hn96pkCiZqUcFEc+54Qg==", + "dev": true, + "requires": { + "@types/parse-json": "^4.0.0", + "import-fresh": "^3.1.0", + "parse-json": "^5.0.0", + "path-type": "^4.0.0", + "yaml": "^1.7.2" + } + }, + "fs-extra": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.0.1.tgz", + "integrity": "sha512-h2iAoN838FqAFJY2/qVpzFXy+EBxfVE220PalAqQLDVsFOHLJrZvut5puAbCdNv6WJk+B8ihI+k0c7JK5erwqQ==", + "dev": true, + "requires": { + "at-least-node": "^1.0.0", + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^1.0.0" + } + }, + "import-fresh": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.2.1.tgz", + "integrity": "sha512-6e1q1cnWP2RXD9/keSkxHScg508CdXqXWgWBaETNhyuBFz+kUZlKboh+ISK+bU++DmbHimVBrOz/zzPe0sZ3sQ==", + "dev": true, + "requires": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + } + }, + "jsonfile": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.0.1.tgz", + "integrity": "sha512-jR2b5v7d2vIOust+w3wtFKZIfpC2pnRmFAhAC/BuweZFQR8qZzxH1OyrQ10HmdVYiXWkYUqPVsz91cG7EL2FBg==", + "dev": true, + "requires": { + "graceful-fs": "^4.1.6", + "universalify": "^1.0.0" + } + }, + "parse-json": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.0.1.tgz", + "integrity": "sha512-ztoZ4/DYeXQq4E21v169sC8qWINGpcosGv9XhTDvg9/hWvx/zrFkc9BiWxR58OJLHGk28j5BL0SDLeV2WmFZlQ==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.0.0", + "error-ex": "^1.3.1", + "json-parse-better-errors": "^1.0.1", + "lines-and-columns": "^1.1.6" + } + }, + "path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "dev": true + }, + "resolve": { + "version": "1.17.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.17.0.tgz", + "integrity": "sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w==", + "dev": true, + "requires": { + "path-parse": "^1.0.6" + } + }, + "resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true + }, + "source-map": { + "version": "0.7.3", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.3.tgz", + "integrity": "sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==", + "dev": true + }, + "tslib": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.0.1.tgz", + "integrity": "sha512-SgIkNheinmEBgx1IUNirK0TUD4X9yjjBRTqqjggWCU3pUEqIk3/Uwl3yRixYKT6WjQuGiwDv4NomL3wqRCj+CQ==", + "dev": true + }, + "universalify": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-1.0.0.tgz", + "integrity": "sha512-rb6X1W158d7pRQBg5gkR8uPaSfiids68LTJQYOtEUhoJUWBdaQHsuT/EUduxXYxcrt4r5PJ4fuHW1MHT6p0qug==", + "dev": true + } + } + }, "rollup-plugin-typescript2": { "version": "0.27.1", "resolved": "https://registry.npmjs.org/rollup-plugin-typescript2/-/rollup-plugin-typescript2-0.27.1.tgz", @@ -20479,6 +21171,14 @@ "ajv-keywords": "^3.4.1" } }, + "scroll-into-view-if-needed": { + "version": "2.2.25", + "resolved": "https://registry.npmjs.org/scroll-into-view-if-needed/-/scroll-into-view-if-needed-2.2.25.tgz", + "integrity": "sha512-C8RKJPq9lK7eubwGpLbUkw3lklcG3Ndjmea2PyauzrA0i4DPlzAmVMGxaZrBFqCrVLfvJmP80IyHnv4jxvg1OQ==", + "requires": { + "compute-scroll-into-view": "^1.0.14" + } + }, "select": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/select/-/select-1.1.2.tgz", @@ -20732,8 +21432,7 @@ "shallowequal": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/shallowequal/-/shallowequal-1.1.0.tgz", - "integrity": "sha512-y0m1JoUZSlPAjXVtPPW70aZWfIL/dSP7AFkRnniLCrK/8MDKog3TySTBmckD+RObVxH0v4Tox67+F14PdED2oQ==", - "dev": true + "integrity": "sha512-y0m1JoUZSlPAjXVtPPW70aZWfIL/dSP7AFkRnniLCrK/8MDKog3TySTBmckD+RObVxH0v4Tox67+F14PdED2oQ==" }, "shebang-command": { "version": "1.2.0", @@ -21311,6 +22010,11 @@ "resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz", "integrity": "sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM=" }, + "string-convert": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/string-convert/-/string-convert-0.2.1.tgz", + "integrity": "sha1-aYLMMEn7tM2F+LJFaLnZvznu/5c=" + }, "string-length": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/string-length/-/string-length-2.0.0.tgz", @@ -21954,8 +22658,7 @@ "tinycolor2": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/tinycolor2/-/tinycolor2-1.4.1.tgz", - "integrity": "sha1-9PrTM0R7wLB9TcjpIJ2POaisd+g=", - "dev": true + "integrity": "sha1-9PrTM0R7wLB9TcjpIJ2POaisd+g=" }, "tmp": { "version": "0.0.33", @@ -22031,8 +22734,7 @@ "toggle-selection": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/toggle-selection/-/toggle-selection-1.0.6.tgz", - "integrity": "sha1-bkWxJj8gF/oKzH2J14sVuL932jI=", - "dev": true + "integrity": "sha1-bkWxJj8gF/oKzH2J14sVuL932jI=" }, "toidentifier": { "version": "1.0.0", @@ -22769,7 +23471,6 @@ "version": "4.0.3", "resolved": "https://registry.npmjs.org/warning/-/warning-4.0.3.tgz", "integrity": "sha512-rpJyN222KWIvHJ/F53XSZv0Zl/accqHR8et1kpaMTD/fLCRxtV8iX8czMzY7sVZupTI3zcUTg8eycS2kNF9l6w==", - "dev": true, "requires": { "loose-envify": "^1.0.0" } diff --git a/package.json b/package.json index a0defd0a..4fc8c58d 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,7 @@ "@types/node": "^12.12.53", "@types/react": "^16.9.44", "@types/react-dom": "^16.9.8", + "antd": "^4.5.4", "classnames": "^2.2.6", "react": "^16.13.1", "react-dom": "^16.13.1", @@ -75,7 +76,8 @@ "enzyme": "^3.11.0", "enzyme-adapter-react-16": "^1.15.2", "eslint-plugin-react": "^7.20.5", - "react-test-renderer": "^16.13.1" + "react-test-renderer": "^16.13.1", + "rollup-plugin-styles": "^3.10.0" }, "peerDependencies": { "react": ">=16.13", diff --git a/rollup.config.ts b/rollup.config.ts index ca2f99f1..a8e4fb50 100644 --- a/rollup.config.ts +++ b/rollup.config.ts @@ -1,24 +1,30 @@ import commonjs from '@rollup/plugin-commonjs' import resolve from '@rollup/plugin-node-resolve' +import styles from 'rollup-plugin-styles' import typescript from 'rollup-plugin-typescript2' import pkg from './package.json' +const assetFileNames = '[name]-[hash][extname]' + export default { input: 'src/components/index.ts', output: [ { file: pkg.main, - format: 'cjs' + format: 'cjs', + assetFileNames }, { file: pkg.module, - format: 'es' + format: 'es', + assetFileNames } ], external: ['react'], plugins: [ resolve(), commonjs(), + styles(), typescript({ tsconfig: 'tsconfig.rollup.json', useTsconfigDeclarationDir: true diff --git a/src/__snapshots__/storybook.test.ts.snap b/src/__snapshots__/storybook.test.ts.snap index f1b0ed47..f15c3eb8 100644 --- a/src/__snapshots__/storybook.test.ts.snap +++ b/src/__snapshots__/storybook.test.ts.snap @@ -362,3 +362,278 @@ exports[`Storyshots Button Submit 1`] = ` `; + +exports[`Storyshots Link Default 1`] = ` +
+
+ + + Default + + +
+ +
+`; + +exports[`Storyshots Link Link With Knobs 1`] = ` +
+
+ + + Link + + +
+ +
+`; + +exports[`Storyshots Tag Colored 1`] = ` +
+
+ + Blue + +
+ +
+`; + +exports[`Storyshots Tag Default 1`] = ` +
+
+ + Default + +
+ +
+`; + +exports[`Storyshots Tag Tag With Knobs 1`] = ` +
+
+ + Magenta + +
+ +
+`; diff --git a/src/components/Button/index.tsx b/src/components/Button/index.tsx index d74f62cc..977d97a6 100644 --- a/src/components/Button/index.tsx +++ b/src/components/Button/index.tsx @@ -1,6 +1,6 @@ +import 'semantic-ui-css/semantic.min.css' import classnames from 'classnames' import React, { FC, ReactNode } from 'react' - export type ButtonType = 'submit' | 'button' | 'reset' export interface ButtonProps { diff --git a/src/components/Link/Link.stories.tsx b/src/components/Link/Link.stories.tsx new file mode 100644 index 00000000..acb7d72c --- /dev/null +++ b/src/components/Link/Link.stories.tsx @@ -0,0 +1,38 @@ +import { action } from '@storybook/addon-actions' +import Link, { LinkProps, LinkTargetType } from './index' +import React, { FC } from 'react' +import { select, text, withKnobs } from '@storybook/addon-knobs' + +export default { + component: Link, + decorators: [withKnobs], + excludeStories: /.*Data$/, + title: 'Link' +} + +const actionsData = { + onClick: action('onClick') +} + +export const LinkData: LinkProps = { + children: 'Default', + href: '', + onClick: actionsData.onClick +} + +export const Default: FC = () => + +export const LinkWithKnobs: FC = () => { + const linkTargetOpts: Record = { + blank: '_blank', + self: '_self' + } + + const props: LinkProps = { + ...LinkData, + children: text('Link text', 'Link'), + target: select('Target', linkTargetOpts, '_self') + } + + return +} diff --git a/src/components/Link/Link.test.tsx b/src/components/Link/Link.test.tsx new file mode 100644 index 00000000..22e56fc5 --- /dev/null +++ b/src/components/Link/Link.test.tsx @@ -0,0 +1,39 @@ +import React from 'react' +import Link, { LinkProps } from '.' +import { mount, ReactWrapper } from 'enzyme' + +let wrapper: ReactWrapper +let mockClick: jest.Mock +const mockProps: LinkProps = { + children: 'Test', + href: '/test', + target: '_blank' +} + +beforeEach(() => { + mockClick = jest.fn() + wrapper = mount() +}) + +describe('Link', () => { + it('renders', () => { + const link = wrapper.find(Link) + expect(link).toHaveLength(1) + }) + + it('calls onClick function when link is clicked', () => { + const link = wrapper.find(Link) + link.simulate('click') + expect(mockClick).toHaveBeenCalledTimes(1) + }) + + it('has the correct href attribute', () => { + const link = wrapper.find(Link) + expect(link.getDOMNode().getAttribute('href')).toBe(mockProps.href) + }) + + it('has the correct target attribute', () => { + const link = wrapper.find(Link) + expect(link.getDOMNode().getAttribute('target')).toBe(mockProps.target) + }) +}) diff --git a/src/components/Link/index.tsx b/src/components/Link/index.tsx new file mode 100644 index 00000000..44d029d0 --- /dev/null +++ b/src/components/Link/index.tsx @@ -0,0 +1,38 @@ +import 'antd/lib/typography/style/index.css' +import { Typography } from 'antd' +import React, { FC, ReactNode } from 'react' + +const AntDLink = Typography.Link + +export type LinkTargetType = '_self' | '_blank' + +export interface LinkProps { + children: ReactNode + href?: string + onClick?: () => void + target?: LinkTargetType +} + +interface AntDProps extends LinkProps { + underline: boolean +} + +const Link: FC = ({ + children, + href, + onClick, + target = '_self' +}: LinkProps) => { + const antDProps: AntDProps = { + children, + target, + underline: true + } + + if (onClick !== undefined) antDProps.onClick = onClick + if (href !== undefined) antDProps.href = href + + return +} + +export default Link diff --git a/src/components/Tag/Tag.stories.tsx b/src/components/Tag/Tag.stories.tsx new file mode 100644 index 00000000..d0970765 --- /dev/null +++ b/src/components/Tag/Tag.stories.tsx @@ -0,0 +1,25 @@ +import React, { FC } from 'react' +import Tag, { TagProps } from './index' +import { text, withKnobs } from '@storybook/addon-knobs' + +export default { + component: Tag, + decorators: [withKnobs], + excludeStories: /.*Data$/, + title: 'Tag' +} + +export const Default: FC = () => Default + +export const Colored: FC = () => { + const props: TagProps = { children: 'Blue', color: 'blue' } + return +} + +export const TagWithKnobs: FC = () => { + const props: TagProps = { + children: text('Tag text', 'Magenta'), + color: text('color', 'magenta') + } + return +} diff --git a/src/components/Tag/Tag.test.tsx b/src/components/Tag/Tag.test.tsx new file mode 100644 index 00000000..e060ba7a --- /dev/null +++ b/src/components/Tag/Tag.test.tsx @@ -0,0 +1,12 @@ +import React from 'react' +import { shallow, ShallowWrapper } from 'enzyme' +import Tag, { TagProps } from './index' + +let wrapper: ShallowWrapper + +describe('Tag', () => { + it('renders', () => { + wrapper = shallow(Tag) + expect(wrapper).toHaveLength(1) + }) +}) diff --git a/src/components/Tag/index.tsx b/src/components/Tag/index.tsx new file mode 100644 index 00000000..e64aff4d --- /dev/null +++ b/src/components/Tag/index.tsx @@ -0,0 +1,14 @@ +import 'antd/lib/tag/style/index.css' +import { Tag as AntDTag } from 'antd' +import React, { FC, ReactNode } from 'react' + +export interface TagProps { + children: ReactNode + color?: string +} + +const Tag: FC = ({ children, color }: TagProps) => { + return {children} +} + +export default Tag diff --git a/src/components/index.ts b/src/components/index.ts index 3f9defb9..b7874c17 100644 --- a/src/components/index.ts +++ b/src/components/index.ts @@ -1 +1,3 @@ export { default as Button } from './Button' +export { default as Link } from './Link' +export { default as Tag } from './Tag'