-
Notifications
You must be signed in to change notification settings - Fork 4
feat(select, popover, dropdown): scrolling and layering (#DS-4749) #1442
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
Merged
Changes from 2 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
8a429e3
feat(select, popover, dropdown): scrolling and layering (#DS-4749)
lskramarov df2c6b9
fix: content-security-policy
lskramarov 785978d
fix: after review
lskramarov 6a09182
fix(popover): docs article tune (#DS-4749)
ded9c16
fix: after review
lskramarov cd65ca2
fix: dropdown + popover bug + refactor
lskramarov 3c16990
fix: update golden files
lskramarov 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
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,18 +1,22 @@ | ||
| @let opened = opened$ | async; | ||
|
|
||
| <docs-sidenav | ||
| class="kbq-scrollbar" | ||
| [class.docs-sidenav_closed]="!opened" | ||
| [class.docs-sidenav_opened]="opened" | ||
| [@openCloseSidenav]="opened ? 'open' : 'closed'" | ||
| /> | ||
| @if (isExamplesPage) { | ||
| <router-outlet /> | ||
| } @else { | ||
| <docs-sidenav | ||
| class="kbq-scrollbar" | ||
| [class.docs-sidenav_closed]="!opened" | ||
| [class.docs-sidenav_opened]="opened" | ||
| [@openCloseSidenav]="opened ? 'open' : 'closed'" | ||
| /> | ||
|
|
||
| <div class="docs-app-container layout-column flex"> | ||
| <docs-navbar [class.docs-top-overflown]="docStates.viewerTopOverflown | async" /> | ||
| <div class="docs-app-container layout-column flex"> | ||
| <docs-navbar [class.docs-top-overflown]="docStates.viewerTopOverflown | async" /> | ||
|
|
||
| <kbq-divider /> | ||
| <kbq-divider /> | ||
|
|
||
| <router-outlet /> | ||
| <router-outlet /> | ||
|
|
||
| <div class="docs-overlay" [@fadeInOutSidenav]="opened ? 'fadeIn' : 'fadeOut'"></div> | ||
| </div> | ||
| <div class="docs-overlay" [@fadeInOutSidenav]="opened ? 'fadeIn' : 'fadeOut'"></div> | ||
| </div> | ||
| } |
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
92 changes: 92 additions & 0 deletions
92
apps/docs/src/app/components/popover-example/popover-example.component.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,92 @@ | ||
| import { CdkScrollable } from '@angular/cdk/overlay'; | ||
| import { ChangeDetectionStrategy, Component } from '@angular/core'; | ||
| import { KbqButtonModule } from '@koobiq/components/button'; | ||
| import { KbqPopoverModule } from '@koobiq/components/popover'; | ||
| import { KbqTopBarModule } from '@koobiq/components/top-bar'; | ||
|
|
||
| @Component({ | ||
| selector: 'docs-popover-example', | ||
| imports: [KbqButtonModule, KbqTopBarModule, CdkScrollable, KbqPopoverModule], | ||
| template: ` | ||
| <kbq-top-bar style="z-index: 1000"> | ||
|
artembelik marked this conversation as resolved.
Outdated
|
||
| <div | ||
| class="layout-row layout-align-center-center layout-padding-top-3xs layout-padding-bottom-3xs kbq-title kbq-truncate-line" | ||
| kbqTopBarContainer | ||
| placement="start" | ||
| > | ||
| <span class="kbq-truncate-line">Page Title</span> | ||
| </div> | ||
|
|
||
| <div kbqTopBarSpacer></div> | ||
| </kbq-top-bar> | ||
|
|
||
| <div class="docs-text-container" cdk-scrollable> | ||
| <p> | ||
| A popover is a transient graphical user interface element that appears on top of the current page's | ||
| content to present information, options, or actions related to a specific UI element, which is commonly | ||
| referred to as the trigger. It is designed for quick, contextual interactions without permanently | ||
| navigating away from the current view. | ||
| </p> | ||
|
|
||
| <button kbq-button kbqPopover [kbqPopoverContent]="popoverContent" [hideIfNotInViewPort]="false"> | ||
| Open popover | ||
| </button> | ||
|
|
||
| <p> | ||
| Think of a popover as a lightweight, floating card that is directly tethered to the element that | ||
| summoned it. Unlike a modal dialog, it does not usually block interaction with the rest of the page | ||
| entirely, allowing for a faster and more in-context workflow. It is often activated by clicking a | ||
| button, icon, or link, and it disappears when the user moves their focus away. | ||
| </p> | ||
| <p> | ||
| The core concept of a popover revolves around its contextual and transient nature. It is directly linked | ||
| to a specific UI element on the page, providing information or controls that are immediately relevant to | ||
| that element. It appears temporarily and disappears when the user interacts outside of it or performs an | ||
| action within it, meaning it does not permanently change the main view. Popovers are meant for small, | ||
| focused interactions and should not be used for large, complex forms or displaying extensive amounts of | ||
| information. In its most common form, a popover is non-modal, which means the user can still interact | ||
| with the main page content while the popover is open, though some designs use a light modal scrim to | ||
| provide stronger visual focus. | ||
| </p> | ||
| <p> | ||
| Visually, a typical popover consists of several key parts that work together to create a clear and | ||
| functional interface element. The container is a floating box with a distinct background color, a drop | ||
| shadow to create depth, and often rounded corners. A small visual element, usually a triangle called a | ||
| pointer or arrow, points directly to the UI element that triggered it, creating a clear visual | ||
| connection between the trigger and the content. The content area is the main body of the popover and can | ||
| contain a wide variety of elements such as text labels, simple form elements, lists of actions, icons, | ||
| and short instructions. An optional close button in the corner provides an explicit way to dismiss the | ||
| popover, which is especially important for users with motor impairments or when the popover contains | ||
| important actions, and optional action buttons allow users to perform primary tasks like saving or | ||
| confirming. | ||
| </p> | ||
| </div> | ||
| `, | ||
| styles: ` | ||
| :host { | ||
| display: flex; | ||
| flex-direction: column; | ||
|
|
||
| margin: 0 auto; | ||
| } | ||
|
|
||
| .docs-text-container { | ||
| display: flex; | ||
| flex-direction: column; | ||
|
|
||
| overflow-y: scroll; | ||
|
|
||
| height: 344px; | ||
| padding-left: var(--kbq-size-xl); | ||
| } | ||
|
|
||
| .kbq-button { | ||
| align-self: center; | ||
| } | ||
| `, | ||
| changeDetection: ChangeDetectionStrategy.OnPush | ||
| }) | ||
| export class DocsPopoverExample { | ||
| readonly popoverContent = | ||
| 'Think of a popover as a lightweight, floating window that is directly tethered to the element that summoned it. Unlike a modal dialog, it doesn\'t usually block interaction with the rest of the page entirely, allowing for a faster, more "in-context" workflow. It\'s often activated by clicking a button, icon, or link, and it disappears when the user moves their focus away.'; | ||
| } | ||
113 changes: 113 additions & 0 deletions
113
apps/docs/src/app/components/select-example/select-example.component.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,113 @@ | ||
| import { CdkScrollable } from '@angular/cdk/overlay'; | ||
| import { ChangeDetectionStrategy, Component } from '@angular/core'; | ||
| import { KbqSelectModule } from '@koobiq/components/select'; | ||
| import { KbqTopBarModule } from '@koobiq/components/top-bar'; | ||
|
|
||
| @Component({ | ||
| selector: 'docs-popover-example', | ||
| imports: [KbqTopBarModule, CdkScrollable, KbqSelectModule], | ||
| template: ` | ||
| <kbq-top-bar style="z-index: 1000"> | ||
| <div | ||
| class="layout-row layout-align-center-center layout-padding-top-3xs layout-padding-bottom-3xs kbq-title kbq-truncate-line" | ||
| kbqTopBarContainer | ||
| placement="start" | ||
| > | ||
| <span class="kbq-truncate-line">Page Title</span> | ||
| </div> | ||
|
|
||
| <div kbqTopBarSpacer></div> | ||
| </kbq-top-bar> | ||
|
|
||
| <div class="docs-text-container layout-padding-left-xxl" cdk-scrollable> | ||
| <p> | ||
| The <select> HTML element represents a control that provides a menu of options. The above example | ||
| shows typical <select> usage. It is given an id attribute to enable it to be associated with a | ||
| <label> for accessibility purposes, as well as a name attribute to represent the name of the | ||
| associated data point submitted to the server. Each menu option is defined by an <option> element | ||
| nested inside the <select>. | ||
| </p> | ||
|
|
||
| <kbq-form-field> | ||
| <kbq-select [value]="'Network Watcher'"> | ||
| <kbq-option [value]="'Network Watcher'">Network Watcher</kbq-option> | ||
| <kbq-option [value]="'Firewall Sentinel'">Firewall Sentinel</kbq-option> | ||
| <kbq-option [value]="'Threat Hunter'">Threat Hunter</kbq-option> | ||
| <kbq-option [value]="'Malware Sentry'">Malware Sentry</kbq-option> | ||
| <kbq-option [value]="'Ransomware Shield'">Ransomware Shield</kbq-option> | ||
| <kbq-option [value]="'Network Watcher'">Network Watcher</kbq-option> | ||
| <kbq-option [value]="'Data Breach Guard'">Data Breach Guard</kbq-option> | ||
| <kbq-option [value]="'Endpoint Defender'">Endpoint Defender</kbq-option> | ||
| </kbq-select> | ||
| </kbq-form-field> | ||
|
|
||
| <p> | ||
| The <select> element has some unique attributes you can use to control it, such as multiple to | ||
| specify whether multiple options can be selected, and size to specify how many options should be shown | ||
| at once. It also accepts most of the general form input attributes such as required, disabled, | ||
| autofocus, etc. | ||
| </p> | ||
| <p> | ||
| You can further nest <option> elements inside <optgroup> elements to create separate groups of | ||
| options inside the dropdown. You can also include <hr> elements to create separators that add visual | ||
| breaks between options. | ||
| </p> | ||
| <p> | ||
| In browsers that don't support the modern customization features (or legacy codebases where they can't | ||
| be used), you are limited to manipulating the box model, the displayed font, etc. You can also use the | ||
| appearance property to remove the default system appearance. | ||
| </p> | ||
| <p> | ||
| You can use the :open pseudo-class to style <select> elements in the open state, that is, when the | ||
| drop-down options list is displayed. This doesn't apply to multi-line <select> elements (those with | ||
| the multiple attribute set) — they tend to render as a scrolling list box rather than a drop-down, so | ||
| don't have an open state. | ||
| </p> | ||
| <p> | ||
| A <select> element is represented in JavaScript by an HTMLSelectElement object, and this object has a | ||
| value property which contains the value of the selected <option>. | ||
| </p> | ||
| <p> | ||
| The <select> element has some unique attributes you can use to control it, such as multiple to | ||
| specify whether multiple options can be selected, and size to specify how many options should be shown | ||
| at once. It also accepts most of the general form input attributes such as required, disabled, | ||
| autofocus, etc. | ||
| </p> | ||
| <p> | ||
| Each <option> element should have a value attribute containing the data value to submit to the server | ||
| when that option is selected. If no value attribute is included, the value defaults to the text | ||
| contained inside the element. You can include a selected attribute on an <option> element to make it | ||
| selected by default when the page first loads. If no selected attribute is specified, the first | ||
| <option> element will be selected by default. | ||
| </p> | ||
| </div> | ||
| `, | ||
| styles: ` | ||
| :host { | ||
| display: flex; | ||
| flex-direction: column; | ||
|
|
||
| margin: 0 auto; | ||
| } | ||
|
|
||
| .docs-text-container { | ||
| display: flex; | ||
| flex-direction: column; | ||
|
|
||
| overflow-y: scroll; | ||
|
|
||
| height: 344px; | ||
| padding-left: var(--kbq-size-xl); | ||
| } | ||
|
|
||
| .kbq-form-field { | ||
| width: 320px; | ||
| align-self: center; | ||
| } | ||
| `, | ||
| changeDetection: ChangeDetectionStrategy.OnPush | ||
| }) | ||
| export class DocsSelectExample { | ||
| readonly popoverContent = | ||
| 'Think of a popover as a lightweight, floating window that is directly tethered to the element that summoned it. Unlike a modal dialog, it doesn\'t usually block interaction with the rest of the page entirely, allowing for a faster, more "in-context" workflow. It\'s often activated by clicking a button, icon, or link, and it disappears when the user moves their focus away.'; | ||
| } |
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
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
Oops, something went wrong.
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.