diff --git a/package.json b/package.json index 28bd451..33e59f4 100644 --- a/package.json +++ b/package.json @@ -91,6 +91,7 @@ "@react-aria/slider": "3.2.4", "@react-aria/ssr": "3.4.1", "@react-aria/switch": "3.3.1", + "@react-aria/table": "^3.5.0", "@react-aria/textfield": "3.8.1", "@react-aria/tooltip": "3.3.4", "@react-aria/utils": "3.14.2", @@ -99,6 +100,7 @@ "@react-stately/checkbox": "3.3.2", "@react-stately/collections": "3.5.1", "@react-stately/combobox": "3.3.1", + "@react-stately/data": "^3.7.0", "@react-stately/list": "3.6.1", "@react-stately/menu": "3.4.4", "@react-stately/numberfield": "3.3.1", @@ -108,6 +110,7 @@ "@react-stately/select": "3.3.4", "@react-stately/selection": "3.11.2", "@react-stately/slider": "3.2.4", + "@react-stately/table": "^3.5.0", "@react-stately/toggle": "3.4.4", "@react-stately/tooltip": "3.2.4", "@react-stately/tree": "3.4.1", @@ -116,6 +119,7 @@ "@react-types/checkbox": "3.4.1", "@react-types/combobox": "3.5.5", "@react-types/dialog": "3.4.5", + "@react-types/grid": "^3.1.4", "@react-types/menu": "3.7.3", "@react-types/numberfield": "3.3.5", "@react-types/overlays": "3.6.5", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index fd888c0..754c866 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -64,6 +64,9 @@ dependencies: '@react-aria/switch': specifier: 3.3.1 version: 3.3.1(react@17.0.2) + '@react-aria/table': + specifier: ^3.5.0 + version: 3.5.0(react-dom@17.0.2)(react@17.0.2) '@react-aria/textfield': specifier: 3.8.1 version: 3.8.1(react@17.0.2) @@ -88,6 +91,9 @@ dependencies: '@react-stately/combobox': specifier: 3.3.1 version: 3.3.1(react@17.0.2) + '@react-stately/data': + specifier: ^3.7.0 + version: 3.7.0(react@17.0.2) '@react-stately/list': specifier: 3.6.1 version: 3.6.1(react@17.0.2) @@ -115,6 +121,9 @@ dependencies: '@react-stately/slider': specifier: 3.2.4 version: 3.2.4(react@17.0.2) + '@react-stately/table': + specifier: ^3.5.0 + version: 3.5.0(react@17.0.2) '@react-stately/toggle': specifier: 3.4.4 version: 3.4.4(react@17.0.2) @@ -139,6 +148,9 @@ dependencies: '@react-types/dialog': specifier: 3.4.5 version: 3.4.5(react@17.0.2) + '@react-types/grid': + specifier: ^3.1.4 + version: 3.1.4(react@17.0.2) '@react-types/menu': specifier: 3.7.3 version: 3.7.3(react@17.0.2) @@ -230,7 +242,7 @@ devDependencies: version: 8.2.4(size-limit@8.1.0) '@size-limit/webpack': specifier: ^8.2.4 - version: 8.2.4(@swc/core@1.3.36)(size-limit@8.1.0) + version: 8.2.4(@swc/core@1.3.36)(esbuild@0.17.19)(size-limit@8.1.0) '@size-limit/webpack-why': specifier: ^8.2.4 version: 8.2.4(size-limit@8.1.0)(webpack@5.76.1) @@ -341,7 +353,7 @@ devDependencies: version: 8.3.0(eslint@8.5.0) eslint-config-react-app: specifier: ^7.0.0 - version: 7.0.0(eslint@8.5.0)(jest@29.4.3)(typescript@4.5.4) + version: 7.0.0(@babel/plugin-syntax-flow@7.21.4)(@babel/plugin-transform-react-jsx@7.21.5)(eslint@8.5.0)(jest@29.4.3)(typescript@4.5.4) eslint-plugin-import: specifier: ^2.25.3 version: 2.25.3(@typescript-eslint/parser@5.8.1)(eslint@8.5.0) @@ -362,7 +374,7 @@ devDependencies: version: 6.0.0 jest: specifier: ^29.4.3 - version: 29.4.3(@types/node@18.14.0) + version: 29.4.3(@types/node@18.14.0)(ts-node@10.9.1) jest-environment-jsdom: specifier: ^29.4.3 version: 29.4.3 @@ -422,7 +434,7 @@ devDependencies: version: 4.3.5(@types/node@18.14.0) webpack: specifier: ^5.76.1 - version: 5.76.1(@swc/core@1.3.36) + version: 5.76.1(@swc/core@1.3.36)(esbuild@0.17.19) packages: @@ -502,10 +514,10 @@ packages: '@babel/helpers': 7.21.5 '@babel/parser': 7.21.8 '@babel/template': 7.20.7 - '@babel/traverse': 7.21.5 + '@babel/traverse': 7.21.5(supports-color@5.5.0) '@babel/types': 7.21.5 convert-source-map: 1.9.0 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) gensync: 1.0.0-beta.2 json5: 2.2.3 semver: 6.3.0 @@ -605,7 +617,7 @@ packages: '@babel/core': 7.21.8 '@babel/helper-compilation-targets': 7.21.5(@babel/core@7.21.8) '@babel/helper-plugin-utils': 7.21.5 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) lodash.debounce: 4.0.8 resolve: 1.22.2 semver: 6.3.0 @@ -657,7 +669,7 @@ packages: '@babel/helper-split-export-declaration': 7.18.6 '@babel/helper-validator-identifier': 7.19.1 '@babel/template': 7.20.7 - '@babel/traverse': 7.21.5 + '@babel/traverse': 7.21.5(supports-color@5.5.0) '@babel/types': 7.21.5 transitivePeerDependencies: - supports-color @@ -698,7 +710,7 @@ packages: '@babel/helper-member-expression-to-functions': 7.21.5 '@babel/helper-optimise-call-expression': 7.18.6 '@babel/template': 7.20.7 - '@babel/traverse': 7.21.5 + '@babel/traverse': 7.21.5(supports-color@5.5.0) '@babel/types': 7.21.5 transitivePeerDependencies: - supports-color @@ -746,7 +758,7 @@ packages: dependencies: '@babel/helper-function-name': 7.21.0 '@babel/template': 7.20.7 - '@babel/traverse': 7.21.5 + '@babel/traverse': 7.21.5(supports-color@5.5.0) '@babel/types': 7.21.5 transitivePeerDependencies: - supports-color @@ -757,7 +769,7 @@ packages: engines: {node: '>=6.9.0'} dependencies: '@babel/template': 7.20.7 - '@babel/traverse': 7.21.5 + '@babel/traverse': 7.21.5(supports-color@5.5.0) '@babel/types': 7.21.5 transitivePeerDependencies: - supports-color @@ -1852,24 +1864,6 @@ packages: '@babel/types': 7.21.5 dev: true - /@babel/traverse@7.21.5: - resolution: {integrity: sha512-AhQoI3YjWi6u/y/ntv7k48mcrCXmus0t79J9qPNlk/lAsFlCiJ047RmbfMOawySTHtywXhbXgpx/8nXMYd+oFw==} - engines: {node: '>=6.9.0'} - dependencies: - '@babel/code-frame': 7.21.4 - '@babel/generator': 7.21.5 - '@babel/helper-environment-visitor': 7.21.5 - '@babel/helper-function-name': 7.21.0 - '@babel/helper-hoist-variables': 7.18.6 - '@babel/helper-split-export-declaration': 7.18.6 - '@babel/parser': 7.21.8 - '@babel/types': 7.21.5 - debug: 4.3.4 - globals: 11.12.0 - transitivePeerDependencies: - - supports-color - dev: true - /@babel/traverse@7.21.5(supports-color@5.5.0): resolution: {integrity: sha512-AhQoI3YjWi6u/y/ntv7k48mcrCXmus0t79J9qPNlk/lAsFlCiJ047RmbfMOawySTHtywXhbXgpx/8nXMYd+oFw==} engines: {node: '>=6.9.0'} @@ -2219,7 +2213,7 @@ packages: lodash.merge: 4.6.2 lodash.uniq: 4.5.0 resolve-from: 5.0.0 - ts-node: 10.9.1(@swc/core@1.3.36)(@types/node@18.14.0)(typescript@4.9.5) + ts-node: 10.9.1(@swc/core@1.3.36)(@types/node@18.14.0)(typescript@4.5.4) typescript: 4.9.5 transitivePeerDependencies: - '@swc/core' @@ -2554,7 +2548,7 @@ packages: engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dependencies: ajv: 6.12.6 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) espree: 9.5.2 globals: 13.20.0 ignore: 5.2.4 @@ -2574,13 +2568,13 @@ packages: resolution: {integrity: sha512-7bAYAv0w4AIao9DNg0avfOLTCPE9woAgs6SpXuMq11IN3A+l+cq8ghczwqSZBM11myvPSJA7vLn72q0rJ0QK6Q==} dependencies: '@formatjs/intl-localematcher': 0.2.32 - tslib: 2.5.0 + tslib: 2.5.1 dev: false /@formatjs/fast-memoize@2.0.1: resolution: {integrity: sha512-M2GgV+qJn5WJQAYewz7q2Cdl6fobQa69S1AzSM2y0P68ZDbK5cWrJIcPCO395Of1ksftGZoOt4LYCO/j9BKBSA==} dependencies: - tslib: 2.5.0 + tslib: 2.5.1 dev: false /@formatjs/icu-messageformat-parser@2.4.0: @@ -2588,20 +2582,20 @@ packages: dependencies: '@formatjs/ecma402-abstract': 1.15.0 '@formatjs/icu-skeleton-parser': 1.4.0 - tslib: 2.5.0 + tslib: 2.5.1 dev: false /@formatjs/icu-skeleton-parser@1.4.0: resolution: {integrity: sha512-Qq347VM616rVLkvN6QsKJELazRyNlbCiN47LdH0Mc5U7E2xV0vatiVhGqd3KFgbc055BvtnUXR7XX60dCGFuWg==} dependencies: '@formatjs/ecma402-abstract': 1.15.0 - tslib: 2.5.0 + tslib: 2.5.1 dev: false /@formatjs/intl-localematcher@0.2.32: resolution: {integrity: sha512-k/MEBstff4sttohyEpXxCmC3MqbUn9VvHGlZ8fauLzkbwXmVrEeyzS+4uhrvAk9DWU9/7otYWxyDox4nT/KVLQ==} dependencies: - tslib: 2.5.0 + tslib: 2.5.1 dev: false /@humanwhocodes/config-array@0.9.5: @@ -2609,7 +2603,7 @@ packages: engines: {node: '>=10.10.0'} dependencies: '@humanwhocodes/object-schema': 1.2.1 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) minimatch: 3.1.2 transitivePeerDependencies: - supports-color @@ -2680,7 +2674,7 @@ packages: slash: 3.0.0 dev: true - /@jest/core@29.5.0: + /@jest/core@29.5.0(ts-node@10.9.1): resolution: {integrity: sha512-28UzQc7ulUrOQw1IsN/kv1QES3q2kkbl/wGslyhAclqZ/8cMdB5M68BffkIdSJgKBUt50d3hbwJ92XESlE7LiQ==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} peerDependencies: @@ -2701,7 +2695,7 @@ packages: exit: 0.1.2 graceful-fs: 4.2.11 jest-changed-files: 29.5.0 - jest-config: 29.5.0(@types/node@18.14.0) + jest-config: 29.5.0(@types/node@18.14.0)(ts-node@10.9.1) jest-haste-map: 29.5.0 jest-message-util: 29.5.0 jest-regex-util: 29.4.3 @@ -3226,6 +3220,30 @@ packages: react: 17.0.2 dev: false + /@react-aria/grid@3.7.0(react-dom@17.0.2)(react@17.0.2): + resolution: {integrity: sha512-jXo+/wQotHDSaMSVdVT7Hxzz65Nj2yK1wssIUQPEZalRhcosGWI1vhdQOD0g9GQL1l5DLyw0m55sych6naeBlw==} + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 + react-dom: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 + dependencies: + '@react-aria/focus': 3.12.0(react@17.0.2) + '@react-aria/i18n': 3.7.1(react@17.0.2) + '@react-aria/interactions': 3.15.0(react@17.0.2) + '@react-aria/live-announcer': 3.3.0 + '@react-aria/selection': 3.14.0(react@17.0.2) + '@react-aria/utils': 3.16.0(react@17.0.2) + '@react-stately/collections': 3.7.0(react@17.0.2) + '@react-stately/grid': 3.6.0(react@17.0.2) + '@react-stately/selection': 3.13.0(react@17.0.2) + '@react-stately/virtualizer': 3.5.1(react@17.0.2) + '@react-types/checkbox': 3.4.3(react@17.0.2) + '@react-types/grid': 3.1.7(react@17.0.2) + '@react-types/shared': 3.18.0(react@17.0.2) + '@swc/helpers': 0.4.14 + react: 17.0.2 + react-dom: 17.0.2(react@17.0.2) + dev: false + /@react-aria/i18n@3.6.3(react@17.0.2): resolution: {integrity: sha512-cDWl8FXJIXsw/raWcThywBueCJ5ncoogq81wYVS6hfZVmSyncONIB3bwUL12cojmjX1VEP31sN0ujT/83QP95Q==} peerDependencies: @@ -3455,6 +3473,22 @@ packages: react: 17.0.2 dev: false + /@react-aria/selection@3.14.0(react@17.0.2): + resolution: {integrity: sha512-4/cq3mP75/qbhz2OkWmrfL6MJ+7+KfFsT6wvVNvxgOWR0n4jivHToKi3DXo2TzInvNU+10Ha7FCWavZoUNgSlA==} + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 + dependencies: + '@react-aria/focus': 3.12.0(react@17.0.2) + '@react-aria/i18n': 3.7.1(react@17.0.2) + '@react-aria/interactions': 3.15.0(react@17.0.2) + '@react-aria/utils': 3.16.0(react@17.0.2) + '@react-stately/collections': 3.7.0(react@17.0.2) + '@react-stately/selection': 3.13.0(react@17.0.2) + '@react-types/shared': 3.18.0(react@17.0.2) + '@swc/helpers': 0.4.14 + react: 17.0.2 + dev: false + /@react-aria/separator@3.2.6(react@17.0.2): resolution: {integrity: sha512-QhYqoLfu+4T3ASCs5Q8ZWfBbRKBUmqquVdREWvHyvVyOBk9kRN9nxsoIxlkss1RJlJJx59AYF9T9CwgL80/bvw==} peerDependencies: @@ -3531,6 +3565,30 @@ packages: react: 17.0.2 dev: false + /@react-aria/table@3.5.0(react-dom@17.0.2)(react@17.0.2): + resolution: {integrity: sha512-oYcsIEYbbjAzojRWUsAdtfxPzlEKBmk6o4svDHnGqC9HSj8/yExn8b8RB0veDP7E+5IdO62pUwUy48jBwWu2uw==} + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 + react-dom: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 + dependencies: + '@babel/runtime': 7.21.5 + '@react-aria/focus': 3.10.1(react@17.0.2) + '@react-aria/grid': 3.7.0(react-dom@17.0.2)(react@17.0.2) + '@react-aria/i18n': 3.6.3(react@17.0.2) + '@react-aria/interactions': 3.13.1(react@17.0.2) + '@react-aria/live-announcer': 3.3.0 + '@react-aria/selection': 3.12.1(react@17.0.2) + '@react-aria/utils': 3.14.2(react@17.0.2) + '@react-stately/table': 3.5.0(react@17.0.2) + '@react-stately/virtualizer': 3.5.1(react@17.0.2) + '@react-types/checkbox': 3.4.1(react@17.0.2) + '@react-types/grid': 3.1.4(react@17.0.2) + '@react-types/shared': 3.16.0(react@17.0.2) + '@react-types/table': 3.6.0(react@17.0.2) + react: 17.0.2 + react-dom: 17.0.2(react@17.0.2) + dev: false + /@react-aria/textfield@3.8.1(react@17.0.2): resolution: {integrity: sha512-jgun/B9ecuRCfBSJLX2xDuNwfuj1lL0oibMWoSv6Y++W+CSS8a7LjR1f9Kll5TDVkQiRRUm9qHwI0og9xTJrNw==} peerDependencies: @@ -3677,6 +3735,16 @@ packages: react: 17.0.2 dev: false + /@react-stately/data@3.7.0(react@17.0.2): + resolution: {integrity: sha512-+u5rKjraR7R6aMMXSDwH61jRRELnGGWr6xMFlk6G9fr8uAmil+AWrv8Dh8nZlJfy5I2hT1d8lbS9j5TRp/QFKg==} + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 + dependencies: + '@babel/runtime': 7.21.5 + '@react-types/shared': 3.16.0(react@17.0.2) + react: 17.0.2 + dev: false + /@react-stately/grid@3.6.0(react@17.0.2): resolution: {integrity: sha512-Sq/ivfq9Kskghoe6rYh2PfhB9/jBGfoj8wUZ4bqHcalTrBjfUvkcWMSFosibYPNZFDkA7r00bbJPDJVf1VLhuw==} peerDependencies: @@ -3833,6 +3901,21 @@ packages: react: 17.0.2 dev: false + /@react-stately/table@3.5.0(react@17.0.2): + resolution: {integrity: sha512-C0HFfKMCOomqPtRCPs85AtoJGPnGu9mzFfwksFxAssdIatw3t66h5SJS0vSSql7Ku9h70scmvJR+nIOckx0IeA==} + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 + dependencies: + '@babel/runtime': 7.21.5 + '@react-stately/collections': 3.5.1(react@17.0.2) + '@react-stately/grid': 3.6.0(react@17.0.2) + '@react-stately/selection': 3.11.2(react@17.0.2) + '@react-types/grid': 3.1.4(react@17.0.2) + '@react-types/shared': 3.16.0(react@17.0.2) + '@react-types/table': 3.6.0(react@17.0.2) + react: 17.0.2 + dev: false + /@react-stately/table@3.9.0(react@17.0.2): resolution: {integrity: sha512-Cl0jmC5eCEhWBAhCjhGklsgYluziNZHF34lHnc99T/DPP+OxwrgwS9rJKTW7L6UOvHU/ADKjEwkE/fZuqVBohg==} peerDependencies: @@ -3981,6 +4064,15 @@ packages: react: 17.0.2 dev: false + /@react-types/grid@3.1.4(react@17.0.2): + resolution: {integrity: sha512-i9f2VEnlex5BFV/AdSUGg71xoukn2i/XT2VLxUXUagy23gFxKJk9Xr3BT9bw+pRRLPwm/Ib+h9ELUdgi8lUAKA==} + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 + dependencies: + '@react-types/shared': 3.16.0(react@17.0.2) + react: 17.0.2 + dev: false + /@react-types/grid@3.1.7(react@17.0.2): resolution: {integrity: sha512-YKo/AbJrgWErPmr5y0K4o6Ts9ModFv5+2FVujecIydu3zLuHsVcx//6uVeHSy2W+uTV9vU/dpMP+GGgg+vWQhw==} peerDependencies: @@ -4212,10 +4304,10 @@ packages: dependencies: '@statoscope/webpack-plugin': 5.26.2(webpack@5.76.1) size-limit: 8.1.0 - webpack: 5.76.1(@swc/core@1.3.36) + webpack: 5.76.1(@swc/core@1.3.36)(esbuild@0.17.19) dev: true - /@size-limit/webpack@8.2.4(@swc/core@1.3.36)(size-limit@8.1.0): + /@size-limit/webpack@8.2.4(@swc/core@1.3.36)(esbuild@0.17.19)(size-limit@8.1.0): resolution: {integrity: sha512-L6TSQpX89cSeWQ1BL31BsaYucao0MGNW1xySHVO7jlgmOwnHC7j5zq91QRN9G6eMG84W+F3uRV4AiyCdZxKz9g==} engines: {node: ^14.0.0 || ^16.0.0 || >=18.0.0} peerDependencies: @@ -4223,7 +4315,7 @@ packages: dependencies: nanoid: 3.3.6 size-limit: 8.1.0 - webpack: 5.76.1(@swc/core@1.3.36) + webpack: 5.76.1(@swc/core@1.3.36)(esbuild@0.17.19) transitivePeerDependencies: - '@swc/core' - esbuild @@ -4449,7 +4541,7 @@ packages: '@statoscope/webpack-stats-extension-package-info': 5.26.2(webpack@5.76.1) '@statoscope/webpack-ui': 5.26.2 open: 8.4.2 - webpack: 5.76.1(@swc/core@1.3.36) + webpack: 5.76.1(@swc/core@1.3.36)(esbuild@0.17.19) dev: true /@statoscope/webpack-stats-extension-compressed@5.26.2(webpack@5.76.1): @@ -4460,7 +4552,7 @@ packages: '@statoscope/stats': 5.14.1 '@statoscope/stats-extension-compressed': 5.25.0 '@statoscope/webpack-model': 5.26.2 - webpack: 5.76.1(@swc/core@1.3.36) + webpack: 5.76.1(@swc/core@1.3.36)(esbuild@0.17.19) dev: true /@statoscope/webpack-stats-extension-package-info@5.26.2(webpack@5.76.1): @@ -4471,7 +4563,7 @@ packages: '@statoscope/stats': 5.14.1 '@statoscope/stats-extension-package-info': 5.25.0 '@statoscope/webpack-model': 5.26.2 - webpack: 5.76.1(@swc/core@1.3.36) + webpack: 5.76.1(@swc/core@1.3.36)(esbuild@0.17.19) dev: true /@statoscope/webpack-ui@5.20.1: @@ -5135,7 +5227,7 @@ packages: dependencies: '@babel/generator': 7.21.5 '@babel/parser': 7.21.8 - '@babel/traverse': 7.21.5 + '@babel/traverse': 7.21.5(supports-color@5.5.0) '@babel/types': 7.21.5 '@storybook/csf': 0.1.0 '@storybook/types': 7.0.10 @@ -5562,7 +5654,7 @@ packages: /@swc/helpers@0.4.14: resolution: {integrity: sha512-4C7nX/dvpzB7za4Ql9K81xK3HPxCpHMgwTZVyf+9JQ6VUbn9jjZVN7/Nkdz/Ugzs2CSjqnL/UPXroiVBVHUWUw==} dependencies: - tslib: 2.5.0 + tslib: 2.5.1 dev: false /@swc/jest@0.2.24(@swc/core@1.3.36): @@ -6083,7 +6175,7 @@ packages: '@typescript-eslint/experimental-utils': 5.8.1(eslint@8.5.0)(typescript@4.5.4) '@typescript-eslint/parser': 5.8.1(eslint@8.5.0)(typescript@4.5.4) '@typescript-eslint/scope-manager': 5.8.1 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) eslint: 8.5.0 functional-red-black-tree: 1.0.1 ignore: 5.2.4 @@ -6139,7 +6231,7 @@ packages: '@typescript-eslint/scope-manager': 5.8.1 '@typescript-eslint/types': 5.8.1 '@typescript-eslint/typescript-estree': 5.8.1(typescript@4.5.4) - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) eslint: 8.5.0 typescript: 4.5.4 transitivePeerDependencies: @@ -6183,7 +6275,7 @@ packages: dependencies: '@typescript-eslint/types': 5.59.6 '@typescript-eslint/visitor-keys': 5.59.6 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) globby: 11.1.0 is-glob: 4.0.3 semver: 7.5.1 @@ -6204,7 +6296,7 @@ packages: dependencies: '@typescript-eslint/types': 5.8.1 '@typescript-eslint/visitor-keys': 5.8.1 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) globby: 11.1.0 is-glob: 4.0.3 semver: 7.5.1 @@ -6387,7 +6479,7 @@ packages: esbuild: '>=0.10.0' dependencies: esbuild: 0.17.19 - tslib: 2.5.0 + tslib: 2.5.1 dev: true /JSONStream@1.3.5: @@ -6477,7 +6569,7 @@ packages: resolution: {integrity: sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==} engines: {node: '>= 6.0.0'} dependencies: - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) transitivePeerDependencies: - supports-color dev: true @@ -6722,21 +6814,21 @@ packages: resolution: {integrity: sha512-O0yuUDnZeQDL+ncNGlJ78BiO4jnYI3bvMsD5prT0/nsgijG/LpNBIr63gTjVTNsiGkgQhiyCShTgxt8oXOrklA==} engines: {node: '>=4'} dependencies: - tslib: 2.5.0 + tslib: 2.5.1 dev: true /ast-types@0.15.2: resolution: {integrity: sha512-c27loCv9QkZinsa5ProX751khO9DJl/AcB5c2KNtA6NRvHKS0PgLfcftz72KVq504vB0Gku5s2kUZzDBvQWvHg==} engines: {node: '>=4'} dependencies: - tslib: 2.5.0 + tslib: 2.5.1 dev: true /ast-types@0.16.1: resolution: {integrity: sha512-6t10qk83GOG8p0vKmaCr8eiilZwO171AvbROMtvvNiwrTly62t+7XkA8RdIIVbpMhCASAsxgAzdRSwh6nw/5Dg==} engines: {node: '>=4'} dependencies: - tslib: 2.5.0 + tslib: 2.5.1 dev: true /async-limiter@1.0.1: @@ -7076,7 +7168,7 @@ packages: hasBin: true dependencies: caniuse-lite: 1.0.30001488 - electron-to-chromium: 1.4.397 + electron-to-chromium: 1.4.399 node-releases: 2.0.10 update-browserslist-db: 1.0.11(browserslist@4.21.5) dev: true @@ -7571,7 +7663,7 @@ packages: dependencies: '@types/node': 18.14.0 cosmiconfig: 8.1.3 - ts-node: 10.9.1(@swc/core@1.3.36)(@types/node@18.14.0)(typescript@4.9.5) + ts-node: 10.9.1(@swc/core@1.3.36)(@types/node@18.14.0)(typescript@4.5.4) typescript: 4.9.5 dev: true @@ -7769,18 +7861,6 @@ packages: ms: 2.1.3 dev: true - /debug@4.3.4: - resolution: {integrity: sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==} - engines: {node: '>=6.0'} - peerDependencies: - supports-color: '*' - peerDependenciesMeta: - supports-color: - optional: true - dependencies: - ms: 2.1.2 - dev: true - /debug@4.3.4(supports-color@5.5.0): resolution: {integrity: sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==} engines: {node: '>=6.0'} @@ -7957,7 +8037,7 @@ packages: hasBin: true dependencies: address: 1.2.2 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) transitivePeerDependencies: - supports-color dev: true @@ -8063,8 +8143,8 @@ packages: jake: 10.8.6 dev: true - /electron-to-chromium@1.4.397: - resolution: {integrity: sha512-jwnPxhh350Q/aMatQia31KAIQdhEsYS0fFZ0BQQlN9tfvOEwShu6ZNwI4kL/xBabjcB/nTy6lSt17kNIluJZ8Q==} + /electron-to-chromium@1.4.399: + resolution: {integrity: sha512-+V1aNvVgoWNWYIbMOiQ1n5fRIaY4SlQ/uRlrsCjLrUwr/3OvQgiX2f5vdav4oArVT9TnttJKcPCqjwPNyZqw/A==} dev: true /elegant-spinner@1.0.1: @@ -8232,7 +8312,7 @@ packages: esbuild: 0.17.19 get-tsconfig: 4.5.0 loader-utils: 2.0.4 - webpack: 5.76.1(@swc/core@1.3.36) + webpack: 5.76.1(@swc/core@1.3.36)(esbuild@0.17.19) webpack-sources: 1.4.3 dev: true @@ -8245,7 +8325,7 @@ packages: peerDependencies: esbuild: '>=0.12 <1' dependencies: - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) esbuild: 0.17.19 transitivePeerDependencies: - supports-color @@ -8332,7 +8412,7 @@ packages: eslint: 8.5.0 dev: true - /eslint-config-react-app@7.0.0(eslint@8.5.0)(jest@29.4.3)(typescript@4.5.4): + /eslint-config-react-app@7.0.0(@babel/plugin-syntax-flow@7.21.4)(@babel/plugin-transform-react-jsx@7.21.5)(eslint@8.5.0)(jest@29.4.3)(typescript@4.5.4): resolution: {integrity: sha512-xyymoxtIt1EOsSaGag+/jmcywRuieQoA2JbPCjnw9HukFj9/97aGPoZVFioaotzk1K5Qt9sHO5EutZbkrAXS0g==} engines: {node: '>=14.0.0'} peerDependencies: @@ -8350,7 +8430,7 @@ packages: babel-preset-react-app: 10.0.1 confusing-browser-globals: 1.0.11 eslint: 8.5.0 - eslint-plugin-flowtype: 8.0.3(eslint@8.5.0) + eslint-plugin-flowtype: 8.0.3(@babel/plugin-syntax-flow@7.21.4)(@babel/plugin-transform-react-jsx@7.21.5)(eslint@8.5.0) eslint-plugin-import: 2.25.3(@typescript-eslint/parser@5.8.1)(eslint@8.5.0) eslint-plugin-jest: 25.7.0(@typescript-eslint/eslint-plugin@5.8.1)(eslint@8.5.0)(jest@29.4.3)(typescript@4.5.4) eslint-plugin-jsx-a11y: 6.5.1(eslint@8.5.0) @@ -8406,7 +8486,7 @@ packages: - supports-color dev: true - /eslint-plugin-flowtype@8.0.3(eslint@8.5.0): + /eslint-plugin-flowtype@8.0.3(@babel/plugin-syntax-flow@7.21.4)(@babel/plugin-transform-react-jsx@7.21.5)(eslint@8.5.0): resolution: {integrity: sha512-dX8l6qUL6O+fYPtpNRideCFSpmWOUVx5QcaGLVqe/vlDiBSe4vYljDWDETwnyFzpl7By/WVIu6rcrniCgH9BqQ==} engines: {node: '>=12.0.0'} peerDependencies: @@ -8414,6 +8494,8 @@ packages: '@babel/plugin-transform-react-jsx': ^7.14.9 eslint: ^8.1.0 dependencies: + '@babel/plugin-syntax-flow': 7.21.4(@babel/core@7.21.8) + '@babel/plugin-transform-react-jsx': 7.21.5(@babel/core@7.21.8) eslint: 8.5.0 lodash: 4.17.21 string-natural-compare: 3.0.1 @@ -8466,7 +8548,7 @@ packages: '@typescript-eslint/eslint-plugin': 5.8.1(@typescript-eslint/parser@5.8.1)(eslint@8.5.0)(typescript@4.5.4) '@typescript-eslint/experimental-utils': 5.59.6(eslint@8.5.0)(typescript@4.5.4) eslint: 8.5.0 - jest: 29.4.3(@types/node@18.14.0) + jest: 29.4.3(@types/node@18.14.0)(ts-node@10.9.1) transitivePeerDependencies: - supports-color - typescript @@ -8600,7 +8682,7 @@ packages: ajv: 6.12.6 chalk: 4.1.2 cross-spawn: 7.0.3 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) doctrine: 3.0.0 enquirer: 2.3.6 escape-string-regexp: 4.0.0 @@ -8680,7 +8762,7 @@ packages: resolution: {integrity: sha512-YNF+mZ/Wu2FU/gvmzuWtYc8rloubL7wfXCTgouFrnjGVXPA/EeYYA7pupXWrb3Iv1cTBeSSxxJIbK23l4MRNqg==} engines: {node: '>=8.3.0'} dependencies: - '@babel/traverse': 7.21.5 + '@babel/traverse': 7.21.5(supports-color@5.5.0) '@babel/types': 7.21.5 c8: 7.13.0 transitivePeerDependencies: @@ -8992,7 +9074,7 @@ packages: resolution: {integrity: sha512-KSuV3ur4gf2KqMNoZx3nXNVhqCkn42GuTYCX4tXPEwf0MjpFQmNMiN6m7dXaUXgIoivL6/65agoUMg4RLS0Vbg==} engines: {node: '>=10'} dependencies: - tslib: 2.5.0 + tslib: 2.5.1 dev: false /for-each@0.3.3: @@ -9481,7 +9563,7 @@ packages: dependencies: '@tootallnate/once': 2.0.0 agent-base: 6.0.2 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) transitivePeerDependencies: - supports-color dev: true @@ -9491,7 +9573,7 @@ packages: engines: {node: '>= 6.0.0'} dependencies: agent-base: 5.1.1 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) transitivePeerDependencies: - supports-color dev: true @@ -9501,7 +9583,7 @@ packages: engines: {node: '>= 6'} dependencies: agent-base: 6.0.2 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) transitivePeerDependencies: - supports-color dev: true @@ -9620,7 +9702,7 @@ packages: '@formatjs/ecma402-abstract': 1.15.0 '@formatjs/fast-memoize': 2.0.1 '@formatjs/icu-messageformat-parser': 2.4.0 - tslib: 2.5.0 + tslib: 2.5.1 dev: false /ip@2.0.0: @@ -10012,7 +10094,7 @@ packages: resolution: {integrity: sha512-n3s8EwkdFIJCG3BPKBYvskgXGoy88ARzvegkitk60NxRdwltLOTaH7CUiMRXvwYorl0Q712iEjcWB+fK/MrWVw==} engines: {node: '>=10'} dependencies: - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) istanbul-lib-coverage: 3.2.0 source-map: 0.6.1 transitivePeerDependencies: @@ -10074,7 +10156,7 @@ packages: - supports-color dev: true - /jest-cli@29.5.0(@types/node@18.14.0): + /jest-cli@29.5.0(@types/node@18.14.0)(ts-node@10.9.1): resolution: {integrity: sha512-L1KcP1l4HtfwdxXNFCL5bmUbLQiKrakMUriBEcc1Vfz6gx31ORKdreuWvmQVBit+1ss9NNR3yxjwfwzZNdQXJw==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} hasBin: true @@ -10084,14 +10166,14 @@ packages: node-notifier: optional: true dependencies: - '@jest/core': 29.5.0 + '@jest/core': 29.5.0(ts-node@10.9.1) '@jest/test-result': 29.5.0 '@jest/types': 29.5.0 chalk: 4.1.2 exit: 0.1.2 graceful-fs: 4.2.11 import-local: 3.1.0 - jest-config: 29.5.0(@types/node@18.14.0) + jest-config: 29.5.0(@types/node@18.14.0)(ts-node@10.9.1) jest-util: 29.5.0 jest-validate: 29.5.0 prompts: 2.4.2 @@ -10102,7 +10184,7 @@ packages: - ts-node dev: true - /jest-config@29.5.0(@types/node@18.14.0): + /jest-config@29.5.0(@types/node@18.14.0)(ts-node@10.9.1): resolution: {integrity: sha512-kvDUKBnNJPNBmFFOhDbm59iu1Fii1Q6SxyhXfvylq3UTHbg6o7j/g8k2dZyXWLvfdKB1vAPxNZnMgtKJcmu3kA==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} peerDependencies: @@ -10137,6 +10219,7 @@ packages: pretty-format: 29.5.0 slash: 3.0.0 strip-json-comments: 3.1.1 + ts-node: 10.9.1(@swc/core@1.3.36)(@types/node@18.14.0)(typescript@4.5.4) transitivePeerDependencies: - supports-color dev: true @@ -10387,7 +10470,7 @@ packages: '@babel/generator': 7.21.5 '@babel/plugin-syntax-jsx': 7.21.4(@babel/core@7.21.8) '@babel/plugin-syntax-typescript': 7.21.4(@babel/core@7.21.8) - '@babel/traverse': 7.21.5 + '@babel/traverse': 7.21.5(supports-color@5.5.0) '@babel/types': 7.21.5 '@jest/expect-utils': 29.5.0 '@jest/transform': 29.5.0 @@ -10477,7 +10560,7 @@ packages: supports-color: 8.1.1 dev: true - /jest@29.4.3(@types/node@18.14.0): + /jest@29.4.3(@types/node@18.14.0)(ts-node@10.9.1): resolution: {integrity: sha512-XvK65feuEFGZT8OO0fB/QAQS+LGHvQpaadkH5p47/j3Ocqq3xf2pK9R+G0GzgfuhXVxEv76qCOOcMb5efLk6PA==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} hasBin: true @@ -10487,10 +10570,10 @@ packages: node-notifier: optional: true dependencies: - '@jest/core': 29.5.0 + '@jest/core': 29.5.0(ts-node@10.9.1) '@jest/types': 29.5.0 import-local: 3.1.0 - jest-cli: 29.5.0(@types/node@18.14.0) + jest-cli: 29.5.0(@types/node@18.14.0)(ts-node@10.9.1) transitivePeerDependencies: - '@types/node' - supports-color @@ -10739,7 +10822,7 @@ packages: chalk: 3.0.0 commander: 4.1.1 cosmiconfig: 6.0.0 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) dedent: 0.7.0 execa: 3.4.0 listr: 0.14.3 @@ -11449,7 +11532,7 @@ packages: resolution: {integrity: sha512-6Mj0yHLdUZjHnOPgr5xfWIMqMWS12zDN6iws9SLuSz76W8jTtAv24MN4/CL7gJrl5vtxGInkkqDv/JIoRsQOvA==} dependencies: '@types/debug': 4.1.7 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) decode-named-character-reference: 1.0.2 micromark-core-commonmark: 1.0.6 micromark-factory-space: 1.0.0 @@ -12273,7 +12356,7 @@ packages: engines: {node: '>=8.16.0'} dependencies: '@types/mime-types': 2.1.1 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) extract-zip: 1.7.0 https-proxy-agent: 4.0.0 mime: 2.6.0 @@ -12612,7 +12695,7 @@ packages: ast-types: 0.15.2 esprima: 4.0.1 source-map: 0.6.1 - tslib: 2.5.0 + tslib: 2.5.1 dev: true /recast@0.23.2: @@ -12623,7 +12706,7 @@ packages: ast-types: 0.16.1 esprima: 4.0.1 source-map: 0.6.1 - tslib: 2.5.0 + tslib: 2.5.1 dev: true /rechoir@0.6.2: @@ -13459,7 +13542,7 @@ packages: webpack: '>=2' dependencies: '@swc/core': 1.3.36 - webpack: 5.76.1(@swc/core@1.3.36) + webpack: 5.76.1(@swc/core@1.3.36)(esbuild@0.17.19) dev: true /symbol-observable@1.2.0: @@ -13546,8 +13629,8 @@ packages: engines: {node: '>=8'} dev: true - /terser-webpack-plugin@5.3.8(@swc/core@1.3.36)(webpack@5.76.1): - resolution: {integrity: sha512-WiHL3ElchZMsK27P8uIUh4604IgJyAW47LVXGbEoB21DbQcZ+OuMpGjVYnEUaqcWM6dO8uS2qUbA7LSCWqvsbg==} + /terser-webpack-plugin@5.3.9(@swc/core@1.3.36)(esbuild@0.17.19)(webpack@5.76.1): + resolution: {integrity: sha512-ZuXsqE07EcggTWQjXUj+Aot/OMcD0bMKGgF63f7UxYcu5/AJF53aIpK1YoP5xR9l6s/Hy2b+t1AM0bLNPRuhwA==} engines: {node: '>= 10.13.0'} peerDependencies: '@swc/core': '*' @@ -13564,11 +13647,12 @@ packages: dependencies: '@jridgewell/trace-mapping': 0.3.18 '@swc/core': 1.3.36 + esbuild: 0.17.19 jest-worker: 27.5.1 schema-utils: 3.1.2 serialize-javascript: 6.0.1 terser: 5.17.4 - webpack: 5.76.1(@swc/core@1.3.36) + webpack: 5.76.1(@swc/core@1.3.36)(esbuild@0.17.19) dev: true /terser@5.17.4: @@ -13684,7 +13768,7 @@ packages: engines: {node: '>=6.10'} dev: true - /ts-node@10.9.1(@swc/core@1.3.36)(@types/node@18.14.0)(typescript@4.9.5): + /ts-node@10.9.1(@swc/core@1.3.36)(@types/node@18.14.0)(typescript@4.5.4): resolution: {integrity: sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==} hasBin: true peerDependencies: @@ -13711,7 +13795,7 @@ packages: create-require: 1.1.1 diff: 4.0.2 make-error: 1.3.6 - typescript: 4.9.5 + typescript: 4.5.4 v8-compile-cache-lib: 3.0.1 yn: 3.1.1 dev: true @@ -13729,8 +13813,8 @@ packages: resolution: {integrity: sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==} dev: true - /tslib@2.5.0: - resolution: {integrity: sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg==} + /tslib@2.5.1: + resolution: {integrity: sha512-KaI6gPil5m9vF7DKaoXxx1ia9fxS4qG5YveErRRVknPDXXriu5M8h48YRjB6h5ZUOKuAKlSJYb0GaDe8I39fRw==} /tsutils@3.21.0(typescript@4.5.4): resolution: {integrity: sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==} @@ -14034,7 +14118,7 @@ packages: dependencies: '@types/react': 17.0.38 react: 17.0.2 - tslib: 2.5.0 + tslib: 2.5.1 dev: false /use-resize-observer@9.1.0(react-dom@17.0.2)(react@17.0.2): @@ -14061,7 +14145,7 @@ packages: '@types/react': 17.0.38 detect-node-es: 1.1.0 react: 17.0.2 - tslib: 2.5.0 + tslib: 2.5.1 dev: false /util-deprecate@1.0.2: @@ -14233,7 +14317,7 @@ packages: resolution: {integrity: sha512-5tyDlKLqPfMqjT3Q9TAqf2YqjwmnUleZwzJi1A5qXnlBCdj2AtOJ6wAWdglTIDOPgOiOrXeBeFcsQ8+aGQ6QbA==} dev: true - /webpack@5.76.1(@swc/core@1.3.36): + /webpack@5.76.1(@swc/core@1.3.36)(esbuild@0.17.19): resolution: {integrity: sha512-4+YIK4Abzv8172/SGqObnUjaIHjLEuUasz9EwQj/9xmPPkYJy2Mh03Q/lJfSD3YLzbxy5FeTq5Uw0323Oh6SJQ==} engines: {node: '>=10.13.0'} hasBin: true @@ -14264,7 +14348,7 @@ packages: neo-async: 2.6.2 schema-utils: 3.1.2 tapable: 2.2.1 - terser-webpack-plugin: 5.3.8(@swc/core@1.3.36)(webpack@5.76.1) + terser-webpack-plugin: 5.3.9(@swc/core@1.3.36)(esbuild@0.17.19)(webpack@5.76.1) watchpack: 2.4.0 webpack-sources: 3.2.3 transitivePeerDependencies: diff --git a/src/components/actions/Button/Button.stories.tsx b/src/components/actions/Button/Button.stories.tsx index f6cfe59..e43e18e 100644 --- a/src/components/actions/Button/Button.stories.tsx +++ b/src/components/actions/Button/Button.stories.tsx @@ -1,4 +1,4 @@ -import { CaretDown, CurrencyCircleDollar } from '@jengaicons/react'; +import { CaretDownFill, CurrencyCircleDollar } from '@jengaicons/react'; import { baseProps } from '../../../stories/lists/baseProps'; import { Space } from '../../layout/Space'; @@ -44,7 +44,7 @@ const Template = ({ icon, rightIcon, label, onClick, ...props }) => ( > : undefined} - rightIcon={rightIcon ? : undefined} + rightIcon={rightIcon ? : undefined} {...props} onPress={(e) => console.log('Press', e)} > @@ -57,7 +57,7 @@ const TemplateSizes = ({ label, icon, rightIcon, size, ...props }) => ( : undefined} - rightIcon={rightIcon ? : undefined} + rightIcon={rightIcon ? : undefined} {...props} size="small" > @@ -65,7 +65,7 @@ const TemplateSizes = ({ label, icon, rightIcon, size, ...props }) => ( : undefined} - rightIcon={rightIcon ? : undefined} + rightIcon={rightIcon ? : undefined} {...props} size="medium" > @@ -73,7 +73,7 @@ const TemplateSizes = ({ label, icon, rightIcon, size, ...props }) => ( : undefined} - rightIcon={rightIcon ? : undefined} + rightIcon={rightIcon ? : undefined} {...props} size="large" > diff --git a/src/components/organisms/Table/ReactStatelyCollections.tsx b/src/components/organisms/Table/ReactStatelyCollections.tsx new file mode 100644 index 0000000..6ab6bdd --- /dev/null +++ b/src/components/organisms/Table/ReactStatelyCollections.tsx @@ -0,0 +1,36 @@ +import { ColumnProps, CellProps, RowProps } from '@react-stately/table'; +import { Column as _Column } from '@react-stately/table'; +import { Cell as _Cell } from '@react-stately/table'; +import { Row as _Row } from '@react-stately/table'; +import { TableBody as _TableBody } from '@react-stately/table'; +import { TableHeader as _TableHeader } from '@react-stately/table'; +import { HTMLProps } from 'react'; + +import { BasePropsWithoutChildren, Styles } from '../../../tasty'; +export const TableHeader = _TableHeader; +export const TableBody = _TableBody; +export const Row = _Row as ( + props: RowProps & { + align?: 'left' | 'center' | 'right'; + styles?: Styles; + } & BasePropsWithoutChildren & + HTMLProps, +) => JSX.Element; +export const Column = _Column as ( + props: ColumnProps & { + align?: 'left' | 'center' | 'right'; + dataType?: 'generic' | 'numeric' | 'date'; + colCellStyles?: Styles; + } & BasePropsWithoutChildren & + HTMLProps, +) => JSX.Element; + +export const AligmentFromDTCatalog = { + generic: 'left', + numeric: 'right', + date: 'right', +}; + +export const Cell = _Cell as ( + props: CellProps & BasePropsWithoutChildren & HTMLProps, +) => JSX.Element; diff --git a/src/components/organisms/Table/Table.stories.tsx b/src/components/organisms/Table/Table.stories.tsx new file mode 100644 index 0000000..e34a79e --- /dev/null +++ b/src/components/organisms/Table/Table.stories.tsx @@ -0,0 +1,354 @@ +import { useAsyncList } from '@react-stately/data'; + +import { Cell, Column, Row, TableBody, TableHeader } from './index'; +import { Table as NewTable } from './index'; +export default { + title: 'Forms/Table', + component: NewTable, +}; + +const AsyncTableTemplate = (args) => { + let list = useAsyncList({ + async load({ signal }) { + let res = await fetch(`https://swapi.py4e.com/api/people/?search`, { + signal, + }); + let json = await res.json(); + return { + items: json.results, + }; + }, + async sort({ items, sortDescriptor }) { + return { + items: items.sort((a, b) => { + let first = a[sortDescriptor.column]; + let second = b[sortDescriptor.column]; + let cmp = + (parseInt(first) || first) < (parseInt(second) || second) ? -1 : 1; + if (sortDescriptor.direction === 'descending') { + cmp *= -1; + } + return cmp; + }), + }; + }, + }); + + return ( + + + + Name + + + Height + + + Mass + + + Birth Year + + + + {(item: { name: string }) => ( + + {(columnKey) => {item[columnKey]}} + + )} + + + ); +}; +const Template = (args) => ( + + + Name + Type + Date Modified + + + + Games + File folder + 6/7/2020 + + + Program Files + File folder + 4/7/2021 + + + bootmgr + System file + 11/20/2010 + + + log.txt + Text Document + 1/18/2016 + + + +); + +const NewTemplate = (args) => ( + + + Name + + Type + + Date Modified + + + + Games + File folder + 6/7/2020 + + + Program Files + File folder + 4/7/2021 + + + bootmgr + System file + 11/20/2010 + + + log.txt + Text Document + 1/18/2016 + + + +); + +const PaginatedAsyncTemplate = (args) => { + let list = useAsyncList({ + async load({ signal }) { + let res = await fetch(`https://swapi.py4e.com/api/people/?search`, { + signal, + }); + let json = await res.json(); + return { + items: json.results, + }; + }, + async sort({ items, sortDescriptor }) { + return { + items: items.sort((a, b) => { + let first = a[sortDescriptor.column]; + let second = b[sortDescriptor.column]; + let cmp = + (parseInt(first) || first) < (parseInt(second) || second) ? -1 : 1; + if (sortDescriptor.direction === 'descending') { + cmp *= -1; + } + return cmp; + }), + }; + }, + }); + return ( + + + + Name + + + Height + + + Mass + + + Birth Year + + + + {(item: { name: string }) => ( + + {(columnKey) => {item[columnKey]}} + + )} + + + ); +}; + +const PaginatedTemplate = (args) => ( + + + Name + Type + Date Modified + + + + Games + File folder + 6/7/2020 + + + Program Files + File folder + 4/7/2021 + + + bootmgr + System file + 11/20/2010 + + + log.txt + Text Document + 1/18/2016 + + + +); + +const AsyncNew = (args) => { + let columns = [ + { name: 'Name', key: 'name' }, + { name: 'Height', key: 'height' }, + { name: 'Mass', key: 'mass' }, + { name: 'Birth Year', key: 'birth_year' }, + ]; + + let list = useAsyncList({ + async load({ signal, cursor }) { + if (cursor) { + cursor = cursor.replace(/^http:\/\//i, 'https://'); + } + + let res = await fetch( + cursor || `https://swapi.py4e.com/api/people/?search=`, + { signal }, + ); + let json = await res.json(); + + return { + items: json.results, + cursor: json.next, + }; + }, + }); + + return ( + + + {(column) => ( + + {column.name} + + )} + + + {(item) => ( + {(key) => {item[key]}} + )} + + + ); +}; + +export const Default = Template.bind({}); +Default.args = {}; +export const WithZebraStripes = Template.bind({}); +WithZebraStripes.args = { zebraStripes: true }; +export const WithColumnTypesAndColumnAlignment = NewTemplate.bind({}); +WithColumnTypesAndColumnAlignment.args = {}; +export const WithSelection = Template.bind({}); +WithSelection.args = { selectionMode: 'single' }; +export const WithMultipleSelection = Template.bind({}); +WithMultipleSelection.args = { selectionMode: 'multiple' }; +export const WithReplaceBehavior = Template.bind({}); +WithReplaceBehavior.args = { + selectionMode: 'single', + selectionBehavior: 'replace', +}; +export const WithMultipleSelectionAndReplaceBehavior = Template.bind({}); +WithMultipleSelectionAndReplaceBehavior.args = { + selectionMode: 'multiple', + selectionBehavior: 'replace', +}; +export const WithDefaultSelection = Template.bind({}); +WithDefaultSelection.args = { + selectionMode: 'single', + defaultSelectedKeys: ['r.1'], + disallowEmptySelection: true, +}; + +export const AsyncExample = AsyncTableTemplate.bind({}); +AsyncExample.args = {}; + +export const WithStickyHeaderAndScrolling = AsyncTableTemplate.bind({}); +WithStickyHeaderAndScrolling.args = { + isVirtualized: true, +}; +export const PaginationExample = PaginatedTemplate.bind({}); +PaginationExample.args = { + recordsPerPage: 3, + bodyStyles: { + background: '#fff', + }, +}; +const EmptyTemplate = (args) => ( + + + + Name + + Type + Size + + {[]} + +); + +export const WithEmpty = EmptyTemplate.bind({}); +WithEmpty.args = { + IsEmpty: HEllo, +}; +export const PaginationAsyncExample = PaginatedAsyncTemplate.bind({}); +PaginationAsyncExample.args = { + recordsPerPage: 3, +}; + +export const NewAsync = AsyncNew.bind({}); +NewAsync.args = { + showFooter: false, + styles: { + height: 'max 300px', + }, +}; diff --git a/src/components/organisms/Table/Table.tsx b/src/components/organisms/Table/Table.tsx new file mode 100644 index 0000000..123fcb9 --- /dev/null +++ b/src/components/organisms/Table/Table.tsx @@ -0,0 +1,148 @@ +import { useTable } from '@react-aria/table'; +import { useTableState } from '@react-stately/table'; +import { forwardRef, ReactElement, useRef } from 'react'; + +import { useProviderProps } from '../../../provider'; +import { useCombinedRefs } from '../../../utils/react'; + +import { TableBase, TableWrapper } from './TableElementsBase'; +import { TableHeadSection } from './TableHeadSection'; +import { TableBodySection } from './TableBodySection'; +import { JengaTableExtendedProps, JengaTableProps } from './types'; +import { TableFooter } from './TableFooter'; + +const DefaultTableProps: Required< + Omit< + JengaTableExtendedProps, + 'customFooter' | 'customHeaderRow' | 'alternateBody' | 'onEmpty' + > +> = { + showFooter: true, + customHeaderRowPostion: 'top', + selectionMode: 'none', + selectionBehavior: 'toggle', + stickyHeader: false, + zebraStripes: false, + checkboxProps: {}, + checkboxStyles: {}, + wrapperProps: {}, + wrapperStyles: {}, + headerStyles: {}, + tableBodyStyles: {}, + tableBodyProps: {}, + footerStyles: {}, + footerProps: {}, + headerProps: {}, + cellPadding: 'regular', + showAlternateBody: false, + cellProps: {}, + cellStyles: {}, + setKeyboardNavigationDisabled: false, + rowStyles: {}, + headerRowProps: {}, + headerRowStyles: {}, + rowProps: {}, +}; + +function withDefaultTableProps(props: JengaTableProps) { + for (let key of Object.keys(DefaultTableProps)) { + if (!props.hasOwnProperty(key)) { + props[key] = DefaultTableProps[key]; + } + } + return props; +} + +function _Table(props: JengaTableProps, ref) { + props = withDefaultTableProps(useProviderProps(props)); + let { + showFooter = true, + alternateBody, + showAlternateBody, + headerProps, + headerStyles, + wrapperProps, + wrapperStyles, + footerProps, + footerStyles, + customHeaderRowPostion, + tableBodyProps, + tableBodyStyles, + customHeaderRow, + customFooter, + onEmpty, + headerRowProps, + headerRowStyles, + stickyHeader, + ...otherProps + } = props; + + let state = useTableState({ + ...props, + showSelectionCheckboxes: + props.selectionMode === 'multiple' && + props.selectionBehavior !== 'replace', + }); + ref = useCombinedRefs([ref, useRef(null)]); + let { gridProps } = useTable(props, state, ref); + const { styles: wrapperStylesFromProps, ...wrapperOtherProps } = + wrapperProps || { styles: {} }; + const { styles: headerStylesFromProps, ...headerOtherProps } = + headerProps || { styles: {} }; + const { styles: tableBodyStylesFromProps, ...tableBodyOtherProps } = + tableBodyProps || { styles: {} }; + const { styles: footerStylesFromProps, ...footerOtherProps } = + footerProps || { styles: {} }; + return ( + + ref={ref} {...gridProps} {...otherProps}> + + customHeaderPosition={customHeaderRowPostion || 'top'} + state={state} + headerRowProps={{ + ...headerRowProps, + styles: { + ...(headerRowProps?.styles || {}), + ...headerRowStyles, + }, + }} + stickyHeader={stickyHeader} + {...headerOtherProps} + styles={{ ...headerStylesFromProps, ...headerStyles }} + > + {customHeaderRow} + + + state={state} + alternateBody={alternateBody} + showAlternateBody={showAlternateBody} + onEmpty={onEmpty} + {...tableBodyOtherProps} + styles={{ ...tableBodyStylesFromProps, ...tableBodyStyles }} + /> + {showFooter ? ( + customFooter ? ( + customFooter + ) : ( + + ) + ) : ( + <>> + )} + + + ); +} + +const Table = forwardRef(_Table) as ( + props: JengaTableProps, + ref, +) => ReactElement; +export { Table }; diff --git a/src/components/organisms/Table/TableBodySection.tsx b/src/components/organisms/Table/TableBodySection.tsx new file mode 100644 index 0000000..6530794 --- /dev/null +++ b/src/components/organisms/Table/TableBodySection.tsx @@ -0,0 +1,73 @@ +import { GridNode } from '@react-types/grid'; +import { useContext } from 'react'; + +import { Styles } from '../../../tasty'; + +import { AligmentFromDTCatalog } from './ReactStatelyCollections'; +import { TableCell } from './TableCell'; +import { TableCheckboxCell } from './TableCheckboxCell'; +import { JengaTablePropsContext } from './TableElementsBase'; +import { TableRow } from './TableRow'; +import { TableRowGroup } from './TableRowGroup'; +import { JengaTableBodyProps } from './types'; + +export function TableBodySection(props: JengaTableBodyProps) { + const { state, alternateBody, showAlternateBody, onEmpty, ...otherProps } = + props; + const { collection } = state; + const { cellPadding } = useContext(JengaTablePropsContext); + + return ( + + {showAlternateBody + ? alternateBody + : [...collection.body.childNodes].length === 0 + ? onEmpty + : [...collection.body.childNodes].map((row) => ( + + {[...row.childNodes].map((cell: GridNode) => { + const align = + cell.column?.props.align || + AligmentFromDTCatalog[ + cell.column?.props.dataType || 'generic' + ] || + 'left'; + const stylesFromColumn = + (cell.column?.props.colCellStyles as Styles) || {}; + + return cell.props.isSelectionCell ? ( + + ) : ( + + ); + })} + + ))} + + ); +} diff --git a/src/components/organisms/Table/TableCell.tsx b/src/components/organisms/Table/TableCell.tsx new file mode 100644 index 0000000..220896e --- /dev/null +++ b/src/components/organisms/Table/TableCell.tsx @@ -0,0 +1,44 @@ +import { useContext, useRef } from 'react'; +import { useTableCell } from '@react-aria/table'; +import { useHover } from '@react-aria/interactions'; + +import { mergeProps } from '../../../utils/react'; +import { useFocus } from '../../../utils/react/interactions'; + +import { JengaTablePropsContext, Td } from './TableElementsBase'; +import { JengaTableElementBaseProps } from './types'; + +export function TableCell(props: JengaTableElementBaseProps) { + const { item: cell, state, styles, ...otherProps } = props; + let ref = useRef(null); + let { gridCellProps } = useTableCell({ node: cell }, state, ref); + let { isFocused, focusProps } = useFocus({ isDisabled: false }); + const { hoverProps, isHovered } = useHover({}); + const { cellProps, cellStyles } = useContext(JengaTablePropsContext); + const { styles: cellStylesFromProps, ...otherCellProps } = cellProps; + return ( + + {cell.rendered} + + ); +} diff --git a/src/components/organisms/Table/TableCheckboxCell.tsx b/src/components/organisms/Table/TableCheckboxCell.tsx new file mode 100644 index 0000000..abc3cf8 --- /dev/null +++ b/src/components/organisms/Table/TableCheckboxCell.tsx @@ -0,0 +1,34 @@ +import { useTableSelectionCheckbox } from '@react-aria/table'; +import { useTableCell } from '@react-aria/table'; +import { useContext, useRef } from 'react'; + +import { Checkbox } from '../../forms/Checkbox/Checkbox'; + +import { JengaTablePropsContext, Td } from './TableElementsBase'; +import { JengaTableCheckboxCellProps } from './types'; + +export function TableCheckboxCell(props: JengaTableCheckboxCellProps) { + const { item: cell, state, ...otherProps } = props; + let ref = useRef(null); + let { gridCellProps } = useTableCell({ node: cell }, state, ref); + let { checkboxProps } = useTableSelectionCheckbox( + { key: cell.parentKey || 'randomKey' }, + state, + ); + const { checkboxProps: jengCheckboxProps, checkboxStyles } = useContext( + JengaTablePropsContext, + ); + const { styles: checkboxStylesFromProps, ...otherCheckboxProps } = + jengCheckboxProps; + return ( + + + + ); +} + +//remove randomKey and make it typesafe as well diff --git a/src/components/organisms/Table/TableColumnHeader.tsx b/src/components/organisms/Table/TableColumnHeader.tsx new file mode 100644 index 0000000..cc2c476 --- /dev/null +++ b/src/components/organisms/Table/TableColumnHeader.tsx @@ -0,0 +1,98 @@ +import { useRef } from 'react'; +import { useTableColumnHeader } from '@react-aria/table'; +import { useHover } from '@react-aria/interactions'; + +import { mergeProps } from '../../../utils/react'; +import { useFocus } from '../../../utils/react/interactions'; +import { Flex } from '../../layout/Flex'; + +import { Th } from './TableElementsBase'; +import { JengaTableColumnHeaderProps } from './types'; +import { AligmentFromDTCatalog } from './ReactStatelyCollections'; + +export function TableColumnHeader(props: JengaTableColumnHeaderProps) { + const { item: column, state, styles = {}, isDisabled, ...otherProps } = props; + let ref = useRef(null); + let { columnHeaderProps } = useTableColumnHeader( + { node: column }, + state, + ref, + ); + const { hoverProps, isHovered } = useHover({ isDisabled }); + const { isFocused, focusProps } = useFocus({ isDisabled }); + + const colspan = column.colspan ? column.colspan : 1; + const align = + column.props.align || + AligmentFromDTCatalog[column.props.dataType || 'generic'] || + 'left'; + const sortState = + state.sortDescriptor?.column === column.key + ? state.sortDescriptor?.direction + : 'unknown'; + return ( + + {column.props.allowsSorting ? ( + + + + + + + {column.rendered} + + ) : ( + column.rendered + )} + + ); +} diff --git a/src/components/organisms/Table/TableElementsBase.tsx b/src/components/organisms/Table/TableElementsBase.tsx new file mode 100644 index 0000000..36be15a --- /dev/null +++ b/src/components/organisms/Table/TableElementsBase.tsx @@ -0,0 +1,133 @@ +import { + createContext, + // ForwardedRef, + forwardRef, + HTMLProps, + ReactElement, + Ref, + // ReactElement, +} from 'react'; + +import { JengaCheckboxProps } from '../../forms/Checkbox/Checkbox'; +import { + tasty, + Element, + Styles, + BasePropsWithoutChildren, +} from '../../../tasty'; + +import { JengaTableBaseProps } from './types'; + +export const Tr = tasty({ + as: 'tr', + role: 'row', +}); +export const Th = tasty({ + as: 'th', + role: 'gridcell', +}); + +export const Td = tasty({ + as: 'td', + role: 'gridcell', +}); + +export const TableWrapper = tasty({ + styles: { + border: '1px solid #e5e5fc', + overflow: 'auto', + position: 'relative', + padding: '0', + }, +}); + +export const TableTemplate = tasty(Element, { + as: 'table', +}); + +export const JengaTablePropsContext = createContext<{ + zebraStripes: boolean; + cellPadding: string | string[]; + checkboxProps: JengaCheckboxProps; + checkboxStyles: Styles; + cellProps: BasePropsWithoutChildren & HTMLProps; + cellStyles: Styles; + rowStyles: Styles; + rowProps: BasePropsWithoutChildren & HTMLProps; +}>({ + zebraStripes: false, + cellPadding: '10px', + rowProps: {}, + rowStyles: {}, + cellProps: {}, + cellStyles: {}, + checkboxProps: {}, + checkboxStyles: {}, +}); + +const cellPaddingCatalog = { + dense: '6px 12px', + regular: '16px 12px', + spacious: '12px', +}; +const parseCellPadding = (cellPadding: string | string[]) => { + if (Array.isArray(cellPadding)) { + return cellPadding.map((cp) => + cellPaddingCatalog.hasOwnProperty(cp) ? cellPaddingCatalog[cp] : cp, + ); + } + return cellPaddingCatalog.hasOwnProperty(cellPadding) + ? cellPaddingCatalog[cellPadding] + : cellPadding; +}; + +export function _TableBase(props: JengaTableBaseProps, ref) { + let { + styles, + zebraStripes = false, + cellPadding = ['regular', 'dense'], + checkboxProps = {}, + checkboxStyles = {}, + cellStyles = {}, + cellProps = {}, + rowProps = {}, + rowStyles = {}, + + ...otherProps + } = props; + + return ( + + + + ); +} + +export const TableBase = forwardRef(_TableBase) as ( + props: JengaTableBaseProps & { ref?: Ref }, +) => ReactElement; +//created in order to make it easy to apply styles for specific tags +//Note:if no styles needed then just delete this and just use Element=tasty({}) then diff --git a/src/components/organisms/Table/TableFooter.tsx b/src/components/organisms/Table/TableFooter.tsx new file mode 100644 index 0000000..aa8d962 --- /dev/null +++ b/src/components/organisms/Table/TableFooter.tsx @@ -0,0 +1,26 @@ +import { BaseProps } from '../../../tasty'; + +import { Td, Tr } from './TableElementsBase'; +import { TableRowGroup } from './TableRowGroup'; + +export const TableFooter = ( + props: BaseProps & { + totalRecords: number; + }, +) => { + const { totalRecords, styles, ...otherProps } = props; + if (totalRecords === 0) return <>>; + return ( + + + + Showing {totalRecords} results. + + + + ); +}; diff --git a/src/components/organisms/Table/TableHeadSection.tsx b/src/components/organisms/Table/TableHeadSection.tsx new file mode 100644 index 0000000..40ed146 --- /dev/null +++ b/src/components/organisms/Table/TableHeadSection.tsx @@ -0,0 +1,69 @@ +import { useContext } from 'react'; + +import { TableColumnHeader } from './TableColumnHeader'; +import { JengaTablePropsContext } from './TableElementsBase'; +import { TableHeaderRow } from './TableHeaderRow'; +import { TableRowGroup } from './TableRowGroup'; +import { TableSelectAllCell } from './TableSelectAllCells'; +import { JengaTableHeadProps } from './types'; + +export function TableHeadSection(props: JengaTableHeadProps) { + const { + state, + stickyHeader = false, + styles, + children, + headerRowProps, + customHeaderPosition, + ...otherProps + } = props; + const { collection } = state; + const { cellPadding } = useContext(JengaTablePropsContext); + const stickyStyles: { position?: 'sticky'; top?: 0 } = stickyHeader + ? { position: 'sticky', top: 0 } + : {}; + + return ( + + {customHeaderPosition === 'top' && children} + {collection.headerRows.map((headerRow) => ( + + {[...headerRow.childNodes].map((column) => + column.props.isSelectionCell ? ( + + ) : ( + + ), + )} + + ))} + {customHeaderPosition === 'bottom' && children} + + ); +} diff --git a/src/components/organisms/Table/TableHeaderRow.tsx b/src/components/organisms/Table/TableHeaderRow.tsx new file mode 100644 index 0000000..aefe0be --- /dev/null +++ b/src/components/organisms/Table/TableHeaderRow.tsx @@ -0,0 +1,24 @@ +import { HTMLProps, useRef } from 'react'; +import { useTableHeaderRow } from '@react-aria/table'; + +import { JengaTableElementBaseProps } from './types'; +import { Tr } from './TableElementsBase'; + +export function TableHeaderRow( + props: JengaTableElementBaseProps & HTMLProps, +) { + const { item, state, children, styles, ...otherProps } = props; + let ref = useRef(null); + let { rowProps } = useTableHeaderRow({ node: item }, state, ref); + return ( + + {children} + + ); +} diff --git a/src/components/organisms/Table/TableRow.tsx b/src/components/organisms/Table/TableRow.tsx new file mode 100644 index 0000000..07a443d --- /dev/null +++ b/src/components/organisms/Table/TableRow.tsx @@ -0,0 +1,77 @@ +import { useHover } from '@react-aria/interactions'; +import { HTMLProps, useContext, useRef } from 'react'; +import { useTableRow } from '@react-aria/table'; + +import { useFocus } from '../../../utils/react/interactions'; +import { mergeProps } from '../../../utils/react'; + +import { JengaTablePropsContext, Tr } from './TableElementsBase'; +import { JengaTableElementBaseProps } from './types'; + +export function TableRow( + props: JengaTableElementBaseProps & HTMLProps, +) { + let { + state, + item, + children, + styles = {}, + isDisabled, + isHidden, + ...otherProps + } = props; + const { + zebraStripes, + rowProps: jengaRowProps, + rowStyles, + } = useContext(JengaTablePropsContext); + let ref = useRef(null); + // @ts-ignore + let isSelected = state.selectionManager.isSelected(item.key); + let { rowProps, isPressed } = useTableRow( + { + node: item, + }, + state, + ref, + ); + const index = item.index ? item.index : 0; + + let { isFocused, focusProps } = useFocus({ isDisabled }); + let { hoverProps, isHovered } = useHover({ isDisabled }); + const { styles: rowStylesFromProps, ...otherRowProps } = jengaRowProps; + return ( + + {children} + + ); +} diff --git a/src/components/organisms/Table/TableRowGroup.tsx b/src/components/organisms/Table/TableRowGroup.tsx new file mode 100644 index 0000000..52f41fb --- /dev/null +++ b/src/components/organisms/Table/TableRowGroup.tsx @@ -0,0 +1,15 @@ +import { useTableRowGroup } from '@react-aria/table'; + +import { AllBaseProps, tasty } from '../../../tasty'; + +const Element = tasty({}); + +export function TableRowGroup(props: AllBaseProps) { + const { children, styles, ...otherProps } = props; + let { rowGroupProps } = useTableRowGroup(); + return ( + + {children} + + ); +} diff --git a/src/components/organisms/Table/TableSelectAllCells.tsx b/src/components/organisms/Table/TableSelectAllCells.tsx new file mode 100644 index 0000000..670ff15 --- /dev/null +++ b/src/components/organisms/Table/TableSelectAllCells.tsx @@ -0,0 +1,42 @@ +import { + useTableColumnHeader, + useTableSelectAllCheckbox, +} from '@react-aria/table'; +import { VisuallyHidden } from '@react-aria/visually-hidden'; +import { useContext, useRef } from 'react'; + +import { Checkbox } from '../../forms/Checkbox/Checkbox'; + +import { JengaTablePropsContext, Th } from './TableElementsBase'; +import { JengaTableElementBaseProps } from './types'; + +export function TableSelectAllCell(props: JengaTableElementBaseProps) { + const { state, item: column, ...otherProps } = props; + let ref = useRef(null); + // @ts-ignore + let isSingleSelectionMode = state.selectionManager.selectionMode === 'single'; + let { columnHeaderProps } = useTableColumnHeader( + { node: column }, + state, + ref, + ); + const { checkboxProps: jengaCheckboxProps, checkboxStyles } = useContext( + JengaTablePropsContext, + ); + let { checkboxProps } = useTableSelectAllCheckbox(state); + const { styles: checkboxStylesFromProps, ...otherCheckboxProps } = + jengaCheckboxProps; + return ( + + {isSingleSelectionMode ? ( + {checkboxProps['aria-label']} + ) : ( + + )} + + ); +} diff --git a/src/components/organisms/Table/index.ts b/src/components/organisms/Table/index.ts new file mode 100644 index 0000000..70601a5 --- /dev/null +++ b/src/components/organisms/Table/index.ts @@ -0,0 +1,3 @@ +export * from './ReactStatelyCollections'; +export * from './Table'; +export * from './TableElementsBase'; diff --git a/src/components/organisms/Table/types.ts b/src/components/organisms/Table/types.ts new file mode 100644 index 0000000..8fea5d2 --- /dev/null +++ b/src/components/organisms/Table/types.ts @@ -0,0 +1,91 @@ +import { TableState, TableStateProps } from '@react-stately/table'; +import { GridNode } from '@react-types/grid'; +import { AriaTableProps } from '@react-aria/table'; +import { HTMLProps } from 'react'; + +import { BaseProps, BasePropsWithoutChildren, Styles } from '../../../tasty'; +import { JengaCheckboxProps } from '../../forms/Checkbox/Checkbox'; + +export type JengaTableElementBaseProps = { + item: GridNode; + state: TableState; +} & BaseProps; + +export type JengaTableCellProps = HTMLProps & + JengaTableElementBaseProps; + +export type JengaTableCheckboxCellProps = JengaTableElementBaseProps; + +export type JengaTableColumnHeaderProps = HTMLProps & + JengaTableElementBaseProps & + BaseProps; + +export type JengaTableExtendedProps = { + wrapperStyles?: Styles; + wrapperProps?: BasePropsWithoutChildren; + tableBodyStyles?: Styles; + tableBodyProps?: HTMLProps & + BasePropsWithoutChildren; + footerStyles?: Styles; + headerStyles?: HTMLProps & Styles; + headerRowProps?: HTMLProps & BaseProps; + headerRowStyles?: Styles; + footerProps?: BasePropsWithoutChildren; + headerProps?: BasePropsWithoutChildren; + checkboxProps?: JengaCheckboxProps; + checkboxStyles?: Styles; + selectionMode?: 'multiple' | 'single' | 'none'; + selectionBehavior?: 'replace' | 'toggle'; + cellPadding?: + | 'dense' + | 'regular' + | 'spaceous' + | string + | string[] + | Array<'dense' | 'regular' | 'spaceous'>; + stickyHeader?: boolean; + zebraStripes?: boolean; + setKeyboardNavigationDisabled?: boolean; + alternateBody?: JSX.Element; + showAlternateBody?: boolean; + showFooter?: boolean; + customHeaderRowPostion?: 'top' | 'bottom'; + customFooter?: JSX.Element; + customHeaderRow?: JSX.Element; + onEmpty?: JSX.Element; + cellStyles?: Styles; + cellProps?: HTMLProps & BasePropsWithoutChildren; + rowProps?: HTMLProps & BasePropsWithoutChildren; + rowStyles?: Styles; +}; +export type JengaTableProps = AriaTableProps & + TableStateProps & + BasePropsWithoutChildren & + JengaTableExtendedProps; + +export type JengaTableBaseProps = TableStateProps & + BaseProps & { + cellPadding?: string | string[]; + zebraStripes?: boolean; + checkboxProps?: JengaCheckboxProps; + checkboxStyles?: Styles; + cellStyles?: Styles; + cellProps?: BasePropsWithoutChildren; + rowProps?: BasePropsWithoutChildren; + rowStyles?: Styles; + }; + +export type JengaTableHeadProps = BaseProps & { + state: TableState; + stickyHeader?: boolean; + headerRowProps?: HTMLProps & BasePropsWithoutChildren; + customHeaderPosition: 'top' | 'bottom'; +}; + +export type JengaTableBodyProps = BaseProps & { + state: TableState; +} & { + alternateBody?: JSX.Element; + showAlternateBody?: boolean; + onEmpty?: JSX.Element; +}; diff --git a/src/components/overlays/NewNotifications/NotificationView/NotificationCloseButton.tsx b/src/components/overlays/NewNotifications/NotificationView/NotificationCloseButton.tsx index 606f044..f8c6717 100644 --- a/src/components/overlays/NewNotifications/NotificationView/NotificationCloseButton.tsx +++ b/src/components/overlays/NewNotifications/NotificationView/NotificationCloseButton.tsx @@ -1,15 +1,15 @@ import { memo } from 'react'; +import { X } from '@jengaicons/react'; import { Button } from '../../../actions'; import { tasty } from '../../../../tasty'; -import { Cross } from '../../../../icons'; export type NotificationCloseButtonProps = { onPress: () => void; }; const CloseButton = tasty(Button, { - icon: , + icon: , label: 'Close the notification', qa: 'NotificationCloseButton', type: 'neutral', diff --git a/src/components/overlays/NewNotifications/NotificationView/NotificationIcon.tsx b/src/components/overlays/NewNotifications/NotificationView/NotificationIcon.tsx index 7e5d5e3..3562e2d 100644 --- a/src/components/overlays/NewNotifications/NotificationView/NotificationIcon.tsx +++ b/src/components/overlays/NewNotifications/NotificationView/NotificationIcon.tsx @@ -1,7 +1,7 @@ import { memo, ReactNode } from 'react'; +import { Warning, CheckCircle, WarningCircle } from '@jengaicons/react'; import { tasty } from '../../../../tasty'; -import { Danger, Success, Attention } from '../../../../icons'; import { NotificationIconProps } from './types'; @@ -73,7 +73,7 @@ export const NotificationIcon = memo(function NotificationIcon( }); const iconsByType: Record = { - attention: , - success: , - danger: , + attention: , + success: , + danger: , }; diff --git a/src/icons/Attention.tsx b/src/icons/Attention.tsx deleted file mode 100644 index cb051d5..0000000 --- a/src/icons/Attention.tsx +++ /dev/null @@ -1,11 +0,0 @@ -export function Attention() { - return ( - - - - ); -} diff --git a/src/icons/Cross.tsx b/src/icons/Cross.tsx deleted file mode 100644 index cc958fd..0000000 --- a/src/icons/Cross.tsx +++ /dev/null @@ -1,11 +0,0 @@ -export function Cross() { - return ( - - - - ); -} diff --git a/src/icons/Danger.tsx b/src/icons/Danger.tsx deleted file mode 100644 index 4bee761..0000000 --- a/src/icons/Danger.tsx +++ /dev/null @@ -1,12 +0,0 @@ -export function Danger() { - return ( - - - - - ); -} diff --git a/src/icons/Success.tsx b/src/icons/Success.tsx deleted file mode 100644 index b1b7b1f..0000000 --- a/src/icons/Success.tsx +++ /dev/null @@ -1,11 +0,0 @@ -export function Success() { - return ( - - - - ); -} diff --git a/src/icons/index.ts b/src/icons/index.ts deleted file mode 100644 index 9c98b0b..0000000 --- a/src/icons/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export * from './Danger'; -export * from './Attention'; -export * from './Success'; -export * from './Cross'; diff --git a/src/index.ts b/src/index.ts index 1f44102..d99442c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -189,3 +189,4 @@ export * from '@react-aria/ssr'; export * from './components/forms/Form'; export * from './components/overlays/NewNotifications'; export * from './components/overlays/Toasts'; +export * from './components/organisms/Table'; diff --git a/src/stories/Result.stories.mdx b/src/stories/Result.stories.mdx index 977c7d2..cfc5169 100644 --- a/src/stories/Result.stories.mdx +++ b/src/stories/Result.stories.mdx @@ -1,6 +1,6 @@ import { Meta } from '@storybook/addon-docs'; import { Story, Canvas, ArgsTable } from '@storybook/addon-docs'; -import { BulbFilled, LockFilled } from '@jengaicons/react'; +import { LightbulbFill, LockFill } from '@jengaicons/react'; import { baseProps } from './lists/baseProps'; import { Element, Button, Result, Space, Text, Title } from '../index'; @@ -105,7 +105,7 @@ Use when important operations need to inform the user to process the results and subtitle: 'Request access from the administrator.', icon: ( - + ), children: Request, @@ -133,7 +133,7 @@ Use when important operations need to inform the user to process the results and ), icon: ( - + ), children: Complete Now,