@momentum-design/components 0.121.8 → 0.122.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/index.js +409 -322
- package/dist/browser/index.js.map +4 -4
- package/dist/components/input/input.component.d.ts +4 -3
- package/dist/components/input/input.component.js +2 -1
- package/dist/components/searchfield/searchfield.component.d.ts +9 -1
- package/dist/components/searchfield/searchfield.component.js +8 -0
- package/dist/components/searchpopover/index.d.ts +11 -0
- package/dist/components/searchpopover/index.js +8 -0
- package/dist/components/searchpopover/searchpopover.component.d.ts +100 -0
- package/dist/components/searchpopover/searchpopover.component.js +208 -0
- package/dist/components/searchpopover/searchpopover.constants.d.ts +8 -0
- package/dist/components/searchpopover/searchpopover.constants.js +10 -0
- package/dist/components/searchpopover/searchpopover.styles.d.ts +2 -0
- package/dist/components/searchpopover/searchpopover.styles.js +23 -0
- package/dist/components/searchpopover/searchpopover.types.d.ts +8 -0
- package/dist/components/searchpopover/searchpopover.types.js +1 -0
- package/dist/custom-elements.json +5453 -3983
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/react/index.d.ts +8 -7
- package/dist/react/index.js +8 -7
- package/dist/react/searchfield/index.d.ts +7 -0
- package/dist/react/searchfield/index.js +7 -0
- package/dist/react/searchpopover/index.d.ts +83 -0
- package/dist/react/searchpopover/index.js +89 -0
- package/package.json +1 -1
|
@@ -163,9 +163,9 @@ declare class Input extends Input_base implements AssociatedFormControl {
|
|
|
163
163
|
/**
|
|
164
164
|
* Handles the input event of the input field.
|
|
165
165
|
* Updates the value and sets the validity of the input field.
|
|
166
|
-
*
|
|
166
|
+
* @internal
|
|
167
167
|
*/
|
|
168
|
-
|
|
168
|
+
protected onInput(): void;
|
|
169
169
|
/**
|
|
170
170
|
* Handles the change event of the input field.
|
|
171
171
|
* Updates the value and sets the validity of the input field.
|
|
@@ -175,8 +175,9 @@ declare class Input extends Input_base implements AssociatedFormControl {
|
|
|
175
175
|
* Read more: https://developer.mozilla.org/en-US/docs/Web/API/Event/composed
|
|
176
176
|
*
|
|
177
177
|
* @param event - Event which contains information about the value change.
|
|
178
|
+
* @internal
|
|
178
179
|
*/
|
|
179
|
-
|
|
180
|
+
protected onChange(event: Event): void;
|
|
180
181
|
/**
|
|
181
182
|
* Handles the keydown event of the input field.
|
|
182
183
|
* If the key pressed is 'Enter', it submits the form.
|
|
@@ -194,7 +194,7 @@ class Input extends AutoFocusOnMountMixin(FormInternalsMixin(DataAriaLabelMixin(
|
|
|
194
194
|
/**
|
|
195
195
|
* Handles the input event of the input field.
|
|
196
196
|
* Updates the value and sets the validity of the input field.
|
|
197
|
-
*
|
|
197
|
+
* @internal
|
|
198
198
|
*/
|
|
199
199
|
onInput() {
|
|
200
200
|
this.updateValue();
|
|
@@ -210,6 +210,7 @@ class Input extends AutoFocusOnMountMixin(FormInternalsMixin(DataAriaLabelMixin(
|
|
|
210
210
|
* Read more: https://developer.mozilla.org/en-US/docs/Web/API/Event/composed
|
|
211
211
|
*
|
|
212
212
|
* @param event - Event which contains information about the value change.
|
|
213
|
+
* @internal
|
|
213
214
|
*/
|
|
214
215
|
onChange(event) {
|
|
215
216
|
this.updateValue();
|
|
@@ -7,6 +7,13 @@ import Input from '../input/input.component';
|
|
|
7
7
|
*
|
|
8
8
|
* This component is built by extending the `mdc-input` component.
|
|
9
9
|
*
|
|
10
|
+
* **Accessibility:**
|
|
11
|
+
*
|
|
12
|
+
* NOTE: this component should not be used in combination with a Popover or Listbox component.
|
|
13
|
+
* Search results should be shown permanently on the page if using this component.
|
|
14
|
+
*
|
|
15
|
+
* For a search field that opens a Popover, use the `mdc-searchpopover` widget instead.
|
|
16
|
+
*
|
|
10
17
|
* @tagname mdc-searchfield
|
|
11
18
|
*
|
|
12
19
|
* @event input - (React: onInput) This event is dispatched when the value of the input field changes (every press).
|
|
@@ -77,8 +84,9 @@ declare class Searchfield extends Input {
|
|
|
77
84
|
/**
|
|
78
85
|
* This method is used to render the input chips inside filters slot.
|
|
79
86
|
* It will remove any elements that are not input chips.
|
|
87
|
+
* @internal
|
|
80
88
|
*/
|
|
81
|
-
|
|
89
|
+
protected renderInputChips(): void;
|
|
82
90
|
/**
|
|
83
91
|
* This sets the focus ring state based on the input focus state.
|
|
84
92
|
* Eventually, this logic has to be omitted and achieved using CSS instead.
|
|
@@ -21,6 +21,13 @@ import { DEFAULTS } from './searchfield.constants';
|
|
|
21
21
|
*
|
|
22
22
|
* This component is built by extending the `mdc-input` component.
|
|
23
23
|
*
|
|
24
|
+
* **Accessibility:**
|
|
25
|
+
*
|
|
26
|
+
* NOTE: this component should not be used in combination with a Popover or Listbox component.
|
|
27
|
+
* Search results should be shown permanently on the page if using this component.
|
|
28
|
+
*
|
|
29
|
+
* For a search field that opens a Popover, use the `mdc-searchpopover` widget instead.
|
|
30
|
+
*
|
|
24
31
|
* @tagname mdc-searchfield
|
|
25
32
|
*
|
|
26
33
|
* @event input - (React: onInput) This event is dispatched when the value of the input field changes (every press).
|
|
@@ -107,6 +114,7 @@ class Searchfield extends Input {
|
|
|
107
114
|
/**
|
|
108
115
|
* This method is used to render the input chips inside filters slot.
|
|
109
116
|
* It will remove any elements that are not input chips.
|
|
117
|
+
* @internal
|
|
110
118
|
*/
|
|
111
119
|
renderInputChips() {
|
|
112
120
|
var _a;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import Searchpopover from './searchpopover.component';
|
|
2
|
+
import '../button';
|
|
3
|
+
import '../icon';
|
|
4
|
+
import '../text';
|
|
5
|
+
import '../popover';
|
|
6
|
+
declare global {
|
|
7
|
+
interface HTMLElementTagNameMap {
|
|
8
|
+
['mdc-searchpopover']: Searchpopover;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
export default Searchpopover;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { CSSResult } from 'lit';
|
|
2
|
+
import Searchfield from '../searchfield/searchfield.component';
|
|
3
|
+
import type { Placement } from './searchpopover.types';
|
|
4
|
+
/**
|
|
5
|
+
* `mdc-searchpopover` widget is a combination of the Searchfield and Popover components, connected to ensure
|
|
6
|
+
* proper accessibility. This component should be used when search results or suggestions need to be displayed
|
|
7
|
+
* in a popover below the search input field, where the search results hold individual actions like navigating to a
|
|
8
|
+
* a different url etc.
|
|
9
|
+
*
|
|
10
|
+
* - Don't use this when search results are displayed inline on the page -> use Searchfield component instead.
|
|
11
|
+
* - Don't use this when a list of options is filtered based on the search input -> use Combobox component instead.
|
|
12
|
+
*
|
|
13
|
+
* It supports `mdc-inputchip` as filters.
|
|
14
|
+
*
|
|
15
|
+
* This component is built by extending the `mdc-searchfield` component & rendering the mdc-popover component inside.
|
|
16
|
+
*
|
|
17
|
+
* @tagname mdc-searchpopover
|
|
18
|
+
*
|
|
19
|
+
* @event input - (React: onInput) This event is dispatched when the value of the input field changes (every press).
|
|
20
|
+
* @event change - (React: onChange) This event is dispatched when the value of the input field changes (on blur).
|
|
21
|
+
* @event focus - (React: onFocus) This event is dispatched when the input receives focus.
|
|
22
|
+
* @event blur - (React: onBlur) This event is dispatched when the input loses focus.
|
|
23
|
+
* @event clear - (React: onClear) This event is dispatched when the input text is cleared.
|
|
24
|
+
* @event shown - (React: onShown) This event is dispatched when the popover is shown
|
|
25
|
+
* @event hidden - (React: onHidden) This event is dispatched when the popover is hidden
|
|
26
|
+
*
|
|
27
|
+
* @slot default - Default slot (=children) for the popover content
|
|
28
|
+
* @slot filters - Slot for input chips
|
|
29
|
+
* @slot label - Slot for the label element. If not provided, the `label` property will be used to render the label.
|
|
30
|
+
* @slot toggletip - Slot for the toggletip info icon button. If not provided, the `toggletip-text` property will be used to render the info icon button and toggletip.
|
|
31
|
+
* @slot help-icon - Slot for the helper/validation icon. If not provided, the icon will be rendered based on the `helpTextType` property.
|
|
32
|
+
* @slot help-text - Slot for the helper/validation text. If not provided, the `helpText` property will be used to render the helper/validation text.
|
|
33
|
+
* @slot input - Slot for the input element. If not provided, the input field will be rendered.
|
|
34
|
+
* @slot input-leading-icon - Slot for the leading icon before the input field. If not provided, the `leadingIcon` property will be used to render the leading icon.
|
|
35
|
+
* @slot input-prefix-text - Slot for the prefix text before the input field. If not provided, the `prefixText` property will be used to render the prefix text.
|
|
36
|
+
* @slot trailing-button - Slot for the trailing button to clear the input field. If not provided, the clear button will be rendered when `trailingButton` property is set to true.
|
|
37
|
+
*
|
|
38
|
+
* @cssproperty --mdc-label-font-size - Font size for the label text.
|
|
39
|
+
* @cssproperty --mdc-label-font-weight - Font weight for the label text.
|
|
40
|
+
* @cssproperty --mdc-label-line-height - Line height for the label text.
|
|
41
|
+
* @cssproperty --mdc-label-color - Color for the label text.
|
|
42
|
+
* @cssproperty --mdc-help-text-font-size - Font size for the help text.
|
|
43
|
+
* @cssproperty --mdc-help-text-font-weight - Font weight for the help text.
|
|
44
|
+
* @cssproperty --mdc-help-text-line-height - Line height for the help text.
|
|
45
|
+
* @cssproperty --mdc-help-text-color - Color for the help text.
|
|
46
|
+
* @cssproperty --mdc-required-indicator-color - Color for the required indicator text.
|
|
47
|
+
* @cssproperty --mdc-input-text-color - Text color for the input field
|
|
48
|
+
* @cssproperty --mdc-input-border-color - Border color for the input container
|
|
49
|
+
* @cssproperty --mdc-input-background-color - Background color for the input field
|
|
50
|
+
* @cssproperty --mdc-input-support-text-color - Text color for the help text
|
|
51
|
+
* @cssproperty --mdc-input-selection-text-color - Text color for the selected text
|
|
52
|
+
* @cssproperty --mdc-input-selection-background-color - Background color for the selected text
|
|
53
|
+
* @cssproperty --mdc-searchpopover-width - Width of the searchpopover component
|
|
54
|
+
* @cssproperty --mdc-searchpopover-popover-width - Width of the popover within the searchpopover component
|
|
55
|
+
* @cssproperty --mdc-searchpopover-popover-height - Height of the popover within the searchpopover component
|
|
56
|
+
*
|
|
57
|
+
* @csspart label - The label element.
|
|
58
|
+
* @csspart label-text - The container for the label and required indicator elements.
|
|
59
|
+
* @csspart required-indicator - The required indicator element that is displayed next to the label when the `required` property is set to true.
|
|
60
|
+
* @csspart info-icon-btn - The info icon button element that is displayed next to the label when the `toggletip-text` property is set.
|
|
61
|
+
* @csspart label-toggletip - The toggletip element that is displayed when the info icon button is clicked.
|
|
62
|
+
* @csspart help-text - The helper/validation text element.
|
|
63
|
+
* @csspart helper-icon - The helper/validation icon element that is displayed next to the helper/validation text.
|
|
64
|
+
* @csspart help-text-container - The container for the helper/validation icon and text elements.
|
|
65
|
+
* @csspart leading-icon - The leading icon element that is displayed before the input field.
|
|
66
|
+
* @csspart prefix-text - The prefix text element that is displayed before the input field.
|
|
67
|
+
* @csspart input-container - The container for the input field, leading icon, prefix text, and trailing button elements.
|
|
68
|
+
* @csspart input-section - The container for the input field, leading icon, and prefix text elements.
|
|
69
|
+
* @csspart input-text - The input field element.
|
|
70
|
+
* @csspart trailing-button - The trailing button element that is displayed to clear the input field when the `trailingButton` property is set to true.
|
|
71
|
+
* @csspart popover-content - The popover content element.
|
|
72
|
+
*/
|
|
73
|
+
declare class Searchpopover extends Searchfield {
|
|
74
|
+
/**
|
|
75
|
+
* Whether to display the popover.
|
|
76
|
+
* @default false
|
|
77
|
+
*/
|
|
78
|
+
displayPopover?: boolean;
|
|
79
|
+
/**
|
|
80
|
+
* The placement of the popover within Searchpopover component.
|
|
81
|
+
* This defines the position of the popover relative to the search input field.
|
|
82
|
+
*
|
|
83
|
+
* Possible values:
|
|
84
|
+
* - 'top-start'
|
|
85
|
+
* - 'bottom-start'
|
|
86
|
+
* @default 'bottom-start'
|
|
87
|
+
*/
|
|
88
|
+
placement: Placement;
|
|
89
|
+
/**
|
|
90
|
+
* The z-index of the popover within Searchpopover.
|
|
91
|
+
*
|
|
92
|
+
* Override this to make sure this stays on top of other components.
|
|
93
|
+
* @default 1000
|
|
94
|
+
*/
|
|
95
|
+
popoverZIndex: number;
|
|
96
|
+
protected renderInputElement(): import("lit-html").TemplateResult<1>;
|
|
97
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
98
|
+
static styles: Array<CSSResult>;
|
|
99
|
+
}
|
|
100
|
+
export default Searchpopover;
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { html } from 'lit';
|
|
11
|
+
import { classMap } from 'lit-html/directives/class-map.js';
|
|
12
|
+
import { property } from 'lit/decorators.js';
|
|
13
|
+
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
14
|
+
import { live } from 'lit/directives/live.js';
|
|
15
|
+
import Searchfield from '../searchfield/searchfield.component';
|
|
16
|
+
import { KEYS } from '../../utils/keys';
|
|
17
|
+
import { POPOVER_PLACEMENT, DEFAULTS as POPOVER_DEFAULTS } from '../popover/popover.constants';
|
|
18
|
+
import { DEFAULTS as FORMFIELD_DEFAULTS } from '../formfieldwrapper/formfieldwrapper.constants';
|
|
19
|
+
import { ROLE } from '../../utils/roles';
|
|
20
|
+
import styles from './searchpopover.styles';
|
|
21
|
+
import { DEFAULTS, TRIGGER_ID, POPOVER_ID } from './searchpopover.constants';
|
|
22
|
+
/**
|
|
23
|
+
* `mdc-searchpopover` widget is a combination of the Searchfield and Popover components, connected to ensure
|
|
24
|
+
* proper accessibility. This component should be used when search results or suggestions need to be displayed
|
|
25
|
+
* in a popover below the search input field, where the search results hold individual actions like navigating to a
|
|
26
|
+
* a different url etc.
|
|
27
|
+
*
|
|
28
|
+
* - Don't use this when search results are displayed inline on the page -> use Searchfield component instead.
|
|
29
|
+
* - Don't use this when a list of options is filtered based on the search input -> use Combobox component instead.
|
|
30
|
+
*
|
|
31
|
+
* It supports `mdc-inputchip` as filters.
|
|
32
|
+
*
|
|
33
|
+
* This component is built by extending the `mdc-searchfield` component & rendering the mdc-popover component inside.
|
|
34
|
+
*
|
|
35
|
+
* @tagname mdc-searchpopover
|
|
36
|
+
*
|
|
37
|
+
* @event input - (React: onInput) This event is dispatched when the value of the input field changes (every press).
|
|
38
|
+
* @event change - (React: onChange) This event is dispatched when the value of the input field changes (on blur).
|
|
39
|
+
* @event focus - (React: onFocus) This event is dispatched when the input receives focus.
|
|
40
|
+
* @event blur - (React: onBlur) This event is dispatched when the input loses focus.
|
|
41
|
+
* @event clear - (React: onClear) This event is dispatched when the input text is cleared.
|
|
42
|
+
* @event shown - (React: onShown) This event is dispatched when the popover is shown
|
|
43
|
+
* @event hidden - (React: onHidden) This event is dispatched when the popover is hidden
|
|
44
|
+
*
|
|
45
|
+
* @slot default - Default slot (=children) for the popover content
|
|
46
|
+
* @slot filters - Slot for input chips
|
|
47
|
+
* @slot label - Slot for the label element. If not provided, the `label` property will be used to render the label.
|
|
48
|
+
* @slot toggletip - Slot for the toggletip info icon button. If not provided, the `toggletip-text` property will be used to render the info icon button and toggletip.
|
|
49
|
+
* @slot help-icon - Slot for the helper/validation icon. If not provided, the icon will be rendered based on the `helpTextType` property.
|
|
50
|
+
* @slot help-text - Slot for the helper/validation text. If not provided, the `helpText` property will be used to render the helper/validation text.
|
|
51
|
+
* @slot input - Slot for the input element. If not provided, the input field will be rendered.
|
|
52
|
+
* @slot input-leading-icon - Slot for the leading icon before the input field. If not provided, the `leadingIcon` property will be used to render the leading icon.
|
|
53
|
+
* @slot input-prefix-text - Slot for the prefix text before the input field. If not provided, the `prefixText` property will be used to render the prefix text.
|
|
54
|
+
* @slot trailing-button - Slot for the trailing button to clear the input field. If not provided, the clear button will be rendered when `trailingButton` property is set to true.
|
|
55
|
+
*
|
|
56
|
+
* @cssproperty --mdc-label-font-size - Font size for the label text.
|
|
57
|
+
* @cssproperty --mdc-label-font-weight - Font weight for the label text.
|
|
58
|
+
* @cssproperty --mdc-label-line-height - Line height for the label text.
|
|
59
|
+
* @cssproperty --mdc-label-color - Color for the label text.
|
|
60
|
+
* @cssproperty --mdc-help-text-font-size - Font size for the help text.
|
|
61
|
+
* @cssproperty --mdc-help-text-font-weight - Font weight for the help text.
|
|
62
|
+
* @cssproperty --mdc-help-text-line-height - Line height for the help text.
|
|
63
|
+
* @cssproperty --mdc-help-text-color - Color for the help text.
|
|
64
|
+
* @cssproperty --mdc-required-indicator-color - Color for the required indicator text.
|
|
65
|
+
* @cssproperty --mdc-input-text-color - Text color for the input field
|
|
66
|
+
* @cssproperty --mdc-input-border-color - Border color for the input container
|
|
67
|
+
* @cssproperty --mdc-input-background-color - Background color for the input field
|
|
68
|
+
* @cssproperty --mdc-input-support-text-color - Text color for the help text
|
|
69
|
+
* @cssproperty --mdc-input-selection-text-color - Text color for the selected text
|
|
70
|
+
* @cssproperty --mdc-input-selection-background-color - Background color for the selected text
|
|
71
|
+
* @cssproperty --mdc-searchpopover-width - Width of the searchpopover component
|
|
72
|
+
* @cssproperty --mdc-searchpopover-popover-width - Width of the popover within the searchpopover component
|
|
73
|
+
* @cssproperty --mdc-searchpopover-popover-height - Height of the popover within the searchpopover component
|
|
74
|
+
*
|
|
75
|
+
* @csspart label - The label element.
|
|
76
|
+
* @csspart label-text - The container for the label and required indicator elements.
|
|
77
|
+
* @csspart required-indicator - The required indicator element that is displayed next to the label when the `required` property is set to true.
|
|
78
|
+
* @csspart info-icon-btn - The info icon button element that is displayed next to the label when the `toggletip-text` property is set.
|
|
79
|
+
* @csspart label-toggletip - The toggletip element that is displayed when the info icon button is clicked.
|
|
80
|
+
* @csspart help-text - The helper/validation text element.
|
|
81
|
+
* @csspart helper-icon - The helper/validation icon element that is displayed next to the helper/validation text.
|
|
82
|
+
* @csspart help-text-container - The container for the helper/validation icon and text elements.
|
|
83
|
+
* @csspart leading-icon - The leading icon element that is displayed before the input field.
|
|
84
|
+
* @csspart prefix-text - The prefix text element that is displayed before the input field.
|
|
85
|
+
* @csspart input-container - The container for the input field, leading icon, prefix text, and trailing button elements.
|
|
86
|
+
* @csspart input-section - The container for the input field, leading icon, and prefix text elements.
|
|
87
|
+
* @csspart input-text - The input field element.
|
|
88
|
+
* @csspart trailing-button - The trailing button element that is displayed to clear the input field when the `trailingButton` property is set to true.
|
|
89
|
+
* @csspart popover-content - The popover content element.
|
|
90
|
+
*/
|
|
91
|
+
class Searchpopover extends Searchfield {
|
|
92
|
+
constructor() {
|
|
93
|
+
super(...arguments);
|
|
94
|
+
/**
|
|
95
|
+
* Whether to display the popover.
|
|
96
|
+
* @default false
|
|
97
|
+
*/
|
|
98
|
+
this.displayPopover = DEFAULTS.DISPLAY_POPOVER;
|
|
99
|
+
/**
|
|
100
|
+
* The placement of the popover within Searchpopover component.
|
|
101
|
+
* This defines the position of the popover relative to the search input field.
|
|
102
|
+
*
|
|
103
|
+
* Possible values:
|
|
104
|
+
* - 'top-start'
|
|
105
|
+
* - 'bottom-start'
|
|
106
|
+
* @default 'bottom-start'
|
|
107
|
+
*/
|
|
108
|
+
this.placement = POPOVER_PLACEMENT.BOTTOM_START;
|
|
109
|
+
/**
|
|
110
|
+
* The z-index of the popover within Searchpopover.
|
|
111
|
+
*
|
|
112
|
+
* Override this to make sure this stays on top of other components.
|
|
113
|
+
* @default 1000
|
|
114
|
+
*/
|
|
115
|
+
this.popoverZIndex = POPOVER_DEFAULTS.Z_INDEX;
|
|
116
|
+
}
|
|
117
|
+
renderInputElement() {
|
|
118
|
+
var _a, _b;
|
|
119
|
+
const placeholderText = this.hasInputChips ? '' : this.placeholder;
|
|
120
|
+
return html `<input
|
|
121
|
+
aria-label="${(_a = this.dataAriaLabel) !== null && _a !== void 0 ? _a : ''}"
|
|
122
|
+
part="input-text"
|
|
123
|
+
id="${this.inputId}"
|
|
124
|
+
name="${this.name}"
|
|
125
|
+
.value="${live(this.value)}"
|
|
126
|
+
?disabled="${this.disabled}"
|
|
127
|
+
?readonly="${this.readonly}"
|
|
128
|
+
?required="${this.required}"
|
|
129
|
+
type="${DEFAULTS.TYPE}"
|
|
130
|
+
aria-expanded="${this.displayPopover ? 'true' : 'false'}"
|
|
131
|
+
aria-controls="${POPOVER_ID}"
|
|
132
|
+
aria-owns="${POPOVER_ID}"
|
|
133
|
+
aria-haspopup="${ROLE.DIALOG}"
|
|
134
|
+
aria-describedby="${ifDefined(this.helpText ? FORMFIELD_DEFAULTS.HELPER_TEXT_ID : ((_b = this.dataAriaDescribedby) !== null && _b !== void 0 ? _b : ''))}"
|
|
135
|
+
aria-invalid="${this.helpTextType === 'error' ? 'true' : 'false'}"
|
|
136
|
+
placeholder=${ifDefined(placeholderText)}
|
|
137
|
+
minlength=${ifDefined(this.minlength)}
|
|
138
|
+
maxlength=${ifDefined(this.maxlength)}
|
|
139
|
+
autocapitalize=${this.autocapitalize}
|
|
140
|
+
autocomplete=${this.autocomplete}
|
|
141
|
+
dirname=${ifDefined(this.dirname)}
|
|
142
|
+
pattern=${ifDefined(this.pattern)}
|
|
143
|
+
list=${ifDefined(this.list)}
|
|
144
|
+
size=${ifDefined(this.size)}
|
|
145
|
+
@input=${this.onInput}
|
|
146
|
+
@change=${this.onChange}
|
|
147
|
+
@keydown=${this.handleKeyDown}
|
|
148
|
+
role=${ifDefined(ROLE.COMBOBOX)}
|
|
149
|
+
/>`;
|
|
150
|
+
}
|
|
151
|
+
render() {
|
|
152
|
+
return html `
|
|
153
|
+
${this.renderLabelElement()}
|
|
154
|
+
<div
|
|
155
|
+
class="${classMap({
|
|
156
|
+
'mdc-focus-ring': this.isInputFocused,
|
|
157
|
+
})}"
|
|
158
|
+
part="input-container"
|
|
159
|
+
id="${TRIGGER_ID}"
|
|
160
|
+
>
|
|
161
|
+
${this.renderLeadingIcon()}
|
|
162
|
+
<div part="scrollable-container" tabindex="-1">
|
|
163
|
+
<div
|
|
164
|
+
part="filters-container"
|
|
165
|
+
@click=${() => this.inputElement.focus()}
|
|
166
|
+
@keydown=${(e) => (e.key === KEYS.ENTER ? this.inputElement.focus() : null)}
|
|
167
|
+
@keyup=${(e) => (e.key === KEYS.SPACE ? this.inputElement.focus() : null)}
|
|
168
|
+
>
|
|
169
|
+
<slot name="filters" @slotchange=${this.renderInputChips}></slot>
|
|
170
|
+
</div>
|
|
171
|
+
${this.renderInputElement()}
|
|
172
|
+
</div>
|
|
173
|
+
${this.renderTrailingButton(this.hasInputChips)}
|
|
174
|
+
</div>
|
|
175
|
+
<mdc-popover
|
|
176
|
+
triggerID="${TRIGGER_ID}"
|
|
177
|
+
id="${POPOVER_ID}"
|
|
178
|
+
trigger="manual"
|
|
179
|
+
interactive
|
|
180
|
+
?visible=${this.displayPopover}
|
|
181
|
+
hide-on-outside-click
|
|
182
|
+
hide-on-escape
|
|
183
|
+
focus-back-to-trigger
|
|
184
|
+
size
|
|
185
|
+
placement="${this.placement}"
|
|
186
|
+
disable-aria-expanded
|
|
187
|
+
z-index="${ifDefined(this.popoverZIndex)}"
|
|
188
|
+
exportparts="popover-content"
|
|
189
|
+
>
|
|
190
|
+
<slot></slot>
|
|
191
|
+
</mdc-popover>
|
|
192
|
+
`;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
Searchpopover.styles = [...Searchfield.styles, ...styles];
|
|
196
|
+
__decorate([
|
|
197
|
+
property({ type: Boolean, reflect: true, attribute: 'display-popover' }),
|
|
198
|
+
__metadata("design:type", Boolean)
|
|
199
|
+
], Searchpopover.prototype, "displayPopover", void 0);
|
|
200
|
+
__decorate([
|
|
201
|
+
property({ type: String, reflect: true }),
|
|
202
|
+
__metadata("design:type", String)
|
|
203
|
+
], Searchpopover.prototype, "placement", void 0);
|
|
204
|
+
__decorate([
|
|
205
|
+
property({ type: Number, reflect: true, attribute: 'popover-z-index' }),
|
|
206
|
+
__metadata("design:type", Number)
|
|
207
|
+
], Searchpopover.prototype, "popoverZIndex", void 0);
|
|
208
|
+
export default Searchpopover;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
declare const TAG_NAME: "mdc-searchpopover";
|
|
2
|
+
declare const DEFAULTS: {
|
|
3
|
+
readonly TYPE: "text";
|
|
4
|
+
readonly DISPLAY_POPOVER: false;
|
|
5
|
+
};
|
|
6
|
+
declare const TRIGGER_ID = "searchpopover-container-triggerid";
|
|
7
|
+
declare const POPOVER_ID = "searchpopover-popoverid";
|
|
8
|
+
export { TAG_NAME, DEFAULTS, TRIGGER_ID, POPOVER_ID };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import utils from '../../utils/tag-name';
|
|
2
|
+
import { INPUT_TYPE } from '../input/input.constants';
|
|
3
|
+
const TAG_NAME = utils.constructTagName('searchpopover');
|
|
4
|
+
const DEFAULTS = {
|
|
5
|
+
TYPE: INPUT_TYPE.TEXT,
|
|
6
|
+
DISPLAY_POPOVER: false,
|
|
7
|
+
};
|
|
8
|
+
const TRIGGER_ID = 'searchpopover-container-triggerid';
|
|
9
|
+
const POPOVER_ID = 'searchpopover-popoverid';
|
|
10
|
+
export { TAG_NAME, DEFAULTS, TRIGGER_ID, POPOVER_ID };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { css } from 'lit';
|
|
2
|
+
const styles = css `
|
|
3
|
+
:host {
|
|
4
|
+
--mdc-searchpopover-width: 100%;
|
|
5
|
+
--mdc-searchpopover-popover-width: var(--mdc-searchpopover-width);
|
|
6
|
+
--mdc-searchpopover-popover-height: auto;
|
|
7
|
+
|
|
8
|
+
width: var(--mdc-searchpopover-width);
|
|
9
|
+
position: relative;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/* Popover height, width & padding overrides */
|
|
13
|
+
:host mdc-popover {
|
|
14
|
+
--mdc-popover-max-width: var(--mdc-searchpopover-popover-width);
|
|
15
|
+
--mdc-popover-max-height: var(--mdc-searchpopover-popover-height);
|
|
16
|
+
}
|
|
17
|
+
:host mdc-popover::part(popover-content) {
|
|
18
|
+
max-height: var(--mdc-popover-max-height);
|
|
19
|
+
min-width: auto;
|
|
20
|
+
padding: 0.75rem 0.5rem;
|
|
21
|
+
}
|
|
22
|
+
`;
|
|
23
|
+
export default [styles];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Events as InputEvents } from '../input/input.types';
|
|
2
|
+
import type { PopoverPlacement, PopoverShownEvent, PopoverHiddenEvent } from '../popover/popover.types';
|
|
3
|
+
type Placement = Extract<PopoverPlacement, 'bottom-start' | 'top-start'>;
|
|
4
|
+
type Events = InputEvents & {
|
|
5
|
+
onShownEvent: PopoverShownEvent;
|
|
6
|
+
onHiddenEvent: PopoverHiddenEvent;
|
|
7
|
+
};
|
|
8
|
+
export type { Events, Placement };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|