-
Notifications
You must be signed in to change notification settings - Fork 53
Component catalog - Accordion #3965
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
zamoore
wants to merge
2
commits into
main
Choose a base branch
from
zamoore/hds-6500/component-catalog_accordion-group
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+186
−0
Open
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,138 @@ | ||
| { | ||
| "updatedAt": "2026-07-01T20:25:05.109Z", | ||
| "components": [ | ||
| { | ||
| "name": "HdsAccordion", | ||
| "description": "The `Accordion` component serves as a wrapper to group one or more `Accordion::Item` components.", | ||
| "args": [ | ||
| { | ||
| "name": "forceState", | ||
| "type": "'open' | 'close'", | ||
| "required": false, | ||
| "description": "Controls the state of all items within the accordion group, allowing all items to be expanded or collapsed simultaneously." | ||
| }, | ||
| { | ||
| "name": "size", | ||
| "type": "'small' | 'medium' | 'large'", | ||
| "required": false, | ||
| "default": "medium", | ||
| "description": "Specifies the size of the accordion." | ||
| }, | ||
|
zamoore marked this conversation as resolved.
|
||
| { | ||
| "name": "titleTag", | ||
| "type": "'div' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'", | ||
| "required": false, | ||
| "default": "div", | ||
| "description": "Specifies the HTML tag used to wrap the content of each Accordion Item's toggle block." | ||
| }, | ||
|
zamoore marked this conversation as resolved.
|
||
| { | ||
| "name": "type", | ||
| "type": "'card' | 'flush'", | ||
| "required": false, | ||
| "default": "card", | ||
| "description": "Determines the style of the accordion." | ||
| } | ||
|
zamoore marked this conversation as resolved.
|
||
| ], | ||
| "blocks": [ | ||
| { | ||
| "name": "default", | ||
| "yields": [ | ||
| { | ||
| "name": "Item", | ||
| "type": "WithBoundArgs< typeof HdsAccordionItem, 'titleTag' | 'size' | 'type' | 'forceState' >", | ||
| "kind": "component", | ||
| "componentName": "HdsAccordionItem", | ||
| "boundArgs": [ | ||
| "titleTag", | ||
| "size", | ||
| "type", | ||
| "forceState" | ||
| ], | ||
| "description": "The `Accordion::Item` component, yielded as contextual component." | ||
|
zamoore marked this conversation as resolved.
Outdated
|
||
| } | ||
| ] | ||
| } | ||
| ] | ||
| }, | ||
| { | ||
| "name": "HdsAccordionItem", | ||
| "description": "The `Accordion::Item` component, yielded as contextual component.", | ||
| "args": [ | ||
| { | ||
| "name": "ariaLabel", | ||
| "type": "string", | ||
| "required": false, | ||
| "default": "\"Toggle display\"", | ||
| "description": "Accepts a string. The `ariaLabel` value is applied to the HTML button which controls visibility of the content block content." | ||
| }, | ||
| { | ||
| "name": "containsInteractive", | ||
| "type": "boolean", | ||
| "required": false, | ||
| "default": "false", | ||
| "description": "Controls whether the entire toggle block is interactive for toggling the content display or whether only the chevron button itself is interactive which allows for adding other interactive content in the toggle area." | ||
| }, | ||
| { | ||
| "name": "forceState", | ||
| "type": "'open' | 'close'", | ||
| "required": false, | ||
| "description": "Controls the state of an `Accordion::Item` after the initial render by overriding its current state." | ||
| }, | ||
| { | ||
| "name": "isOpen", | ||
| "type": "boolean", | ||
| "required": false, | ||
| "default": "false", | ||
| "description": "Toggles the visibility of the content. To display content on page load, set the value to `true`." | ||
| }, | ||
| { | ||
| "name": "isStatic", | ||
| "type": "boolean", | ||
| "required": false, | ||
| "default": "false", | ||
| "description": "Removes the ability to interact with the toggle and hides the chevron element when set to `true`." | ||
| }, | ||
| { | ||
| "name": "onClickToggle", | ||
| "type": "(event: MouseEvent, ...args: any[]) => void", | ||
| "required": false, | ||
| "description": "Callback function invoked when the toggle is clicked." | ||
| }, | ||
| { | ||
| "name": "size", | ||
| "type": "'small' | 'medium' | 'large'", | ||
| "required": false, | ||
| "default": "medium" | ||
| }, | ||
| { | ||
| "name": "titleTag", | ||
| "type": "'div' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'", | ||
| "required": false, | ||
| "default": "div" | ||
| }, | ||
| { | ||
| "name": "type", | ||
| "type": "'card' | 'flush'", | ||
| "required": false, | ||
| "default": "card" | ||
| } | ||
| ], | ||
| "blocks": [ | ||
| { | ||
| "name": "content", | ||
| "yields": [ | ||
| { | ||
| "name": "close", | ||
| "type": "(...args: any[]) => void", | ||
| "kind": "function", | ||
| "description": "A function to programmatically close the `Accordion::Item`." | ||
| } | ||
| ] | ||
| }, | ||
| { | ||
| "name": "toggle" | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| /** | ||
| * Copyright IBM Corp. 2021, 2025 | ||
| * SPDX-License-Identifier: MPL-2.0 | ||
| */ | ||
|
|
||
| import { z } from "zod"; | ||
|
|
||
| const catalogArgSchema = z.object({ | ||
| name: z.string().min(1), | ||
| type: z.string().min(1), | ||
| required: z.boolean().optional(), | ||
| description: z.string().optional(), | ||
| default: z.string().optional(), | ||
| }); | ||
|
|
||
| const catalogBlockYieldSchema = z.object({ | ||
| name: z.string().min(1), | ||
| type: z.string().min(1), | ||
| kind: z.enum(["component", "function", "value"]).optional(), | ||
| componentName: z.string().min(1).optional(), | ||
| boundArgs: z.array(z.string().min(1)).optional(), | ||
| description: z.string().optional(), | ||
| }); | ||
|
|
||
| const catalogBlockSchema = z.object({ | ||
| name: z.string().min(1), | ||
| yields: z.array(catalogBlockYieldSchema).optional(), | ||
| }); | ||
|
|
||
| const catalogDesignSchema = z.object({ | ||
| figmaUrl: z.string().url(), | ||
| nodeId: z.string().min(1).optional(), | ||
| fileKey: z.string().min(1).optional(), | ||
| }); | ||
|
|
||
| const catalogComponentSchema = z.object({ | ||
| name: z.string().min(1), | ||
| description: z.string().min(1), | ||
| design: catalogDesignSchema.optional(), | ||
| args: z.array(catalogArgSchema).optional(), | ||
| blocks: z.array(catalogBlockSchema).optional(), | ||
| }); | ||
|
|
||
| export const componentCatalogSchema = z.object({ | ||
| updatedAt: z.string().datetime(), | ||
| components: z.array(catalogComponentSchema), | ||
| }); | ||
|
|
||
| export type ComponentCatalog = z.infer<typeof componentCatalogSchema>; | ||
| export type ComponentCatalogComponent = ComponentCatalog["components"][number]; |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.