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

feature/select #70

Merged
merged 57 commits into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
b191adf
feat(select): adds functional select brain/hlm cmps/directives
thatsamsonkid Dec 5, 2023
108db4f
feat(label): adds label brain
thatsamsonkid Dec 5, 2023
e2a95ab
feat(select): brain select component refinement
thatsamsonkid Dec 7, 2023
9c2b610
feat(label): brain label component
thatsamsonkid Dec 20, 2023
c4f5a8a
feat: adds directives for scrolling select elements
thatsamsonkid Jan 2, 2024
d48d7bb
chore: select cypress init
thatsamsonkid Jan 2, 2024
53b29e3
refactor: change brn-select-content to component
thatsamsonkid Jan 2, 2024
9f3e357
refactor: adds helm selectors to brn-select, brn-select-value
thatsamsonkid Jan 2, 2024
847f05d
feat: adds helm select directive
thatsamsonkid Jan 2, 2024
6a38cac
fix: helm select content directive with brn refactor
thatsamsonkid Jan 2, 2024
50e4eef
fix: updates select stories
thatsamsonkid Jan 2, 2024
9d05cce
fix(select): missing brn export
thatsamsonkid Jan 17, 2024
e3cb439
fix(select): incorrect setter
thatsamsonkid Jan 17, 2024
fe640e6
fix(select): removes tw class from brn-select-content
thatsamsonkid Jan 17, 2024
1cc23b6
fix(select): removes unused code
thatsamsonkid Jan 17, 2024
7996776
fix(select): tw scroll class
thatsamsonkid Jan 17, 2024
c21324c
feat(select): add brn-select-up/down
thatsamsonkid Jan 23, 2024
f61a044
feat(select): add hlm select-scroll-up/down
thatsamsonkid Jan 23, 2024
9309b14
fix(select): clear selected when multi changes from true to false
thatsamsonkid Jan 23, 2024
f97bdd0
fix(select): change detection issue with selected options
thatsamsonkid Jan 23, 2024
a1642f8
feat(select): show/hide scroll up/down
thatsamsonkid Jan 23, 2024
dd3d3a3
fix(select): hide scrollbar
thatsamsonkid Jan 25, 2024
8053b91
feat(select): add arrow scroll up/down
thatsamsonkid Jan 27, 2024
0439461
fix(select): dropdown border dark mode
thatsamsonkid Jan 28, 2024
bccc45d
feat(select): select-trigger custom icon
thatsamsonkid Jan 28, 2024
ed1052b
fix(select): option checkmark location
thatsamsonkid Jan 28, 2024
900da59
fix(label): add getter for id
thatsamsonkid Jan 28, 2024
3b3404d
feat(select): brn group and label
thatsamsonkid Jan 28, 2024
c0ef9a1
feat(select): helm select group and label
thatsamsonkid Jan 28, 2024
2477f78
fix(select): update scrollable story
thatsamsonkid Jan 28, 2024
0004f2f
fix(select): selected options value display
thatsamsonkid Jan 28, 2024
232ef1c
fix(select): multiple value update and selection display
thatsamsonkid Jan 28, 2024
77cfdd3
fix(select): service deselect all options fix
thatsamsonkid Jan 28, 2024
04b0424
fix(select): log clean up
thatsamsonkid Jan 28, 2024
8a263f6
feat(select): sticky labels
thatsamsonkid Jan 28, 2024
67def14
fix(select): multi value selection indentation issue
thatsamsonkid Jan 28, 2024
1d66bf3
refactor: brn-select-content
thatsamsonkid Jan 30, 2024
8283131
fix(select): select ada label and value reading
thatsamsonkid Feb 1, 2024
f53afb6
docs(select): add the select page with preview and examples
elite-benni Jan 30, 2024
b318576
docs(select): use the correct formcontrolname in srcollable select
elite-benni Jan 31, 2024
199c0ee
fix(select): allow select to function without explicit ngControl
thatsamsonkid Feb 2, 2024
5cd9f9d
fix(select): storybook cleanup
thatsamsonkid Feb 2, 2024
852b8be
feat: minor code style improvements and a couple more. see below
goetzrobin Feb 2, 2024
4c16fbf
fix(select): testing surfaced issues
thatsamsonkid Feb 14, 2024
54578a8
fix: ts config formatting
thatsamsonkid Feb 14, 2024
abbf382
feat(select): initial tests
thatsamsonkid Feb 14, 2024
aaf4431
docs(select): remove formcontrol from examples and preview
elite-benni Feb 15, 2024
1615218
feat(select): support for dir
thatsamsonkid Feb 19, 2024
cfa2a55
feat(select): additional tests
thatsamsonkid Feb 19, 2024
1bddddc
Merge pull request #6 from elite-benni/feature/select
thatsamsonkid Feb 19, 2024
71faa1d
docs: border css rule
thatsamsonkid Feb 19, 2024
32fb66e
fix: turn up and down into components and import the icons in there
goetzrobin Feb 20, 2024
913ee4f
fix: add border classes and allow classnames passed to hlm-select
goetzrobin Feb 20, 2024
457f29e
fix: make focus return to trigger when dropdown closed & minor code s…
goetzrobin Feb 20, 2024
fab9ed9
docs: minor improvements to select documentation & examples
goetzrobin Feb 20, 2024
bac9dd1
Merge pull request #7 from goetzrobin/feature/select-pr-review
thatsamsonkid Feb 20, 2024
c2d1e75
fix: remove unneeded border color rule
thatsamsonkid Feb 21, 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
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export const routeMeta: RouteMeta = {
</div>

<spartan-page-bottom-nav>
<spartan-page-bottom-nav-link href="separator" label="Separator" />
<spartan-page-bottom-nav-link href="select" label="Select" />
<spartan-page-bottom-nav-link direction="previous" href="radio-group" label="Radio Group" />
</spartan-page-bottom-nav>
</section>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import { Component } from '@angular/core';
import { provideIcons } from '@ng-icons/core';
import { radixChevronDown, radixChevronUp } from '@ng-icons/radix-icons';
import { BrnSelectImports } from '@spartan-ng/ui-select-brain';
import { HlmSelectImports } from '@spartan-ng/ui-select-helm';

@Component({
selector: 'spartan-select-multiple-preview',
standalone: true,
imports: [BrnSelectImports, HlmSelectImports],
providers: [provideIcons({ radixChevronUp, radixChevronDown })],
template: `
<brn-select class="inline-block" placeholder="Select some fruit" [multiple]="true">
<hlm-select-trigger class="w-56">
<hlm-select-value />
</hlm-select-trigger>
<hlm-select-content class="w-56">
<hlm-option value="Apples">Apples</hlm-option>
<hlm-option value="Bananas">Bananas</hlm-option>
<hlm-option value="Pears">Pears</hlm-option>
<hlm-option value="Strawberries">Strawberries</hlm-option>
</hlm-select-content>
</brn-select>
`,
})
export class SelectMultiplePreviewComponent {}

export const multipleCode = `
import { Component } from '@angular/core';
import { provideIcons } from '@ng-icons/core';
import { radixChevronDown, radixChevronUp } from '@ng-icons/radix-icons';
import { BrnSelectImports } from '@spartan-ng/ui-select-brain';
import { HlmSelectImports } from '@spartan-ng/ui-select-helm';

@Component({
selector: 'spartan-select-multiple-preview',
standalone: true,
imports: [BrnSelectImports, HlmSelectImports],
providers: [provideIcons({ radixChevronUp, radixChevronDown })],
template: \`
<brn-select class="inline-block" placeholder="Select some fruit" [multiple]="true">
<hlm-select-trigger class="w-56">
<hlm-select-value />
</hlm-select-trigger>
<hlm-select-content class="w-56">
<hlm-option value="Apples">Apples</hlm-option>
<hlm-option value="Bananas">Bananas</hlm-option>
<hlm-option value="Pears">Pears</hlm-option>
<hlm-option value="Strawberries">Strawberries</hlm-option>
</hlm-select-content>
</brn-select>
\`,
})
export class SelectMultiplePreviewComponent {}
`;
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
import { Component } from '@angular/core';
import { BrnSelectImports } from '@spartan-ng/ui-select-brain';
import { HlmSelectImports } from '@spartan-ng/ui-select-helm';

@Component({
selector: 'spartan-select-scrollable-preview',
standalone: true,
imports: [BrnSelectImports, HlmSelectImports],
template: `
<hlm-select scrollable="true" placeholder="Select a timezone">
<hlm-select-trigger class="w-[280px]">
<hlm-select-value />
</hlm-select-trigger>
<hlm-select-content class="min-w-content max-h-96">
<hlm-select-scroll-up />

<hlm-select-group>
<hlm-select-label>North America</hlm-select-label>
<hlm-option value="est">Eastern Standard Time (EST)</hlm-option>
<hlm-option value="cst">Central Standard Time (CST)</hlm-option>
<hlm-option value="mst">Mountain Standard Time (MST)</hlm-option>
<hlm-option value="pst">Pacific Standard Time (PST)</hlm-option>
<hlm-option value="akst">Alaska Standard Time (AKST)</hlm-option>
<hlm-option value="hst">Hawaii Standard Time (HST)</hlm-option>
</hlm-select-group>

<hlm-select-group>
<hlm-select-label>Europe & Africa</hlm-select-label>
<hlm-option value="gmt">Greenwich Mean Time (GMT)</hlm-option>
<hlm-option value="cet">Central European Time (CET)</hlm-option>
<hlm-option value="eet">Eastern European Time (EET)</hlm-option>
<hlm-option value="west">Western European Summer Time (WEST)</hlm-option>
<hlm-option value="cat">Central Africa Time (CAT)</hlm-option>
<hlm-option value="eat">East Africa Time (EAT)</hlm-option>
</hlm-select-group>

<hlm-select-group>
<hlm-select-label>Asia</hlm-select-label>
<hlm-option value="msk">Moscow Time (MSK)</hlm-option>
<hlm-option value="ist">India Standard Time (IST)</hlm-option>
<hlm-option value="cst_china">China Standard Time (CST)</hlm-option>
<hlm-option value="jst">Japan Standard Time (JST)</hlm-option>
<hlm-option value="kst">Korea Standard Time (KST)</hlm-option>
<hlm-option value="ist_indonesia">Indonesia Central Standard Time (WITA)</hlm-option>
</hlm-select-group>

<hlm-select-group>
<hlm-select-label>Australia & Pacific</hlm-select-label>
<hlm-option value="awst">Australian Western Standard Time (AWST)</hlm-option>
<hlm-option value="acst">Australian Central Standard Time (ACST)</hlm-option>
<hlm-option value="aest">Australian Eastern Standard Time (AEST)</hlm-option>
<hlm-option value="nzst">New Zealand Standard Time (NZST)</hlm-option>
<hlm-option value="fjt">Fiji Time (FJT)</hlm-option>
</hlm-select-group>

<hlm-select-group>
<hlm-select-label>South America</hlm-select-label>
<hlm-option value="art">Argentina Time (ART)</hlm-option>
<hlm-option value="bot">Bolivia Time (BOT)</hlm-option>
<hlm-option value="brt">Brasilia Time (BRT)</hlm-option>
<hlm-option value="clt">Chile Standard Time (CLT)</hlm-option>
</hlm-select-group>

<hlm-select-scroll-down />
</hlm-select-content>
</hlm-select>
`,
})
export class SelectScrollablePreviewComponent {}

export const scrollableCode = `import { Component } from '@angular/core';
import { BrnSelectImports } from '@spartan-ng/ui-select-brain';
import { HlmSelectImports } from '@spartan-ng/ui-select-helm';

@Component({
selector: 'spartan-select-scrollable-preview',
standalone: true,
imports: [BrnSelectImports, HlmSelectImports],
template: \`
<hlm-select scrollable="true" placeholder="Select a timezone">
<hlm-select-trigger class="w-[280px]">
<hlm-select-value />
</hlm-select-trigger>
<hlm-select-content class="min-w-content max-h-96">
<hlm-select-scroll-up/>

<hlm-select-group>
<hlm-select-label>North America</hlm-select-label>
<hlm-option value="est">Eastern Standard Time (EST)</hlm-option>
<hlm-option value="cst">Central Standard Time (CST)</hlm-option>
<hlm-option value="mst">Mountain Standard Time (MST)</hlm-option>
<hlm-option value="pst">Pacific Standard Time (PST)</hlm-option>
<hlm-option value="akst">Alaska Standard Time (AKST)</hlm-option>
<hlm-option value="hst">Hawaii Standard Time (HST)</hlm-option>
</hlm-select-group>

<hlm-select-group>
<hlm-select-label>Europe & Africa</hlm-select-label>
<hlm-option value="gmt">Greenwich Mean Time (GMT)</hlm-option>
<hlm-option value="cet">Central European Time (CET)</hlm-option>
<hlm-option value="eet">Eastern European Time (EET)</hlm-option>
<hlm-option value="west">Western European Summer Time (WEST)</hlm-option>
<hlm-option value="cat">Central Africa Time (CAT)</hlm-option>
<hlm-option value="eat">East Africa Time (EAT)</hlm-option>
</hlm-select-group>

<hlm-select-group>
<hlm-select-label>Asia</hlm-select-label>
<hlm-option value="msk">Moscow Time (MSK)</hlm-option>
<hlm-option value="ist">India Standard Time (IST)</hlm-option>
<hlm-option value="cst_china">China Standard Time (CST)</hlm-option>
<hlm-option value="jst">Japan Standard Time (JST)</hlm-option>
<hlm-option value="kst">Korea Standard Time (KST)</hlm-option>
<hlm-option value="ist_indonesia">Indonesia Central Standard Time (WITA)</hlm-option>
</hlm-select-group>

<hlm-select-group>
<hlm-select-label>Australia & Pacific</hlm-select-label>
<hlm-option value="awst">Australian Western Standard Time (AWST)</hlm-option>
<hlm-option value="acst">Australian Central Standard Time (ACST)</hlm-option>
<hlm-option value="aest">Australian Eastern Standard Time (AEST)</hlm-option>
<hlm-option value="nzst">New Zealand Standard Time (NZST)</hlm-option>
<hlm-option value="fjt">Fiji Time (FJT)</hlm-option>
</hlm-select-group>

<hlm-select-group>
<hlm-select-label>South America</hlm-select-label>
<hlm-option value="art">Argentina Time (ART)</hlm-option>
<hlm-option value="bot">Bolivia Time (BOT)</hlm-option>
<hlm-option value="brt">Brasilia Time (BRT)</hlm-option>
<hlm-option value="clt">Chile Standard Time (CLT)</hlm-option>
</hlm-select-group>

<hlm-select-scroll-down/>
</hlm-select-content>
</hlm-select>
\`,
})
export class SelectScrollablePreviewComponent {}`;
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
import { RouteMeta } from '@analogjs/router';
import { Component } from '@angular/core';
import { hlmH4 } from '@spartan-ng/ui-typography-helm';
import { CodePreviewDirective } from '../../../../shared/code/code-preview.directive';
import { CodeComponent } from '../../../../shared/code/code.component';
import { MainSectionDirective } from '../../../../shared/layout/main-section.directive';
import { PageBottomNavLinkComponent } from '../../../../shared/layout/page-bottom-nav/page-bottom-nav-link.component';
import { PageBottomNavComponent } from '../../../../shared/layout/page-bottom-nav/page-bottom-nav.component';
import { PageNavComponent } from '../../../../shared/layout/page-nav/page-nav.component';
import { SectionIntroComponent } from '../../../../shared/layout/section-intro.component';
import { SectionSubHeadingComponent } from '../../../../shared/layout/section-sub-heading.component';
import { TabsComponent } from '../../../../shared/layout/tabs.component';
import { metaWith } from '../../../../shared/meta/meta.util';
import { SelectMultiplePreviewComponent, multipleCode } from './select--multiple.preview';
import { SelectScrollablePreviewComponent, scrollableCode } from './select--scrollable.preview';
import { SelectPreviewComponent, defaultCode, defaultImports, defaultSkeleton } from './select.preview';

export const routeMeta: RouteMeta = {
data: { breadcrumb: 'Select' },
meta: metaWith('spartan/ui - Select', 'A control that allows the user to toggle between checked and not checked.'),
title: 'spartan/ui - Select',
};
@Component({
selector: 'spartan-select',
standalone: true,
imports: [
MainSectionDirective,
CodeComponent,
SectionIntroComponent,
SectionSubHeadingComponent,
TabsComponent,
CodePreviewDirective,
PageNavComponent,
PageBottomNavComponent,
PageBottomNavLinkComponent,
SelectPreviewComponent,
SelectMultiplePreviewComponent,
SelectScrollablePreviewComponent,
],
template: `
<section spartanMainSection>
<spartan-section-intro name="Select" lead="Select a value from a list of options." />

<spartan-tabs firstTab="Preview" secondTab="Code">
<div spartanCodePreview firstTab>
<spartan-select-preview />
</div>
<spartan-code secondTab [code]="defaultCode" />
</spartan-tabs>

<spartan-section-sub-heading id="installation">Installation</spartan-section-sub-heading>
<spartan-tabs class="mt-4" firstTab="Nx Plugin" secondTab="Angular CLI">
<spartan-code firstTab language="sh" code="npx nx g @spartan-ng/cli:ui select" />
<spartan-code secondTab language="sh" code="ng g @spartan-ng/cli:ui select" />
</spartan-tabs>

<spartan-section-sub-heading id="usage">Usage</spartan-section-sub-heading>
<div class="space-y-4">
<spartan-code [code]="defaultImports" />
<spartan-code [code]="defaultSkeleton" />
</div>

<spartan-section-sub-heading id="examples">Examples</spartan-section-sub-heading>
<h3 id="examples__multiple" class="${hlmH4} mb-2 mt-6">Multiple</h3>
<spartan-tabs firstTab="Preview" secondTab="Code">
<div spartanCodePreview firstTab>
<spartan-select-multiple-preview />
</div>
<spartan-code secondTab [code]="multipleCode" />
</spartan-tabs>
<h3 id="examples__scrollable" class="${hlmH4} mb-2 mt-6">Scrollable with Groups</h3>
<spartan-tabs firstTab="Preview" secondTab="Code">
<div spartanCodePreview firstTab>
<spartan-select-scrollable-preview />
</div>
<spartan-code secondTab [code]="scrollableCode" />
</spartan-tabs>

<spartan-page-bottom-nav>
<spartan-page-bottom-nav-link href="separator" label="Separator" />
<spartan-page-bottom-nav-link direction="previous" href="scroll-area" label="Scroll Area" />
</spartan-page-bottom-nav>
</section>
<spartan-page-nav />
`,
})
export default class SkeletonPageComponent {
protected readonly defaultCode = defaultCode;
protected readonly defaultSkeleton = defaultSkeleton;
protected readonly defaultImports = defaultImports;
protected readonly multipleCode = multipleCode;
protected readonly scrollableCode = scrollableCode;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import { Component } from '@angular/core';
import { BrnSelectImports } from '@spartan-ng/ui-select-brain';
import { HlmSelectImports } from '@spartan-ng/ui-select-helm';

@Component({
selector: 'spartan-select-preview',
standalone: true,
imports: [BrnSelectImports, HlmSelectImports],
template: `
<brn-select class="inline-block" placeholder="Select an option">
<hlm-select-trigger class="w-56">
<hlm-select-value />
</hlm-select-trigger>
<hlm-select-content class="w-56">
<hlm-option value="Refresh">Refresh</hlm-option>
<hlm-option value="Settings">Settings</hlm-option>
<hlm-option value="Help">Help</hlm-option>
<hlm-option value="Signout">Sign out</hlm-option>
</hlm-select-content>
</brn-select>
`,
})
export class SelectPreviewComponent {}

export const defaultCode = `
import { Component } from '@angular/core';
import { BrnSelectImports } from '@spartan-ng/ui-select-brain';
import { HlmSelectImports } from '@spartan-ng/ui-select-helm';

@Component({
selector: 'spartan-select-preview',
standalone: true,
imports: [BrnSelectImports, HlmSelectImports],
providers: [provideIcons({ radixChevronUp, radixChevronDown })],
template: \`
<brn-select class="inline-block" placeholder="Select an option">
<hlm-select-trigger class="w-56">
<hlm-select-value />
</hlm-select-trigger>
<hlm-select-content class="w-56">
<hlm-option value="Refresh">Refresh</hlm-option>
<hlm-option value="Settings">Settings</hlm-option>
<hlm-option value="Help">Help</hlm-option>
<hlm-option value="Signout">Sign out</hlm-option>
</hlm-select-content>
</brn-select>
\`,
})
export class SelectPreviewComponent {}
`;

export const defaultImports = `
import { Component } from '@angular/core';
import { BrnSelectImports } from '@spartan-ng/ui-select-brain';
import { HlmSelectImports } from '@spartan-ng/ui-select-helm';
`;
export const defaultSkeleton = `
<brn-select class="inline-block" placeholder="Select an option">
<hlm-select-trigger>
<hlm-select-value />
</hlm-select-trigger>
<hlm-select-content class="w-56">
<hlm-option value="Refresh">Refresh</hlm-option>
<hlm-option value="Settings">Settings</hlm-option>
<hlm-option value="Help">Help</hlm-option>
<hlm-option value="Signout">Sign out</hlm-option>
</hlm-select-content>
</brn-select>
`;
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export const routeMeta: RouteMeta = {

<spartan-page-bottom-nav>
<spartan-page-bottom-nav-link href="sheet" label="Sheet" />
<spartan-page-bottom-nav-link direction="previous" href="scroll-area" label="Scroll Area" />
<spartan-page-bottom-nav-link direction="previous" href="select" label="Select" />
</spartan-page-bottom-nav>
</section>
<spartan-page-nav />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,7 @@ import { SideNavLinksComponent } from './side-nav-links.directive';
<a (click)="linkClicked.emit()" spartanSideNavLink="/components/progress">Progress</a>
<a (click)="linkClicked.emit()" spartanSideNavLink="/components/radio-group">Radio Group</a>
<a (click)="linkClicked.emit()" spartanSideNavLink="/components/scroll-area">Scroll Area</a>
<a disabled spartanSideNavLink="/components/select">
Select
<spartan-side-nav-cs />
</a>
<a (click)="linkClicked.emit()" spartanSideNavLink="/components/select">Select</a>
<a (click)="linkClicked.emit()" spartanSideNavLink="/components/separator">Separator</a>
<a (click)="linkClicked.emit()" spartanSideNavLink="/components/sheet">Sheet</a>
<a (click)="linkClicked.emit()" spartanSideNavLink="/components/skeleton">Skeleton</a>
Expand Down
Loading
Loading