Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
4a74340
chore(deps): bump react-router and react-router-dom
dependabot[bot] Jan 8, 2026
06299d9
feat(#2609): add doc for GoabDataGrid
vanessatran-ddi Jan 12, 2026
c089aba
fix: make Sandbox generic to resolve typescript vs data attributes
vanessatran-ddi Jan 13, 2026
c19550d
fix: add delay render for GoabDataGrid to fix keyboard navigation
vanessatran-ddi Jan 19, 2026
13568ac
chore: allow to switch table/card layout under sandbox
vanessatran-ddi Jan 20, 2026
c69f65d
chore: add indeterminate checkbox to sandbox and example
vanessatran-ddi Jan 20, 2026
37e4ed2
fix: tab double focus when switching tabs on data-grid
vanessatran-ddi Jan 21, 2026
e44d968
chore: move icon position to right
vanessatran-ddi Jan 21, 2026
d826099
fix: sticky menu overlap vs 2 examples
vanessatran-ddi Jan 21, 2026
0e9fdfc
chore(deps-dev): bump lodash from 4.17.21 to 4.17.23
dependabot[bot] Jan 22, 2026
c8e98d2
Merge pull request #470 from GovAlta/vanessa/2609-data-grid-doc
chrisolsen Jan 23, 2026
d0d8fb5
Merge pull request #473 from GovAlta/dependabot/npm_and_yarn/lodash-4…
chrisolsen Jan 23, 2026
7bbd7f6
Merge pull request #468 from GovAlta/dependabot/npm_and_yarn/multi-dc…
chrisolsen Jan 23, 2026
7bf7d90
chore: update GoabIconType
vanessatran-ddi Jan 23, 2026
476793f
chore: doc minHeight and maxHeight for container
vanessatran-ddi Jan 23, 2026
b1a39e3
chore: add leadingIcon and maxWidth to MenuButton
vanessatran-ddi Jan 23, 2026
fa2d04d
chore: add id to GoabText
vanessatran-ddi Jan 23, 2026
7a55cb4
Merge pull request #475 from GovAlta/vanessa/3356-docs
chrisolsen Feb 2, 2026
ae5801e
Updating package versions
dustin-nielsen-goa Feb 3, 2026
fadc762
Merge pull request #476 from GovAlta/update_versions
ArakTaiRoth Feb 4, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 34 additions & 42 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@
"prettier": "npx prettier . --write"
},
"dependencies": {
"@abgov/react-components": "6.10.0-dev.8",
"@abgov/ui-components-common": "1.10.0-dev.2",
"@abgov/web-components": "1.40.0-dev.17",
"@abgov/react-components": "6.10.0",
"@abgov/ui-components-common": "1.10.0",
"@abgov/web-components": "1.40.0",
"@faker-js/faker": "^8.3.1",
"highlight.js": "^11.8.0",
"js-cookie": "^3.0.5",
"octokit": "^4.0.2",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router-dom": "^6.13.0",
"react-router-dom": "^6.30.3",
"use-debounce": "^10.0.4"
},
"devDependencies": {
Expand All @@ -38,7 +38,7 @@
"prettier": "2.4.1",
"typescript": "^5.4.2",
"vite": "^5.4.21",
"lodash": "^4.17.21",
"lodash": "^4.17.23",
"@types/lodash": "^4.17.16"
}
}
40 changes: 28 additions & 12 deletions src/components/sandbox/Sandbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ type Flag = "reactive" | "template-driven" | "event";
type ComponentType = "goa" | "codesnippet";
type Serializer = (el: any, properties: ComponentBinding[]) => string;

interface SandboxProps {
interface SandboxProps<T = Record<string, unknown>> {
properties?: ComponentBinding[];
formItemProperties?: ComponentBinding[];
note?: string | { type?: GoabCalloutType; heading?: string; content: string };
fullWidth?: boolean;
onChange?: (bindings: ComponentBinding[], props: Record<string, unknown>) => void;
onChange?: (bindings: ComponentBinding[], props: T) => void;
onChangeFormItemBindings?: (bindings: ComponentBinding[], props: Record<string, unknown>) => void;
flags?: Flag[];
skipRender?: boolean; // prevent rendering the snippet, to allow custom code to be shown
Expand All @@ -41,11 +41,11 @@ interface SandboxProps {

type SandboxViewProps = {
fullWidth?: boolean;
sandboxProps: SandboxProps;
sandboxProps: SandboxProps<unknown>;
background?: string;
};

export const Sandbox = (props: SandboxProps) => {
export const Sandbox = <T = Record<string, unknown>,>(props: SandboxProps<T>) => {
const {language: lang, version} = useContext(LanguageVersionContext);
const [formatLang, setFormatLang] = useState<string>("");

Expand Down Expand Up @@ -92,10 +92,20 @@ export const Sandbox = (props: SandboxProps) => {
}

function onChangeFormItemBindings(bindings: ComponentBinding[]) {
props.onChangeFormItemBindings?.(bindings, toKeyValue(bindings));
props.onChangeFormItemBindings?.(bindings, toFormItemKeyValue(bindings));
}

function toKeyValue(bindings: ComponentBinding[]) {
function toKeyValue(bindings: ComponentBinding[]): T {
return bindings.reduce((acc: Record<string, unknown>, prop: ComponentBinding) => {
if (typeof prop.value === "string" && prop.value === "") {
return acc;
}
acc[prop.name] = prop.value;
return acc;
}, {}) as unknown as T;
}

function toFormItemKeyValue(bindings: ComponentBinding[]): Record<string, unknown> {
return bindings.reduce((acc: Record<string, unknown>, prop: ComponentBinding) => {
if (typeof prop.value === "string" && prop.value === "") {
return acc;
Expand All @@ -117,7 +127,7 @@ export const Sandbox = (props: SandboxProps) => {

return (
<>
{props.skipRenderDom ? null : <SandboxView fullWidth={props.fullWidth} sandboxProps={props} background={props.background} />}
{props.skipRenderDom ? null : <SandboxView fullWidth={props.fullWidth} sandboxProps={props as SandboxProps<unknown>} background={props.background} />}

{/* Only render the GoAAccordion if props.properties is provided */}
{props.properties && props.properties.length > 0 && (
Expand All @@ -141,7 +151,7 @@ export const Sandbox = (props: SandboxProps) => {
/>
</GoabAccordion>
)}
<SandboxCode props={props} formatLang={formatLang} lang={lang} serializers={serializers} version={version} />
<SandboxCode props={props as SandboxProps<unknown>} formatLang={formatLang} lang={lang} serializers={serializers} version={version} />
{props.note &&
(typeof props.note === "string" ? (
<p className="sandbox-note">{props.note}</p>
Expand All @@ -162,7 +172,7 @@ export const Sandbox = (props: SandboxProps) => {
};

type SandboxCodeProps = {
props: SandboxProps & { children: ReactNode };
props: SandboxProps<unknown> & { children: ReactNode };
lang: string;
formatLang: string;
serializers: Record<string, Serializer>;
Expand Down Expand Up @@ -246,7 +256,7 @@ function SandboxCode(p: SandboxCodeProps) {
// to be displayed, while hiding the non-reactive ones
type AdditionalCodeSnippetsProps = {
tags: string[];
sandboxProps: SandboxProps;
sandboxProps: SandboxProps<unknown>;
}
function AdditionalCodeSnippets(props: AdditionalCodeSnippetsProps) {
const matches = (list: string[]): boolean => {
Expand All @@ -259,6 +269,12 @@ function AdditionalCodeSnippets(props: AdditionalCodeSnippetsProps) {
Array.isArray(el.props.tags)
? el.props.tags
: [el.props.tags];

const isSharedSnippet = componentTags.includes("angular") && componentTags.includes("react");
if (isSharedSnippet) {
return props.tags.some(tag => componentTags.includes(tag));
}

if (props.tags.length !== componentTags.length)
return false;
return matches(componentTags);
Expand All @@ -269,7 +285,7 @@ function AdditionalCodeSnippets(props: AdditionalCodeSnippetsProps) {
// Filters components from within the Sandbox children
// i.e. Get all the <CodeSnippet> components
type ComponentListProps = {
sandboxProps: SandboxProps;
sandboxProps: SandboxProps<unknown>;
type: ComponentType;
}
function ComponentList(props: ComponentListProps): ReactElement[] {
Expand All @@ -289,7 +305,7 @@ function ComponentList(props: ComponentListProps): ReactElement[] {
type ComponentOutputProps = {
formatLang: string;
type: "angular" | "angular-reactive" | "angular-template-driven" | "react";
sandboxProps: SandboxProps;
sandboxProps: SandboxProps<unknown>;
serializer: Serializer;
}

Expand Down
27 changes: 27 additions & 0 deletions src/examples/data-grid/DataGridExamples.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { SandboxHeader } from "@components/sandbox/sandbox-header/sandboxHeader.tsx";
import { BasicTableWithKeyboardNavigation } from "./basic-table-with-keyboard-navigation.tsx";
import { SortableTableWithRowSelection } from "./sortable-table-with-row-selection.tsx";
import { LayoutModeWithCards } from "./layout-mode-with-cards.tsx";

interface DataGridExamplesProps {
isGridReady?: boolean;
}

export function DataGridExamples({
isGridReady = true,
}: DataGridExamplesProps) {
return (
<>
<SandboxHeader exampleTitle="Basic table with keyboard navigation" />
<BasicTableWithKeyboardNavigation isGridReady={isGridReady} />

<SandboxHeader exampleTitle="Sortable table with row selection" />
<SortableTableWithRowSelection isGridReady={isGridReady} />

<SandboxHeader exampleTitle="Layout mode with cards" />
<LayoutModeWithCards isGridReady={isGridReady} />
</>
);
}

export default DataGridExamples;
Loading