Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge #4

Merged
merged 43 commits into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
fbdf0c0
Merge pull request #457 from learningequality/release-v1.5.x
MisRob Sep 28, 2023
2b44dbf
Merge remote-tracking branch 'upstream/develop' into develop
muditchoudhary Mar 29, 2024
7a2c1ad
Merge remote-tracking branch 'upstream/develop' into develop
muditchoudhary Jun 1, 2024
dd6a483
Add new KRadioButtonGroup Component
muditchoudhary Jun 3, 2024
ea5a9f1
Add setTabIndex method to set tab index on each radio component
muditchoudhary Jun 3, 2024
6100a15
Add test for KRadioButtonGroup component
muditchoudhary Jun 4, 2024
eb9c801
Add docs for KRadioButtonGroup
muditchoudhary Jun 4, 2024
fddf31e
Update tableOfContents
muditchoudhary Jun 4, 2024
afcd18f
Merge remote-tracking branch 'upstream/develop' into develop
muditchoudhary Jun 19, 2024
4b0688a
Add new KRadioButtonGroup Component
muditchoudhary Jun 3, 2024
87a3928
Add setTabIndex method to set tab index on each radio component
muditchoudhary Jun 3, 2024
ebaf9cb
Add test for KRadioButtonGroup component
muditchoudhary Jun 4, 2024
a8c1951
Add docs for KRadioButtonGroup
muditchoudhary Jun 4, 2024
3f2d8ea
Update tableOfContents
muditchoudhary Jun 4, 2024
b1d09dc
Fix: fix tab issue for change language model
muditchoudhary Jun 19, 2024
220eacf
Merge remote-tracking branch 'origin/KRadioButtonGroup-Component' int…
muditchoudhary Jun 19, 2024
29f339a
Update KRadioButtonGroup component
muditchoudhary Jun 20, 2024
73e8e76
fix lint
muditchoudhary Jul 10, 2024
df58010
Change keydown event with keyup event
muditchoudhary Jul 10, 2024
0e9be90
fix lint
muditchoudhary Jul 10, 2024
adb42c0
Fix some logics in KRadioButtonGroup, fix tests
muditchoudhary Aug 7, 2024
60d0b3d
Merge branch 'develop' into KRadioButtonGroup-Component
muditchoudhary Aug 8, 2024
3004607
Fix queryAndAddRadioBtns recursive logic and rename methods name
muditchoudhary Aug 17, 2024
c3e9712
Merge remote-tracking branch 'origin/KRadioButtonGroup-Component' int…
muditchoudhary Aug 17, 2024
b1b1816
Merge branch 'develop' into KRadioButtonGroup-Component
MisRob Aug 21, 2024
1fa0a0b
Update CHANGELOG.md
MisRob Aug 21, 2024
46566e4
Update documentation
MisRob Aug 21, 2024
fb4c3cf
Merge branch 'develop' into KRadioButtonGroup-Component
MisRob Aug 21, 2024
37272a8
Update documentation
MisRob Aug 21, 2024
bdea254
Add another example to docs
MisRob Aug 21, 2024
8fd5d35
Merge pull request #650 from muditchoudhary/KRadioButtonGroup-Component
MisRob Aug 26, 2024
f4752af
Removed the border-radius on align left
Aug 26, 2024
f693a2c
Added some logic to keep borderRadius
Aug 26, 2024
6e9b26e
fixes lint
AllanOXDi Aug 27, 2024
cd60a91
Update CHANGELOG.md
Spoorthy1423 Aug 27, 2024
3d60c67
Update CHANGELOG.md
Spoorthy1423 Aug 27, 2024
6361230
Update CHANGELOG.md
Spoorthy1423 Aug 27, 2024
a3d91b2
Update CHANGELOG.md
Spoorthy1423 Aug 27, 2024
5aa3d5e
Update CHANGELOG.md
Spoorthy1423 Aug 27, 2024
5092490
Merge pull request #754 from Spoorthy1423/issue-741-resolve
MisRob Aug 27, 2024
3bfd2f7
Bump KDS version to 5.0.0-rc3
AlexVelezLl Aug 27, 2024
015325c
Merge pull request #757 from AlexVelezLl/release-v5-prep
AlexVelezLl Aug 27, 2024
186ea35
Merge branch 'gsoc-table-develop' into main
BabyElias Aug 28, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,38 @@ Changelog is rather internal in nature. See release notes for the public overvie

## Upcoming version 5.x.x (`develop` branch)

- [#753]
- **Description:** Bump KDS version to 5.0.0-rc3.
- **Products impact:** -.
- **Addresses:** -.
- **Components:** -.
- **Breaking:** -.
- **Impacts a11y:** -.
- **Guidance:** -.

[#753]: https://github.com/learningequality/kolibri-design-system/pull/753

- [#754]
- **Description:** Removed the border-radius on align left.
- **Products impact:** bugfix.
- **Addresses:** https://github.com/learningequality/kolibri-design-system/issues/741
- **Components:** `KCard`
- **Breaking:** no -.
- **Impacts a11y:** no -.
- **Guidance:** -

[#741]: https://github.com/learningequality/kolibri-design-system/pull/751

- [#650]
- **Description:** Add `KRadioButtonGroup` component to fix keyboard navigation in radio button groups in Firefox
- **Products impact:** New API
- **Addresses:** https://github.com/learningequality/kolibri/issues/10491
- **Components:** `KRadioButtonGroup`
- **Breaking:** no
- **Impacts a11y:** yes
- **Guidance:** Make sure that all `KRadioButton`s are wrapped in `KRadioButtonGroup`

[#650]: https://github.com/learningequality/kolibri-design-system/pull/650


[#727]
Expand Down
169 changes: 141 additions & 28 deletions docs/pages/kradiobutton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,143 @@

<DocsPageTemplate apiDocs>
<DocsPageSection title="Overview" anchor="#overview">
<p>
This is a radio button component:
</p>
<p>A radio button is used to make a single selection from a group of options. Radio buttons should be used instead of checkboxes if only one option can be selected.</p>

<p><code>KRadioButton</code>'s are always be wrapped in <DocsLibraryLink component="KRadioButtonGroup" />.</p>
</DocsPageSection>

<DocsPageSection title="Usage" anchor="#usage">
<DocsShow>
<KRadioButton
v-model="exampleValue"
label="Option A"
value="val-a"
/>
<KRadioButton
v-model="exampleValue"
label="Option B"
value="val-b"
/>
<KRadioButton
v-model="exampleValue"
label="Option C"
description="This one is special!"
buttonValue="val-c"
/>
<KRadioButton
v-model="exampleValue"
label="Truncated label. Adjusting your browser window size to see this in action."
buttonValue="val-d"
truncateLabel
/>
<KRadioButtonGroup>
<KRadioButton
v-model="exampleValue"
label="Option A"
buttonValue="val-a"
/>
<KRadioButton
v-model="exampleValue"
label="Option B"
buttonValue="val-b"
/>
<KRadioButton
v-model="exampleValue"
label="Option C"
description="This one is special!"
buttonValue="val-c"
/>
<KRadioButton
v-model="exampleValue"
label="Truncated label. Adjusting your browser window size to see this in action."
buttonValue="val-d"
truncateLabel
/>
</KRadioButtonGroup>
<p>
Current value: {{ exampleValue }}
</p>
</DocsShow>
<p>
A radio button is used to make a single selection from a group of options. Radio buttons should be used instead of checkboxes if only one option can be selected.
</p>

<DocsShowCode language="html">
<KRadioButtonGroup>
<KRadioButton
v-model="exampleValue"
label="Option A"
buttonValue="val-a"
/>
<KRadioButton
v-model="exampleValue"
label="Option B"
butonValue="val-b"
/>
<KRadioButton
v-model="exampleValue"
label="Option C"
description="This one is special!"
buttonValue="val-c"
/>
<KRadioButton
v-model="exampleValue"
label="Truncated label. Adjusting your browser window size to see this in action."
buttonValue="val-d"
truncateLabel
/>
</KRadioButtonGroup>
</DocsShowCode>

<h3>With grid layout</h3>

<p>It is possible to use radio buttons together with grid layout components such as <DocsLibraryLink component="KGrid" /> or <DocsLibraryLink component="KFixedGrid" />. For example: </p>

<DocsShow>

<KRadioButtonGroup>
<KFixedGrid :numCols="2">
<KFixedGridItem :span="1">
<KRadioButton
v-model="exampleValue"
label="Option A"
buttonValue="val-a"
/>
<KRadioButton
v-model="exampleValue"
label="Option B"
buttonValue="val-b"
/>
</KFixedGridItem>
<KFixedGridItem :span="1">
<KRadioButton
v-model="exampleValue"
label="Option C"
description="This one is special!"
buttonValue="val-c"
/>
<KRadioButton
v-model="exampleValue"
label="Truncated label. Adjusting your browser window size to see this in action."
buttonValue="val-d"
truncateLabel
/>
</KFixedGridItem>
</KFixedGrid>
</KRadioButtonGroup>

<p>
Current value: {{ exampleValue }}
</p>
</DocsShow>

<DocsShowCode language="html">
<KRadioButtonGroup>
<KFixedGrid :numCols="2">
<KFixedGridItem :span="1">
<KRadioButton
v-model="exampleValue"
label="Option A"
buttonValue="val-a"
/>
<KRadioButton
v-model="exampleValue"
label="Option B"
buttonValue="val-b"
/>
</KFixedGridItem>
<KFixedGridItem :span="1">
<KRadioButton
v-model="exampleValue"
label="Option C"
description="This one is special!"
buttonValue="val-c"
/>
<KRadioButton
v-model="exampleValue"
label="Truncated label. Adjusting your browser window size to see this in action."
buttonValue="val-d"
truncateLabel
/>
</KFixedGridItem>
</KFixedGrid>
</KRadioButtonGroup>
</DocsShowCode>
</DocsPageSection>

<DocsPageSection title="Layout" anchor="#layout">
Expand All @@ -56,11 +160,20 @@

<DocsPageSection title="Guidelines" anchor="#guidelines">
<ul>
<li>Always wrap <code>KRadioButton</code> group in <DocsLibraryLink component="KRadioButtonGroup" /></li>
<li>There must always be exactly one radio button selected within a group</li>
<li>If the user is allowed to not select any of the options, provide a "None" option</li>
<li>By default, the first radio option is selected, but may be configured to have any option preselected</li>
</ul>
</DocsPageSection>

<DocsPageSection title="Related" anchor="#related">
<ul>
<li>
<DocsLibraryLink component="KRadioButtonGroup" /> ensures <code>KRadioButton</code> groups are accessible in all supported browsers.
</li>
</ul>
</DocsPageSection>
</DocsPageTemplate>

</template>
Expand Down
13 changes: 13 additions & 0 deletions docs/pages/kradiobuttongroup.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<template>

<DocsPageTemplate :apiDocs="true">

<DocsPageSection title="Overview" anchor="#overview">
<p>
Ensures <code>KRadioButton</code> groups are accessible in all supported browsers. Refer to <DocsLibraryLink component="KRadioButton" /> for more.
</p>
</DocsPageSection>

</DocsPageTemplate>

</template>
5 changes: 5 additions & 0 deletions docs/tableOfContents.js
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,11 @@ export default [
title: 'KListWithOverflow',
isCode: true,
}),
new Page({
path: '/kradiobuttongroup',
title: 'KRadioButtonGroup',
isCode: true,
}),
new Page({
path: '/kcard',
title: 'KCard',
Expand Down
15 changes: 7 additions & 8 deletions lib/KCard/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -247,13 +247,13 @@
return this.stylesAndClasses.thumbnailAlignClass;
},
/*
Returns dynamic classes and few style-like data that CSS was cumbersome/impossible to use for ,or are in need of using theme, grouped by all possible combinations of layouts.
Returns dynamic classes and few style-like data that CSS was cumbersome/impossible to use for ,or are in need of using theme, grouped by all possible combinations of layouts.

New styles and classes are meant to be added to this single-source-of-truth object so
that we can easily locate all styling being applied to a particular layout
New styles and classes are meant to be added to this single-source-of-truth object so
that we can easily locate all styling being applied to a particular layout

Could be further simplified by using solely dynamic styles, but that would have detrimental effects on our auto RTL machinery and we would need to take care manually of more places.
*/
Could be further simplified by using solely dynamic styles, but that would have detrimental effects on our auto RTL machinery and we would need to take care manually of more places.
*/
stylesAndClasses() {
/* In px. Needs to be the same as $spacer variable in styles part */
const SPACER = 24;
Expand All @@ -266,7 +266,6 @@
width: '100%',
height: '100%',
};

if (this.layout === 'vertical' && this.thumbnailDisplay === 'large') {
return {
rootClass: 'vertical-with-large-thumbnail',
Expand Down Expand Up @@ -316,11 +315,11 @@
thumbnailAspectRatio: undefined,
headingStyles: {
...headingCommonStyles,
width: `calc(60% - ${SPACER * 2}px)` /* same as slots width defined in styles */,
width: `calc(60% - ${SPACER * 2}px)`, // same as slots width defined in styles
},
thumbnailStyles: {
...thumbnailCommonStyles,
borderRadius: '8px 0 0 8px',
borderRadius: this.thumbnailAlign === 'right' ? '0 8px 8px 0' : '8px 0 0 8px',
},
};
}
Expand Down
19 changes: 18 additions & 1 deletion lib/KRadioButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
ref="input"
v-autofocus="autofocus"
type="radio"
:tabindex="tabIndex"
class="k-radio-button-input"
:checked="isChecked"
:value="buttonValue !== null ? buttonValue : value"
Expand Down Expand Up @@ -71,7 +72,9 @@
};

/**
* Used to display all options
* Used to display radio buttons.
*
* To be used within `KRadioButtonGroup`.
*/
export default {
name: 'KRadioButton',
Expand Down Expand Up @@ -148,6 +151,7 @@
},
data: () => ({
active: false,
tabIndex: 0,
}),
computed: {
isChecked() {
Expand Down Expand Up @@ -183,6 +187,12 @@
}
},
methods: {
/**
* Toggles the check state of the radio button.
*
* @public
* @param {Event} event - The event object.
*/
toggleCheck(event) {
if (!this.disabled) {
this.focus();
Expand Down Expand Up @@ -220,6 +230,13 @@
*/
this.$emit('blur');
},
/**
* @public
* Sets `tab-index` on input
*/
setTabIndex(val) {
this.tabIndex = val;
},
},
};

Expand Down
Loading
Loading