diff --git a/packages/stacks-docs/_data/components/activity-indicator.json b/packages/stacks-docs/_data/components/activity-indicator.json index e476674582..6cae2ff92a 100644 --- a/packages/stacks-docs/_data/components/activity-indicator.json +++ b/packages/stacks-docs/_data/components/activity-indicator.json @@ -1,29 +1,30 @@ { - "indicator": [ + "classes": [ { - "class": ".s-activity-indicator", - "applies": "N/A", + "code": ".s-activity-indicator", "description": "Base activity indicator element with theme-aware coloring" }, { - "class": ".s-activity-indicator__success", + "code": ".s-activity-indicator__success", "applies": ".s-activity-indicator", "description": "Styles the activity indicator in a success state" }, { - "class": ".s-activity-indicator__warning", + "code": ".s-activity-indicator__warning", "applies": ".s-activity-indicator", "description": "Styles the activity indicator in a warning state" }, { - "class": ".s-activity-indicator__danger", + "code": ".s-activity-indicator__danger", "applies": ".s-activity-indicator", "description": "Styles the activity indicator in a danger state" }, { - "class": ".s-activity-indicator__sm", + "code": ".s-activity-indicator__sm", "applies": ".s-activity-indicator", "description": "Styles the activity indicator in a small size" } - ] + ], + "examples": ["", "3", "12", "370", "new"], + "variants": ["success", "warning", "danger"] } \ No newline at end of file diff --git a/packages/stacks-docs/_data/components/avatars-component.json b/packages/stacks-docs/_data/components/avatars.json similarity index 67% rename from packages/stacks-docs/_data/components/avatars-component.json rename to packages/stacks-docs/_data/components/avatars.json index 48c749b715..b0ced834c5 100644 --- a/packages/stacks-docs/_data/components/avatars-component.json +++ b/packages/stacks-docs/_data/components/avatars.json @@ -1,59 +1,60 @@ { "classes": [ { - "class": ".s-avatar", - "applies": "N/A", + "code": ".s-avatar", "description": "The base avatar at 16px." }, { - "class": ".s-avatar--image", - "applies": "N/A", + "code": ".s-avatar--image", + "parent": ".s-avatar", "description": "A child element for displaying a user’s profile image." }, { - "class": ".s-avatar--letter", - "applies": "N/A", + "code": ".s-avatar--letter", + "parent": ".s-avatar", "description": "A child element for displaying an abbreviated Team name." }, { - "class": ".s-avatar--badge", - "applies": "N/A", + "code": ".s-avatar--badge", + "parent": ".s-avatar", "description": "A child element that provides positioning to the shield on Team avatars." }, { - "class": ".s-avatar--indicator", - "applies": "N/A", + "code": ".s-avatar--indicator", + "parent": ".s-avatar", "description": "A child element that provides positioning to the activity indicator on user's avatars." }, { - "class": ".s-avatar__24", + "code": ".s-avatar__24", "applies": ".s-avatar", "description": "Adds the proper border radius and scaling at 24px." }, { - "class": ".s-avatar__32", + "code": ".s-avatar__32", "applies": ".s-avatar", "description": "Adds the proper border radius and scaling at 32px." }, { - "class": ".s-avatar__48", + "code": ".s-avatar__48", "applies": ".s-avatar", "description": "Adds the proper border radius and scaling at 48px." }, { - "class": ".s-avatar__64", + "code": ".s-avatar__64", "applies": ".s-avatar", "description": "Adds the proper border radius and scaling at 64px." }, { - "class": ".s-avatar__96", + "code": ".s-avatar__96", "applies": ".s-avatar", "description": "Adds the proper border radius and scaling at 96px." }, { - "class": ".s-avatar__128", + "code": ".s-avatar__128", "applies": ".s-avatar", "description": "Adds the proper border radius and scaling at 128px." } - ] + ], + "examples": [16, 24, 32, 48, 64, 96, 128], + "teamBgs": ["blue-400", "theme-primary", "png"] } \ No newline at end of file diff --git a/packages/stacks-docs/_data/components/badges.json b/packages/stacks-docs/_data/components/badges.json index 509087a062..c25e35c27f 100644 --- a/packages/stacks-docs/_data/components/badges.json +++ b/packages/stacks-docs/_data/components/badges.json @@ -1,11 +1,87 @@ { + "classes": [ + { + "code": ".s-badge", + "description": "Base badge element." + }, + { + "code": ".s-badge__gold", + "applies": ".s-badge", + "description": "Badge indicating a gold award." + }, + { + "code": ".s-badge__silver", + "applies": ".s-badge", + "description": "Badge indicating a silver award." + }, + { + "code": ".s-badge__bronze", + "applies": ".s-badge", + "description": "Badge indicating a bronze award." + }, + { + "code": ".s-badge__important", + "applies": ".s-badge", + "description": "Applies important styling to the badge." + }, + { + "code": ".s-badge__squared", + "applies": ".s-badge", + "description": "Applies a background color to the badge's icon." + }, + { + "code": ".s-badge__info", + "applies": ".s-badge", + "description": "Badge indicating an info status." + }, + { + "code": ".s-badge__warning", + "applies": ".s-badge", + "description": "Badge indicating a warning status." + }, + { + "code": ".s-badge__danger", + "applies": ".s-badge", + "description": "Badge indicating a danger status." + }, + { + "code": ".s-badge__critical", + "applies": ".s-badge", + "description": "Badge indicating a critical status." + }, + { + "code": ".s-badge__tonal", + "applies": ".s-badge", + "description": "Badge indicating a tonal status." + }, + { + "code": ".s-badge__success", + "applies": ".s-badge", + "description": "Badge indicating a success status." + }, + { + "code": ".s-badge__featured", + "applies": ".s-badge", + "description": "Badge indicating a featured status." + }, + { + "code": ".s-badge__sm", + "applies": ".s-badge", + "description": "Applies a small size to the badge." + }, + { + "code": ".s-badge__lg", + "applies": ".s-badge", + "description": "Applies a large size to the badge." + } + ], "achievement": [ { "title": "Achievement", "classes": [ { "title": "Gold", - "class": "s-bling__gold", + "bling": "gold", "label": "Great Question", "html": "s-badge", "repType": "gold", @@ -13,7 +89,7 @@ }, { "title": "Silver", - "class": "s-bling__silver", + "bling": "silver", "label": "Favorite Question", "html": "s-badge", "repType": "silver", @@ -21,7 +97,7 @@ }, { "title": "Bronze", - "class": "s-bling__bronze", + "bling": "bronze", "label": "Altruist", "html": "s-badge", "repType": "bronze", @@ -36,7 +112,7 @@ "classes": [ { "title": "Gold", - "class": "s-badge__gold", + "code": "s-badge__gold", "repType": "gold", "html": "s-badge s-badge__gold", "label": "python", @@ -44,7 +120,7 @@ }, { "title": "Silver", - "class": "s-badge__silver", + "code": "s-badge__silver", "repType": "silver", "html": "s-badge s-badge__silver", "label": "css", @@ -52,7 +128,7 @@ }, { "title": "Bronze", - "class": "s-badge__bronze", + "code": "s-badge__bronze", "repType": "bronze", "html": "s-badge s-badge__bronze", "label": "javascript", @@ -74,7 +150,7 @@ }, { "title": "Info", - "class": "s-badge__info", + "code": "s-badge__info", "icon": "Compose", "html": "s-badge s-badge__info", "label": "Draft", @@ -82,7 +158,7 @@ }, { "title": "Warning", - "class": "s-badge__warning", + "code": "s-badge__warning", "icon": "Eye", "html": "s-badge s-badge__warning", "label": "Review", @@ -90,7 +166,7 @@ }, { "title": "Danger", - "class": "s-badge__danger", + "code": "s-badge__danger", "icon": "Flag", "html": "s-badge s-badge__danger", "label": "Closed", @@ -98,7 +174,7 @@ }, { "title": "Critical", - "class": "s-badge__critical", + "code": "s-badge__critical", "icon": "Challenge", "html": "s-badge s-badge__critical", "label": "Deleted", @@ -106,7 +182,7 @@ }, { "title": "Tonal", - "class": "s-badge__tonal", + "code": "s-badge__tonal", "icon": "Key", "html": "s-badge s-badge__tonal", "label": "Pinned", @@ -114,7 +190,7 @@ }, { "title": "Success", - "class": "s-badge__success", + "code": "s-badge__success", "icon": "Check", "html": "s-badge s-badge__success", "label": "Success", @@ -122,7 +198,7 @@ }, { "title": "Featured", - "class": "s-badge__featured", + "code": "s-badge__featured", "icon": "Star", "html": "s-badge s-badge__featured", "label": "New", @@ -134,12 +210,12 @@ "squared": [ { "title": "Squared", - "class": "s-badge__squared", + "code": "s-badge__squared", "classes": [ { "title": "Success", "icon": "Check", - "class": "s-badge__success", + "code": "s-badge__success", "html": "s-badge s-badge__squared s-badge__success", "label": "Accepted answer", "description": "Success badge styling in squared variant." @@ -147,7 +223,7 @@ { "title": "Featured", "icon": "VoteUp", - "class": "s-badge__featured", + "code": "s-badge__featured", "html": "s-badge s-badge__squared s-badge__featured", "label": "Earn badge", "description": "Featured badge styling in squared variant." @@ -162,26 +238,26 @@ { "title": "Warning", "icon": "Notification", - "html": "s-badge s-badge__squared s-badge__warning s-badge__important", + "classes": "s-badge__squared s-badge__warning s-badge__important", "label": "Needs attention", "description": "Warning badge styling in squared variant with important styling." }, { "title": "Danger", "icon": "VoteUp", - "html": "s-badge s-badge__danger s-badge__important", + "classes": "s-badge__danger s-badge__important", "label": "Ending soon", "description": "Danger badge styling with important styling." }, { "title": "Critical", - "html": "s-badge s-badge__critical s-badge__important", + "classes": "s-badge__critical s-badge__important", "label": "Spam", "description": "Critical badge styling with important styling." }, { "title": "Info", - "html": "s-badge s-badge__info s-badge__important", + "classes": "s-badge__info s-badge__important", "label": "+100", "description": "Info badge styling in small size with important styling." } @@ -194,43 +270,37 @@ "classes": [ { "title": "Admin", - "class": "s-badge__admin", - "html": "s-badge s-badge__admin", + "modifier": "admin", "label": "Admin", "description": "Badge indicating user is an admin." }, { "title": "Moderator", - "class": "s-badge__moderator", - "html": "s-badge s-badge__moderator", + "modifier": "moderator", "label": "Moderator", "description": "Badge indicating user is an moderator." }, { "title": "Staff", - "class": "s-badge__staff", - "html": "s-badge s-badge__staff", + "modifier": "staff", "label": "Staff", "description": "Badge indicating user is staff." }, { "title": "AI", - "class": "s-badge__ai", - "html": "s-badge s-badge__ai", + "modifier": "ai", "label": "AI", "description": "Badge indicating content is AI generated." }, { "title": "Bot", - "class": "s-badge__bot", - "html": "s-badge s-badge__bot", + "modifier": "bot", "label": "Bot", "description": "Badge indicating user is a bot." }, { "title": "New", - "class": "s-badge__new", - "html": "s-badge s-badge__new", + "modifier": "new", "label": "New", "description": "Badge indicating new user" } @@ -243,21 +313,19 @@ "classes": [ { "title": "Small", - "class": "s-badge__sm", - "html": "s-badge s-badge__sm s-badge__success", + "modifier": "sm", "label": "Small", "description": "The badge in small size." }, { "title": "Default", - "html": "s-badge s-badge__warning", + "modifier": "", "label": "Default", "description": "The badge in default size." }, { "title": "Large", - "class": "s-badge__lg", - "html": "s-badge s-badge__lg s-badge__danger", + "modifier": "lg", "label": "Large", "description": "The badge in large size." } diff --git a/packages/stacks-docs/_data/components/banners.json b/packages/stacks-docs/_data/components/banners.json index b40e208cca..11be21fbee 100644 --- a/packages/stacks-docs/_data/components/banners.json +++ b/packages/stacks-docs/_data/components/banners.json @@ -1,54 +1,116 @@ { - "system": [ + "classes": [ { - "class": ".s-banner", - "applies": "N/A", + "code": ".s-banner", "description": "Base banner parent class. This defaults to a system banner style." }, { - "class": ".s-banner--dismiss", - "applies": ".s-banner", + "code": ".s-banner--actions", + "parent": ".s-banner", + "description": "Container styling for banner actions including the dismiss button." + }, + { + "code": ".s-banner--dismiss", + "parent": ".s-banner", "description": "Applies to child button element within the banner to position it appropriately." }, { - "class": ".s-banner--actions", + "code": ".s-banner__important", "applies": ".s-banner", - "description": "Container styling for banner actions including the dismiss button." + "description": "Applies an important visual style. This should be used for time-sensitive, pressing information that needs to be noticed by the user." }, { - "class": ".s-banner__info", + "code": ".s-banner__info", "applies": ".s-banner", "description": "Applies info (blue) visual styles." }, { - "class": ".s-banner__success", + "code": ".s-banner__success", "applies": ".s-banner", "description": "Applies success (green) visual styles." }, { - "class": ".s-banner__warning", + "code": ".s-banner__warning", "applies": ".s-banner", "description": "Applies warning (yellow) visual styles." }, { - "class": ".s-banner__danger", + "code": ".s-banner__danger", "applies": ".s-banner", "description": "Applies danger (red) visual styles." }, { - "class": ".s-banner__featured", + "code": ".s-banner__featured", "applies": ".s-banner", "description": "Applies featured (purple) visual styles." }, { - "class": ".s-banner__activity", + "code": ".s-banner__activity", "applies": ".s-banner", "description": "Applies activity (pink) visual styles." }, { - "class": ".s-banner__important", + "code": ".is-pinned", "applies": ".s-banner", - "description": "Emboldens the above visual styles by strengthening the background saturation. This should be used for time-sensitive, pressing information that needs to be noticed by the user." + "description": "Pins the banner to the top of the browser window." + } + ], + "attributes": [ + { + "code": "data-controller=\"s-banner\"", + "primaryContext": "Controller element", + "description": "Wires up the element to the banner controller. This may be a .s-banner element or a wrapper element." + }, + { + "code": "data-s-banner-target=\"banner\"", + "primaryContext": ".s-banner element", + "description": "Wires up the element that is to be shown/hidden" + }, + { + "code": "data-s-banner-remove-when-hidden=\"true\"", + "primaryContext": "Controller element", + "description": "(optional) Removes the banner from the DOM entirely when it is hidden" + } + ], + "events": [ + { + "code": "s-banner:show", + "primaryContext": "Banner target", + "description": "Fires immediately before showing the banner. Calling .preventDefault() cancels the display of the banner." + }, + { + "code": "s-banner:shown", + "primaryContext": "Banner target", + "description": "Fires after the banner has been visually shown" + }, + { + "code": "s-banner:hide", + "primaryContext": "Banner target", + "description": "Fires immediately before hiding the banner. Calling .preventDefault() cancels the removal of the banner." + }, + { + "code": "s-banner:hidden", + "primaryContext": "Banner target", + "description": "Fires after the banner has been visually hidden" + } + ], + "eventDetails": [ + { + "code": "dispatcher", + "primaryContext": "Banner target", + "description": "Contains the Element that initiated the event. For instance, the button clicked to show, the element clicked outside the banner that caused it to hide, etc." + } + ], + "helpers": [ + { + "code": "Stacks.showBanner", + "primaryContext": "Element: the element the data-controller=\"s-banner\" attribute is on", + "description": "Helper to manually show an s-banner element via external JS" + }, + { + "code": "Stacks.hideBanner", + "primaryContext": "Element: the element the data-controller=\"s-banner\" attribute is on", + "description": "Helper to manually hide an s-banner element via external JS" } ] } \ No newline at end of file diff --git a/packages/stacks-docs/_data/atomic/bling.json b/packages/stacks-docs/_data/components/bling.json similarity index 55% rename from packages/stacks-docs/_data/atomic/bling.json rename to packages/stacks-docs/_data/components/bling.json index 932e910ebe..697270c82e 100644 --- a/packages/stacks-docs/_data/atomic/bling.json +++ b/packages/stacks-docs/_data/components/bling.json @@ -1,4 +1,50 @@ { + "classes": [ + { + "code": ".s-bling", + "description": "Base bling element." + }, + { + "code": ".s-bling__gold", + "applies": ".s-bling", + "description": "Gold bling element." + }, + { + "code": ".s-bling__silver", + "applies": ".s-bling", + "description": "Silver bling element." + }, + { + "code": ".s-bling__bronze", + "applies": ".s-bling", + "description": "Bronze bling element." + }, + { + "code": ".s-bling__activity", + "applies": ".s-bling", + "description": "Activity bling element." + }, + { + "code": ".s-bling__filled", + "applies": ".s-bling", + "description": "Filled bling element." + }, + { + "code": ".s-bling__rep", + "applies": ".s-bling", + "description": "Reputation bling element." + }, + { + "code": ".s-bling__sm", + "applies": ".s-bling", + "description": "Small bling element." + }, + { + "code": ".s-bling__lg", + "applies": ".s-bling", + "description": "Large bling element." + } + ], "title": "Bling", "variants": ["default", "rep", "activity", "gold", "silver", "bronze"], "sizes": ["sm", "default", "lg"], diff --git a/packages/stacks-docs/_data/components/breadcrumbs.json b/packages/stacks-docs/_data/components/breadcrumbs.json index 891c7f6780..9b40c0c299 100644 --- a/packages/stacks-docs/_data/components/breadcrumbs.json +++ b/packages/stacks-docs/_data/components/breadcrumbs.json @@ -1,23 +1,22 @@ { "classes": [ { - "class": ".s-breadcrumbs", - "applies": "N/A", + "code": ".s-breadcrumbs", "description": "Base parent container for breadcrumbs" }, { - "class": ".s-breadcrumbs--item", - "applies": ".s-breadcrumbs", + "code": ".s-breadcrumbs--item", + "parent": ".s-breadcrumbs", "description": "Individual breadcrumb element containing a link and a divider" }, { - "class": ".s-breadcrumbs--link", - "applies": ".s-breadcrumbs--item", + "code": ".s-breadcrumbs--link", + "parent": ".s-breadcrumbs--item", "description": "Breadcrumb link element" }, { - "class": ".s-breadcrumbs--divider", - "applies": ".s-breadcrumbs--item", + "code": ".s-breadcrumbs--divider", + "parent": ".s-breadcrumbs--item", "description": "Breadcrumb divider element" } ] diff --git a/packages/stacks-docs/_data/components/button-groups.json b/packages/stacks-docs/_data/components/button-groups.json index 11ee7a5c00..fbdee95c75 100644 --- a/packages/stacks-docs/_data/components/button-groups.json +++ b/packages/stacks-docs/_data/components/button-groups.json @@ -1,8 +1,7 @@ { "classes": [ { - "class": ".s-btn-group", - "applies": "N/A", + "code": ".s-btn-group", "description": "Base button group style." } ], diff --git a/packages/stacks-docs/_data/components/buttons.json b/packages/stacks-docs/_data/components/buttons.json index a26062cb88..f4a11471e9 100644 --- a/packages/stacks-docs/_data/components/buttons.json +++ b/packages/stacks-docs/_data/components/buttons.json @@ -1,4 +1,85 @@ { + "classes": [ + { + "code": ".s-btn", + "description": "Base button element" + }, + { + "code": ".s-btn--badge", + "parent": ".s-btn", + "description": "Badge container for the button" + }, + { + "code": ".s-btn__clear", + "applies": ".s-btn", + "description": "Clear button variant" + }, + { + "code": ".s-btn__danger", + "applies": ".s-btn", + "description": "Danger button variant" + }, + { + "code": ".s-btn__featured", + "applies": ".s-btn", + "description": "Featured button variant" + }, + { + "code": ".s-btn__tonal", + "applies": ".s-btn", + "description": "Tonal button variant" + }, + { + "code": ".s-btn__dropdown", + "applies": ".s-btn", + "description": "Dropdown button variant" + }, + { + "code": ".s-btn__icon", + "applies": ".s-btn", + "description": "Icon button variant" + }, + { + "code": ".s-btn__link", + "applies": ".s-btn", + "description": "Link button variant" + }, + { + "code": ".s-btn__unset", + "applies": ".s-btn", + "description": "Unset button variant" + }, + { + "code": ".s-btn__facebook", + "applies": ".s-btn", + "description": "Facebook button variant" + }, + { + "code": ".s-btn__github", + "applies": ".s-btn", + "description": "GitHub button variant" + }, + { + "code": ".s-btn__google", + "applies": ".s-btn", + "description": "Google button variant" + }, + { + "code": ".s-btn__xs", + "applies": ".s-btn", + "description": "Extra small button variant" + }, + { + "code": ".s-btn__sm", + "applies": ".s-btn", + "description": "Small button variant" + }, + { + "code": ".s-btn__lg", + "applies": ".s-btn", + "description": "Large button variant" + } + ], "base": [ { "title": "Base", diff --git a/packages/stacks-docs/_data/components/cards.json b/packages/stacks-docs/_data/components/cards.json new file mode 100644 index 0000000000..fac8316d2a --- /dev/null +++ b/packages/stacks-docs/_data/components/cards.json @@ -0,0 +1,13 @@ +{ + "classes": [ + { + "code": ".s-card", + "description": "Base card style." + }, + { + "code": ".s-card__muted", + "applies": ".s-card", + "description": "Muted card style." + } + ] +} \ No newline at end of file diff --git a/packages/stacks-docs/_data/components/checkbox_radio.json b/packages/stacks-docs/_data/components/checkbox_radio.json index 1ec9b19c02..adce85156c 100644 --- a/packages/stacks-docs/_data/components/checkbox_radio.json +++ b/packages/stacks-docs/_data/components/checkbox_radio.json @@ -1,4 +1,26 @@ { + "checkbox-classes": [ + { + "code": ".s-checkbox", + "description": "Base checkbox style." + }, + { + "code": ".s-checkbox__checkmark", + "applies": ".s-checkbox", + "description": "Checkmark style." + } + ], + "radio-classes": [ + { + "code": ".s-radio", + "description": "Base radio style." + }, + { + "code": ".s-radio__checkmark", + "applies": ".s-radio", + "description": "Checkmark style." + } + ], "checkbox": [ { "description": "Unchecked checkbox.", diff --git a/packages/stacks-docs/_data/components/code-blocks.json b/packages/stacks-docs/_data/components/code-blocks.json index ceda5424a9..da6d1b1de0 100644 --- a/packages/stacks-docs/_data/components/code-blocks.json +++ b/packages/stacks-docs/_data/components/code-blocks.json @@ -1,19 +1,18 @@ { "classes": [ { - "class": ".s-code-block", - "applies": "N/A", - "description": "Adds proper styling to pre-formatted code." + "code": ".s-code-block", + "description": "Base code block style." }, { - "class": ".linenums", + "code": ".linenums", "applies": ".s-code-block", "description": "Adds a line numbers column to the code block." }, { - "class": ".linenums:<n>", + "code": ".linenums:<n>", "applies": ".s-code-block", - "description": "Adds a line numbers column to the code block starting at a number <n>." + "description": "Adds a line numbers column to the code block starting at a number <n>." } ] } diff --git a/packages/stacks-docs/_data/components/empty-states.json b/packages/stacks-docs/_data/components/empty-states.json new file mode 100644 index 0000000000..d531405502 --- /dev/null +++ b/packages/stacks-docs/_data/components/empty-states.json @@ -0,0 +1,8 @@ +{ + "classes": [ + { + "code": ".s-empty-state", + "description": "Base empty state style." + } + ] +} \ No newline at end of file diff --git a/packages/stacks-docs/_data/components/expandable.json b/packages/stacks-docs/_data/components/expandable.json new file mode 100644 index 0000000000..ddd1527443 --- /dev/null +++ b/packages/stacks-docs/_data/components/expandable.json @@ -0,0 +1,18 @@ +{ + "classes": [ + { + "code": ".s-expandable", + "description": "Container for the expandable content. Include an id attribute to be referenced by the expandable control." + }, + { + "code": ".s-expandable--content", + "parent": ".s-expandable", + "description": "Class for the expandable content. This is the content that will be shown and hidden when the expandable is toggled." + }, + { + "code": ".is-expanded", + "applies": ".s-expandable", + "description": "Expanded state class." + } + ] +} \ No newline at end of file diff --git a/packages/stacks-docs/_data/components/inputs.json b/packages/stacks-docs/_data/components/inputs.json index 4920754b54..e92daf982c 100644 --- a/packages/stacks-docs/_data/components/inputs.json +++ b/packages/stacks-docs/_data/components/inputs.json @@ -1,298 +1,54 @@ { - "validation": [ + "classes": [ { - "class": ".has-warning", - "description": "Used to warn users that the value they’ve entered has a potential problem, but it doesn’t block them from proceeding." + "code": ".s-input", + "description": "Base input style." }, { - "class": ".has-error", - "description": "Used to alert users that the value they’ve entered is incorrect, not filled in, or has a problem which will block them from proceeding." + "code": ".s-input__creditcard", + "applies": ".s-input", + "description": "Adds a credit card icon to the input." }, { - "class": ".has-success", - "description": "Used to notify users that the value they’ve entered is fine or has been submitted successfully." - } - ], - "input": [ - { - "sizes": [ - { - "name": "Small", - "size": "13px", - "class": "s-input__sm" - }, - { - "name": "Default", - "size": "14px", - "class": "N/A" - }, - { - "name": "Large", - "size": "18px", - "class": "s-input__lg" - } - ] + "code": ".s-input__search", + "applies": ".s-input", + "description": "Adds a search icon to the input." }, { - "types": [ - { - "name": "color", - "html5": true, - "description": "Allows user to select a color and returns the hex value for that color. The color picker used is native to the OS or the browser." - }, - { - "name": "date", - "html5": true, - "description": "Allows user to enter a date (year, month, and day) without a time." - }, - { - "name": "datetime-local", - "html5": true, - "description": "Allows user to enter a date (year, month, and day) and a time, with no time zone." - }, - { - "name": "email", - "html5": true, - "description": "Allows user to enter an email address. Some mobile devices will deliver custom keyboards specifically for entering email addresses." - }, - { - "name": "file", - "html5": false, - "description": "Allows user to select a file. To define the type of files that can be selected, use the accept=\"\" attribute." - }, - { - "name": "month", - "html5": true, - "description": "Allows user to enter a month and year with no time zone." - }, - { - "name": "number", - "html5": true, - "description": "Limits user to entering only numbers. Some mobile devices will deliver a custom keyboard." - }, - { - "name": "password", - "html5": false, - "description": "Single-line text input whose value is obsecured. Use the minlength and maxlength attributes to specify the value length." - }, - { - "name": "range", - "html5": true, - "description": "Allows user to enter a number who exact value isn't important." - }, - { - "name": "search", - "html5": true, - "description": "Single-line text input for entering search strings. Some mobile devices will deliver a custom keyboard." - }, - { - "name": "tel", - "html5": true, - "description": "Allows user to enter a telephone number. Some mobile devices will deliver a custom keyboard." - }, - { - "name": "text", - "html5": false, - "description": "Single-line text input field." - }, - { - "name": "time", - "html5": true, - "description": "Allows user to enter a time value with no time zone." - }, - { - "name": "url", - "html5": true, - "description": "Allows user to enter a website URL. Some mobile devices will deliver a custom keyboard." - }, - { - "name": "week", - "html5": true, - "description": "Allows user to enter a date consisting of a week-year number and a week number with no time zone." - } - ] + "code": ".s-input__sm", + "applies": ".s-input", + "description": "Apply a small size." }, { - "attributes": [ - { - "name": "accept", - "html5": false, - "description": "If the type is file, then this attribute will indicate the file types that will be accepted. The value must be a comma-separated list." - }, - { - "name": "autocomplete", - "html5": true, - "description": "Indicates if the control value can be automatically completed by the browser. For a full list of possible values, please visit MDN Inputs page." - }, - { - "name": "autofocus", - "html5": true, - "description": "Lets you specify which form control should have input focus on page load. Only one element can have this attribute and it cannot be set on hidden elements." - }, - { - "name": "capture", - "html5": false, - "description": "If the type is file, then this Boolean attribute will indicate that the capture of media directly from the device's environment using a media capture mechanicism is preferred (e.g. taking a photo using a camera)." - }, - { - "name": "disabled", - "html5": false, - "description": "Boolean attribute that indicates the input is not available for interaction." - }, - { - "name": "form", - "html5": true, - "description": "This attribute associates the form element with the input element. The input value must be the form's id value within the same document. If this isn't specified, the input will use the closest ancestor form element. This attribute allows you to place inputs anywhere on the page, not just as a descendant within a form element. An input can only be associated with one form." - }, - { - "name": "max", - "html5": true, - "description": "Maximum numeric or date-time value for this item, which cannot be lesser than the minimum value." - }, - { - "name": "maxlength", - "html5": true, - "description": "If type is text, email, search, password, tel, or url; this attribute sets the maximum number of characters that can be entered." - }, - { - "name": "min", - "html5": true, - "description": "Minimum numeric or date-time value for this item, which cannot be greater than the minimum value." - }, - { - "name": "minlength", - "html5": true, - "description": "If type is text, email, search, password, tel, or url; this attribute sets the minimum number of characters that must be entered." - }, - { - "name": "multiple", - "html5": true, - "description": "If type is email or file, this attribute allows for more than one value." - }, - { - "name": "name", - "html5": false, - "description": "Name of the control which is submitted with the form data." - }, - { - "name": "placeholder", - "html5": true, - "description": "Provides a hint to the user of what can be entered into the control." - }, - { - "name": "readonly", - "html5": true, - "description": "Indicates that the control cannot be modified by the user. This is ignored if the type attribute is hidden, range, color, checkbox, radio, or a button type." - }, - { - "name": "required", - "html5": true, - "description": "Specifies that the user must provide a value for this control before submitting the form. This is ignored if the type attribute is hidden, image, or a button type." - }, - { - "name": "selectionDirection", - "html5": true, - "description": "Specifies the direction in which a selection occurs." - }, - { - "name": "selectionEnd", - "html5": false, - "description": "The offset into the element's text content of the last selected character. If there's no selection, this value indicates the offset to the character following the current text input cursor position (that is, the position the next character typed would occupy)." - }, - { - "name": "selectionStart", - "html5": false, - "description": "The offset into the element's text content of the first selected character. If there's no selection, this value indicates the offset to the character following the current text input cursor position (that is, the position the next character typed would occupy)." - }, - { - "name": "size", - "html5": false, - "description": "The control's initial size." - }, - { - "name": "spellcheck", - "html5": true, - "description": "Setting the value to true indicates that the element needs to have its spelling and grammar checked." - }, - { - "name": "step", - "html5": true, - "description": "Works with min and max attributes to limit the increments at which a numeric or date-time value can be set." - }, - { - "name": "tabindex", - "html5": true, - "description": "Position of the element in the tab navigation order for the current document." - }, - { - "name": "value", - "html5": false, - "description": "Initial value for the control." - } - ] + "code": ".s-input__lg", + "applies": ".s-input", + "description": "Apply a large size." } ], - "textarea": [ + "sizes": [ { - "sizes": [ - { - "name": "Small", - "size": "13px", - "class": "s-textarea__sm" - }, - { - "name": "Default", - "size": "14px", - "class": "N/A" - }, - { - "name": "Large", - "size": "18px", - "class": "s-textarea__lg" - } - ] - } - ], - "select": [ + "primaryContext": "Small", + "secondaryContext": "13px", + "code": ".s-input__sm", + "description": "" + }, + { + "primaryContext": "Default", + "secondaryContext": "14px", + "description": "" + }, { - "sizes": [ - { - "name": "Small", - "size": "13px", - "class": "s-select__sm" - }, - { - "name": "Default", - "size": "14px", - "class": "N/A" - }, - { - "name": "Large", - "size": "18px", - "class": "s-select__lg" - } - ] + "primaryContext": "Large", + "secondaryContext": "18px", + "code": ".s-input__lg", + "description": "" } ], - "label": [ + "required": [ { - "sizes": [ - { - "name": "Small", - "size": "14px", - "class": "s-label__sm" - }, - { - "name": "Default", - "size": "16px", - "class": "N/A" - }, - { - "name": "Large", - "size": "22px", - "class": "s-label__lg" - } - ] + "code": ".s-required-symbol", + "secondaryContext": "abbr element enclosing the asterisk", + "description": "Used to style the asterisk indicating that a specific field is required." } ] } \ No newline at end of file diff --git a/packages/stacks-docs/_data/components/labels.json b/packages/stacks-docs/_data/components/labels.json new file mode 100644 index 0000000000..7dd3f1ae97 --- /dev/null +++ b/packages/stacks-docs/_data/components/labels.json @@ -0,0 +1,37 @@ +{ + "classes": [ + { + "code": ".s-label", + "description": "Base label style." + }, + { + "code": ".s-label__sm", + "applies": ".s-label", + "description": "Apply a small size." + }, + { + "code": ".s-label__lg", + "applies": ".s-label", + "description": "Apply a large size." + } + ], + "sizes": [ + { + "code": ".s-label__sm", + "secondaryContext": "14px", + "primaryContext": "Small", + "description": "" + }, + { + "secondaryContext": "16px", + "primaryContext": "Default", + "description": "" + }, + { + "code": ".s-label__lg", + "secondaryContext": "22px", + "primaryContext": "Large", + "description": "" + } + ] +} \ No newline at end of file diff --git a/packages/stacks-docs/_data/components/link-previews.json b/packages/stacks-docs/_data/components/link-previews.json index 510b985493..a358bc60db 100644 --- a/packages/stacks-docs/_data/components/link-previews.json +++ b/packages/stacks-docs/_data/components/link-previews.json @@ -1,59 +1,81 @@ { "classes": [ { - "class": ".s-link-preview", - "parent": "N/A", + "code": ".s-link-preview", "description": "Base parent container for link previews" }, { - "class": ".s-link-preview--header", + "code": ".s-link-preview--header", "parent": ".s-link-preview", "description": "Top section containing the title and details" }, { - "class": ".s-link-preview--icon", - "parent": ".s-link-preview--header", - "description": "Logo of the third party link. Use the @Svg.Helper." - }, - { - "class": ".s-link-preview--title", - "parent": ".s-link-preview--header", - "description": "Title of the linked file" - }, - { - "class": ".s-link-preview--details", - "parent": ".s-link-preview--header", - "description": "Details and meta data of the linked file" - }, - { - "class": ".s-link-preview--body", + "code": ".s-link-preview--body", "parent": ".s-link-preview", "description": "Middle section containing the body of the linked file whose expected content is rich text or markdown" }, { - "class": ".s-link-preview--code", + "code": ".s-link-preview--code", "parent": ".s-link-preview", "description": "Middle section containing the body of the linked file whose expected content is code" }, { - "class": ".s-link-preview--footer", + "code": ".s-link-preview--footer", "parent": ".s-link-preview", "description": "Bottom section containing URL details" }, { - "class": ".s-link-preview--url", + "code": ".s-link-preview--icon", + "parent": ".s-link-preview--header", + "description": "Logo of the third party link. Use the @Svg.Helper." + }, + { + "code": ".s-link-preview--title", + "parent": ".s-link-preview--header", + "description": "Title of the linked file." + }, + { + "code": ".s-link-preview--details", + "parent": ".s-link-preview--header", + "description": "Details and meta data of the linked file." + }, + { + "code": ".s-link-preview--url", "parent": ".s-link-preview--footer", - "description": "URL of the linked file" + "description": "URL of the linked file." }, { - "class": ".s-link-preview--misc", + "code": ".s-link-preview--misc", "parent": ".s-link-preview--footer", "description": "(optional) A small catch-all for anything you might need. This page contains a few use cases." }, { - "class": ".linenums", + "code": ".linenums", "parent": ".s-link-preview--code", "description": "Added to the pre of the preview block to properly display line numbers" } - ] + ], + "examples": { + "base": { + "title": "Using hooks for a simple fetch request and breaking the rules of hooks, unsure how?", + "description": "Use for links whose expected body is rich text or markdown like Jira issues or Slack messages. Wherever possible, it’s best practice to support basic markdown formatting (bold, italics, line breaks, lists, etc.)", + "details": "Issue submitted by Ricky Otero on Aug 12, 2019RESOLVED", + "body": [ + "I'm trying to create a simple fetch with hooks from an AWS database. At the moment it errors out and the only reason I can see is because it breaks the rules of hooks but I'm not sure how. It's at the top level of this functional component and it's not called inside an event handler.", + "The result of this call (an array of user data), needs to be exported as a function and called in another file.", + "If anyone can spot something I have missed and can highlighted how I'm breaking the rules of hooks I'd be grateful!", + "Thanks!" + ], + "url": "https://stackoverflow.atlassian.net/projects/SREREQ/queues/custom/1", + "misc": "Privacy notice" + }, + "code": { + "title": "Gruntfile.js", + "description": "Use for links whose expected body is code like code files or GitHub Gists. In these scenarios, replace s-link-preview--body class with s-link-preview--code.", + "details": "Located in StackExchange / Stacks", + "code": "use strict;\n\nmodule.exports = function(grunt) {\n grunt.initConfig({\n pkg: grunt.file.readJSON('package.json'),\n version: '<%= pkg.version %>',\n\n // Shell commands for use in Grunt tasks\n shell: {\n eleventyBuild: {\n command: 'npx @11ty/eleventy',\n options: {\n stderr: false,\n execOptions: {\n cwd: 'docs'\n }\n }\n }\n }\n });\n\n grunt.loadNpmTasks('grunt-contrib-uglify');\n\n grunt.registerTask('default', ['uglify']);\n};", + "url": "https://github.com/StackExchange/Stacks/blob/develop/Gruntfile.js", + "misc": "(truncated)" + } + } } \ No newline at end of file diff --git a/packages/stacks-docs/_data/components/links.json b/packages/stacks-docs/_data/components/links.json index ec624fcdcd..2ef10caf76 100644 --- a/packages/stacks-docs/_data/components/links.json +++ b/packages/stacks-docs/_data/components/links.json @@ -1,86 +1,84 @@ { - "single-links": [ + "link-classes": [ { - "class": ".s-link", - "applies": "N/A", + "code": ".s-link", "description": "Base link style that is used almost universally." }, { - "class": ".s-link__grayscale", + "code": ".s-link__grayscale", "applies": ".s-link", "description": "A link style modification with our default text color." }, { - "class": ".s-link__muted", + "code": ".s-link__muted", "applies": ".s-link", "description": "Applies a visually muted style to the base style." }, { - "class": ".s-link__danger", + "code": ".s-link__danger", "applies": ".s-link", "description": "Applies an important, destructive red to the base style." }, { - "class": ".s-link__inherit", + "code": ".s-link__inherit", "applies": ".s-link", "description": "Applies the parent element’s text color." }, { - "class": ".s-link__underlined", + "code": ".s-link__underlined", "applies": ".s-link", "description": "Adds an underline to the link’s text." }, { - "class": ".s-link__dropdown", + "code": ".s-link__dropdown", "applies": ".s-link", "description": "Applies a caret for dropdowns and additional interactivity." } ], - "descendent-anchors": [ + "anchors-classes": [ { - "class": ".s-anchors", + "code": ".s-anchors", "name": "base", - "applies": "N/A", "description": "A consistent link style is applied to all descendent anchors.", "exampleClasses": "" }, { - "class": ".s-anchors__default", + "code": ".s-anchors__default", "applies": ".s-anchors", "name": "default", "description": "All descendent links receive s-link’s default styling.", "exampleClasses": "" }, { - "class": ".s-anchors__grayscale", + "code": ".s-anchors__grayscale", "applies": ".s-anchors", "name": "grayscale", "description": "Applies gray styling to all descendent links.", "exampleClasses": "fc-orange-500" }, { - "class": ".s-anchors__muted", + "code": ".s-anchors__muted", "applies": ".s-anchors", "name": "muted", "description": "Applies a visually muted style to all descendent links.", "exampleClasses": "" }, { - "class": ".s-anchors__danger", + "code": ".s-anchors__danger", "applies": ".s-anchors", "name": "danger", "description": "Applies an important, destructive red to all descendent links.", "exampleClasses": "" }, { - "class": ".s-anchors__underlined", + "code": ".s-anchors__underlined", "applies": ".s-anchors", "name": "underlined", "description": "Applies an underline to all descendent links.", "exampleClasses": "" }, { - "class": ".s-anchors__inherit", + "code": ".s-anchors__inherit", "applies": ".s-anchors", "name": "inherit", "description": "Applies the parent element’s text color to all descendent links.", diff --git a/packages/stacks-docs/_data/components/loader.json b/packages/stacks-docs/_data/components/loader.json index 05abfa09a8..6bde8f7915 100644 --- a/packages/stacks-docs/_data/components/loader.json +++ b/packages/stacks-docs/_data/components/loader.json @@ -1,25 +1,40 @@ { "classes": [ { - "class": ".s-loader", - "applies": "N/A", + "code": ".s-loader", "description": "Base class for the loader component" }, { - "class": ".s-loader--sr-text", - "applies": ".s-loader", - "description": "Child necessary to render the center loader block and renders the accessible text" + "code": ".s-loader--sr-text", + "parent": ".s-loader", + "description": "Necessary to render the center loader block and renders the accessible text" }, { - "class": ".s-loader__sm", + "code": ".s-loader__sm", "applies": ".s-loader", "description": "A small variant of the loader component" }, { - "class": ".s-loader__lg", + "code": ".s-loader__lg", "applies": ".s-loader", "description": "A large variant of the loader component" } ], + "sizes-classes": [ + { + "code": ".s-loader__sm", + "applies": ".s-loader", + "description": "
Loading…
" + }, + { + "code": ".s-loader", + "description": "
Loading…
" + }, + { + "code": ".s-loader__lg", + "applies": ".s-loader", + "description": "
Loading…
" + } + ], "sizes": ["s-loader__sm", "", "s-loader__lg"] } diff --git a/packages/stacks-docs/_data/components/menu.json b/packages/stacks-docs/_data/components/menus.json similarity index 62% rename from packages/stacks-docs/_data/components/menu.json rename to packages/stacks-docs/_data/components/menus.json index bf2ac129ef..6b2dc6d7fd 100644 --- a/packages/stacks-docs/_data/components/menu.json +++ b/packages/stacks-docs/_data/components/menus.json @@ -1,37 +1,36 @@ { "classes": [ { - "class": ".s-menu", - "applies": "N/A", + "code": ".s-menu", "description": "Base container styling for a menu." }, { - "class": ".s-menu--divider", - "applies": ".s-menu", + "code": ".s-menu--divider", + "parent": ".s-menu", "description": "Adds a divider line between menu sections." }, { - "class": ".s-menu--item", - "applies": ".s-menu", + "code": ".s-menu--item", + "parent": ".s-menu", "description": "Applies link styling to link within a menu. Used for actionable elements." }, { - "class": ".s-menu--title", - "applies": ".s-menu", + "code": ".s-menu--title", + "parent": ".s-menu", "description": "Adds appropriate styling for a title within a menu." }, { - "class": ".s-menu--icon", - "applies": ".s-menu--item", + "code": ".s-menu--icon", + "parent": ".s-menu--item", "description": "Applies styling to an icon." }, { - "class": ".s-menu--action", - "applies": ".s-menu--item", + "code": ".s-menu--action", + "parent": ".s-menu--item", "description": "Applies link styling to link within a menu. Used for actionable elements." }, { - "class": ".s-menu--action__danger", + "code": ".s-menu--action__danger", "applies": ".s-menu--action", "description": "Applies danger styling to a menu link. Used for destructive actions." } diff --git a/packages/stacks-docs/_data/components/modals.json b/packages/stacks-docs/_data/components/modals.json index 83e461d876..f393074113 100644 --- a/packages/stacks-docs/_data/components/modals.json +++ b/packages/stacks-docs/_data/components/modals.json @@ -1,44 +1,164 @@ { "classes": [ { - "class": ".s-modal", - "applies": "N/A", - "description": "Base parent container for modals" + "code": ".s-modal", + "description": "Base parent container for modals." }, { - "class": ".s-modal__danger", - "applies": ".s-modal", - "description": "Adds styling for potentially dangerous actions" + "code": ".s-modal--dialog", + "parent": ".s-modal", + "description": "Creates a container that holds the modal dialog with proper padding and shadows." }, { - "class": ".s-modal--dialog", - "applies": "Child of .s-modal", - "description": "Creates a container that holds the modal dialog with proper padding and shadows" + "code": ".s-modal--body", + "parent": ".s-modal--dialog", + "description": "Adds proper styling to the modal dialog’s body text." }, { - "class": ".s-modal--header", - "applies": "Child of .s-modal--dialog", - "description": "Adds proper styling to the modal dialog’s header" + "code": ".s-modal--close", + "parent": ".s-modal--dialog", + "description": "Used to dismiss a modal." }, { - "class": ".s-modal--body", - "applies": "Child of .s-modal--dialog", - "description": "Adds proper styling to the modal dialog’s body text" + "code": ".s-modal--header", + "parent": ".s-modal--dialog", + "description": "Adds proper styling to the modal dialog’s header." }, { - "class": ".s-modal--footer", - "applies": "Child of .s-modal--dialog", + "code": ".s-modal--footer", + "parent": ".s-modal--dialog", "description": "Adds the desired spacing to the row of button actions." }, { - "class": ".s-modal--close", - "applies": "Child of .s-modal--dialog", - "description": "Used to dismiss a modal" + "code": ".s-modal__danger", + "applies": ".s-modal", + "description": "Adds styling for potentially dangerous actions." }, { - "class": ".s-modal__full", - "applies": ".s-modal--dialog", - "description": "Makes the .s-modal--dialog container take up as much of the screen as possible." + "code": ".s-modal__full", + "applies": ".s-modal--dialog", + "description": "Makes the container take up as much of the screen as possible." + } + ], + "attributes": [ + { + "code": "data-controller=\"s-modal\"", + "primaryContext": "Controller element", + "description": "Wires up the element to the modal controller. This may be a .s-modal element or a wrapper element." + }, + { + "code": "data-s-modal-target=\"modal\"", + "primaryContext": ".s-modal element", + "description": "Wires up the element that is to be shown/hidden" + }, + { + "code": "data-s-modal-target=\"initialFocus\"", + "primaryContext": "Any child focusable element", + "description": "Designates which element to focus on modal show. If absent, defaults to the first focusable element within the modal." + }, + { + "code": "data-action=\"s-modal#toggle\"", + "primaryContext": "Any child focusable element", + "description": "Wires up the element that is to be shown/hidden" + }, + { + "code": "data-action=\"s-modal#hide\"", + "primaryContext": "Any child focusable element", + "description": "Wires up the element that is to be shown/hidden" + }, + { + "code": "data-s-modal-return-element=\"[css selector]\"", + "primaryContext": "Controller element", + "description": "Designates the element to return focus to when the modal is closed. If left unset, focus is not altered on close." + }, + { + "code": "data-s-modal-remove-when-hidden=\"true\"", + "primaryContext": "Controller element", + "description": "Removes the modal from the DOM entirely when it is hidden" + } + ], + "events": [ + { + "code": "s-modal:show", + "primaryContext": "Modal target", + "description": "Fires immediately before showing the modal. Calling .preventDefault() cancels the display of the modal." + }, + { + "code": "s-modal:shown", + "primaryContext": "Modal target", + "description": "Fires after the modal has been visually shown" + }, + { + "code": "s-modal:hide", + "primaryContext": "Modal target", + "description": "Fires immediately before hiding the modal. Calling .preventDefault() cancels the removal of the modal." + }, + { + "code": "s-modal:hidden", + "primaryContext": "Modal target", + "description": "Fires after the modal has been visually hidden" + } + ], + "eventDetails": [ + { + "code": "dispatcher", + "primaryContext": "Modal target", + "description": "Contains the Element that initiated the event. For instance, the button clicked to show, the element clicked outside the modal that caused it to hide, etc." + }, + { + "code": "returnElement", + "primaryContext": "Modal target", + "description": "Contains the Element to return focus to on hide. If a value is set to this property inside an event listener, it will be updated on the controller as well." + } + ], + "helpers": [ + { + "code": "Stacks.showModal", + "primaryContext": "Controller element", + "description": "Helper to manually show an s-modal element via external JS" + }, + { + "code": "Stacks.hideModal", + "primaryContext": "Controller element", + "description": "Helper to manually hide an s-modal element via external JS" + } + ], + "accessibility": [ + { + "code": "aria-describedby=\"[id]\"", + "primaryContext": "Modal target", + "description": "Supply the modal’s summary copy id. Assistive technologies (such as screen readers) use this to attribute to associate static text with a widget, element groups, headings, definitions, etc. (Source)" + }, + { + "code": "aria-hidden=\"[state]\"", + "primaryContext": "Modal target", + "description": "Informs assistive technologies (such as screen readers) if they should ignore the element. This should not be confused with the HTML5 hidden attribute which tells the browser to not display an element. (Source)" + }, + { + "code": "aria-label=\"[text]\"", + "primaryContext": "Modal target", + "description": "Labels the element for assistive technologies (such as screen readers). (Source)" + }, + { + "code": "aria-labelledby=\"[id]\"", + "primaryContext": "Modal target", + "description": "Supply the modal’s title id here. Assistive technologies (such as screen readers) use this to attribute to catalog the document objects correctly. (Source)" + }, + { + "code": "role=\"dialog\"", + "primaryContext": "Modal target", + "description": "Identifies dialog elements for assistive technologies (Source)" + }, + { + "code": "role=\"document\"", + "primaryContext": "Modal target", + "description": "Helps assistive technologies to switch their reading mode from the larger document to a focused dialog window. (Source)" + } + ], + "sizes": [ + { + "code": ".s-modal__full", + "secondaryContext": "100% - 48px" } ] } diff --git a/packages/stacks-docs/_data/components/navigation.json b/packages/stacks-docs/_data/components/navigation.json index e60d4e5e79..dcec6f281c 100644 --- a/packages/stacks-docs/_data/components/navigation.json +++ b/packages/stacks-docs/_data/components/navigation.json @@ -1,54 +1,53 @@ { "classes": [ { - "class": ".s-navigation", - "applies": "N/A", - "description": "Base parent container for navigation" + "code": ".s-navigation", + "description": "Base parent container for navigation." }, { - "class": ".s-navigation__vertical", - "applies": ".s-navigation", - "description": "Renders the navigation vertically" - }, - { - "class": ".s-navigation__scroll", - "applies": ".s-navigation", - "description": "When the navigation items overflow the width of the component, enable horizontal scrolling. By default, navigation items will wrap. This should not be applied to vertical navigations." + "code": ".s-navigation--item", + "parent": ".s-navigation", + "description": "The individual item in a navigation" }, { - "class": ".s-navigation__sm", - "applies": ".s-navigation", - "description": "Tightens up the overall spacing and reduces the text size" + "code": ".s-navigation--avatar", + "parent": ".s-navigation--item", + "description": "Applies styling to the avatar of the navigation item" }, { - "class": ".s-navigation--item", - "applies": "Child of .s-navigation", - "description": "The individual item in a navigation" + "code": ".s-navigation--icon", + "parent": ".s-navigation--item", + "description": "Applies styling to the icon of the navigation item" }, { - "class": ".s-navigation--item-text", - "applies": "Child of .s-navigation--item", + "code": ".s-navigation--item-text", + "parent": ".s-navigation--item", "description": "The element meant to contain the text of the navigation item" }, { - "class": ".s-navigation--icon", - "applies": "Child of .s-navigation--item", - "description": "Applies styling to the icon of the navigation item" + "code": ".s-navigation__scroll", + "applies": ".s-navigation", + "description": "When the navigation items overflow the width of the component, enable horizontal scrolling. By default, navigation items will wrap. This should not be applied to vertical navigations." }, { - "class": ".s-navigation--avatar", - "applies": "Child of .s-navigation--item", - "description": "Applies styling to the avatar of the navigation item" + "code": ".s-navigation__sm", + "applies": ".s-navigation", + "description": "Tightens up the overall spacing and reduces the text size" }, { - "class": ".is-selected", - "applies": ".s-navigation--item", - "description": "Applies to a navigation item that’s currently selected / active" + "code": ".s-navigation__vertical", + "applies": ".s-navigation", + "description": "Renders the navigation vertically." }, { - "class": ".s-navigation--item__dropdown", - "applies": ".s-navigation--item", + "code": ".s-navigation--item__dropdown", + "applies": ".s-navigation--item", "description": "Adds a small caret that indicates a dropdown" + }, + { + "code": ".is-selected", + "applies": ".s-navigation--item", + "description": "Applies to a navigation item that’s currently selected / active" } ], "navigation-attributes": [ diff --git a/packages/stacks-docs/_data/components/notices.json b/packages/stacks-docs/_data/components/notices.json index 59a24206d8..e100c35b7f 100644 --- a/packages/stacks-docs/_data/components/notices.json +++ b/packages/stacks-docs/_data/components/notices.json @@ -1,136 +1,206 @@ { - "base": [ + "classes": [ { - "type": "default", - "icon": "Help" - }, - { - "type": "info", - "icon": "Info" + "code": ".s-notice", + "primaryContext": ".s-toast when rendered as a toast", + "description": "Base notice parent class." }, { - "type": "success", - "icon": "Check" + "code": ".s-notice--actions", + "parent": ".s-notice", + "description": "Container styling for notice actions including the dismiss button." }, { - "type": "warning", - "icon": "Alert" + "code": ".s-notice--dismiss", + "parent": ".s-notice", + "description": "Applies to child button element within the notice to position it appropriately." }, { - "type": "danger", - "icon": "AlertFill" + "code": ".s-notice__activity", + "applies": ".s-notice", + "description": "Applies activity (pink) visual styles." }, { - "type": "featured", - "icon": "Star" + "code": ".s-notice__danger", + "applies": ".s-notice", + "description": "Applies danger (red) visual styles." }, { - "type": "activity", - "icon": "Notification" - } - ], - "visual": [ - { - "class": ".s-notice", - "applies": "N/A", - "description": "Default style used to separate notices from the main content." + "code": ".s-notice__featured", + "applies": ".s-notice", + "description": "Applies featured (purple) visual styles." }, { - "class": ".s-notice--dismiss", + "code": ".s-notice__important", "applies": ".s-notice", - "description": "Applies to child button element within the banner to position it appropriately." + "description": "Applies an important visual style. This should be used for time-sensitive, pressing information that needs to be noticed by the user." }, { - "class": ".s-notice--actions", + "code": ".s-notice__info", "applies": ".s-notice", - "description": "Container styling for notice actions including the dismiss button." + "description": "Applies info (blue) visual styles." }, { - "class": ".s-notice__info", + "code": ".s-notice__success", "applies": ".s-notice", - "description": "Visual style for information notices." + "description": "Applies success (green) visual styles." }, { - "class": ".s-notice__success", + "code": ".s-notice__warning", "applies": ".s-notice", - "description": "Visual style for success notices." + "description": "Applies warning (yellow) visual styles." }, { - "class": ".s-notice__warning", - "applies": ".s-notice", - "description": "Visual style for warning notices." + "code": ".s-toast", + "description": "Parent of .s-notice. See the Toast section for more information." + } + ], + "base": [ + { + "type": "default", + "icon": "Help" }, { - "class": ".s-notice__danger", - "applies": ".s-notice", - "description": "Visual style for danger notices." + "type": "info", + "icon": "Info" }, { - "class": ".s-notice__featured", - "applies": ".s-notice", - "description": "Visual style for featured notices." + "type": "success", + "icon": "Check" }, { - "class": ".s-notice__activity", - "applies": ".s-notice", - "description": "Visual style for activity notices." + "type": "warning", + "icon": "Alert" }, { - "class": ".s-notice__important", - "applies": ".s-notice", - "description": "Emboldens the above visual styles by strengthening the background saturation. This should be used for time-sensitive, pressing information that needs to be noticed by the user." - } - ], - "behavior": [ + "type": "danger", + "icon": "AlertFill" + }, { - "type": "Inline", - "class": ".s-notice", - "applies": "N/A", - "description": "Notice inserted within the content area." + "type": "featured", + "icon": "Star" }, { - "type": "Toast", - "class": ".s-toast", - "applies": "Container", - "description": "Adds a container to properly fix a floating toast notice to the top-center of the page. These toasts typically disappear after a set time (i.e. 3 seconds)" + "type": "activity", + "icon": "Notification" } ], - "access": [ + "accessibility": [ { - "item": "aria-labelledby=\"[id]\"", + "code": "aria-labelledby=\"[id]\"", "applies": ".s-toast", "description": "Used to reference the alert message within the dialog. If you are using .s-toast, this must be applied.", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-labelledby" }, { - "item": "aria-hidden=\"[state]\"", + "code": "aria-hidden=\"[state]\"", "applies": ".s-toast", "description": "Informs assistive technologies (such as screen readers) if they should ignore the element. When applied to .s-toast, Stacks will use this attribute to show or hide the toast.", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-hidden" }, { - "item": "aria-label=\"[text]\"", + "code": "aria-label=\"[text]\"", "applies": ".s-btn", "description": "Labels the element for assistive technologies (such as screen readers). This should be used on any button that does not contain text content.", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-label" }, { - "item": "role=\"alert\"", + "code": "role=\"alert\"", "applies": ".s-notice", "description": "A form of live region which contains important, usually time-sensitive, information. Elements with an alert role have an implicit aria-live value of assertive and implicit aria-atomic value of true.", "url": "https://www.w3.org/TR/wai-aria-1.1/#alert" }, { - "item": "role=\"alertdialog\"", + "code": "role=\"alertdialog\"", "applies": ".s-toast", "description": "The wrapping content area of an alert. Elements with the alertdialog role must use the aria-describedby attribute to reference the alert message within the dialog.", "url": "https://www.w3.org/TR/wai-aria-1.1/#alertdialog" }, { - "item": "role=\"status\"", + "code": "role=\"status\"", "applies": ".s-notice", "description": "A form of live region which contains advisory information but isn't important enough to justify an alert role. Elements with a status role have an implicit aria-live value of polite and implicit aria-atomic value of true. If the element controlling the status appears in a different area of the page, you must make the relationship explicit with the aria-controls attribute.", "url": "https://www.w3.org/TR/wai-aria-1.1/#status" } - ] + ], + "javascript": { + "attributes": [ + { + "code": "data-controller=\"s-toast\"", + "secondaryContext": "Controller element", + "description": "Wires up the element to the toast controller. This may be a .s-toast element or a wrapper element." + }, + { + "code": "data-s-toast-target=\"toast\"", + "secondaryContext": "Controller element", + "description": "Wires up the element that is to be shown/hidden" + }, + { + "code": "data-s-toast-target=\"initialFocus\"", + "secondaryContext": "Any child focusable element", + "description": "Designates which element to focus on toast show. If absent, defaults to the first focusable element within the toast." + }, + { + "code": "data-action=\"s-toast#toggle\"", + "secondaryContext": "Toggling element", + "description": "Wires up the element to toggle the visibility of a toast" + }, + { + "code": "data-s-toast-return-element=\"[css selector]\"", + "secondaryContext": "Controller element", + "description": "(optional) Designates the element to return focus to when the toast is closed. If left unset, focus is not altered on close." + }, + { + "code": "data-s-toast-remove-when-hidden=\"true\"", + "secondaryContext": "Controller element", + "description": "(optional) Removes the toast from the DOM entirely when it is hidden" + } + ], + "events": [ + { + "code": "s-toast:show", + "secondaryContext": "Toast target", + "description": "Fires immediately before showing the toast. Calling .preventDefault() cancels the display of the toast." + }, + { + "code": "s-toast:shown", + "secondaryContext": "Toast target", + "description": "Fires after the toast has been visually shown" + }, + { + "code": "s-toast:hide", + "secondaryContext": "Toast target", + "description": "Fires immediately before hiding the toast. Calling .preventDefault() cancels the removal of the toast." + }, + { + "code": "s-toast:hidden", + "secondaryContext": "Toast target", + "description": "Fires after the toast has been visually hidden" + } + ], + "eventDetails": [ + { + "code": "dispatcher", + "applies": "s-toast:*", + "description": "Contains the Element that initiated the event. For instance, the button clicked to show, the element clicked outside the toast that caused it to hide, etc." + }, + { + "code": "returnElement", + "applies": "s-toast:show,
s-toast:hide", + "description": "Contains the Element to return focus to on hide. If a value is set to this property inside an event listener, it will be updated on the controller as well." + } + ], + "helpers": [ + { + "code": "Stacks.showToast", + "secondaryContext": "element", + "description": "Helper to manually show an s-toast element via external JS" + }, + { + "code": "Stacks.hideToast", + "secondaryContext": "element", + "description": "Helper to manually hide an s-toast element via external JS" + } + ] + } } diff --git a/packages/stacks-docs/_data/components/page-titles.json b/packages/stacks-docs/_data/components/page-titles.json new file mode 100644 index 0000000000..3455997ee7 --- /dev/null +++ b/packages/stacks-docs/_data/components/page-titles.json @@ -0,0 +1,32 @@ +{ + "classes": [ + { + "code": ".s-page-title", + "description": "Base class for the page title component." + }, + { + "code": ".s-page-title--actions", + "parent": ".s-page-title", + "description": "Contains the page actions." + }, + { + "code": ".s-page-title--text", + "parent": ".s-page-title", + "description": "Contains the page title and description." + }, + { + "code": ".s-page-title--description", + "parent": ".s-page-title--text", + "description": "Contains the page description." + }, + { + "code": ".s-page-title--header", + "parent": ".s-page-title--text", + "description": "Contains the page title." + } + ], + "example": { + "title": "Page title", + "description": "Optional description de Finibus Bonorum et Malorum with an optional link." + } +} \ No newline at end of file diff --git a/packages/stacks-docs/_data/components/pagination-component.json b/packages/stacks-docs/_data/components/pagination-component.json index b9785252ee..163eb554ea 100644 --- a/packages/stacks-docs/_data/components/pagination-component.json +++ b/packages/stacks-docs/_data/components/pagination-component.json @@ -1,29 +1,58 @@ { "classes": [ { - "class": ".s-pagination", - "applies": "N/A", - "description": "Base pagination style that is used universally." + "code": ".s-pagination", + "description": "Base pagination style." }, { - "class": ".s-pagination--item", - "applies": "N/A", - "description": "A child element that’s used as a link and labeled with the page number." + "code": ".s-pagination--item", + "parent": ".s-pagination", + "description": "A child element that's used as a link and labeled with the page number." }, { - "class": ".is-selected", + "code": ".s-pagination--item__clear", "applies": ".s-pagination--item", - "description": "Active state that’s applied to the current page." + "description": "Clears the background and removes any interactivity. Used for ellipses and descriptions." }, { - "class": ".s-pagination--item__nav", + "code": ".s-pagination--item__nav", "applies": ".s-pagination--item", "description": "Styles the Next or Previous button with a circular background and fixed dimensions. Typically used with an icon to indicate navigation to the next page." }, { - "class": ".s-pagination--item__clear", + "code": ".is-selected", "applies": ".s-pagination--item", - "description": "Clears the background and removes any interactivity. Used for ellipses and descriptions." + "description": "Active state that's applied to the current page." + } + ], + "examples": { + "base": { + "nextButton": true, + "previousButton": true, + "items": [ + { + "page": 1, + "classes": "is-selected" + }, + { + "page": 2 + }, + { + "page": 3 + }, + { + "page": 4 + }, + { + "page": 5 + }, + { + "page": "…" + }, + { + "page": 122386 + } + ] } - ] -} \ No newline at end of file + } +} diff --git a/packages/stacks-docs/_data/components/popovers.json b/packages/stacks-docs/_data/components/popovers.json index b14c792a3a..8cd3b0d536 100644 --- a/packages/stacks-docs/_data/components/popovers.json +++ b/packages/stacks-docs/_data/components/popovers.json @@ -1,29 +1,166 @@ { - "automatic": [ + "classes": [ { - "class": ".s-popover", - "applies": "N/A", + "code": ".s-popover", "description": "Base parent container for popovers" }, { - "class": ".s-popover__tooltip", - "applies": ".s-popover", + "code": ".s-popover--close", + "parent": ".s-popover", + "description": "Used to dismiss a popover" + }, + { + "code": ".s-popover--content", + "parent": ".s-popover", + "description": "Wrapper around the popover content to apply appropriate overflow styles" + }, + { + "code": ".s-popover__tooltip", + "applies": ".s-popover", "description": "Removes minimum size constraints to support shorter tooltip text" }, { - "class": ".is-visible", - "applies": ".s-popover", + "code": ".is-visible", + "applies": ".s-popover", "description": "This class toggles the popover visibility" + } + ], + "interactiveAttributes": [ + { + "code": "id=\"{POPOVER_ID}\"", + "applies": ".s-popover", + "description": "A unique id that the popover’s toggling element can target. Matches the value of [aria-controls] on the toggling element." }, { - "class": ".s-popover--close", - "applies": "Child of .s-popover", - "description": "Used to dismiss a popover" + "code": "data-controller=\"s-popover\"", + "secondaryContext": "Controller element", + "description": "Wires up the element to the popover controller. This may be a toggling element or a wrapper element." }, { - "class": ".s-popover--content", - "applies": "Child of .s-popover", - "description": "Wrapper around the popover content to apply appropriate overflow styles" + "code": "data-s-popover-reference-selector=\"[css selector]\"", + "secondaryContext": "Controller element", + "description": "(optional) Designates the element to use as the popover reference. If left unset, the value defaults to the controller element." + }, + { + "code": "aria-controls=\"{POPOVER_ID}\"", + "secondaryContext": "Reference element", + "description": "Associates the element to the desired popover element." + }, + { + "code": "data-action=\"s-popover#toggle\"", + "secondaryContext": "Toggling element", + "description": "Wires up the element to toggle the visibility of a generic popover." + }, + { + "code": "data-s-popover-toggle-class=\"[class list]\"", + "secondaryContext": "Controller element", + "description": "Adds an optional space-delineated list of classes to be toggled on the originating element when the popover is shown or hidden." + }, + { + "code": "data-s-popover-placement=\"[placement]\"", + "secondaryContext": "Controller element", + "description": "Dictates where to place the popover in relation to the reference element. By default, the placement value is bottom. Accepted placements are auto, top, right, bottom, left. Each placement can take an additional -start and -end variation." + }, + { + "code": "data-s-popover-auto-show=\"[true|false]\"", + "secondaryContext": "Controller element", + "description": "(optional) If true, the popover will appear immediately when the Stacks controller is first connected. This should be used in place of .is-visible for displaying popovers on load as it will prevent the popover from appearing before it has been correctly positioned." + }, + { + "code": "data-s-popover-hide-on-outside-click=\"[always|never|if-in-viewport|after-dismissal]\"", + "secondaryContext": "Controller element", + "description": "(optional) Default: always" + } + ], + "interactiveEvents": [ + { + "code": "s-popover:show", + "description": "Fires immediately before showing and positioning the popover. This fires before the popover is first displayed to the user, and can be used to create or initialize the popover element. Calling .preventDefault() cancels the display of the popover." + }, + { + "code": "s-popover:shown", + "description": "Fires immediately after showing the popover." + }, + { + "code": "s-popover:hide", + "description": "Fires immediately before hiding the popover. Calling .preventDefault() prevents the removal of the popover." + }, + { + "code": "s-popover:hidden", + "description": "Fires immediately after hiding the popover." + } + ], + "dispatchedEvents": [ + { + "code": "dispatcher", + "applies": "s-popover:*", + "description": "Contains the Element that initiated the event. For instance, the button clicked to show, the element clicked outside the popover that caused it to hide, etc." + } + ], + "tooltipHoverAttributes": [ + { + "code": "id=\"{POPOVER_ID}\"", + "applies": ".s-popover", + "description": "A unique id that the popover’s toggling element can target. Matches the value of [aria-describedby] on the toggling element." + }, + { + "code": "data-controller=\"s-tooltip\"", + "secondaryContext": "Controller element", + "description": "Wires up the element to the tooltip controller." + }, + { + "code": "data-s-tooltip-reference-selector=\"[css selector]\"", + "secondaryContext": "Controller element", + "description": "(optional) Designates the element to use as the tooltip reference. If left unset, the value defaults to the controller element." + }, + { + "code": "aria-describedby=\"{POPOVER_ID}\"", + "secondaryContext": "Reference element", + "description": "Associates the element to the desired popover element." + }, + { + "code": "title=\"{TITLE}\"", + "secondaryContext": "Controller element", + "description": "If aria-describedby is not present or valid, and the title attribute exists, the title will be removed from the element and be used to create a popover immediately after the element. All content will be escaped and inserted as text." + }, + { + "code": "data-s-tooltip-html-title=\"{TITLE}\"", + "secondaryContext": "Controller element", + "description": "Acts the exact same as the title attribute, but inserts the raw text directly as html. If both this and the title attribute exist on the element, this attribute will be used." + }, + { + "code": "data-s-tooltip-placement=\"[placement]\"", + "secondaryContext": "Controller element", + "description": "Dictates where to place the tooltip in relation to the reference element. By default, the placement value is bottom. Accepted placements are auto, top, right, bottom, left. Each placement can take an additional -start and -end variation." + } + ], + "tooltipHoverEvents": [ + { + "code": "s-tooltip:show", + "secondaryContext": "Controller element", + "description": "Default preventable Fires immediately before showing and positioning the tooltip. This fires before the tooltip is first displayed to the user, and can be used to create or initialize the tooltip element. Calling .preventDefault() cancels the display of the popover." + }, + { + "code": "s-tooltip:shown", + "secondaryContext": "Controller element", + "description": "Fires immediately after showing the tooltip." + }, + { + "code": "s-tooltip:hide", + "secondaryContext": "Controller element", + "description": "Default preventable Fires immediately before hiding the tooltip. Calling .preventDefault() prevents the removal of the tooltip." + }, + { + "code": "s-tooltip:hidden", + "secondaryContext": "Controller element", + "description": "Fires immediately after hiding the tooltip." + } + ], + "tooltipDispatchedEvents": [ + { + "code": "dispatcher", + "applies": "s-tooltip:*", + "description": "Contains the Element that initiated the event. For instance, the element hovered over to show, etc." } ] } \ No newline at end of file diff --git a/packages/stacks-docs/_data/components/post-summary.json b/packages/stacks-docs/_data/components/post-summary.json index eb7d0604f4..85e09dcf66 100644 --- a/packages/stacks-docs/_data/components/post-summary.json +++ b/packages/stacks-docs/_data/components/post-summary.json @@ -1,109 +1,108 @@ { "classes": [ { - "class": ".s-post-summary", - "applies": "N/A", + "code": ".s-post-summary", "description": "Base parent container for a post summary" }, { - "class": ".s-post-summary__answered", - "applies": ".s-post-summary", - "description": "Adds the styling necessary for a question with accepted answers" + "code": ".s-post-summary--answers", + "parent": ".s-post-summary", + "description": "Container for the post summary answers" }, { - "class": ".s-post-summary__deleted", - "applies": ".s-post-summary", - "description": "Adds the styling necessary for a deleted post" + "code": ".s-post-summary--content", + "parent": ".s-post-summary", + "description": "Container for the post summary content" }, { - "class": ".s-post-summary--sm-hide", - "applies": ".s-post-summary", - "description": "Hides the stats container on small screens" + "code": ".s-post-summary--stats", + "parent": ".s-post-summary", + "description": "Container for the post summary stats" }, { - "class": ".s-post-summary--sm-show", - "applies": ".s-post-summary", - "description": "Shows the stats container on small screens" + "code": ".s-post-summary--tags", + "parent": ".s-post-summary", + "description": "Container for the post summary tags" }, { - "class": ".s-post-summary--answers", - "applies": ".s-post-summary", - "description": "Container for the post summary answers" + "code": ".s-post-summary--title", + "parent": ".s-post-summary", + "description": "Container for the post summary title" }, { - "class": ".s-post-summary--answer", - "applies": ".s-post-summary--answers", + "code": ".s-post-summary--answer", + "parent": ".s-post-summary--answers", "description": "Container for the post summary answer" }, { - "class": ".s-post-summary--answer__accepted", - "applies": ".s-post-summary--answer", - "description": "Adds the styling necessary for an accepted answer" - }, - { - "class": ".s-post-summary--content", - "applies": ".s-post-summary", - "description": "Container for the post summary content" - }, - { - "class": ".s-post-summary--content-meta", - "applies": ".s-post-summary--content", + "code": ".s-post-summary--content-meta", + "parent": ".s-post-summary--content", "description": "A container for post meta data, things like tags and user cards." }, { - "class": ".s-post-summary--content-type", - "applies": ".s-post-summary--content", + "code": ".s-post-summary--content-type", + "parent": ".s-post-summary--content", "description": "Container for the post summary content type" }, { - "class": ".s-post-summary--excerpt", - "applies": ".s-post-summary--content", + "code": ".s-post-summary--excerpt", + "parent": ".s-post-summary--content", "description": "Container for the post summary excerpt" }, { - "class": ".s-post-summary--stats", - "applies": ".s-post-summary", - "description": "Container for the post summary stats" - }, - { - "class": ".s-post-summary--stats-answers", - "applies": ".s-post-summary--stats", + "code": ".s-post-summary--stats-answers", + "parent": ".s-post-summary--stats", "description": "Container for the post summary answers" }, { - "class": ".s-post-summary--stats-bounty", - "applies": ".s-post-summary--stats", + "code": ".s-post-summary--stats-bounty", + "parent": ".s-post-summary--stats", "description": "Container for the post summary bounty" }, { - "class": ".s-post-summary--stats-item", - "applies": ".s-post-summary--stats", + "code": ".s-post-summary--stats-item", + "parent": ".s-post-summary--stats", "description": "A genericcontainer for views, comments, read time, and other meta data which prepends a separator icon." }, { - "class": ".s-post-summary--stats-votes", - "applies": ".s-post-summary--stats", + "code": ".s-post-summary--stats-votes", + "parent": ".s-post-summary--stats", "description": "Container for the post summary votes" }, { - "class": ".s-post-summary--tags", - "applies": ".s-post-summary", - "description": "Container for the post summary tags" + "code": ".s-post-summary--title-link", + "parent": ".s-post-summary--title", + "description": "Link styling for the post summary title" + }, + { + "code": ".s-post-summary--title-icon", + "parent": ".s-post-summary--title", + "description": "Icon styling for the post summary title" + }, + { + "code": ".s-post-summary--sm-hide", + "applies": ".s-post-summary > *", + "description": "Hides the stats container on small screens." }, { - "class": ".s-post-summary--title", + "code": ".s-post-summary--sm-show", + "applies": ".s-post-summary > *", + "description": "Shows the stats container on small screens." + }, + { + "code": ".s-post-summary__answered", "applies": ".s-post-summary", - "description": "Container for the post summary title" + "description": "Adds the styling necessary for a question with accepted answers" }, { - "class": ".s-post-summary--title-link", - "applies": ".s-post-summary--title", - "description": "Link styling for the post summary title" + "code": ".s-post-summary__deleted", + "applies": ".s-post-summary", + "description": "Adds the styling necessary for a deleted post" }, { - "class": ".s-post-summary--title-icon", - "applies": ".s-post-summary--title", - "description": "Icon styling for the post summary title" + "code": ".s-post-summary--answer__accepted", + "applies": ".s-post-summary--answer", + "description": "Adds the styling necessary for an accepted answer" } ], "answered": { diff --git a/packages/stacks-docs/_data/components/progress-bars.json b/packages/stacks-docs/_data/components/progress-bars.json new file mode 100644 index 0000000000..e3fadca7d5 --- /dev/null +++ b/packages/stacks-docs/_data/components/progress-bars.json @@ -0,0 +1,120 @@ +{ + "classes": [ + { + "code": ".s-progress", + "description": "The parent class for all progress bars." + }, + { + "code": ".s-progress--bar", + "parent": ".s-progress", + "description": "Shows the user’s current progress to accomplishing a goal with a background color." + }, + { + "code": ".s-progress--label", + "parent": ".s-progress", + "description": "Used to describe what progress bar is tracking." + }, + { + "code": ".s-progress--bar__left", + "parent": ".s-progress--step", + "description": "Draws a line on the left side of a step." + }, + { + "code": ".s-progress--bar__right", + "parent": ".s-progress--step", + "description": "Draws a line on the right side of a step." + }, + { + "code": ".s-progress--step", + "parent": ".s-progress--stepped", + "description": "Wrapper for each individual step." + }, + { + "code": ".s-progress__badge", + "applies": ".s-progress", + "description": "Styles the progress bar as a badge." + }, + { + "code": ".s-progress__brand", + "applies": ".s-progress", + "description": "Applies the brand color to the progress bar." + }, + { + "code": ".s-progress__circular", + "applies": ".s-progress", + "description": "Styles the progress bar as a circular progress bar." + }, + { + "code": ".s-progress__info", + "applies": ".s-progress", + "description": "Applies the info color to the progress bar." + }, + { + "code": ".s-progress__privilege", + "applies": ".s-progress", + "description": "Used to display a privilege progress bar." + }, + { + "code": ".s-progress__segmented", + "applies": ".s-progress", + "description": "Styles the progress bar as a segmented progress bar." + }, + { + "code": ".s-progress__stepped", + "applies": ".s-progress", + "description": "Styles the progress bar as a stepped progress bar." + }, + { + "code": ".s-progress__gold", + "applies": ".s-progress__badge", + "description": "Styles the progress bar as a gold badge." + }, + { + "code": ".s-progress__silver", + "applies": ".s-progress__badge", + "description": "Styles the progress bar as a silver badge." + }, + { + "code": ".s-progress__bronze", + "applies": ".s-progress__badge", + "description": "Styles the progress bar as a bronze badge." + }, + { + "code": ".is-active", + "applies": ".s-progress--step", + "description": "Styles the active step." + }, + { + "code": ".is-completed", + "applies": ".s-progress--step", + "description": "Styles the completed step." + } + ], + "parameters": [ + { + "code": "role=\"progressbar\"", + "applies": ".s-progress--bar", + "description": "This parameter communicates that element is displaying progress status that takes a long time or consists of several steps. (Source)" + }, + { + "code": "aria-valuemin", + "applies": ".s-progress--bar", + "description": "This parameter defines the minimum allowed value for the progress bar. (Source)" + }, + { + "code": "aria-valuemax", + "applies": ".s-progress--bar", + "description": "This parameter defines the maximum allowed value for the progress bar. (Source)" + }, + { + "code": "aria-valuenow", + "applies": ".s-progress--bar", + "description": "This parameter defines the current value for the progress bar. (Source)" + }, + { + "code": "style=\"width: [value]%\"", + "applies": ".s-progress--bar", + "description": "This parameter sets the width of the progress bar as a percentage. The value is the aria-valuenow value displayed as a percentage." + } + ] +} \ No newline at end of file diff --git a/packages/stacks-docs/_data/components/prose.json b/packages/stacks-docs/_data/components/prose.json index faaaea6041..b88ac2c96b 100644 --- a/packages/stacks-docs/_data/components/prose.json +++ b/packages/stacks-docs/_data/components/prose.json @@ -1,12 +1,11 @@ { "classes": [ { - "class": ".s-prose", - "applies": "N/A", + "code": ".s-prose", "description": "Adds proper styling for rendered Markdown." }, { - "class": ".s-prose__sm", + "code": ".s-prose__sm", "applies": ".s-prose", "description": "Decreases the base font size and line height." } diff --git a/packages/stacks-docs/_data/components/select.json b/packages/stacks-docs/_data/components/select.json new file mode 100644 index 0000000000..67534c4556 --- /dev/null +++ b/packages/stacks-docs/_data/components/select.json @@ -0,0 +1,52 @@ +{ + "classes": [ + { + "code": ".s-select", + "description": "Base select style." + }, + { + "code": ".s-select__sm", + "applies": ".s-select", + "description": "Apply a small size." + }, + { + "code": ".s-select__lg", + "applies": ".s-select", + "description": "Apply a large size." + }, + { + "code": ".has-error", + "applies": ".s-select", + "description": "Apply an error state." + }, + { + "code": ".has-success", + "applies": ".s-select", + "description": "Apply a success state." + }, + { + "code": ".has-warning", + "applies": ".s-select", + "description": "Apply a warning state." + } + ], + "sizes": [ + { + "primaryContext": "Small", + "secondaryContext": "13px", + "code": ".s-select__sm", + "description": "
" + }, + { + "primaryContext": "Default", + "secondaryContext": "14px", + "description": "
" + }, + { + "primaryContext": "Large", + "secondaryContext": "18px", + "code": ".s-select__lg", + "description": "
" + } + ] +} diff --git a/packages/stacks-docs/_data/components/sidebar-widgets.json b/packages/stacks-docs/_data/components/sidebar-widgets.json new file mode 100644 index 0000000000..6705a368aa --- /dev/null +++ b/packages/stacks-docs/_data/components/sidebar-widgets.json @@ -0,0 +1,23 @@ +{ + "classes": [ + { + "code": ".s-sidebarwidget", + "description": "Base sidebar widget style." + }, + { + "code": ".s-sidebarwidget--content", + "parent": ".s-sidebarwidget", + "description": "Container for the sidebar widget content." + }, + { + "code": ".s-sidebarwidget--header", + "parent": ".s-sidebarwidget", + "description": "Container for the sidebar widget header." + }, + { + "code": ".s-sidebarwidget--footer", + "parent": ".s-sidebarwidget", + "description": "Container for the sidebar widget footer." + } + ] +} diff --git a/packages/stacks-docs/_data/components/tables.json b/packages/stacks-docs/_data/components/tables.json index 3b68ebb323..21e5080e66 100644 --- a/packages/stacks-docs/_data/components/tables.json +++ b/packages/stacks-docs/_data/components/tables.json @@ -1,94 +1,145 @@ { + "classes": [ + { + "code": ".s-table-container", + "description": "Container for the table." + }, + { + "code": ".s-table", + "parent": ".s-table-container", + "description": "Base table style." + }, + { + "code": ".s-table--cell:n", + "parent": ".s-table > tr > td", + "description": "Table cell width in 12 evenly divided columns. Replace :n with the number of columns the cell should span." + }, + { + "code": ".s-table__b0", + "applies": ".s-table", + "description": "Removes all table cell borders." + }, + { + "code": ".s-table__bx", + "applies": ".s-table", + "description": "Shows only horizontal table cell borders. Good for tables with lots of data that can be sorted and filtered." + }, + { + "code": ".s-table__bx-simple", + "applies": ".s-table", + "description": "Removes most of the default borders and backgrounds. Good for tables without much data that don't need to be sorted or filtered." + }, + { + "code": ".s-table__sortable", + "applies": ".s-table", + "description": "Applies styling to imply the table is sortable." + }, + { + "code": ".s-table__stripes", + "applies": ".s-table", + "description": "Apply zebra striping to the table." + }, + { + "code": ".s-table__sm", + "applies": ".s-table", + "description": "Apply a condensed sizing to the table." + }, + { + "code": ".s-table__lg", + "applies": ".s-table", + "description": "Apply a large sizing to the table." + } + ], "widths": [ { - "class": ".s-table--cell1", - "output": "8.3333333%" + "code": ".s-table--cell1", + "primaryContext": "8.3333333%" }, { - "class": ".s-table--cell2", - "output": "16.6666667%" + "code": ".s-table--cell2", + "primaryContext": "16.6666667%" }, { - "class": ".s-table--cell3", - "output": "25%" + "code": ".s-table--cell3", + "primaryContext": "25%" }, { - "class": ".s-table--cell4", - "output": "33.3333333%" + "code": ".s-table--cell4", + "primaryContext": "33.3333333%" }, { - "class": ".s-table--cell5", - "output": "41.6666667%" + "code": ".s-table--cell5", + "primaryContext": "41.6666667%" }, { - "class": ".s-table--cell6", - "output": "50%" + "code": ".s-table--cell6", + "primaryContext": "50%" }, { - "class": ".s-table--cell7", - "output": "58.3333333%" + "code": ".s-table--cell7", + "primaryContext": "58.3333333%" }, { - "class": ".s-table--cell8", - "output": "66.6666667%" + "code": ".s-table--cell8", + "primaryContext": "66.6666667%" }, { - "class": ".s-table--cell9", - "output": "75%" + "code": ".s-table--cell9", + "primaryContext": "75%" }, { - "class": ".s-table--cell10", - "output": "83.3333333%" + "code": ".s-table--cell10", + "primaryContext": "83.3333333%" }, { - "class": ".s-table--cell11", - "output": "91.6666667%" + "code": ".s-table--cell11", + "primaryContext": "91.6666667%" }, { - "class": ".s-table--cell12", - "output": "100%" + "code": ".s-table--cell12", + "primaryContext": "100%" } ], "data-attributes": [ { - "attribute": "data-controller=\"s-table\"", + "code": "data-controller=\"s-table\"", "applies": "table", "description": "Wires up the table to the JS controller" }, { - "attribute": "data-s-table-target=\"column\"", + "code": "data-s-table-target=\"column\"", "applies": "th", "description": "Marks this is a sortable column for the purpose of modifying arrow icons" }, { - "attribute": "data-action=\"click->s-table#sort\"", + "code": "data-action=\"click->s-table#sort\"", "applies": "button", "description": "Causes a click on the header cell to sort by this column" }, { - "attribute": "data-s-table-sort-to=\"top\"", + "code": "data-s-table-sort-to=\"top\"", "applies": "tr", "description": "Forces the sorting of a row to the top" }, { - "attribute": "data-s-table-sort-to=\"bottom\"", + "code": "data-s-table-sort-to=\"bottom\"", "applies": "tr", "description": "Forces the sorting of a row to the bottom" }, { - "attribute": "data-s-table-sort-val=\"[x]\"", + "code": "data-s-table-sort-val=\"[x]\"", "applies": "td", "description": "Optionally use a custom value for sorting instead of the cell’s text content" } ], "atomic": [ { - "class": ".tl-auto", - "output": "table-layout: auto;" + "code": ".tl-auto", + "primaryContext": "table-layout: auto;" }, { - "class": ".tl-fixed", - "output": "table-layout: fixed;" + "code": ".tl-fixed", + "primaryContext": "table-layout: fixed;" } ] } diff --git a/packages/stacks-docs/_data/components/tag.json b/packages/stacks-docs/_data/components/tag.json new file mode 100644 index 0000000000..dfa2aa131f --- /dev/null +++ b/packages/stacks-docs/_data/components/tag.json @@ -0,0 +1 @@ +{"classes":[{"class":".s-tag","description":"Base tag style that is used almost universally."},{"class":".s-tag__moderator","applies":".s-tag","description":"Exclusively used within Meta communities by moderators (and employees) to assign unique statuses to questions."},{"class":".s-tag__required","applies":".s-tag","description":"Exclusively used within Meta communities to denote the post type. One of these tags are required on all Meta posts."},{"class":".s-tag__ignored","applies":".s-tag","description":"Prepends an icon to indicate the tag is ignored."},{"class":".s-tag__watched","applies":".s-tag","description":"Prepends an icon to indicate the tag is watched."},{"class":".s-tag--dismiss","description":"A child element within .s-tag for a clear or dismiss action icon. When using this element, it should be rendered as a button containing the icon and the parent .s-tag should be rendered as a span element."},{"class":".s-tag--sponsor","description":"A child element within .s-tag that correctly positions a tag's sponsor logo."}],"sizes":[{"class":"s-tag__sm"},{"class":"N/A"},{"class":"s-tag__lg"}]} diff --git a/packages/stacks-docs/_data/components/tags-component.json b/packages/stacks-docs/_data/components/tags-component.json index edd7083660..9b25e2d433 100644 --- a/packages/stacks-docs/_data/components/tags-component.json +++ b/packages/stacks-docs/_data/components/tags-component.json @@ -1,50 +1,64 @@ { "classes": [ { - "class": ".s-tag", - "applies": "N/A", + "code": ".s-tag", "description": "Base tag style that is used almost universally." }, { - "class": ".s-tag__moderator", + "code": ".s-tag--dismiss", + "parent": ".s-tag", + "description": "For a clear or dismiss action icon. When using this element, it should be rendered as a button containing the icon and the parent .s-tag should be rendered as a span element." + }, + { + "code": ".s-tag--sponsor", + "parent": ".s-tag", + "description": "Correctly positions a tag’s sponsor logo." + }, + { + "code": ".s-tag__moderator", "applies": ".s-tag", "description": "Exclusively used within Meta communities by moderators (and employees) to assign unique statuses to questions." }, { - "class": ".s-tag__required", + "code": ".s-tag__required", "applies": ".s-tag", "description": "Exclusively used within Meta communities to denote the post type. One of these tags are required on all Meta posts." }, { - "class": ".s-tag__ignored", + "code": ".s-tag__ignored", "applies": ".s-tag", "description": "Prepends an icon to indicate the tag is ignored." }, { - "class": ".s-tag__watched", + "code": ".s-tag__watched", "applies": ".s-tag", "description": "Prepends an icon to indicate the tag is watched." }, { - "class": ".s-tag--dismiss", - "applies": "N/A", - "description": "A child element within .s-tag for a clear or dismiss action icon. When using this element, it should be rendered as a button containing the icon and the parent .s-tag should be rendered as a span element." + "code": ".s-tag__sm", + "applies": ".s-tag", + "description": "Apply a small size to the tag." }, { - "class": ".s-tag--sponsor", - "applies": "N/A", - "description": "A child element within .s-tag that correctly positions a tag’s sponsor logo." + "code": ".s-tag__lg", + "applies": ".s-tag", + "description": "Apply a large size to the tag." } ], "sizes": [ { - "class": "s-tag__sm" + "code": ".s-tag__sm", + "applies": ".s-tag", + "description": "css" }, { - "class": "N/A" + "applies": ".s-tag", + "description": "css" }, { - "class": "s-tag__lg" + "code": ".s-tag__lg", + "applies": ".s-tag", + "description": "css" } ] } diff --git a/packages/stacks-docs/_data/components/textareas.json b/packages/stacks-docs/_data/components/textareas.json new file mode 100644 index 0000000000..eb81c83693 --- /dev/null +++ b/packages/stacks-docs/_data/components/textareas.json @@ -0,0 +1,44 @@ +{ + "classes": [ + { + "code": ".s-textarea", + "description": "Base textarea style." + }, + { + "code": ".s-textarea__sm", + "applies": ".s-textarea", + "description": "Apply a small size." + }, + { + "code": ".s-textarea__lg", + "applies": ".s-textarea", + "description": "Apply a large size." + } + ], + "sizes": [ + { + "primaryContext": "Small", + "secondaryContext": "13px", + "code": ".s-textarea__sm", + "description": "" + }, + { + "primaryContext": "Default", + "secondaryContext": "14px", + "description": "" + }, + { + "primaryContext": "Large", + "secondaryContext": "18px", + "code": ".s-textarea__lg", + "description": "" + } + ], + "required": [ + { + "code": ".s-required-symbol", + "secondaryContext": "abbr element enclosing the asterisk", + "description": "Used to style the asterisk indicating that a specific field is required." + } + ] +} \ No newline at end of file diff --git a/packages/stacks-docs/_data/components/toggle-switch.json b/packages/stacks-docs/_data/components/toggle-switch.json new file mode 100644 index 0000000000..5ce97f8c64 --- /dev/null +++ b/packages/stacks-docs/_data/components/toggle-switch.json @@ -0,0 +1,13 @@ +{ + "classes": [ + { + "code": ".s-toggle-switch", + "description": "Base toggle switch style." + }, + { + "code": ".s-toggle-switch__multiple", + "applies": ".s-toggle-switch", + "description": "Used to style toggle switches with three or more options." + } + ] +} \ No newline at end of file diff --git a/packages/stacks-docs/_data/components/topbar.json b/packages/stacks-docs/_data/components/topbar.json index 1a7adbb775..291872153d 100644 --- a/packages/stacks-docs/_data/components/topbar.json +++ b/packages/stacks-docs/_data/components/topbar.json @@ -1,76 +1,78 @@ -[ - { - "class": ".s-topbar", - "description": "Base class" - }, - { - "class": ".s-topbar__light", - "applies": "`.s-topbar`", - "description": "Forced light theme" - }, - { - "class": ".s-topbar__dark", - "applies": "`.s-topbar`", - "description": "Forced dark theme" - }, - { - "class": ".s-topbar--skip-link", - "description": "Applied to an anchor tag for bypassing the top-level navigation links and jump to the main content on a page. [See WCAG Technique G1](https://www.w3.org/WAI/WCAG22/Techniques/general/G1)", - "applies": "Child of `.s-topbar`" - }, - { - "class": ".s-topbar--container", - "description": "Add **atomic** `classes` here to customize internal content width; defaults to `.wmx12`", - "applies": "Child of `.s-topbar`" - }, - { - "class": ".s-topbar--logo", - "description": "The logo. Can apply `.is-selected` to this", - "applies": "Child of `.s-topbar`" - }, - { - "class": ".s-topbar--menu-btn", - "description": "Hamburger menu icon. Add `.is-selected` to turn it into an X", - "applies": "Child of `.s-topbar`" - }, - { - "class": ".s-topbar--content", - "description": "Contains `li > .s-topbar--item` elements that don’t look like anything in particular", - "applies": "Child of `.s-topbar`" - }, - { - "class": ".s-topbar--item", - "description": "A topbar item element with hover, active and focused styling. Can add `.is-selected`", - "applies": "Child of `.s-topbar--content > li`" - }, - { - "class": ".s-topbar--item__unset", - "description": "This class excludes the `.s-topbar--item` from any automatic styling. This is useful for calls to action, e.g. buttons or log in links", - "applies": "`.s-topbar--item`" - }, - { - "class": ".s-topbar--navigation", - "description": "Apply to `nav` to ensure proper layout", - "applies": "Parent of `.s-topbar--container`" - }, - { - "class": ".s-topbar--notice", - "description": "A badge-styled notice that stands out. Add `.is-unread` to make it stand out more", - "applies": "Child of `.s-topbar`" - }, - { - "class": ".s-topbar--searchbar", - "description": "Contains a search input and an optional `.s-select`. Hides itself on mobile.", - "applies": "Child of `.s-topbar`" - }, - { - "class": ".s-topbar--searchbar--input-group", - "description": "Holds the search input + icon", - "applies": "Child of `.s-topbar--searchbar`" - }, - { - "class": ".s-topbar--searchbar__open", - "applies": "`.s-topbar--searchbar`", - "description": "On mobile, this class shows the search input below the topbar. Toggle this class with a button" - } -] +{ + "classes": [ + { + "code": ".s-topbar", + "description": "Base class" + }, + { + "code": ".s-topbar--container", + "parent": ".s-topbar", + "description": "Add atomic classes here to customize internal content width; defaults to `.wmx12`" + }, + { + "code": ".s-topbar--skip-link", + "parent": ".s-topbar", + "description": "Applied to an anchor tag for bypassing the top-level navigation links and jump to the main content on a page. See WCAG Technique G1" + }, + { + "code": ".s-topbar--logo", + "parent": ".s-topbar--container", + "description": "The logo. Can apply .is-selected to this" + }, + { + "code": ".s-topbar--menu-btn", + "parent": ".s-topbar--container", + "description": "Hamburger menu icon. Add .is-selected to turn it into an X" + }, + { + "code": ".s-topbar--navigation", + "parent": ".s-topbar--container", + "description": "Apply to nav to ensure proper layout." + }, + { + "code": ".s-topbar--notice", + "parent": ".s-topbar--container", + "description": "A badge-styled notice that stands out. Add .is-unread to make it stand out more." + }, + { + "code": ".s-topbar--searchbar", + "parent": ".s-topbar--container", + "description": "Contains a search input and an optional `.s-select`. Hides itself on mobile." + }, + { + "code": ".s-topbar--content", + "parent": ".s-topbar--navigation", + "description": "Contains li > .s-topbar--item elements that don’t look like anything in particular" + }, + { + "code": ".s-topbar--item", + "parent": ".s-topbar--content > li", + "description": "A topbar item element with hover, active and focused styling. Can add `.is-selected`" + }, + { + "code": ".s-topbar--searchbar--input-group", + "parent": ".s-topbar--searchbar", + "description": "Holds the search input + icon." + }, + { + "code": ".s-topbar--item__unset", + "applies": ".s-topbar--item", + "description": "This class excludes the .s-topbar--item from any automatic styling. This is useful for calls to action, e.g. buttons or log in links." + }, + { + "code": ".s-topbar--searchbar__open", + "applies": ".s-topbar--searchbar", + "description": "On mobile, this class shows the search input below the topbar. Toggle this class with a button." + }, + { + "code": ".s-topbar__light", + "applies": ".s-topbar", + "description": "Applies a forced light theme" + }, + { + "code": ".s-topbar__dark", + "applies": ".s-topbar", + "description": "Applies a forced dark theme" + } + ] +} diff --git a/packages/stacks-docs/_data/components/uploader-component.json b/packages/stacks-docs/_data/components/uploader-component.json deleted file mode 100644 index 59744aebc4..0000000000 --- a/packages/stacks-docs/_data/components/uploader-component.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "classes": [ - { - "class": ".s-uploader", - "applies": "N/A", - "description": "Base uploader element" - }, - { - "class": ".is-active", - "applies": ".s-uploader", - "description": "Active styling for uploader element. Added on dragenter or when input has value." - }, - { - "class": ".is-disabled", - "applies": ".s-uploader", - "description": "Appropriately styles the uploader when it is disabled. Don’t forget to also add the disabled attribute on the input itself." - }, - { - "class": ".has-error", - "applies": ".s-uploader", - "description": "Adds error styling to the component." - }, - { - "class": ".has-success", - "applies": ".s-uploader", - "description": "Adds success styling to the component." - }, - { - "class": ".has-warning", - "applies": ".s-uploader", - "description": "Adds warning styling to the component." - }, - { - "class": ".s-uploader--container", - "applies": "Child of .s-uploader", - "description": "Container for the visual elements of the uploader." - }, - { - "class": ".s-uploader--input", - "applies": "Child of .s-uploader", - "description": "Adds proper styling to the uploader's file input. Visually hidden." - }, - { - "class": ".s-uploader--previews", - "applies": "Child of .s-uploader--container", - "description": "Container for selected item(s) preview." - }, - { - "class": ".s-uploader--preview", - "applies": "Child of .s-uploader--previews", - "description": "An image or string to preview a selected file." - }, - { - "class": ".s-uploader--reset", - "applies": "Child of .s-uploader--container", - "description": "Used to reset the uploader." - } - ] -} diff --git a/packages/stacks-docs/_data/components/uploader.json b/packages/stacks-docs/_data/components/uploader.json new file mode 100644 index 0000000000..17965b9b8f --- /dev/null +++ b/packages/stacks-docs/_data/components/uploader.json @@ -0,0 +1,105 @@ +{ + "classes": [ + { + "code": ".s-uploader", + "description": "Base uploader element" + }, + { + "code": ".s-uploader--container", + "parent": ".s-uploader", + "description": "Container for the visual elements of the uploader." + }, + { + "code": ".s-uploader--input", + "parent": ".s-uploader--container", + "description": "Adds proper styling to the uploader's file input. Visually hidden." + }, + { + "code": ".s-uploader--previews", + "parent": ".s-uploader--container", + "description": "Container for selected item(s) preview." + }, + { + "code": ".s-uploader--reset", + "parent": ".s-uploader--container", + "description": "Used to reset the uploader." + }, + { + "code": ".s-uploader--preview", + "parent": ".s-uploader--previews", + "description": "An image or string to preview a selected file." + }, + { + "code": ".is-active", + "applies": ".s-uploader", + "description": "Active styling for uploader element. Added on dragenter or when input has value." + }, + { + "code": ".is-disabled", + "applies": ".s-uploader", + "description": "Appropriately styles the uploader when it is disabled. Don’t forget to also add the disabled attribute on the input itself." + }, + { + "code": ".has-error", + "applies": ".s-uploader", + "description": "Adds error styling to the component." + }, + { + "code": ".has-success", + "applies": ".s-uploader", + "description": "Adds success styling to the component." + }, + { + "code": ".has-warning", + "applies": ".s-uploader", + "description": "Adds warning styling to the component." + } + ], + "attributes": [ + { + "code": "data-controller=\"s-uploader\"", + "secondaryContext": "Controller element", + "description": "Wires up the element to the uploader controller. This may be a .s-uploader element or a wrapper element." + }, + { + "code": "data-target=\"s-uploader.uploader\"", + "applies": ".s-uploader", + "description": "Wires up the element containing input, previews, and reset targets." + }, + { + "code": "data-s-uploader-target=\"input\"", + "applies": ".s-uploader--input", + "description": "Designates the file input element." + }, + { + "code": "data-target=\"s-uploader.previews\"", + "applies": ".s-uploader--previews", + "description": "Designates the element to act as a container to file preview(s)." + }, + { + "code": "data-action=\"input->s-uploader#handleInput\"", + "applies": "input[type=file]", + "description": "Wires up the element to provide files for preview on change." + }, + { + "code": "data-action=\"click->s-uploader#reset\"", + "secondaryContext": "Any child element", + "description": "Wires up the element to reset the uploader to its initial state." + }, + { + "code": "data-s-uploader-show-on-input", + "secondaryContext": "Any child element", + "description": "Toggles element visibility. Shows when input has value." + }, + { + "code": "data-s-uploader-hide-on-input", + "secondaryContext": "Any child element", + "description": "Toggles element visibility. Hides when input has value." + }, + { + "code": "data-s-uploader-enable-on-input", + "secondaryContext": "Any child element", + "description": "Toggles element disabled state. Disables when input has no value." + } + ] +} diff --git a/packages/stacks-docs/_data/components/user-card.json b/packages/stacks-docs/_data/components/user-cards.json similarity index 85% rename from packages/stacks-docs/_data/components/user-card.json rename to packages/stacks-docs/_data/components/user-cards.json index f9480e792d..2838391492 100644 --- a/packages/stacks-docs/_data/components/user-card.json +++ b/packages/stacks-docs/_data/components/user-cards.json @@ -1,54 +1,58 @@ { "classes": [ { - "class": ".s-user-card", - "applies": "N/A", + "code": ".s-user-card", "description": "Base user card container that applies the basic style." }, { - "class": ".s-user-card--group", - "applies": "N/A", - "description": "A container for group elements." - }, - { - "class": ".s-user-card--group__split", - "applies": "Modifier for
.s-user-card--group", - "description": "Inserts a separator between each element." - }, - { - "class": ".s-user-card--column", - "applies": "N/A", + "code": ".s-user-card--column", + "applies": ".s-user-card > *", "description": "A container for column elements." }, { - "class": ".s-user-card--row", - "applies": "N/A", + "code": ".s-user-card--row", + "applies": ".s-user-card > *", "description": "A container for row elements." }, { - "class": ".s-user-card--bio", - "applies": "N/A", + "code": ".s-user-card--group", + "applies": ".s-user-card > *", + "description": "A container for group elements." + }, + { + "code": ".s-user-card--bio", "description": "Container for the user's bio." }, { - "class": ".s-user-card--recognition", - "applies": "N/A", + "code": ".s-user-card--recognition", "description": "Container for recognition by a collective." }, { - "class": ".s-user-card--rep", - "applies": "N/A", + "code": ".s-user-card--rep", "description": "Container for the user's reputation." }, { - "class": ".s-user-card--time", - "applies": "N/A", + "code": ".s-user-card--time", "description": "Container for the user's timestamp." }, { - "class": ".s-user-card--username", - "applies": "N/A", + "code": ".s-user-card--username", "description": "Container for the user's username." + }, + { + "code": ".s-user-card__sm", + "applies": ".s-user-card", + "description": "Use the small variant for space-constrained areas, such as post summaries, or to establish visual hierarchy for secondary content like comments and replies." + }, + { + "code": ".s-user-card__lg", + "applies": ".s-user-card", + "description": "Use the large variant when space permits and more detailed information is desired." + }, + { + "code": ".s-user-card--group__split", + "applies": ".s-user-card--group", + "description": "Inserts a separator between each element." } ], "base": [ @@ -179,7 +183,7 @@ "bronze": 4, "badges": [ { - "class": "s-badge__moderator", + "code": "s-badge__moderator", "text": "Mod" } ], @@ -204,18 +208,17 @@ ], "sizes": [ { - "size": "small", - "class": ".s-user-card__sm", + "code": ".s-user-card__sm", + "secondaryContext": "small", "description": "Use the small variant for space-constrained areas, such as post summaries, or to establish visual hierarchy for secondary content like comments and replies." }, { - "size": "default", - "class": "N/A", + "item": "N/A", "description": "Use the default variant when the user needs a more primary focus of the content. This style features a larger avatar to establish top-level hierarchy like question and answer authors." }, { - "size": "large", - "class": ".s-user-card__lg", + "code": ".s-user-card__lg", + "secondaryContext": "large", "description": "Use the large variant when space permits and more detailed information is desired" } ], @@ -313,18 +316,17 @@ ], "states": [ { - "name": "Original Poster", - "class": "s-user-card--username__op", + "primaryContext": "Original Poster", + "code": ".s-user-card--username__op", "description": "This label identifies the author of the primary post (such as the Question asker) when they appear in secondary contexts, like comment threads." }, { - "name": "New Contributor", - "class": "N/A", + "primaryContext": "New Contributor", "description": "This label appears on a user's first-ever question or answer to signal that they are new to the platform." }, { - "name": "Deleted user", - "class": "s-user-card__deleted", + "primaryContext": "Deleted user", + "code": ".s-user-card__deleted", "description": "When a user is deleted, we still need to show their name, but we strip the meta data." } ], @@ -414,13 +416,12 @@ ], "additional-bling": [ { - "name": "Recognized Member", - "class": "s-user-card--recognition-additional-bling", + "code": ".s-user-card--recognition-additional-bling", + "primaryContext": "Recognized Member", "description": "This label appears on within a Collective question post to signal that they are a Recognized Member." }, { - "name": "Awarded", - "class": "N/A", + "primaryContext": "Awarded", "description": "This icon appears next to a user when they are within the top 3 positions of a Collective’s leaderboard." } ] diff --git a/packages/stacks-docs/_data/components/vote.json b/packages/stacks-docs/_data/components/vote.json index b69212a0a2..fb4359995f 100644 --- a/packages/stacks-docs/_data/components/vote.json +++ b/packages/stacks-docs/_data/components/vote.json @@ -1,44 +1,43 @@ { "classes": [ { - "class": ".s-vote", - "applies": "N/A", + "code": ".s-vote", "description": "Base vote component." }, { - "class": ".s-vote__expanded", - "applies": ".s-vote", - "description": "Expanded vote style that shows upvote and downvote counts separately." + "code": ".s-vote--btn", + "parent": ".s-vote", + "description": "Vote button." }, { - "class": ".s-vote__horizontal", - "applies": ".s-vote", - "description": "Horizontal vote style that arranges buttons and counts in a row. This layout does not officially support downvoting or expanded vote count." + "code": ".s-vote--votes", + "parent": ".s-vote", + "description": "Container for vote counts." }, { - "class": ".s-vote--btn", - "applies": ".s-vote", - "description": "Vote button." + "code": ".s-vote--downvotes", + "parent": ".s-vote--votes", + "description": "Downvote count." }, { - "class": ".s-vote--votes", - "applies": ".s-vote", - "description": "Container for vote counts." + "code": ".s-vote--total", + "parent": ".s-vote--votes", + "description": "Total vote count." }, { - "class": ".s-vote--upvotes", - "applies": ".s-vote--votes", + "code": ".s-vote--upvotes", + "parent": ".s-vote--votes", "description": "Upvote count." }, { - "class": ".s-vote--total", - "applies": ".s-vote--votes", - "description": "Total vote count." + "code": ".s-vote__expanded", + "applies": ".s-vote", + "description": "Expanded vote style that shows upvote and downvote counts separately." }, { - "class": ".s-vote--downvotes", - "applies": ".s-vote--votes", - "description": "Downvote count." + "code": ".s-vote__horizontal", + "applies": ".s-vote", + "description": "Horizontal vote style that arranges buttons and counts in a row. This layout does not officially support downvoting or expanded vote count." } ], "groups": { diff --git a/packages/stacks-docs/_data/validation-classes.json b/packages/stacks-docs/_data/validation-classes.json new file mode 100644 index 0000000000..f7822de560 --- /dev/null +++ b/packages/stacks-docs/_data/validation-classes.json @@ -0,0 +1,17 @@ +[ + { + "code": ".has-warning", + "primaryContext": "Parent element", + "description": "Used to warn users that the value they’ve entered has a potential problem, but it doesn’t block them from proceeding." + }, + { + "code": ".has-error", + "primaryContext": "Parent element", + "description": "Used to alert users that the value they’ve entered is incorrect, not filled in, or has a problem which will block them from proceeding." + }, + { + "code": ".has-success", + "primaryContext": "Parent element", + "description": "Used to notify users that the value they’ve entered is fine or has been submitted successfully." + } +] \ No newline at end of file diff --git a/packages/stacks-docs/_includes/docs-table.html b/packages/stacks-docs/_includes/docs-table.html new file mode 100644 index 0000000000..9cc160b14c --- /dev/null +++ b/packages/stacks-docs/_includes/docs-table.html @@ -0,0 +1,152 @@ +{% comment %} + Reusable classes reference table (Class | Applied to | Description). + Set docsItems in parent scope. Column header classes default as below; override by + setting classColClasses, appliesColClasses, or descriptionColClasses before including. + + Usage: + {% assign docsItems = itemType.items %} + {% include "docs-table.html" %} + Override one column: {% assign appliesColClasses = "s-table--cell4" %} +{% endcomment %} + +{% if tableId == nil %} + {% assign tableId = "docs-table" %} +{% endif %} + +{% comment %}Default column th classes{% endcomment %} +{% if col1Classes == nil %} + {% assign col1Classes = "s-table--cell3" %} +{% endif %} +{% if col2Classes == nil %} + {% assign col2Classes = "s-table--cell2" %} +{% endif %} +{% if col3Classes == nil %} + {% assign col3Classes = "s-table--cell2" %} +{% endif %} +{% if col4Classes == nil %} + {% assign col4Classes = "" %} +{% endif %} + +{% comment %}Default column th headings{% endcomment %} +{% if col1Heading == nil %} + {% assign col1Heading = "Class" %} +{% endif %} +{% if col2Heading == nil %} + {% assign col2Heading = "Parent" %} +{% endif %} +{% if col3Heading == nil %} + {% assign col3Heading = "Modifies" %} +{% endif %} +{% if col4Heading == nil %} + {% assign col4Heading = "Description" %} +{% endif %} + +{% if expandableBtnText == nil %} + {% assign expandableBtnText = "Show all classes" %} +{% endif %} +{% assign expandableClassesTable = expandableClassesTable | default: false %} +
+ + + + {% if col1Heading != "" %} + + {% endif %} + {% if col2Heading != "" %} + + {% endif %} + {% if col3Heading != "" %} + + {% endif %} + {% if col4Heading != "" %} + + {% endif %} + + + + {% for item in docsItems %} + + {% if col1Heading != "" %} + + {% endif %} + {% if col2Heading != "" %} + + {% endif %} + {% if col3Heading != "" %} + + {% endif %} + {% if col4Heading != "" %} + + {% endif %} + + {% endfor %} + +
+ {{ col1Heading }} + + {{ col2Heading }} + + {{ col3Heading }} + + {{ col4Heading }} +
+ {% if item.code or item.text %} + {% if item.code %} + {{ item.code }} + {% endif %} + {% if item.text %} + {{ item.text }} + {% endif %} + {% else %} + N/A + {% endif %} + + {% if item.primaryContext or item.parent %} + {% if item.primaryContext %} + {{ item.primaryContext }} + {% endif %} + {% if item.parent %} + {{ item.parent }} + {% endif %} + {% else %} + N/A + {% endif %} + + {% if item.secondaryContext or item.applies %} + {% if item.secondaryContext %} + {{ item.secondaryContext }} + {% endif %} + {% if item.applies %} + {{ item.applies }} + {% endif %} + {% else %} + N/A + {% endif %} + {{ item.description }}
+
+{% if expandableClassesTable %} + +{% endif %} + + +{% assign tableId = nil %} +{% assign col1Classes = nil %} +{% assign col2Classes = nil %} +{% assign col3Classes = nil %} +{% assign col4Classes = nil %} +{% assign col1Heading = nil %} +{% assign col2Heading = nil %} +{% assign col3Heading = nil %} +{% assign col4Heading = nil %} +{% assign expandableBtnText = nil %} +{% assign expandableClassesTable = nil %} diff --git a/packages/stacks-docs/assets/js/global.navigation.js b/packages/stacks-docs/assets/js/global.navigation.js index 0a090de58a..ca6df65ff3 100644 --- a/packages/stacks-docs/assets/js/global.navigation.js +++ b/packages/stacks-docs/assets/js/global.navigation.js @@ -8,6 +8,19 @@ $(document).ready(function() { e.preventDefault(); }); + // Docs table "Show all classes" - use delegation so it works after sidebar nav AJAX load + $(document).on("click", ".js-docs-table-expand", function() { + var button = $(this); + var tableId = button.attr("aria-controls"); + var table = tableId ? document.getElementById(tableId) : null; + if (table) { + button.addClass("d-none"); + button.attr("aria-expanded", "true"); + table.classList.remove("v-truncate", "v-truncate-fade", "overflow-auto"); + table.classList.add("overflow-x-auto"); + } + }); + function regenerateMenu () { // Hide the navigation if we've opened it hamburgerBtn.removeClass("is-selected"); diff --git a/packages/stacks-docs/assets/less/stacks-documentation.less b/packages/stacks-docs/assets/less/stacks-documentation.less index adfc54f394..629f9d6611 100644 --- a/packages/stacks-docs/assets/less/stacks-documentation.less +++ b/packages/stacks-docs/assets/less/stacks-documentation.less @@ -93,7 +93,6 @@ h2, h3 { background-color: var(--black-150); border: var(--su1) solid var(--black-200); border-radius: var(--su2); - color: var(--green-600); font-family: var(--ff-mono); overflow-wrap: break-word; margin: var(--sun1); @@ -172,7 +171,7 @@ h2, h3 { color: var(--black-500); - font-size: var(--fs-body3); + font-size: var(--fs-body2); line-height: 1.5; margin-bottom: var(--su16); margin-top: 0; @@ -235,10 +234,6 @@ h2, h3 { --_dt-c: var(--green-400); } - code { - font-size: 1em; - } - min-width: var(--su344); } diff --git a/packages/stacks-docs/product/components/activity-indicator.html b/packages/stacks-docs/product/components/activity-indicator.html index 6012439c2c..2d959746d4 100644 --- a/packages/stacks-docs/product/components/activity-indicator.html +++ b/packages/stacks-docs/product/components/activity-indicator.html @@ -7,31 +7,14 @@ tags: components --- -{% assign examples = " ,3,12,370,new" | split: "," %} -
{% header "h2", "Classes" %} -
- - - - - - - - - - {% for item in activity-indicator.indicator %} - - - - - - {% endfor %} - -
ClassApplied toDescription
{{ item.class }}{% if item.applies == "N/A" %}{{ item.applies }}{% else %}{{ item.applies }}{% endif %}{{ item.description }}
-
+ {% assign docsItems = activity-indicator.classes %} + {% assign col3Classes = "s-table--cell4" %} + {% assign col2Heading = "" %} + {% include "docs-table.html" %}
+
{% header "h2", "Examples" %} {% header "h3", "Default" %} @@ -92,7 +75,7 @@ {% endhighlight %}
- {% for example in examples %} + {% for example in activity-indicator.examples %}
{{ example }}
New activity
@@ -146,11 +129,10 @@
{% endhighlight %}
- {% assign variants = "success,warning,danger" | split: "," %}
- {% for variant in variants %} + {% for variant in activity-indicator.variants %}
- {% for example in examples %} + {% for example in activity-indicator.examples %}
{{ example }}
New activity
diff --git a/packages/stacks-docs/product/components/avatars.html b/packages/stacks-docs/product/components/avatars.html index b5e6600b90..ef110c14c0 100644 --- a/packages/stacks-docs/product/components/avatars.html +++ b/packages/stacks-docs/product/components/avatars.html @@ -6,29 +6,14 @@ description: Avatars are used to quickly identify users or teams. tags: components --- +
{% header "h2", "Classes" %} -
- - - - - - - - - - {% for item in avatars-component.classes %} - - - - - - {% endfor %} - -
ClassApplied toDescription
{{ item.class }}{{ item.applies }}{{ item.description }}
-
+ {% assign docsItems = avatars.classes %} + {% assign expandableClassesTable = true %} + {% include "docs-table.html" %}
+
{% header "h2", "Examples" %} {% header "h3", "Users" %} @@ -64,85 +49,31 @@ {% endhighlight %}
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + {% for example in avatars.examples %} + + + + + + {% endfor %} +
- 16px - default - - - demo avatar - -
- 24px - .s-avatar__24 - - - demo avatar - -
- 32px - .s-avatar__32 - - - demo avatar - -
- 48px - .s-avatar__48 - - - demo avatar - -
- 64px - .s-avatar__64 - - - demo avatar - -
- 96px - .s-avatar__96 - - - demo avatar - -
- 128px - .s-avatar__128 - - - demo avatar - -
+ {{ example }}px + + {% if example == "16" %}default{% else %}.s-avatar__{{ example }}{% endif %} + + + demo avatar + +
@@ -170,34 +101,35 @@ {% endhighlight %}
- - - - - - - - + + + + + + + + + {% for example in avatars.examples %} + {% if example == 16 or example == 24 %} + + + + + + {% endif %} + {% endfor %} +
- 16px - default - - -
-
Online
-
- demo avatar -
-
- 24px - .s-avatar__24 - - -
-
Online
-
- demo avatar -
-
+ {{ example }}px + + {% if example == 16 %}default{% else %}.s-avatar__{{ example }}{% endif %} + + +
+
Online
+
+ demo avatar +
+
@@ -254,202 +186,55 @@ {% endhighlight %}
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
- 16px - default - - -
- - {% icon "ShieldXSm", "native s-avatar--badge" %} -
- Hum -
-
- -
- - {% icon "ShieldXSm", "native s-avatar--badge" %} -
- Hum -
-
- -
- - {% icon "ShieldXSm", "native s-avatar--badge" %} -
- Hum -
-
- 24px - .s-avatar__24 - - - - Hum - {% icon "ShieldXSm", "native s-avatar--badge" %} - - - - - Hum - {% icon "ShieldXSm", "native s-avatar--badge" %} - - - - - Hum - {% icon "ShieldXSm", "native s-avatar--badge" %} - -
- 32px - .s-avatar__32 - - - - Hum - {% icon "ShieldXSm", "native s-avatar--badge" %} - - - - - Hum - {% icon "ShieldXSm", "native s-avatar--badge" %} - - - - - Hum - {% icon "ShieldXSm", "native s-avatar--badge" %} - -
- 48px - .s-avatar__48 - - - - Hum - {% icon "ShieldXSm", "native s-avatar--badge" %} - - - - - Hum - {% icon "ShieldXSm", "native s-avatar--badge" %} - - - - - Hum - {% icon "ShieldXSm", "native s-avatar--badge" %} - -
- 64px - .s-avatar__64 - - - - Hum - {% icon "ShieldXSm", "native s-avatar--badge" %} - - - - - Hum - {% icon "ShieldXSm", "native s-avatar--badge" %} - - - - - Hum - {% icon "ShieldXSm", "native s-avatar--badge" %} - -
- 96px - .s-avatar__96 - - - - Hum - {% icon "ShieldXSm", "native s-avatar--badge" %} - - - - - Hum - {% icon "ShieldXSm", "native s-avatar--badge" %} - - - - - Hum - {% icon "ShieldXSm", "native s-avatar--badge" %} - -
- 128px - .s-avatar__128 - - - - Hum - {% icon "ShieldXSm", "native s-avatar--badge" %} - - - - - Hum - {% icon "ShieldXSm", "native s-avatar--badge" %} - - - - - Hum - {% icon "ShieldXSm", "native s-avatar--badge" %} - -
+ + + + + + + + + + + {% for example in avatars.examples %} + + + + {% for bgColor in avatars.teamBgs %} + + {% endfor %} + + {% endfor %} +
+ {{ example }}px + + {% if example == "16" %}default{% else %}.s-avatar__{{ example }}{% endif %} + + {% if example == 16 %} + +
+ {% if bgColor == "png" %} + + {% else %} + + {% endif %} + {% icon "ShieldXSm", "native s-avatar--badge" %} +
+ Hum +
+ {% else %} + + {% if bgColor == "png" %} + + {% else %} + + Hum + {% endif %} + {% icon "ShieldXSm", "native s-avatar--badge" %} + + {% endif %} +
diff --git a/packages/stacks-docs/product/components/badges.html b/packages/stacks-docs/product/components/badges.html index a69e5e3562..d252472f27 100644 --- a/packages/stacks-docs/product/components/badges.html +++ b/packages/stacks-docs/product/components/badges.html @@ -6,6 +6,15 @@ description: Badges are labels used for flags, earned achievements, and number totals. tags: components --- + +
+ {% header "h2", "Classes" %} + {% assign docsItems = badges.classes %} + {% assign col2Heading = "" %} + {% assign expandableClassesTable = true %} + {% include "docs-table.html" %} +
+
{% header "h2", "Styles" %} {% header "h3", "Default" %} @@ -115,7 +124,6 @@ Example - Class Description @@ -132,14 +140,6 @@ {{ type.label }} - -
- .s-badge > - {% if type.class != nil %} - .{{ type.class }} - {% endif %} -
- {{ type.description }} {% endfor %} @@ -179,7 +179,7 @@ Example - Class + Modifier class Description @@ -198,9 +198,10 @@
- .s-badge - {% if type.class != nil %} - .{{ type.class }} + {% if type.code != nil %} + .{{ type.code }} + {% else %} + N/A {% endif %}
@@ -262,7 +263,7 @@ Example - Class + Modifier class Description @@ -282,12 +283,10 @@
- .s-badge - {% if type.class != nil %} - .{{ type.class }} - {% endif %} - {% if badge.class != nil %} - .{{ badge.class }} + {% if type.code != nil %} + .{{ type.code }} + {% else %} + N/A {% endif %}
@@ -320,7 +319,7 @@ Example - Class + Modifier classes Description @@ -337,12 +336,15 @@
- .s-badge - {% if type.class != nil %} - .{{ type.class }} + {% if badge.code != nil %} + .{{ badge.code }} + {% else %} + N/A {% endif %} - {% if badge.class != nil %} - .{{ badge.class }} + {% if type.code != nil %} + .{{ type.code }} + {% else %} + N/A {% endif %}
@@ -381,7 +383,7 @@ Example - Class + Modifier classes Description @@ -391,7 +393,7 @@ {% for type in types %} - + {% if type.icon != nil %} {% icon type.icon %} {{ type.label }} @@ -402,7 +404,7 @@
- {% assign classes = type.html | split: " " %} + {% assign classes = type.classes | split: " " %} {% for class in classes %} .{{ class }} {% endfor %} @@ -444,13 +446,12 @@ {% for type in types %} - {{ type.label }} + {{ type.label }}
- .s-badge - {% if type.class != nil %} - .{{ type.class }} + {% if type.modifier != nil %} + .s-badge__{{ type.modifier }} {% endif %}
@@ -484,7 +485,7 @@ Examples - Class + Modifier class Description @@ -494,15 +495,14 @@ {% for type in types %} - + {{ type.label }}
- .s-badge - {% if type.class != nil %} - .{{ type.class }} + {% if type.modifier != nil %} + .s-badge__{{ type.modifier }} {% endif %}
diff --git a/packages/stacks-docs/product/components/banners.html b/packages/stacks-docs/product/components/banners.html index 4d11045433..806167f41f 100644 --- a/packages/stacks-docs/product/components/banners.html +++ b/packages/stacks-docs/product/components/banners.html @@ -2,166 +2,28 @@ layout: page title: Banners figma: https://www.figma.com/design/do4Ug0Yws8xCfRjHe9cJfZ/Project-SHINE---Product-UI?node-id=5982-7648&m=dev -description: Banners are a type of notice, delivering both system and engagement messaging. These are highly intrusive messaging methods and so should be used appropriately. +description: Banners are full-width notices used for system and engagement messaging. They are highly intrusive and should be used only when essential information needs to be conveyed to the user. tags: components --- - - - +
+ {% header "h2", "Classes" %} + {% assign docsItems = banners.classes %} + {% assign expandableClassesTable = true %} + {% include "docs-table.html" %} +
+ {% header "h2", "Usage guidelines" %}

System banners are used for system messaging. They are full-width notices placed in one of two locations:

    -
  1. Above everything else: If the system banner is related to the entire website (e.g. the website is in read-only), place the banner first. These cannot be dismissed until the issue is resolved. To pin a system banner to the top of the browser window, add .is-pinned.
  2. +
  3. Pinned: If the system banner is related to the entire website (e.g. the website is in read-only), above all other content including the topbar. To pin a system banner to the top of the browser window, add .is-pinned.
  4. Below the top navigation bar: This is the default location for all system banners. Use these banners when it affects only a particular area of the product (e.g. when a product subscription is about to expire).
-

Since system banners are a type of notice, you can use the following notice visual styles in conjunction with .s-banner:

+

Refer to the Classes section for more information on how to apply the correct styles to the banner.

- {% header "h2", "Classes" %} -
- - - - - - - - - - {% for item in banners.system %} - - - - - - {% endfor %} - -
ClassApplies toDescription
{{ item.class }}{% if item.applies == "N/A" %}{{ item.applies }}{% else %}{{ item.applies }}{% endif %}{{ item.description }}
-
- {% header "h2", "JavaScript" %} -

The .s-banner component includes a controller to show and hide the banner programitically. While it is optional, at least including the functionality to close the banner is recommended.

- - {% header "h3", "Attributes" %} -
- - - - - - - - - - - - - - - - - - - - - - - - - -
AttributeApplied toDescription
data-controller="s-banner"Controller elementWires up the element to the banner controller. This may be a .s-banner element or a wrapper element.
data-s-banner-target="banner".s-banner elementWires up the element that is to be shown/hidden
data-s-banner-remove-when-hidden="true"Controller elementOptional Removes the banner from the DOM entirely when it is hidden
-
- {% header "h3", "Events" %} -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
EventElementDescription
s-banner:showBanner targetDefault preventable Fires immediately before showing the banner. Calling .preventDefault() cancels the display of the banner.
s-banner:shownBanner targetFires after the banner has been visually shown
s-banner:hideBanner targetDefault preventable Fires immediately before hiding the banner. Calling .preventDefault() cancels the removal of the banner.
s-banner:hiddenBanner targetFires after the banner has been visually hidden
-
-
- - - - - - - - - - - - - - - -
event.detailApplicable eventsDescription
dispatchers-banner:*Contains the Element that initiated the event. For instance, the button clicked to show, the element clicked outside the banner that caused it to hide, etc.
-
- {% header "h3", "Helpers" %} -
- - - - - - - - - - - - - - - - - - - - -
FunctionParametersDescription
Stacks.showBanner - element: the element the data-controller="s-banner" attribute is on

-
Helper to manually show an s-banner element via external JS
Stacks.hideBanner - element: the element the data-controller="s-banner" attribute is on

-
Helper to manually hide an s-banner element via external JS
-
- {% header "h2", "Examples" %}
@@ -284,7 +146,10 @@
- {% header "h2", "JavaScript Example" %} + {% header "h2", "JavaScript" %} +

The .s-banner component includes a controller to show and hide the banner programitically. While it is optional, at least including the functionality to close the banner is recommended.

+ + {% header "h3", "Example" %}
{% highlight html %}
+ + +
+ {% header "h3", "Attributes" %} + {% assign docsItems = banners.attributes %} + {% assign col1Classes = "s-table--cell5" %} + {% assign col1Heading = "Attribute" %} + {% assign col2Heading = "Applies to" %} + {% assign col3Heading = "" %} + {% assign tableId = "banners-attributes-table" %} + {% include "docs-table.html" %} +
+ +
+ {% header "h3", "Events" %} + {% assign docsItems = banners.events %} + {% assign col1Heading = "Event" %} + {% assign col2Heading = "Applies to" %} + {% assign col3Heading = "" %} + {% assign tableId = "banners-events-table" %} + {% include "docs-table.html" %} +
+ +
+ {% header "h3", "Event details" %} + {% assign docsItems = banners.eventDetails %} + {% assign col1Heading = "event.detail" %} + {% assign col2Heading = "" %} + {% assign col3Heading = "Applicable events" %} + {% assign tableId = "banners-event-details-table" %} + {% include "docs-table.html" %} +
+ +
+ {% header "h3", "Helpers" %} + {% assign docsItems = banners.helpers %} + {% assign col1Classes = "s-table--cell3" %} + {% assign col2Classes = "s-table--cell4" %} + {% assign col1Heading = "Function" %} + {% assign col2Heading = "Parameters" %} + {% assign col3Heading = "" %} + {% assign tableId = "banners-helpers-table" %} + {% include "docs-table.html" %} +
+ + + + + + \ No newline at end of file diff --git a/packages/stacks-docs/product/components/bling.html b/packages/stacks-docs/product/components/bling.html index 5aece75f53..d09767ecef 100644 --- a/packages/stacks-docs/product/components/bling.html +++ b/packages/stacks-docs/product/components/bling.html @@ -5,6 +5,15 @@ description: Bling is used to indicate award type in badges, topbar, and user cards. tags: components --- + +
+ {% header "h2", "Classes" %} + {% assign docsItems = bling.classes %} + {% assign col2Heading = "" %} + {% assign expandableClassesTable = true %} + {% include "docs-table.html" %} +
+
{% header "h2", "Types" %}

Use the clear bling variant only when its associated color is already present in the component, such as within a colored tag badge or alongside a filled element.

diff --git a/packages/stacks-docs/product/components/breadcrumbs.html b/packages/stacks-docs/product/components/breadcrumbs.html index 16576359c3..d8e975a573 100644 --- a/packages/stacks-docs/product/components/breadcrumbs.html +++ b/packages/stacks-docs/product/components/breadcrumbs.html @@ -5,29 +5,16 @@ description: Breadcrumbs are used to provide context for the currently-viewed page. tags: components --- +
{% header "h2", "Classes" %} -
- - - - - - - - - - {% for item in breadcrumbs.classes %} - - - - - - {% endfor %} - -
ClassParentDescription
{{ item.class }}{{ item.applies }}{{ item.description }}
-
+ {% assign docsItems = breadcrumbs.classes %} + {% assign col1Classes = "s-table--cell4"%} + {% assign col2Classes = "s-table--cell3"%} + {% assign col3Heading = "" %} + {% include "docs-table.html" %}
+
{% header "h2", "Examples" %}

Breadcrumbs show users where they are within a site’s hierarchy. Breadcrumbs help orient the user and allow for navigation to previous page levels. It can be appropriate to use a breadcrumb when:

diff --git a/packages/stacks-docs/product/components/button-groups.html b/packages/stacks-docs/product/components/button-groups.html index 6821683192..e7a4e704a5 100644 --- a/packages/stacks-docs/product/components/button-groups.html +++ b/packages/stacks-docs/product/components/button-groups.html @@ -5,29 +5,16 @@ description: Button groups are a collection of buttons. This component is used in our questions view, and is frequently used in conjunction with other form elements such as search fields and sorting dropdowns. If the content you’re interacting with is a simple paring down or filter of the current view, it’s appropriate to use the .s-btn-group component. Add the class .is-selected and the aria-current attribute with the appropriate value to show the currently selected button. tags: components --- +
{% header "h2", "Classes" %} -
- - - - - - - - - - {% for item in button-groups.classes %} - - - - - - {% endfor %} - -
ClassApplied toDescription
{{ item.class }}{{ item.applies }}{{ item.description }}
-
+ {% assign docsItems = button-groups.classes %} + {% assign col2Heading = "" %} + {% assign col3Heading = "" %} + {% include "docs-table.html" %} +
+
{% header "h2", "Button attributes" %} {% for item in button-groups.button-attributes %} diff --git a/packages/stacks-docs/product/components/buttons.html b/packages/stacks-docs/product/components/buttons.html index 8d2c8f4640..b090144028 100644 --- a/packages/stacks-docs/product/components/buttons.html +++ b/packages/stacks-docs/product/components/buttons.html @@ -6,6 +6,14 @@ description: Buttons are user interface elements which allows users to take actions throughout the project. It is important that they have ample click space and help communicate the importance of their actions. tags: components --- + +
+ {% header "h2", "Classes" %} + {% assign docsItems = buttons.classes %} + {% assign expandableClassesTable = true %} + {% include "docs-table.html" %} +
+
{% header "h2", "Styles" %}

Stacks provides 3 different button styles:

@@ -462,7 +470,7 @@ Type Class Size - Example + Example @@ -523,8 +531,8 @@ Type - Class - Definition + Attribute + Definition Example @@ -547,8 +555,8 @@ Type - Class - Definition + Class + Definition Example @@ -579,8 +587,8 @@ Type - Class - Definition + Class + Definition Examples @@ -609,8 +617,8 @@ Type - Class - Definition + Class + Definition Examples diff --git a/packages/stacks-docs/product/components/cards.html b/packages/stacks-docs/product/components/cards.html index 2521ef0d98..3212c2dec2 100644 --- a/packages/stacks-docs/product/components/cards.html +++ b/packages/stacks-docs/product/components/cards.html @@ -5,6 +5,14 @@ description: Cards are used to group similar concepts and tasks together to make information easier to scan, read, and act on. Cards should use a heading that sets clear expectations about the card’s purpose, paragraphs that put the most critical information first, and (optionally) calls to action on the bottom to direct user action. tags: components --- + +
+ {% header "h2", "Classes" %} + {% assign docsItems = cards.classes %} + {% assign col2Heading = "" %} + {% include "docs-table.html" %} +
+
{% header "h2", "Base" %}

The base card styling applies a border and padding to the card.

diff --git a/packages/stacks-docs/product/components/checkbox.html b/packages/stacks-docs/product/components/checkbox.html index 6e07623089..68d36fe476 100644 --- a/packages/stacks-docs/product/components/checkbox.html +++ b/packages/stacks-docs/product/components/checkbox.html @@ -6,6 +6,15 @@ description: Checkable inputs that visually allow for multiple options or true/false values. tags: components --- + +
+ {% header "h2", "Classes" %} + {% assign docsItems = checkbox_radio.checkbox-classes %} + {% assign col1Classes = "s-table--cell4" %} + {% assign col2Heading = "" %} + {% include "docs-table.html" %} +
+
{% header "h2", "Base" %} @@ -202,24 +211,10 @@

Checkboxes use the same validation states as inputs.

{% header "h3", "Validation classes" %} -
- - - - - - - - - {% for state in inputs.validation %} - - - - - {% endfor %} - -
ClassDescription
{{ state.class }}{{ state.description }}
-
+ {% assign docsItems = validation-classes %} + {% assign col2Heading = "Applies to" %} + {% assign col3Heading = "" %} + {% include "docs-table.html" %} {% header "h3", "Validation examples" %}
diff --git a/packages/stacks-docs/product/components/code-blocks.html b/packages/stacks-docs/product/components/code-blocks.html index 56018d9a3b..ed0e7e48fc 100644 --- a/packages/stacks-docs/product/components/code-blocks.html +++ b/packages/stacks-docs/product/components/code-blocks.html @@ -4,28 +4,13 @@ description: Stacks provides styling for code blocks with syntax highlighting provided by highlight.js. Special care was taken to make sure our light and dark themes felt like Stack Overflow while maintaining near AAA color contrasts and still being distinguishable for those with a color vision deficiency. tags: components --- +
{% header "h2", "Classes" %} -
- - - - - - - - - - {% for item in code-blocks.classes %} - - - - - - {% endfor %} - -
ClassApplies toOutput
{{ item.class }}{{ item.applies }}{{ item.description }}
-
+ {% assign docsItems = code-blocks.classes %} + {% assign col2Heading = "" %} + {% assign col3Classes = "s-table--cell3" %} + {% include "docs-table.html" %}
diff --git a/packages/stacks-docs/product/components/empty-states.html b/packages/stacks-docs/product/components/empty-states.html index 7f1aa69243..87bace788c 100644 --- a/packages/stacks-docs/product/components/empty-states.html +++ b/packages/stacks-docs/product/components/empty-states.html @@ -6,6 +6,16 @@ description: Empty states are used when there is no data to show. Ideally they orient the user by providing feedback based on the the user’s last interaction or communicate the benefits of a feature. When appropriate, they should explain the next steps the user should take and provide guidance with a clear call-to-action. tags: components --- + +
+ {% header "h2", "Classes" %} + {% assign docsItems = empty-states.classes %} + {% assign col2Heading = "" %} + {% assign col3Heading = "" %} + {% assign col2Classes = "s-table--cell3" %} + {% include "docs-table.html" %} +
+
{% header "h2", "No data or results" %}

diff --git a/packages/stacks-docs/product/components/expandable.html b/packages/stacks-docs/product/components/expandable.html index 4a2e7759ad..e9eb23e314 100644 --- a/packages/stacks-docs/product/components/expandable.html +++ b/packages/stacks-docs/product/components/expandable.html @@ -5,6 +5,16 @@ description: An expandable, sometimes called an accordion, is an element that can be hidden / revealed with a sliding transition. tags: components --- + +

+ {% header "h2", "Classes" %} + {% assign docsItems = expandable.classes %} + {% assign col1Classes = "s-table--cell3" %} + {% assign col2Classes = "s-table--cell3" %} + {% assign col3Classes = "s-table--cell3" %} + {% include "docs-table.html" %} +
+
{% header "h2", "Examples" %} {% header "h3", "Basic" %} diff --git a/packages/stacks-docs/product/components/inputs.html b/packages/stacks-docs/product/components/inputs.html index deb02178ed..8d9dc2d7d2 100644 --- a/packages/stacks-docs/product/components/inputs.html +++ b/packages/stacks-docs/product/components/inputs.html @@ -6,6 +6,16 @@ description: Input elements are used to gather information from users. tags: components --- + +
+ {% header "h2", "Classes" %} + {% assign docsItems = inputs.classes %} + {% assign col2Heading = "" %} + {% assign col1Classes = "s-table--cell4" %} + {% assign col3Classes = "s-table--cell3" %} + {% include "docs-table.html" %} +
+
{% header "h2", "Base style" %}

Inputs are normally paired with a label, but there are times when they can be used without a label. Placeholder text should primarily be used as a content prompt and only provided when needed.

@@ -77,22 +87,12 @@

Labels or instructions must be provided when content requires user input. For any input field within a form that is required for successful data submission, provide the asterisk * as a symbol and a legend advising the meaning of the symbol before the first use.

Stacks includes a special .s-required-symbol class to ensure the symbol (asterisk) is clearly visible.

- - - - - - - - - - - - - - - -
ClassAppliesDefinition
.s-required-symbolabbr element enclosing the asteriskUsed to style the asterisk indicating that a specific field is required.
+ {% assign docsItems = inputs.required %} + {% assign col2Heading = "" %} + {% assign col3Heading = "Applies" %} + {% assign col3Classes = "s-table--cell4" %} + {% include "docs-table.html" %} + {% highlight html %} * {% endhighlight %} @@ -152,26 +152,10 @@

Validation states provides the user feedback based on their interaction (or lack of interaction) with an input. These styles are applied by applying the appropriate class to the wrapping parent container.

{% header "h3", "Validation classes" %} -
- - - - - - - - - - {% for state in inputs.validation %} - - - - - - {% endfor %} - -
ClassAppliesDefinition
{{ state.class }}Parent wrapper for input{{ state.description }}
-
+ {% assign docsItems = validation-classes %} + {% assign col2Heading = "Applies to" %} + {% assign col3Heading = "" %} + {% include "docs-table.html" %} {% header "h3", "Validation guidance" %}

@@ -311,31 +295,13 @@

{% header "h2", "Sizes" %} -
- - - - - - - - - - - {% for item in inputs.input %} - {% assign size = item.sizes %} - {% for item in size %} - - - - - - - {% endfor %} - {% endfor %} - -
NameSizeClassExample
{{ item.name }}{{ item.size }}{% if item.class == "N/A" %}{{ item.class }}{% else %}.{{ item.class }}{% endif %}
-
+ + {% assign docsItems = inputs.sizes %} + {% assign col2Heading = "Name" %} + {% assign col3Heading = "Size" %} + {% assign col4Heading = "Example" %} + {% assign tableId = "input-sizes-table" %} + {% include "docs-table.html" %}
diff --git a/packages/stacks-docs/product/components/labels.html b/packages/stacks-docs/product/components/labels.html index 099fe55b83..e783656ea1 100644 --- a/packages/stacks-docs/product/components/labels.html +++ b/packages/stacks-docs/product/components/labels.html @@ -5,6 +5,16 @@ description: Labels are used to describe inputs, select menus, textareas, radio buttons, and checkboxes. tags: components --- + +
+ {% header "h2", "Classes" %} + {% assign docsItems = labels.classes %} + {% assign col2Heading = "" %} + {% assign col1Classes = "s-table--cell4" %} + {% assign col3Classes = "s-table--cell3" %} + {% include "docs-table.html" %} +
+

Labels inform users what information is being asked of them. They should be written in sentence case.

{% tip %} @@ -35,31 +45,13 @@
{% header "h2", "Sizes" %} -
- - - - - - - - - - - {% for item in inputs.label %} - {% assign size = item.sizes %} - {% for item in size %} - - - - - - - {% endfor %} - {% endfor %} - -
NameSizeClassExample
{{ item.name }}{{ item.size }}{% if item.class == "N/A" %}{{ item.class }}{% else %}.{{ item.class }}{% endif %}
-
+ + {% assign docsItems = labels.sizes %} + {% assign col2Heading = "Name" %} + {% assign col3Heading = "Size" %} + {% assign col4Heading = "Example" %} + {% assign tableId = "label-sizes-table" %} + {% include "docs-table.html" %}
diff --git a/packages/stacks-docs/product/components/link-previews.html b/packages/stacks-docs/product/components/link-previews.html index 93c3710497..d8c3d99246 100644 --- a/packages/stacks-docs/product/components/link-previews.html +++ b/packages/stacks-docs/product/components/link-previews.html @@ -6,27 +6,15 @@ ---
{% header "h2", "Classes" %} -
- - - - - - - - - - {% for item in link-previews.classes %} - - - - - - {% endfor %} - -
ClassParentDescription
{{ item.class }}{{ item.parent }}{{ item.description }}
-
+ {% assign docsItems = link-previews.classes %} + {% assign col1Classes = "s-table--cell4" %} + {% assign col2Classes = "s-table--cell4" %} + {% assign col3Heading = "" %} + {% assign col4Heading = "Description" %} + {% assign expandableClassesTable = true %} + {% include "docs-table.html" %}
+
{% header "h2", "Examples" %}

Link previews automatically appear when you pasting a link into a post, providing a glimpse of what’s been linked to. This approach has been popularized by Slack, Twitter, Facebook, etc. Link previews should be tailored to fit the content received from each third party. It might be appropriate to use atomic utility classes for further customization, but Stacks provides a few reusable patterns:

@@ -50,29 +38,27 @@

{% endhighlight %}
+ {% assign baseExample = link-previews.examples.base %}
@@ -103,17 +89,18 @@
{% endhighlight %}
+ {% assign codeExample = link-previews.examples.code %}
@@ -196,11 +183,11 @@ {% icon "GitHub" %}
- - Gruntfile.js + + {{ codeExample.title }}
@@ -226,8 +213,8 @@ {% endhighlight %} diff --git a/packages/stacks-docs/product/components/links.html b/packages/stacks-docs/product/components/links.html index 2a541fa751..e619dae754 100644 --- a/packages/stacks-docs/product/components/links.html +++ b/packages/stacks-docs/product/components/links.html @@ -5,30 +5,15 @@ description: Links are lightly styled via the a element by default. In addition, we provide .s-link and its variations. In rare situations, .s-link can be applied to n button while maintaining the look of an anchor. tags: components --- + +{% header "h2", "Links" %}
- {% header "h2", "Single link" %} - {% header "h3", "Single link classes" %} -
- - - - - - - - - - {% for item in links.single-links %} - - - - - - {% endfor %} - -
ClassApplied toDescription
{{ item.class }}{{ item.applies }}{{ item.description }}
-
+ {% header "h3", "Link classes" %} + {% assign docsItems = links.link-classes %} + {% assign col2Heading = "" %} + {% include "docs-table.html" %}
+
{% header "h3", "Single link examples" %}
@@ -60,30 +45,18 @@

Any link with adjacent static text cannot use color alone to differentiate it as a link. If a link is next to static text and the only visual indication that it’s a link is the color of the text, it will require an underline in addition to the color. Reference WCAG SC 1.4.1 for more details.

+{% header "h2", "Anchors" %}
- {% header "h2", "Descendent anchors" %} - {% header "h3", "Descendent anchor classes" %} -
- - - - - - - - - - {% for item in links.descendent-anchors %} - - - - - - {% endfor %} - -
ClassApplied toDescription
{{ item.class }}{{ item.applies }}{{ item.description }}
-
- {% header "h3", "Descendent anchor examples" %} + {% header "h3", "Anchor classes" %} + {% assign docsItems = links.anchors-classes %} + {% assign col1Classes = "s-table--cell3" %} + {% assign col3Classes = "s-table--cell2" %} + {% assign col2Heading = "" %} + {% include "docs-table.html" %} +
+ +
+ {% header "h3", "Anchor examples" %}

Sometimes you need to give all <a> elements inside a container or component the same color, even when it‘s impractical or even impossible to give each anchor element an s-link class (e.g. because the markup is generated from Markdown).

In this case, you can add the s-anchors class together with one of the modifiers @@ -101,7 +74,7 @@

{% endhighlight %}
- {% for item in links.descendent-anchors %} + {% for item in links.anchors-classes %} {% if item.name != "base" %}
There is a {{ item.name }} link here, , and another one. diff --git a/packages/stacks-docs/product/components/loader.html b/packages/stacks-docs/product/components/loader.html index 2b0db11d9e..55add7716d 100644 --- a/packages/stacks-docs/product/components/loader.html +++ b/packages/stacks-docs/product/components/loader.html @@ -8,34 +8,8 @@
{% header "h2", "Classes" %} -
- - - - - - - - - - {% for item in loader.classes %} - - - - - - {% endfor %} - -
ClassApplied toDescription
- {{ item.class }} - - {% if item.applies == "N/A" %} - {{ item.applies }} - {% else %} - {{ item.applies }} - {% endif %} - {{ item.description }}
-
+ {% assign docsItems = loader.classes %} + {% include "docs-table.html" %}
{% header "h2", "Examples" %} {% header "h3", "Base" %} @@ -60,38 +34,9 @@
{% header "h3", "Sizes" %} - - - - - - - - - - {% for size in loader.sizes %} - - - - - - {% endfor %} - -
ClassApplied toExample
- {% if size == "" %} - .s-loader - {% else %} - .{{ size }} - {%endif %} - - {% if size == "" %} - N/A - {% else %} - .s-loader - {% endif %} - -
-
Loading…
-
-
+ {% assign docsItems = loader.sizes-classes %} + {% assign col3Classes = "s-table--cell3" %} + {% assign col2Heading = "" %} + {% assign col4Heading = "Example" %} + {% include "docs-table.html" %}
diff --git a/packages/stacks-docs/product/components/menus.html b/packages/stacks-docs/product/components/menus.html index 57c5570218..3014ae9cc4 100644 --- a/packages/stacks-docs/product/components/menus.html +++ b/packages/stacks-docs/product/components/menus.html @@ -8,37 +8,19 @@ ---
{% header "h2", "Classes" %} -
- - - - - - - - - - {% for item in menu.classes %} - - - - - - {% endfor %} - -
ClassParentDescription
{{ item.class }}{{ item.applies }}{{ item.description }}
-
+ {% assign docsItems = menus.classes %} + {% assign col2Classes = "s-table--cell3" %} + {% assign col3Classes = "s-table--cell3" %} + {% include "docs-table.html" %}
+
{% header "h2", "Examples" %} -

- A menu displays a list of choices temporarily, and usually represent tasks or actions. Don’t confuse menus for navigation. -

+

A menu displays a list of choices temporarily, and usually represent tasks or actions. Don’t confuse menus for navigation.

{% header "h3", "Basic" %} -

- At its most basic, a menu is a simple styled list of contextual actions. Because they’re contextual, it’s strongly recommended that a menu is contained within a popover or a card. When placed in various containers, you’ll need to either account for the padding on the container, or use negative margins on the menu component itself. -

+

At its most basic, a menu is a simple styled list of contextual actions. Because they’re contextual, it’s strongly recommended that a menu is contained within a popover or a card. When placed in various containers, you’ll need to either account for the padding on the container, or use negative margins on the menu component itself.

+
{% highlight html %}
diff --git a/packages/stacks-docs/product/components/modals.html b/packages/stacks-docs/product/components/modals.html index 182e70cca5..c9cdfaa3d0 100644 --- a/packages/stacks-docs/product/components/modals.html +++ b/packages/stacks-docs/product/components/modals.html @@ -9,209 +9,69 @@ ---
{% header "h2", "Classes" %} -
- - - - - - - - - - {% for item in modals.classes %} - - - - - - {% endfor %} - -
ClassApplies toDescription
{{ item.class }}{{ item.applies }}{{ item.description }}
-
+ {% assign docsItems = modals.classes %} + {% assign tableId = "modals-classes-table" %} + {% assign expandableClassesTable = true %} + {% assign expandableBtnText = "Show all classes" %} + {% include "docs-table.html" %} +
+
{% header "h2", "JavaScript" %} {% header "h3", "Attributes" %} -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
AttributeApplied toDescription
data-controller="s-modal"Controller elementWires up the element to the modal controller. This may be a .s-modal element or a wrapper element.
data-s-modal-target="modal".s-modal elementWires up the element that is to be shown/hidden
data-s-modal-target="initialFocus"Any child focusable elementOptional Designates which element to focus on modal show. If absent, defaults to the first focusable element within the modal.
data-action="s-modal#toggle"Toggling elementWires up the element to toggle the visibility of a modal
data-s-modal-return-element="[css selector]"Controller elementOptional Designates the element to return focus to when the modal is closed. If left unset, focus is not altered on close.
data-s-modal-remove-when-hidden="true"Controller elementOptional Removes the modal from the DOM entirely when it is hidden
-
+ {% assign docsItems = modals.attributes %} + {% assign col1Classes = "s-table--cell5" %} + {% assign col2Classes = "s-table--cell3" %} + {% assign col2Heading = "Applies to" %} + {% assign col3Heading = "" %} + {% assign expandableClassesTable = true %} + {% assign expandableBtnText = "Show all attributes" %} + {% assign tableId = "modals-attributes-table" %} + {% include "docs-table.html" %} +
+ +
{% header "h3", "Events" %} -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
EventElementDescription
s-modal:showModal targetDefault preventable Fires immediately before showing the modal. Calling .preventDefault() cancels the display of the modal.
s-modal:shownModal targetFires after the modal has been visually shown
s-modal:hideModal targetDefault preventable Fires immediately before hiding the modal. Calling .preventDefault() cancels the removal of the modal.
s-modal:hiddenModal targetFires after the modal has been visually hidden
-
-
- - - - - - - - - - - - - - - - - - - - - - -
event.detailApplicable eventsDescription
dispatchers-modal:*Contains the Element that initiated the event. For instance, the button clicked to show, the element clicked outside the modal that caused it to hide, etc.
returnElements-modal:show, s-modal:hideContains the Element to return focus to on hide. If a value is set to this property inside an event listener, it will be updated on the controller as well.
-
+ {% assign docsItems = modals.events %} + {% assign col2Heading = "Applies to" %} + {% assign col3Heading = "" %} + {% assign tableId = "modals-events-table" %} + {% assign expandableClassesTable = true %} + {% assign expandableBtnText = "Show all events" %} + {% include "docs-table.html" %} +
+ +
+ {% header "h3", "Event details" %} + {% assign docsItems = modals.eventDetails %} + {% assign col2Heading = "Applies to" %} + {% assign col3Heading = "" %} + {% assign tableId = "modals-event-details-table" %} + {% include "docs-table.html" %} +
+ +
{% header "h3", "Helpers" %} -
- - - - - - - - - - - - - - - - - - - - -
FunctionParametersDescription
Stacks.showModal - element: the element the data-controller="s-modal" attribute is on

-
Helper to manually show an s-modal element via external JS
Stacks.hideModal - element: the element the data-controller="s-modal" attribute is on

-
Helper to manually hide an s-modal element via external JS
-
+ {% assign docsItems = modals.helpers %} + {% assign col2Heading = "Applies to" %} + {% assign col3Heading = "" %} + {% assign tableId = "modals-helpers-table" %} + {% include "docs-table.html" %} +
+
{% header "h2", "Accessibility" %}

Modals are designed with accessibility in mind by default. When a modal is open, navigation with the keyboard will be constrained to only those elements within the modal. To ensure maximum compatibility, all a tags must have href attributes and any default focusable items you don’t want focusable must have their tabindex set to -1.

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ItemApplied toDescription
aria-describedby="[id]".s-modalSupply the modal’s summary copy id. Assistive technologies (such as screen readers) use this to attribute to associate static text with a widget, element groups, headings, definitions, etc. (Source)
aria-hidden="[state]".s-modalInforms assistive technologies (such as screen readers) if they should ignore the element. This should not be confused with the HTML5 hidden attribute which tells the browser to not display an element. (Source)
aria-label="[text]".s-modal--closeLabels the element for assistive technologies (such as screen readers). (Source)
aria-labelledby="[id]".s-modalSupply the modal’s title id here. Assistive technologies (such as screen readers) use this to attribute to catalog the document objects correctly. (Source)
role="dialog".s-modalIdentifies dialog elements for assistive technologies (Source)
role="document".s-modal--dialogHelps assistive technologies to switch their reading mode from the larger document to a focused dialog window. (Source)
-
+ {% assign docsItems = modals.accessibility %} + {% assign col1Classes = "s-table--cell4" %} + {% assign col2Heading = "Applies to" %} + {% assign col3Heading = "" %} + {% assign tableId = "modals-accessibility-table" %} + {% include "docs-table.html" %}
@@ -396,26 +256,13 @@

Congratulations
{% header "h2", "Sizes" %}

Most modal dialogs look good by default, but may need some combination of .ws[x] or .wmx[x] classes applied to .s-modal--dialog. Additionally, the following class is available for modals:

-
- - - - - - - - - - - - - - - - - -
ClassValuePixels (13px base)Pixels (15px base)
.s-modal__full100% - 48pxN/AN/A
-
+ + {% assign docsItems = modals.sizes %} + {% assign col2Heading = "" %} + {% assign col3Heading = "Value" %} + {% assign col4Heading = "" %} + {% assign tableId = "modals-sizes-table" %} + {% include "docs-table.html" %}
diff --git a/packages/stacks-docs/product/components/navigation.html b/packages/stacks-docs/product/components/navigation.html index e46eb813cf..cb2a8cd2b3 100644 --- a/packages/stacks-docs/product/components/navigation.html +++ b/packages/stacks-docs/product/components/navigation.html @@ -9,26 +9,9 @@ ---
{% header "h2", "Classes" %} -
- - - - - - - - - - {% for item in navigation.classes %} - - - - - - {% endfor %} - -
ClassApplies toDescription
{{ item.class }}{{ item.applies }}{{ item.description }}
-
+ {% assign docsItems = navigation.classes %} + {% assign col1Classes = "s-table--cell4" %} + {% include "docs-table.html" %} {% for item in navigation.navigation-attributes %} {% header "h3", item.title %} diff --git a/packages/stacks-docs/product/components/notices.html b/packages/stacks-docs/product/components/notices.html index 08a616f89a..f7a05e6ef8 100644 --- a/packages/stacks-docs/product/components/notices.html +++ b/packages/stacks-docs/product/components/notices.html @@ -7,234 +7,30 @@ tags: components --- - - - -
- {% header "h2", "Accessibility" %} -
- - - - - - - - - - {% for item in notices.access %} - - - - - - {% endfor %} - -
ItemApplied toDescription
{{ item.item }} - {% if item.applies == "N/A" %} - {{ item.applies }} - {% else %} - {% assign class = item.applies | split: " " %} - - {% for name in class %} - {{ name }} - {% endfor %} - {% endif %} - {{ item.description }} (Source)
-
+ {% header "h2", "Classes" %} + {% assign docsItems = notices.classes %} + {% assign expandableClassesTable = true %} + {% include "docs-table.html" %}
- {% header "h2", "JavaScript" %} - {% header "h3", "Attributes" %} -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
AttributeApplied toDescription
data-controller="s-toast"Controller elementWires up the element to the toast controller. This may be a .s-toast element or a wrapper element.
data-s-toast-target="toast".s-toast elementWires up the element that is to be shown/hidden
data-s-toast-target="initialFocus"Any child focusable elementOptional Designates which element to focus on toast show. If absent, defaults to the first focusable element within the toast.
data-action="s-toast#toggle"Toggling elementWires up the element to toggle the visibility of a toast
data-s-toast-return-element="[css selector]"Controller elementOptional Designates the element to return focus to when the toast is closed. If left unset, focus is not altered on close.
data-s-toast-remove-when-hidden="true"Controller elementOptional Removes the toast from the DOM entirely when it is hidden
-
- {% header "h3", "Events" %} -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
EventElementDescription
s-toast:showToast targetDefault preventable Fires immediately before showing the toast. Calling .preventDefault() cancels the display of the toast.
s-toast:shownToast targetFires after the toast has been visually shown
s-toast:hideToast targetDefault preventable Fires immediately before hiding the toast. Calling .preventDefault() cancels the removal of the toast.
s-toast:hiddenToast targetFires after the toast has been visually hidden
-
-
- - - - - - - - - - - - - - - - - - - - - - -
event.detailApplicable eventsDescription
dispatchers-toast:*Contains the Element that initiated the event. For instance, the button clicked to show, the element clicked outside the toast that caused it to hide, etc.
returnElements-toast:show, s-toast:hideContains the Element to return focus to on hide. If a value is set to this property inside an event listener, it will be updated on the controller as well.
-
- {% header "h3", "Helpers" %} -
- - - - - - - - - - - - - - - - - - - - -
FunctionParametersDescription
Stacks.showToast - element: the element the data-controller="s-toast" attribute is on

-
Helper to manually show an s-toast element via external JS
Stacks.hideToast - element: the element the data-controller="s-toast" attribute is on

-
Helper to manually hide an s-toast element via external JS
-
+ {% header "h2", "Accessibility" %} + {% assign tableId = "docs-accessibility-table" %} + {% assign docsItems = notices.accessibility %} + {% assign expandableClassesTable = true %} + {% assign col1Heading = "Item" %} + {% assign col1Classes = "s-table--cell4" %} + {% assign col2Heading = "" %} + {% assign expandableBtnText = "Show all accessibility items" %} + {% include "docs-table.html" %}
- {% header "h2", "Visual styles" %} - {% header "h3", "Classes" %} -
- - - - - - - - - - {% for item in notices.visual %} - - - - - - {% endfor %} - -
ClassApplied toDescription
{{ item.class }} - {% if item.applies == "N/A" %} - {{ item.applies }} - {% else %} - {% assign class = item.applies | split: " " %} - - {% for name in class %} - {{ name }} - {% endfor %} - {% endif %} - {{ item.description }}
-
- + {% header "h2", "Examples" %} {% header "h3", "Base" %} -

Default notice variations

{% highlight html %}
@@ -245,7 +41,7 @@ @Svg.Info
-
+
@Svg.Check
@@ -298,7 +94,7 @@ @Svg.Info
-
- {% header "h3", "Styling child links" %} + {% header "h3", "Styling child links" %}

We recommend using descendent anchor classes, typically .s-anchors.s-anchors__inherit.s-anchors__underlined for notices containing links generated from markdown when you cannot manually generate the inner html.

{% highlight html %} @@ -352,12 +148,10 @@ {% endhighlight %}
- -
- {% header "h2", "Behaviors" %} -
- - - - - - - - - - - {% for item in notices.behavior %} - - - - - - {% endfor %} - -
BehaviorClassApplied toDescription
{{ item.type }} - {{ item.class }} - {% if item.applies == "N/A" %} - {{ item.applies }} - {% else %} - {% assign class = item.applies | split: " " %} + {% header "h2", "Toast" %} + {% tip "warning" %} + We are phasing out Toasts due to significant accessibility barriers. Avoid this component for new features. Instead, prioritize integrated alternatives—such as component state changes or inline messages—to provide accessible feedback directly where the user is focused. + {% endtip %} - {% for name in class %} - {{ name }} - {% endfor %} - {% endif %} - {{ item.description }}
-
- - {% header "h3", "Toast" %}

- Floating notices, but aligned to the top and center of the page and they disappear after a set time. + Toasts are floating notices that are aligned to the center top of the page. They disappear after a set time. Visibility is changed with animation by toggling between aria-hidden="true" and aria-hidden="false". When including a dismiss button the .s-notice--dismiss class should be applied to the button for toast-specific styling. -

- -
-
- -
-
- -
- {% icon "Alert" %} - Usage Warning: We are phasing out Toasts due to significant accessibility barriers. Avoid this component for new features. Instead, prioritize integrated alternatives—such as component state changes or inline messages—to provide accessible feedback directly where the user is focused. -
+

{% highlight html %} @@ -465,5 +218,73 @@ {% endfor %}

+
+ +
+ +
+ + {% header "h3", "JavaScript" %} + + {% header "h4", "Attributes" %} + {% assign docsItems = notices.javascript.attributes %} + {% assign col1Heading = "Attribute" %} + {% assign col1Classes = "s-table--cell5" %} + {% assign col2Heading = "" %} + {% assign tableId = "docs-javascript-attributes-table" %} +
+ {% include "docs-table.html" %} +
+ + {% header "h4", "Events" %} + {% assign docsItems = notices.javascript.events %} + {% assign col1Heading = "Event" %} + {% assign col2Heading = "" %} + {% assign tableId = "docs-javascript-events-table" %} +
+ {% include "docs-table.html" %} +
+ + {% header "h4", "Event details" %} + {% assign docsItems = notices.javascript.eventDetails %} + {% assign col1Heading = "event.detail" %} + {% assign col2Heading = "" %} + {% assign col3Heading = "Applicable events" %} + {% assign tableId = "docs-javascript-event-details-table" %} +
+ {% include "docs-table.html" %}
+ + {% header "h4", "Helpers" "mt48" %} +

+ The following helpers are available to manually show and hide a toast notice. +

+ {% assign docsItems = notices.javascript.helpers %} + {% assign col1Heading = "Function" %} + {% assign col2Heading = "" %} + {% assign col3Heading = "Parameters" %} + {% assign tableId = "docs-javascript-helpers-table" %} + {% include "docs-table.html" %}
+ + + + + \ No newline at end of file diff --git a/packages/stacks-docs/product/components/page-titles.html b/packages/stacks-docs/product/components/page-titles.html index c1ff2c9307..8123de2148 100644 --- a/packages/stacks-docs/product/components/page-titles.html +++ b/packages/stacks-docs/product/components/page-titles.html @@ -6,43 +6,20 @@ ---
- {% header "h2", "Components" %} -
- - - - - - - - - - - - - - - - - - - - - - - - - -
ComponentDescription
Page titleTitle of the page. Refer to the content section of Stacks for things like word choice, naming, and capitalization.
Description OptionalAdditional context for content and actions on the page.
Actions OptionalFree-form area to include buttons, filters, or other HTML content.
Breadcrumbs OptionalBreadcrumbs can be included to provide context for the currently-viewed page.
-
- {% header "h2", "Admin sections" %} -

- These components should be used in the admin sections of our private Q&A products. -

- {% header "h3", "Base Styles" %} -

- The base style for pages that don’t need further description beyond the page title and don’t have any actions for filters. -

+ {% header "h2", "Classes" %} + {% assign docsItems = page-titles.classes %} + {% assign col1Classes = "s-table--cell4" %} + {% assign col2Classes = "s-table--cell3" %} + {% assign col3Heading = "" %} + {% include "docs-table.html" %} +
+ +
+ {% header "h2", "Examples" %} + {% header "h3", "Base example" %} +

The base style for pages that don’t need further description beyond the page title and don’t have any actions for filters.

+ {% assign example = page-titles.example %} +
{% highlight html %}
@@ -51,14 +28,13 @@

Page title

{% endhighlight %}
-

Page title

+

{{ example.title }}

+ {% header "h3", "Title with description" %} -

- A summary of a page’s content. Helpful for large pages with multiple actions. -

+

A summary of a page’s content. Helpful for large pages with multiple actions.

{% highlight html %}
@@ -71,16 +47,15 @@

Page title

-

Page title

-

Optional description de Finibus Bonorum et Malorum with an optional link.

+

{{ example.title }}

+

{{ example.description }}

+ {% header "h3", "Title with actions" %} -

- When a page title includes actions, they are located at the far end of the component. This area is free-form, so we can include any markups we'd like, from single button to a d-flex of custom filters and text. -

+

When a page title includes actions, they are located at the far end of the component. This area is free-form, so we can include any markups we'd like, from single button to a d-flex of custom filters and text.

{% highlight html %}
@@ -94,8 +69,8 @@

Page title

-

Page title

-

Optional description de Finibus Bonorum et Malorum with an optional link.

+

{{ example.title }}

+

{{ example.description }}

@@ -106,10 +81,9 @@

Page title

+ {% header "h3", "Title with breadcrumbs" %} -

- Breadcrumbs are used to provide context for the currently-viewed page and reduce the number of actions a website visitor needs to take in order to get to a higher-level page. Breadcrumbs should not be used for single-level sections that have no logical grouping. -

+

Breadcrumbs are used to provide context for the currently-viewed page and reduce the number of actions a website visitor needs to take in order to get to a higher-level page. Breadcrumbs should not be used for single-level sections that have no logical grouping.

{% highlight html %}
@@ -136,7 +110,7 @@

Page title

-

Page title

+

{{ example.title }}

Optional description de Finibus Bonorum et Malorum with an optional link.

diff --git a/packages/stacks-docs/product/components/pagination.html b/packages/stacks-docs/product/components/pagination.html index 2b964278b0..5eee2feeac 100644 --- a/packages/stacks-docs/product/components/pagination.html +++ b/packages/stacks-docs/product/components/pagination.html @@ -6,35 +6,26 @@ description: Pagination splits content into pages, as seen on questions, tags, users, and jobs listings. tags: components --- +
{% header "h2", "Classes" %} -
- - - - - - - - - - {% for item in pagination-component.classes %} - - - - - - {% endfor %} - -
ClassApplied toDescription
{{ item.class }}{{ item.applies }}{{ item.description }}
-
+ {% assign docsItems = pagination-component.classes %} + {% assign col3Classes = "s-table--cell3" %} + {% include "docs-table.html" %}
+
{% header "h2", "Example" %}
{% highlight html %}
+
- {% header "h2", "Hover tooltips" %} + {% header "h2", "Tooltips" %}

When a popover is intended only for display as an on-hover tooltip and contains no interactive text, the s-tooltip controller can be used in place of s-popover. This is a separate controller that can be used alongside s-popover on a single target element.

- {% header "h3", "Hover attributes" %} -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
AttributeApplied toDescription
id="{POPOVER_ID}".s-popoverA unique id that the popover’s toggling element can target. Matches the value of [aria-describedby] on the toggling element.
data-controller="s-tooltip"Controller elementWires up the element to the tooltip controller.
data-s-tooltip-reference-selector="[css selector]"Controller elementOptional Designates the element to use as the tooltip reference. If left unset, the value defaults to the controller element.
aria-describedby="{POPOVER_ID}"Reference elementAssociates the element to the desired popover element.
title="{TITLE}"Controller elementIf aria-describedby is not present or valid, and the title attribute exists, the title will be removed from the element and be used to create a popover immediately after the element. All content will be escaped and inserted as text.
data-s-tooltip-html-title="{TITLE}"Controller elementActs the exact same as the title attribute, but inserts the raw text directly as html. If both this and the title attribute exist on the element, this attribute will be used.
data-s-tooltip-placement="[placement]"Controller elementDictates where to place the popover in relation to the reference element. By default, the placement value is bottom. Accepted placements are auto, top, right, bottom, left. Each placement can take an additional -start and -end variation.
-
- {% header "h3", "Hover events" %} -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
EventElementDescription
s-tooltip:showController elementDefault preventable Fires immediately before showing and positioning the tooltip. This fires before the tooltip is first displayed to the user, and can be used to create or initialize the tooltip element. Calling .preventDefault() cancels the display of the popover.
s-tooltip:shownController elementFires immediately after showing the tooltip.
s-tooltip:hideController elementDefault preventable Fires immediately before hiding the tooltip. Calling .preventDefault() prevents the removal of the tooltip.
s-tooltip:hiddenController elementFires immediately after hiding the tooltip.
-
-
- - - - - - - - - - - - - - - -
event.detailApplicable eventsDescription
dispatchers-tooltip:*Contains the Element that initiated the event. For instance, the element hovered over to show, etc.
-
- {% header "h3", "Hover examples" %} +
+ {% header "h3", "Tooltip hover attributes" %} + {% assign tableId = "popovers-tooltip-hover-attributes-table" %} + {% assign docsItems = popovers.tooltipHoverAttributes %} + {% assign col1Heading = "Attribute" %} + {% assign col2Heading = "" %} + {% assign col3Heading = "Applied to" %} + {% assign expandableClassesTable = true %} + {% assign expandableBtnText = "Show all tooltip hover attributes" %} + {% include "docs-table.html" %} +
+ +
+ {% header "h3", "Tooltip hover events" %} + {% assign tableId = "popovers-tooltip-hover-events-table" %} + {% assign docsItems = popovers.tooltipHoverEvents %} + {% assign col1Classes = "s-table--cell4" %} + {% assign col1Heading = "Event" %} + {% assign col2Heading = "" %} + {% assign col3Heading = "Element" %} + {% assign expandableClassesTable = true %} + {% assign expandableBtnText = "Show all tooltip hover events" %} + {% include "docs-table.html" %} +
+ +
+ {% header "h3", "Tooltip dispatched events" %} + {% assign tableId = "popovers-tooltip-dispatched-events-table" %} + {% assign docsItems = popovers.tooltipDispatchedEvents %} + {% assign col1Classes = "s-table--cell4" %} + {% assign col1Heading = "Event" %} + {% assign col2Heading = "" %} + {% assign col3Heading = "Element" %} + {% include "docs-table.html" %} +
+
+ +
+ {% header "h2", "Tooltip examples" %}

If the user doesn’t need to interact with the contents of the popover, it may be appropriate to only show it on hover. This will make popovers feel like a tooltip. To do so, we provide an alternative controller, s-tooltip, that shows the tooltip only on hover.

- {% header "h4", "Title attribute" %} -

In the simple case where no markup is needed in the tooltip, the popover element can be omitted and automatically generated using the title attribute.

+
+ {% header "h3", "Title attribute" %} +

In the simple case where no markup is needed in the tooltip, the popover element can be omitted and automatically generated using the title attribute.

-
+
{% highlight html %} {% endhighlight %} -
- +
+ +
-
+
- {% header "h4", "JavaScript configuration (tooltips)" %} -

In cases where the tooltip needs to display simple text or HTML, the popover can be configured using JavaScript. Plain text tooltips will render characters like <, >, and & as is. HTML tooltips will render the HTML as expected.

-
+
+ {% header "h3", "JavaScript configuration (tooltips)" %} +

In cases where the tooltip needs to display simple text or HTML, the popover can be configured using JavaScript. Plain text tooltips will render characters like <, >, and & as is. HTML tooltips will render the HTML as expected.

+
{% highlight javascript %} Stacks.setTooltipText(el, "Plain text tooltip", @@ -526,20 +377,22 @@

Lorem ipsum

placement: "top-end" }); {% endhighlight %} -
- - +
+ + +
-
+
- {% header "h4", "Rich tooltips" %} -

When a rich tooltip is required, a popover element can be configured in much the same way as an s-popover controller, with the most notable difference being the use of aria-describedby instead of aria-controls.

+
+ {% header "h3", "Rich tooltips" %} +

When a rich tooltip is required, a popover element can be configured in much the same way as an s-popover controller, with the most notable difference being the use of aria-describedby instead of aria-controls.

-
+
{% highlight html %}
{% endhighlight %} -
- -
- {% header "h4", "Tooltips and interactive popovers" %} -

Hover tooltips can be used alongside interactive popovers. Tooltips will no appear when the interactive popover is visible.

+
+ {% header "h3", "Tooltips and interactive popovers" %} +

Hover tooltips can be used alongside interactive popovers. Tooltips will no appear when the interactive popover is visible.

-
+
{% highlight html %}
{% endhighlight %} -
- -
+
{% header "h2", "Manual placement" %} {% tip, "warning" %} Our Stimulus popover controller handles the positioning of popovers for you. Popovers can be positioned manually for various legacy reasons, but we recommend using the s-popover controller's placement property instead. {% endtip %} - {% header "h3", "Manual examples" %} -

Popovers can also be positioned manually if you aren’t using the built-in JavaScript interactivity. Practically, this might look like adding something like t8 l8 to .s-popover.

-

By default, popovers are hidden and positioned absolutely. Adding the class .is-visible will show the popover.

-
+
+ {% header "h3", "Manual examples" %} +

Popovers can also be positioned manually if you aren’t using the built-in JavaScript interactivity. Practically, this might look like adding something like t8 l8 to .s-popover.

+

By default, popovers are hidden and positioned absolutely. Adding the class .is-visible will show the popover.

+ +
{% highlight html %}
@@ -649,14 +508,15 @@

Lorem ipsum

{% endhighlight %} -
-
-
-

Example popover with manual placement

+
+
+
+

Example popover with manual placement

+
-
+
diff --git a/packages/stacks-docs/product/components/post-summary.html b/packages/stacks-docs/product/components/post-summary.html index ed021a30ee..e6f38c2769 100644 --- a/packages/stacks-docs/product/components/post-summary.html +++ b/packages/stacks-docs/product/components/post-summary.html @@ -8,33 +8,22 @@
{% header "h2", "Classes" %} -
- - - - - - - - - - {% for item in post-summary.classes %} - - - - - - {% endfor %} - -
ClassParentDescription
{{ item.class }}{{ item.applies }}{{ item.description }}
-
+ {% assign tableId = "post-summary-classes-table" %} + {% assign docsItems = post-summary.classes %} + {% assign col2Classes = "s-table--cell3" %} + {% assign col3Classes = "s-table--cell3" %} + {% assign expandableClassesTable = true %} + {% include "docs-table.html" %}
-{% header "h2", "Examples" %} -{% header "h3", "Base" %}
-

Use the post summary component to provide a concise summary of a question, article, or other content.

-
+ {% header "h2", "Examples" %} + +
+ {% header "h3", "Base" %} + +

Use the post summary component to provide a concise summary of a question, article, or other content.

+
{% highlight html %}
@@ -89,33 +78,35 @@
{% endhighlight %} -
- {% render 'post-summary-item.html' %} -
-
+
+ {% render 'post-summary-item.html' %} +
+
-{% header "h3", "Answered" %} -
-

- Add the .s-post-summary__answered modifier class to indicate that the post has an accepted answer. -

-
+
+ {% header "h3", "Answered" %} + +

+ Add the .s-post-summary__answered modifier class to indicate that the post has an accepted answer. +

+
{% highlight html %}
{% endhighlight %} -
- {% render 'post-summary-item.html', data: post-summary.answered %} -
-
+
+ {% render 'post-summary-item.html', data: post-summary.answered %} +
+
-
- {% header "h3", "Bountied" %} -

- Include the .s-post-summary--stats-bounty element to indicate that the post has a bounty. -

-
+
+ {% header "h3", "Bountied" %} + +

+ Include the .s-post-summary--stats-bounty element to indicate that the post has a bounty. +

+
{% highlight html %}
@@ -142,15 +133,16 @@ …
{% endhighlight %} -
- {% render 'post-summary-item.html', data: post-summary.bountied %} -
-
+
+ {% render 'post-summary-item.html', data: post-summary.bountied %} +
+
-{% header "h3", "Ignored" %} -
-

Including an ignored tag will automatically apply custom ignored styling to the post summary.

-
+
+ {% header "h3", "Ignored" %} + +

Including an ignored tag will automatically apply custom ignored styling to the post summary.

+
{% highlight html %}
… @@ -163,18 +155,19 @@
{% endhighlight %} -
- {% render 'post-summary-item.html', - data: post-summary.ignored - %} +
+ {% render 'post-summary-item.html', + data: post-summary.ignored + %} +
-
-
+
-{% header "h3", "Watched" %} -
-

Including a watched tag will automatically apply custom watched styling to the post summary.

-
+
+ {% header "h3", "Watched" %} + +

Including a watched tag will automatically apply custom watched styling to the post summary.

+
{% highlight html %}
… @@ -187,35 +180,37 @@
{% endhighlight %} -
- {% render 'post-summary-item.html', - data: post-summary.watched - %} +
+ {% render 'post-summary-item.html', + data: post-summary.watched + %} +
-
-
+
-{% header "h3", "Deleted" %} -
-

Include the .s-post-summary__deleted modifier class applies custom deleted styling to the post summary.

-
+
+ {% header "h3", "Deleted" %} + +

Include the .s-post-summary__deleted modifier class applies custom deleted styling to the post summary.

+
{% highlight html %}
{% endhighlight %} -
- {% render 'post-summary-item.html', - data: post-summary.deleted - %} +
+ {% render 'post-summary-item.html', + data: post-summary.deleted + %} +
-
-
+
-{% header "h3", "State badges" %} -
-

Include the appropriate state badge to indicate the current state of the post.

-
+
+ {% header "h3", "State badges" %} + +

Include the appropriate state badge to indicate the current state of the post.

+
{% highlight html %}
@@ -322,20 +317,20 @@
{% endhighlight %} -
- {% for data in post-summary.states %} - {% render 'post-summary-item.html', - data: data - %} - {% endfor %} +
+ {% for data in post-summary.states %} + {% render 'post-summary-item.html', + data: data + %} + {% endfor %} +
-
-
+
-{% header "h3", "Content types" %} -
-

Include the appropriate content type badge to indicate the type of content the post represents.

-
+
+ {% header "h3", "Content types" %} +

Include the appropriate content type badge to indicate the type of content the post represents.

+
{% highlight html %}
@@ -389,42 +384,43 @@
{% endhighlight %} -
- {% for data in post-summary.contentTypes %} - {% render 'post-summary-item.html', data: data %} - {% endfor %} +
+ {% for data in post-summary.contentTypes %} + {% render 'post-summary-item.html', data: data %} + {% endfor %} +
-
-
+
- -{% header "h3", "Excerpt sizes" %} -
- {% header "h4", "Classes" %} -

Post summaries can be shown without an excerpt or with an excerpt with one, two, or three lines of text. Exclude the excerpt container to hide the excerpt or apply the appropriate truncation class to the excerpt container. See also Truncation.

-
- - - - - - - - - {% for item in post-summary.excerptSizes %} - {% if item.excerptLines > 0 %} +
+ {% header "h3", "Excerpt sizes" %} + + {% header "h4", "Classes" %} +

Post summaries can be shown without an excerpt or with an excerpt with one, two, or three lines of text. Exclude the excerpt container to hide the excerpt or apply the appropriate truncation class to the excerpt container. See also Truncation.

+ +
+
ClassDescription
+ - - - - {% endif %} - {% endfor %} - -
.v-truncate{{ item.excerptLines }}Truncates the excerpt to {{ item.excerptLines }} lines of text.
-
+ Class + Description + + + + {% for item in post-summary.excerptSizes %} + {% if item.excerptLines > 0 %} + + .v-truncate{{ item.excerptLines }} + Truncates the excerpt to {{ item.excerptLines }} lines of text. + + {% endif %} + {% endfor %} + + + - {% header "h4", "Examples" %} -
+ {% header "h4", "Examples" %} +
{% highlight html %}
@@ -462,39 +458,39 @@
{% endhighlight %} -
- {% for data in post-summary.excerptSizes %} - {% render 'post-summary-item.html', - data: data - %} - {% endfor %} +
+ {% for data in post-summary.excerptSizes %} + {% render 'post-summary-item.html', + data: data + %} + {% endfor %} +
-
-
+ -{% header "h3", "Small container" %} -
-

Post summaries adapt to their container size. When shown with a container smaller than 448px, the post summary renders with a compact layout.

-
+
+ {% header "h3", "Small container" %} + +

Post summaries adapt to their container size. When shown with a container smaller than 448px, the post summary renders with a compact layout.

+
{% highlight html %}
{% endhighlight %} -
-
- {% for data in post-summary.small %} - {% render 'post-summary-item.html', data: data %} - {% endfor %} +
+
+ {% for data in post-summary.small %} + {% render 'post-summary-item.html', data: data %} + {% endfor %} +
-
-
+
- -{% header "h3", "Answers" %} -
- -

Answers to a question can be shown in a post summary. Include the .s-post-summary--answers container to show the answers.

-

For accepted answers, add the .s-post-summary--answer__accepted modifier class and display the Accepted answer text and icon as shown in the example below.

-
+
+ {% header "h3", "Answers" %} + +

Answers to a question can be shown in a post summary. Include the .s-post-summary--answers container to show the answers.

+

For accepted answers, add the .s-post-summary--answer__accepted modifier class and display the Accepted answer text and icon as shown in the example below.

+
{% highlight html %}
@@ -578,10 +574,11 @@
{% endhighlight %} -
- {% for data in post-summary.withAnswers %} - {% render 'post-summary-item.html', data: data %} - {% endfor %} +
+ {% for data in post-summary.withAnswers %} + {% render 'post-summary-item.html', data: data %} + {% endfor %} +
-
+
diff --git a/packages/stacks-docs/product/components/progress-bars.html b/packages/stacks-docs/product/components/progress-bars.html index fab134d9e9..ff49a7a0a1 100644 --- a/packages/stacks-docs/product/components/progress-bars.html +++ b/packages/stacks-docs/product/components/progress-bars.html @@ -5,133 +5,27 @@ tags: components ---
- {% header "h2", "Classes and parameters" %} -

These are the various classes and parameters used within progress bars.

+ {% header "h2", "Classes" %} + {% assign tableId = "progress-bars-classes-table" %} + {% assign docsItems = progress-bars.classes %} + {% assign col1Classes = "s-table--cell3" %} + {% assign expandableClassesTable = true %} + {% include "docs-table.html" %} +
- {% header "h3", "Classes" %} -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ClassesDescription
.s-progressThe parent class for all progress bars.
.s-progress--barA child element of .s-progress. It shows the user’s current progress to accomplishing a goal with a background color.
.s-progress--labelA child element of .s-progress. It’s used to describe what progress bar is tracking.
.s-progress__brandA modifying class applied to .s-progress, it changes the bar color from green to orange.
.s-progress__infoA modifying class applied to .s-progress, it changes the bar color from green to blue.
.s-progress__circularA modifying class applied to .s-progress, it changes the bar to be a percentage of a circle.
.s-progress__privilegeA modifying class applied to .s-progress, it changes the bar color from green to a lighter green (for legibility reasons).
.s-progress__badgeA modifying class applied to .s-progress, it is applied when a badge progress bar is desired.
.s-progress__goldA modifying class applied to .s-progress__badge, it is used when a gold badge progress bar is desired.
.s-progress__silverA modifying class applied to .s-progress__badge, it is used when a silver badge progress bar is desired.
.s-progress__bronzeA modifying class applied to .s-progress__badge, it is used when a bronze badge progress bar is desired.
.s-progress__segmentedA modifying class applied to .s-progress for a segmented progress bar
.s-progress__steppedA modifying class applied to .s-progress for a stepped progress bar
.s-progress--stepA child of .s-progress__stepped that’s a wrapper for each individual step
.is-activeA modifier .s-progress__step that adds visual styling to the active step.
.is-completedA modifier .s-progress__step that adds visual styling to a completed step.
.s-progress--stopA child of .s-progress__step, the circle that might contain a checkmark if the step’s been completed.
.s-progress--bar__leftA modifier of .s-progress__bar that draws a line on the left side of a step.
.s-progress--bar__rightA modifier of .s-progress__bar that draws a line on the right side of a step.
-
- {% header "h3", "Parameters" %} -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ParameterDescription
role="progressbar"Applied to .s-progress--bar, this parameter communicates that element is displaying progress status that takes a long time or consists of several steps. (Source)
aria-valueminApplied to .s-progress--bar, this parameter defines the minimum allowed value for the progress bar. (Source)
aria-valuemaxApplied to .s-progress--bar, this parameter defines the maximum allowed value for the progress bar. (Source)
aria-valuenowApplied to .s-progress--bar, this parameter defines the current value for the progress bar. (Source)
style="width: [value]%"Applied to .s-progress--bar, this is the aria-valuenow value displayed as a percentage.
-
+
+ {% header "h2", "Parameters" %} + {% assign tableId = "progress-bars-parameters-table" %} + {% assign docsItems = progress-bars.parameters %} + {% assign col1Classes = "s-table--cell4" %} + {% assign col2Heading = "" %} + {% assign col3Classes = "s-table--cell3" %} + {% assign col1Heading = "Parameter" %} + {% assign col3Heading = "Applies to" %} + {% include "docs-table.html" %}
+
{% header "h2", "Base style" %}

Since most progress bars are used to show successful completion of a task, the default fill color is green.

diff --git a/packages/stacks-docs/product/components/prose.html b/packages/stacks-docs/product/components/prose.html index 56e50cb520..6dffe26cf5 100644 --- a/packages/stacks-docs/product/components/prose.html +++ b/packages/stacks-docs/product/components/prose.html @@ -8,26 +8,12 @@ {% assign expandBtnContainerClasses = "ps-sticky bg-white z-popover py16 t64 bb bc-black-200 sm:py8" %}
- {% header "h2", "Classes" %} -
- - - - - - - - - {% for item in components.prose.classes %} - - - - - {% endfor %} - -
ClassOutput
{{ item.class }}{{ item.description }}
-
+ {% header "h2", "Parameters" %} + {% assign docsItems = prose.classes %} + {% assign col2Heading = "" %} + {% include "docs-table.html" %}
+
{% header "h2", "Examples" %} {% header "h3", "Minimal" %} diff --git a/packages/stacks-docs/product/components/radio.html b/packages/stacks-docs/product/components/radio.html index 95660c01b4..b5ce2b3bee 100644 --- a/packages/stacks-docs/product/components/radio.html +++ b/packages/stacks-docs/product/components/radio.html @@ -6,8 +6,16 @@ description: Checkable inputs that visually allow for single selection from multiple options. tags: components --- +
+ {% header "h2", "Classes" %} + {% assign docsItems = checkbox_radio.radio-classes %} + {% assign col1Classes = "s-table--cell4" %} + {% assign col2Heading = "" %} + {% include "docs-table.html" %} +
+
{% header "h2", "Base" %}

Use the .s-radio to wrap input[type="radio"] elements to apply radio styles.

@@ -281,24 +289,10 @@

Radios use the same validation states as inputs.

{% header "h3", "Validation classes" %} -
- - - - - - - - - {% for state in inputs.validation %} - - - - - {% endfor %} - -
ClassDescription
{{ state.class }}{{ state.description }}
-
+ {% assign docsItems = validation-classes %} + {% assign col2Heading = "Applies to" %} + {% assign col3Heading = "" %} + {% include "docs-table.html" %} {% header "h3", "Validation examples" %}
diff --git a/packages/stacks-docs/product/components/select.html b/packages/stacks-docs/product/components/select.html index 61c24dabba..7216a45d64 100644 --- a/packages/stacks-docs/product/components/select.html +++ b/packages/stacks-docs/product/components/select.html @@ -6,6 +6,16 @@ description: A selectable menu list from which a user can make a single selection. Typically they are used when there are more than four possible options. The custom select menu styling is achieved by wrapping the select tag within the .s-select class. tags: components --- + +
+ {% header "h2", "Classes" %} + {% assign docsItems = select.classes %} + {% assign col1Classes = "s-table--cell4" %} + {% assign col3Classes = "s-table--cell3" %} + {% assign col2Heading = "" %} + {% include "docs-table.html" %} +
+
{% header "h2", "Base style" %}
@@ -86,26 +96,10 @@

Validation states provides the user feedback based on their interaction (or lack of interaction) with a select menu. These styles are applied by applying the appropriate class to the wrapping parent container.

{% header "h3", "Validation classes" %} -
- - - - - - - - - - {% for state in inputs.validation %} - - - - - - {% endfor %} - -
ClassAppliesDefinition
{{ state.class }}Parent wrapper for select{{ state.description }}
-
+ {% assign docsItems = validation-classes %} + {% assign col2Heading = "Applies to" %} + {% assign col3Heading = "" %} + {% include "docs-table.html" %} {% header "h3", "Validation examples" %} {% header "h4", "Warning" %} @@ -237,29 +231,11 @@
{% header "h2", "Sizes" %} -
- - - - - - - - - - - {% for item in inputs.select %} - {% assign size = item.sizes %} - {% for item in size %} - - - - - - - {% endfor %} - {% endfor %} - -
NameSizeClassExample
{{ item.name }}{{ item.size }}{% if item.class == "N/A" %}{{ item.class }}{% else %}.{{ item.class }}{% endif %}
-
+ + {% assign docsItems = select.sizes %} + {% assign col2Heading = "Name" %} + {% assign col3Heading = "Size" %} + {% assign col4Heading = "Example" %} + {% assign tableId = "select-sizes-table" %} + {% include "docs-table.html" %}
diff --git a/packages/stacks-docs/product/components/sidebar-widgets.html b/packages/stacks-docs/product/components/sidebar-widgets.html index a230af1516..30d1f9d4c0 100644 --- a/packages/stacks-docs/product/components/sidebar-widgets.html +++ b/packages/stacks-docs/product/components/sidebar-widgets.html @@ -5,6 +5,15 @@ tags: components --- +
+ {% header "h2", "Classes" %} + {% assign docsItems = sidebar-widgets.classes %} + {% assign col1Classes = "s-table--cell4" %} + {% assign col2Classes = "s-table--cell3" %} + {% assign col3Heading = "" %} + {% include "docs-table.html" %} +
+
{% header "h2", "Basic style" %} diff --git a/packages/stacks-docs/product/components/tables.html b/packages/stacks-docs/product/components/tables.html index 4772a6d85b..0260f7153b 100644 --- a/packages/stacks-docs/product/components/tables.html +++ b/packages/stacks-docs/product/components/tables.html @@ -6,6 +6,13 @@ tags: components --- +
+ {% header "h2", "Classes" %} + {% assign docsItems = tables.classes %} + {% assign col2Classes = "s-table--cell3" %} + {% include "docs-table.html" %} +
+
{% header "h2", "Default style" %}

Tables should be wrapped in a container, .s-table-container. This provides horizontal scrolling when necessary in the smallest breakpoints. The default table style is a bordered cell layout with a stylized header row.

@@ -413,22 +420,11 @@ {% header "h2", "Cell widths" %}

Table columns will size themselves based on their content. To set a specific width, you can use one of the following table cell classes to specify the width for any column.

{% header "h3", "Classes" %} - - - - - - - - - {% for item in tables.widths %} - - - - - {% endfor %} - -
ClassWidth
{{ item.class }}{{ item.output }}
+ {% assign docsItems = tables.widths %} + {% assign col2Heading = "Width" %} + {% assign col3Heading = "" %} + {% assign col4Heading = "" %} + {% include "docs-table.html" %} {% header "h3", "Examples" %}
@@ -733,26 +729,10 @@

If the table contains rows that should not be sorted, but rather always be at the top or always be at the bottom, add data-s-table-sort-to="top" or data-s-table-sort-to="bottom" to the <tr> element.

{% header "h3", "JavaScript data attributes" %} -
- - - - - - - - - - {% for item in tables.data-attributes %} - - - - - - {% endfor %} - -
AttributeApplied toDescription
{{ item.attribute }}{{ item.applies }}{{ item.description }}
-
+ {% assign docsItems = tables.data-attributes %} + {% assign col1Classes = "s-table--cell5" %} + {% assign col2Classes = "s-table--cell2" %} + {% include "docs-table.html" %} {% header "h3", "JavaScript example" %}
@@ -1188,22 +1168,10 @@ {% header "h2", "Atomic classes" %}

Further control of table behavior is possible with atomic classes. For example, you can make non-table markup display as a table layout by pairing .d-table, .d-table-cell and .tl-fixed.

-
- - - - - - - - - {% for item in tables.atomic %} - - - - - {% endfor %} - -
ClassOutput
{{ item.class }}{{ item.output }}
-
+ {% assign docsItems = tables.atomic %} + {% assign col1Classes = "s-table--cell2" %} + {% assign col2Heading = "Output" %} + {% assign col3Heading = "" %} + {% assign col4Heading = "" %} + {% include "docs-table.html" %}
diff --git a/packages/stacks-docs/product/components/tags.html b/packages/stacks-docs/product/components/tags.html index ec3ec454bf..6c213fe037 100644 --- a/packages/stacks-docs/product/components/tags.html +++ b/packages/stacks-docs/product/components/tags.html @@ -6,28 +6,14 @@ description: Tags are an interactive, community-generated keyword that allow communities to label, organize, and discover related content. Tags are maintained by their respective communities tags: components --- +
{% header "h2", "Classes" %} -
- - - - - - - - - - {% for item in tags-component.classes %} - - - - - - {% endfor %} - -
ClassApplied toDescription
{{ item.class }}{{ item.applies }}{{ item.description }}
-
+ {% assign docsItems = tags-component.classes %} + {% include "docs-table.html" %} +
+ +
{% header "h2", "Accessibility" %}

Tags should be focusable and navigable with the keyboard. @@ -122,22 +108,9 @@

{% header "h2", "Sizes" %} - - - - - - - - - - {% for item in tags-component.sizes %} - - - - - - {% endfor %} - -
ClassApplied toExample
{% if item.class == "N/A" %}.s-tag{% else %}.{{ item.class }}{% endif %}{% if item.class == "N/A" %}{{ item.class }}{% else %}.s-tag{% endif %}css
+ {% assign docsItems = tags-component.sizes %} + {% assign col2Heading = "" %} + {% assign col3Heading = "Applied to" %} + {% assign col4Heading = "Example" %} + {% include "docs-table.html" %}
\ No newline at end of file diff --git a/packages/stacks-docs/product/components/textarea.html b/packages/stacks-docs/product/components/textarea.html index 8a207cee26..0a2b1730a6 100644 --- a/packages/stacks-docs/product/components/textarea.html +++ b/packages/stacks-docs/product/components/textarea.html @@ -6,7 +6,17 @@ description: Multi-line inputs used by users to enter longer text portions. tags: components --- -
+ +
+ {% header "h2", "Classes" %} + {% assign docsItems = textareas.classes %} + {% assign col2Heading = "" %} + {% assign col1Classes = "s-table--cell4" %} + {% assign col3Classes = "s-table--cell3" %} + {% include "docs-table.html" %} +
+ +
{% header "h2", "Base style" %}
{% highlight html %} @@ -41,26 +51,10 @@

Validation states provides the user feedback based on their interaction (or lack of interaction) with a textarea. These styles are applied by applying the appropriate class to the wrapping parent container.

{% header "h3", "Validation classes" %} -
- - - - - - - - - - {% for state in inputs.validation %} - - - - - - {% endfor %} - -
ClassAppliesDefinition
{{ state.class }}Parent wrapper for textarea{{ state.description }}
-
+ {% assign docsItems = validation-classes %} + {% assign col2Heading = "Applies to" %} + {% assign col3Heading = "" %} + {% include "docs-table.html" %} {% header "h3", "Validation examples" %} {% header "h4", "Warning" %} @@ -138,33 +132,11 @@
{% header "h2", "Sizes" %} -
- - - - - - - - - - - {% for item in inputs.textarea %} - {% assign size = item.sizes %} - {% for item in size %} - - - - - - - {% endfor %} - {% endfor %} - -
NameSizeClassExample
{{ item.name }}{{ item.size }}{% if item.class == "N/A" %}{{ item.class }}{% else %}.{{ item.class }}{% endif %} -
- -
-
-
+ + {% assign docsItems = textareas.sizes %} + {% assign col2Heading = "Name" %} + {% assign col3Heading = "Size" %} + {% assign col4Heading = "Example" %} + {% assign tableId = "textarea-sizes-table" %} + {% include "docs-table.html" %}
diff --git a/packages/stacks-docs/product/components/toggle-switch.html b/packages/stacks-docs/product/components/toggle-switch.html index 2551f0c847..85a0adad40 100644 --- a/packages/stacks-docs/product/components/toggle-switch.html +++ b/packages/stacks-docs/product/components/toggle-switch.html @@ -5,6 +5,16 @@ description: A toggle is used to quickly switch between two or more possible states. They are most commonly used for simple “on/off” switches. tags: components --- + +
+ {% header "h2", "Classes" %} + {% assign docsItems = toggle-switch.classes %} + {% assign col2Heading = "" %} + {% assign col1Classes = "s-table--cell4" %} + {% assign col3Classes = "s-table--cell3" %} + {% include "docs-table.html" %} +
+
{% header "h2", "Styles" %} {% header "h3", "Basic toggle" %} diff --git a/packages/stacks-docs/product/components/topbar.html b/packages/stacks-docs/product/components/topbar.html index 988d03b67d..49a706625e 100644 --- a/packages/stacks-docs/product/components/topbar.html +++ b/packages/stacks-docs/product/components/topbar.html @@ -7,26 +7,10 @@
{% header "h2", "Classes" %} -
- - - - - - - - - - {% for item in topbar %} - - - - - - {% endfor %} - -
ClassApplies toDescription
{{ item.class }}{{ item.applies | default: "N/A" | markdown | newline_to_br }}{{ item.description | markdown }}
-
+ {% assign docsItems = topbar.classes %} + {% assign col2Classes = "s-table--cell3" %} + {% assign expandableClassesTable = true %} + {% include "docs-table.html" %}
diff --git a/packages/stacks-docs/product/components/uploader.html b/packages/stacks-docs/product/components/uploader.html index 59cb1f79f4..f1f614f763 100644 --- a/packages/stacks-docs/product/components/uploader.html +++ b/packages/stacks-docs/product/components/uploader.html @@ -5,90 +5,30 @@ description: The Stacks uploader is a custom-styled file input with added functionality to preview the file or files the user is uploading. tags: components --- +
{% header "h2", "Classes" %} -
- - - - - - - - - - {% for item in uploader-component.classes %} - - - - - - {% endfor %} - -
ClassApplied toDescription
{{ item.class }}{{ item.applies }}{{ item.description }}
-
+ {% assign tableId = "uploader-classes-table" %} + {% assign docsItems = uploader.classes %} + {% assign col2Classes = "s-table--cell3" %} + {% assign expandableClassesTable = true %} + {% include "docs-table.html" %} +
+ +
{% header "h2", "JavaScript" %} + {% header "h3", "Attributes" %} -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
AttributeApplied toDescription
data-controller="s-uploader"Controller elementWires up the element to the uploader controller. This may be a .s-uploader element or a wrapper element.
data-target="s-uploader.uploader".s-uploaderWires up the element containing input, previews, and reset targets.
data-s-uploader-target="input".s-uploader--inputDesignates the file input element.
data-target="s-uploader.previews".s-uploader--previewsDesignates the element to act as a container to file preview(s).
data-action="input->s-uploader#handleInput"input[type=file] elementWires up the element to provide files for preview on change.
data-action="click->s-uploader#reset"Any child elementWires up the element to reset the uploader to its initial state.
data-s-uploader-show-on-inputAny child elementToggles element visibility. Shows when input has value.
data-s-uploader-hide-on-inputAny child elementToggles element visibility. Hides when input has value.
data-s-uploader-enable-on-inputAny child elementToggles element disabled state. Disables when input has no value.
-
+ {% assign tableId = "uploader-attributes-table" %} + {% assign docsItems = uploader.attributes %} + {% assign col1Classes = "s-table--cell4" %} + {% assign col3Classes = "s-table--cell3" %} + {% assign col2Heading = "" %} + {% assign expandableClassesTable = true %} + {% assign expandableBtnText = "Show all attributes" %} + {% include "docs-table.html" %}
+
{% header "h2", "Examples" %}

Including a file input with the class s-uploader--input within s-uploader will provide the correct styling for an upload section.

diff --git a/packages/stacks-docs/product/components/user-cards.html b/packages/stacks-docs/product/components/user-cards.html index 54758d0ebe..03a009930a 100644 --- a/packages/stacks-docs/product/components/user-cards.html +++ b/packages/stacks-docs/product/components/user-cards.html @@ -5,29 +5,17 @@ description: User cards are a combination of a user and metadata about the user or post tags: components --- +
{% header "h2", "Classes" %} -
- - - - - - - - - - {% for item in user-card.classes %} - - - - - - {% endfor %} - -
ClassApplied toDescription
{{ item.class }}{{ item.applies }}{{ item.description }}
-
+ {% assign tableId = "user-cards-classes-table" %} + {% assign docsItems = user-cards.classes %} + {% assign col1Classes = "s-table--cell4" %} + {% assign col2Classes = "s-table--cell3" %} + {% assign expandableClassesTable = true %} + {% include "docs-table.html" %}
+
{% header "h2", "Examples" %} {% header "h3", "Default" %} @@ -77,7 +65,7 @@
{% endhighlight %}
- {% for user in user-card.base %} + {% for user in user-cards.base %} {% endhighlight %}
- {% for user in user-card.with-badges %} + {% for user in user-cards.with-badges %}
@@ -244,32 +232,12 @@
{% header "h3", "Sizes" %} -
- - - - - - - - - - {% for item in user-card.sizes %} - - - - - - {% endfor %} - -
SizeClassDescription
{{ item.size }} - {% if item.class == "N/A" %} - {{ item.class }} - {% else %} - {{ item.class }} - {% endif %} - {{ item.description }}
-
+ {% assign docsItems = user-cards.sizes %} + {% assign tableId = "user-cards-sizes-table" %} + {% assign col2Heading = "" %} + {% assign col3Heading = "Size" %} + {% include "docs-table.html" %} + {% header "h4", "Small" %}
{% highlight html %} @@ -316,7 +284,7 @@
{% endhighlight %}
- {% for user in user-card.small %} + {% for user in user-cards.small %} {% endhighlight %}
- {% for user in user-card.large %} + {% for user in user-cards.large %}
@@ -514,26 +482,14 @@
{% header "h3", "States" %} -
- - - - - - - - - - {% for state in user-card.states %} - - - - - - {% endfor %} - -
StateClassDescription
{{ state.name }}{{ state.class }}{{ state.description }}
-
+ {% assign docsItems = user-cards.states %} + {% assign col1Heading = "Class" %} + {% assign col2Heading = "State" %} + {% assign col1Classes = "s-table--cell4" %} + {% assign col3Heading = "" %} + {% assign tableId = "user-cards-states-table" %} + {% include "docs-table.html" %} + {% header "h4", "Original Poster" %}
{% highlight html %} @@ -576,7 +532,7 @@
{% endhighlight %}
- {% header "h3", "Additional bling" %}

Use to display a specialized icon alongside the username, highlighting unique achievements. This style is additive and can be combined with any of the usercard variants listed above.

-
- - - - - - - - - - {% for bling in user-card.additional-bling %} - - - {% if bling.class == "N/A" %} - - {% else %} - - {% endif %} - - - {% endfor %} - -
NameClassDescription
{{ bling.name }}{{ bling.class }} {{ bling.class }}{{ bling.description }}
-
+ {% header "h3", "Additional bling" %} + {% assign docsItems = user-cards.additional-bling %} + {% assign col2Heading = "Name" %} + {% assign col3Heading = "" %} + {% assign col1Classes = "s-table--cell4" %} + {% include "docs-table.html" %} + {% header "h4", "Recognized Member" %}
{% highlight html %} @@ -912,7 +850,7 @@
{% endhighlight %}