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(input): add new <bq-input> component #344

Merged
merged 41 commits into from
Jul 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
05d69e0
feat(input): add component auto generated skeleton
dgonzalezr Jul 7, 2023
6b82061
feat(input): add base styles and prefix/suffix slots
dgonzalezr Jul 7, 2023
a6f08be
feat(input): handle prefix/suffix slots visibility
dgonzalezr Jul 7, 2023
b14ca76
refactor(input): use CSS variables and logical properties
dgonzalezr Jul 7, 2023
c0c91a2
docs(input): update storybook examples
dgonzalezr Jul 7, 2023
030223e
test(input): update e2e tests
dgonzalezr Jul 7, 2023
7e47129
refactor(input): prefix/suffix to not use position absolute
dgonzalezr Jul 13, 2023
1af770a
feat(input): add clear button (only visual layout)
dgonzalezr Jul 13, 2023
04c9ae4
feat(input): handle change and clear input events
dgonzalezr Jul 13, 2023
fd40d78
feat(input): allow hide the clear button with `disableClear`
dgonzalezr Jul 13, 2023
5f4aa3f
feat(input): add `clearButtonLabel`, used for accessibility
dgonzalezr Jul 13, 2023
04e8dc9
refactor(input): rename CSS classes
dgonzalezr Jul 13, 2023
9aa7205
feat(input): handle input label content
dgonzalezr Jul 13, 2023
94d9496
fix(input): hasValue state on default value set
dgonzalezr Jul 13, 2023
bb45353
test(input): update e2e tests
dgonzalezr Jul 13, 2023
4001266
fix(input): border color when the input is focused
dgonzalezr Jul 14, 2023
7d4a267
refactor(input): use CSS variables for label and helper text
dgonzalezr Jul 14, 2023
d8b8c9c
feat(input): add helper text
dgonzalezr Jul 14, 2023
f6b956f
docs(input): update storybook example with helper text
dgonzalezr Jul 14, 2023
c81e2bc
test(input): add e2e test for helper-text
dgonzalezr Jul 14, 2023
247bb00
feat(input): hanlde input, focus and blur events
dgonzalezr Jul 14, 2023
96421a5
refactor: use shadow DOM delegatesFocus
dgonzalezr Jul 14, 2023
51fadc1
fix: wrong EventEmitter import path
dgonzalezr Jul 14, 2023
f46a2d7
feat(input): allow and handle debounce for `bqInput` event
dgonzalezr Jul 14, 2023
104a0b1
feat(input): handle validation status
dgonzalezr Jul 14, 2023
8d69098
docs(input): add validation storybook examples
dgonzalezr Jul 14, 2023
da32223
test(input): update e2e tests
dgonzalezr Jul 17, 2023
70f2310
feat(input): handle `disabled` and move types
dgonzalezr Jul 17, 2023
54be510
feat(input): support native HTML input attributes
dgonzalezr Jul 17, 2023
874552c
docs(input): update storybook examples
dgonzalezr Jul 17, 2023
d970178
feat(input): add `bq-input` to angular value accessor bindings
dgonzalezr Jul 17, 2023
cd58365
fix(angular): cannot use private types
dgonzalezr Jul 17, 2023
3888675
fix(tooltip): set `display: flex` on the trigger container
dgonzalezr Jul 17, 2023
a67c93e
fix(input): remove optional from `autofocus` prop
dgonzalezr Jul 17, 2023
08463f0
docs(input): add label with tooltip example
dgonzalezr Jul 17, 2023
b859a9f
docs(input): improve storybook conditonal templates
dgonzalezr Jul 17, 2023
afa234b
docs(input): use `ifDefined` lit-html directive
dgonzalezr Jul 17, 2023
ff53d99
style: sync package-lock.json after rebase
dgonzalezr Jul 17, 2023
f2c06c7
fix(input): hide search clear native control
dgonzalezr Jul 17, 2023
ee46854
style: variable name typo
dgonzalezr Jul 17, 2023
f4906e8
fix(input): webkit clear control shown on `input[type="search"]`
dgonzalezr Jul 18, 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
24 changes: 23 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/bee-q/.storybook/preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,6 @@ export const parameters = {
printWidth: 80,
useTabs: false,
},
root: '#root-inner',
},
};
225 changes: 225 additions & 0 deletions packages/bee-q/src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { TButtonAppearance, TButtonSize, TButtonType, TButtonVariant } from "./c
import { TDialogFooterAppearance, TDialogSize } from "./components/dialog/bq-dialog.types";
import { TDividerOrientation, TDividerStrokeLinecap, TDividerTitleAlignment } from "./components/divider/bq-divider.types";
import { TIconWeight } from "./components/icon/bq-icon.types";
import { TInputType, TInputValidation, TInputValue } from "./components/input/bq-input.types";
import { TNotificationType } from "./components/notification/bq-notification.types";
import { TRadioGroupOrientation } from "./components/radio-group/bq-radio-group.types";
import { TSideMenuAppearance, TSideMenuSize } from "./components/side-menu/bq-side-menu.types";
Expand All @@ -27,6 +28,7 @@ export { TButtonAppearance, TButtonSize, TButtonType, TButtonVariant } from "./c
export { TDialogFooterAppearance, TDialogSize } from "./components/dialog/bq-dialog.types";
export { TDividerOrientation, TDividerStrokeLinecap, TDividerTitleAlignment } from "./components/divider/bq-divider.types";
export { TIconWeight } from "./components/icon/bq-icon.types";
export { TInputType, TInputValidation, TInputValue } from "./components/input/bq-input.types";
export { TNotificationType } from "./components/notification/bq-notification.types";
export { TRadioGroupOrientation } from "./components/radio-group/bq-radio-group.types";
export { TSideMenuAppearance, TSideMenuSize } from "./components/side-menu/bq-side-menu.types";
Expand Down Expand Up @@ -277,6 +279,101 @@ export namespace Components {
*/
"weight"?: TIconWeight;
}
interface BqInput {
/**
* Controls whether or not the input field should be capitalized and how. Possible values are 'off', 'none', 'on', 'sentences', 'words', and 'characters'. See: https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/autocapitalize
*/
"autocapitalize": string;
/**
* Specifies whether or not the input field should have autocomplete enabled. See: https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete#values
*/
"autocomplete": string;
/**
* Controls whether or not the input field should have autocorrect enabled. Possible values are 'on' and 'off'.
*/
"autocorrect": 'on' | 'off';
/**
* If true, the input will be focused on component render
*/
"autofocus": boolean;
/**
* The clear button aria label
*/
"clearButtonLabel"?: string;
/**
* The amount of time, in milliseconds, to wait before emitting the `bqInput` event after the input value changes. A value of 0 means no debouncing will occur.
*/
"debounceTime"?: number;
/**
* If true, the clear button won't be displayed
*/
"disableClear"?: boolean;
/**
* Indicates whether the input is disabled or not. If `true`, the input is disabled and cannot be interacted with.
*/
"disabled"?: boolean;
/**
* The ID of the form that the input field belongs to.
*/
"form"?: string;
/**
* The inputmode attribute specifies what kind of input mechanism would be most helpful for users entering content into the input field. This allows a browser to display an appropriate virtual keyboard while editing. Possible values are 'none', 'text', 'decimal', 'numeric', 'tel', 'search', 'email', 'url', and 'date'.
*/
"inputmode"?: string;
/**
* The maximum value that the input field can accept. Only applies to date and number input types.
*/
"max"?: number | string;
/**
* The maximum number of characters that the input field can accept.
*/
"maxlength": number;
/**
* The minimum value that the input field can accept. Only applies to date and number input types.
*/
"min"?: number | string;
/**
* The minimum number of characters that the input field can accept.
*/
"minlength": number;
/**
* The input field name.
*/
"name": string;
/**
* Specifies a regular expression the form control's value should match. See: https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern
*/
"pattern"?: string;
/**
* The input placeholder text value
*/
"placeholder"?: string;
/**
* If true, the input field cannot be modified.
*/
"readonly"?: boolean;
/**
* Indicates whether or not the input field is required to be filled out before submitting the form.
*/
"required"?: boolean;
/**
* A number that specifies the granularity that the value must adhere to. Valid for date, month, week, time, datetime-local, number, and range. See: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#step
*/
"step": number | 'any';
/**
* The type attribute specifies the type of input field to display. Possible values are 'text', 'password', 'email', 'number', 'tel', 'search', 'url', and more. See: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#input_types
*/
"type": TInputType;
/**
* The validation status of the input.
* @remarks This property is used to indicate the validation status of the 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 input value, it can be used to reset the input to a previous value
*/
"value": TInputValue;
}
interface BqNotification {
/**
* If true, the notification will automatically hide after the specified amount of time
Expand Down Expand Up @@ -676,6 +773,10 @@ export interface BqIconCustomEvent<T> extends CustomEvent<T> {
detail: T;
target: HTMLBqIconElement;
}
export interface BqInputCustomEvent<T> extends CustomEvent<T> {
detail: T;
target: HTMLBqInputElement;
}
export interface BqNotificationCustomEvent<T> extends CustomEvent<T> {
detail: T;
target: HTMLBqNotificationElement;
Expand Down Expand Up @@ -768,6 +869,12 @@ declare global {
prototype: HTMLBqIconElement;
new (): HTMLBqIconElement;
};
interface HTMLBqInputElement extends Components.BqInput, HTMLStencilElement {
}
var HTMLBqInputElement: {
prototype: HTMLBqInputElement;
new (): HTMLBqInputElement;
};
interface HTMLBqNotificationElement extends Components.BqNotification, HTMLStencilElement {
}
var HTMLBqNotificationElement: {
Expand Down Expand Up @@ -861,6 +968,7 @@ declare global {
"bq-dialog": HTMLBqDialogElement;
"bq-divider": HTMLBqDividerElement;
"bq-icon": HTMLBqIconElement;
"bq-input": HTMLBqInputElement;
"bq-notification": HTMLBqNotificationElement;
"bq-radio": HTMLBqRadioElement;
"bq-radio-group": HTMLBqRadioGroupElement;
Expand Down Expand Up @@ -1140,6 +1248,121 @@ declare namespace LocalJSX {
*/
"weight"?: TIconWeight;
}
interface BqInput {
/**
* Controls whether or not the input field should be capitalized and how. Possible values are 'off', 'none', 'on', 'sentences', 'words', and 'characters'. See: https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/autocapitalize
*/
"autocapitalize"?: string;
/**
* Specifies whether or not the input field should have autocomplete enabled. See: https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete#values
*/
"autocomplete"?: string;
/**
* Controls whether or not the input field should have autocorrect enabled. Possible values are 'on' and 'off'.
*/
"autocorrect"?: 'on' | 'off';
/**
* If true, the input will be focused on component render
*/
"autofocus"?: boolean;
/**
* The clear button aria label
*/
"clearButtonLabel"?: string;
/**
* The amount of time, in milliseconds, to wait before emitting the `bqInput` event after the input value changes. A value of 0 means no debouncing will occur.
*/
"debounceTime"?: number;
/**
* If true, the clear button won't be displayed
*/
"disableClear"?: boolean;
/**
* Indicates whether the input is disabled or not. If `true`, the input is disabled and cannot be interacted with.
*/
"disabled"?: boolean;
/**
* The ID of the form that the input field belongs to.
*/
"form"?: string;
/**
* The inputmode attribute specifies what kind of input mechanism would be most helpful for users entering content into the input field. This allows a browser to display an appropriate virtual keyboard while editing. Possible values are 'none', 'text', 'decimal', 'numeric', 'tel', 'search', 'email', 'url', and 'date'.
*/
"inputmode"?: string;
/**
* The maximum value that the input field can accept. Only applies to date and number input types.
*/
"max"?: number | string;
/**
* The maximum number of characters that the input field can accept.
*/
"maxlength"?: number;
/**
* The minimum value that the input field can accept. Only applies to date and number input types.
*/
"min"?: number | string;
/**
* The minimum number of characters that the input field can accept.
*/
"minlength"?: number;
/**
* The input field name.
*/
"name": string;
/**
* Callback handler emitted when the input loses focus
*/
"onBqBlur"?: (event: BqInputCustomEvent<HTMLBqInputElement>) => void;
/**
* Callback handler emitted when the input value has changed and the input loses focus. This handler is called whenever the user finishes typing or pasting text into the input field and then clicks outside of the input field.
*/
"onBqChange"?: (event: BqInputCustomEvent<{ value: string | number | string[]; el: HTMLBqInputElement }>) => void;
/**
* Callback handler emitted when the input value has been cleared
*/
"onBqClear"?: (event: BqInputCustomEvent<HTMLBqInputElement>) => void;
/**
* Callback handler emitted when the input has received focus
*/
"onBqFocus"?: (event: BqInputCustomEvent<HTMLBqInputElement>) => void;
/**
* Callback handler emitted when the input value changes. This handler is called whenever the user types or pastes text into the input field.
*/
"onBqInput"?: (event: BqInputCustomEvent<{ value: string | number | string[]; el: HTMLBqInputElement }>) => void;
/**
* Specifies a regular expression the form control's value should match. See: https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern
*/
"pattern"?: string;
/**
* The input placeholder text value
*/
"placeholder"?: string;
/**
* If true, the input field cannot be modified.
*/
"readonly"?: boolean;
/**
* Indicates whether or not the input field is required to be filled out before submitting the form.
*/
"required"?: boolean;
/**
* A number that specifies the granularity that the value must adhere to. Valid for date, month, week, time, datetime-local, number, and range. See: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#step
*/
"step"?: number | 'any';
/**
* The type attribute specifies the type of input field to display. Possible values are 'text', 'password', 'email', 'number', 'tel', 'search', 'url', and more. See: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#input_types
*/
"type"?: TInputType;
/**
* The validation status of the input.
* @remarks This property is used to indicate the validation status of the 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 input value, it can be used to reset the input to a previous value
*/
"value"?: TInputValue;
}
interface BqNotification {
/**
* If true, the notification will automatically hide after the specified amount of time
Expand Down Expand Up @@ -1554,6 +1777,7 @@ declare namespace LocalJSX {
"bq-dialog": BqDialog;
"bq-divider": BqDivider;
"bq-icon": BqIcon;
"bq-input": BqInput;
"bq-notification": BqNotification;
"bq-radio": BqRadio;
"bq-radio-group": BqRadioGroup;
Expand Down Expand Up @@ -1589,6 +1813,7 @@ declare module "@stencil/core" {
* Icons are simplified images that graphically explain the meaning of an object on the screen.
*/
"bq-icon": LocalJSX.BqIcon & JSXBase.HTMLAttributes<HTMLBqIconElement>;
"bq-input": LocalJSX.BqInput & JSXBase.HTMLAttributes<HTMLBqInputElement>;
"bq-notification": LocalJSX.BqNotification & JSXBase.HTMLAttributes<HTMLBqNotificationElement>;
"bq-radio": LocalJSX.BqRadio & JSXBase.HTMLAttributes<HTMLBqRadioElement>;
"bq-radio-group": LocalJSX.BqRadioGroup & JSXBase.HTMLAttributes<HTMLBqRadioGroupElement>;
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 @@ -50,6 +50,7 @@ Buttons are designed for users to take action on a page or a screen.
### Used by

- [bq-dialog](../dialog)
- [bq-input](../input)
- [bq-notification](../notification)

### Depends on
Expand All @@ -61,6 +62,7 @@ Buttons are designed for users to take action on a page or a screen.
graph TD;
bq-button --> bq-icon
bq-dialog --> bq-button
bq-input --> bq-button
bq-notification --> bq-button
style bq-button fill:#f9f,stroke:#333,stroke-width:4px
```
Expand Down
2 changes: 2 additions & 0 deletions packages/bee-q/src/components/icon/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ Icons are simplified images that graphically explain the meaning of an object on

- [bq-button](../button)
- [bq-dialog](../dialog)
- [bq-input](../input)
- [bq-notification](../notification)
- [bq-switch](../switch)
- [bq-toast](../toast)
Expand All @@ -47,6 +48,7 @@ Icons are simplified images that graphically explain the meaning of an object on
graph TD;
bq-button --> bq-icon
bq-dialog --> bq-icon
bq-input --> bq-icon
bq-notification --> bq-icon
bq-switch --> bq-icon
bq-toast --> bq-icon
Expand Down
Loading