Skip to content

Commit

Permalink
Feat query table (#21)
Browse files Browse the repository at this point in the history
* feat: add basic query table

* build: enable alias command in publish workflow

* chore: update deps

* fix(ui): make account menu style consistent

* fix(ui): pagination

* feat(ui): add dialog and query table actions

* feat(ui): set width of cols and density of rows

* feat(ui): add column visibility action

* feat(ui): add sort and disableMulti*

* feat(ui): add active filter icon on col header

* style(ui): rename RightActionBar to ActionMenu

* docs: changeset

* fix: improve package.json's

* fix: upgrade deps, upgrade to ts-node --esm

* build: remove unecessary lint-staged config
  • Loading branch information
bestickley authored Mar 8, 2022
1 parent bbbe8d4 commit 4a05c2f
Show file tree
Hide file tree
Showing 38 changed files with 3,334 additions and 2,000 deletions.
5 changes: 5 additions & 0 deletions .changeset/mighty-panthers-clean.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"gboost-ui": minor
---

Add QueryTable and Dialog components
8 changes: 8 additions & 0 deletions .changeset/nasty-pianos-serve.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"gboost": patch
"gboost-common": patch
"gboost-infra": patch
"gboost-ui": patch
---

Improve package.json's
8 changes: 8 additions & 0 deletions .changeset/rotten-kiwis-reply.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"gboost": patch
"gboost-common": patch
"gboost-infra": patch
"gboost-ui": patch
---

Update deps
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
# publish doesn't run on every push to main
# TODO: update to use native changeset option to use PNPM when this merges:
# https://github.com/changesets/changesets/pull/674
publish: alias npm="pnpm" && pnpm changeset publish
publish: shopt -s expand_aliases && alias npm="pnpm" && pnpm changeset publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
8 changes: 4 additions & 4 deletions docs/demos/notifications/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@
"preview": "vite preview"
},
"dependencies": {
"@aws-amplify/ui-react": "^2.6.2",
"@aws-amplify/ui-react": "^2.8.0",
"@fontsource/inter": "^4.5.4",
"gboost-ui": "^0.4.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"vite": "^2.8.0"
"vite": "^2.8.6"
},
"devDependencies": {
"@types/react": "^17.0.33",
"@types/react-dom": "^17.0.10",
"@types/react-dom": "^17.0.13",
"@vitejs/plugin-react": "^1.0.7",
"typescript": "^4.5.4"
"typescript": "^4.6.2"
}
}
8 changes: 4 additions & 4 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,21 @@
"@easyops-cn/docusaurus-search-local": "^0.21.4",
"@mdx-js/react": "^1.6.22",
"clsx": "^1.1.1",
"docusaurus-plugin-typedoc": "^0.17.0",
"docusaurus-plugin-typedoc": "^0.17.2",
"prism-react-renderer": "^1.3.1",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"typedoc": "^0.22.12",
"typedoc": "^0.22.13",
"typedoc-plugin-markdown": "^3.11.14"
},
"devDependencies": {
"@docusaurus/module-type-aliases": "2.0.0-beta.16",
"@docusaurus/plugin-content-docs": "^2.0.0-beta.16",
"@docusaurus/plugin-content-docs": "^2.0.0-beta.17",
"@docusaurus/theme-classic": "2.0.0-beta.16",
"@tsconfig/docusaurus": "^1.0.4",
"@types/react": "^17.0.39",
"eslint": "^8.10.0",
"eslint-config-prettier": "^8.4.0",
"eslint-config-prettier": "^8.5.0",
"eslint-config-react-app": "^7.0.0",
"eslint-define-config": "^1.2.5",
"eslint-plugin-jest": "^25.7.0",
Expand Down
15 changes: 6 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,22 @@
"lint": "pnpm --recursive --filter ./packages --parallel lint",
"unit-test": "pnpm --recursive --filter ./packages --parallel test",
"prepare": "husky install",
"changeset-version": "node --loader ts-node/esm scripts/changeset-version.ts",
"license-check": "node --loader ts-node/esm scripts/license-check.ts",
"changeset-version": "ts-node --esm scripts/changeset-version.ts",
"license-check": "ts-node --esm scripts/license-check.ts",
"preinstall": "npx only-allow pnpm"
},
"devDependencies": {
"@changesets/changelog-github": "^0.4.2",
"@changesets/cli": "^2.20.0",
"@changesets/changelog-github": "^0.4.3",
"@changesets/cli": "^2.21.1",
"@types/license-checker": "^25.0.3",
"@types/node": "^14.18.12",
"husky": "^7.0.4",
"license-checker": "^25.0.1",
"lint-staged": "^12.3.4",
"ts-node": "^10.5.0",
"lint-staged": "^12.3.5",
"ts-node": "^10.7.0",
"typescript": "^4.6.2"
},
"license": "Apache-2.0",
"lint-staged": {
"*": "true"
},
"dependencies": {
"node^16.11.25": "link:@types/node^16.11.25"
}
Expand Down
17 changes: 9 additions & 8 deletions packages/gboost-common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
},
"types": "./src/index.ts",
"publishConfig": {
"main": "./lib/index.js",
"main": "./lib/index.mjs",
"module": "./lib/index.js",
"exports": {
".": "./lib/index.js"
},
Expand All @@ -27,20 +28,20 @@
"test": "jest"
},
"devDependencies": {
"@types/jest": "^27.4.0",
"@typescript-eslint/eslint-plugin": "^5.12.0",
"@typescript-eslint/parser": "^5.12.0",
"eslint": "^8.9.0",
"eslint-config-prettier": "^8.3.0",
"@types/jest": "^27.4.1",
"@typescript-eslint/eslint-plugin": "^5.14.0",
"@typescript-eslint/parser": "^5.14.0",
"eslint": "^8.10.0",
"eslint-config-prettier": "^8.5.0",
"eslint-define-config": "^1.2.5",
"eslint-plugin-jest": "^25.7.0",
"eslint-plugin-prettier": "^4.0.0",
"jest": "^27.5.1",
"prettier": "^2.5.1",
"rimraf": "^3.0.2",
"ts-jest": "^27.1.3",
"ts-node": "^10.5.0",
"typescript": "^4.5.5"
"ts-node": "^10.7.0",
"typescript": "^4.6.2"
},
"repository": {
"type": "git",
Expand Down
35 changes: 18 additions & 17 deletions packages/gboost-infra/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
},
"types": "./src/index.ts",
"publishConfig": {
"main": "./lib/index.js",
"main": "./lib/index.mjs",
"module": "./lib/index.js",
"exports": {
".": "./lib/index.js"
},
Expand All @@ -22,38 +23,38 @@
"node": ">=16"
},
"scripts": {
"build": "node --loader ts-node/esm scripts/build.ts",
"build": "ts-node --esm scripts/build.ts",
"lint": "eslint \"src/**/*.ts\"",
"test": "jest"
},
"dependencies": {
"@aws-cdk/aws-appsync-alpha": "^2.5.0-alpha.0",
"@aws-sdk/client-cognito-identity-provider": "^3.51.0",
"aws-cdk-lib": "^2.12.0",
"cdk-nag": "^2.5.2",
"constructs": "^10.0.63",
"esbuild": "^0.14.21",
"@aws-sdk/client-cognito-identity-provider": "^3.53.0",
"aws-cdk-lib": "^2.15.0",
"cdk-nag": "^2.9.5",
"constructs": "^10.0.82",
"esbuild": "^0.14.25",
"gboost-common": "workspace:^0.3.1",
"joi": "^17.6.0"
},
"devDependencies": {
"@types/aws-lambda": "^8.10.92",
"@types/aws-lambda": "^8.10.93",
"@types/fs-extra": "^9.0.13",
"@types/jest": "^27.4.0",
"@types/node": "^16.11.25",
"@typescript-eslint/eslint-plugin": "^5.12.0",
"@typescript-eslint/parser": "^5.12.0",
"eslint": "^8.9.0",
"eslint-config-prettier": "^8.3.0",
"@types/jest": "^27.4.1",
"@types/node": "^16.11.26",
"@typescript-eslint/eslint-plugin": "^5.14.0",
"@typescript-eslint/parser": "^5.14.0",
"eslint": "^8.10.0",
"eslint-config-prettier": "^8.5.0",
"eslint-define-config": "^1.2.5",
"eslint-plugin-jest": "^25.7.0",
"eslint-plugin-prettier": "^4.0.0",
"fs-extra": "^10.0.0",
"fs-extra": "^10.0.1",
"jest": "^27.5.1",
"prettier": "^2.5.1",
"ts-jest": "^27.1.3",
"ts-node": "^10.5.0",
"typescript": "^4.5.5"
"ts-node": "^10.7.0",
"typescript": "^4.6.2"
},
"repository": {
"type": "git",
Expand Down
38 changes: 20 additions & 18 deletions packages/gboost-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
},
"types": "./src/index.tsx",
"publishConfig": {
"main": "./lib/index.jsx",
"main": "./lib/index.mjsx",
"module": "./lib/index.jsx",
"exports": {
".": "./lib/index.jsx"
},
Expand All @@ -27,33 +28,34 @@
"test": "jest"
},
"dependencies": {
"@aws-amplify/api-graphql": "^2.2.20",
"@aws-amplify/auth": "^4.4.0",
"@aws-amplify/ui": "^3.0.13",
"@aws-amplify/ui-react": "^2.6.2",
"@mantine/hooks": "^3.6.7",
"@aws-amplify/api-graphql": "^2.2.22",
"@aws-amplify/auth": "^4.4.2",
"@aws-amplify/ui": "^3.2.0",
"@aws-amplify/ui-react": "^2.8.0",
"@mantine/hooks": "^3.6.14",
"@radix-ui/colors": "^0.1.8",
"@stitches/react": "^1.2.6",
"aws-amplify": "^4.3.14",
"@radix-ui/react-dialog": "^0.1.7",
"@stitches/react": "^1.2.7",
"aws-amplify": "^4.3.15",
"gboost-common": "workspace:^0.3.1",
"graphql": "^15.8.0",
"graphql-tag": "^2.12.6",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-hook-form": "^7.27.1",
"react-icons": "^4.3.1",
"react-router-dom": "^6.2.1",
"react-router-dom": "^6.2.2",
"react-transition-group": "^4.4.2"
},
"devDependencies": {
"@types/jest": "^27.4.0",
"@types/jest": "^27.4.1",
"@types/react": "^17.0.39",
"@types/react-dom": "^17.0.11",
"@types/react-dom": "^17.0.13",
"@types/react-transition-group": "^4.4.4",
"@typescript-eslint/eslint-plugin": "^5.12.0",
"@typescript-eslint/parser": "^5.12.0",
"eslint": "^8.9.0",
"eslint-config-prettier": "^8.3.0",
"@typescript-eslint/eslint-plugin": "^5.14.0",
"@typescript-eslint/parser": "^5.14.0",
"eslint": "^8.10.0",
"eslint-config-prettier": "^8.5.0",
"eslint-config-react-app": "^7.0.0",
"eslint-define-config": "^1.2.5",
"eslint-plugin-jest": "^25.7.0",
Expand All @@ -62,9 +64,9 @@
"prettier": "^2.5.1",
"rimraf": "^3.0.2",
"ts-jest": "^27.1.3",
"ts-node": "^10.5.0",
"typescript": "^4.5.5",
"vite": "^2.8.3"
"ts-node": "^10.7.0",
"typescript": "^4.6.2",
"vite": "^2.8.6"
},
"repository": {
"type": "git",
Expand Down
3 changes: 3 additions & 0 deletions packages/gboost-ui/src/Box.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import { styled } from "./stitches.config.js";

/**
* Unstyled div to utilize Stitches' CSS typings
*/
export const Box = styled("div");
94 changes: 94 additions & 0 deletions packages/gboost-ui/src/Dialog.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
import { ReactElement } from "react";
import { Heading, Icon } from "@aws-amplify/ui-react";
import { keyframes, styled } from "./stitches.config.js";
import * as DialogPrimitive from "@radix-ui/react-dialog";
import { Box } from "./Box.jsx";
import { MdClose } from "react-icons/md";

const overlayShow = keyframes({
"0%": { opacity: 0 },
"100%": { opacity: 1 },
});

const contentShow = keyframes({
"0%": { opacity: 0, transform: "translate(-50%, -48%) scale(.96)" },
"100%": { opacity: 1, transform: "translate(-50%, -50%) scale(1)" },
});

const StyledOverlay = styled(DialogPrimitive.Overlay, {
bc: "$blackA9",
position: "fixed",
inset: 0,
"@media (prefers-reduced-motion: no-preference)": {
animation: `${overlayShow} 150ms cubic-bezier(0.16, 1, 0.3, 1) forwards`,
},
});

const StyledContent = styled(DialogPrimitive.Content, {
backgroundColor: "white",
borderRadius: 6,
boxShadow:
"hsl(206 22% 7% / 35%) 0px 10px 38px -10px, hsl(206 22% 7% / 20%) 0px 10px 20px -15px",
position: "fixed",
top: "50%",
left: "50%",
transform: "translate(-50%, -50%)",
width: "90vw",
maxWidth: "450px",
maxHeight: "85vh",
padding: 25,
"@media (prefers-reduced-motion: no-preference)": {
animation: `${contentShow} 150ms cubic-bezier(0.16, 1, 0.3, 1) forwards`,
},
"&:focus": { outline: "none" },
});
const StyledIcon = styled(Icon, { cursor: "pointer" });

interface DialogProps {
children: ReactElement;
title?: string;
trigger: ReactElement;
maxWidth?: string;
}

/**
* Dialog for showing auxiliary content. Try to limit use of dialogs. Prefer
* nested pages where possible
*/
export function Dialog({
children,
title,
trigger,
maxWidth,
}: DialogProps): ReactElement {
return (
<DialogPrimitive.Root>
<DialogPrimitive.Trigger asChild>{trigger}</DialogPrimitive.Trigger>
<DialogPrimitive.Portal>
<StyledOverlay />
<StyledContent css={{ maxWidth }}>
<>
{title && (
<Box
css={{
display: "flex",
justifyContent: "space-between",
mb: "$3",
}}
>
<div />
<Heading level={4}>{title}</Heading>
<DialogPrimitive.Close asChild>
<span>
<StyledIcon aria-label="close" as={MdClose} />
</span>
</DialogPrimitive.Close>
</Box>
)}
{children}
</>
</StyledContent>
</DialogPrimitive.Portal>
</DialogPrimitive.Root>
);
}
Loading

0 comments on commit 4a05c2f

Please sign in to comment.