Skip to content

Commit

Permalink
Docs/1164 toggle group documentation (#1602)
Browse files Browse the repository at this point in the history
* First part of the toggle group documentation

* Accessibility part, code part and some other improvements.

* component status

* Update status

* overview usage content

* Toggle group status changed to preview, moved toggle group usage documentation to the right place.

* Update behaviors of Toggle group

* Added the descriptions and update some names

* removing indentation in the example

* attempt to fix production bug on website

* changeset

* Update toggle-group.ts

* Update code.md

* Update usage.md

* Update accessibility.md

* Fixed Diana's comments

* Update the description

* Update Anatomy

* Update usage.md

* Update website/src/categories/components/toggle-group/accessibility.md

* Update packages/components/toggle-group/src/toggle-group.ts

* Fix text anatomy section and link to toggle btn

---------

Co-authored-by: arecuenco-dsgn <[email protected]>
Co-authored-by: Diana Broeders <[email protected]>
  • Loading branch information
3 people authored Nov 1, 2024
1 parent ac23d84 commit 6866dd0
Show file tree
Hide file tree
Showing 16 changed files with 450 additions and 6,013 deletions.
5 changes: 5 additions & 0 deletions .changeset/orange-feet-protect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sl-design-system/toggle-button': patch
---

Fixed toggling `text-only` attribute.
2 changes: 1 addition & 1 deletion packages/components/toggle-button/src/toggle-button.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export class ToggleButton extends ScopedElementsMixin(LitElement) {

if (changes.has('defaultIcon') || changes.has('hasText') || changes.has('pressedIcon')) {
this.toggleAttribute('icon-only', !this.hasText && !!this.defaultIcon && !!this.pressedIcon);
this.toggleAttribute('text-only', this.hasText && !this.defaultIcon && !this.pressedIcon);
this.toggleAttribute('text-only', !!this.hasText && !this.defaultIcon && !this.pressedIcon);
}

if (changes.has('defaultIcon') || changes.has('pressedIcon')) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Icon.register(

export default {
title: 'Actions/Toggle group',
tags: ['draft'],
tags: ['preview'],
args: {
disabled: false,
multiple: false
Expand Down
13 changes: 7 additions & 6 deletions packages/components/toggle-group/src/toggle-group.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ declare global {
* A component for visually grouping toggle buttons together. By default, this component ensures that only one button
* in the group is active at a time. This behavior can be disabled by setting the `multiple` property.
*
* @slot default - The default slot.
* @slot default - The default slot for toggle buttons.
* For toggle group there is a possibility to use toggle buttons with text only.
*/
export class ToggleGroup extends LitElement {
/** @internal */
Expand All @@ -42,12 +43,12 @@ export class ToggleGroup extends LitElement {
@property({ type: Boolean, reflect: true }) disabled?: boolean;

/**
* By default, only a single toggle button inside the group can be active. This means
* that the group will automatically deactivate the other buttons when one is toggled.
* By default, only a single toggle button inside the group can be active.
* This means that the group will automatically deactivate the other buttons when one is toggled.
*
* If you toggle this property, then multiple buttons can be active at the same time.
* In this case the group does nothing when a button is toggled. Use this mode if you want to
* handle the toggling of buttons yourself.
* When set to true multiple buttons can be active at the same time.
* In this case the group does nothing when a button is toggled.
* Use this mode if you want to handle the toggling of buttons yourself.
*/
@property({ type: Boolean }) multiple?: boolean;

Expand Down
5,967 changes: 0 additions & 5,967 deletions website/src/_data/custom-elements/custom-elements.md

This file was deleted.

62 changes: 31 additions & 31 deletions website/src/_data/tokens/base.json
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@
"sm": {
"value": {
"fontFamily": "{text.typeset.fontFamily.body}",
"fontWeight": "{text.typeset.fontWeight.bold}",
"fontWeight": "{text.typeset.fontWeight.demibold}",
"fontSize": "{text.typeset.fontSize.xs}",
"lineHeight": "{text.typeset.lineHeight.xs}",
"textCase": "{text.typeset.textCase.uppercase}"
Expand All @@ -473,7 +473,7 @@
"md": {
"value": {
"fontFamily": "{text.typeset.fontFamily.body}",
"fontWeight": "{text.typeset.fontWeight.bold}",
"fontWeight": "{text.typeset.fontWeight.demibold}",
"fontSize": "{text.typeset.fontSize.sm}",
"lineHeight": "{text.typeset.lineHeight.sm}",
"textCase": "{text.typeset.textCase.uppercase}"
Expand All @@ -483,7 +483,7 @@
"lg": {
"value": {
"fontFamily": "{text.typeset.fontFamily.body}",
"fontWeight": "{text.typeset.fontWeight.bold}",
"fontWeight": "{text.typeset.fontWeight.demibold}",
"fontSize": "{text.typeset.fontSize.md}",
"lineHeight": "{text.typeset.lineHeight.md}",
"textCase": "{text.typeset.textCase.uppercase}"
Expand All @@ -493,7 +493,7 @@
"xl": {
"value": {
"fontFamily": "{text.typeset.fontFamily.body}",
"fontWeight": "{text.typeset.fontWeight.bold}",
"fontWeight": "{text.typeset.fontWeight.demibold}",
"fontSize": "{text.typeset.fontSize.xl}",
"lineHeight": "{text.typeset.lineHeight.xl}",
"textCase": "{text.typeset.textCase.uppercase}"
Expand All @@ -503,7 +503,7 @@
"2xl": {
"value": {
"fontFamily": "{text.typeset.fontFamily.body}",
"fontWeight": "{text.typeset.fontWeight.bold}",
"fontWeight": "{text.typeset.fontWeight.demibold}",
"fontSize": "{text.typeset.fontSize.2xl}",
"lineHeight": "{text.typeset.lineHeight.2xl}",
"textCase": "{text.typeset.textCase.uppercase}"
Expand All @@ -513,7 +513,7 @@
"3xl": {
"value": {
"fontFamily": "{text.typeset.fontFamily.body}",
"fontWeight": "{text.typeset.fontWeight.bold}",
"fontWeight": "{text.typeset.fontWeight.demibold}",
"fontSize": "{icon.typeset.fontSize.2xl}",
"lineHeight": "{text.typeset.lineHeight.2xl}",
"textCase": "{text.typeset.textCase.uppercase}"
Expand All @@ -523,7 +523,7 @@
"4xl": {
"value": {
"fontFamily": "{text.typeset.fontFamily.body}",
"fontWeight": "{text.typeset.fontWeight.bold}",
"fontWeight": "{text.typeset.fontWeight.demibold}",
"fontSize": "{icon.typeset.fontSize.4xl}",
"lineHeight": "{text.typeset.lineHeight.2xl}",
"textCase": "{text.typeset.textCase.uppercase}"
Expand Down Expand Up @@ -763,7 +763,7 @@
"0": {
"value": {
"fontFamily": "{text.typeset.fontFamily.heading}",
"fontWeight": "{text.typeset.fontWeight.bold}",
"fontWeight": "{text.typeset.fontWeight.demibold}",
"lineHeight": "{text.typeset.lineHeight.4xl}",
"fontSize": "{text.typeset.fontSize.4xl}",
"textDecoration": "{text.typeset.textDecoration.none}",
Expand Down Expand Up @@ -791,7 +791,7 @@
"2": {
"value": {
"fontFamily": "{text.typeset.fontFamily.heading}",
"fontWeight": "{text.typeset.fontWeight.bold}",
"fontWeight": "{text.typeset.fontWeight.demibold}",
"lineHeight": "{text.typeset.lineHeight.2xl}",
"fontSize": "{text.typeset.fontSize.2xl}",
"textDecoration": "{text.typeset.textDecoration.none}",
Expand Down Expand Up @@ -819,7 +819,7 @@
"4": {
"value": {
"fontFamily": "{text.typeset.fontFamily.heading}",
"fontWeight": "{text.typeset.fontWeight.bold}",
"fontWeight": "{text.typeset.fontWeight.demibold}",
"lineHeight": "{text.typeset.lineHeight.lg}",
"fontSize": "{text.typeset.fontSize.lg}",
"textDecoration": "{text.typeset.textDecoration.none}",
Expand Down Expand Up @@ -864,7 +864,7 @@
"bold": {
"value": {
"fontFamily": "{text.typeset.fontFamily.body}",
"fontWeight": "{text.typeset.fontWeight.bold}",
"fontWeight": "{text.typeset.fontWeight.demibold}",
"lineHeight": "{text.typeset.lineHeight.sm}",
"fontSize": "{text.typeset.fontSize.sm}",
"letterSpacing": "{text.typeset.letterSpacing.lg}",
Expand Down Expand Up @@ -908,7 +908,7 @@
"bold": {
"value": {
"fontFamily": "{text.typeset.fontFamily.body}",
"fontWeight": "{text.typeset.fontWeight.bold}",
"fontWeight": "{text.typeset.fontWeight.demibold}",
"lineHeight": "{text.typeset.lineHeight.md}",
"fontSize": "{text.typeset.fontSize.md}",
"letterSpacing": "{text.typeset.letterSpacing.lg}",
Expand Down Expand Up @@ -952,7 +952,7 @@
"bold": {
"value": {
"fontFamily": "{text.typeset.fontFamily.body}",
"fontWeight": "{text.typeset.fontWeight.bold}",
"fontWeight": "{text.typeset.fontWeight.demibold}",
"lineHeight": "{text.typeset.lineHeight.lg}",
"fontSize": "{text.typeset.fontSize.lg}",
"letterSpacing": "{text.typeset.letterSpacing.md}",
Expand Down Expand Up @@ -1259,7 +1259,7 @@
"title": {
"value": {
"fontFamily": "{text.typeset.fontFamily.body}",
"fontWeight": "{text.typeset.fontWeight.bold}",
"fontWeight": "{text.typeset.fontWeight.demibold}",
"lineHeight": "{text.typeset.lineHeight.sm}",
"fontSize": "{text.typeset.fontSize.sm}"
},
Expand All @@ -1271,7 +1271,7 @@
"heading": {
"value": {
"fontFamily": "{text.typeset.fontFamily.heading}",
"fontWeight": "{text.typeset.fontWeight.bold}",
"fontWeight": "{text.typeset.fontWeight.demibold}",
"lineHeight": "{text.typeset.lineHeight.2xl}",
"fontSize": "{icon.typeset.fontSize.xl}"
},
Expand Down Expand Up @@ -1541,7 +1541,7 @@
"sm": {
"value": {
"fontFamily": "{text.typeset.fontFamily.body}",
"fontWeight": "{text.typeset.fontWeight.bold}",
"fontWeight": "{text.typeset.fontWeight.demibold}",
"lineHeight": "{text.typeset.lineHeight.sm}",
"fontSize": "{text.typeset.fontSize.md}"
},
Expand All @@ -1551,7 +1551,7 @@
"md": {
"value": {
"fontFamily": "{text.typeset.fontFamily.body}",
"fontWeight": "{text.typeset.fontWeight.bold}",
"fontWeight": "{text.typeset.fontWeight.demibold}",
"lineHeight": "{text.typeset.lineHeight.lg}",
"fontSize": "{text.typeset.fontSize.lg}"
},
Expand All @@ -1561,7 +1561,7 @@
"lg": {
"value": {
"fontFamily": "{text.typeset.fontFamily.body}",
"fontWeight": "{text.typeset.fontWeight.bold}",
"fontWeight": "{text.typeset.fontWeight.demibold}",
"lineHeight": "{text.typeset.lineHeight.lg}",
"fontSize": "{text.typeset.fontSize.xl}"
},
Expand Down Expand Up @@ -1710,7 +1710,7 @@
"title": {
"value": {
"fontFamily": "{text.typeset.fontFamily.body}",
"fontWeight": "{text.typeset.fontWeight.bold}",
"fontWeight": "{text.typeset.fontWeight.demibold}",
"lineHeight": "{text.typeset.lineHeight.md}",
"fontSize": "{text.typeset.fontSize.md}"
},
Expand Down Expand Up @@ -1767,7 +1767,7 @@
"sm": {
"value": {
"fontFamily": "{text.typeset.fontFamily.body}",
"fontWeight": "{text.typeset.fontWeight.bold}",
"fontWeight": "{text.typeset.fontWeight.demibold}",
"lineHeight": "{button.label.sm}",
"fontSize": "{text.typeset.fontSize.sm}",
"textDecoration": "{text.typeset.textDecoration.none}"
Expand All @@ -1777,7 +1777,7 @@
"md": {
"value": {
"fontFamily": "{text.typeset.fontFamily.body}",
"fontWeight": "{text.typeset.fontWeight.bold}",
"fontWeight": "{text.typeset.fontWeight.demibold}",
"lineHeight": "{button.label.md}",
"fontSize": "{text.typeset.fontSize.md}",
"textDecoration": "{text.typeset.textDecoration.none}"
Expand All @@ -1787,7 +1787,7 @@
"lg": {
"value": {
"fontFamily": "{text.typeset.fontFamily.body}",
"fontWeight": "{text.typeset.fontWeight.bold}",
"fontWeight": "{text.typeset.fontWeight.demibold}",
"lineHeight": "{button.label.lg}",
"fontSize": "{text.typeset.fontSize.lg}",
"textDecoration": "{text.typeset.textDecoration.none}"
Expand All @@ -1799,7 +1799,7 @@
"sm": {
"value": {
"fontFamily": "{text.typeset.fontFamily.body}",
"fontWeight": "{text.typeset.fontWeight.bold}",
"fontWeight": "{text.typeset.fontWeight.demibold}",
"lineHeight": "{button.label.sm}",
"fontSize": "{text.typeset.fontSize.sm}",
"textDecoration": "{text.typeset.textDecoration.underline}"
Expand All @@ -1809,7 +1809,7 @@
"md": {
"value": {
"fontFamily": "{text.typeset.fontFamily.body}",
"fontWeight": "{text.typeset.fontWeight.bold}",
"fontWeight": "{text.typeset.fontWeight.demibold}",
"lineHeight": "{button.label.md}",
"fontSize": "{text.typeset.fontSize.md}",
"textDecoration": "{text.typeset.textDecoration.underline}"
Expand All @@ -1819,7 +1819,7 @@
"lg": {
"value": {
"fontFamily": "{text.typeset.fontFamily.body}",
"fontWeight": "{text.typeset.fontWeight.bold}",
"fontWeight": "{text.typeset.fontWeight.demibold}",
"lineHeight": "{button.label.lg}",
"fontSize": "{text.typeset.fontSize.lg}",
"textDecoration": "{text.typeset.textDecoration.underline}"
Expand All @@ -1831,7 +1831,7 @@
"sm": {
"value": {
"fontFamily": "{text.typeset.fontFamily.body}",
"fontWeight": "{text.typeset.fontWeight.bold}",
"fontWeight": "{text.typeset.fontWeight.demibold}",
"lineHeight": "{button.label.sm}",
"fontSize": "{text.typeset.fontSize.sm}",
"textDecoration": "{text.typeset.textDecoration.underline}"
Expand All @@ -1841,7 +1841,7 @@
"md": {
"value": {
"fontFamily": "{text.typeset.fontFamily.body}",
"fontWeight": "{text.typeset.fontWeight.bold}",
"fontWeight": "{text.typeset.fontWeight.demibold}",
"lineHeight": "{button.label.md}",
"fontSize": "{text.typeset.fontSize.md}",
"textDecoration": "{text.typeset.textDecoration.underline}"
Expand All @@ -1851,7 +1851,7 @@
"lg": {
"value": {
"fontFamily": "{text.typeset.fontFamily.body}",
"fontWeight": "{text.typeset.fontWeight.bold}",
"fontWeight": "{text.typeset.fontWeight.demibold}",
"lineHeight": "{button.label.lg}",
"fontSize": "{text.typeset.fontSize.lg}",
"textDecoration": "{text.typeset.textDecoration.underline}"
Expand All @@ -1863,7 +1863,7 @@
"sm": {
"value": {
"fontFamily": "{text.typeset.fontFamily.body}",
"fontWeight": "{text.typeset.fontWeight.bold}",
"fontWeight": "{text.typeset.fontWeight.demibold}",
"lineHeight": "{button.label.sm}",
"fontSize": "{text.typeset.fontSize.sm}",
"textDecoration": "{text.typeset.textDecoration.none}"
Expand All @@ -1873,7 +1873,7 @@
"md": {
"value": {
"fontFamily": "{text.typeset.fontFamily.body}",
"fontWeight": "{text.typeset.fontWeight.bold}",
"fontWeight": "{text.typeset.fontWeight.demibold}",
"lineHeight": "{button.label.md}",
"fontSize": "{text.typeset.fontSize.md}",
"textDecoration": "{text.typeset.textDecoration.none}"
Expand All @@ -1883,7 +1883,7 @@
"lg": {
"value": {
"fontFamily": "{text.typeset.fontFamily.body}",
"fontWeight": "{text.typeset.fontWeight.bold}",
"fontWeight": "{text.typeset.fontWeight.demibold}",
"lineHeight": "{button.label.lg}",
"fontSize": "{text.typeset.fontSize.lg}",
"textDecoration": "{text.typeset.textDecoration.none}"
Expand Down
4 changes: 2 additions & 2 deletions website/src/_data/tokens/core.json
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@
},
"space": {
"none": {
"value": "0",
"value": "0px",
"type": "spacing",
"description": "space.none"
},
Expand Down Expand Up @@ -2364,7 +2364,7 @@
"heading": {
"value": {
"fontFamily": "{text.typeset.fontFamily.heading}",
"fontWeight": "{text.typeset.fontWeight.bold}",
"fontWeight": "{text.typeset.fontWeight.demibold}",
"lineHeight": "{text.typeset.lineHeight.md}",
"fontSize": "{icon.typeset.fontSize.md}"
},
Expand Down
Loading

0 comments on commit 6866dd0

Please sign in to comment.