@ni/fast-foundation 10.1.4 → 10.2.0
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/esm/accordion/accordion.js +1 -2
- package/dist/esm/anchor/anchor.js +2 -4
- package/dist/esm/anchored-region/anchored-region-config.js +32 -6
- package/dist/esm/anchored-region/anchored-region.js +1 -1
- package/dist/esm/breadcrumb/breadcrumb.js +2 -3
- package/dist/esm/button/button.js +5 -10
- package/dist/esm/calendar/calendar.template.js +1 -2
- package/dist/esm/calendar/date-formatter.js +4 -1
- package/dist/esm/combobox/combobox.js +7 -11
- package/dist/esm/data-grid/data-grid-cell.js +1 -2
- package/dist/esm/data-grid/data-grid.js +11 -11
- package/dist/esm/design-system/design-system.js +4 -1
- package/dist/esm/design-token/custom-property-manager.js +2 -2
- package/dist/esm/design-token/design-token.js +16 -17
- package/dist/esm/di/di.js +2 -3
- package/dist/esm/dialog/dialog.js +2 -4
- package/dist/esm/directives/reflect-attributes.js +1 -1
- package/dist/esm/form-associated/form-associated.js +3 -5
- package/dist/esm/foundation-element/foundation-element.js +4 -1
- package/dist/esm/horizontal-scroll/horizontal-scroll.js +6 -9
- package/dist/esm/horizontal-scroll/horizontal-scroll.template.js +8 -11
- package/dist/esm/listbox/listbox.element.js +5 -10
- package/dist/esm/listbox/listbox.js +21 -28
- package/dist/esm/listbox-option/listbox-option.js +4 -7
- package/dist/esm/menu/menu.js +1 -1
- package/dist/esm/number-field/number-field.js +2 -4
- package/dist/esm/picker/picker-list-item.js +3 -4
- package/dist/esm/picker/picker-menu-option.js +3 -4
- package/dist/esm/picker/picker.js +12 -9
- package/dist/esm/radio/radio.js +3 -5
- package/dist/esm/radio-group/radio-group.js +4 -8
- package/dist/esm/select/select.js +12 -20
- package/dist/esm/tabs/tabs.js +2 -4
- package/dist/esm/test-utilities/fixture.js +57 -60
- package/dist/esm/test-utilities/timeout.js +5 -8
- package/dist/esm/toolbar/toolbar.js +7 -9
- package/dist/esm/utilities/intersection-service.js +2 -4
- package/dist/fast-foundation.js +243 -262
- package/dist/fast-foundation.min.js +88 -88
- package/package.json +8 -6
package/dist/fast-foundation.js
CHANGED
|
@@ -26,7 +26,7 @@ const $global = (function () {
|
|
|
26
26
|
// eslint-disable-next-line no-new-func
|
|
27
27
|
return new Function("return this")();
|
|
28
28
|
}
|
|
29
|
-
catch
|
|
29
|
+
catch {
|
|
30
30
|
// If all fails, give up and create an object.
|
|
31
31
|
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
32
32
|
return {};
|
|
@@ -42,7 +42,10 @@ const propConfig = {
|
|
|
42
42
|
writable: false,
|
|
43
43
|
};
|
|
44
44
|
if ($global.FAST === void 0) {
|
|
45
|
-
Reflect.defineProperty($global, "FAST",
|
|
45
|
+
Reflect.defineProperty($global, "FAST", {
|
|
46
|
+
value: Object.create(null),
|
|
47
|
+
...propConfig,
|
|
48
|
+
});
|
|
46
49
|
}
|
|
47
50
|
/**
|
|
48
51
|
* The FAST global.
|
|
@@ -51,13 +54,16 @@ if ($global.FAST === void 0) {
|
|
|
51
54
|
const FAST = $global.FAST;
|
|
52
55
|
if (FAST.getById === void 0) {
|
|
53
56
|
const storage = Object.create(null);
|
|
54
|
-
Reflect.defineProperty(FAST, "getById",
|
|
57
|
+
Reflect.defineProperty(FAST, "getById", {
|
|
58
|
+
value(id, initialize) {
|
|
55
59
|
let found = storage[id];
|
|
56
60
|
if (found === void 0) {
|
|
57
61
|
found = initialize ? (storage[id] = initialize()) : null;
|
|
58
62
|
}
|
|
59
63
|
return found;
|
|
60
|
-
}
|
|
64
|
+
},
|
|
65
|
+
...propConfig,
|
|
66
|
+
});
|
|
61
67
|
}
|
|
62
68
|
/**
|
|
63
69
|
* A readonly, empty array.
|
|
@@ -426,12 +432,11 @@ class PropertyChangeNotifier {
|
|
|
426
432
|
* @param propertyName - The property name, passed along to subscribers during notification.
|
|
427
433
|
*/
|
|
428
434
|
notify(propertyName) {
|
|
429
|
-
var _a;
|
|
430
435
|
const subscribers = this.subscribers[propertyName];
|
|
431
436
|
if (subscribers !== void 0) {
|
|
432
437
|
subscribers.notify(propertyName);
|
|
433
438
|
}
|
|
434
|
-
|
|
439
|
+
this.sourceSubscribers?.notify(propertyName);
|
|
435
440
|
}
|
|
436
441
|
/**
|
|
437
442
|
* Subscribes to notification of changes in an object's state.
|
|
@@ -439,7 +444,6 @@ class PropertyChangeNotifier {
|
|
|
439
444
|
* @param propertyToWatch - The name of the property that the subscriber is interested in watching for changes.
|
|
440
445
|
*/
|
|
441
446
|
subscribe(subscriber, propertyToWatch) {
|
|
442
|
-
var _a;
|
|
443
447
|
if (propertyToWatch) {
|
|
444
448
|
let subscribers = this.subscribers[propertyToWatch];
|
|
445
449
|
if (subscribers === void 0) {
|
|
@@ -449,7 +453,7 @@ class PropertyChangeNotifier {
|
|
|
449
453
|
}
|
|
450
454
|
else {
|
|
451
455
|
this.sourceSubscribers =
|
|
452
|
-
|
|
456
|
+
this.sourceSubscribers ?? new SubscriberSet(this.source);
|
|
453
457
|
this.sourceSubscribers.subscribe(subscriber);
|
|
454
458
|
}
|
|
455
459
|
}
|
|
@@ -459,7 +463,6 @@ class PropertyChangeNotifier {
|
|
|
459
463
|
* @param propertyToUnwatch - The name of the property that the subscriber is no longer interested in watching.
|
|
460
464
|
*/
|
|
461
465
|
unsubscribe(subscriber, propertyToUnwatch) {
|
|
462
|
-
var _a;
|
|
463
466
|
if (propertyToUnwatch) {
|
|
464
467
|
const subscribers = this.subscribers[propertyToUnwatch];
|
|
465
468
|
if (subscribers !== void 0) {
|
|
@@ -467,7 +470,7 @@ class PropertyChangeNotifier {
|
|
|
467
470
|
}
|
|
468
471
|
}
|
|
469
472
|
else {
|
|
470
|
-
|
|
473
|
+
this.sourceSubscribers?.unsubscribe(subscriber);
|
|
471
474
|
}
|
|
472
475
|
}
|
|
473
476
|
}
|
|
@@ -477,7 +480,7 @@ class PropertyChangeNotifier {
|
|
|
477
480
|
* @public
|
|
478
481
|
*/
|
|
479
482
|
const Observable = FAST.getById(2 /* KernelServiceId.observable */, () => {
|
|
480
|
-
const volatileRegex = /(
|
|
483
|
+
const volatileRegex = /(\?\?|:|&&|\|\||if)/;
|
|
481
484
|
const notifierLookup = new WeakMap();
|
|
482
485
|
const queueUpdate = DOM.queueUpdate;
|
|
483
486
|
let watcher = void 0;
|
|
@@ -1025,14 +1028,15 @@ class HTMLBindingDirective extends TargetedHTMLDirective {
|
|
|
1025
1028
|
/**
|
|
1026
1029
|
* Creates an instance of BindingDirective.
|
|
1027
1030
|
* @param binding - A binding that returns the data used to update the DOM.
|
|
1031
|
+
* @param isVolatile - Optional parameter indicating whether the binding is volatile. If not provided, the volatility of the binding is determined by Observable.isVolatileBinding().
|
|
1028
1032
|
*/
|
|
1029
|
-
constructor(binding) {
|
|
1033
|
+
constructor(binding, isVolatile) {
|
|
1030
1034
|
super();
|
|
1031
1035
|
this.binding = binding;
|
|
1032
1036
|
this.bind = normalBind;
|
|
1033
1037
|
this.unbind = normalUnbind;
|
|
1034
1038
|
this.updateTarget = updateAttributeTarget;
|
|
1035
|
-
this.isBindingVolatile = Observable.isVolatileBinding(this.binding);
|
|
1039
|
+
this.isBindingVolatile = isVolatile ?? Observable.isVolatileBinding(this.binding);
|
|
1036
1040
|
}
|
|
1037
1041
|
/**
|
|
1038
1042
|
* Gets/sets the name of the attribute or property that this
|
|
@@ -1167,12 +1171,14 @@ function createAggregateBinding(parts) {
|
|
|
1167
1171
|
return parts[0];
|
|
1168
1172
|
}
|
|
1169
1173
|
let targetName;
|
|
1174
|
+
let isVolatile = false;
|
|
1170
1175
|
const partCount = parts.length;
|
|
1171
1176
|
const finalParts = parts.map((x) => {
|
|
1172
1177
|
if (typeof x === "string") {
|
|
1173
1178
|
return () => x;
|
|
1174
1179
|
}
|
|
1175
1180
|
targetName = x.targetName || targetName;
|
|
1181
|
+
isVolatile = isVolatile || Observable.isVolatileBinding(x.binding);
|
|
1176
1182
|
return x.binding;
|
|
1177
1183
|
});
|
|
1178
1184
|
const binding = (scope, context) => {
|
|
@@ -1182,7 +1188,7 @@ function createAggregateBinding(parts) {
|
|
|
1182
1188
|
}
|
|
1183
1189
|
return output;
|
|
1184
1190
|
};
|
|
1185
|
-
const directive = new HTMLBindingDirective(binding);
|
|
1191
|
+
const directive = new HTMLBindingDirective(binding, isVolatile);
|
|
1186
1192
|
directive.targetName = targetName;
|
|
1187
1193
|
return directive;
|
|
1188
1194
|
}
|
|
@@ -1654,20 +1660,20 @@ class ElementStyles {
|
|
|
1654
1660
|
this.behaviors === null ? behaviors : this.behaviors.concat(behaviors);
|
|
1655
1661
|
return this;
|
|
1656
1662
|
}
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1663
|
+
/**
|
|
1664
|
+
* Create ElementStyles from ComposableStyles.
|
|
1665
|
+
*/
|
|
1666
|
+
static { this.create = (() => {
|
|
1667
|
+
if (DOM.supportsAdoptedStyleSheets) {
|
|
1668
|
+
const styleSheetCache = new Map();
|
|
1669
|
+
return (styles) =>
|
|
1670
|
+
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
1671
|
+
new AdoptedStyleSheetsStyles(styles, styleSheetCache);
|
|
1672
|
+
}
|
|
1665
1673
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
1666
|
-
new
|
|
1667
|
-
}
|
|
1668
|
-
|
|
1669
|
-
return (styles) => new StyleElementStyles(styles);
|
|
1670
|
-
})();
|
|
1674
|
+
return (styles) => new StyleElementStyles(styles);
|
|
1675
|
+
})(); }
|
|
1676
|
+
}
|
|
1671
1677
|
function reduceStyles(styles) {
|
|
1672
1678
|
return styles
|
|
1673
1679
|
.map((x) => x instanceof ElementStyles ? reduceStyles(x.styles) : [x])
|
|
@@ -1727,7 +1733,7 @@ if (DOM.supportsAdoptedStyleSheets) {
|
|
|
1727
1733
|
}
|
|
1728
1734
|
};
|
|
1729
1735
|
}
|
|
1730
|
-
catch
|
|
1736
|
+
catch {
|
|
1731
1737
|
// Do nothing if an error is thrown, the default
|
|
1732
1738
|
// case handles FrozenArray.
|
|
1733
1739
|
}
|
|
@@ -2074,11 +2080,11 @@ class FASTElementDefinition {
|
|
|
2074
2080
|
? defaultShadowOptions
|
|
2075
2081
|
: nameOrConfig.shadowOptions === null
|
|
2076
2082
|
? void 0
|
|
2077
|
-
:
|
|
2083
|
+
: { ...defaultShadowOptions, ...nameOrConfig.shadowOptions };
|
|
2078
2084
|
this.elementOptions =
|
|
2079
2085
|
nameOrConfig.elementOptions === void 0
|
|
2080
2086
|
? defaultElementOptions
|
|
2081
|
-
:
|
|
2087
|
+
: { ...defaultElementOptions, ...nameOrConfig.elementOptions };
|
|
2082
2088
|
this.styles =
|
|
2083
2089
|
nameOrConfig.styles === void 0
|
|
2084
2090
|
? void 0
|
|
@@ -2110,12 +2116,12 @@ class FASTElementDefinition {
|
|
|
2110
2116
|
}
|
|
2111
2117
|
return this;
|
|
2112
2118
|
}
|
|
2119
|
+
/**
|
|
2120
|
+
* Gets the element definition associated with the specified type.
|
|
2121
|
+
* @param type - The custom element type to retrieve the definition for.
|
|
2122
|
+
*/
|
|
2123
|
+
static { this.forType = fastRegistry.getByType; }
|
|
2113
2124
|
}
|
|
2114
|
-
/**
|
|
2115
|
-
* Gets the element definition associated with the specified type.
|
|
2116
|
-
* @param type - The custom element type to retrieve the definition for.
|
|
2117
|
-
*/
|
|
2118
|
-
FASTElementDefinition.forType = fastRegistry.getByType;
|
|
2119
2125
|
|
|
2120
2126
|
const shadowRoots = new WeakMap();
|
|
2121
2127
|
const defaultEventOptions = {
|
|
@@ -2394,7 +2400,7 @@ class Controller extends PropertyChangeNotifier {
|
|
|
2394
2400
|
*/
|
|
2395
2401
|
emit(type, detail, options) {
|
|
2396
2402
|
if (this._isConnected) {
|
|
2397
|
-
return this.element.dispatchEvent(new CustomEvent(type,
|
|
2403
|
+
return this.element.dispatchEvent(new CustomEvent(type, { detail, ...defaultEventOptions, ...options }));
|
|
2398
2404
|
}
|
|
2399
2405
|
return false;
|
|
2400
2406
|
}
|
|
@@ -3493,7 +3499,10 @@ function repeat(itemsBinding, templateOrTemplateBinding, options = defaultRepeat
|
|
|
3493
3499
|
const templateBinding = typeof templateOrTemplateBinding === "function"
|
|
3494
3500
|
? templateOrTemplateBinding
|
|
3495
3501
|
: () => templateOrTemplateBinding;
|
|
3496
|
-
return new RepeatDirective(itemsBinding, templateBinding,
|
|
3502
|
+
return new RepeatDirective(itemsBinding, templateBinding, {
|
|
3503
|
+
...defaultRepeatOptions,
|
|
3504
|
+
...options,
|
|
3505
|
+
});
|
|
3497
3506
|
}
|
|
3498
3507
|
|
|
3499
3508
|
/**
|
|
@@ -4243,7 +4252,7 @@ const DI = Object.freeze({
|
|
|
4243
4252
|
Interface.friendlyName = friendlyName == null ? "(anonymous)" : friendlyName;
|
|
4244
4253
|
if (configure != null) {
|
|
4245
4254
|
Interface.register = function (container, key) {
|
|
4246
|
-
return configure(new ResolverBuilder(container, key
|
|
4255
|
+
return configure(new ResolverBuilder(container, key ?? Interface));
|
|
4247
4256
|
};
|
|
4248
4257
|
}
|
|
4249
4258
|
Interface.toString = function toString() {
|
|
@@ -4587,13 +4596,12 @@ class ResolverImpl {
|
|
|
4587
4596
|
}
|
|
4588
4597
|
}
|
|
4589
4598
|
getFactory(container) {
|
|
4590
|
-
var _a, _b, _c;
|
|
4591
4599
|
switch (this.strategy) {
|
|
4592
4600
|
case 1 /* ResolverStrategy.singleton */:
|
|
4593
4601
|
case 2 /* ResolverStrategy.transient */:
|
|
4594
4602
|
return container.getFactory(this.state);
|
|
4595
4603
|
case 5 /* ResolverStrategy.alias */:
|
|
4596
|
-
return
|
|
4604
|
+
return container.getResolver(this.state)?.getFactory?.(container) ?? null;
|
|
4597
4605
|
default:
|
|
4598
4606
|
return null;
|
|
4599
4607
|
}
|
|
@@ -5334,7 +5342,10 @@ class FoundationElementRegistry {
|
|
|
5334
5342
|
this.type = type;
|
|
5335
5343
|
this.elementDefinition = elementDefinition;
|
|
5336
5344
|
this.overrideDefinition = overrideDefinition;
|
|
5337
|
-
this.definition =
|
|
5345
|
+
this.definition = {
|
|
5346
|
+
...this.elementDefinition,
|
|
5347
|
+
...this.overrideDefinition,
|
|
5348
|
+
};
|
|
5338
5349
|
}
|
|
5339
5350
|
register(container, context) {
|
|
5340
5351
|
const definition = this.definition;
|
|
@@ -5568,7 +5579,7 @@ function canUseFocusVisible() {
|
|
|
5568
5579
|
styleElement.sheet.insertRule("foo:focus-visible {color:inherit}", 0);
|
|
5569
5580
|
_canUseFocusVisible = true;
|
|
5570
5581
|
}
|
|
5571
|
-
catch
|
|
5582
|
+
catch {
|
|
5572
5583
|
_canUseFocusVisible = false;
|
|
5573
5584
|
}
|
|
5574
5585
|
finally {
|
|
@@ -5784,7 +5795,6 @@ class Accordion extends FoundationElement {
|
|
|
5784
5795
|
this.$emit("change", this.activeid);
|
|
5785
5796
|
};
|
|
5786
5797
|
this.setItems = () => {
|
|
5787
|
-
var _a;
|
|
5788
5798
|
if (this.accordionItems.length === 0) {
|
|
5789
5799
|
return;
|
|
5790
5800
|
}
|
|
@@ -5803,7 +5813,7 @@ class Accordion extends FoundationElement {
|
|
|
5803
5813
|
item.addEventListener("focus", this.handleItemFocus);
|
|
5804
5814
|
});
|
|
5805
5815
|
if (this.isSingleExpandMode()) {
|
|
5806
|
-
const expandedItem =
|
|
5816
|
+
const expandedItem = this.findExpandedItem() ?? this.accordionItems[0];
|
|
5807
5817
|
expandedItem.setAttribute("aria-disabled", "true");
|
|
5808
5818
|
}
|
|
5809
5819
|
};
|
|
@@ -6057,14 +6067,12 @@ class Anchor extends FoundationElement {
|
|
|
6057
6067
|
* Relevant PR on the Firefox browser: https://phabricator.services.mozilla.com/D123858
|
|
6058
6068
|
*/
|
|
6059
6069
|
this.handleUnsupportedDelegatesFocus = () => {
|
|
6060
|
-
var _a;
|
|
6061
6070
|
// Check to see if delegatesFocus is supported
|
|
6062
6071
|
if (window.ShadowRoot &&
|
|
6063
6072
|
!window.ShadowRoot.prototype.hasOwnProperty("delegatesFocus") &&
|
|
6064
|
-
|
|
6073
|
+
this.$fastController.definition.shadowOptions?.delegatesFocus) {
|
|
6065
6074
|
this.focus = () => {
|
|
6066
|
-
|
|
6067
|
-
(_a = this.control) === null || _a === void 0 ? void 0 : _a.focus();
|
|
6075
|
+
this.control?.focus();
|
|
6068
6076
|
};
|
|
6069
6077
|
}
|
|
6070
6078
|
};
|
|
@@ -6154,12 +6162,11 @@ class IntersectionService {
|
|
|
6154
6162
|
* @internal
|
|
6155
6163
|
*/
|
|
6156
6164
|
this.requestPosition = (target, callback) => {
|
|
6157
|
-
var _a;
|
|
6158
6165
|
if (this.intersectionDetector === null) {
|
|
6159
6166
|
return;
|
|
6160
6167
|
}
|
|
6161
6168
|
if (this.observedElements.has(target)) {
|
|
6162
|
-
|
|
6169
|
+
this.observedElements.get(target)?.push(callback);
|
|
6163
6170
|
return;
|
|
6164
6171
|
}
|
|
6165
6172
|
this.observedElements.set(target, [callback]);
|
|
@@ -6204,9 +6211,8 @@ class IntersectionService {
|
|
|
6204
6211
|
const pendingCallbackParams = [];
|
|
6205
6212
|
// go through the entries to build a list of callbacks and params for each
|
|
6206
6213
|
entries.forEach((entry) => {
|
|
6207
|
-
var _a;
|
|
6208
6214
|
// stop watching this element until we get new update requests for it
|
|
6209
|
-
|
|
6215
|
+
this.intersectionDetector?.unobserve(entry.target);
|
|
6210
6216
|
const thisElementCallbacks = this.observedElements.get(entry.target);
|
|
6211
6217
|
if (thisElementCallbacks !== undefined) {
|
|
6212
6218
|
thisElementCallbacks.forEach((callback) => {
|
|
@@ -7033,6 +7039,7 @@ class AnchoredRegion extends FoundationElement {
|
|
|
7033
7039
|
this.initialize();
|
|
7034
7040
|
}
|
|
7035
7041
|
}
|
|
7042
|
+
static { this.intersectionService = new IntersectionService(); }
|
|
7036
7043
|
/**
|
|
7037
7044
|
* @internal
|
|
7038
7045
|
*/
|
|
@@ -7130,7 +7137,6 @@ class AnchoredRegion extends FoundationElement {
|
|
|
7130
7137
|
this.updateRegionStyle();
|
|
7131
7138
|
}
|
|
7132
7139
|
}
|
|
7133
|
-
AnchoredRegion.intersectionService = new IntersectionService();
|
|
7134
7140
|
__decorate([
|
|
7135
7141
|
attr
|
|
7136
7142
|
], AnchoredRegion.prototype, "anchor", void 0);
|
|
@@ -7210,14 +7216,26 @@ const horizontalAnchorOverlay = {
|
|
|
7210
7216
|
*
|
|
7211
7217
|
* @public
|
|
7212
7218
|
*/
|
|
7213
|
-
const FlyoutPosTop =
|
|
7219
|
+
const FlyoutPosTop = {
|
|
7220
|
+
...horizontalAnchorOverlay,
|
|
7221
|
+
verticalDefaultPosition: "top",
|
|
7222
|
+
verticalPositioningMode: "locktodefault",
|
|
7223
|
+
verticalInset: false,
|
|
7224
|
+
verticalScaling: "content",
|
|
7225
|
+
};
|
|
7214
7226
|
/**
|
|
7215
7227
|
* A region that always places itself below the anchor, has
|
|
7216
7228
|
* a width to match the anchor, and is sized vertically by content
|
|
7217
7229
|
*
|
|
7218
7230
|
* @public
|
|
7219
7231
|
*/
|
|
7220
|
-
const FlyoutPosBottom =
|
|
7232
|
+
const FlyoutPosBottom = {
|
|
7233
|
+
...horizontalAnchorOverlay,
|
|
7234
|
+
verticalDefaultPosition: "bottom",
|
|
7235
|
+
verticalPositioningMode: "locktodefault",
|
|
7236
|
+
verticalInset: false,
|
|
7237
|
+
verticalScaling: "content",
|
|
7238
|
+
};
|
|
7221
7239
|
/**
|
|
7222
7240
|
* A region that places itself above or below the anchor
|
|
7223
7241
|
* based on available space, has a width to match the anchor,
|
|
@@ -7225,21 +7243,32 @@ const FlyoutPosBottom = Object.assign(Object.assign({}, horizontalAnchorOverlay)
|
|
|
7225
7243
|
*
|
|
7226
7244
|
* @public
|
|
7227
7245
|
*/
|
|
7228
|
-
const FlyoutPosTallest =
|
|
7246
|
+
const FlyoutPosTallest = {
|
|
7247
|
+
...horizontalAnchorOverlay,
|
|
7248
|
+
verticalPositioningMode: "dynamic",
|
|
7249
|
+
verticalInset: false,
|
|
7250
|
+
verticalScaling: "content",
|
|
7251
|
+
};
|
|
7229
7252
|
/**
|
|
7230
7253
|
* A region that always places itself above the anchor, has
|
|
7231
7254
|
* a width to match the anchor, and is sized vertically by available space
|
|
7232
7255
|
*
|
|
7233
7256
|
* @public
|
|
7234
7257
|
*/
|
|
7235
|
-
const FlyoutPosTopFill =
|
|
7258
|
+
const FlyoutPosTopFill = {
|
|
7259
|
+
...FlyoutPosTop,
|
|
7260
|
+
verticalScaling: "fill",
|
|
7261
|
+
};
|
|
7236
7262
|
/**
|
|
7237
7263
|
* A region that always places itself below the anchor, has
|
|
7238
7264
|
* a width to match the anchor, and is sized vertically by available space
|
|
7239
7265
|
*
|
|
7240
7266
|
* @public
|
|
7241
7267
|
*/
|
|
7242
|
-
const FlyoutPosBottomFill =
|
|
7268
|
+
const FlyoutPosBottomFill = {
|
|
7269
|
+
...FlyoutPosBottom,
|
|
7270
|
+
verticalScaling: "fill",
|
|
7271
|
+
};
|
|
7243
7272
|
/**
|
|
7244
7273
|
* A region that places itself above or below the anchor
|
|
7245
7274
|
* based on available space, has a width to match the anchor,
|
|
@@ -7247,7 +7276,10 @@ const FlyoutPosBottomFill = Object.assign(Object.assign({}, FlyoutPosBottom), {
|
|
|
7247
7276
|
*
|
|
7248
7277
|
* @public
|
|
7249
7278
|
*/
|
|
7250
|
-
const FlyoutPosTallestFill =
|
|
7279
|
+
const FlyoutPosTallestFill = {
|
|
7280
|
+
...FlyoutPosTallest,
|
|
7281
|
+
verticalScaling: "fill",
|
|
7282
|
+
};
|
|
7251
7283
|
|
|
7252
7284
|
/**
|
|
7253
7285
|
* The template for {@link @ni/fast-foundation#Avatar} component.
|
|
@@ -7446,12 +7478,11 @@ class Breadcrumb extends FoundationElement {
|
|
|
7446
7478
|
* We look in the shadow DOM because we insert an anchor when breadcrumb-item has an href.
|
|
7447
7479
|
*/
|
|
7448
7480
|
findChildWithHref(node) {
|
|
7449
|
-
var _a, _b;
|
|
7450
7481
|
if (node.childElementCount > 0) {
|
|
7451
7482
|
return node.querySelector("a[href]");
|
|
7452
7483
|
}
|
|
7453
|
-
else if (
|
|
7454
|
-
return
|
|
7484
|
+
else if (node.shadowRoot?.childElementCount) {
|
|
7485
|
+
return node.shadowRoot?.querySelector("a[href]");
|
|
7455
7486
|
}
|
|
7456
7487
|
else
|
|
7457
7488
|
return null;
|
|
@@ -7838,7 +7869,6 @@ function FormAssociated(BaseCtor) {
|
|
|
7838
7869
|
* Attach the proxy element to the DOM
|
|
7839
7870
|
*/
|
|
7840
7871
|
attachProxy() {
|
|
7841
|
-
var _a;
|
|
7842
7872
|
if (!this.proxyInitialized) {
|
|
7843
7873
|
this.proxyInitialized = true;
|
|
7844
7874
|
this.proxy.style.display = "none";
|
|
@@ -7859,16 +7889,15 @@ function FormAssociated(BaseCtor) {
|
|
|
7859
7889
|
this.proxySlot = document.createElement("slot");
|
|
7860
7890
|
this.proxySlot.setAttribute("name", proxySlotName);
|
|
7861
7891
|
}
|
|
7862
|
-
|
|
7892
|
+
this.shadowRoot?.appendChild(this.proxySlot);
|
|
7863
7893
|
this.appendChild(this.proxy);
|
|
7864
7894
|
}
|
|
7865
7895
|
/**
|
|
7866
7896
|
* Detach the proxy element from the DOM
|
|
7867
7897
|
*/
|
|
7868
7898
|
detachProxy() {
|
|
7869
|
-
var _a;
|
|
7870
7899
|
this.removeChild(this.proxy);
|
|
7871
|
-
|
|
7900
|
+
this.shadowRoot?.removeChild(this.proxySlot);
|
|
7872
7901
|
}
|
|
7873
7902
|
/** {@inheritDoc (FormAssociated:interface).validate} */
|
|
7874
7903
|
validate(anchor) {
|
|
@@ -7892,7 +7921,7 @@ function FormAssociated(BaseCtor) {
|
|
|
7892
7921
|
if (this.form instanceof HTMLFormElement) {
|
|
7893
7922
|
// Implicit submission
|
|
7894
7923
|
const defaultButton = this.form.querySelector("[type=submit]");
|
|
7895
|
-
defaultButton
|
|
7924
|
+
defaultButton?.click();
|
|
7896
7925
|
}
|
|
7897
7926
|
break;
|
|
7898
7927
|
}
|
|
@@ -8034,8 +8063,7 @@ class Button extends FormAssociatedButton {
|
|
|
8034
8063
|
* @internal
|
|
8035
8064
|
*/
|
|
8036
8065
|
this.handleClick = (e) => {
|
|
8037
|
-
|
|
8038
|
-
if (this.disabled && ((_a = this.defaultSlottedContent) === null || _a === void 0 ? void 0 : _a.length) <= 1) {
|
|
8066
|
+
if (this.disabled && this.defaultSlottedContent?.length <= 1) {
|
|
8039
8067
|
e.stopPropagation();
|
|
8040
8068
|
}
|
|
8041
8069
|
};
|
|
@@ -8066,8 +8094,7 @@ class Button extends FormAssociatedButton {
|
|
|
8066
8094
|
* Resets the parent form
|
|
8067
8095
|
*/
|
|
8068
8096
|
this.handleFormReset = () => {
|
|
8069
|
-
|
|
8070
|
-
(_a = this.form) === null || _a === void 0 ? void 0 : _a.reset();
|
|
8097
|
+
this.form?.reset();
|
|
8071
8098
|
};
|
|
8072
8099
|
/**
|
|
8073
8100
|
* Overrides the focus call for where delegatesFocus is unsupported.
|
|
@@ -8075,11 +8102,10 @@ class Button extends FormAssociatedButton {
|
|
|
8075
8102
|
* Relevant PR on the Firefox browser: https://phabricator.services.mozilla.com/D123858
|
|
8076
8103
|
*/
|
|
8077
8104
|
this.handleUnsupportedDelegatesFocus = () => {
|
|
8078
|
-
var _a;
|
|
8079
8105
|
// Check to see if delegatesFocus is supported
|
|
8080
8106
|
if (window.ShadowRoot &&
|
|
8081
8107
|
!window.ShadowRoot.prototype.hasOwnProperty("delegatesFocus") &&
|
|
8082
|
-
|
|
8108
|
+
this.$fastController.definition.shadowOptions?.delegatesFocus) {
|
|
8083
8109
|
this.focus = () => {
|
|
8084
8110
|
this.control.focus();
|
|
8085
8111
|
};
|
|
@@ -8132,11 +8158,10 @@ class Button extends FormAssociatedButton {
|
|
|
8132
8158
|
* @internal
|
|
8133
8159
|
*/
|
|
8134
8160
|
connectedCallback() {
|
|
8135
|
-
var _a;
|
|
8136
8161
|
super.connectedCallback();
|
|
8137
8162
|
this.proxy.setAttribute("type", this.type);
|
|
8138
8163
|
this.handleUnsupportedDelegatesFocus();
|
|
8139
|
-
const elements = Array.from(
|
|
8164
|
+
const elements = Array.from(this.control?.children);
|
|
8140
8165
|
if (elements) {
|
|
8141
8166
|
elements.forEach((span) => {
|
|
8142
8167
|
span.addEventListener("click", this.handleClick);
|
|
@@ -8147,9 +8172,8 @@ class Button extends FormAssociatedButton {
|
|
|
8147
8172
|
* @internal
|
|
8148
8173
|
*/
|
|
8149
8174
|
disconnectedCallback() {
|
|
8150
|
-
var _a;
|
|
8151
8175
|
super.disconnectedCallback();
|
|
8152
|
-
const elements = Array.from(
|
|
8176
|
+
const elements = Array.from(this.control?.children);
|
|
8153
8177
|
if (elements) {
|
|
8154
8178
|
elements.forEach((span) => {
|
|
8155
8179
|
span.removeEventListener("click", this.handleClick);
|
|
@@ -8283,7 +8307,10 @@ class DateFormatter {
|
|
|
8283
8307
|
if (!dateObj.getTime()) {
|
|
8284
8308
|
return "";
|
|
8285
8309
|
}
|
|
8286
|
-
const optionsWithTimeZone =
|
|
8310
|
+
const optionsWithTimeZone = {
|
|
8311
|
+
timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
8312
|
+
...format,
|
|
8313
|
+
};
|
|
8287
8314
|
return new Intl.DateTimeFormat(locale, optionsWithTimeZone).format(dateObj);
|
|
8288
8315
|
}
|
|
8289
8316
|
/**
|
|
@@ -8894,6 +8921,17 @@ const dataGridTemplate = (context, definition) => {
|
|
|
8894
8921
|
* @public
|
|
8895
8922
|
*/
|
|
8896
8923
|
class DataGrid extends FoundationElement {
|
|
8924
|
+
/**
|
|
8925
|
+
* generates a basic column definition by examining sample row data
|
|
8926
|
+
*/
|
|
8927
|
+
static { this.generateColumns = (row) => {
|
|
8928
|
+
return Object.getOwnPropertyNames(row).map((property, index) => {
|
|
8929
|
+
return {
|
|
8930
|
+
columnDataKey: property,
|
|
8931
|
+
gridColumn: `${index}`,
|
|
8932
|
+
};
|
|
8933
|
+
});
|
|
8934
|
+
}; }
|
|
8897
8935
|
/**
|
|
8898
8936
|
* generates a gridTemplateColumns based on columndata array
|
|
8899
8937
|
*/
|
|
@@ -9271,17 +9309,6 @@ class DataGrid extends FoundationElement {
|
|
|
9271
9309
|
}
|
|
9272
9310
|
}
|
|
9273
9311
|
}
|
|
9274
|
-
/**
|
|
9275
|
-
* generates a basic column definition by examining sample row data
|
|
9276
|
-
*/
|
|
9277
|
-
DataGrid.generateColumns = (row) => {
|
|
9278
|
-
return Object.getOwnPropertyNames(row).map((property, index) => {
|
|
9279
|
-
return {
|
|
9280
|
-
columnDataKey: property,
|
|
9281
|
-
gridColumn: `${index}`,
|
|
9282
|
-
};
|
|
9283
|
-
});
|
|
9284
|
-
};
|
|
9285
9312
|
__decorate([
|
|
9286
9313
|
attr({ attribute: "no-tabbing", mode: "boolean" })
|
|
9287
9314
|
], DataGrid.prototype, "noTabbing", void 0);
|
|
@@ -9395,12 +9422,11 @@ class DataGridCell extends FoundationElement {
|
|
|
9395
9422
|
* @internal
|
|
9396
9423
|
*/
|
|
9397
9424
|
connectedCallback() {
|
|
9398
|
-
var _a;
|
|
9399
9425
|
super.connectedCallback();
|
|
9400
9426
|
this.addEventListener(eventFocusIn, this.handleFocusin);
|
|
9401
9427
|
this.addEventListener(eventFocusOut, this.handleFocusout);
|
|
9402
9428
|
this.addEventListener(eventKeyDown, this.handleKeydown);
|
|
9403
|
-
this.style.gridColumn = `${
|
|
9429
|
+
this.style.gridColumn = `${this.columnDefinition?.gridColumn === undefined
|
|
9404
9430
|
? 0
|
|
9405
9431
|
: this.columnDefinition.gridColumn}`;
|
|
9406
9432
|
this.updateCellView();
|
|
@@ -9788,7 +9814,6 @@ const noninteractiveCalendarTemplate = (todayString) => {
|
|
|
9788
9814
|
* @public
|
|
9789
9815
|
*/
|
|
9790
9816
|
const calendarTemplate = (context, definition) => {
|
|
9791
|
-
var _a;
|
|
9792
9817
|
const today = new Date();
|
|
9793
9818
|
const todayString = `${today.getMonth() + 1}-${today.getDate()}-${today.getFullYear()}`;
|
|
9794
9819
|
return html `
|
|
@@ -9796,7 +9821,7 @@ const calendarTemplate = (context, definition) => {
|
|
|
9796
9821
|
${startTemplate}
|
|
9797
9822
|
${definition.title instanceof Function
|
|
9798
9823
|
? definition.title(context, definition)
|
|
9799
|
-
:
|
|
9824
|
+
: definition.title ?? ""}
|
|
9800
9825
|
<slot></slot>
|
|
9801
9826
|
${when(x => x.readonly, noninteractiveCalendarTemplate(todayString), interactiveCalendarGridTemplate(context, todayString))}
|
|
9802
9827
|
${endTemplate}
|
|
@@ -10032,15 +10057,13 @@ class ListboxOption extends FoundationElement {
|
|
|
10032
10057
|
}
|
|
10033
10058
|
}
|
|
10034
10059
|
get label() {
|
|
10035
|
-
|
|
10036
|
-
return (_a = this.value) !== null && _a !== void 0 ? _a : this.text;
|
|
10060
|
+
return this.value ?? this.text;
|
|
10037
10061
|
}
|
|
10038
10062
|
get text() {
|
|
10039
|
-
|
|
10040
|
-
return (_b = (_a = this.textContent) === null || _a === void 0 ? void 0 : _a.replace(/\s+/g, " ").trim()) !== null && _b !== void 0 ? _b : "";
|
|
10063
|
+
return this.textContent?.replace(/\s+/g, " ").trim() ?? "";
|
|
10041
10064
|
}
|
|
10042
10065
|
set value(next) {
|
|
10043
|
-
const newValue = `${next
|
|
10066
|
+
const newValue = `${next ?? ""}`;
|
|
10044
10067
|
this._value = newValue;
|
|
10045
10068
|
this.dirtyValue = true;
|
|
10046
10069
|
if (this.proxy instanceof HTMLOptionElement) {
|
|
@@ -10049,9 +10072,8 @@ class ListboxOption extends FoundationElement {
|
|
|
10049
10072
|
Observable.notify(this, "value");
|
|
10050
10073
|
}
|
|
10051
10074
|
get value() {
|
|
10052
|
-
var _a;
|
|
10053
10075
|
Observable.track(this, "value");
|
|
10054
|
-
return
|
|
10076
|
+
return this._value ?? this.text;
|
|
10055
10077
|
}
|
|
10056
10078
|
get form() {
|
|
10057
10079
|
return this.proxy ? this.proxy.form : null;
|
|
@@ -10198,8 +10220,7 @@ class Listbox extends FoundationElement {
|
|
|
10198
10220
|
* @internal
|
|
10199
10221
|
*/
|
|
10200
10222
|
get firstSelectedOption() {
|
|
10201
|
-
|
|
10202
|
-
return (_a = this.selectedOptions[0]) !== null && _a !== void 0 ? _a : null;
|
|
10223
|
+
return this.selectedOptions[0] ?? null;
|
|
10203
10224
|
}
|
|
10204
10225
|
/**
|
|
10205
10226
|
* Returns true if there is one or more selectable option.
|
|
@@ -10215,8 +10236,7 @@ class Listbox extends FoundationElement {
|
|
|
10215
10236
|
* @public
|
|
10216
10237
|
*/
|
|
10217
10238
|
get length() {
|
|
10218
|
-
|
|
10219
|
-
return (_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
|
|
10239
|
+
return this.options?.length ?? 0;
|
|
10220
10240
|
}
|
|
10221
10241
|
/**
|
|
10222
10242
|
* The list of options.
|
|
@@ -10243,6 +10263,19 @@ class Listbox extends FoundationElement {
|
|
|
10243
10263
|
set typeAheadExpired(value) {
|
|
10244
10264
|
this.typeaheadExpired = value;
|
|
10245
10265
|
}
|
|
10266
|
+
/**
|
|
10267
|
+
* A static filter to include only selectable options.
|
|
10268
|
+
*
|
|
10269
|
+
* @param n - element to filter
|
|
10270
|
+
* @public
|
|
10271
|
+
*/
|
|
10272
|
+
static { this.slottedOptionFilter = (n) => isListboxOption(n) && !n.hidden; }
|
|
10273
|
+
/**
|
|
10274
|
+
* Typeahead timeout in milliseconds.
|
|
10275
|
+
*
|
|
10276
|
+
* @internal
|
|
10277
|
+
*/
|
|
10278
|
+
static { this.TYPE_AHEAD_TIMEOUT_MS = 1000; }
|
|
10246
10279
|
/**
|
|
10247
10280
|
* Handle click events for listbox options.
|
|
10248
10281
|
*
|
|
@@ -10463,12 +10496,11 @@ class Listbox extends FoundationElement {
|
|
|
10463
10496
|
* @internal
|
|
10464
10497
|
*/
|
|
10465
10498
|
selectedIndexChanged(prev, next) {
|
|
10466
|
-
var _a;
|
|
10467
10499
|
if (!this.hasSelectableOptions) {
|
|
10468
10500
|
this.selectedIndex = -1;
|
|
10469
10501
|
return;
|
|
10470
10502
|
}
|
|
10471
|
-
if (
|
|
10503
|
+
if (this.options[this.selectedIndex]?.disabled && typeof prev === "number") {
|
|
10472
10504
|
const selectableIndex = this.getSelectableIndex(prev, next);
|
|
10473
10505
|
const newNext = selectableIndex > -1 ? selectableIndex : prev;
|
|
10474
10506
|
this.selectedIndex = newNext;
|
|
@@ -10488,9 +10520,8 @@ class Listbox extends FoundationElement {
|
|
|
10488
10520
|
* @internal
|
|
10489
10521
|
*/
|
|
10490
10522
|
selectedOptionsChanged(prev, next) {
|
|
10491
|
-
var _a;
|
|
10492
10523
|
const filteredNext = next.filter(Listbox.slottedOptionFilter);
|
|
10493
|
-
|
|
10524
|
+
this.options?.forEach(o => {
|
|
10494
10525
|
const notifier = Observable.getNotifier(o);
|
|
10495
10526
|
notifier.unsubscribe(this, "selected");
|
|
10496
10527
|
o.selected = filteredNext.includes(o);
|
|
@@ -10503,9 +10534,8 @@ class Listbox extends FoundationElement {
|
|
|
10503
10534
|
* @public
|
|
10504
10535
|
*/
|
|
10505
10536
|
selectFirstOption() {
|
|
10506
|
-
var _a, _b;
|
|
10507
10537
|
if (!this.disabled) {
|
|
10508
|
-
this.selectedIndex =
|
|
10538
|
+
this.selectedIndex = this.options?.findIndex(o => !o.disabled) ?? -1;
|
|
10509
10539
|
}
|
|
10510
10540
|
}
|
|
10511
10541
|
/**
|
|
@@ -10544,8 +10574,7 @@ class Listbox extends FoundationElement {
|
|
|
10544
10574
|
* @internal
|
|
10545
10575
|
*/
|
|
10546
10576
|
setDefaultSelectedOption() {
|
|
10547
|
-
|
|
10548
|
-
this.selectedIndex = (_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.findIndex(el => el.defaultSelected)) !== null && _b !== void 0 ? _b : -1;
|
|
10577
|
+
this.selectedIndex = this.options?.findIndex(el => el.defaultSelected) ?? -1;
|
|
10549
10578
|
}
|
|
10550
10579
|
/**
|
|
10551
10580
|
* Sets an option as selected and gives it focus.
|
|
@@ -10553,10 +10582,9 @@ class Listbox extends FoundationElement {
|
|
|
10553
10582
|
* @public
|
|
10554
10583
|
*/
|
|
10555
10584
|
setSelectedOptions() {
|
|
10556
|
-
|
|
10557
|
-
if ((_a = this.options) === null || _a === void 0 ? void 0 : _a.length) {
|
|
10585
|
+
if (this.options?.length) {
|
|
10558
10586
|
this.selectedOptions = [this.options[this.selectedIndex]];
|
|
10559
|
-
this.ariaActiveDescendant =
|
|
10587
|
+
this.ariaActiveDescendant = this.firstSelectedOption?.id ?? "";
|
|
10560
10588
|
this.focusAndScrollOptionIntoView();
|
|
10561
10589
|
}
|
|
10562
10590
|
}
|
|
@@ -10609,19 +10637,6 @@ class Listbox extends FoundationElement {
|
|
|
10609
10637
|
}
|
|
10610
10638
|
}
|
|
10611
10639
|
}
|
|
10612
|
-
/**
|
|
10613
|
-
* A static filter to include only selectable options.
|
|
10614
|
-
*
|
|
10615
|
-
* @param n - element to filter
|
|
10616
|
-
* @public
|
|
10617
|
-
*/
|
|
10618
|
-
Listbox.slottedOptionFilter = (n) => isListboxOption(n) && !n.hidden;
|
|
10619
|
-
/**
|
|
10620
|
-
* Typeahead timeout in milliseconds.
|
|
10621
|
-
*
|
|
10622
|
-
* @internal
|
|
10623
|
-
*/
|
|
10624
|
-
Listbox.TYPE_AHEAD_TIMEOUT_MS = 1000;
|
|
10625
10640
|
__decorate([
|
|
10626
10641
|
attr({ mode: "boolean" })
|
|
10627
10642
|
], Listbox.prototype, "disabled", void 0);
|
|
@@ -10840,17 +10855,16 @@ class Combobox extends FormAssociatedCombobox {
|
|
|
10840
10855
|
return this._value;
|
|
10841
10856
|
}
|
|
10842
10857
|
set value(next) {
|
|
10843
|
-
var _a, _b, _c;
|
|
10844
10858
|
const prev = `${this._value}`;
|
|
10845
10859
|
if (this.$fastController.isConnected && this.options) {
|
|
10846
10860
|
const selectedIndex = this.options.findIndex(el => el.text.toLowerCase() === next.toLowerCase());
|
|
10847
|
-
const prevSelectedValue =
|
|
10848
|
-
const nextSelectedValue =
|
|
10861
|
+
const prevSelectedValue = this.options[this.selectedIndex]?.text;
|
|
10862
|
+
const nextSelectedValue = this.options[selectedIndex]?.text;
|
|
10849
10863
|
this.selectedIndex =
|
|
10850
10864
|
prevSelectedValue !== nextSelectedValue
|
|
10851
10865
|
? selectedIndex
|
|
10852
10866
|
: this.selectedIndex;
|
|
10853
|
-
next =
|
|
10867
|
+
next = this.firstSelectedOption?.text || next;
|
|
10854
10868
|
}
|
|
10855
10869
|
if (prev !== next) {
|
|
10856
10870
|
this._value = next;
|
|
@@ -10866,7 +10880,7 @@ class Combobox extends FormAssociatedCombobox {
|
|
|
10866
10880
|
*/
|
|
10867
10881
|
clickHandler(e) {
|
|
10868
10882
|
const captured = e.target.closest(`option,[role=option]`);
|
|
10869
|
-
if (this.disabled ||
|
|
10883
|
+
if (this.disabled || captured?.disabled) {
|
|
10870
10884
|
return;
|
|
10871
10885
|
}
|
|
10872
10886
|
if (this.open) {
|
|
@@ -10939,8 +10953,7 @@ class Combobox extends FormAssociatedCombobox {
|
|
|
10939
10953
|
this.control.focus();
|
|
10940
10954
|
if (this.firstSelectedOption) {
|
|
10941
10955
|
requestAnimationFrame(() => {
|
|
10942
|
-
|
|
10943
|
-
(_a = this.firstSelectedOption) === null || _a === void 0 ? void 0 : _a.scrollIntoView({ block: "nearest" });
|
|
10956
|
+
this.firstSelectedOption?.scrollIntoView({ block: "nearest" });
|
|
10944
10957
|
});
|
|
10945
10958
|
}
|
|
10946
10959
|
}
|
|
@@ -11159,8 +11172,7 @@ class Combobox extends FormAssociatedCombobox {
|
|
|
11159
11172
|
* @internal
|
|
11160
11173
|
*/
|
|
11161
11174
|
syncValue() {
|
|
11162
|
-
|
|
11163
|
-
const newValue = this.selectedIndex > -1 ? (_a = this.firstSelectedOption) === null || _a === void 0 ? void 0 : _a.text : this.control.value;
|
|
11175
|
+
const newValue = this.selectedIndex > -1 ? this.firstSelectedOption?.text : this.control.value;
|
|
11164
11176
|
this.updateValue(this.value !== newValue);
|
|
11165
11177
|
}
|
|
11166
11178
|
/**
|
|
@@ -11221,9 +11233,8 @@ class Combobox extends FormAssociatedCombobox {
|
|
|
11221
11233
|
* @internal
|
|
11222
11234
|
*/
|
|
11223
11235
|
updateValue(shouldEmit) {
|
|
11224
|
-
var _a;
|
|
11225
11236
|
if (this.$fastController.isConnected) {
|
|
11226
|
-
this.value =
|
|
11237
|
+
this.value = this.firstSelectedOption?.text || this.control.value;
|
|
11227
11238
|
this.control.value = this.value;
|
|
11228
11239
|
}
|
|
11229
11240
|
if (shouldEmit) {
|
|
@@ -11516,6 +11527,8 @@ class ElementStyleSheetTarget {
|
|
|
11516
11527
|
* @internal
|
|
11517
11528
|
*/
|
|
11518
11529
|
class RootStyleSheetTarget {
|
|
11530
|
+
static { this.roots = new Set(); }
|
|
11531
|
+
static { this.properties = {}; }
|
|
11519
11532
|
setProperty(name, value) {
|
|
11520
11533
|
RootStyleSheetTarget.properties[name] = value;
|
|
11521
11534
|
for (const target of RootStyleSheetTarget.roots.values()) {
|
|
@@ -11557,8 +11570,6 @@ class RootStyleSheetTarget {
|
|
|
11557
11570
|
return root === defaultElement ? document : root;
|
|
11558
11571
|
}
|
|
11559
11572
|
}
|
|
11560
|
-
RootStyleSheetTarget.roots = new Set();
|
|
11561
|
-
RootStyleSheetTarget.properties = {};
|
|
11562
11573
|
// Caches PropertyTarget instances
|
|
11563
11574
|
const propertyTargetCache = new WeakMap();
|
|
11564
11575
|
// Use Constructable StyleSheets for FAST elements when supported, otherwise use
|
|
@@ -11620,6 +11631,13 @@ class DesignTokenImpl extends CSSDirective {
|
|
|
11620
11631
|
static isDerivedDesignTokenValue(value) {
|
|
11621
11632
|
return typeof value === "function";
|
|
11622
11633
|
}
|
|
11634
|
+
static { this.uniqueId = (() => {
|
|
11635
|
+
let id = 0;
|
|
11636
|
+
return () => {
|
|
11637
|
+
id++;
|
|
11638
|
+
return id.toString(16);
|
|
11639
|
+
};
|
|
11640
|
+
})(); }
|
|
11623
11641
|
/**
|
|
11624
11642
|
* Gets a token by ID. Returns undefined if the token was not found.
|
|
11625
11643
|
* @param id - The ID of the token
|
|
@@ -11628,6 +11646,10 @@ class DesignTokenImpl extends CSSDirective {
|
|
|
11628
11646
|
static getTokenById(id) {
|
|
11629
11647
|
return DesignTokenImpl.tokensById.get(id);
|
|
11630
11648
|
}
|
|
11649
|
+
/**
|
|
11650
|
+
* Token storage by token ID
|
|
11651
|
+
*/
|
|
11652
|
+
static { this.tokensById = new Map(); }
|
|
11631
11653
|
getOrCreateSubscriberSet(target = this) {
|
|
11632
11654
|
return (this.subscribers.get(target) ||
|
|
11633
11655
|
(this.subscribers.set(target, new Set()) && this.subscribers.get(target)));
|
|
@@ -11709,17 +11731,6 @@ class DesignTokenImpl extends CSSDirective {
|
|
|
11709
11731
|
return ((target) => token.getValueFor(target));
|
|
11710
11732
|
}
|
|
11711
11733
|
}
|
|
11712
|
-
DesignTokenImpl.uniqueId = (() => {
|
|
11713
|
-
let id = 0;
|
|
11714
|
-
return () => {
|
|
11715
|
-
id++;
|
|
11716
|
-
return id.toString(16);
|
|
11717
|
-
};
|
|
11718
|
-
})();
|
|
11719
|
-
/**
|
|
11720
|
-
* Token storage by token ID
|
|
11721
|
-
*/
|
|
11722
|
-
DesignTokenImpl.tokensById = new Map();
|
|
11723
11734
|
class CustomPropertyReflector {
|
|
11724
11735
|
startReflection(token, target) {
|
|
11725
11736
|
token.subscribe(this, target);
|
|
@@ -11866,6 +11877,10 @@ class DesignTokenNode {
|
|
|
11866
11877
|
} while (current !== null);
|
|
11867
11878
|
return null;
|
|
11868
11879
|
}
|
|
11880
|
+
/**
|
|
11881
|
+
* Responsible for reflecting tokens to CSS custom properties
|
|
11882
|
+
*/
|
|
11883
|
+
static { this.cssCustomPropertyReflector = new CustomPropertyReflector(); }
|
|
11869
11884
|
/**
|
|
11870
11885
|
* The parent DesignTokenNode, or null.
|
|
11871
11886
|
*/
|
|
@@ -11966,11 +11981,10 @@ class DesignTokenNode {
|
|
|
11966
11981
|
* @returns
|
|
11967
11982
|
*/
|
|
11968
11983
|
getRaw(token) {
|
|
11969
|
-
var _a;
|
|
11970
11984
|
if (this.assignedValues.has(token)) {
|
|
11971
11985
|
return this.assignedValues.get(token);
|
|
11972
11986
|
}
|
|
11973
|
-
return
|
|
11987
|
+
return DesignTokenNode.findClosestAssignedNode(token, this)?.getRaw(token);
|
|
11974
11988
|
}
|
|
11975
11989
|
/**
|
|
11976
11990
|
* Sets a token to a value for a node
|
|
@@ -12171,10 +12185,6 @@ class DesignTokenNode {
|
|
|
12171
12185
|
return false;
|
|
12172
12186
|
}
|
|
12173
12187
|
}
|
|
12174
|
-
/**
|
|
12175
|
-
* Responsible for reflecting tokens to CSS custom properties
|
|
12176
|
-
*/
|
|
12177
|
-
DesignTokenNode.cssCustomPropertyReflector = new CustomPropertyReflector();
|
|
12178
12188
|
__decorate([
|
|
12179
12189
|
observable
|
|
12180
12190
|
], DesignTokenNode.prototype, "children", void 0);
|
|
@@ -12444,7 +12454,10 @@ class ElementDefinitionEntry {
|
|
|
12444
12454
|
ComponentPresentation.define(this.name, presentation, this.container);
|
|
12445
12455
|
}
|
|
12446
12456
|
defineElement(definition) {
|
|
12447
|
-
this.definition = new FASTElementDefinition(this.type,
|
|
12457
|
+
this.definition = new FASTElementDefinition(this.type, {
|
|
12458
|
+
...definition,
|
|
12459
|
+
name: this.name,
|
|
12460
|
+
});
|
|
12448
12461
|
}
|
|
12449
12462
|
tagFor(type) {
|
|
12450
12463
|
return DesignSystem.tagFor(type);
|
|
@@ -13083,8 +13096,7 @@ class Dialog extends FoundationElement {
|
|
|
13083
13096
|
* @internal
|
|
13084
13097
|
*/
|
|
13085
13098
|
static isFocusableFastElement(element) {
|
|
13086
|
-
|
|
13087
|
-
return !!((_b = (_a = element.$fastController) === null || _a === void 0 ? void 0 : _a.definition.shadowOptions) === null || _b === void 0 ? void 0 : _b.delegatesFocus);
|
|
13099
|
+
return !!element.$fastController?.definition.shadowOptions?.delegatesFocus;
|
|
13088
13100
|
}
|
|
13089
13101
|
/**
|
|
13090
13102
|
* Test if the element has a focusable shadow
|
|
@@ -13094,8 +13106,7 @@ class Dialog extends FoundationElement {
|
|
|
13094
13106
|
* @internal
|
|
13095
13107
|
*/
|
|
13096
13108
|
static hasTabbableShadow(element) {
|
|
13097
|
-
|
|
13098
|
-
return Array.from((_b = (_a = element.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelectorAll("*")) !== null && _b !== void 0 ? _b : []).some(x => {
|
|
13109
|
+
return Array.from(element.shadowRoot?.querySelectorAll("*") ?? []).some(x => {
|
|
13099
13110
|
return isTabbable(x);
|
|
13100
13111
|
});
|
|
13101
13112
|
}
|
|
@@ -13125,6 +13136,7 @@ const observer = new MutationObserver((mutations) => {
|
|
|
13125
13136
|
}
|
|
13126
13137
|
});
|
|
13127
13138
|
class AttributeReflectionSubscriptionSet extends SubscriberSet {
|
|
13139
|
+
static { this.subscriberCache = new WeakMap(); }
|
|
13128
13140
|
subscribe(subscriber) {
|
|
13129
13141
|
super.subscribe(subscriber);
|
|
13130
13142
|
if (!this.watchedAttributes.has(subscriber.attributes)) {
|
|
@@ -13158,7 +13170,6 @@ class AttributeReflectionSubscriptionSet extends SubscriberSet {
|
|
|
13158
13170
|
observer.observe(this.source, { attributeFilter });
|
|
13159
13171
|
}
|
|
13160
13172
|
}
|
|
13161
|
-
AttributeReflectionSubscriptionSet.subscriberCache = new WeakMap();
|
|
13162
13173
|
class ReflectAttrBehavior {
|
|
13163
13174
|
constructor(target, attributes) {
|
|
13164
13175
|
this.target = target;
|
|
@@ -13515,8 +13526,7 @@ class ListboxElement extends Listbox {
|
|
|
13515
13526
|
* @internal
|
|
13516
13527
|
*/
|
|
13517
13528
|
get checkedOptions() {
|
|
13518
|
-
|
|
13519
|
-
return (_a = this.options) === null || _a === void 0 ? void 0 : _a.filter(o => o.checked);
|
|
13529
|
+
return this.options?.filter(o => o.checked);
|
|
13520
13530
|
}
|
|
13521
13531
|
/**
|
|
13522
13532
|
* Returns the index of the first selected option.
|
|
@@ -13535,8 +13545,7 @@ class ListboxElement extends Listbox {
|
|
|
13535
13545
|
* @internal
|
|
13536
13546
|
*/
|
|
13537
13547
|
activeIndexChanged(prev, next) {
|
|
13538
|
-
|
|
13539
|
-
this.ariaActiveDescendant = (_b = (_a = this.options[next]) === null || _a === void 0 ? void 0 : _a.id) !== null && _b !== void 0 ? _b : "";
|
|
13548
|
+
this.ariaActiveDescendant = this.options[next]?.id ?? "";
|
|
13540
13549
|
this.focusAndScrollOptionIntoView();
|
|
13541
13550
|
}
|
|
13542
13551
|
/**
|
|
@@ -13684,11 +13693,10 @@ class ListboxElement extends Listbox {
|
|
|
13684
13693
|
* @internal
|
|
13685
13694
|
*/
|
|
13686
13695
|
clickHandler(e) {
|
|
13687
|
-
var _a;
|
|
13688
13696
|
if (!this.multiple) {
|
|
13689
13697
|
return super.clickHandler(e);
|
|
13690
13698
|
}
|
|
13691
|
-
const captured =
|
|
13699
|
+
const captured = e.target?.closest(`[role=option]`);
|
|
13692
13700
|
if (!captured || captured.disabled) {
|
|
13693
13701
|
return;
|
|
13694
13702
|
}
|
|
@@ -13821,9 +13829,8 @@ class ListboxElement extends Listbox {
|
|
|
13821
13829
|
* @internal
|
|
13822
13830
|
*/
|
|
13823
13831
|
multipleChanged(prev, next) {
|
|
13824
|
-
var _a;
|
|
13825
13832
|
this.ariaMultiSelectable = next ? "true" : null;
|
|
13826
|
-
|
|
13833
|
+
this.options?.forEach(o => {
|
|
13827
13834
|
o.checked = next ? false : undefined;
|
|
13828
13835
|
});
|
|
13829
13836
|
this.setSelectedOptions();
|
|
@@ -13853,8 +13860,7 @@ class ListboxElement extends Listbox {
|
|
|
13853
13860
|
* @internal
|
|
13854
13861
|
*/
|
|
13855
13862
|
sizeChanged(prev, next) {
|
|
13856
|
-
|
|
13857
|
-
const size = Math.max(0, parseInt((_a = next === null || next === void 0 ? void 0 : next.toFixed()) !== null && _a !== void 0 ? _a : "", 10));
|
|
13863
|
+
const size = Math.max(0, parseInt(next?.toFixed() ?? "", 10));
|
|
13858
13864
|
if (size !== next) {
|
|
13859
13865
|
DOM.queueUpdate(() => {
|
|
13860
13866
|
this.size = size;
|
|
@@ -14045,14 +14051,13 @@ class PickerMenuOption extends FoundationElement {
|
|
|
14045
14051
|
this.$emit("pickeroptioninvoked");
|
|
14046
14052
|
}
|
|
14047
14053
|
updateView() {
|
|
14048
|
-
var _a, _b;
|
|
14049
14054
|
this.disconnectView();
|
|
14050
14055
|
this.customView =
|
|
14051
|
-
|
|
14056
|
+
this.contentsTemplate?.render(this, this) ??
|
|
14057
|
+
defaultContentsTemplate$1.render(this, this);
|
|
14052
14058
|
}
|
|
14053
14059
|
disconnectView() {
|
|
14054
|
-
|
|
14055
|
-
(_a = this.customView) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
14060
|
+
this.customView?.dispose();
|
|
14056
14061
|
this.customView = undefined;
|
|
14057
14062
|
}
|
|
14058
14063
|
}
|
|
@@ -14121,14 +14126,13 @@ class PickerListItem extends FoundationElement {
|
|
|
14121
14126
|
this.$emit("pickeriteminvoked");
|
|
14122
14127
|
}
|
|
14123
14128
|
updateView() {
|
|
14124
|
-
var _a, _b;
|
|
14125
14129
|
this.disconnectView();
|
|
14126
14130
|
this.customView =
|
|
14127
|
-
|
|
14131
|
+
this.contentsTemplate?.render(this, this) ??
|
|
14132
|
+
defaultContentsTemplate.render(this, this);
|
|
14128
14133
|
}
|
|
14129
14134
|
disconnectView() {
|
|
14130
|
-
|
|
14131
|
-
(_a = this.customView) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
14135
|
+
this.customView?.dispose();
|
|
14132
14136
|
this.customView = undefined;
|
|
14133
14137
|
}
|
|
14134
14138
|
}
|
|
@@ -14823,12 +14827,11 @@ class Picker extends FormAssociatedPicker {
|
|
|
14823
14827
|
* Disables the menu. Note that the menu can be open, just doens't have any valid options on display.
|
|
14824
14828
|
*/
|
|
14825
14829
|
disableMenu() {
|
|
14826
|
-
var _a, _b, _c;
|
|
14827
14830
|
this.menuFocusIndex = -1;
|
|
14828
14831
|
this.menuFocusOptionId = undefined;
|
|
14829
|
-
|
|
14830
|
-
|
|
14831
|
-
|
|
14832
|
+
this.inputElement?.removeAttribute("aria-activedescendant");
|
|
14833
|
+
this.inputElement?.removeAttribute("aria-owns");
|
|
14834
|
+
this.inputElement?.removeAttribute("aria-expanded");
|
|
14832
14835
|
}
|
|
14833
14836
|
/**
|
|
14834
14837
|
* Sets the currently focused menu option by index
|
|
@@ -14863,17 +14866,15 @@ class Picker extends FormAssociatedPicker {
|
|
|
14863
14866
|
* Updates the template used for the list item repeat behavior
|
|
14864
14867
|
*/
|
|
14865
14868
|
updateListItemTemplate() {
|
|
14866
|
-
var _a;
|
|
14867
14869
|
this.activeListItemTemplate =
|
|
14868
|
-
|
|
14870
|
+
this.listItemTemplate ?? this.defaultListItemTemplate;
|
|
14869
14871
|
}
|
|
14870
14872
|
/**
|
|
14871
14873
|
* Updates the template used for the menu option repeat behavior
|
|
14872
14874
|
*/
|
|
14873
14875
|
updateOptionTemplate() {
|
|
14874
|
-
var _a;
|
|
14875
14876
|
this.activeMenuOptionTemplate =
|
|
14876
|
-
|
|
14877
|
+
this.menuOptionTemplate ?? this.defaultMenuOptionTemplate;
|
|
14877
14878
|
}
|
|
14878
14879
|
/**
|
|
14879
14880
|
* Updates the filtered options array
|
|
@@ -14895,7 +14896,13 @@ class Picker extends FormAssociatedPicker {
|
|
|
14895
14896
|
if (newConfig === null) {
|
|
14896
14897
|
newConfig = FlyoutPosBottomFill;
|
|
14897
14898
|
}
|
|
14898
|
-
this.menuConfig =
|
|
14899
|
+
this.menuConfig = {
|
|
14900
|
+
...newConfig,
|
|
14901
|
+
autoUpdateMode: "auto",
|
|
14902
|
+
fixedPlacement: true,
|
|
14903
|
+
horizontalViewportLock: false,
|
|
14904
|
+
verticalViewportLock: false,
|
|
14905
|
+
};
|
|
14899
14906
|
}
|
|
14900
14907
|
}
|
|
14901
14908
|
__decorate([
|
|
@@ -15615,6 +15622,7 @@ class Menu extends FoundationElement {
|
|
|
15615
15622
|
this.setItems();
|
|
15616
15623
|
}
|
|
15617
15624
|
}
|
|
15625
|
+
static { this.focusableElementRoles = roleForMenuItem; }
|
|
15618
15626
|
/**
|
|
15619
15627
|
* @internal
|
|
15620
15628
|
*/
|
|
@@ -15714,7 +15722,6 @@ class Menu extends FoundationElement {
|
|
|
15714
15722
|
}
|
|
15715
15723
|
}
|
|
15716
15724
|
}
|
|
15717
|
-
Menu.focusableElementRoles = roleForMenuItem;
|
|
15718
15725
|
__decorate([
|
|
15719
15726
|
observable
|
|
15720
15727
|
], Menu.prototype, "items", void 0);
|
|
@@ -16086,8 +16093,7 @@ class NumberField extends FormAssociatedNumberField {
|
|
|
16086
16093
|
* @internal
|
|
16087
16094
|
*/
|
|
16088
16095
|
maxChanged(previous, next) {
|
|
16089
|
-
|
|
16090
|
-
this.max = Math.max(next, (_a = this.min) !== null && _a !== void 0 ? _a : next);
|
|
16096
|
+
this.max = Math.max(next, this.min ?? next);
|
|
16091
16097
|
const min = Math.min(this.min, this.max);
|
|
16092
16098
|
if (this.min !== undefined && this.min !== min) {
|
|
16093
16099
|
this.min = min;
|
|
@@ -16103,8 +16109,7 @@ class NumberField extends FormAssociatedNumberField {
|
|
|
16103
16109
|
* @internal
|
|
16104
16110
|
*/
|
|
16105
16111
|
minChanged(previous, next) {
|
|
16106
|
-
|
|
16107
|
-
this.min = Math.min(next, (_a = this.max) !== null && _a !== void 0 ? _a : next);
|
|
16112
|
+
this.min = Math.min(next, this.max ?? next);
|
|
16108
16113
|
const max = Math.max(this.min, this.max);
|
|
16109
16114
|
if (this.max !== undefined && this.max !== max) {
|
|
16110
16115
|
this.max = max;
|
|
@@ -16571,12 +16576,10 @@ class RadioGroup extends FoundationElement {
|
|
|
16571
16576
|
radio.focus();
|
|
16572
16577
|
};
|
|
16573
16578
|
this.moveRightOffGroup = () => {
|
|
16574
|
-
|
|
16575
|
-
(_a = this.nextElementSibling) === null || _a === void 0 ? void 0 : _a.focus();
|
|
16579
|
+
this.nextElementSibling?.focus();
|
|
16576
16580
|
};
|
|
16577
16581
|
this.moveLeftOffGroup = () => {
|
|
16578
|
-
|
|
16579
|
-
(_a = this.previousElementSibling) === null || _a === void 0 ? void 0 : _a.focus();
|
|
16582
|
+
this.previousElementSibling?.focus();
|
|
16580
16583
|
};
|
|
16581
16584
|
/**
|
|
16582
16585
|
* @internal
|
|
@@ -16802,12 +16805,10 @@ class RadioGroup extends FoundationElement {
|
|
|
16802
16805
|
return this.closest('[role="toolbar"]');
|
|
16803
16806
|
}
|
|
16804
16807
|
get isInsideToolbar() {
|
|
16805
|
-
|
|
16806
|
-
return ((_a = this.parentToolbar) !== null && _a !== void 0 ? _a : false);
|
|
16808
|
+
return (this.parentToolbar ?? false);
|
|
16807
16809
|
}
|
|
16808
16810
|
get isInsideFoundationToolbar() {
|
|
16809
|
-
|
|
16810
|
-
return !!((_a = this.parentToolbar) === null || _a === void 0 ? void 0 : _a["$fastController"]);
|
|
16811
|
+
return !!this.parentToolbar?.["$fastController"];
|
|
16811
16812
|
}
|
|
16812
16813
|
/**
|
|
16813
16814
|
* @internal
|
|
@@ -16964,13 +16965,12 @@ class Radio extends FormAssociatedRadio {
|
|
|
16964
16965
|
* @internal
|
|
16965
16966
|
*/
|
|
16966
16967
|
defaultCheckedChanged() {
|
|
16967
|
-
var _a;
|
|
16968
16968
|
if (this.$fastController.isConnected && !this.dirtyChecked) {
|
|
16969
16969
|
// Setting this.checked will cause us to enter a dirty state,
|
|
16970
16970
|
// but if we are clean when defaultChecked is changed, we want to stay
|
|
16971
16971
|
// in a clean state, so reset this.dirtyChecked
|
|
16972
16972
|
if (!this.isInsideRadioGroup()) {
|
|
16973
|
-
this.checked =
|
|
16973
|
+
this.checked = this.defaultChecked ?? false;
|
|
16974
16974
|
this.dirtyChecked = false;
|
|
16975
16975
|
}
|
|
16976
16976
|
}
|
|
@@ -17003,10 +17003,9 @@ class Radio extends FormAssociatedRadio {
|
|
|
17003
17003
|
* @internal
|
|
17004
17004
|
*/
|
|
17005
17005
|
connectedCallback() {
|
|
17006
|
-
var _a, _b;
|
|
17007
17006
|
super.connectedCallback();
|
|
17008
17007
|
this.validate();
|
|
17009
|
-
if (
|
|
17008
|
+
if (this.parentElement?.getAttribute("role") !== "radiogroup" &&
|
|
17010
17009
|
this.getAttribute("tabindex") === null) {
|
|
17011
17010
|
if (!this.disabled) {
|
|
17012
17011
|
this.setAttribute("tabindex", "0");
|
|
@@ -17018,7 +17017,7 @@ class Radio extends FormAssociatedRadio {
|
|
|
17018
17017
|
// but if we are clean when defaultChecked is changed, we want to stay
|
|
17019
17018
|
// in a clean state, so reset this.dirtyChecked
|
|
17020
17019
|
if (!this.isInsideRadioGroup()) {
|
|
17021
|
-
this.checked =
|
|
17020
|
+
this.checked = this.defaultChecked ?? false;
|
|
17022
17021
|
this.dirtyChecked = false;
|
|
17023
17022
|
}
|
|
17024
17023
|
}
|
|
@@ -17243,12 +17242,11 @@ class HorizontalScroll extends FoundationElement {
|
|
|
17243
17242
|
* @internal
|
|
17244
17243
|
*/
|
|
17245
17244
|
setFlippers() {
|
|
17246
|
-
var _a, _b;
|
|
17247
17245
|
const position = this.scrollContainer.scrollLeft;
|
|
17248
|
-
|
|
17246
|
+
this.previousFlipperContainer?.classList.toggle("disabled", position === 0);
|
|
17249
17247
|
if (this.scrollStops) {
|
|
17250
17248
|
const lastStop = Math.abs(this.scrollStops[this.scrollStops.length - 1]);
|
|
17251
|
-
|
|
17249
|
+
this.nextFlipperContainer?.classList.toggle("disabled", this.validateStops(false) && Math.abs(position) + this.width >= lastStop);
|
|
17252
17250
|
}
|
|
17253
17251
|
}
|
|
17254
17252
|
/**
|
|
@@ -17260,12 +17258,11 @@ class HorizontalScroll extends FoundationElement {
|
|
|
17260
17258
|
* @public
|
|
17261
17259
|
*/
|
|
17262
17260
|
scrollInView(item, padding = 0, rightPadding) {
|
|
17263
|
-
var _a;
|
|
17264
17261
|
if (typeof item !== "number" && item) {
|
|
17265
17262
|
item = this.scrollItems.findIndex(scrollItem => scrollItem === item || scrollItem.contains(item));
|
|
17266
17263
|
}
|
|
17267
17264
|
if (item !== undefined) {
|
|
17268
|
-
rightPadding = rightPadding
|
|
17265
|
+
rightPadding = rightPadding ?? padding;
|
|
17269
17266
|
const { scrollContainer: container, scrollStops, scrollItems: items } = this;
|
|
17270
17267
|
const { scrollLeft } = this.scrollContainer;
|
|
17271
17268
|
const { width: containerWidth } = container.getBoundingClientRect();
|
|
@@ -17275,9 +17272,9 @@ class HorizontalScroll extends FoundationElement {
|
|
|
17275
17272
|
const isBefore = scrollLeft + padding > itemStart;
|
|
17276
17273
|
if (isBefore || scrollLeft + containerWidth - rightPadding < itemEnd) {
|
|
17277
17274
|
const stops = [...scrollStops].sort((a, b) => (isBefore ? b - a : a - b));
|
|
17278
|
-
const scrollTo =
|
|
17275
|
+
const scrollTo = stops.find(position => isBefore
|
|
17279
17276
|
? position + padding < itemStart
|
|
17280
|
-
: position + containerWidth - (rightPadding
|
|
17277
|
+
: position + containerWidth - (rightPadding ?? 0) > itemEnd) ?? 0;
|
|
17281
17278
|
this.scrollToPosition(scrollTo);
|
|
17282
17279
|
}
|
|
17283
17280
|
}
|
|
@@ -17341,12 +17338,11 @@ class HorizontalScroll extends FoundationElement {
|
|
|
17341
17338
|
* @public
|
|
17342
17339
|
*/
|
|
17343
17340
|
scrollToPosition(newPosition, position = this.scrollContainer.scrollLeft) {
|
|
17344
|
-
var _a;
|
|
17345
17341
|
if (this.scrolling) {
|
|
17346
17342
|
return;
|
|
17347
17343
|
}
|
|
17348
17344
|
this.scrolling = true;
|
|
17349
|
-
const seconds =
|
|
17345
|
+
const seconds = this.duration ?? `${Math.abs(newPosition - position) / this.speed}s`;
|
|
17350
17346
|
this.content.style.setProperty("transition-duration", seconds);
|
|
17351
17347
|
const computedDuration = parseFloat(getComputedStyle(this.content).getPropertyValue("transition-duration"));
|
|
17352
17348
|
const transitionendHandler = (e) => {
|
|
@@ -17428,9 +17424,7 @@ __decorate([
|
|
|
17428
17424
|
/**
|
|
17429
17425
|
* @public
|
|
17430
17426
|
*/
|
|
17431
|
-
const horizontalScrollTemplate = (context, definition) =>
|
|
17432
|
-
var _a, _b;
|
|
17433
|
-
return html `
|
|
17427
|
+
const horizontalScrollTemplate = (context, definition) => html `
|
|
17434
17428
|
<template
|
|
17435
17429
|
class="horizontal-scroll"
|
|
17436
17430
|
@keyup="${(x, c) => x.keyupHandler(c.event)}"
|
|
@@ -17446,9 +17440,9 @@ const horizontalScrollTemplate = (context, definition) => {
|
|
|
17446
17440
|
<div class="content-container" part="content-container" ${ref("content")}>
|
|
17447
17441
|
<slot
|
|
17448
17442
|
${slotted({
|
|
17449
|
-
|
|
17450
|
-
|
|
17451
|
-
|
|
17443
|
+
property: "scrollItems",
|
|
17444
|
+
filter: elements(),
|
|
17445
|
+
})}
|
|
17452
17446
|
></slot>
|
|
17453
17447
|
</div>
|
|
17454
17448
|
</div>
|
|
@@ -17461,8 +17455,8 @@ const horizontalScrollTemplate = (context, definition) => {
|
|
|
17461
17455
|
<div class="scroll-action" part="scroll-action-previous">
|
|
17462
17456
|
<slot name="previous-flipper">
|
|
17463
17457
|
${definition.previousFlipper instanceof Function
|
|
17464
|
-
|
|
17465
|
-
|
|
17458
|
+
? definition.previousFlipper(context, definition)
|
|
17459
|
+
: definition.previousFlipper ?? ""}
|
|
17466
17460
|
</slot>
|
|
17467
17461
|
</div>
|
|
17468
17462
|
</div>
|
|
@@ -17474,8 +17468,8 @@ const horizontalScrollTemplate = (context, definition) => {
|
|
|
17474
17468
|
<div class="scroll-action" part="scroll-action-next">
|
|
17475
17469
|
<slot name="next-flipper">
|
|
17476
17470
|
${definition.nextFlipper instanceof Function
|
|
17477
|
-
|
|
17478
|
-
|
|
17471
|
+
? definition.nextFlipper(context, definition)
|
|
17472
|
+
: definition.nextFlipper ?? ""}
|
|
17479
17473
|
</slot>
|
|
17480
17474
|
</div>
|
|
17481
17475
|
</div>
|
|
@@ -17484,7 +17478,6 @@ const horizontalScrollTemplate = (context, definition) => {
|
|
|
17484
17478
|
${endSlotTemplate(context, definition)}
|
|
17485
17479
|
</template>
|
|
17486
17480
|
`;
|
|
17487
|
-
};
|
|
17488
17481
|
|
|
17489
17482
|
/**
|
|
17490
17483
|
* a method to filter out any whitespace _only_ nodes, to be used inside a template
|
|
@@ -17864,17 +17857,16 @@ class Select extends FormAssociatedSelect {
|
|
|
17864
17857
|
return this._value;
|
|
17865
17858
|
}
|
|
17866
17859
|
set value(next) {
|
|
17867
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
17868
17860
|
const prev = `${this._value}`;
|
|
17869
|
-
if (
|
|
17861
|
+
if (this._options?.length) {
|
|
17870
17862
|
const selectedIndex = this._options.findIndex(el => el.value === next);
|
|
17871
|
-
const prevSelectedValue =
|
|
17872
|
-
const nextSelectedValue =
|
|
17863
|
+
const prevSelectedValue = this._options[this.selectedIndex]?.value ?? null;
|
|
17864
|
+
const nextSelectedValue = this._options[selectedIndex]?.value ?? null;
|
|
17873
17865
|
if (selectedIndex === -1 || prevSelectedValue !== nextSelectedValue) {
|
|
17874
17866
|
next = "";
|
|
17875
17867
|
this.selectedIndex = selectedIndex;
|
|
17876
17868
|
}
|
|
17877
|
-
next =
|
|
17869
|
+
next = this.firstSelectedOption?.value ?? next;
|
|
17878
17870
|
}
|
|
17879
17871
|
if (prev !== next) {
|
|
17880
17872
|
this._value = next;
|
|
@@ -17891,9 +17883,8 @@ class Select extends FormAssociatedSelect {
|
|
|
17891
17883
|
* @internal
|
|
17892
17884
|
*/
|
|
17893
17885
|
updateValue(shouldEmit) {
|
|
17894
|
-
var _a, _b;
|
|
17895
17886
|
if (this.$fastController.isConnected) {
|
|
17896
|
-
this.value =
|
|
17887
|
+
this.value = this.firstSelectedOption?.value ?? "";
|
|
17897
17888
|
}
|
|
17898
17889
|
if (shouldEmit) {
|
|
17899
17890
|
this.$emit("input");
|
|
@@ -17945,9 +17936,8 @@ class Select extends FormAssociatedSelect {
|
|
|
17945
17936
|
* @public
|
|
17946
17937
|
*/
|
|
17947
17938
|
get displayValue() {
|
|
17948
|
-
var _a, _b;
|
|
17949
17939
|
Observable.track(this, "displayValue");
|
|
17950
|
-
return
|
|
17940
|
+
return this.firstSelectedOption?.text ?? "";
|
|
17951
17941
|
}
|
|
17952
17942
|
/**
|
|
17953
17943
|
* Synchronize the `aria-disabled` property when the `disabled` property changes.
|
|
@@ -18008,7 +17998,6 @@ class Select extends FormAssociatedSelect {
|
|
|
18008
17998
|
* @internal
|
|
18009
17999
|
*/
|
|
18010
18000
|
focusoutHandler(e) {
|
|
18011
|
-
var _a;
|
|
18012
18001
|
super.focusoutHandler(e);
|
|
18013
18002
|
if (!this.open) {
|
|
18014
18003
|
return true;
|
|
@@ -18018,7 +18007,7 @@ class Select extends FormAssociatedSelect {
|
|
|
18018
18007
|
this.focus();
|
|
18019
18008
|
return;
|
|
18020
18009
|
}
|
|
18021
|
-
if (!
|
|
18010
|
+
if (!this.options?.includes(focusTarget)) {
|
|
18022
18011
|
this.open = false;
|
|
18023
18012
|
if (this.indexWhenOpened !== this.selectedIndex) {
|
|
18024
18013
|
this.updateValue(true);
|
|
@@ -18070,8 +18059,7 @@ class Select extends FormAssociatedSelect {
|
|
|
18070
18059
|
* @internal
|
|
18071
18060
|
*/
|
|
18072
18061
|
mousedownHandler(e) {
|
|
18073
|
-
|
|
18074
|
-
if (e.offsetX >= 0 && e.offsetX <= ((_a = this.listbox) === null || _a === void 0 ? void 0 : _a.scrollWidth)) {
|
|
18062
|
+
if (e.offsetX >= 0 && e.offsetX <= this.listbox?.scrollWidth) {
|
|
18075
18063
|
return super.mousedownHandler(e);
|
|
18076
18064
|
}
|
|
18077
18065
|
return this.collapsible;
|
|
@@ -18098,11 +18086,9 @@ class Select extends FormAssociatedSelect {
|
|
|
18098
18086
|
* @internal
|
|
18099
18087
|
*/
|
|
18100
18088
|
selectedOptionsChanged(prev, next) {
|
|
18101
|
-
var _a;
|
|
18102
18089
|
super.selectedOptionsChanged(prev, next);
|
|
18103
|
-
|
|
18104
|
-
|
|
18105
|
-
const proxyOption = (_a = this.proxy) === null || _a === void 0 ? void 0 : _a.options.item(i);
|
|
18090
|
+
this.options?.forEach((o, i) => {
|
|
18091
|
+
const proxyOption = this.proxy?.options.item(i);
|
|
18106
18092
|
if (proxyOption) {
|
|
18107
18093
|
proxyOption.selected = o.selected;
|
|
18108
18094
|
}
|
|
@@ -18116,9 +18102,8 @@ class Select extends FormAssociatedSelect {
|
|
|
18116
18102
|
* @internal
|
|
18117
18103
|
*/
|
|
18118
18104
|
setDefaultSelectedOption() {
|
|
18119
|
-
|
|
18120
|
-
const
|
|
18121
|
-
const selectedIndex = options === null || options === void 0 ? void 0 : options.findIndex(el => el.hasAttribute("selected") || el.selected || el.value === this.value);
|
|
18105
|
+
const options = this.options ?? Array.from(this.children).filter(Listbox.slottedOptionFilter);
|
|
18106
|
+
const selectedIndex = options?.findIndex(el => el.hasAttribute("selected") || el.selected || el.value === this.value);
|
|
18122
18107
|
if (selectedIndex !== -1) {
|
|
18123
18108
|
this.selectedIndex = selectedIndex;
|
|
18124
18109
|
return;
|
|
@@ -19533,14 +19518,12 @@ class Tabs extends FoundationElement {
|
|
|
19533
19518
|
}
|
|
19534
19519
|
getTabIds() {
|
|
19535
19520
|
return this.tabs.map((tab) => {
|
|
19536
|
-
|
|
19537
|
-
return (_a = tab.getAttribute("id")) !== null && _a !== void 0 ? _a : `tab-${uniqueId()}`;
|
|
19521
|
+
return tab.getAttribute("id") ?? `tab-${uniqueId()}`;
|
|
19538
19522
|
});
|
|
19539
19523
|
}
|
|
19540
19524
|
getTabPanelIds() {
|
|
19541
19525
|
return this.tabpanels.map((tabPanel) => {
|
|
19542
|
-
|
|
19543
|
-
return (_a = tabPanel.getAttribute("id")) !== null && _a !== void 0 ? _a : `panel-${uniqueId()}`;
|
|
19526
|
+
return tabPanel.getAttribute("id") ?? `panel-${uniqueId()}`;
|
|
19544
19527
|
});
|
|
19545
19528
|
}
|
|
19546
19529
|
setComponent() {
|
|
@@ -20081,8 +20064,7 @@ class Toolbar extends FoundationElement {
|
|
|
20081
20064
|
* @internal
|
|
20082
20065
|
*/
|
|
20083
20066
|
mouseDownHandler(e) {
|
|
20084
|
-
|
|
20085
|
-
const activeIndex = (_a = this.focusableElements) === null || _a === void 0 ? void 0 : _a.findIndex(x => x.contains(e.target));
|
|
20067
|
+
const activeIndex = this.focusableElements?.findIndex(x => x.contains(e.target));
|
|
20086
20068
|
if (activeIndex > -1 && this.activeIndex !== activeIndex) {
|
|
20087
20069
|
this.setFocusedElement(activeIndex);
|
|
20088
20070
|
}
|
|
@@ -20120,8 +20102,9 @@ class Toolbar extends FoundationElement {
|
|
|
20120
20102
|
* @internal
|
|
20121
20103
|
*/
|
|
20122
20104
|
getDirectionalIncrementer(key) {
|
|
20123
|
-
|
|
20124
|
-
|
|
20105
|
+
return (ToolbarArrowKeyMap[key]?.[this.orientation]?.[this.direction] ??
|
|
20106
|
+
ToolbarArrowKeyMap[key]?.[this.orientation] ??
|
|
20107
|
+
0);
|
|
20125
20108
|
}
|
|
20126
20109
|
/**
|
|
20127
20110
|
* Handle keyboard events for the toolbar.
|
|
@@ -20161,8 +20144,7 @@ class Toolbar extends FoundationElement {
|
|
|
20161
20144
|
* @internal
|
|
20162
20145
|
*/
|
|
20163
20146
|
reduceFocusableElements() {
|
|
20164
|
-
|
|
20165
|
-
const previousFocusedElement = (_a = this.focusableElements) === null || _a === void 0 ? void 0 : _a[this.activeIndex];
|
|
20147
|
+
const previousFocusedElement = this.focusableElements?.[this.activeIndex];
|
|
20166
20148
|
this.focusableElements = this.allSlottedItems.reduce(Toolbar.reduceFocusableItems, []);
|
|
20167
20149
|
// If the previously active item is still focusable, adjust the active index to the
|
|
20168
20150
|
// index of that item.
|
|
@@ -20195,10 +20177,9 @@ class Toolbar extends FoundationElement {
|
|
|
20195
20177
|
* @internal
|
|
20196
20178
|
*/
|
|
20197
20179
|
static reduceFocusableItems(elements, element) {
|
|
20198
|
-
var _a, _b, _c, _d;
|
|
20199
20180
|
const isRoleRadio = element.getAttribute("role") === "radio";
|
|
20200
|
-
const isFocusableFastElement =
|
|
20201
|
-
const hasFocusableShadow = Array.from(
|
|
20181
|
+
const isFocusableFastElement = element.$fastController?.definition.shadowOptions?.delegatesFocus;
|
|
20182
|
+
const hasFocusableShadow = Array.from(element.shadowRoot?.querySelectorAll("*") ?? []).some(x => isFocusable(x));
|
|
20202
20183
|
if (!element.hasAttribute("disabled") &&
|
|
20203
20184
|
!element.hasAttribute("hidden") &&
|
|
20204
20185
|
(isFocusable(element) ||
|