@tylertech/forge 3.1.2 → 3.1.3

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.
@@ -2899,6 +2899,11 @@
2899
2899
  "name": "noninteractive",
2900
2900
  "description": "Controls whether the list item will automatically attach itself to interactive slotted elements or not.",
2901
2901
  "values": []
2902
+ },
2903
+ {
2904
+ "name": "focus-propagation",
2905
+ "description": "Controls whether the interactive element will receive focus if a non-interactive element is clicked within the list item.",
2906
+ "values": []
2902
2907
  }
2903
2908
  ],
2904
2909
  "references": []
@@ -22,8 +22,10 @@ export class DateRangePickerAdapter extends BaseDatePickerAdapter {
22
22
  if (!this._fromInputElement || !this._fromInputElement) {
23
23
  throw new Error(`The ${DATE_RANGE_PICKER_CONSTANTS.elementName} requires two inputs`);
24
24
  }
25
- const separator = this._createInputSeparator();
26
- this._fromInputElement.insertAdjacentElement('afterend', separator);
25
+ if (!this._component.querySelector(`[${FIELD_CONSTANTS.attributes.MULTI_INPUT_SEPARATOR}]`)) {
26
+ const separator = this._createInputSeparator();
27
+ this._fromInputElement.insertAdjacentElement('afterend', separator);
28
+ }
27
29
  }
28
30
  _initializeCalendarDropdown() {
29
31
  const targetElement = this._getDefaultTargetElement();
@@ -15,6 +15,7 @@ export declare const LIST_ITEM_CONSTANTS: {
15
15
  THREE_LINE: string;
16
16
  WRAP: string;
17
17
  NONINTERACTIVE: string;
18
+ FOCUS_PROPAGATION: string;
18
19
  };
19
20
  attributes: {
20
21
  SELECTED: string;
@@ -26,6 +27,7 @@ export declare const LIST_ITEM_CONSTANTS: {
26
27
  THREE_LINE: string;
27
28
  WRAP: string;
28
29
  NONINTERACTIVE: string;
30
+ FOCUS_PROPAGATION: string;
29
31
  };
30
32
  classes: {
31
33
  ROOT: string;
@@ -47,7 +49,11 @@ export declare const LIST_ITEM_CONSTANTS: {
47
49
  events: {
48
50
  SELECT: string;
49
51
  };
52
+ defaults: {
53
+ FOCUS_PROPAGATION: ListItemFocusPropagation;
54
+ };
50
55
  };
51
56
  export interface IListItemSelectEventData<T = any> {
52
57
  value: T;
53
58
  }
59
+ export type ListItemFocusPropagation = 'allow' | 'off';
@@ -14,7 +14,8 @@ const observedAttributes = {
14
14
  TWO_LINE: 'two-line',
15
15
  THREE_LINE: 'three-line',
16
16
  WRAP: 'wrap',
17
- NONINTERACTIVE: 'noninteractive'
17
+ NONINTERACTIVE: 'noninteractive',
18
+ FOCUS_PROPAGATION: 'focus-propagation'
18
19
  };
19
20
  const attributes = {
20
21
  ...observedAttributes
@@ -39,6 +40,9 @@ const selectors = {
39
40
  const events = {
40
41
  SELECT: `${elementName}-select`
41
42
  };
43
+ const defaults = {
44
+ FOCUS_PROPAGATION: 'allow'
45
+ };
42
46
  export const LIST_ITEM_CONSTANTS = {
43
47
  elementName,
44
48
  observedAttributes,
@@ -46,5 +50,6 @@ export const LIST_ITEM_CONSTANTS = {
46
50
  classes,
47
51
  selectors,
48
52
  ids,
49
- events
53
+ events,
54
+ defaults
50
55
  };
@@ -4,6 +4,7 @@
4
4
  * License: Apache-2.0
5
5
  */
6
6
  import { IListItemAdapter } from './list-item-adapter';
7
+ import { ListItemFocusPropagation } from './list-item-constants';
7
8
  export interface IListItemCore {
8
9
  selected: boolean;
9
10
  active: boolean;
@@ -14,6 +15,7 @@ export interface IListItemCore {
14
15
  threeLine: boolean;
15
16
  wrap: boolean;
16
17
  noninteractive: boolean;
18
+ focusPropagation: ListItemFocusPropagation;
17
19
  }
18
20
  export declare class ListItemCore implements IListItemCore {
19
21
  private _adapter;
@@ -26,6 +28,7 @@ export declare class ListItemCore implements IListItemCore {
26
28
  private _threeLine;
27
29
  private _wrap;
28
30
  private _noninteractive;
31
+ private _focusPropagation;
29
32
  private _interactiveStateChangeListener;
30
33
  private _mousedownListener;
31
34
  private _clickListener;
@@ -57,4 +60,6 @@ export declare class ListItemCore implements IListItemCore {
57
60
  set wrap(value: boolean);
58
61
  get noninteractive(): boolean;
59
62
  set noninteractive(value: boolean);
63
+ get focusPropagation(): ListItemFocusPropagation;
64
+ set focusPropagation(value: ListItemFocusPropagation);
60
65
  }
@@ -15,6 +15,7 @@ export class ListItemCore {
15
15
  this._threeLine = false;
16
16
  this._wrap = false;
17
17
  this._noninteractive = false;
18
+ this._focusPropagation = LIST_ITEM_CONSTANTS.defaults.FOCUS_PROPAGATION;
18
19
  this._interactiveStateChangeListener = this._onInteractiveStateChange.bind(this);
19
20
  this._mousedownListener = this._onMousedown.bind(this);
20
21
  this._clickListener = this._onClick.bind(this);
@@ -35,7 +36,7 @@ export class ListItemCore {
35
36
  _onMousedown(evt) {
36
37
  const composedElements = evt.composedPath().filter((el) => el.nodeType === Node.ELEMENT_NODE);
37
38
  const fromInteractiveElement = composedElements.some(el => el === this._adapter.interactiveElement);
38
- if (!fromInteractiveElement) {
39
+ if (this._focusPropagation === 'off' || !fromInteractiveElement) {
39
40
  evt.preventDefault();
40
41
  }
41
42
  }
@@ -104,7 +105,9 @@ export class ListItemCore {
104
105
  this._dispatchSelectEvent();
105
106
  }
106
107
  _clickInteractiveElement() {
107
- this._adapter.interactiveElement?.focus();
108
+ if (this._focusPropagation === 'allow') {
109
+ this._adapter.interactiveElement?.focus();
110
+ }
108
111
  this._adapter.tempDeactivateFocusIndicator(); // Workaround until we can call `focus({ focusVisible: false })` to prevent focus ring from showing
109
112
  this._adapter.interactiveElement?.click();
110
113
  }
@@ -227,4 +230,16 @@ export class ListItemCore {
227
230
  this._adapter.toggleHostAttribute(LIST_ITEM_CONSTANTS.attributes.NONINTERACTIVE, this._noninteractive);
228
231
  }
229
232
  }
233
+ get focusPropagation() {
234
+ return this._focusPropagation;
235
+ }
236
+ set focusPropagation(value) {
237
+ if (!['allow', 'off'].includes(value)) {
238
+ value = LIST_ITEM_CONSTANTS.defaults.FOCUS_PROPAGATION;
239
+ }
240
+ if (this._focusPropagation !== value) {
241
+ this._focusPropagation = value;
242
+ this._adapter.toggleHostAttribute(LIST_ITEM_CONSTANTS.attributes.FOCUS_PROPAGATION, this._focusPropagation !== LIST_ITEM_CONSTANTS.defaults.FOCUS_PROPAGATION, this._focusPropagation);
243
+ }
244
+ }
230
245
  }
@@ -3,7 +3,7 @@
3
3
  * Copyright Tyler Technologies, Inc.
4
4
  * License: Apache-2.0
5
5
  */
6
- import { IListItemSelectEventData } from './list-item-constants';
6
+ import { IListItemSelectEventData, ListItemFocusPropagation } from './list-item-constants';
7
7
  import { IWithElementInternals } from '../../core/mixins/internals/with-element-internals';
8
8
  import { IWithDefaultAria } from '../../core/mixins/internals/with-default-aria';
9
9
  import { BaseComponent } from '../../core/base/base-component';
@@ -17,6 +17,7 @@ export interface IListItemProperties<T = unknown> {
17
17
  threeLine: boolean;
18
18
  wrap: boolean;
19
19
  noninteractive: boolean;
20
+ focusPropagation: ListItemFocusPropagation;
20
21
  }
21
22
  export interface IListItemComponent<T = unknown> extends IListItemProperties<T>, IWithElementInternals, IWithDefaultAria {
22
23
  }
@@ -43,6 +44,7 @@ declare const ListItemComponent_base: import("../..").AbstractConstructor<import
43
44
  * @property {boolean} [threeLine=false] - Sets the list item height to support at least three lines of text.
44
45
  * @property {boolean} [wrap=false] - Sets the list item to wrap its text content.
45
46
  * @property {boolean} [noninteractive=false] - Controls whether the list item will automatically attach itself to interactive slotted elements or not.
47
+ * @property {boolean} [focusPropagation="allow"] - Controls whether the interactive element will receive focus if a non-interactive element is clicked within the list item.
46
48
  *
47
49
  * @attribute {boolean} [selected=false] - Applies the selected state to the list item.
48
50
  * @attribute {boolean} [active=false] - Applies the active state to the list item by emulating its focused state.
@@ -53,6 +55,7 @@ declare const ListItemComponent_base: import("../..").AbstractConstructor<import
53
55
  * @attribute {boolean} [three-line=false] - Sets the list item height to support at least three lines of text.
54
56
  * @attribute {boolean} [wrap=false] - Sets the list item to wrap its text content.
55
57
  * @attribute {boolean} [noninteractive=false] - Controls whether the list item will automatically attach itself to interactive slotted elements or not.
58
+ * @attribute {boolean} [focus-propagation="allow"] - Controls whether the interactive element will receive focus if a non-interactive element is clicked within the list item.
56
59
  *
57
60
  * @event {CustomEvent<IListItemSelectEventData>} forge-list-item-select - Fires when the list item is selected.
58
61
  *
@@ -128,5 +131,6 @@ export declare class ListItemComponent extends ListItemComponent_base implements
128
131
  threeLine: boolean;
129
132
  wrap: boolean;
130
133
  noninteractive: boolean;
134
+ focusPropagation: ListItemFocusPropagation;
131
135
  }
132
136
  export {};
@@ -29,6 +29,7 @@ const styles = ':host{--_list-item-indent:var(--forge-list-item-indent, var(--fo
29
29
  * @property {boolean} [threeLine=false] - Sets the list item height to support at least three lines of text.
30
30
  * @property {boolean} [wrap=false] - Sets the list item to wrap its text content.
31
31
  * @property {boolean} [noninteractive=false] - Controls whether the list item will automatically attach itself to interactive slotted elements or not.
32
+ * @property {boolean} [focusPropagation="allow"] - Controls whether the interactive element will receive focus if a non-interactive element is clicked within the list item.
32
33
  *
33
34
  * @attribute {boolean} [selected=false] - Applies the selected state to the list item.
34
35
  * @attribute {boolean} [active=false] - Applies the active state to the list item by emulating its focused state.
@@ -39,6 +40,7 @@ const styles = ':host{--_list-item-indent:var(--forge-list-item-indent, var(--fo
39
40
  * @attribute {boolean} [three-line=false] - Sets the list item height to support at least three lines of text.
40
41
  * @attribute {boolean} [wrap=false] - Sets the list item to wrap its text content.
41
42
  * @attribute {boolean} [noninteractive=false] - Controls whether the list item will automatically attach itself to interactive slotted elements or not.
43
+ * @attribute {boolean} [focus-propagation="allow"] - Controls whether the interactive element will receive focus if a non-interactive element is clicked within the list item.
42
44
  *
43
45
  * @event {CustomEvent<IListItemSelectEventData>} forge-list-item-select - Fires when the list item is selected.
44
46
  *
@@ -142,6 +144,9 @@ let ListItemComponent = class ListItemComponent extends WithElementInternals(Wit
142
144
  case LIST_ITEM_CONSTANTS.observedAttributes.NONINTERACTIVE:
143
145
  this.noninteractive = coerceBoolean(newValue);
144
146
  break;
147
+ case LIST_ITEM_CONSTANTS.observedAttributes.FOCUS_PROPAGATION:
148
+ this.focusPropagation = newValue;
149
+ break;
145
150
  }
146
151
  }
147
152
  };
@@ -172,6 +177,9 @@ __decorate([
172
177
  __decorate([
173
178
  coreProperty()
174
179
  ], ListItemComponent.prototype, "noninteractive", void 0);
180
+ __decorate([
181
+ coreProperty()
182
+ ], ListItemComponent.prototype, "focusPropagation", void 0);
175
183
  ListItemComponent = __decorate([
176
184
  customElement({
177
185
  name: LIST_ITEM_CONSTANTS.elementName,
@@ -152,6 +152,7 @@ export function createListItems(config, listElement, options, startIndex = 0, re
152
152
  }
153
153
  let listItemElement = document.createElement('forge-list-item');
154
154
  listItemElement.value = option.value;
155
+ listItemElement.focusPropagation = 'off';
155
156
  listItemElement.setAttribute('role', 'presentation');
156
157
  const buttonElement = document.createElement('button');
157
158
  buttonElement.type = 'button';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tylertech/forge",
3
3
  "description": "Tyler Forge™ Web Components library",
4
- "version": "3.1.2",
4
+ "version": "3.1.3",
5
5
  "author": "Tyler Technologies, Inc.",
6
6
  "license": "Apache-2.0",
7
7
  "repository": {