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

feat(Select): add new bq-select component #449

Merged
merged 23 commits into from
Aug 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
2b99dae
feat(Select): define component skeleton from `bq-input`
dgonzalezr Aug 14, 2023
84ca668
feat(Select): add dropdown functionality
dgonzalezr Aug 14, 2023
130bbb4
docs(Select): update readme files, included `Used by` components
dgonzalezr Aug 14, 2023
05eadeb
refactor(Select): sync selected option from value
dgonzalezr Aug 14, 2023
3a90ee2
fix(Select): delegate focus, also after select
dgonzalezr Aug 14, 2023
79cd451
fix(Dropdown): accessibility issues regarding arias and role
dgonzalezr Aug 15, 2023
1ccf094
fix(Select): aria-* accessibility issues
dgonzalezr Aug 15, 2023
ac8ec17
fix(Selected): supress user click text selection
dgonzalezr Aug 15, 2023
6f62f0e
feat(Dropdown): add `bqoOpen` event emitter
dgonzalezr Aug 15, 2023
f1ebe9d
feat(Select): animate suffix icon on dropdown panel open/close
dgonzalezr Aug 15, 2023
8b8f98a
feat(dropdown): allow disabled and do not open panel if trigger is di…
dgonzalezr Aug 15, 2023
14b18f6
feat(Select): add panel properties
dgonzalezr Aug 15, 2023
d9ac34a
fix(Option): avoid bubbling for focus and blur events
dgonzalezr Aug 15, 2023
2dfb9c3
feat(Angular): include `bq-select` in the Angular Value Accessor Bind…
dgonzalezr Aug 15, 2023
82ad890
docs(Select): update Storybook examples and .mdx docs
dgonzalezr Aug 15, 2023
8fa887e
test(Select): add e2e tests
dgonzalezr Aug 16, 2023
05517e3
fix(Select): stop focus and blur event propagation from bq-option(s)
dgonzalezr Aug 16, 2023
16e214f
style(Select): refactor CSS classes to use BEM
dgonzalezr Aug 16, 2023
cc711fb
docs(Select): add more Storybook examples
dgonzalezr Aug 16, 2023
7e48678
chore(deps): sync package-lock.json
dgonzalezr Aug 16, 2023
5c54de8
test(Select): update e2e tests after CSS classes rename
dgonzalezr Aug 16, 2023
77aa12d
chore(deps): sync package-lock.json after rebase
dgonzalezr Aug 16, 2023
c281059
chore(Sonarclcloud): add `.sonarcloud.properties` config file
dgonzalezr Aug 16, 2023
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
13 changes: 13 additions & 0 deletions .sonarcloud.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
sonar.organization=endava
sonar.projectKey=Endava_bee-q

# Path to sources
sonar.exclusions=config/**/*

# Path to tests
sonar.test.inclusions=**/*.spec.*
sonar.testExecutionReportPaths=packages/bee-q/test-report.xml
sonar.javascript.lcov.reportPaths=packages/bee-q/coverage/lcov.info

# Exclusions for copy-paste detection
sonar.cpd.exclusions=config/**/*,packages/bee-q/src/components/**/*,packages/bee-q/src/shared/**/__test__/**/*
2,360 changes: 1,184 additions & 1,176 deletions package-lock.json

Large diffs are not rendered by default.

203 changes: 203 additions & 0 deletions packages/bee-q/src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,10 @@ export namespace Components {
"titleAlignment"?: TDividerTitleAlignment;
}
interface BqDropdown {
/**
* If true, the dropdown panel will be visible and won't be shown.
*/
"disabled"?: boolean;
/**
* Represents the distance (gutter or margin) between the panel and the trigger element.
*/
Expand Down Expand Up @@ -596,6 +600,85 @@ export namespace Components {
*/
"value"?: string;
}
interface BqSelect {
/**
* If true, the Select input will be focused on component render
*/
"autofocus": boolean;
/**
* The clear button aria label
*/
"clearButtonLabel"?: string;
/**
* If true, the clear button won't be displayed
*/
"disableClear"?: boolean;
/**
* Indicates whether the Select input is disabled or not. If `true`, the Select is disabled and cannot be interacted with.
*/
"disabled"?: boolean;
/**
* Represents the distance (gutter or margin) between the Select panel and the input element.
*/
"distance"?: number;
/**
* The ID of the form that the Select input belongs to.
*/
"form"?: string;
/**
* If true, the Select panel will remain open after a selection is made.
*/
"keepOpenOnSelect"?: boolean;
/**
* The Select input name.
*/
"name": string;
/**
* If true, the Select panel will be visible.
*/
"open"?: boolean;
/**
* When set, it will override the height of the Select panel.
*/
"panelHeight"?: string;
/**
* The Select input placeholder text value
*/
"placeholder"?: string;
/**
* Position of the Select panel
*/
"placement"?: FloatingUIPlacement;
/**
* If true, the Select input cannot be modified.
*/
"readonly"?: boolean;
/**
* Indicates whether or not the Select input is required to be filled out before submitting the form.
*/
"required"?: boolean;
/**
* Whether the panel should have the Select same width as the input element
*/
"sameWidth"?: boolean;
/**
* Represents the skidding between the Select panel and the input element.
*/
"skidding"?: number;
/**
* Defines the strategy to position the Select panel
*/
"strategy"?: 'fixed' | 'absolute';
/**
* The validation status of the Select input.
* @remarks This property is used to indicate the validation status of the select input. It can be set to one of the following values: - `'none'`: No validation status is set. - `'error'`: The input has a validation error. - `'warning'`: The input has a validation warning. - `'success'`: The input has passed validation.
*/
"validationStatus": TInputValidation;
/**
* The select input value, it can be used to reset the field to a previous value
*/
"value": TInputValue;
}
interface BqSideMenu {
/**
* It sets a predefined appearance of the side menu
Expand Down Expand Up @@ -968,6 +1051,10 @@ export interface BqDialogCustomEvent<T> extends CustomEvent<T> {
detail: T;
target: HTMLBqDialogElement;
}
export interface BqDropdownCustomEvent<T> extends CustomEvent<T> {
detail: T;
target: HTMLBqDropdownElement;
}
export interface BqIconCustomEvent<T> extends CustomEvent<T> {
detail: T;
target: HTMLBqIconElement;
Expand Down Expand Up @@ -996,6 +1083,10 @@ export interface BqRadioGroupCustomEvent<T> extends CustomEvent<T> {
detail: T;
target: HTMLBqRadioGroupElement;
}
export interface BqSelectCustomEvent<T> extends CustomEvent<T> {
detail: T;
target: HTMLBqSelectElement;
}
export interface BqSideMenuCustomEvent<T> extends CustomEvent<T> {
detail: T;
target: HTMLBqSideMenuElement;
Expand Down Expand Up @@ -1146,6 +1237,12 @@ declare global {
prototype: HTMLBqRadioGroupElement;
new (): HTMLBqRadioGroupElement;
};
interface HTMLBqSelectElement extends Components.BqSelect, HTMLStencilElement {
}
var HTMLBqSelectElement: {
prototype: HTMLBqSelectElement;
new (): HTMLBqSelectElement;
};
interface HTMLBqSideMenuElement extends Components.BqSideMenu, HTMLStencilElement {
}
var HTMLBqSideMenuElement: {
Expand Down Expand Up @@ -1238,6 +1335,7 @@ declare global {
"bq-panel": HTMLBqPanelElement;
"bq-radio": HTMLBqRadioElement;
"bq-radio-group": HTMLBqRadioGroupElement;
"bq-select": HTMLBqSelectElement;
"bq-side-menu": HTMLBqSideMenuElement;
"bq-side-menu-item": HTMLBqSideMenuItemElement;
"bq-slider": HTMLBqSliderElement;
Expand Down Expand Up @@ -1543,6 +1641,10 @@ declare namespace LocalJSX {
"titleAlignment"?: TDividerTitleAlignment;
}
interface BqDropdown {
/**
* If true, the dropdown panel will be visible and won't be shown.
*/
"disabled"?: boolean;
/**
* Represents the distance (gutter or margin) between the panel and the trigger element.
*/
Expand All @@ -1551,6 +1653,10 @@ declare namespace LocalJSX {
* If true, the panel will remain open after a selection is made.
*/
"keepOpenOnSelect"?: boolean;
/**
* Callback handler to be called when the dropdown panel is opened or closed.
*/
"onBqOpen"?: (event: BqDropdownCustomEvent<{ open: boolean }>) => void;
/**
* If true, the panel will be visible.
*/
Expand Down Expand Up @@ -1898,6 +2004,101 @@ declare namespace LocalJSX {
*/
"value"?: string;
}
interface BqSelect {
/**
* If true, the Select input will be focused on component render
*/
"autofocus"?: boolean;
/**
* The clear button aria label
*/
"clearButtonLabel"?: string;
/**
* If true, the clear button won't be displayed
*/
"disableClear"?: boolean;
/**
* Indicates whether the Select input is disabled or not. If `true`, the Select is disabled and cannot be interacted with.
*/
"disabled"?: boolean;
/**
* Represents the distance (gutter or margin) between the Select panel and the input element.
*/
"distance"?: number;
/**
* The ID of the form that the Select input belongs to.
*/
"form"?: string;
/**
* If true, the Select panel will remain open after a selection is made.
*/
"keepOpenOnSelect"?: boolean;
/**
* The Select input name.
*/
"name": string;
/**
* Callback handler emitted when the Select input loses focus
*/
"onBqBlur"?: (event: BqSelectCustomEvent<HTMLBqSelectElement>) => void;
/**
* Callback handler emitted when the selected value has been cleared
*/
"onBqClear"?: (event: BqSelectCustomEvent<HTMLBqSelectElement>) => void;
/**
* Callback handler emitted when the Select input has received focus
*/
"onBqFocus"?: (event: BqSelectCustomEvent<HTMLBqSelectElement>) => void;
/**
* Callback handler emitted when the selected value has changed
*/
"onBqSelect"?: (event: BqSelectCustomEvent<{ value: string | number | string[]; item: HTMLBqOptionElement }>) => void;
/**
* If true, the Select panel will be visible.
*/
"open"?: boolean;
/**
* When set, it will override the height of the Select panel.
*/
"panelHeight"?: string;
/**
* The Select input placeholder text value
*/
"placeholder"?: string;
/**
* Position of the Select panel
*/
"placement"?: FloatingUIPlacement;
/**
* If true, the Select input cannot be modified.
*/
"readonly"?: boolean;
/**
* Indicates whether or not the Select input is required to be filled out before submitting the form.
*/
"required"?: boolean;
/**
* Whether the panel should have the Select same width as the input element
*/
"sameWidth"?: boolean;
/**
* Represents the skidding between the Select panel and the input element.
*/
"skidding"?: number;
/**
* Defines the strategy to position the Select panel
*/
"strategy"?: 'fixed' | 'absolute';
/**
* The validation status of the Select input.
* @remarks This property is used to indicate the validation status of the select input. It can be set to one of the following values: - `'none'`: No validation status is set. - `'error'`: The input has a validation error. - `'warning'`: The input has a validation warning. - `'success'`: The input has passed validation.
*/
"validationStatus"?: TInputValidation;
/**
* The select input value, it can be used to reset the field to a previous value
*/
"value"?: TInputValue;
}
interface BqSideMenu {
/**
* It sets a predefined appearance of the side menu
Expand Down Expand Up @@ -2308,6 +2509,7 @@ declare namespace LocalJSX {
"bq-panel": BqPanel;
"bq-radio": BqRadio;
"bq-radio-group": BqRadioGroup;
"bq-select": BqSelect;
"bq-side-menu": BqSideMenu;
"bq-side-menu-item": BqSideMenuItem;
"bq-slider": BqSlider;
Expand Down Expand Up @@ -2352,6 +2554,7 @@ declare module "@stencil/core" {
"bq-panel": LocalJSX.BqPanel & JSXBase.HTMLAttributes<HTMLBqPanelElement>;
"bq-radio": LocalJSX.BqRadio & JSXBase.HTMLAttributes<HTMLBqRadioElement>;
"bq-radio-group": LocalJSX.BqRadioGroup & JSXBase.HTMLAttributes<HTMLBqRadioGroupElement>;
"bq-select": LocalJSX.BqSelect & JSXBase.HTMLAttributes<HTMLBqSelectElement>;
"bq-side-menu": LocalJSX.BqSideMenu & JSXBase.HTMLAttributes<HTMLBqSideMenuElement>;
"bq-side-menu-item": LocalJSX.BqSideMenuItem & JSXBase.HTMLAttributes<HTMLBqSideMenuItemElement>;
"bq-slider": LocalJSX.BqSlider & JSXBase.HTMLAttributes<HTMLBqSliderElement>;
Expand Down
2 changes: 2 additions & 0 deletions packages/bee-q/src/components/button/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ Buttons are designed for users to take action on a page or a screen.
- [bq-dialog](../dialog)
- [bq-input](../input)
- [bq-notification](../notification)
- [bq-select](../select)

### Depends on

Expand All @@ -64,6 +65,7 @@ graph TD;
bq-dialog --> bq-button
bq-input --> bq-button
bq-notification --> bq-button
bq-select --> bq-button
style bq-button fill:#f9f,stroke:#333,stroke-width:4px
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const meta: Meta = {
},
},
argTypes: {
disabled: { control: 'boolean' },
distance: { control: 'number' },
placement: {
control: 'select',
Expand Down Expand Up @@ -43,6 +44,7 @@ const meta: Meta = {
trigger: { control: 'text', table: { disable: true } },
},
args: {
disabled: false,
distance: 4,
placement: 'bottom-start',
open: false,
Expand All @@ -60,6 +62,7 @@ type Story = StoryObj;

const Template = (args: Args) => html`
<bq-dropdown
?disabled=${args.disabled}
distance=${args.distance}
placement=${args.placement}
?open=${args.open}
Expand Down
Loading