-
Notifications
You must be signed in to change notification settings - Fork 3
fix(radio, toggle): multiline support (#DS-3538) #657
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
Merged
+219
−69
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; | ||
import { DemoModule } from './module'; | ||
import { bootstrapApplication } from '@angular/platform-browser'; | ||
import { provideAnimations } from '@angular/platform-browser/animations'; | ||
import { ToggleDev } from './module'; | ||
|
||
platformBrowserDynamic() | ||
.bootstrapModule(DemoModule) | ||
.catch((error) => console.error(error)); | ||
bootstrapApplication(ToggleDev, { | ||
providers: [ | ||
provideAnimations() | ||
] | ||
}).catch((error) => console.error(error)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,5 @@ | ||
`<kbq-radio>` provides the same functionality as a native `<input type="radio">`. | ||
🚧 **Documentation in progress** 🚧 | ||
artembelik marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
<!-- example(radio-overview) --> | ||
Unfortunately, the documentation for this section is not ready yet. We are actively working on its creation and plan to add it soon. | ||
|
||
### Radio groups | ||
|
||
Radio-buttons should typically be placed inside of an `<kbq-radio-group>` unless the DOM structure | ||
would make that impossible (e.g., radio-buttons inside of table cells). The radio-group has a | ||
`value` property that reflects the currently selected radio-button inside of the group. | ||
|
||
Individual radio-buttons inside of a radio-group will inherit the `name` of the group. | ||
|
||
### Use with @angular/forms | ||
|
||
`<kbq-radio-group>` is compatible with `@angular/forms` and supports both `FormsModule` | ||
and `ReactiveFormsModule`. | ||
|
||
### Accessibility | ||
|
||
The `<kbq-radio-button>` uses an internal `<input type="radio">` to provide an accessible experience. | ||
This internal radio button receives focus and is automatically labelled by the text content of the | ||
`<kbq-radio-button>` element. | ||
If you would like to contribute to the documentation or have any questions, please feel free to [open an issue](https://github.com/koobiq/angular-components/issues) in our GitHub repository. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,7 +27,6 @@ | |
|
||
cursor: pointer; | ||
|
||
white-space: nowrap; | ||
// for maximum clickable area. | ||
width: 100%; | ||
} | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,5 @@ | ||
<!-- example(toggle-overview) --> | ||
|
||
### Многострочный | ||
artembelik marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
<!-- example(toggle-multiline) --> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
packages/docs-examples/components/radio/radio-multiline/radio-multiline-example.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { ChangeDetectionStrategy, Component } from '@angular/core'; | ||
import { KbqFormFieldModule } from '@koobiq/components/form-field'; | ||
import { KbqRadioModule } from '@koobiq/components/radio'; | ||
|
||
type ExampleOption = { label: string; hint: string }; | ||
|
||
/** | ||
* @title Radio multiline example | ||
*/ | ||
@Component({ | ||
standalone: true, | ||
selector: 'radio-multiline-example', | ||
imports: [KbqRadioModule, KbqFormFieldModule], | ||
template: ` | ||
<kbq-radio-group> | ||
@for (option of options; track option) { | ||
<kbq-radio-button [checked]="$first" [value]="$index"> | ||
{{ option.label }} | ||
<kbq-hint>{{ option.hint }}</kbq-hint> | ||
</kbq-radio-button> | ||
} | ||
</kbq-radio-group> | ||
`, | ||
styles: ` | ||
:host { | ||
display: flex; | ||
justify-content: center; | ||
} | ||
|
||
.kbq-radio-group { | ||
max-width: 255px; | ||
} | ||
`, | ||
changeDetection: ChangeDetectionStrategy.OnPush | ||
}) | ||
export class RadioMultilineExample { | ||
readonly options: ExampleOption[] = [ | ||
{ | ||
label: 'Regular software and operating system updates', | ||
hint: 'Updating software and operating systems regularly helps to patch vulnerabilities and enhance security measures against potential threats' | ||
}, | ||
{ | ||
label: 'Using strong and unique passwords', | ||
hint: 'Creating strong and unique passwords for each online account can enhance cybersecurity, as cyber attacks often exploit weak or stolen passwords' | ||
}, | ||
{ | ||
label: 'Implementing multi-factor authentication (MFA)', | ||
hint: 'Multi-factor authentication involves multiple identification forms before account access, reducing the risk of unauthorized access' | ||
} | ||
]; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
packages/docs-examples/components/toggle/toggle-multiline/toggle-multiline-example.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { ChangeDetectionStrategy, Component } from '@angular/core'; | ||
import { KbqFormFieldModule } from '@koobiq/components/form-field'; | ||
import { KbqToggleModule } from '@koobiq/components/toggle'; | ||
|
||
/** | ||
* @title Toggle multiline example | ||
*/ | ||
@Component({ | ||
standalone: true, | ||
selector: 'toggle-multiline-example', | ||
imports: [KbqToggleModule, KbqFormFieldModule], | ||
template: ` | ||
<kbq-toggle> | ||
I accept the security policy terms and acknowledge the responsibility to safeguard sensitive information | ||
<kbq-hint> | ||
Please review our security policy for detailed information about data protection and privacy standards. | ||
By checking this box, you confirm that you understand and agree to comply with all security | ||
requirements. | ||
</kbq-hint> | ||
</kbq-toggle> | ||
`, | ||
styles: ` | ||
:host { | ||
display: flex; | ||
justify-content: center; | ||
} | ||
|
||
.kbq-toggle { | ||
max-width: 400px; | ||
} | ||
`, | ||
changeDetection: ChangeDetectionStrategy.OnPush | ||
}) | ||
export class ToggleMultilineExample {} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.