@fluentui/web-components 3.0.0-beta.39 → 3.0.0-beta.40
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/CHANGELOG.md +13 -2
- package/dist/dts/accordion/accordion.d.ts +35 -12
- package/dist/dts/accordion-item/accordion-item.d.ts +42 -14
- package/dist/dts/accordion-item/accordion-item.options.d.ts +2 -2
- package/dist/dts/accordion-item/index.d.ts +1 -1
- package/dist/dts/checkbox/checkbox.d.ts +98 -48
- package/dist/dts/field/field.d.ts +30 -1
- package/dist/dts/field/field.options.d.ts +2 -0
- package/dist/dts/index.d.ts +1 -1
- package/dist/dts/radio/index.d.ts +1 -1
- package/dist/dts/radio/radio.d.ts +38 -35
- package/dist/dts/radio/radio.options.d.ts +14 -0
- package/dist/dts/radio/radio.styles.d.ts +3 -1
- package/dist/dts/radio/radio.template.d.ts +13 -1
- package/dist/dts/radio-group/radio-group.d.ts +211 -49
- package/dist/dts/radio-group/radio-group.template.d.ts +1 -1
- package/dist/dts/styles/states/index.d.ts +20 -0
- package/dist/dts/switch/switch.d.ts +1 -0
- package/dist/dts/utils/root-active-element.d.ts +1 -0
- package/dist/esm/accordion/accordion.js +46 -85
- package/dist/esm/accordion/accordion.js.map +1 -1
- package/dist/esm/accordion-item/accordion-item.js +63 -19
- package/dist/esm/accordion-item/accordion-item.js.map +1 -1
- package/dist/esm/accordion-item/accordion-item.options.js +1 -1
- package/dist/esm/accordion-item/accordion-item.options.js.map +1 -1
- package/dist/esm/accordion-item/accordion-item.styles.js +41 -63
- package/dist/esm/accordion-item/accordion-item.styles.js.map +1 -1
- package/dist/esm/accordion-item/accordion-item.template.js +24 -43
- package/dist/esm/accordion-item/accordion-item.template.js.map +1 -1
- package/dist/esm/accordion-item/index.js +1 -1
- package/dist/esm/accordion-item/index.js.map +1 -1
- package/dist/esm/checkbox/checkbox.js +146 -97
- package/dist/esm/checkbox/checkbox.js.map +1 -1
- package/dist/esm/checkbox/checkbox.styles.js +1 -6
- package/dist/esm/checkbox/checkbox.styles.js.map +1 -1
- package/dist/esm/checkbox/checkbox.template.js.map +1 -1
- package/dist/esm/field/field.js +91 -29
- package/dist/esm/field/field.js.map +1 -1
- package/dist/esm/field/field.options.js.map +1 -1
- package/dist/esm/field/field.styles.js +31 -16
- package/dist/esm/field/field.styles.js.map +1 -1
- package/dist/esm/field/field.template.js +1 -1
- package/dist/esm/field/field.template.js.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/radio/radio.js +59 -72
- package/dist/esm/radio/radio.js.map +1 -1
- package/dist/esm/radio/radio.options.js +2 -0
- package/dist/esm/radio/radio.options.js.map +1 -0
- package/dist/esm/radio/radio.styles.js +95 -88
- package/dist/esm/radio/radio.styles.js.map +1 -1
- package/dist/esm/radio/radio.template.js +21 -24
- package/dist/esm/radio/radio.template.js.map +1 -1
- package/dist/esm/radio-group/radio-group.js +416 -313
- package/dist/esm/radio-group/radio-group.js.map +1 -1
- package/dist/esm/radio-group/radio-group.styles.js +26 -32
- package/dist/esm/radio-group/radio-group.styles.js.map +1 -1
- package/dist/esm/radio-group/radio-group.template.js +6 -21
- package/dist/esm/radio-group/radio-group.template.js.map +1 -1
- package/dist/esm/styles/states/index.js +20 -0
- package/dist/esm/styles/states/index.js.map +1 -1
- package/dist/esm/switch/switch.js +4 -0
- package/dist/esm/switch/switch.js.map +1 -1
- package/dist/esm/switch/switch.styles.js +3 -6
- package/dist/esm/switch/switch.styles.js.map +1 -1
- package/dist/esm/switch/switch.template.js.map +1 -1
- package/dist/esm/theme/set-theme.js +3 -6
- package/dist/esm/theme/set-theme.js.map +1 -1
- package/dist/esm/utils/root-active-element.js +9 -0
- package/dist/esm/utils/root-active-element.js.map +1 -0
- package/dist/web-components.d.ts +461 -181
- package/dist/web-components.js +1387 -1233
- package/dist/web-components.min.js +262 -258
- package/package.json +1 -1
- package/dist/dts/radio/radio.form-associated.d.ts +0 -14
- package/dist/esm/radio/radio.form-associated.js +0 -14
- package/dist/esm/radio/radio.form-associated.js.map +0 -1
package/dist/web-components.js
CHANGED
|
@@ -3316,6 +3316,22 @@ const Orientation = {
|
|
|
3316
3316
|
vertical: "vertical"
|
|
3317
3317
|
};
|
|
3318
3318
|
|
|
3319
|
+
/**
|
|
3320
|
+
* Returns the index of the last element in the array where predicate is true, and -1 otherwise.
|
|
3321
|
+
*
|
|
3322
|
+
* @param array - the array to test
|
|
3323
|
+
* @param predicate - find calls predicate once for each element of the array, in descending order, until it finds one where predicate returns true. If such an element is found, findLastIndex immediately returns that element index. Otherwise, findIndex returns -1.
|
|
3324
|
+
*/
|
|
3325
|
+
function findLastIndex(array, predicate) {
|
|
3326
|
+
let k = array.length;
|
|
3327
|
+
while (k--) {
|
|
3328
|
+
if (predicate(array[k], k, array)) {
|
|
3329
|
+
return k;
|
|
3330
|
+
}
|
|
3331
|
+
}
|
|
3332
|
+
return -1;
|
|
3333
|
+
}
|
|
3334
|
+
|
|
3319
3335
|
/**
|
|
3320
3336
|
* A test that ensures that all arguments are HTML Elements
|
|
3321
3337
|
*/
|
|
@@ -3336,12 +3352,6 @@ const keyEscape = "Escape";
|
|
|
3336
3352
|
const keyHome = "Home";
|
|
3337
3353
|
const keySpace = " ";
|
|
3338
3354
|
const keyTab = "Tab";
|
|
3339
|
-
const ArrowKeys = {
|
|
3340
|
-
ArrowDown: keyArrowDown,
|
|
3341
|
-
ArrowLeft: keyArrowLeft,
|
|
3342
|
-
ArrowRight: keyArrowRight,
|
|
3343
|
-
ArrowUp: keyArrowUp
|
|
3344
|
-
};
|
|
3345
3355
|
|
|
3346
3356
|
/**
|
|
3347
3357
|
* Expose ltr and rtl strings
|
|
@@ -3357,14 +3367,6 @@ var Direction;
|
|
|
3357
3367
|
* is larger than the max, the minimum value will be returned. If the value is smaller than the minimum,
|
|
3358
3368
|
* the maximum will be returned. Otherwise, the value is returned un-changed.
|
|
3359
3369
|
*/
|
|
3360
|
-
function wrapInBounds(min, max, value) {
|
|
3361
|
-
if (value < min) {
|
|
3362
|
-
return max;
|
|
3363
|
-
} else if (value > max) {
|
|
3364
|
-
return min;
|
|
3365
|
-
}
|
|
3366
|
-
return value;
|
|
3367
|
-
}
|
|
3368
3370
|
/**
|
|
3369
3371
|
* Ensures that a value is between a min and max value. If value is lower than min, min will be returned.
|
|
3370
3372
|
* If value is greater than max, max will be returned.
|
|
@@ -3381,70 +3383,70 @@ function uniqueId(prefix = "") {
|
|
|
3381
3383
|
return `${prefix}${uniqueIdCounter++}`;
|
|
3382
3384
|
}
|
|
3383
3385
|
|
|
3384
|
-
var __defProp$
|
|
3385
|
-
var __getOwnPropDesc$
|
|
3386
|
-
var __decorateClass$
|
|
3387
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
3386
|
+
var __defProp$u = Object.defineProperty;
|
|
3387
|
+
var __getOwnPropDesc$u = Object.getOwnPropertyDescriptor;
|
|
3388
|
+
var __decorateClass$u = (decorators, target, key, kind) => {
|
|
3389
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$u(target, key) : target;
|
|
3388
3390
|
for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
3389
|
-
if (kind && result) __defProp$
|
|
3391
|
+
if (kind && result) __defProp$u(target, key, result);
|
|
3390
3392
|
return result;
|
|
3391
3393
|
};
|
|
3392
3394
|
class ARIAGlobalStatesAndProperties {}
|
|
3393
|
-
__decorateClass$
|
|
3395
|
+
__decorateClass$u([attr({
|
|
3394
3396
|
attribute: "aria-atomic"
|
|
3395
3397
|
})], ARIAGlobalStatesAndProperties.prototype, "ariaAtomic", 2);
|
|
3396
|
-
__decorateClass$
|
|
3398
|
+
__decorateClass$u([attr({
|
|
3397
3399
|
attribute: "aria-busy"
|
|
3398
3400
|
})], ARIAGlobalStatesAndProperties.prototype, "ariaBusy", 2);
|
|
3399
|
-
__decorateClass$
|
|
3401
|
+
__decorateClass$u([attr({
|
|
3400
3402
|
attribute: "aria-controls"
|
|
3401
3403
|
})], ARIAGlobalStatesAndProperties.prototype, "ariaControls", 2);
|
|
3402
|
-
__decorateClass$
|
|
3404
|
+
__decorateClass$u([attr({
|
|
3403
3405
|
attribute: "aria-current"
|
|
3404
3406
|
})], ARIAGlobalStatesAndProperties.prototype, "ariaCurrent", 2);
|
|
3405
|
-
__decorateClass$
|
|
3407
|
+
__decorateClass$u([attr({
|
|
3406
3408
|
attribute: "aria-describedby"
|
|
3407
3409
|
})], ARIAGlobalStatesAndProperties.prototype, "ariaDescribedby", 2);
|
|
3408
|
-
__decorateClass$
|
|
3410
|
+
__decorateClass$u([attr({
|
|
3409
3411
|
attribute: "aria-details"
|
|
3410
3412
|
})], ARIAGlobalStatesAndProperties.prototype, "ariaDetails", 2);
|
|
3411
|
-
__decorateClass$
|
|
3413
|
+
__decorateClass$u([attr({
|
|
3412
3414
|
attribute: "aria-disabled"
|
|
3413
3415
|
})], ARIAGlobalStatesAndProperties.prototype, "ariaDisabled", 2);
|
|
3414
|
-
__decorateClass$
|
|
3416
|
+
__decorateClass$u([attr({
|
|
3415
3417
|
attribute: "aria-errormessage"
|
|
3416
3418
|
})], ARIAGlobalStatesAndProperties.prototype, "ariaErrormessage", 2);
|
|
3417
|
-
__decorateClass$
|
|
3419
|
+
__decorateClass$u([attr({
|
|
3418
3420
|
attribute: "aria-flowto"
|
|
3419
3421
|
})], ARIAGlobalStatesAndProperties.prototype, "ariaFlowto", 2);
|
|
3420
|
-
__decorateClass$
|
|
3422
|
+
__decorateClass$u([attr({
|
|
3421
3423
|
attribute: "aria-haspopup"
|
|
3422
3424
|
})], ARIAGlobalStatesAndProperties.prototype, "ariaHaspopup", 2);
|
|
3423
|
-
__decorateClass$
|
|
3425
|
+
__decorateClass$u([attr({
|
|
3424
3426
|
attribute: "aria-hidden"
|
|
3425
3427
|
})], ARIAGlobalStatesAndProperties.prototype, "ariaHidden", 2);
|
|
3426
|
-
__decorateClass$
|
|
3428
|
+
__decorateClass$u([attr({
|
|
3427
3429
|
attribute: "aria-invalid"
|
|
3428
3430
|
})], ARIAGlobalStatesAndProperties.prototype, "ariaInvalid", 2);
|
|
3429
|
-
__decorateClass$
|
|
3431
|
+
__decorateClass$u([attr({
|
|
3430
3432
|
attribute: "aria-keyshortcuts"
|
|
3431
3433
|
})], ARIAGlobalStatesAndProperties.prototype, "ariaKeyshortcuts", 2);
|
|
3432
|
-
__decorateClass$
|
|
3434
|
+
__decorateClass$u([attr({
|
|
3433
3435
|
attribute: "aria-label"
|
|
3434
3436
|
})], ARIAGlobalStatesAndProperties.prototype, "ariaLabel", 2);
|
|
3435
|
-
__decorateClass$
|
|
3437
|
+
__decorateClass$u([attr({
|
|
3436
3438
|
attribute: "aria-labelledby"
|
|
3437
3439
|
})], ARIAGlobalStatesAndProperties.prototype, "ariaLabelledby", 2);
|
|
3438
|
-
__decorateClass$
|
|
3440
|
+
__decorateClass$u([attr({
|
|
3439
3441
|
attribute: "aria-live"
|
|
3440
3442
|
})], ARIAGlobalStatesAndProperties.prototype, "ariaLive", 2);
|
|
3441
|
-
__decorateClass$
|
|
3443
|
+
__decorateClass$u([attr({
|
|
3442
3444
|
attribute: "aria-owns"
|
|
3443
3445
|
})], ARIAGlobalStatesAndProperties.prototype, "ariaOwns", 2);
|
|
3444
|
-
__decorateClass$
|
|
3446
|
+
__decorateClass$u([attr({
|
|
3445
3447
|
attribute: "aria-relevant"
|
|
3446
3448
|
})], ARIAGlobalStatesAndProperties.prototype, "ariaRelevant", 2);
|
|
3447
|
-
__decorateClass$
|
|
3449
|
+
__decorateClass$u([attr({
|
|
3448
3450
|
attribute: "aria-roledescription"
|
|
3449
3451
|
})], ARIAGlobalStatesAndProperties.prototype, "ariaRoledescription", 2);
|
|
3450
3452
|
|
|
@@ -3613,54 +3615,159 @@ function applyMixins(derivedCtor, ...baseCtors) {
|
|
|
3613
3615
|
});
|
|
3614
3616
|
}
|
|
3615
3617
|
|
|
3616
|
-
|
|
3617
|
-
|
|
3618
|
-
|
|
3619
|
-
|
|
3618
|
+
const CustomStatesSetSupported = CSS.supports("selector(:state(g))");
|
|
3619
|
+
function toggleState(elementInternals, state, force) {
|
|
3620
|
+
if (!CustomStatesSetSupported) {
|
|
3621
|
+
elementInternals.shadowRoot.host.toggleAttribute(`state--${state}`, force);
|
|
3622
|
+
return;
|
|
3623
|
+
}
|
|
3624
|
+
force = force ?? !elementInternals.states.has(state);
|
|
3625
|
+
if (force) {
|
|
3626
|
+
elementInternals.states.add(state);
|
|
3627
|
+
return;
|
|
3628
|
+
}
|
|
3629
|
+
elementInternals.states.delete(state);
|
|
3630
|
+
}
|
|
3631
|
+
|
|
3632
|
+
var __defProp$t = Object.defineProperty;
|
|
3633
|
+
var __getOwnPropDesc$t = Object.getOwnPropertyDescriptor;
|
|
3634
|
+
var __decorateClass$t = (decorators, target, key, kind) => {
|
|
3635
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$t(target, key) : target;
|
|
3620
3636
|
for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
3621
|
-
if (kind && result) __defProp$
|
|
3637
|
+
if (kind && result) __defProp$t(target, key, result);
|
|
3622
3638
|
return result;
|
|
3623
3639
|
};
|
|
3624
3640
|
class AccordionItem extends FASTElement {
|
|
3625
3641
|
constructor() {
|
|
3626
3642
|
super(...arguments);
|
|
3643
|
+
/**
|
|
3644
|
+
* The internal {@link https://developer.mozilla.org/docs/Web/API/ElementInternals | `ElementInternals`} instance for the component.
|
|
3645
|
+
*
|
|
3646
|
+
* @internal
|
|
3647
|
+
*/
|
|
3648
|
+
this.elementInternals = this.attachInternals();
|
|
3627
3649
|
this.headinglevel = 2;
|
|
3628
3650
|
this.expanded = false;
|
|
3629
3651
|
this.disabled = false;
|
|
3630
3652
|
this.id = uniqueId("accordion-");
|
|
3631
3653
|
this.block = false;
|
|
3632
|
-
|
|
3633
|
-
|
|
3634
|
-
|
|
3635
|
-
|
|
3636
|
-
|
|
3637
|
-
|
|
3638
|
-
|
|
3639
|
-
|
|
3640
|
-
|
|
3654
|
+
}
|
|
3655
|
+
/**
|
|
3656
|
+
* Handles expanded changes
|
|
3657
|
+
* @param prev - previous value
|
|
3658
|
+
* @param next - next value
|
|
3659
|
+
*/
|
|
3660
|
+
expandedChanged(prev, next) {
|
|
3661
|
+
toggleState(this.elementInternals, "expanded", next);
|
|
3662
|
+
}
|
|
3663
|
+
/**
|
|
3664
|
+
* Handles disabled changes
|
|
3665
|
+
* @param prev - previous value
|
|
3666
|
+
* @param next - next value
|
|
3667
|
+
*/
|
|
3668
|
+
disabledChanged(prev, next) {
|
|
3669
|
+
toggleState(this.elementInternals, "disabled", next);
|
|
3670
|
+
}
|
|
3671
|
+
/**
|
|
3672
|
+
* Handles changes to size attribute
|
|
3673
|
+
* @param prev - previous value
|
|
3674
|
+
* @param next - next value
|
|
3675
|
+
*/
|
|
3676
|
+
sizeChanged(prev, next) {
|
|
3677
|
+
if (prev) {
|
|
3678
|
+
toggleState(this.elementInternals, prev, false);
|
|
3679
|
+
}
|
|
3680
|
+
if (next) {
|
|
3681
|
+
toggleState(this.elementInternals, next, true);
|
|
3682
|
+
}
|
|
3683
|
+
}
|
|
3684
|
+
/**
|
|
3685
|
+
* Handles changes to block attribute
|
|
3686
|
+
* @param prev - previous value
|
|
3687
|
+
* @param next - next value
|
|
3688
|
+
*/
|
|
3689
|
+
blockChanged(prev, next) {
|
|
3690
|
+
toggleState(this.elementInternals, "block", next);
|
|
3691
|
+
}
|
|
3692
|
+
/**
|
|
3693
|
+
* Handles changes to marker-position attribute
|
|
3694
|
+
* @param prev - previous value
|
|
3695
|
+
* @param next - next value
|
|
3696
|
+
*/
|
|
3697
|
+
markerPositionChanged(prev, next) {
|
|
3698
|
+
if (prev) {
|
|
3699
|
+
toggleState(this.elementInternals, `align-${prev}`, false);
|
|
3700
|
+
}
|
|
3701
|
+
if (next) {
|
|
3702
|
+
toggleState(this.elementInternals, `align-${next}`, true);
|
|
3703
|
+
}
|
|
3641
3704
|
}
|
|
3642
3705
|
}
|
|
3643
|
-
__decorateClass$
|
|
3706
|
+
__decorateClass$t([attr({
|
|
3644
3707
|
attribute: "heading-level",
|
|
3645
3708
|
mode: "fromView",
|
|
3646
3709
|
converter: nullableNumberConverter
|
|
3647
3710
|
})], AccordionItem.prototype, "headinglevel", 2);
|
|
3648
|
-
__decorateClass$
|
|
3711
|
+
__decorateClass$t([attr({
|
|
3649
3712
|
mode: "boolean"
|
|
3650
3713
|
})], AccordionItem.prototype, "expanded", 2);
|
|
3651
|
-
__decorateClass$
|
|
3714
|
+
__decorateClass$t([attr({
|
|
3652
3715
|
mode: "boolean"
|
|
3653
3716
|
})], AccordionItem.prototype, "disabled", 2);
|
|
3654
|
-
__decorateClass$
|
|
3655
|
-
__decorateClass$
|
|
3656
|
-
__decorateClass$
|
|
3717
|
+
__decorateClass$t([attr], AccordionItem.prototype, "id", 2);
|
|
3718
|
+
__decorateClass$t([attr], AccordionItem.prototype, "size", 2);
|
|
3719
|
+
__decorateClass$t([attr({
|
|
3657
3720
|
mode: "boolean"
|
|
3658
3721
|
})], AccordionItem.prototype, "block", 2);
|
|
3659
|
-
__decorateClass$
|
|
3660
|
-
attribute: "
|
|
3661
|
-
})], AccordionItem.prototype, "
|
|
3722
|
+
__decorateClass$t([attr({
|
|
3723
|
+
attribute: "marker-position"
|
|
3724
|
+
})], AccordionItem.prototype, "markerPosition", 2);
|
|
3662
3725
|
applyMixins(AccordionItem, StartEnd);
|
|
3663
3726
|
|
|
3727
|
+
const checkedState = css.partial`:is([state--checked], :state(checked))`;
|
|
3728
|
+
const disabledState = css.partial`:is([state--disabled], :state(disabled))`;
|
|
3729
|
+
const filledLighterState = css.partial`:is([state--filled-lighter], :state(filled-lighter))`;
|
|
3730
|
+
const filledDarkerState = css.partial`:is([state--filled-darker], :state(filled-darker))`;
|
|
3731
|
+
const ghostState = css.partial`:is([state--ghost], :state(ghost))`;
|
|
3732
|
+
const invertedState = css.partial`:is([state--inverted], :state(inverted))`;
|
|
3733
|
+
const primaryState = css.partial`:is([state--primary], :state(primary))`;
|
|
3734
|
+
const outlineState = css.partial`:is([state--outline], :state(outline))`;
|
|
3735
|
+
const strongState = css.partial`:is([state--strong], :state(strong))`;
|
|
3736
|
+
const subtleState = css.partial`:is([state--subtle], :state(subtle))`;
|
|
3737
|
+
const tintState = css.partial`:is([state--tint], :state(tint))`;
|
|
3738
|
+
const underlineState$1 = css.partial`:is([state--underline], :state(underline))`;
|
|
3739
|
+
const transparentState = css.partial`:is([state--transparent], :state(transparent))`;
|
|
3740
|
+
const circularState = css.partial`:is([state--circular], :state(circular))`;
|
|
3741
|
+
const roundedState = css.partial`:is([state--rounded], :state(rounded))`;
|
|
3742
|
+
const squareState = css.partial`:is([state--square], :state(square))`;
|
|
3743
|
+
const tinyState = css.partial`:is([state--tiny], :state(tiny))`;
|
|
3744
|
+
const extraSmallState = css.partial`:is([state--extra-small], :state(extra-small))`;
|
|
3745
|
+
const smallState = css.partial`:is([state--small], :state(small))`;
|
|
3746
|
+
const largeState = css.partial`:is([state--large], :state(large))`;
|
|
3747
|
+
const extraLargeState = css.partial`:is([state--extra-large], :state(extra-large))`;
|
|
3748
|
+
const hugeState = css.partial`:is([state--huge], :state(huge))`;
|
|
3749
|
+
const alignStartState = css.partial`:is([state--align-start], :state(align-start))`;
|
|
3750
|
+
const alignEndState = css.partial`:is([state--align-end], :state(align-end))`;
|
|
3751
|
+
const insetState = css.partial`:is([state--inset], :state(inset))`;
|
|
3752
|
+
const iconOnlyState = css.partial`:is([state--icon], :state(icon))`;
|
|
3753
|
+
const pressedState = css.partial`:is([state--pressed], :state(pressed))`;
|
|
3754
|
+
const brandState = css.partial`:is([state--brand], :state(brand))`;
|
|
3755
|
+
const errorState = css.partial`:is([state--error], :state(error))`;
|
|
3756
|
+
const dangerState = css.partial`:is([state--danger], :state(danger))`;
|
|
3757
|
+
const importantState = css.partial`:is([state--important], :state(important))`;
|
|
3758
|
+
const informativeState = css.partial`:is([state--informative], :state(informative))`;
|
|
3759
|
+
css.partial`:is([state--marigold], :state(marigold))`;
|
|
3760
|
+
const neutralState = css.partial`:is([state--neutral], :state(neutral))`;
|
|
3761
|
+
const severeState = css.partial`:is([state--severe], :state(severe))`;
|
|
3762
|
+
const successState = css.partial`:is([state--success], :state(success))`;
|
|
3763
|
+
const warningState = css.partial`:is([state--warning], :state(warning))`;
|
|
3764
|
+
const verticalState = css.partial`:is([state--vertical], :state(vertical))`;
|
|
3765
|
+
css.partial`:is([state--horizontal], :state(horizontal))`;
|
|
3766
|
+
css.partial`:is([state--singleline], :state(singleline))`;
|
|
3767
|
+
const multiLineState = css.partial`:is([state--multiline], :state(multiline))`;
|
|
3768
|
+
const expandedState = css.partial`:is([state--expanded], :state(expanded))`;
|
|
3769
|
+
const blockState = css.partial`:is([state--block], :state(block))`;
|
|
3770
|
+
|
|
3664
3771
|
const colorNeutralForeground1 = "var(--colorNeutralForeground1)";
|
|
3665
3772
|
const colorNeutralForeground1Hover = "var(--colorNeutralForeground1Hover)";
|
|
3666
3773
|
const colorNeutralForeground1Pressed = "var(--colorNeutralForeground1Pressed)";
|
|
@@ -3682,7 +3789,6 @@ const colorBrandForegroundLinkPressed = "var(--colorBrandForegroundLinkPressed)"
|
|
|
3682
3789
|
const colorNeutralForeground2Link = "var(--colorNeutralForeground2Link)";
|
|
3683
3790
|
const colorNeutralForeground2LinkHover = "var(--colorNeutralForeground2LinkHover)";
|
|
3684
3791
|
const colorNeutralForeground2LinkPressed = "var(--colorNeutralForeground2LinkPressed)";
|
|
3685
|
-
const colorCompoundBrandForeground1 = "var(--colorCompoundBrandForeground1)";
|
|
3686
3792
|
const colorCompoundBrandForeground1Hover = "var(--colorCompoundBrandForeground1Hover)";
|
|
3687
3793
|
const colorCompoundBrandForeground1Pressed = "var(--colorCompoundBrandForeground1Pressed)";
|
|
3688
3794
|
const colorNeutralForegroundOnBrand = "var(--colorNeutralForegroundOnBrand)";
|
|
@@ -3879,6 +3985,7 @@ const spacingVerticalXS = "var(--spacingVerticalXS)";
|
|
|
3879
3985
|
const spacingVerticalSNudge = "var(--spacingVerticalSNudge)";
|
|
3880
3986
|
const spacingVerticalS = "var(--spacingVerticalS)";
|
|
3881
3987
|
const spacingVerticalMNudge = "var(--spacingVerticalMNudge)";
|
|
3988
|
+
const spacingVerticalM = "var(--spacingVerticalM)";
|
|
3882
3989
|
const spacingVerticalL = "var(--spacingVerticalL)";
|
|
3883
3990
|
const spacingVerticalXXL = "var(--spacingVerticalXXL)";
|
|
3884
3991
|
const durationUltraFast = "var(--durationUltraFast)";
|
|
@@ -3901,7 +4008,7 @@ const curveLinear = "var(--curveLinear)";
|
|
|
3901
4008
|
const styles$x = css`
|
|
3902
4009
|
${display("block")}
|
|
3903
4010
|
|
|
3904
|
-
:host{max-width:fit-content;contain:content}.heading{height:44px;display:grid;position:relative;
|
|
4011
|
+
:host{max-width:fit-content;contain:content}.heading{height:44px;display:grid;position:relative;padding-inline:${spacingHorizontalM} ${spacingHorizontalMNudge};border-radius:${borderRadiusMedium};font-family:${fontFamilyBase};font-size:${fontSizeBase300};font-weight:${fontWeightRegular};line-height:${lineHeightBase300};grid-template-columns:auto auto 1fr auto}.button{appearance:none;background:${colorTransparentBackground};border:none;box-sizing:border-box;color:${colorNeutralForeground1};cursor:pointer;font:inherit;grid-column:auto / span 2;grid-row:1;height:44px;outline:none;padding:0;text-align:start}.button::before{content:'';position:absolute;inset:0px;cursor:pointer;border-radius:${borderRadiusSmall}}:where(.default-marker-collapsed,.default-marker-expanded),::slotted(:is([slot='marker-collapsed'],[slot='marker-expanded'])){display:flex;align-items:center;justify-content:center;pointer-events:none;position:relative;height:100%;padding-inline-end:${spacingHorizontalS};grid-column:1 / span 1;grid-row:1}.content{margin:0 ${spacingHorizontalM}}::slotted([slot='start']){display:flex;justify-content:center;align-items:center;padding-right:${spacingHorizontalS};grid-column:2 / span 1;grid-row:1}button:focus-visible::after{content:'';position:absolute;inset:0px;cursor:pointer;border-radius:${borderRadiusSmall};outline:none;border:2px solid ${colorStrokeFocus1};box-shadow:inset 0 0 0 1px ${colorStrokeFocus2}}:host(${disabledState}) .button{color:${colorNeutralForegroundDisabled}}:host(${disabledState}) svg{filter:invert(89%) sepia(0%) saturate(569%) hue-rotate(155deg) brightness(88%) contrast(87%)}:host(${expandedState}) .content{display:block}:host(${expandedState}) .default-marker-collapsed,:host(${expandedState}) ::slotted([slot='marker-collapsed']),:host(:not(${expandedState})) :is(.default-marker-expanded,.content),:host(:not(${expandedState})) ::slotted([slot='marker-expanded']){display:none}:host(${expandedState}) ::slotted([slot='marker-expanded']),:host(:not(${expandedState})) ::slotted([slot='marker-collapsed']){display:flex}.heading{font-size:${fontSizeBase300};line-height:${lineHeightBase300}}:host(${smallState}) .heading{font-size:${fontSizeBase200};line-height:${lineHeightBase200}}:host(${largeState}) .heading{font-size:${fontSizeBase400};line-height:${lineHeightBase400}}:host(${extraLargeState}) .heading{font-size:${fontSizeBase500};line-height:${lineHeightBase500}}:host(${alignEndState}) :slotted([slot='start']){grid-column:1 / span 1}:host(${alignEndState}) :is(.default-marker-collapsed,.default-marker-expanded){grid-column:4 / span 1;padding-inline-start:${spacingHorizontalS};padding-inline-end:0}:host(${alignEndState}) .button{grid-column:2 / span 3}:host([block]){max-width:100%}:host(${alignEndState}) .heading{grid-template-columns:auto auto 28px;padding-inline:${spacingHorizontalM}}:host(${alignEndState}:has([slot='start'])) .heading{padding-inline:${spacingHorizontalMNudge} ${spacingHorizontalM}}:host(${blockState}${alignEndState}) .heading{grid-template-columns:auto 1fr}:host(${alignEndState}) :is(.default-marker-collapsed,.default-marker-expanded){grid-column:5 / span 1}`;
|
|
3905
4012
|
|
|
3906
4013
|
const chevronRight20Filled = html.partial(`<svg
|
|
3907
4014
|
width="20"
|
|
@@ -3909,7 +4016,8 @@ const chevronRight20Filled = html.partial(`<svg
|
|
|
3909
4016
|
viewBox="0 0 20 20"
|
|
3910
4017
|
fill="none"
|
|
3911
4018
|
xmlns="http://www.w3.org/2000/svg"
|
|
3912
|
-
class="default-collapsed
|
|
4019
|
+
class="default-marker-collapsed"
|
|
4020
|
+
aria-hidden="true"
|
|
3913
4021
|
>
|
|
3914
4022
|
<path
|
|
3915
4023
|
d="M7.73271 4.20694C8.03263 3.92125 8.50737 3.93279 8.79306 4.23271L13.7944 9.48318C14.0703 9.77285 14.0703 10.2281 13.7944 10.5178L8.79306 15.7682C8.50737 16.0681 8.03263 16.0797 7.73271 15.794C7.43279 15.5083 7.42125 15.0336 7.70694 14.7336L12.2155 10.0005L7.70694 5.26729C7.42125 4.96737 7.43279 4.49264 7.73271 4.20694Z"
|
|
@@ -3922,7 +4030,8 @@ const chevronDown20Filled = html.partial(`<svg
|
|
|
3922
4030
|
viewBox="0 0 20 20"
|
|
3923
4031
|
fill="none"
|
|
3924
4032
|
xmlns="http://www.w3.org/2000/svg"
|
|
3925
|
-
class="default-expanded
|
|
4033
|
+
class="default-marker-expanded"
|
|
4034
|
+
aria-hidden="true"
|
|
3926
4035
|
>
|
|
3927
4036
|
<path
|
|
3928
4037
|
d="M15.794 7.73271C16.0797 8.03263 16.0681 8.50737 15.7682 8.79306L10.5178 13.7944C10.2281 14.0703 9.77285 14.0703 9.48318 13.7944L4.23271 8.79306C3.93279 8.50737 3.92125 8.03263 4.20694 7.73271C4.49264 7.43279 4.96737 7.42125 5.26729 7.70694L10.0005 12.2155L14.7336 7.70694C15.0336 7.42125 15.5083 7.43279 15.794 7.73271Z"
|
|
@@ -3930,7 +4039,7 @@ const chevronDown20Filled = html.partial(`<svg
|
|
|
3930
4039
|
/>
|
|
3931
4040
|
</svg>`);
|
|
3932
4041
|
function accordionItemTemplate(options = {}) {
|
|
3933
|
-
return html`<div class="heading" part="heading" role="heading" aria-level="${x => x.headinglevel}"><button class="button" part="button" ${ref("expandbutton")} ?disabled="${x => x.disabled ? "true" : void 0}" aria-expanded="${x => x.expanded}" aria-controls="${x => x.id}-panel" id="${x => x.id}"
|
|
4042
|
+
return html`<div class="heading" part="heading" role="heading" aria-level="${x => x.headinglevel}"><button class="button" part="button" ${ref("expandbutton")} ?disabled="${x => x.disabled ? "true" : void 0}" aria-expanded="${x => x.expanded}" aria-controls="${x => x.id}-panel" id="${x => x.id}"><slot name="heading"></slot></button>${startSlotTemplate(options)}<slot name="marker-expanded">${staticallyCompose(options.expandedIcon)}</slot><slot name="marker-collapsed">${staticallyCompose(options.collapsedIcon)}</slot></div><div class="content" part="content" id="${x => x.id}-panel" role="region" aria-labelledby="${x => x.id}"><slot></slot></div>`;
|
|
3934
4043
|
}
|
|
3935
4044
|
const template$y = accordionItemTemplate({
|
|
3936
4045
|
collapsedIcon: chevronRight20Filled,
|
|
@@ -3950,12 +4059,12 @@ const AccordionExpandMode = {
|
|
|
3950
4059
|
multi: "multi"
|
|
3951
4060
|
};
|
|
3952
4061
|
|
|
3953
|
-
var __defProp$
|
|
3954
|
-
var __getOwnPropDesc$
|
|
3955
|
-
var __decorateClass$
|
|
3956
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
4062
|
+
var __defProp$s = Object.defineProperty;
|
|
4063
|
+
var __getOwnPropDesc$s = Object.getOwnPropertyDescriptor;
|
|
4064
|
+
var __decorateClass$s = (decorators, target, key, kind) => {
|
|
4065
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$s(target, key) : target;
|
|
3957
4066
|
for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
3958
|
-
if (kind && result) __defProp$
|
|
4067
|
+
if (kind && result) __defProp$s(target, key, result);
|
|
3959
4068
|
return result;
|
|
3960
4069
|
};
|
|
3961
4070
|
class Accordion extends FASTElement {
|
|
@@ -3963,9 +4072,11 @@ class Accordion extends FASTElement {
|
|
|
3963
4072
|
super(...arguments);
|
|
3964
4073
|
this.expandmode = AccordionExpandMode.multi;
|
|
3965
4074
|
this.activeItemIndex = 0;
|
|
3966
|
-
|
|
3967
|
-
|
|
3968
|
-
|
|
4075
|
+
/**
|
|
4076
|
+
* Resets event listeners and sets the `accordionItems` property
|
|
4077
|
+
* then rebinds event listeners to each non-disabled item
|
|
4078
|
+
* @returns {void}
|
|
4079
|
+
*/
|
|
3969
4080
|
this.setItems = () => {
|
|
3970
4081
|
if (this.slottedAccordionItems.length === 0) {
|
|
3971
4082
|
return;
|
|
@@ -3974,83 +4085,43 @@ class Accordion extends FASTElement {
|
|
|
3974
4085
|
this.removeItemListeners(children);
|
|
3975
4086
|
children.forEach(child => Observable.getNotifier(child).subscribe(this, "disabled"));
|
|
3976
4087
|
this.accordionItems = children.filter(child => !child.hasAttribute("disabled"));
|
|
3977
|
-
this.accordionIds = this.getItemIds();
|
|
3978
4088
|
this.accordionItems.forEach((item, index) => {
|
|
3979
4089
|
if (item instanceof AccordionItem) {
|
|
3980
|
-
item.addEventListener("click", this.
|
|
3981
|
-
item.addEventListener("keydown", this.handleItemKeyDown);
|
|
3982
|
-
item.addEventListener("focus", this.handleItemFocus);
|
|
4090
|
+
item.addEventListener("click", this.expandedChangedHandler);
|
|
3983
4091
|
Observable.getNotifier(item).subscribe(this, "expanded");
|
|
3984
4092
|
}
|
|
3985
|
-
const itemId = this.accordionIds[index];
|
|
3986
|
-
item.setAttribute("id", typeof itemId !== "string" ? `accordion-${index + 1}` : itemId);
|
|
3987
|
-
this.activeid = this.accordionIds[this.activeItemIndex];
|
|
3988
4093
|
});
|
|
3989
4094
|
if (this.isSingleExpandMode()) {
|
|
3990
4095
|
const expandedItem = this.findExpandedItem();
|
|
3991
4096
|
this.setSingleExpandMode(expandedItem);
|
|
3992
4097
|
}
|
|
3993
4098
|
};
|
|
4099
|
+
/**
|
|
4100
|
+
* Removes event listeners from the previous accordion items
|
|
4101
|
+
* @param oldValue An array of the previous accordion items
|
|
4102
|
+
*/
|
|
3994
4103
|
this.removeItemListeners = oldValue => {
|
|
3995
4104
|
oldValue.forEach((item, index) => {
|
|
3996
4105
|
Observable.getNotifier(item).unsubscribe(this, "disabled");
|
|
3997
4106
|
Observable.getNotifier(item).unsubscribe(this, "expanded");
|
|
3998
|
-
item.removeEventListener("click", this.
|
|
3999
|
-
item.removeEventListener("keydown", this.handleItemKeyDown);
|
|
4000
|
-
item.removeEventListener("focus", this.handleItemFocus);
|
|
4107
|
+
item.removeEventListener("click", this.expandedChangedHandler);
|
|
4001
4108
|
});
|
|
4002
4109
|
};
|
|
4003
|
-
|
|
4004
|
-
|
|
4005
|
-
|
|
4006
|
-
|
|
4007
|
-
|
|
4008
|
-
|
|
4009
|
-
|
|
4010
|
-
this.handleExpandedChange = item => {
|
|
4110
|
+
/**
|
|
4111
|
+
* Changes the expanded state of the accordion item
|
|
4112
|
+
* @param evt Click event
|
|
4113
|
+
* @returns
|
|
4114
|
+
*/
|
|
4115
|
+
this.expandedChangedHandler = evt => {
|
|
4116
|
+
const item = evt.target;
|
|
4011
4117
|
if (item instanceof AccordionItem) {
|
|
4012
|
-
this.activeid = item.getAttribute("id");
|
|
4013
4118
|
if (!this.isSingleExpandMode()) {
|
|
4014
4119
|
item.expanded = !item.expanded;
|
|
4015
4120
|
this.activeItemIndex = this.accordionItems.indexOf(item);
|
|
4016
4121
|
} else {
|
|
4017
4122
|
this.setSingleExpandMode(item);
|
|
4018
4123
|
}
|
|
4019
|
-
this
|
|
4020
|
-
}
|
|
4021
|
-
};
|
|
4022
|
-
this.handleItemKeyDown = event => {
|
|
4023
|
-
if (event.target !== event.currentTarget) {
|
|
4024
|
-
return;
|
|
4025
|
-
}
|
|
4026
|
-
this.accordionIds = this.getItemIds();
|
|
4027
|
-
switch (event.key) {
|
|
4028
|
-
case keyArrowUp:
|
|
4029
|
-
event.preventDefault();
|
|
4030
|
-
this.adjust(-1);
|
|
4031
|
-
break;
|
|
4032
|
-
case keyArrowDown:
|
|
4033
|
-
event.preventDefault();
|
|
4034
|
-
this.adjust(1);
|
|
4035
|
-
break;
|
|
4036
|
-
case keyHome:
|
|
4037
|
-
this.activeItemIndex = 0;
|
|
4038
|
-
this.focusItem();
|
|
4039
|
-
break;
|
|
4040
|
-
case keyEnd:
|
|
4041
|
-
this.activeItemIndex = this.accordionItems.length - 1;
|
|
4042
|
-
this.focusItem();
|
|
4043
|
-
break;
|
|
4044
|
-
}
|
|
4045
|
-
};
|
|
4046
|
-
this.handleItemFocus = event => {
|
|
4047
|
-
if (event.target === event.currentTarget) {
|
|
4048
|
-
const focusedItem = event.target;
|
|
4049
|
-
const focusedIndex = this.activeItemIndex = Array.from(this.accordionItems).indexOf(focusedItem);
|
|
4050
|
-
if (this.activeItemIndex !== focusedIndex && focusedIndex !== -1) {
|
|
4051
|
-
this.activeItemIndex = focusedIndex;
|
|
4052
|
-
this.activeid = this.accordionIds[this.activeItemIndex];
|
|
4053
|
-
}
|
|
4124
|
+
this.$emit("change");
|
|
4054
4125
|
}
|
|
4055
4126
|
};
|
|
4056
4127
|
}
|
|
@@ -4062,11 +4133,11 @@ class Accordion extends FASTElement {
|
|
|
4062
4133
|
if (!expandedItem) {
|
|
4063
4134
|
return;
|
|
4064
4135
|
}
|
|
4065
|
-
if (next
|
|
4066
|
-
expandedItem?.expandbutton.removeAttribute("aria-disabled");
|
|
4067
|
-
} else {
|
|
4136
|
+
if (next === AccordionExpandMode.single) {
|
|
4068
4137
|
this.setSingleExpandMode(expandedItem);
|
|
4138
|
+
return;
|
|
4069
4139
|
}
|
|
4140
|
+
expandedItem?.expandbutton.removeAttribute("aria-disabled");
|
|
4070
4141
|
}
|
|
4071
4142
|
/**
|
|
4072
4143
|
* @internal
|
|
@@ -4077,6 +4148,7 @@ class Accordion extends FASTElement {
|
|
|
4077
4148
|
}
|
|
4078
4149
|
}
|
|
4079
4150
|
/**
|
|
4151
|
+
* Watch for changes to the slotted accordion items `disabled` and `expanded` attributes
|
|
4080
4152
|
* @internal
|
|
4081
4153
|
*/
|
|
4082
4154
|
handleChange(source, propertyName) {
|
|
@@ -4088,12 +4160,28 @@ class Accordion extends FASTElement {
|
|
|
4088
4160
|
}
|
|
4089
4161
|
}
|
|
4090
4162
|
}
|
|
4163
|
+
/**
|
|
4164
|
+
* Find the first expanded item in the accordion
|
|
4165
|
+
* @returns {void}
|
|
4166
|
+
*/
|
|
4091
4167
|
findExpandedItem() {
|
|
4092
4168
|
if (this.accordionItems.length === 0) {
|
|
4093
4169
|
return null;
|
|
4094
4170
|
}
|
|
4095
4171
|
return this.accordionItems.find(item => item instanceof AccordionItem && item.expanded) ?? this.accordionItems[0];
|
|
4096
4172
|
}
|
|
4173
|
+
/**
|
|
4174
|
+
* Checks if the accordion is in single expand mode
|
|
4175
|
+
* @returns {boolean}
|
|
4176
|
+
*/
|
|
4177
|
+
isSingleExpandMode() {
|
|
4178
|
+
return this.expandmode === AccordionExpandMode.single;
|
|
4179
|
+
}
|
|
4180
|
+
/**
|
|
4181
|
+
* Controls the behavior of the accordion in single expand mode
|
|
4182
|
+
* @param expandedItem The item to expand in single expand mode
|
|
4183
|
+
* @returns {void}
|
|
4184
|
+
*/
|
|
4097
4185
|
setSingleExpandMode(expandedItem) {
|
|
4098
4186
|
if (this.accordionItems.length === 0) {
|
|
4099
4187
|
return;
|
|
@@ -4114,29 +4202,11 @@ class Accordion extends FASTElement {
|
|
|
4114
4202
|
}
|
|
4115
4203
|
});
|
|
4116
4204
|
}
|
|
4117
|
-
getItemIds() {
|
|
4118
|
-
return this.slottedAccordionItems.map(accordionItem => {
|
|
4119
|
-
return accordionItem.id;
|
|
4120
|
-
});
|
|
4121
|
-
}
|
|
4122
|
-
isSingleExpandMode() {
|
|
4123
|
-
return this.expandmode === AccordionExpandMode.single;
|
|
4124
|
-
}
|
|
4125
|
-
adjust(adjustment) {
|
|
4126
|
-
this.activeItemIndex = wrapInBounds(0, this.accordionItems.length - 1, this.activeItemIndex + adjustment);
|
|
4127
|
-
this.focusItem();
|
|
4128
|
-
}
|
|
4129
|
-
focusItem() {
|
|
4130
|
-
const element = this.accordionItems[this.activeItemIndex];
|
|
4131
|
-
if (element instanceof AccordionItem) {
|
|
4132
|
-
element.expandbutton.focus();
|
|
4133
|
-
}
|
|
4134
|
-
}
|
|
4135
4205
|
}
|
|
4136
|
-
__decorateClass$
|
|
4206
|
+
__decorateClass$s([attr({
|
|
4137
4207
|
attribute: "expand-mode"
|
|
4138
4208
|
})], Accordion.prototype, "expandmode", 2);
|
|
4139
|
-
__decorateClass$
|
|
4209
|
+
__decorateClass$s([observable], Accordion.prototype, "slottedAccordionItems", 2);
|
|
4140
4210
|
|
|
4141
4211
|
const styles$w = css`
|
|
4142
4212
|
${display("flex")}
|
|
@@ -4159,20 +4229,6 @@ const definition$x = Accordion.compose({
|
|
|
4159
4229
|
|
|
4160
4230
|
definition$x.define(FluentDesignSystem.registry);
|
|
4161
4231
|
|
|
4162
|
-
const CustomStatesSetSupported = CSS.supports("selector(:state(g))");
|
|
4163
|
-
function toggleState(elementInternals, state, force) {
|
|
4164
|
-
if (!CustomStatesSetSupported) {
|
|
4165
|
-
elementInternals.shadowRoot.host.toggleAttribute(`state--${state}`, force);
|
|
4166
|
-
return;
|
|
4167
|
-
}
|
|
4168
|
-
force = force ?? !elementInternals.states.has(state);
|
|
4169
|
-
if (force) {
|
|
4170
|
-
elementInternals.states.add(state);
|
|
4171
|
-
return;
|
|
4172
|
-
}
|
|
4173
|
-
elementInternals.states.delete(state);
|
|
4174
|
-
}
|
|
4175
|
-
|
|
4176
4232
|
const ButtonType = {
|
|
4177
4233
|
submit: "submit",
|
|
4178
4234
|
reset: "reset",
|
|
@@ -4190,12 +4246,12 @@ const AnchorAttributes = {
|
|
|
4190
4246
|
type: "type"
|
|
4191
4247
|
};
|
|
4192
4248
|
|
|
4193
|
-
var __defProp$
|
|
4194
|
-
var __getOwnPropDesc$
|
|
4195
|
-
var __decorateClass$
|
|
4196
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
4249
|
+
var __defProp$r = Object.defineProperty;
|
|
4250
|
+
var __getOwnPropDesc$r = Object.getOwnPropertyDescriptor;
|
|
4251
|
+
var __decorateClass$r = (decorators, target, key, kind) => {
|
|
4252
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$r(target, key) : target;
|
|
4197
4253
|
for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
4198
|
-
if (kind && result) __defProp$
|
|
4254
|
+
if (kind && result) __defProp$r(target, key, result);
|
|
4199
4255
|
return result;
|
|
4200
4256
|
};
|
|
4201
4257
|
class BaseAnchor extends FASTElement {
|
|
@@ -4303,14 +4359,14 @@ class BaseAnchor extends FASTElement {
|
|
|
4303
4359
|
return proxy;
|
|
4304
4360
|
}
|
|
4305
4361
|
}
|
|
4306
|
-
__decorateClass$
|
|
4307
|
-
__decorateClass$
|
|
4308
|
-
__decorateClass$
|
|
4309
|
-
__decorateClass$
|
|
4310
|
-
__decorateClass$
|
|
4311
|
-
__decorateClass$
|
|
4312
|
-
__decorateClass$
|
|
4313
|
-
__decorateClass$
|
|
4362
|
+
__decorateClass$r([attr], BaseAnchor.prototype, "download", 2);
|
|
4363
|
+
__decorateClass$r([attr], BaseAnchor.prototype, "href", 2);
|
|
4364
|
+
__decorateClass$r([attr], BaseAnchor.prototype, "hreflang", 2);
|
|
4365
|
+
__decorateClass$r([attr], BaseAnchor.prototype, "ping", 2);
|
|
4366
|
+
__decorateClass$r([attr], BaseAnchor.prototype, "referrerpolicy", 2);
|
|
4367
|
+
__decorateClass$r([attr], BaseAnchor.prototype, "rel", 2);
|
|
4368
|
+
__decorateClass$r([attr], BaseAnchor.prototype, "target", 2);
|
|
4369
|
+
__decorateClass$r([attr], BaseAnchor.prototype, "type", 2);
|
|
4314
4370
|
class AnchorButton extends BaseAnchor {
|
|
4315
4371
|
constructor() {
|
|
4316
4372
|
super(...arguments);
|
|
@@ -4364,55 +4420,15 @@ class AnchorButton extends BaseAnchor {
|
|
|
4364
4420
|
toggleState(this.elementInternals, "icon", !!next);
|
|
4365
4421
|
}
|
|
4366
4422
|
}
|
|
4367
|
-
__decorateClass$
|
|
4368
|
-
__decorateClass$
|
|
4369
|
-
__decorateClass$
|
|
4370
|
-
__decorateClass$
|
|
4423
|
+
__decorateClass$r([attr], AnchorButton.prototype, "appearance", 2);
|
|
4424
|
+
__decorateClass$r([attr], AnchorButton.prototype, "shape", 2);
|
|
4425
|
+
__decorateClass$r([attr], AnchorButton.prototype, "size", 2);
|
|
4426
|
+
__decorateClass$r([attr({
|
|
4371
4427
|
attribute: "icon-only",
|
|
4372
4428
|
mode: "boolean"
|
|
4373
4429
|
})], AnchorButton.prototype, "iconOnly", 2);
|
|
4374
4430
|
applyMixins(AnchorButton, StartEnd);
|
|
4375
4431
|
|
|
4376
|
-
const filledLighterState = css.partial`:is([state--filled-lighter], :state(filled-lighter))`;
|
|
4377
|
-
const filledDarkerState = css.partial`:is([state--filled-darker], :state(filled-darker))`;
|
|
4378
|
-
const ghostState = css.partial`:is([state--ghost], :state(ghost))`;
|
|
4379
|
-
const invertedState = css.partial`:is([state--inverted], :state(inverted))`;
|
|
4380
|
-
const primaryState = css.partial`:is([state--primary], :state(primary))`;
|
|
4381
|
-
const outlineState = css.partial`:is([state--outline], :state(outline))`;
|
|
4382
|
-
const strongState = css.partial`:is([state--strong], :state(strong))`;
|
|
4383
|
-
const subtleState = css.partial`:is([state--subtle], :state(subtle))`;
|
|
4384
|
-
const tintState = css.partial`:is([state--tint], :state(tint))`;
|
|
4385
|
-
const underlineState$1 = css.partial`:is([state--underline], :state(underline))`;
|
|
4386
|
-
const transparentState = css.partial`:is([state--transparent], :state(transparent))`;
|
|
4387
|
-
const circularState = css.partial`:is([state--circular], :state(circular))`;
|
|
4388
|
-
const roundedState = css.partial`:is([state--rounded], :state(rounded))`;
|
|
4389
|
-
const squareState = css.partial`:is([state--square], :state(square))`;
|
|
4390
|
-
const tinyState = css.partial`:is([state--tiny], :state(tiny))`;
|
|
4391
|
-
const extraSmallState = css.partial`:is([state--extra-small], :state(extra-small))`;
|
|
4392
|
-
const smallState = css.partial`:is([state--small], :state(small))`;
|
|
4393
|
-
const largeState = css.partial`:is([state--large], :state(large))`;
|
|
4394
|
-
const extraLargeState = css.partial`:is([state--extra-large], :state(extra-large))`;
|
|
4395
|
-
const hugeState = css.partial`:is([state--huge], :state(huge))`;
|
|
4396
|
-
const alignStartState = css.partial`:is([state--align-start], :state(align-start))`;
|
|
4397
|
-
const alignEndState = css.partial`:is([state--align-end], :state(align-end))`;
|
|
4398
|
-
const insetState = css.partial`:is([state--inset], :state(inset))`;
|
|
4399
|
-
const iconOnlyState = css.partial`:is([state--icon], :state(icon))`;
|
|
4400
|
-
const pressedState = css.partial`:is([state--pressed], :state(pressed))`;
|
|
4401
|
-
const brandState = css.partial`:is([state--brand], :state(brand))`;
|
|
4402
|
-
const errorState = css.partial`:is([state--error], :state(error))`;
|
|
4403
|
-
const dangerState = css.partial`:is([state--danger], :state(danger))`;
|
|
4404
|
-
const importantState = css.partial`:is([state--important], :state(important))`;
|
|
4405
|
-
const informativeState = css.partial`:is([state--informative], :state(informative))`;
|
|
4406
|
-
css.partial`:is([state--marigold], :state(marigold))`;
|
|
4407
|
-
const neutralState = css.partial`:is([state--neutral], :state(neutral))`;
|
|
4408
|
-
const severeState = css.partial`:is([state--severe], :state(severe))`;
|
|
4409
|
-
const successState = css.partial`:is([state--success], :state(success))`;
|
|
4410
|
-
const warningState = css.partial`:is([state--warning], :state(warning))`;
|
|
4411
|
-
const verticalState = css.partial`:is([state--vertical], :state(vertical))`;
|
|
4412
|
-
css.partial`:is([state--horizontal], :state(horizontal))`;
|
|
4413
|
-
css.partial`:is([state--singleline], :state(singleline))`;
|
|
4414
|
-
const multiLineState = css.partial`:is([state--multiline], :state(multiline))`;
|
|
4415
|
-
|
|
4416
4432
|
const baseButtonStyles = css`
|
|
4417
4433
|
${display("inline-flex")}
|
|
4418
4434
|
|
|
@@ -4522,12 +4538,12 @@ const AvatarColor = {
|
|
|
4522
4538
|
...AvatarNamedColor
|
|
4523
4539
|
};
|
|
4524
4540
|
|
|
4525
|
-
var __defProp$
|
|
4526
|
-
var __getOwnPropDesc$
|
|
4527
|
-
var __decorateClass$
|
|
4528
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
4541
|
+
var __defProp$q = Object.defineProperty;
|
|
4542
|
+
var __getOwnPropDesc$q = Object.getOwnPropertyDescriptor;
|
|
4543
|
+
var __decorateClass$q = (decorators, target, key, kind) => {
|
|
4544
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$q(target, key) : target;
|
|
4529
4545
|
for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
4530
|
-
if (kind && result) __defProp$
|
|
4546
|
+
if (kind && result) __defProp$q(target, key, result);
|
|
4531
4547
|
return result;
|
|
4532
4548
|
};
|
|
4533
4549
|
const _Avatar = class _Avatar extends FASTElement {
|
|
@@ -4593,16 +4609,16 @@ const _Avatar = class _Avatar extends FASTElement {
|
|
|
4593
4609
|
* An array of the available Avatar named colors
|
|
4594
4610
|
*/
|
|
4595
4611
|
_Avatar.colors = Object.values(AvatarNamedColor);
|
|
4596
|
-
__decorateClass$
|
|
4597
|
-
__decorateClass$
|
|
4598
|
-
__decorateClass$
|
|
4612
|
+
__decorateClass$q([attr], _Avatar.prototype, "name", 2);
|
|
4613
|
+
__decorateClass$q([attr], _Avatar.prototype, "initials", 2);
|
|
4614
|
+
__decorateClass$q([attr({
|
|
4599
4615
|
converter: nullableNumberConverter
|
|
4600
4616
|
})], _Avatar.prototype, "size", 2);
|
|
4601
|
-
__decorateClass$
|
|
4602
|
-
__decorateClass$
|
|
4603
|
-
__decorateClass$
|
|
4604
|
-
__decorateClass$
|
|
4605
|
-
__decorateClass$
|
|
4617
|
+
__decorateClass$q([attr], _Avatar.prototype, "shape", 2);
|
|
4618
|
+
__decorateClass$q([attr], _Avatar.prototype, "active", 2);
|
|
4619
|
+
__decorateClass$q([attr], _Avatar.prototype, "appearance", 2);
|
|
4620
|
+
__decorateClass$q([attr], _Avatar.prototype, "color", 2);
|
|
4621
|
+
__decorateClass$q([attr({
|
|
4606
4622
|
attribute: "color-id"
|
|
4607
4623
|
})], _Avatar.prototype, "colorId", 2);
|
|
4608
4624
|
let Avatar = _Avatar;
|
|
@@ -4661,12 +4677,12 @@ const BadgeColor = {
|
|
|
4661
4677
|
warning: "warning"
|
|
4662
4678
|
};
|
|
4663
4679
|
|
|
4664
|
-
var __defProp$
|
|
4665
|
-
var __getOwnPropDesc$
|
|
4666
|
-
var __decorateClass$
|
|
4667
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
4680
|
+
var __defProp$p = Object.defineProperty;
|
|
4681
|
+
var __getOwnPropDesc$p = Object.getOwnPropertyDescriptor;
|
|
4682
|
+
var __decorateClass$p = (decorators, target, key, kind) => {
|
|
4683
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$p(target, key) : target;
|
|
4668
4684
|
for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
4669
|
-
if (kind && result) __defProp$
|
|
4685
|
+
if (kind && result) __defProp$p(target, key, result);
|
|
4670
4686
|
return result;
|
|
4671
4687
|
};
|
|
4672
4688
|
class Badge extends FASTElement {
|
|
@@ -4734,10 +4750,10 @@ class Badge extends FASTElement {
|
|
|
4734
4750
|
}
|
|
4735
4751
|
}
|
|
4736
4752
|
}
|
|
4737
|
-
__decorateClass$
|
|
4738
|
-
__decorateClass$
|
|
4739
|
-
__decorateClass$
|
|
4740
|
-
__decorateClass$
|
|
4753
|
+
__decorateClass$p([attr], Badge.prototype, "appearance", 2);
|
|
4754
|
+
__decorateClass$p([attr], Badge.prototype, "color", 2);
|
|
4755
|
+
__decorateClass$p([attr], Badge.prototype, "shape", 2);
|
|
4756
|
+
__decorateClass$p([attr], Badge.prototype, "size", 2);
|
|
4741
4757
|
applyMixins(Badge, StartEnd);
|
|
4742
4758
|
|
|
4743
4759
|
const badgeBaseStyles = css.partial`
|
|
@@ -5114,12 +5130,12 @@ const definition$u = Badge.compose({
|
|
|
5114
5130
|
|
|
5115
5131
|
definition$u.define(FluentDesignSystem.registry);
|
|
5116
5132
|
|
|
5117
|
-
var __defProp$
|
|
5118
|
-
var __getOwnPropDesc$
|
|
5119
|
-
var __decorateClass$
|
|
5120
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
5133
|
+
var __defProp$o = Object.defineProperty;
|
|
5134
|
+
var __getOwnPropDesc$o = Object.getOwnPropertyDescriptor;
|
|
5135
|
+
var __decorateClass$o = (decorators, target, key, kind) => {
|
|
5136
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$o(target, key) : target;
|
|
5121
5137
|
for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
5122
|
-
if (kind && result) __defProp$
|
|
5138
|
+
if (kind && result) __defProp$o(target, key, result);
|
|
5123
5139
|
return result;
|
|
5124
5140
|
};
|
|
5125
5141
|
class Button extends FASTElement {
|
|
@@ -5370,46 +5386,46 @@ class Button extends FASTElement {
|
|
|
5370
5386
|
* @public
|
|
5371
5387
|
*/
|
|
5372
5388
|
Button.formAssociated = true;
|
|
5373
|
-
__decorateClass$
|
|
5374
|
-
__decorateClass$
|
|
5389
|
+
__decorateClass$o([attr], Button.prototype, "appearance", 2);
|
|
5390
|
+
__decorateClass$o([attr({
|
|
5375
5391
|
mode: "boolean"
|
|
5376
5392
|
})], Button.prototype, "autofocus", 2);
|
|
5377
|
-
__decorateClass$
|
|
5378
|
-
__decorateClass$
|
|
5393
|
+
__decorateClass$o([observable], Button.prototype, "defaultSlottedContent", 2);
|
|
5394
|
+
__decorateClass$o([attr({
|
|
5379
5395
|
mode: "boolean"
|
|
5380
5396
|
})], Button.prototype, "disabled", 2);
|
|
5381
|
-
__decorateClass$
|
|
5397
|
+
__decorateClass$o([attr({
|
|
5382
5398
|
attribute: "disabled-focusable",
|
|
5383
5399
|
mode: "boolean"
|
|
5384
5400
|
})], Button.prototype, "disabledFocusable", 2);
|
|
5385
|
-
__decorateClass$
|
|
5401
|
+
__decorateClass$o([attr({
|
|
5386
5402
|
attribute: "formaction"
|
|
5387
5403
|
})], Button.prototype, "formAction", 2);
|
|
5388
|
-
__decorateClass$
|
|
5404
|
+
__decorateClass$o([attr({
|
|
5389
5405
|
attribute: "form"
|
|
5390
5406
|
})], Button.prototype, "formAttribute", 2);
|
|
5391
|
-
__decorateClass$
|
|
5407
|
+
__decorateClass$o([attr({
|
|
5392
5408
|
attribute: "formenctype"
|
|
5393
5409
|
})], Button.prototype, "formEnctype", 2);
|
|
5394
|
-
__decorateClass$
|
|
5410
|
+
__decorateClass$o([attr({
|
|
5395
5411
|
attribute: "formmethod"
|
|
5396
5412
|
})], Button.prototype, "formMethod", 2);
|
|
5397
|
-
__decorateClass$
|
|
5413
|
+
__decorateClass$o([attr({
|
|
5398
5414
|
attribute: "formnovalidate",
|
|
5399
5415
|
mode: "boolean"
|
|
5400
5416
|
})], Button.prototype, "formNoValidate", 2);
|
|
5401
|
-
__decorateClass$
|
|
5417
|
+
__decorateClass$o([attr({
|
|
5402
5418
|
attribute: "formtarget"
|
|
5403
5419
|
})], Button.prototype, "formTarget", 2);
|
|
5404
|
-
__decorateClass$
|
|
5420
|
+
__decorateClass$o([attr({
|
|
5405
5421
|
attribute: "icon-only",
|
|
5406
5422
|
mode: "boolean"
|
|
5407
5423
|
})], Button.prototype, "iconOnly", 2);
|
|
5408
|
-
__decorateClass$
|
|
5409
|
-
__decorateClass$
|
|
5410
|
-
__decorateClass$
|
|
5411
|
-
__decorateClass$
|
|
5412
|
-
__decorateClass$
|
|
5424
|
+
__decorateClass$o([attr], Button.prototype, "name", 2);
|
|
5425
|
+
__decorateClass$o([attr], Button.prototype, "shape", 2);
|
|
5426
|
+
__decorateClass$o([attr], Button.prototype, "size", 2);
|
|
5427
|
+
__decorateClass$o([attr], Button.prototype, "type", 2);
|
|
5428
|
+
__decorateClass$o([attr], Button.prototype, "value", 2);
|
|
5413
5429
|
applyMixins(Button, StartEnd);
|
|
5414
5430
|
|
|
5415
5431
|
function buttonTemplate$1(options = {}) {
|
|
@@ -5425,25 +5441,18 @@ const definition$t = Button.compose({
|
|
|
5425
5441
|
|
|
5426
5442
|
definition$t.define(FluentDesignSystem.registry);
|
|
5427
5443
|
|
|
5428
|
-
var __defProp$
|
|
5429
|
-
var __getOwnPropDesc$
|
|
5430
|
-
var __decorateClass$
|
|
5431
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
5444
|
+
var __defProp$n = Object.defineProperty;
|
|
5445
|
+
var __getOwnPropDesc$n = Object.getOwnPropertyDescriptor;
|
|
5446
|
+
var __decorateClass$n = (decorators, target, key, kind) => {
|
|
5447
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$n(target, key) : target;
|
|
5432
5448
|
for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
5433
|
-
if (kind && result) __defProp$
|
|
5449
|
+
if (kind && result) __defProp$n(target, key, result);
|
|
5434
5450
|
return result;
|
|
5435
5451
|
};
|
|
5436
5452
|
class BaseCheckbox extends FASTElement {
|
|
5437
5453
|
constructor() {
|
|
5438
|
-
super();
|
|
5439
|
-
this.disabled = false;
|
|
5454
|
+
super(...arguments);
|
|
5440
5455
|
this.initialValue = "on";
|
|
5441
|
-
/**
|
|
5442
|
-
* The internal checked state of the control.
|
|
5443
|
-
*
|
|
5444
|
-
* @internal
|
|
5445
|
-
*/
|
|
5446
|
-
this._checked = this.initialChecked ?? false;
|
|
5447
5456
|
/**
|
|
5448
5457
|
* Indicates that the checked state has been changed by the user.
|
|
5449
5458
|
*
|
|
@@ -5468,7 +5477,6 @@ class BaseCheckbox extends FASTElement {
|
|
|
5468
5477
|
* @internal
|
|
5469
5478
|
*/
|
|
5470
5479
|
this._value = this.initialValue;
|
|
5471
|
-
this.elementInternals.role = "checkbox";
|
|
5472
5480
|
}
|
|
5473
5481
|
/**
|
|
5474
5482
|
* The element's current checked state.
|
|
@@ -5477,40 +5485,52 @@ class BaseCheckbox extends FASTElement {
|
|
|
5477
5485
|
*/
|
|
5478
5486
|
get checked() {
|
|
5479
5487
|
Observable.track(this, "checked");
|
|
5480
|
-
return this._checked;
|
|
5488
|
+
return !!this._checked;
|
|
5481
5489
|
}
|
|
5482
|
-
set checked(
|
|
5483
|
-
this._checked =
|
|
5484
|
-
this.setFormValue(
|
|
5490
|
+
set checked(next) {
|
|
5491
|
+
this._checked = next;
|
|
5492
|
+
this.setFormValue(next ? this.value : null);
|
|
5485
5493
|
this.setValidity();
|
|
5486
5494
|
this.setAriaChecked();
|
|
5487
|
-
toggleState(this.elementInternals, "checked",
|
|
5495
|
+
toggleState(this.elementInternals, "checked", next);
|
|
5488
5496
|
Observable.notify(this, "checked");
|
|
5489
5497
|
}
|
|
5490
5498
|
/**
|
|
5491
|
-
*
|
|
5499
|
+
* Toggles the disabled state when the user changes the `disabled` property.
|
|
5492
5500
|
*
|
|
5493
5501
|
* @internal
|
|
5494
5502
|
*/
|
|
5495
|
-
|
|
5496
|
-
this.
|
|
5497
|
-
toggleState(this.elementInternals, "
|
|
5503
|
+
disabledChanged(prev, next) {
|
|
5504
|
+
this.elementInternals.ariaDisabled = this.disabled ? "true" : "false";
|
|
5505
|
+
toggleState(this.elementInternals, "disabled", this.disabled);
|
|
5506
|
+
}
|
|
5507
|
+
/**
|
|
5508
|
+
* Sets the disabled state when the `disabled` attribute changes.
|
|
5509
|
+
*
|
|
5510
|
+
* @param prev - the previous value
|
|
5511
|
+
* @param next - the current value
|
|
5512
|
+
* @internal
|
|
5513
|
+
*/
|
|
5514
|
+
disabledAttributeChanged(prev, next) {
|
|
5515
|
+
this.disabled = !!next;
|
|
5498
5516
|
}
|
|
5499
5517
|
/**
|
|
5500
|
-
* Updates the
|
|
5518
|
+
* Updates the checked state when the `checked` attribute is changed, unless the checked state has been changed by the user.
|
|
5501
5519
|
*
|
|
5520
|
+
* @param prev - The previous initial checked state
|
|
5521
|
+
* @param next - The current initial checked state
|
|
5502
5522
|
* @internal
|
|
5503
5523
|
*/
|
|
5504
5524
|
initialCheckedChanged(prev, next) {
|
|
5505
5525
|
if (!this.dirtyChecked) {
|
|
5506
|
-
this.checked = next;
|
|
5526
|
+
this.checked = !!next;
|
|
5507
5527
|
}
|
|
5508
5528
|
}
|
|
5509
5529
|
/**
|
|
5510
|
-
* Sets the value of the input when the value attribute changes.
|
|
5530
|
+
* Sets the value of the input when the `value` attribute changes.
|
|
5511
5531
|
*
|
|
5512
|
-
* @param prev - The previous value
|
|
5513
|
-
* @param next - The current value
|
|
5532
|
+
* @param prev - The previous initial value
|
|
5533
|
+
* @param next - The current initial value
|
|
5514
5534
|
* @internal
|
|
5515
5535
|
*/
|
|
5516
5536
|
initialValueChanged(prev, next) {
|
|
@@ -5526,7 +5546,7 @@ class BaseCheckbox extends FASTElement {
|
|
|
5526
5546
|
requiredChanged(prev, next) {
|
|
5527
5547
|
if (this.$fastController.isConnected) {
|
|
5528
5548
|
this.setValidity();
|
|
5529
|
-
this.elementInternals.ariaRequired =
|
|
5549
|
+
this.elementInternals.ariaRequired = this.required ? "true" : "false";
|
|
5530
5550
|
}
|
|
5531
5551
|
}
|
|
5532
5552
|
/**
|
|
@@ -5605,14 +5625,6 @@ class BaseCheckbox extends FASTElement {
|
|
|
5605
5625
|
get willValidate() {
|
|
5606
5626
|
return this.elementInternals.willValidate;
|
|
5607
5627
|
}
|
|
5608
|
-
/**
|
|
5609
|
-
* Sets the `elementInternals.ariaChecked` value based on the checked state.
|
|
5610
|
-
*
|
|
5611
|
-
* @internal
|
|
5612
|
-
*/
|
|
5613
|
-
setAriaChecked() {
|
|
5614
|
-
this.elementInternals.ariaChecked = this.indeterminate ? "mixed" : `${this.checked}`;
|
|
5615
|
-
}
|
|
5616
5628
|
/**
|
|
5617
5629
|
* Checks the validity of the element and returns the result.
|
|
5618
5630
|
*
|
|
@@ -5634,14 +5646,16 @@ class BaseCheckbox extends FASTElement {
|
|
|
5634
5646
|
return;
|
|
5635
5647
|
}
|
|
5636
5648
|
this.dirtyChecked = true;
|
|
5649
|
+
const previousChecked = this.checked;
|
|
5637
5650
|
this.toggleChecked();
|
|
5638
|
-
this
|
|
5639
|
-
|
|
5651
|
+
if (previousChecked !== this.checked) {
|
|
5652
|
+
this.$emit("change");
|
|
5653
|
+
this.$emit("input");
|
|
5654
|
+
}
|
|
5640
5655
|
return true;
|
|
5641
5656
|
}
|
|
5642
5657
|
connectedCallback() {
|
|
5643
5658
|
super.connectedCallback();
|
|
5644
|
-
this.setFormValue(this.checked ? this.value : null);
|
|
5645
5659
|
this.setAriaChecked();
|
|
5646
5660
|
this.setValidity();
|
|
5647
5661
|
}
|
|
@@ -5652,7 +5666,7 @@ class BaseCheckbox extends FASTElement {
|
|
|
5652
5666
|
* @internal
|
|
5653
5667
|
*/
|
|
5654
5668
|
inputHandler(e) {
|
|
5655
|
-
this.
|
|
5669
|
+
this.setFormValue(this.value);
|
|
5656
5670
|
this.setValidity();
|
|
5657
5671
|
return true;
|
|
5658
5672
|
}
|
|
@@ -5687,7 +5701,6 @@ class BaseCheckbox extends FASTElement {
|
|
|
5687
5701
|
formResetCallback() {
|
|
5688
5702
|
this.checked = this.initialChecked ?? false;
|
|
5689
5703
|
this.dirtyChecked = false;
|
|
5690
|
-
this.indeterminate = false;
|
|
5691
5704
|
this.setValidity();
|
|
5692
5705
|
}
|
|
5693
5706
|
/**
|
|
@@ -5700,6 +5713,15 @@ class BaseCheckbox extends FASTElement {
|
|
|
5700
5713
|
reportValidity() {
|
|
5701
5714
|
return this.elementInternals.reportValidity();
|
|
5702
5715
|
}
|
|
5716
|
+
/**
|
|
5717
|
+
* Sets the ARIA checked state.
|
|
5718
|
+
*
|
|
5719
|
+
* @param value - The checked state
|
|
5720
|
+
* @internal
|
|
5721
|
+
*/
|
|
5722
|
+
setAriaChecked(value = this.checked) {
|
|
5723
|
+
this.elementInternals.ariaChecked = value ? "true" : "false";
|
|
5724
|
+
}
|
|
5703
5725
|
/**
|
|
5704
5726
|
* Reflects the {@link https://developer.mozilla.org/docs/Web/API/ElementInternals/setFormValue | `ElementInternals.setFormValue()`} method.
|
|
5705
5727
|
*
|
|
@@ -5729,24 +5751,25 @@ class BaseCheckbox extends FASTElement {
|
|
|
5729
5751
|
*
|
|
5730
5752
|
* @internal
|
|
5731
5753
|
*/
|
|
5732
|
-
setValidity(flags
|
|
5733
|
-
valueMissing: !!this.required && !this.checked
|
|
5734
|
-
}, message = this.validationMessage, anchor) {
|
|
5754
|
+
setValidity(flags, message, anchor) {
|
|
5735
5755
|
if (this.$fastController.isConnected) {
|
|
5736
|
-
if (this.disabled) {
|
|
5756
|
+
if (this.disabled || !this.required) {
|
|
5737
5757
|
this.elementInternals.setValidity({});
|
|
5738
5758
|
return;
|
|
5739
5759
|
}
|
|
5740
|
-
this.elementInternals.setValidity(
|
|
5760
|
+
this.elementInternals.setValidity({
|
|
5761
|
+
valueMissing: !!this.required && !this.checked,
|
|
5762
|
+
...flags
|
|
5763
|
+
}, message ?? this.validationMessage, anchor);
|
|
5741
5764
|
}
|
|
5742
5765
|
}
|
|
5743
5766
|
/**
|
|
5744
5767
|
* Toggles the checked state of the control.
|
|
5745
5768
|
*
|
|
5769
|
+
* @param force - Forces the element to be checked or unchecked
|
|
5746
5770
|
* @public
|
|
5747
5771
|
*/
|
|
5748
5772
|
toggleChecked(force = !this.checked) {
|
|
5749
|
-
this.indeterminate = false;
|
|
5750
5773
|
this.checked = force;
|
|
5751
5774
|
}
|
|
5752
5775
|
}
|
|
@@ -5757,33 +5780,47 @@ class BaseCheckbox extends FASTElement {
|
|
|
5757
5780
|
* @public
|
|
5758
5781
|
*/
|
|
5759
5782
|
BaseCheckbox.formAssociated = true;
|
|
5760
|
-
__decorateClass$
|
|
5783
|
+
__decorateClass$n([attr({
|
|
5761
5784
|
mode: "boolean"
|
|
5762
5785
|
})], BaseCheckbox.prototype, "autofocus", 2);
|
|
5763
|
-
__decorateClass$
|
|
5786
|
+
__decorateClass$n([observable], BaseCheckbox.prototype, "disabled", 2);
|
|
5787
|
+
__decorateClass$n([attr({
|
|
5788
|
+
attribute: "disabled",
|
|
5764
5789
|
mode: "boolean"
|
|
5765
|
-
})], BaseCheckbox.prototype, "
|
|
5766
|
-
__decorateClass$
|
|
5790
|
+
})], BaseCheckbox.prototype, "disabledAttribute", 2);
|
|
5791
|
+
__decorateClass$n([attr({
|
|
5767
5792
|
attribute: "form"
|
|
5768
5793
|
})], BaseCheckbox.prototype, "formAttribute", 2);
|
|
5769
|
-
__decorateClass$
|
|
5770
|
-
__decorateClass$o([attr({
|
|
5794
|
+
__decorateClass$n([attr({
|
|
5771
5795
|
attribute: "checked",
|
|
5772
5796
|
mode: "boolean"
|
|
5773
5797
|
})], BaseCheckbox.prototype, "initialChecked", 2);
|
|
5774
|
-
__decorateClass$
|
|
5798
|
+
__decorateClass$n([attr({
|
|
5775
5799
|
attribute: "value",
|
|
5776
5800
|
mode: "fromView"
|
|
5777
5801
|
})], BaseCheckbox.prototype, "initialValue", 2);
|
|
5778
|
-
__decorateClass$
|
|
5779
|
-
__decorateClass$
|
|
5802
|
+
__decorateClass$n([attr], BaseCheckbox.prototype, "name", 2);
|
|
5803
|
+
__decorateClass$n([attr({
|
|
5780
5804
|
mode: "boolean"
|
|
5781
5805
|
})], BaseCheckbox.prototype, "required", 2);
|
|
5782
5806
|
class Checkbox extends BaseCheckbox {
|
|
5783
5807
|
/**
|
|
5784
|
-
*
|
|
5785
|
-
*
|
|
5786
|
-
* @param
|
|
5808
|
+
* Updates the indeterminate state when the `indeterminate` property changes.
|
|
5809
|
+
*
|
|
5810
|
+
* @param prev - the indeterminate state
|
|
5811
|
+
* @param next - the current indeterminate state
|
|
5812
|
+
* @internal
|
|
5813
|
+
*/
|
|
5814
|
+
indeterminateChanged(prev, next) {
|
|
5815
|
+
this.setAriaChecked();
|
|
5816
|
+
toggleState(this.elementInternals, "indeterminate", next);
|
|
5817
|
+
}
|
|
5818
|
+
/**
|
|
5819
|
+
* Applies shape states when the `shape` property changes.
|
|
5820
|
+
*
|
|
5821
|
+
* @param prev - the previous shape value
|
|
5822
|
+
* @param next - the next shape value
|
|
5823
|
+
* @internal
|
|
5787
5824
|
*/
|
|
5788
5825
|
shapeChanged(prev, next) {
|
|
5789
5826
|
if (prev) {
|
|
@@ -5794,9 +5831,11 @@ class Checkbox extends BaseCheckbox {
|
|
|
5794
5831
|
}
|
|
5795
5832
|
}
|
|
5796
5833
|
/**
|
|
5797
|
-
*
|
|
5834
|
+
* Applies size states when the `size` property changes.
|
|
5835
|
+
*
|
|
5798
5836
|
* @param prev - the previous state
|
|
5799
5837
|
* @param next - the next state
|
|
5838
|
+
* @internal
|
|
5800
5839
|
*/
|
|
5801
5840
|
sizeChanged(prev, next) {
|
|
5802
5841
|
if (prev) {
|
|
@@ -5806,19 +5845,46 @@ class Checkbox extends BaseCheckbox {
|
|
|
5806
5845
|
toggleState(this.elementInternals, next, true);
|
|
5807
5846
|
}
|
|
5808
5847
|
}
|
|
5848
|
+
constructor() {
|
|
5849
|
+
super();
|
|
5850
|
+
this.elementInternals.role = "checkbox";
|
|
5851
|
+
}
|
|
5852
|
+
/**
|
|
5853
|
+
* Sets the ARIA checked state. If the `indeterminate` flag is true, the value will be 'mixed'.
|
|
5854
|
+
*
|
|
5855
|
+
* @internal
|
|
5856
|
+
* @override
|
|
5857
|
+
*/
|
|
5858
|
+
setAriaChecked(value = this.checked) {
|
|
5859
|
+
if (this.indeterminate) {
|
|
5860
|
+
this.elementInternals.ariaChecked = "mixed";
|
|
5861
|
+
return;
|
|
5862
|
+
}
|
|
5863
|
+
super.setAriaChecked(value);
|
|
5864
|
+
}
|
|
5865
|
+
/**
|
|
5866
|
+
* Toggles the checked state of the control.
|
|
5867
|
+
*
|
|
5868
|
+
* @param force - Forces the element to be checked or unchecked
|
|
5869
|
+
* @public
|
|
5870
|
+
*/
|
|
5871
|
+
toggleChecked(force = !this.checked) {
|
|
5872
|
+
this.indeterminate = false;
|
|
5873
|
+
super.toggleChecked(force);
|
|
5874
|
+
}
|
|
5809
5875
|
}
|
|
5810
|
-
__decorateClass$
|
|
5811
|
-
__decorateClass$
|
|
5876
|
+
__decorateClass$n([observable], Checkbox.prototype, "indeterminate", 2);
|
|
5877
|
+
__decorateClass$n([attr], Checkbox.prototype, "shape", 2);
|
|
5878
|
+
__decorateClass$n([attr], Checkbox.prototype, "size", 2);
|
|
5812
5879
|
|
|
5813
|
-
const checkedState$1 = css.partial`:is([state--checked], :state(checked))`;
|
|
5814
5880
|
const indeterminateState = css.partial`:is([state--indeterminate], :state(indeterminate))`;
|
|
5815
5881
|
const styles$r = css`
|
|
5816
5882
|
${display("inline-flex")}
|
|
5817
5883
|
|
|
5818
|
-
:host{--size:16px;background-color:${colorNeutralBackground1};border-radius:${borderRadiusSmall};border:${strokeWidthThin} solid ${colorNeutralStrokeAccessible};box-sizing:border-box;cursor:pointer;position:relative;width:var(--size)}:host,.indeterminate-indicator,.checked-indicator{aspect-ratio:1}:host(:hover){border-color:${colorNeutralStrokeAccessibleHover}}:host(:active){border-color:${colorNeutralStrokeAccessiblePressed}}:host(${checkedState
|
|
5819
|
-
:host{border-color:FieldText}:host(:not([slot='input']:focus-visible))::after{border-color:Canvas}:host(:not([disabled]):hover),:host(${checkedState
|
|
5884
|
+
:host{--size:16px;background-color:${colorNeutralBackground1};border-radius:${borderRadiusSmall};border:${strokeWidthThin} solid ${colorNeutralStrokeAccessible};box-sizing:border-box;cursor:pointer;position:relative;width:var(--size)}:host,.indeterminate-indicator,.checked-indicator{aspect-ratio:1}:host(:hover){border-color:${colorNeutralStrokeAccessibleHover}}:host(:active){border-color:${colorNeutralStrokeAccessiblePressed}}:host(${checkedState}:hover){background-color:${colorCompoundBrandBackgroundHover};border-color:${colorCompoundBrandStrokeHover}}:host(${checkedState}:active){background-color:${colorCompoundBrandBackgroundPressed};border-color:${colorCompoundBrandStrokePressed}}:host(:focus-visible){outline:none}:host(:not([slot='input']))::after{content:'';position:absolute;inset:-8px;box-sizing:border-box;outline:none;border:${strokeWidthThick} solid ${colorTransparentStroke};border-radius:${borderRadiusMedium}}:host(:not([slot='input']):focus-visible)::after{border-color:${colorStrokeFocus2}}.indeterminate-indicator,.checked-indicator{color:${colorNeutralForegroundInverted};inset:0;margin:auto;position:absolute}::slotted([slot='checked-indicator']),.checked-indicator{fill:currentColor;display:inline-flex;flex:1 0 auto;width:12px}:host(:not(${checkedState})) *:is(::slotted([slot='checked-indicator']),.checked-indicator){display:none}:host(${checkedState}),:host(${indeterminateState}){border-color:${colorCompoundBrandStroke}}:host(${checkedState}),:host(${indeterminateState}) .indeterminate-indicator{background-color:${colorCompoundBrandBackground}}:host(${indeterminateState}) .indeterminate-indicator{border-radius:${borderRadiusSmall};position:absolute;width:calc(var(--size) / 2);inset:0}:host(${largeState}){--size:20px}:host(${largeState}) ::slotted([slot='checked-indicator']),:host(${largeState}) .checked-indicator{width:16px}:host(${circularState}),:host(${circularState}) .indeterminate-indicator{border-radius:${borderRadiusCircular}}:host([disabled]),:host([disabled]${checkedState}){background-color:${colorNeutralBackgroundDisabled};border-color:${colorNeutralStrokeDisabled}}:host([disabled]){cursor:unset}:host([disabled]${indeterminateState}) .indeterminate-indicator{background-color:${colorNeutralStrokeDisabled}}:host([disabled]${checkedState}) .checked-indicator{color:${colorNeutralStrokeDisabled}}`.withBehaviors(forcedColorsStylesheetBehavior(css`
|
|
5885
|
+
:host{border-color:FieldText}:host(:not([slot='input']:focus-visible))::after{border-color:Canvas}:host(:not([disabled]):hover),:host(${checkedState}:not([disabled]):hover),:host(:not([slot='input']):focus-visible)::after{border-color:Highlight}.indeterminate-indicator,.checked-indicator{color:HighlightText}:host(${checkedState}),:host(${indeterminateState}) .indeterminate-indicator{background-color:FieldText}:host(${checkedState}:not([disabled]):hover),:host(${indeterminateState}:not([disabled]):hover) .indeterminate-indicator{background-color:Highlight}:host([disabled]){border-color:GrayText}:host([disabled]${indeterminateState}) .indeterminate-indicator{background-color:GrayText}:host([disabled]),:host([disabled]${checkedState}) .checked-indicator{color:GrayText}`));
|
|
5820
5886
|
|
|
5821
|
-
const checkedIndicator = html.partial( /* html */
|
|
5887
|
+
const checkedIndicator$1 = html.partial( /* html */
|
|
5822
5888
|
`
|
|
5823
5889
|
<svg
|
|
5824
5890
|
fill="currentColor"
|
|
@@ -5839,7 +5905,7 @@ function checkboxTemplate(options = {}) {
|
|
|
5839
5905
|
return html`<template tabindex="${x => !x.disabled ? 0 : void 0}" @click="${(x, c) => x.clickHandler(c.event)}" @input="${(x, c) => x.inputHandler(c.event)}" @keydown="${(x, c) => x.keydownHandler(c.event)}" @keyup="${(x, c) => x.keyupHandler(c.event)}"><slot name="checked-indicator">${staticallyCompose(options.checkedIndicator)}</slot><slot name="indeterminate-indicator">${staticallyCompose(options.indeterminateIndicator)}</slot></template>`;
|
|
5840
5906
|
}
|
|
5841
5907
|
const template$s = checkboxTemplate({
|
|
5842
|
-
checkedIndicator,
|
|
5908
|
+
checkedIndicator: checkedIndicator$1,
|
|
5843
5909
|
indeterminateIndicator
|
|
5844
5910
|
});
|
|
5845
5911
|
|
|
@@ -5872,12 +5938,12 @@ const definition$r = CompoundButton.compose({
|
|
|
5872
5938
|
|
|
5873
5939
|
definition$r.define(FluentDesignSystem.registry);
|
|
5874
5940
|
|
|
5875
|
-
var __defProp$
|
|
5876
|
-
var __getOwnPropDesc$
|
|
5877
|
-
var __decorateClass$
|
|
5878
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
5941
|
+
var __defProp$m = Object.defineProperty;
|
|
5942
|
+
var __getOwnPropDesc$m = Object.getOwnPropertyDescriptor;
|
|
5943
|
+
var __decorateClass$m = (decorators, target, key, kind) => {
|
|
5944
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$m(target, key) : target;
|
|
5879
5945
|
for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
5880
|
-
if (kind && result) __defProp$
|
|
5946
|
+
if (kind && result) __defProp$m(target, key, result);
|
|
5881
5947
|
return result;
|
|
5882
5948
|
};
|
|
5883
5949
|
class CounterBadge extends FASTElement {
|
|
@@ -5974,22 +6040,22 @@ class CounterBadge extends FASTElement {
|
|
|
5974
6040
|
return;
|
|
5975
6041
|
}
|
|
5976
6042
|
}
|
|
5977
|
-
__decorateClass$
|
|
5978
|
-
__decorateClass$
|
|
5979
|
-
__decorateClass$
|
|
5980
|
-
__decorateClass$
|
|
5981
|
-
__decorateClass$
|
|
6043
|
+
__decorateClass$m([attr], CounterBadge.prototype, "appearance", 2);
|
|
6044
|
+
__decorateClass$m([attr], CounterBadge.prototype, "color", 2);
|
|
6045
|
+
__decorateClass$m([attr], CounterBadge.prototype, "shape", 2);
|
|
6046
|
+
__decorateClass$m([attr], CounterBadge.prototype, "size", 2);
|
|
6047
|
+
__decorateClass$m([attr({
|
|
5982
6048
|
converter: nullableNumberConverter
|
|
5983
6049
|
})], CounterBadge.prototype, "count", 2);
|
|
5984
|
-
__decorateClass$
|
|
6050
|
+
__decorateClass$m([attr({
|
|
5985
6051
|
attribute: "overflow-count",
|
|
5986
6052
|
converter: nullableNumberConverter
|
|
5987
6053
|
})], CounterBadge.prototype, "overflowCount", 2);
|
|
5988
|
-
__decorateClass$
|
|
6054
|
+
__decorateClass$m([attr({
|
|
5989
6055
|
attribute: "show-zero",
|
|
5990
6056
|
mode: "boolean"
|
|
5991
6057
|
})], CounterBadge.prototype, "showZero", 2);
|
|
5992
|
-
__decorateClass$
|
|
6058
|
+
__decorateClass$m([attr({
|
|
5993
6059
|
mode: "boolean"
|
|
5994
6060
|
})], CounterBadge.prototype, "dot", 2);
|
|
5995
6061
|
applyMixins(CounterBadge, StartEnd);
|
|
@@ -6024,12 +6090,12 @@ const DialogType = {
|
|
|
6024
6090
|
alert: "alert"
|
|
6025
6091
|
};
|
|
6026
6092
|
|
|
6027
|
-
var __defProp$
|
|
6028
|
-
var __getOwnPropDesc$
|
|
6029
|
-
var __decorateClass$
|
|
6030
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
6093
|
+
var __defProp$l = Object.defineProperty;
|
|
6094
|
+
var __getOwnPropDesc$l = Object.getOwnPropertyDescriptor;
|
|
6095
|
+
var __decorateClass$l = (decorators, target, key, kind) => {
|
|
6096
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$l(target, key) : target;
|
|
6031
6097
|
for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
6032
|
-
if (kind && result) __defProp$
|
|
6098
|
+
if (kind && result) __defProp$l(target, key, result);
|
|
6033
6099
|
return result;
|
|
6034
6100
|
};
|
|
6035
6101
|
class Dialog extends FASTElement {
|
|
@@ -6097,14 +6163,14 @@ class Dialog extends FASTElement {
|
|
|
6097
6163
|
return true;
|
|
6098
6164
|
}
|
|
6099
6165
|
}
|
|
6100
|
-
__decorateClass$
|
|
6101
|
-
__decorateClass$
|
|
6166
|
+
__decorateClass$l([observable], Dialog.prototype, "dialog", 2);
|
|
6167
|
+
__decorateClass$l([attr({
|
|
6102
6168
|
attribute: "aria-describedby"
|
|
6103
6169
|
})], Dialog.prototype, "ariaDescribedby", 2);
|
|
6104
|
-
__decorateClass$
|
|
6170
|
+
__decorateClass$l([attr({
|
|
6105
6171
|
attribute: "aria-labelledby"
|
|
6106
6172
|
})], Dialog.prototype, "ariaLabelledby", 2);
|
|
6107
|
-
__decorateClass$
|
|
6173
|
+
__decorateClass$l([attr], Dialog.prototype, "type", 2);
|
|
6108
6174
|
|
|
6109
6175
|
const template$p = html`<dialog role="${x => x.type === DialogType.alert ? "alertdialog" : "dialog"}" type="${x => x.type}" class="dialog" part="dialog" aria-modal="${x => x.type === DialogType.modal || x.type === DialogType.alert ? "true" : void 0}" aria-describedby="${x => x.ariaDescribedby}" aria-labelledby="${x => x.ariaLabelledby}" aria-label="${x => x.ariaLabel}" @click="${(x, c) => x.clickHandler(c.event)}" @cancel="${(x, c) => x.type === DialogType.alert ? c.event.preventDefault() : x.hide()}" ${ref("dialog")}><slot></slot></dialog>`;
|
|
6110
6176
|
|
|
@@ -6120,12 +6186,12 @@ const definition$p = Dialog.compose({
|
|
|
6120
6186
|
|
|
6121
6187
|
definition$p.define(FluentDesignSystem.registry);
|
|
6122
6188
|
|
|
6123
|
-
var __defProp$
|
|
6124
|
-
var __getOwnPropDesc$
|
|
6125
|
-
var __decorateClass$
|
|
6126
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
6189
|
+
var __defProp$k = Object.defineProperty;
|
|
6190
|
+
var __getOwnPropDesc$k = Object.getOwnPropertyDescriptor;
|
|
6191
|
+
var __decorateClass$k = (decorators, target, key, kind) => {
|
|
6192
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$k(target, key) : target;
|
|
6127
6193
|
for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
6128
|
-
if (kind && result) __defProp$
|
|
6194
|
+
if (kind && result) __defProp$k(target, key, result);
|
|
6129
6195
|
return result;
|
|
6130
6196
|
};
|
|
6131
6197
|
class DialogBody extends FASTElement {
|
|
@@ -6134,7 +6200,7 @@ class DialogBody extends FASTElement {
|
|
|
6134
6200
|
this.noTitleAction = false;
|
|
6135
6201
|
}
|
|
6136
6202
|
}
|
|
6137
|
-
__decorateClass$
|
|
6203
|
+
__decorateClass$k([attr({
|
|
6138
6204
|
mode: "boolean",
|
|
6139
6205
|
attribute: "no-title-action"
|
|
6140
6206
|
})], DialogBody.prototype, "noTitleAction", 2);
|
|
@@ -6180,12 +6246,12 @@ const DividerRole = {
|
|
|
6180
6246
|
};
|
|
6181
6247
|
const DividerOrientation = Orientation;
|
|
6182
6248
|
|
|
6183
|
-
var __defProp$
|
|
6184
|
-
var __getOwnPropDesc$
|
|
6185
|
-
var __decorateClass$
|
|
6186
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
6249
|
+
var __defProp$j = Object.defineProperty;
|
|
6250
|
+
var __getOwnPropDesc$j = Object.getOwnPropertyDescriptor;
|
|
6251
|
+
var __decorateClass$j = (decorators, target, key, kind) => {
|
|
6252
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$j(target, key) : target;
|
|
6187
6253
|
for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
6188
|
-
if (kind && result) __defProp$
|
|
6254
|
+
if (kind && result) __defProp$j(target, key, result);
|
|
6189
6255
|
return result;
|
|
6190
6256
|
};
|
|
6191
6257
|
class Divider extends FASTElement {
|
|
@@ -6272,13 +6338,13 @@ class Divider extends FASTElement {
|
|
|
6272
6338
|
}
|
|
6273
6339
|
}
|
|
6274
6340
|
}
|
|
6275
|
-
__decorateClass$
|
|
6276
|
-
__decorateClass$
|
|
6277
|
-
__decorateClass$
|
|
6341
|
+
__decorateClass$j([attr], Divider.prototype, "role", 2);
|
|
6342
|
+
__decorateClass$j([attr], Divider.prototype, "orientation", 2);
|
|
6343
|
+
__decorateClass$j([attr({
|
|
6278
6344
|
attribute: "align-content"
|
|
6279
6345
|
})], Divider.prototype, "alignContent", 2);
|
|
6280
|
-
__decorateClass$
|
|
6281
|
-
__decorateClass$
|
|
6346
|
+
__decorateClass$j([attr], Divider.prototype, "appearance", 2);
|
|
6347
|
+
__decorateClass$j([attr({
|
|
6282
6348
|
mode: "boolean"
|
|
6283
6349
|
})], Divider.prototype, "inset", 2);
|
|
6284
6350
|
|
|
@@ -6317,12 +6383,12 @@ const DrawerType = {
|
|
|
6317
6383
|
inline: "inline"
|
|
6318
6384
|
};
|
|
6319
6385
|
|
|
6320
|
-
var __defProp$
|
|
6321
|
-
var __getOwnPropDesc$
|
|
6322
|
-
var __decorateClass$
|
|
6323
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
6386
|
+
var __defProp$i = Object.defineProperty;
|
|
6387
|
+
var __getOwnPropDesc$i = Object.getOwnPropertyDescriptor;
|
|
6388
|
+
var __decorateClass$i = (decorators, target, key, kind) => {
|
|
6389
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$i(target, key) : target;
|
|
6324
6390
|
for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
6325
|
-
if (kind && result) __defProp$
|
|
6391
|
+
if (kind && result) __defProp$i(target, key, result);
|
|
6326
6392
|
return result;
|
|
6327
6393
|
};
|
|
6328
6394
|
class Drawer extends FASTElement {
|
|
@@ -6392,18 +6458,18 @@ class Drawer extends FASTElement {
|
|
|
6392
6458
|
return true;
|
|
6393
6459
|
}
|
|
6394
6460
|
}
|
|
6395
|
-
__decorateClass$
|
|
6396
|
-
__decorateClass$
|
|
6461
|
+
__decorateClass$i([attr], Drawer.prototype, "type", 2);
|
|
6462
|
+
__decorateClass$i([attr({
|
|
6397
6463
|
attribute: "aria-labelledby"
|
|
6398
6464
|
})], Drawer.prototype, "ariaLabelledby", 2);
|
|
6399
|
-
__decorateClass$
|
|
6465
|
+
__decorateClass$i([attr({
|
|
6400
6466
|
attribute: "aria-describedby"
|
|
6401
6467
|
})], Drawer.prototype, "ariaDescribedby", 2);
|
|
6402
|
-
__decorateClass$
|
|
6403
|
-
__decorateClass$
|
|
6468
|
+
__decorateClass$i([attr], Drawer.prototype, "position", 2);
|
|
6469
|
+
__decorateClass$i([attr({
|
|
6404
6470
|
attribute: "size"
|
|
6405
6471
|
})], Drawer.prototype, "size", 2);
|
|
6406
|
-
__decorateClass$
|
|
6472
|
+
__decorateClass$i([observable], Drawer.prototype, "dialog", 2);
|
|
6407
6473
|
|
|
6408
6474
|
const styles$l = css`
|
|
6409
6475
|
${display("block")}
|
|
@@ -6442,24 +6508,38 @@ const ValidationFlags = {
|
|
|
6442
6508
|
valid: "valid"
|
|
6443
6509
|
};
|
|
6444
6510
|
|
|
6445
|
-
var __defProp$
|
|
6446
|
-
var __getOwnPropDesc$
|
|
6447
|
-
var __decorateClass$
|
|
6448
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
6511
|
+
var __defProp$h = Object.defineProperty;
|
|
6512
|
+
var __getOwnPropDesc$h = Object.getOwnPropertyDescriptor;
|
|
6513
|
+
var __decorateClass$h = (decorators, target, key, kind) => {
|
|
6514
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$h(target, key) : target;
|
|
6449
6515
|
for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
6450
|
-
if (kind && result) __defProp$
|
|
6516
|
+
if (kind && result) __defProp$h(target, key, result);
|
|
6451
6517
|
return result;
|
|
6452
6518
|
};
|
|
6453
6519
|
class Field extends FASTElement {
|
|
6454
6520
|
constructor() {
|
|
6455
|
-
super(
|
|
6521
|
+
super();
|
|
6456
6522
|
this.labelPosition = LabelPosition.above;
|
|
6523
|
+
this.labelSlot = [];
|
|
6457
6524
|
/**
|
|
6458
6525
|
* The internal {@link https://developer.mozilla.org/docs/Web/API/ElementInternals | `ElementInternals`} instance for the component.
|
|
6459
6526
|
*
|
|
6460
6527
|
* @internal
|
|
6461
6528
|
*/
|
|
6462
6529
|
this.elementInternals = this.attachInternals();
|
|
6530
|
+
this.elementInternals.role = "presentation";
|
|
6531
|
+
}
|
|
6532
|
+
/**
|
|
6533
|
+
* Updates attributes on the slotted label elements.
|
|
6534
|
+
*
|
|
6535
|
+
* @param prev - the previous list of slotted label elements
|
|
6536
|
+
* @param next - the current list of slotted label elements
|
|
6537
|
+
*/
|
|
6538
|
+
labelSlotChanged(prev, next) {
|
|
6539
|
+
if (next && this.input) {
|
|
6540
|
+
this.setLabelProperties();
|
|
6541
|
+
this.setStates();
|
|
6542
|
+
}
|
|
6463
6543
|
}
|
|
6464
6544
|
/**
|
|
6465
6545
|
* Adds or removes the `invalid` event listener based on the presence of slotted message elements.
|
|
@@ -6469,6 +6549,7 @@ class Field extends FASTElement {
|
|
|
6469
6549
|
* @internal
|
|
6470
6550
|
*/
|
|
6471
6551
|
messageSlotChanged(prev, next) {
|
|
6552
|
+
toggleState(this.elementInternals, "has-message", !!next.length);
|
|
6472
6553
|
if (!next.length) {
|
|
6473
6554
|
this.removeEventListener("invalid", this.invalidHandler, {
|
|
6474
6555
|
capture: true
|
|
@@ -6487,30 +6568,43 @@ class Field extends FASTElement {
|
|
|
6487
6568
|
* @internal
|
|
6488
6569
|
*/
|
|
6489
6570
|
slottedInputsChanged(prev, next) {
|
|
6490
|
-
|
|
6491
|
-
|
|
6571
|
+
if (next?.length) {
|
|
6572
|
+
this.input = next?.[0];
|
|
6492
6573
|
this.setStates();
|
|
6493
6574
|
}
|
|
6494
6575
|
}
|
|
6495
6576
|
/**
|
|
6496
|
-
*
|
|
6577
|
+
* Updates the field's states and label properties when the assigned input changes.
|
|
6497
6578
|
*
|
|
6498
|
-
* @param
|
|
6579
|
+
* @param prev - the previous input
|
|
6580
|
+
* @param next - the current input
|
|
6581
|
+
*/
|
|
6582
|
+
inputChanged(prev, next) {
|
|
6583
|
+
if (next) {
|
|
6584
|
+
this.setStates();
|
|
6585
|
+
this.setLabelProperties();
|
|
6586
|
+
}
|
|
6587
|
+
}
|
|
6588
|
+
/**
|
|
6589
|
+
* Calls the `setStates` method when a `change` event is emitted from the slotted input.
|
|
6590
|
+
*
|
|
6591
|
+
* @param e - the event object
|
|
6499
6592
|
* @internal
|
|
6500
6593
|
*/
|
|
6501
6594
|
changeHandler(e) {
|
|
6502
6595
|
this.setStates();
|
|
6596
|
+
this.setValidationStates();
|
|
6597
|
+
return true;
|
|
6503
6598
|
}
|
|
6504
6599
|
/**
|
|
6505
6600
|
* Redirects `click` events to the slotted input.
|
|
6506
6601
|
*
|
|
6602
|
+
* @param e - the event object
|
|
6507
6603
|
* @internal
|
|
6508
6604
|
*/
|
|
6509
6605
|
clickHandler(e) {
|
|
6510
|
-
if (this
|
|
6511
|
-
this.input.focus();
|
|
6606
|
+
if (this === e.target) {
|
|
6512
6607
|
this.input.click();
|
|
6513
|
-
return;
|
|
6514
6608
|
}
|
|
6515
6609
|
return true;
|
|
6516
6610
|
}
|
|
@@ -6521,7 +6615,7 @@ class Field extends FASTElement {
|
|
|
6521
6615
|
* @internal
|
|
6522
6616
|
*/
|
|
6523
6617
|
focusinHandler(e) {
|
|
6524
|
-
if (
|
|
6618
|
+
if (this.matches(":focus-within:has(> :focus-visible)")) {
|
|
6525
6619
|
toggleState(this.elementInternals, "focus-visible", true);
|
|
6526
6620
|
}
|
|
6527
6621
|
return true;
|
|
@@ -6546,7 +6640,25 @@ class Field extends FASTElement {
|
|
|
6546
6640
|
if (this.messageSlot.length) {
|
|
6547
6641
|
e.preventDefault();
|
|
6548
6642
|
}
|
|
6549
|
-
this.
|
|
6643
|
+
this.setValidationStates();
|
|
6644
|
+
}
|
|
6645
|
+
/**
|
|
6646
|
+
* Sets ARIA and form-related attributes on slotted label elements.
|
|
6647
|
+
*
|
|
6648
|
+
* @internal
|
|
6649
|
+
*/
|
|
6650
|
+
setLabelProperties() {
|
|
6651
|
+
if (this.$fastController.isConnected) {
|
|
6652
|
+
this.input.id = this.input.id || uniqueId("input");
|
|
6653
|
+
this.labelSlot?.forEach(label => {
|
|
6654
|
+
if (label instanceof HTMLLabelElement) {
|
|
6655
|
+
label.htmlFor = label.htmlFor || this.input.id;
|
|
6656
|
+
label.id = label.id || `${this.input.id}--label`;
|
|
6657
|
+
label.setAttribute("aria-hidden", "true");
|
|
6658
|
+
this.input.setAttribute("aria-labelledby", label.id);
|
|
6659
|
+
}
|
|
6660
|
+
});
|
|
6661
|
+
}
|
|
6550
6662
|
}
|
|
6551
6663
|
/**
|
|
6552
6664
|
* Toggles the field's states based on the slotted input.
|
|
@@ -6558,22 +6670,26 @@ class Field extends FASTElement {
|
|
|
6558
6670
|
toggleState(this.elementInternals, "disabled", !!this.input.disabled);
|
|
6559
6671
|
toggleState(this.elementInternals, "readonly", !!this.input.readOnly);
|
|
6560
6672
|
toggleState(this.elementInternals, "required", !!this.input.required);
|
|
6561
|
-
|
|
6562
|
-
|
|
6563
|
-
|
|
6564
|
-
|
|
6565
|
-
|
|
6566
|
-
|
|
6673
|
+
toggleState(this.elementInternals, "checked", !!this.input.checked);
|
|
6674
|
+
}
|
|
6675
|
+
}
|
|
6676
|
+
setValidationStates() {
|
|
6677
|
+
if (!this.input.validity) {
|
|
6678
|
+
return;
|
|
6679
|
+
}
|
|
6680
|
+
for (const [flag, value] of Object.entries(ValidationFlags)) {
|
|
6681
|
+
toggleState(this.elementInternals, value, this.input.validity[flag]);
|
|
6567
6682
|
}
|
|
6568
6683
|
}
|
|
6569
6684
|
}
|
|
6570
|
-
__decorateClass$
|
|
6685
|
+
__decorateClass$h([attr({
|
|
6571
6686
|
attribute: "label-position"
|
|
6572
6687
|
})], Field.prototype, "labelPosition", 2);
|
|
6573
|
-
__decorateClass$
|
|
6574
|
-
__decorateClass$
|
|
6688
|
+
__decorateClass$h([observable], Field.prototype, "labelSlot", 2);
|
|
6689
|
+
__decorateClass$h([observable], Field.prototype, "messageSlot", 2);
|
|
6690
|
+
__decorateClass$h([observable], Field.prototype, "slottedInputs", 2);
|
|
6691
|
+
__decorateClass$h([observable], Field.prototype, "input", 2);
|
|
6575
6692
|
|
|
6576
|
-
const disabledState = css.partial`:is([state--disabled], :state(disabled))`;
|
|
6577
6693
|
const focusVisibleState = css.partial`:is([state--focus-visible], :state(focus-visible))`;
|
|
6578
6694
|
const badInputState = css.partial`:is([state--${ValidationFlags.badInput}], :state(${ValidationFlags.badInput}))`;
|
|
6579
6695
|
const customErrorState = css.partial`:is([state--${ValidationFlags.customError}], :state(${ValidationFlags.customError}))`;
|
|
@@ -6586,10 +6702,11 @@ const tooShortState = css.partial`:is([state--${ValidationFlags.tooShort}], :sta
|
|
|
6586
6702
|
const typeMismatchState = css.partial`:is([state--${ValidationFlags.typeMismatch}], :state(${ValidationFlags.typeMismatch}))`;
|
|
6587
6703
|
const validState = css.partial`:is([state-${ValidationFlags.valid}], :state(${ValidationFlags.valid}))`;
|
|
6588
6704
|
const valueMissingState = css.partial`:is([state--${ValidationFlags.valueMissing}], :state(${ValidationFlags.valueMissing}))`;
|
|
6705
|
+
const hasMessageState = css.partial`:is([state--has-message], :state(has-message))`;
|
|
6589
6706
|
const styles$k = css`
|
|
6590
6707
|
${display("inline-grid")}
|
|
6591
6708
|
|
|
6592
|
-
:host{align-items:center;
|
|
6709
|
+
:host{color:${colorNeutralForeground1};align-items:center;gap:0 ${spacingHorizontalM};justify-items:start;padding:${spacingVerticalS} ${spacingHorizontalS};position:relative}:has([slot='message']){color:${colorNeutralForeground1};row-gap:${spacingVerticalS}}:not(::slotted([slot='label'])){gap:0}:host([label-position='before']){grid-template-areas:'label input' 'label message'}:host([label-position='after']){gap:0;grid-template-areas:'input label' 'message message';grid-template-columns:auto 1fr}:host([label-position='after']) ::slotted([slot='input']){margin-inline-end:${spacingHorizontalM}}:host([label-position='above']){grid-template-areas:'label' 'input' 'message';row-gap:${spacingVerticalXXS}}:host([label-position='below']){grid-template-areas:'input' 'label' 'message';justify-items:center}:host([label-position='below']) ::slotted([slot='label']){margin-block-start:${spacingVerticalM}}:host([label-position='below']:not(${hasMessageState})){grid-template-areas:'input' 'label'}::slotted([slot='label'])::after{content:'';display:block;position:absolute;inset:0}::slotted([slot='input']){grid-area:input;position:relative;z-index:1}::slotted([slot='message']){margin-block-start:${spacingVerticalXXS};grid-area:message}:host(${focusVisibleState}:focus-within){border-radius:${borderRadiusMedium};outline:${strokeWidthThick} solid ${colorStrokeFocus2}}::slotted(label),::slotted([slot='label']){cursor:inherit;display:inline-flex;font-family:${fontFamilyBase};font-size:${fontSizeBase300};font-weight:${fontWeightRegular};grid-area:label;line-height:${lineHeightBase300};user-select:none}:host([size='small']) ::slotted(label){font-size:${fontSizeBase200};line-height:${lineHeightBase200}}:host([size='large']) ::slotted(label){font-size:${fontSizeBase400};line-height:${lineHeightBase400}}:host([size='large']) ::slotted(label),:host([weight='semibold']) ::slotted(label){font-weight:${fontWeightSemibold}}:host(${disabledState}){cursor:default}::slotted([flag]){display:none}:host(${badInputState}) ::slotted([flag='${ValidationFlags.badInput}']),:host(${customErrorState}) ::slotted([flag='${ValidationFlags.customError}']),:host(${patternMismatchState}) ::slotted([flag='${ValidationFlags.patternMismatch}']),:host(${rangeOverflowState}) ::slotted([flag='${ValidationFlags.rangeOverflow}']),:host(${rangeUnderflowState}) ::slotted([flag='${ValidationFlags.rangeUnderflow}']),:host(${stepMismatchState}) ::slotted([flag='${ValidationFlags.stepMismatch}']),:host(${tooLongState}) ::slotted([flag='${ValidationFlags.tooLong}']),:host(${tooShortState}) ::slotted([flag='${ValidationFlags.tooShort}']),:host(${typeMismatchState}) ::slotted([flag='${ValidationFlags.typeMismatch}']),:host(${valueMissingState}) ::slotted([flag='${ValidationFlags.valueMissing}']),:host(${validState}) ::slotted([flag='${ValidationFlags.valid}']){display:block}`;
|
|
6593
6710
|
|
|
6594
6711
|
const template$l = html`<template @click="${(x, c) => x.clickHandler(c.event)}" @change="${(x, c) => x.changeHandler(c.event)}" @focusin="${(x, c) => x.focusinHandler(c.event)}" @focusout="${(x, c) => x.focusoutHandler(c.event)}" ${children({
|
|
6595
6712
|
property: "slottedInputs",
|
|
@@ -6598,7 +6715,7 @@ const template$l = html`<template @click="${(x, c) => x.clickHandler(c.event)}"
|
|
|
6598
6715
|
subtree: true,
|
|
6599
6716
|
selector: '[slot="input"]',
|
|
6600
6717
|
filter: elements()
|
|
6601
|
-
})}><slot name="label" part="label"></slot><slot name="input" part="input"></slot><slot name="message" part="message" ${slotted({
|
|
6718
|
+
})}><slot name="label" part="label" ${slotted("labelSlot")}></slot><slot name="input" part="input"></slot><slot name="message" part="message" ${slotted({
|
|
6602
6719
|
property: "messageSlot",
|
|
6603
6720
|
filter: elements("[flag]")
|
|
6604
6721
|
})}></slot></template>`;
|
|
@@ -6614,12 +6731,12 @@ const definition$l = Field.compose({
|
|
|
6614
6731
|
|
|
6615
6732
|
definition$l.define(FluentDesignSystem.registry);
|
|
6616
6733
|
|
|
6617
|
-
var __defProp$
|
|
6618
|
-
var __getOwnPropDesc$
|
|
6619
|
-
var __decorateClass$
|
|
6620
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
6734
|
+
var __defProp$g = Object.defineProperty;
|
|
6735
|
+
var __getOwnPropDesc$g = Object.getOwnPropertyDescriptor;
|
|
6736
|
+
var __decorateClass$g = (decorators, target, key, kind) => {
|
|
6737
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$g(target, key) : target;
|
|
6621
6738
|
for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
6622
|
-
if (kind && result) __defProp$
|
|
6739
|
+
if (kind && result) __defProp$g(target, key, result);
|
|
6623
6740
|
return result;
|
|
6624
6741
|
};
|
|
6625
6742
|
class Image extends FASTElement {
|
|
@@ -6684,17 +6801,17 @@ class Image extends FASTElement {
|
|
|
6684
6801
|
}
|
|
6685
6802
|
}
|
|
6686
6803
|
}
|
|
6687
|
-
__decorateClass$
|
|
6804
|
+
__decorateClass$g([attr({
|
|
6688
6805
|
mode: "boolean"
|
|
6689
6806
|
})], Image.prototype, "block", 2);
|
|
6690
|
-
__decorateClass$
|
|
6807
|
+
__decorateClass$g([attr({
|
|
6691
6808
|
mode: "boolean"
|
|
6692
6809
|
})], Image.prototype, "bordered", 2);
|
|
6693
|
-
__decorateClass$
|
|
6810
|
+
__decorateClass$g([attr({
|
|
6694
6811
|
mode: "boolean"
|
|
6695
6812
|
})], Image.prototype, "shadow", 2);
|
|
6696
|
-
__decorateClass$
|
|
6697
|
-
__decorateClass$
|
|
6813
|
+
__decorateClass$g([attr], Image.prototype, "fit", 2);
|
|
6814
|
+
__decorateClass$g([attr], Image.prototype, "shape", 2);
|
|
6698
6815
|
|
|
6699
6816
|
const template$k = html`<slot></slot>`;
|
|
6700
6817
|
|
|
@@ -6709,12 +6826,12 @@ const definition$k = Image.compose({
|
|
|
6709
6826
|
|
|
6710
6827
|
definition$k.define(FluentDesignSystem.registry);
|
|
6711
6828
|
|
|
6712
|
-
var __defProp$
|
|
6713
|
-
var __getOwnPropDesc$
|
|
6714
|
-
var __decorateClass$
|
|
6715
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
6829
|
+
var __defProp$f = Object.defineProperty;
|
|
6830
|
+
var __getOwnPropDesc$f = Object.getOwnPropertyDescriptor;
|
|
6831
|
+
var __decorateClass$f = (decorators, target, key, kind) => {
|
|
6832
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$f(target, key) : target;
|
|
6716
6833
|
for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
6717
|
-
if (kind && result) __defProp$
|
|
6834
|
+
if (kind && result) __defProp$f(target, key, result);
|
|
6718
6835
|
return result;
|
|
6719
6836
|
};
|
|
6720
6837
|
class Label extends FASTElement {
|
|
@@ -6764,12 +6881,12 @@ class Label extends FASTElement {
|
|
|
6764
6881
|
toggleState(this.elementInternals, "disabled", next);
|
|
6765
6882
|
}
|
|
6766
6883
|
}
|
|
6767
|
-
__decorateClass$
|
|
6768
|
-
__decorateClass$
|
|
6769
|
-
__decorateClass$
|
|
6884
|
+
__decorateClass$f([attr], Label.prototype, "size", 2);
|
|
6885
|
+
__decorateClass$f([attr], Label.prototype, "weight", 2);
|
|
6886
|
+
__decorateClass$f([attr({
|
|
6770
6887
|
mode: "boolean"
|
|
6771
6888
|
})], Label.prototype, "disabled", 2);
|
|
6772
|
-
__decorateClass$
|
|
6889
|
+
__decorateClass$f([attr({
|
|
6773
6890
|
mode: "boolean"
|
|
6774
6891
|
})], Label.prototype, "required", 2);
|
|
6775
6892
|
|
|
@@ -6791,12 +6908,12 @@ const definition$j = Label.compose({
|
|
|
6791
6908
|
|
|
6792
6909
|
definition$j.define(FluentDesignSystem.registry);
|
|
6793
6910
|
|
|
6794
|
-
var __defProp$
|
|
6795
|
-
var __getOwnPropDesc$
|
|
6796
|
-
var __decorateClass$
|
|
6797
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
6911
|
+
var __defProp$e = Object.defineProperty;
|
|
6912
|
+
var __getOwnPropDesc$e = Object.getOwnPropertyDescriptor;
|
|
6913
|
+
var __decorateClass$e = (decorators, target, key, kind) => {
|
|
6914
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$e(target, key) : target;
|
|
6798
6915
|
for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
6799
|
-
if (kind && result) __defProp$
|
|
6916
|
+
if (kind && result) __defProp$e(target, key, result);
|
|
6800
6917
|
return result;
|
|
6801
6918
|
};
|
|
6802
6919
|
class Link extends BaseAnchor {
|
|
@@ -6826,8 +6943,8 @@ class Link extends BaseAnchor {
|
|
|
6826
6943
|
toggleState(this.elementInternals, "inline", next);
|
|
6827
6944
|
}
|
|
6828
6945
|
}
|
|
6829
|
-
__decorateClass$
|
|
6830
|
-
__decorateClass$
|
|
6946
|
+
__decorateClass$e([attr], Link.prototype, "appearance", 2);
|
|
6947
|
+
__decorateClass$e([attr({
|
|
6831
6948
|
mode: "boolean"
|
|
6832
6949
|
})], Link.prototype, "inline", 2);
|
|
6833
6950
|
|
|
@@ -6889,12 +7006,12 @@ const MenuItemRole = {
|
|
|
6889
7006
|
[MenuItemRole.menuitemradio]: "menuitemradio"
|
|
6890
7007
|
});
|
|
6891
7008
|
|
|
6892
|
-
var __defProp$
|
|
6893
|
-
var __getOwnPropDesc$
|
|
6894
|
-
var __decorateClass$
|
|
6895
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
7009
|
+
var __defProp$d = Object.defineProperty;
|
|
7010
|
+
var __getOwnPropDesc$d = Object.getOwnPropertyDescriptor;
|
|
7011
|
+
var __decorateClass$d = (decorators, target, key, kind) => {
|
|
7012
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$d(target, key) : target;
|
|
6896
7013
|
for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
6897
|
-
if (kind && result) __defProp$
|
|
7014
|
+
if (kind && result) __defProp$d(target, key, result);
|
|
6898
7015
|
return result;
|
|
6899
7016
|
};
|
|
6900
7017
|
class MenuItem extends FASTElement {
|
|
@@ -7039,18 +7156,18 @@ class MenuItem extends FASTElement {
|
|
|
7039
7156
|
}
|
|
7040
7157
|
}
|
|
7041
7158
|
}
|
|
7042
|
-
__decorateClass$
|
|
7159
|
+
__decorateClass$d([attr({
|
|
7043
7160
|
mode: "boolean"
|
|
7044
7161
|
})], MenuItem.prototype, "disabled", 2);
|
|
7045
|
-
__decorateClass$
|
|
7046
|
-
__decorateClass$
|
|
7162
|
+
__decorateClass$d([attr], MenuItem.prototype, "role", 2);
|
|
7163
|
+
__decorateClass$d([attr({
|
|
7047
7164
|
mode: "boolean"
|
|
7048
7165
|
})], MenuItem.prototype, "checked", 2);
|
|
7049
|
-
__decorateClass$
|
|
7166
|
+
__decorateClass$d([attr({
|
|
7050
7167
|
mode: "boolean"
|
|
7051
7168
|
})], MenuItem.prototype, "hidden", 2);
|
|
7052
|
-
__decorateClass$
|
|
7053
|
-
__decorateClass$
|
|
7169
|
+
__decorateClass$d([observable], MenuItem.prototype, "slottedSubmenu", 2);
|
|
7170
|
+
__decorateClass$d([observable], MenuItem.prototype, "submenu", 2);
|
|
7054
7171
|
applyMixins(MenuItem, StartEnd);
|
|
7055
7172
|
|
|
7056
7173
|
const styles$g = css`
|
|
@@ -7080,12 +7197,12 @@ const definition$g = MenuItem.compose({
|
|
|
7080
7197
|
|
|
7081
7198
|
definition$g.define(FluentDesignSystem.registry);
|
|
7082
7199
|
|
|
7083
|
-
var __defProp$
|
|
7084
|
-
var __getOwnPropDesc$
|
|
7085
|
-
var __decorateClass$
|
|
7086
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
7200
|
+
var __defProp$c = Object.defineProperty;
|
|
7201
|
+
var __getOwnPropDesc$c = Object.getOwnPropertyDescriptor;
|
|
7202
|
+
var __decorateClass$c = (decorators, target, key, kind) => {
|
|
7203
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$c(target, key) : target;
|
|
7087
7204
|
for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
7088
|
-
if (kind && result) __defProp$
|
|
7205
|
+
if (kind && result) __defProp$c(target, key, result);
|
|
7089
7206
|
return result;
|
|
7090
7207
|
};
|
|
7091
7208
|
const _MenuList = class _MenuList extends FASTElement {
|
|
@@ -7294,7 +7411,7 @@ const _MenuList = class _MenuList extends FASTElement {
|
|
|
7294
7411
|
}
|
|
7295
7412
|
};
|
|
7296
7413
|
_MenuList.focusableElementRoles = MenuItemRole;
|
|
7297
|
-
__decorateClass$
|
|
7414
|
+
__decorateClass$c([observable], _MenuList.prototype, "items", 2);
|
|
7298
7415
|
let MenuList = _MenuList;
|
|
7299
7416
|
|
|
7300
7417
|
const styles$f = css`
|
|
@@ -7315,12 +7432,12 @@ const definition$f = MenuList.compose({
|
|
|
7315
7432
|
|
|
7316
7433
|
definition$f.define(FluentDesignSystem.registry);
|
|
7317
7434
|
|
|
7318
|
-
var __defProp$
|
|
7319
|
-
var __getOwnPropDesc$
|
|
7320
|
-
var __decorateClass$
|
|
7321
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
7435
|
+
var __defProp$b = Object.defineProperty;
|
|
7436
|
+
var __getOwnPropDesc$b = Object.getOwnPropertyDescriptor;
|
|
7437
|
+
var __decorateClass$b = (decorators, target, key, kind) => {
|
|
7438
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$b(target, key) : target;
|
|
7322
7439
|
for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
7323
|
-
if (kind && result) __defProp$
|
|
7440
|
+
if (kind && result) __defProp$b(target, key, result);
|
|
7324
7441
|
return result;
|
|
7325
7442
|
};
|
|
7326
7443
|
class Menu extends FASTElement {
|
|
@@ -7604,24 +7721,24 @@ class Menu extends FASTElement {
|
|
|
7604
7721
|
}
|
|
7605
7722
|
}
|
|
7606
7723
|
}
|
|
7607
|
-
__decorateClass$
|
|
7724
|
+
__decorateClass$b([observable, attr({
|
|
7608
7725
|
attribute: "open-on-hover",
|
|
7609
7726
|
mode: "boolean"
|
|
7610
7727
|
})], Menu.prototype, "openOnHover", 2);
|
|
7611
|
-
__decorateClass$
|
|
7728
|
+
__decorateClass$b([observable, attr({
|
|
7612
7729
|
attribute: "open-on-context",
|
|
7613
7730
|
mode: "boolean"
|
|
7614
7731
|
})], Menu.prototype, "openOnContext", 2);
|
|
7615
|
-
__decorateClass$
|
|
7732
|
+
__decorateClass$b([observable, attr({
|
|
7616
7733
|
attribute: "close-on-scroll",
|
|
7617
7734
|
mode: "boolean"
|
|
7618
7735
|
})], Menu.prototype, "closeOnScroll", 2);
|
|
7619
|
-
__decorateClass$
|
|
7736
|
+
__decorateClass$b([observable, attr({
|
|
7620
7737
|
attribute: "persist-on-item-click",
|
|
7621
7738
|
mode: "boolean"
|
|
7622
7739
|
})], Menu.prototype, "persistOnItemClick", 2);
|
|
7623
|
-
__decorateClass$
|
|
7624
|
-
__decorateClass$
|
|
7740
|
+
__decorateClass$b([observable], Menu.prototype, "slottedMenuList", 2);
|
|
7741
|
+
__decorateClass$b([observable], Menu.prototype, "slottedTriggers", 2);
|
|
7625
7742
|
|
|
7626
7743
|
const styles$e = css`
|
|
7627
7744
|
${display("inline-block")}
|
|
@@ -7647,12 +7764,12 @@ const definition$e = Menu.compose({
|
|
|
7647
7764
|
|
|
7648
7765
|
definition$e.define(FluentDesignSystem.registry);
|
|
7649
7766
|
|
|
7650
|
-
var __defProp$
|
|
7651
|
-
var __getOwnPropDesc$
|
|
7652
|
-
var __decorateClass$
|
|
7653
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
7767
|
+
var __defProp$a = Object.defineProperty;
|
|
7768
|
+
var __getOwnPropDesc$a = Object.getOwnPropertyDescriptor;
|
|
7769
|
+
var __decorateClass$a = (decorators, target, key, kind) => {
|
|
7770
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$a(target, key) : target;
|
|
7654
7771
|
for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
7655
|
-
if (kind && result) __defProp$
|
|
7772
|
+
if (kind && result) __defProp$a(target, key, result);
|
|
7656
7773
|
return result;
|
|
7657
7774
|
};
|
|
7658
7775
|
class MessageBar extends FASTElement {
|
|
@@ -7713,9 +7830,9 @@ class MessageBar extends FASTElement {
|
|
|
7713
7830
|
}
|
|
7714
7831
|
}
|
|
7715
7832
|
}
|
|
7716
|
-
__decorateClass$
|
|
7717
|
-
__decorateClass$
|
|
7718
|
-
__decorateClass$
|
|
7833
|
+
__decorateClass$a([attr], MessageBar.prototype, "shape", 2);
|
|
7834
|
+
__decorateClass$a([attr], MessageBar.prototype, "layout", 2);
|
|
7835
|
+
__decorateClass$a([attr], MessageBar.prototype, "intent", 2);
|
|
7719
7836
|
|
|
7720
7837
|
const styles$d = css`
|
|
7721
7838
|
:host{display:grid;box-sizing:border-box;font-family:${fontFamilyBase};font-size:${fontSizeBase200};line-height:${lineHeightBase200};width:100%;background:${colorNeutralBackground3};border:1px solid ${colorNeutralStroke1};padding-inline:${spacingHorizontalM};border-radius:${borderRadiusMedium};min-height:36px;align-items:center;grid-template:'icon body actions dismiss' / auto 1fr auto auto;contain:layout style paint}:host(${squareState}){border-radius:0}:host(${successState}){background-color:${colorPaletteGreenBackground1};border-color:${colorPaletteGreenBorder1}}:host(${warningState}){background-color:${colorPaletteDarkOrangeBackground1};border-color:${colorPaletteDarkOrangeBorder1}}:host(${errorState}){background-color:${colorPaletteRedBackground1};border-color:${colorPaletteRedBorder1}}:host(${multiLineState}){grid-template-areas:'icon body dismiss'
|
|
@@ -7737,12 +7854,12 @@ const definition$d = MessageBar.compose({
|
|
|
7737
7854
|
|
|
7738
7855
|
definition$d.define(FluentDesignSystem.registry);
|
|
7739
7856
|
|
|
7740
|
-
var __defProp$
|
|
7741
|
-
var __getOwnPropDesc$
|
|
7742
|
-
var __decorateClass$
|
|
7743
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
7857
|
+
var __defProp$9 = Object.defineProperty;
|
|
7858
|
+
var __getOwnPropDesc$9 = Object.getOwnPropertyDescriptor;
|
|
7859
|
+
var __decorateClass$9 = (decorators, target, key, kind) => {
|
|
7860
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$9(target, key) : target;
|
|
7744
7861
|
for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
7745
|
-
if (kind && result) __defProp$
|
|
7862
|
+
if (kind && result) __defProp$9(target, key, result);
|
|
7746
7863
|
return result;
|
|
7747
7864
|
};
|
|
7748
7865
|
class ProgressBar extends FASTElement {
|
|
@@ -7831,21 +7948,21 @@ class ProgressBar extends FASTElement {
|
|
|
7831
7948
|
return range === 0 ? 0 : Math.fround((value - min) / range * 100);
|
|
7832
7949
|
}
|
|
7833
7950
|
}
|
|
7834
|
-
__decorateClass$
|
|
7835
|
-
__decorateClass$
|
|
7836
|
-
__decorateClass$
|
|
7951
|
+
__decorateClass$9([attr], ProgressBar.prototype, "thickness", 2);
|
|
7952
|
+
__decorateClass$9([attr], ProgressBar.prototype, "shape", 2);
|
|
7953
|
+
__decorateClass$9([attr({
|
|
7837
7954
|
attribute: "validation-state"
|
|
7838
7955
|
})], ProgressBar.prototype, "validationState", 2);
|
|
7839
|
-
__decorateClass$
|
|
7956
|
+
__decorateClass$9([attr({
|
|
7840
7957
|
converter: nullableNumberConverter
|
|
7841
7958
|
})], ProgressBar.prototype, "value", 2);
|
|
7842
|
-
__decorateClass$
|
|
7959
|
+
__decorateClass$9([attr({
|
|
7843
7960
|
converter: nullableNumberConverter
|
|
7844
7961
|
})], ProgressBar.prototype, "min", 2);
|
|
7845
|
-
__decorateClass$
|
|
7962
|
+
__decorateClass$9([attr({
|
|
7846
7963
|
converter: nullableNumberConverter
|
|
7847
7964
|
})], ProgressBar.prototype, "max", 2);
|
|
7848
|
-
__decorateClass$
|
|
7965
|
+
__decorateClass$9([volatile], ProgressBar.prototype, "percentComplete", 1);
|
|
7849
7966
|
|
|
7850
7967
|
const styles$c = css`
|
|
7851
7968
|
${display("block")}
|
|
@@ -7868,64 +7985,739 @@ const definition$c = ProgressBar.compose({
|
|
|
7868
7985
|
|
|
7869
7986
|
definition$c.define(FluentDesignSystem.registry);
|
|
7870
7987
|
|
|
7871
|
-
|
|
7872
|
-
|
|
7873
|
-
|
|
7874
|
-
|
|
7875
|
-
|
|
7876
|
-
|
|
7877
|
-
|
|
7878
|
-
|
|
7879
|
-
|
|
7880
|
-
|
|
7881
|
-
|
|
7882
|
-
|
|
7883
|
-
|
|
7884
|
-
|
|
7885
|
-
|
|
7886
|
-
|
|
7887
|
-
|
|
7888
|
-
|
|
7889
|
-
|
|
7890
|
-
|
|
7891
|
-
|
|
7892
|
-
|
|
7893
|
-
*
|
|
7894
|
-
* @remarks
|
|
7895
|
-
* HTML Attribute: disabled
|
|
7896
|
-
*/
|
|
7897
|
-
this.disabled = false;
|
|
7898
|
-
/**
|
|
7899
|
-
* These are events that are still fired by the proxy
|
|
7900
|
-
* element based on user / programmatic interaction.
|
|
7901
|
-
*
|
|
7902
|
-
* The proxy implementation should be transparent to
|
|
7903
|
-
* the app author, so block these events from emitting.
|
|
7904
|
-
*/
|
|
7905
|
-
this.proxyEventsToBlock = ["change", "click"];
|
|
7906
|
-
this.proxyInitialized = false;
|
|
7907
|
-
this.required = false;
|
|
7908
|
-
this.initialValue = this.initialValue || "";
|
|
7909
|
-
if (!this.elementInternals) {
|
|
7910
|
-
this.formResetCallback = this.formResetCallback.bind(this);
|
|
7911
|
-
}
|
|
7988
|
+
class Radio extends BaseCheckbox {
|
|
7989
|
+
connectedCallback() {
|
|
7990
|
+
super.connectedCallback();
|
|
7991
|
+
this.tabIndex = this.disabled ? -1 : 0;
|
|
7992
|
+
}
|
|
7993
|
+
constructor() {
|
|
7994
|
+
super();
|
|
7995
|
+
this.elementInternals.role = "radio";
|
|
7996
|
+
}
|
|
7997
|
+
/**
|
|
7998
|
+
* Toggles the disabled state when the user changes the `disabled` property.
|
|
7999
|
+
*
|
|
8000
|
+
* @param prev - the previous value of the `disabled` property
|
|
8001
|
+
* @param next - the current value of the `disabled` property
|
|
8002
|
+
* @internal
|
|
8003
|
+
* @override
|
|
8004
|
+
*/
|
|
8005
|
+
disabledChanged(prev, next) {
|
|
8006
|
+
super.disabledChanged(prev, next);
|
|
8007
|
+
if (next) {
|
|
8008
|
+
this.checked = false;
|
|
8009
|
+
this.tabIndex = -1;
|
|
7912
8010
|
}
|
|
8011
|
+
this.$emit("disabled", next, {
|
|
8012
|
+
bubbles: true
|
|
8013
|
+
});
|
|
8014
|
+
}
|
|
8015
|
+
/**
|
|
8016
|
+
* This method is a no-op for the radio component.
|
|
8017
|
+
*
|
|
8018
|
+
* @internal
|
|
8019
|
+
* @override
|
|
8020
|
+
* @remarks
|
|
8021
|
+
* To make a group of radio controls required, see {@link RadioGroup.required}.
|
|
8022
|
+
*/
|
|
8023
|
+
requiredChanged() {
|
|
8024
|
+
return;
|
|
8025
|
+
}
|
|
8026
|
+
/**
|
|
8027
|
+
* This method is a no-op for the radio component.
|
|
8028
|
+
*
|
|
8029
|
+
* @internal
|
|
8030
|
+
* @override
|
|
8031
|
+
* @remarks
|
|
8032
|
+
* The radio form value is controlled by the `RadioGroup` component.
|
|
8033
|
+
*/
|
|
8034
|
+
setFormValue() {
|
|
8035
|
+
return;
|
|
8036
|
+
}
|
|
8037
|
+
/**
|
|
8038
|
+
* Sets the validity of the control.
|
|
8039
|
+
*
|
|
8040
|
+
* @internal
|
|
8041
|
+
* @override
|
|
8042
|
+
* @remarks
|
|
8043
|
+
* The radio component does not have a `required` attribute, so this method always sets the validity to `true`.
|
|
8044
|
+
*/
|
|
8045
|
+
setValidity() {
|
|
8046
|
+
this.elementInternals.setValidity({});
|
|
8047
|
+
}
|
|
8048
|
+
/**
|
|
8049
|
+
* Toggles the checked state of the control.
|
|
8050
|
+
*
|
|
8051
|
+
* @param force - Forces the element to be checked or unchecked
|
|
8052
|
+
* @public
|
|
8053
|
+
* @override
|
|
8054
|
+
* @remarks
|
|
8055
|
+
* The radio checked state is controlled by the `RadioGroup` component, so the `force` parameter defaults to `true`.
|
|
8056
|
+
*/
|
|
8057
|
+
toggleChecked(force = true) {
|
|
8058
|
+
super.toggleChecked(force);
|
|
8059
|
+
}
|
|
8060
|
+
}
|
|
8061
|
+
|
|
8062
|
+
function getRootActiveElement(element) {
|
|
8063
|
+
const rootNode = element.getRootNode();
|
|
8064
|
+
if (rootNode instanceof ShadowRoot) {
|
|
8065
|
+
return rootNode.activeElement;
|
|
8066
|
+
}
|
|
8067
|
+
return document.activeElement;
|
|
8068
|
+
}
|
|
8069
|
+
|
|
8070
|
+
const RadioGroupOrientation = Orientation;
|
|
8071
|
+
|
|
8072
|
+
var __defProp$8 = Object.defineProperty;
|
|
8073
|
+
var __getOwnPropDesc$8 = Object.getOwnPropertyDescriptor;
|
|
8074
|
+
var __decorateClass$8 = (decorators, target, key, kind) => {
|
|
8075
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$8(target, key) : target;
|
|
8076
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
8077
|
+
if (kind && result) __defProp$8(target, key, result);
|
|
8078
|
+
return result;
|
|
8079
|
+
};
|
|
8080
|
+
class RadioGroup extends FASTElement {
|
|
8081
|
+
constructor() {
|
|
8082
|
+
super();
|
|
7913
8083
|
/**
|
|
7914
|
-
*
|
|
7915
|
-
* Feature detects API support and resolve respectively
|
|
7916
|
-
*
|
|
7917
|
-
* @internal
|
|
8084
|
+
* Indicates that the value has been changed by the user.
|
|
7918
8085
|
*/
|
|
7919
|
-
|
|
7920
|
-
|
|
7921
|
-
}
|
|
8086
|
+
this.dirtyState = false;
|
|
8087
|
+
this.disabled = false;
|
|
7922
8088
|
/**
|
|
7923
|
-
*
|
|
8089
|
+
* The internal {@link https://developer.mozilla.org/docs/Web/API/ElementInternals | `ElementInternals`} instance for the component.
|
|
7924
8090
|
*
|
|
7925
|
-
* @
|
|
8091
|
+
* @internal
|
|
7926
8092
|
*/
|
|
7927
|
-
|
|
7928
|
-
|
|
8093
|
+
this.elementInternals = this.attachInternals();
|
|
8094
|
+
this.elementInternals.role = "radiogroup";
|
|
8095
|
+
this.elementInternals.ariaOrientation = this.orientation ?? RadioGroupOrientation.horizontal;
|
|
8096
|
+
}
|
|
8097
|
+
/**
|
|
8098
|
+
* Sets the checked state of the nearest enabled radio when the `checkedIndex` changes.
|
|
8099
|
+
*
|
|
8100
|
+
* @param prev - the previous index
|
|
8101
|
+
* @param next - the current index
|
|
8102
|
+
* @internal
|
|
8103
|
+
*/
|
|
8104
|
+
checkedIndexChanged(prev, next) {
|
|
8105
|
+
if (!this.enabledRadios) {
|
|
8106
|
+
return;
|
|
8107
|
+
}
|
|
8108
|
+
this.checkRadio(next);
|
|
8109
|
+
}
|
|
8110
|
+
/**
|
|
8111
|
+
* Sets the `disabled` attribute on all child radios when the `disabled` property changes.
|
|
8112
|
+
*
|
|
8113
|
+
* @param prev - the previous disabled value
|
|
8114
|
+
* @param next - the current disabled value
|
|
8115
|
+
* @internal
|
|
8116
|
+
*/
|
|
8117
|
+
disabledChanged(prev, next) {
|
|
8118
|
+
if (this.$fastController.isConnected) {
|
|
8119
|
+
this.checkedIndex = -1;
|
|
8120
|
+
this.radios?.forEach(radio => {
|
|
8121
|
+
radio.disabled = radio.disabledAttribute || this.disabled;
|
|
8122
|
+
});
|
|
8123
|
+
this.restrictFocus();
|
|
8124
|
+
}
|
|
8125
|
+
}
|
|
8126
|
+
/**
|
|
8127
|
+
* Sets the matching radio to checked when the value changes. If no radio matches the value, no radio will be checked.
|
|
8128
|
+
*
|
|
8129
|
+
* @param prev - the previous value
|
|
8130
|
+
* @param next - the current value
|
|
8131
|
+
*/
|
|
8132
|
+
initialValueChanged(prev, next) {
|
|
8133
|
+
this.value = next ?? "";
|
|
8134
|
+
}
|
|
8135
|
+
/**
|
|
8136
|
+
* Sets the `name` attribute on all child radios when the `name` property changes.
|
|
8137
|
+
*
|
|
8138
|
+
* @internal
|
|
8139
|
+
*/
|
|
8140
|
+
nameChanged(prev, next) {
|
|
8141
|
+
if (this.isConnected && next) {
|
|
8142
|
+
this.radios?.forEach(radio => {
|
|
8143
|
+
radio.name = this.name;
|
|
8144
|
+
});
|
|
8145
|
+
}
|
|
8146
|
+
}
|
|
8147
|
+
/**
|
|
8148
|
+
* Sets the ariaOrientation attribute when the orientation changes.
|
|
8149
|
+
*
|
|
8150
|
+
* @param prev - the previous orientation
|
|
8151
|
+
* @param next - the current orientation
|
|
8152
|
+
* @internal
|
|
8153
|
+
*/
|
|
8154
|
+
orientationChanged(prev, next) {
|
|
8155
|
+
this.elementInternals.ariaOrientation = this.orientation ?? RadioGroupOrientation.horizontal;
|
|
8156
|
+
}
|
|
8157
|
+
/**
|
|
8158
|
+
* Updates the enabled radios collection when properties on the child radios change.
|
|
8159
|
+
*
|
|
8160
|
+
* @param prev - the previous radios
|
|
8161
|
+
* @param next - the current radios
|
|
8162
|
+
*/
|
|
8163
|
+
radiosChanged(prev, next) {
|
|
8164
|
+
const setSize = next?.length;
|
|
8165
|
+
if (!setSize) {
|
|
8166
|
+
return;
|
|
8167
|
+
}
|
|
8168
|
+
if (!this.name && next.every(x => x.name === next[0].name)) {
|
|
8169
|
+
this.name = next[0].name;
|
|
8170
|
+
}
|
|
8171
|
+
const checkedIndex = findLastIndex(this.enabledRadios, x => x.initialChecked);
|
|
8172
|
+
next.forEach((radio, index) => {
|
|
8173
|
+
radio.ariaPosInSet = `${index + 1}`;
|
|
8174
|
+
radio.ariaSetSize = `${setSize}`;
|
|
8175
|
+
if (this.initialValue && !this.dirtyState) {
|
|
8176
|
+
radio.checked = radio.value === this.initialValue;
|
|
8177
|
+
} else {
|
|
8178
|
+
radio.checked = index === checkedIndex;
|
|
8179
|
+
}
|
|
8180
|
+
radio.name = this.name ?? radio.name;
|
|
8181
|
+
radio.disabled = this.disabled || radio.disabledAttribute;
|
|
8182
|
+
});
|
|
8183
|
+
if (!this.dirtyState && this.initialValue) {
|
|
8184
|
+
this.value = this.initialValue;
|
|
8185
|
+
}
|
|
8186
|
+
if (!this.value) {
|
|
8187
|
+
this.checkedIndex = checkedIndex;
|
|
8188
|
+
}
|
|
8189
|
+
const radioIds = next.map(radio => radio.id).join(" ").trim();
|
|
8190
|
+
if (radioIds) {
|
|
8191
|
+
this.setAttribute("aria-owns", radioIds);
|
|
8192
|
+
}
|
|
8193
|
+
Updates.enqueue(() => {
|
|
8194
|
+
this.restrictFocus();
|
|
8195
|
+
});
|
|
8196
|
+
}
|
|
8197
|
+
/**
|
|
8198
|
+
*
|
|
8199
|
+
* @param prev - the previous required value
|
|
8200
|
+
* @param next - the current required value
|
|
8201
|
+
*/
|
|
8202
|
+
requiredChanged(prev, next) {
|
|
8203
|
+
this.elementInternals.ariaRequired = next ? "true" : null;
|
|
8204
|
+
this.setValidity();
|
|
8205
|
+
}
|
|
8206
|
+
/**
|
|
8207
|
+
* A collection of child radios that are not disabled.
|
|
8208
|
+
*
|
|
8209
|
+
* @internal
|
|
8210
|
+
*/
|
|
8211
|
+
get enabledRadios() {
|
|
8212
|
+
if (this.disabled) {
|
|
8213
|
+
return [];
|
|
8214
|
+
}
|
|
8215
|
+
return this.radios?.filter(x => !x.disabled) ?? [];
|
|
8216
|
+
}
|
|
8217
|
+
/**
|
|
8218
|
+
* The validation message. Uses the browser's default validation message for native checkboxes if not otherwise
|
|
8219
|
+
* specified (e.g., via `setCustomValidity`).
|
|
8220
|
+
*
|
|
8221
|
+
* @internal
|
|
8222
|
+
*/
|
|
8223
|
+
get validationMessage() {
|
|
8224
|
+
if (this.elementInternals.validationMessage) {
|
|
8225
|
+
return this.elementInternals.validationMessage;
|
|
8226
|
+
}
|
|
8227
|
+
if (this.enabledRadios?.[0]?.validationMessage) {
|
|
8228
|
+
return this.enabledRadios[0].validationMessage;
|
|
8229
|
+
}
|
|
8230
|
+
if (!this._validationFallbackMessage) {
|
|
8231
|
+
const validationMessageFallbackControl = document.createElement("input");
|
|
8232
|
+
validationMessageFallbackControl.type = "radio";
|
|
8233
|
+
validationMessageFallbackControl.required = true;
|
|
8234
|
+
validationMessageFallbackControl.checked = false;
|
|
8235
|
+
this._validationFallbackMessage = validationMessageFallbackControl.validationMessage;
|
|
8236
|
+
}
|
|
8237
|
+
return this._validationFallbackMessage;
|
|
8238
|
+
}
|
|
8239
|
+
/**
|
|
8240
|
+
* The element's validity state.
|
|
8241
|
+
*
|
|
8242
|
+
* @public
|
|
8243
|
+
* @remarks
|
|
8244
|
+
* Reflects the {@link https://developer.mozilla.org/docs/Web/API/ElementInternals/validity | `ElementInternals.validity`} property.
|
|
8245
|
+
*/
|
|
8246
|
+
get validity() {
|
|
8247
|
+
return this.elementInternals.validity;
|
|
8248
|
+
}
|
|
8249
|
+
/**
|
|
8250
|
+
* The current value of the checked radio.
|
|
8251
|
+
*
|
|
8252
|
+
* @public
|
|
8253
|
+
*/
|
|
8254
|
+
get value() {
|
|
8255
|
+
Observable.notify(this, "value");
|
|
8256
|
+
return this.enabledRadios.find(x => x.checked)?.value ?? null;
|
|
8257
|
+
}
|
|
8258
|
+
set value(next) {
|
|
8259
|
+
const index = this.enabledRadios.findIndex(x => x.value === next);
|
|
8260
|
+
this.checkedIndex = index;
|
|
8261
|
+
if (this.$fastController.isConnected) {
|
|
8262
|
+
this.setFormValue(next);
|
|
8263
|
+
this.setValidity();
|
|
8264
|
+
}
|
|
8265
|
+
Observable.track(this, "value");
|
|
8266
|
+
}
|
|
8267
|
+
/**
|
|
8268
|
+
* Sets the checked state of all radios when any radio emits a `change` event.
|
|
8269
|
+
*
|
|
8270
|
+
* @param e - the change event
|
|
8271
|
+
*/
|
|
8272
|
+
changeHandler(e) {
|
|
8273
|
+
if (this === e.target) {
|
|
8274
|
+
return true;
|
|
8275
|
+
}
|
|
8276
|
+
this.dirtyState = true;
|
|
8277
|
+
const radioIndex = this.enabledRadios.indexOf(e.target);
|
|
8278
|
+
this.checkRadio(radioIndex);
|
|
8279
|
+
return true;
|
|
8280
|
+
}
|
|
8281
|
+
/**
|
|
8282
|
+
* Checks the radio at the specified index.
|
|
8283
|
+
*
|
|
8284
|
+
* @param index - the index of the radio to check
|
|
8285
|
+
* @internal
|
|
8286
|
+
*/
|
|
8287
|
+
checkRadio(index = this.checkedIndex) {
|
|
8288
|
+
let checkedIndex = this.checkedIndex;
|
|
8289
|
+
this.enabledRadios.forEach((item, i) => {
|
|
8290
|
+
const shouldCheck = i === index;
|
|
8291
|
+
item.checked = shouldCheck;
|
|
8292
|
+
if (shouldCheck) {
|
|
8293
|
+
checkedIndex = i;
|
|
8294
|
+
}
|
|
8295
|
+
});
|
|
8296
|
+
this.checkedIndex = checkedIndex;
|
|
8297
|
+
this.setFormValue(this.value);
|
|
8298
|
+
this.setValidity();
|
|
8299
|
+
}
|
|
8300
|
+
/**
|
|
8301
|
+
* Checks the validity of the element and returns the result.
|
|
8302
|
+
*
|
|
8303
|
+
* @public
|
|
8304
|
+
* @remarks
|
|
8305
|
+
* Reflects the {@link https://developer.mozilla.org/docs/Web/API/ElementInternals/checkValidity | `HTMLInputElement.checkValidity()`} method.
|
|
8306
|
+
*/
|
|
8307
|
+
checkValidity() {
|
|
8308
|
+
return this.elementInternals.checkValidity();
|
|
8309
|
+
}
|
|
8310
|
+
/**
|
|
8311
|
+
* Handles click events for the radio group.
|
|
8312
|
+
*
|
|
8313
|
+
* @param e - the click event
|
|
8314
|
+
* @internal
|
|
8315
|
+
*/
|
|
8316
|
+
clickHandler(e) {
|
|
8317
|
+
if (this === e.target) {
|
|
8318
|
+
this.enabledRadios[Math.max(0, this.checkedIndex)]?.focus();
|
|
8319
|
+
}
|
|
8320
|
+
return true;
|
|
8321
|
+
}
|
|
8322
|
+
/**
|
|
8323
|
+
* Focuses the checked radio or the first enabled radio.
|
|
8324
|
+
*
|
|
8325
|
+
* @internal
|
|
8326
|
+
*/
|
|
8327
|
+
focus() {
|
|
8328
|
+
this.enabledRadios[Math.max(0, this.checkedIndex)]?.focus();
|
|
8329
|
+
}
|
|
8330
|
+
/**
|
|
8331
|
+
* Enables tabbing through the radio group when the group receives focus.
|
|
8332
|
+
*
|
|
8333
|
+
* @param e - the focus event
|
|
8334
|
+
* @internal
|
|
8335
|
+
*/
|
|
8336
|
+
focusinHandler(e) {
|
|
8337
|
+
if (!this.disabled) {
|
|
8338
|
+
this.enabledRadios.forEach(radio => {
|
|
8339
|
+
radio.tabIndex = 0;
|
|
8340
|
+
});
|
|
8341
|
+
}
|
|
8342
|
+
return true;
|
|
8343
|
+
}
|
|
8344
|
+
/**
|
|
8345
|
+
* Sets the tabindex of the radios based on the checked state when the radio group loses focus.
|
|
8346
|
+
*
|
|
8347
|
+
* @param e - the focusout event
|
|
8348
|
+
* @internal
|
|
8349
|
+
*/
|
|
8350
|
+
focusoutHandler(e) {
|
|
8351
|
+
if (this.radios?.includes(e.relatedTarget) && this.radios?.some(x => x.checked)) {
|
|
8352
|
+
this.restrictFocus();
|
|
8353
|
+
}
|
|
8354
|
+
return true;
|
|
8355
|
+
}
|
|
8356
|
+
formResetCallback() {
|
|
8357
|
+
this.dirtyState = false;
|
|
8358
|
+
this.checkedIndex = -1;
|
|
8359
|
+
this.setFormValue(this.value);
|
|
8360
|
+
this.setValidity();
|
|
8361
|
+
}
|
|
8362
|
+
getEnabledIndexInBounds(index, upperBound = this.enabledRadios.length) {
|
|
8363
|
+
if (upperBound === 0) {
|
|
8364
|
+
return -1;
|
|
8365
|
+
}
|
|
8366
|
+
return (index + upperBound) % upperBound;
|
|
8367
|
+
}
|
|
8368
|
+
/**
|
|
8369
|
+
* Handles keydown events for the radio group.
|
|
8370
|
+
*
|
|
8371
|
+
* @param e - the keyboard event
|
|
8372
|
+
* @internal
|
|
8373
|
+
*/
|
|
8374
|
+
keydownHandler(e) {
|
|
8375
|
+
const isRtl = getDirection(this) === "rtl";
|
|
8376
|
+
const checkedIndex = this.enabledRadios.findIndex(x => x === getRootActiveElement(this)) ?? this.checkedIndex;
|
|
8377
|
+
let increment = 0;
|
|
8378
|
+
switch (e.key) {
|
|
8379
|
+
case "ArrowLeft":
|
|
8380
|
+
{
|
|
8381
|
+
increment = isRtl ? 1 : -1;
|
|
8382
|
+
break;
|
|
8383
|
+
}
|
|
8384
|
+
case "ArrowUp":
|
|
8385
|
+
{
|
|
8386
|
+
increment = -1;
|
|
8387
|
+
break;
|
|
8388
|
+
}
|
|
8389
|
+
case "ArrowRight":
|
|
8390
|
+
{
|
|
8391
|
+
increment = isRtl ? -1 : 1;
|
|
8392
|
+
break;
|
|
8393
|
+
}
|
|
8394
|
+
case "ArrowDown":
|
|
8395
|
+
{
|
|
8396
|
+
increment = 1;
|
|
8397
|
+
break;
|
|
8398
|
+
}
|
|
8399
|
+
case "Tab":
|
|
8400
|
+
{
|
|
8401
|
+
this.restrictFocus();
|
|
8402
|
+
break;
|
|
8403
|
+
}
|
|
8404
|
+
case " ":
|
|
8405
|
+
{
|
|
8406
|
+
this.checkRadio();
|
|
8407
|
+
break;
|
|
8408
|
+
}
|
|
8409
|
+
}
|
|
8410
|
+
if (!increment) {
|
|
8411
|
+
return true;
|
|
8412
|
+
}
|
|
8413
|
+
const nextIndex = checkedIndex + increment;
|
|
8414
|
+
this.checkedIndex = this.getEnabledIndexInBounds(nextIndex);
|
|
8415
|
+
this.enabledRadios[this.checkedIndex]?.focus();
|
|
8416
|
+
}
|
|
8417
|
+
/**
|
|
8418
|
+
*
|
|
8419
|
+
* @param e - the disabled event
|
|
8420
|
+
*/
|
|
8421
|
+
disabledRadioHandler(e) {
|
|
8422
|
+
if (e.detail === true && e.target.checked) {
|
|
8423
|
+
this.checkedIndex = -1;
|
|
8424
|
+
}
|
|
8425
|
+
}
|
|
8426
|
+
/**
|
|
8427
|
+
* Reports the validity of the element.
|
|
8428
|
+
*
|
|
8429
|
+
* @public
|
|
8430
|
+
* @remarks
|
|
8431
|
+
* Reflects the {@link https://developer.mozilla.org/docs/Web/API/ElementInternals/reportValidity | `HTMLInputElement.reportValidity()`} method.
|
|
8432
|
+
*/
|
|
8433
|
+
reportValidity() {
|
|
8434
|
+
return this.elementInternals.reportValidity();
|
|
8435
|
+
}
|
|
8436
|
+
/**
|
|
8437
|
+
* Resets the `tabIndex` for all child radios when the radio group loses focus.
|
|
8438
|
+
*
|
|
8439
|
+
* @internal
|
|
8440
|
+
*/
|
|
8441
|
+
restrictFocus() {
|
|
8442
|
+
let activeIndex = Math.max(this.checkedIndex, 0);
|
|
8443
|
+
const focusedRadioIndex = this.enabledRadios.indexOf(getRootActiveElement(this));
|
|
8444
|
+
if (focusedRadioIndex !== -1) {
|
|
8445
|
+
activeIndex = focusedRadioIndex;
|
|
8446
|
+
}
|
|
8447
|
+
activeIndex = this.getEnabledIndexInBounds(activeIndex);
|
|
8448
|
+
this.enabledRadios.forEach((item, index) => {
|
|
8449
|
+
item.tabIndex = index === activeIndex ? 0 : -1;
|
|
8450
|
+
});
|
|
8451
|
+
}
|
|
8452
|
+
/**
|
|
8453
|
+
* Reflects the {@link https://developer.mozilla.org/docs/Web/API/ElementInternals/setFormValue | `ElementInternals.setFormValue()`} method.
|
|
8454
|
+
*
|
|
8455
|
+
* @internal
|
|
8456
|
+
*/
|
|
8457
|
+
setFormValue(value, state) {
|
|
8458
|
+
this.elementInternals.setFormValue(value, value ?? state);
|
|
8459
|
+
}
|
|
8460
|
+
/**
|
|
8461
|
+
* Sets the validity of the element.
|
|
8462
|
+
*
|
|
8463
|
+
* @param flags - Validity flags to set.
|
|
8464
|
+
* @param message - Optional message to supply. If not provided, the element's `validationMessage` will be used.
|
|
8465
|
+
* @param anchor - Optional anchor to use for the validation message.
|
|
8466
|
+
*
|
|
8467
|
+
* @internal
|
|
8468
|
+
*/
|
|
8469
|
+
setValidity(flags, message, anchor) {
|
|
8470
|
+
if (this.$fastController.isConnected) {
|
|
8471
|
+
if (this.disabled || !this.required) {
|
|
8472
|
+
this.elementInternals.setValidity({});
|
|
8473
|
+
return;
|
|
8474
|
+
}
|
|
8475
|
+
this.elementInternals.setValidity({
|
|
8476
|
+
valueMissing: this.required && !this.value,
|
|
8477
|
+
...flags
|
|
8478
|
+
}, message ?? this.validationMessage, anchor ?? this.enabledRadios[0]);
|
|
8479
|
+
}
|
|
8480
|
+
}
|
|
8481
|
+
/**
|
|
8482
|
+
* Updates the collection of child radios when the slot changes.
|
|
8483
|
+
*
|
|
8484
|
+
* @param e - the slot change event
|
|
8485
|
+
* @internal
|
|
8486
|
+
*/
|
|
8487
|
+
slotchangeHandler(e) {
|
|
8488
|
+
Updates.enqueue(() => {
|
|
8489
|
+
this.radios = [...this.querySelectorAll("*")].filter(x => x instanceof Radio);
|
|
8490
|
+
});
|
|
8491
|
+
}
|
|
8492
|
+
}
|
|
8493
|
+
/**
|
|
8494
|
+
* The form-associated flag.
|
|
8495
|
+
* @see {@link https://html.spec.whatwg.org/multipage/custom-elements.html#custom-elements-face-example | Form-associated custom elements}
|
|
8496
|
+
*
|
|
8497
|
+
* @public
|
|
8498
|
+
*/
|
|
8499
|
+
RadioGroup.formAssociated = true;
|
|
8500
|
+
__decorateClass$8([observable], RadioGroup.prototype, "checkedIndex", 2);
|
|
8501
|
+
__decorateClass$8([attr({
|
|
8502
|
+
attribute: "disabled",
|
|
8503
|
+
mode: "boolean"
|
|
8504
|
+
})], RadioGroup.prototype, "disabled", 2);
|
|
8505
|
+
__decorateClass$8([attr({
|
|
8506
|
+
attribute: "value",
|
|
8507
|
+
mode: "fromView"
|
|
8508
|
+
})], RadioGroup.prototype, "initialValue", 2);
|
|
8509
|
+
__decorateClass$8([attr], RadioGroup.prototype, "name", 2);
|
|
8510
|
+
__decorateClass$8([attr], RadioGroup.prototype, "orientation", 2);
|
|
8511
|
+
__decorateClass$8([observable], RadioGroup.prototype, "radios", 2);
|
|
8512
|
+
__decorateClass$8([attr({
|
|
8513
|
+
mode: "boolean"
|
|
8514
|
+
})], RadioGroup.prototype, "required", 2);
|
|
8515
|
+
|
|
8516
|
+
const styles$b = css`
|
|
8517
|
+
${display("flex")}
|
|
8518
|
+
|
|
8519
|
+
:host{-webkit-tap-highlight-color:transparent;cursor:pointer}:host(${disabledState}),:host([orientation='vertical']){flex-direction:column;justify-content:flex-start}:host([orientation='horizontal']){flex-direction:row}::slotted(*){color:${colorNeutralForeground3}}::slotted(:hover){color:${colorNeutralForeground2}}::slotted(:active){color:${colorNeutralForeground1}}::slotted(${disabledState}){color:${colorNeutralForegroundDisabled}}::slotted(${checkedState}){color:${colorNeutralForeground1}}`;
|
|
8520
|
+
|
|
8521
|
+
function radioGroupTemplate() {
|
|
8522
|
+
return html`<template @disabled="${(x, c) => x.disabledRadioHandler(c.event)}" @change="${(x, c) => x.changeHandler(c.event)}" @click="${(x, c) => x.clickHandler(c.event)}" @focusin="${(x, c) => x.focusinHandler(c.event)}" @focusout="${(x, c) => x.focusoutHandler(c.event)}" @keydown="${(x, c) => x.keydownHandler(c.event)}"><slot @slotchange="${(x, c) => x.slotchangeHandler(c.event)}"></slot></template>`;
|
|
8523
|
+
}
|
|
8524
|
+
const template$b = radioGroupTemplate();
|
|
8525
|
+
|
|
8526
|
+
const definition$b = RadioGroup.compose({
|
|
8527
|
+
name: `${FluentDesignSystem.prefix}-radio-group`,
|
|
8528
|
+
template: template$b,
|
|
8529
|
+
styles: styles$b
|
|
8530
|
+
});
|
|
8531
|
+
|
|
8532
|
+
definition$b.define(FluentDesignSystem.registry);
|
|
8533
|
+
|
|
8534
|
+
const styles$a = css`
|
|
8535
|
+
${display("inline-flex")}
|
|
8536
|
+
|
|
8537
|
+
:host{--size:16px;aspect-ratio:1;background-color:${colorNeutralBackground1};border:${strokeWidthThin} solid ${colorNeutralStrokeAccessible};border-radius:${borderRadiusCircular};box-sizing:border-box;position:relative;width:var(--size)}:host([size='large']){--size:20px}.checked-indicator{aspect-ratio:1;border-radius:${borderRadiusCircular};color:${colorNeutralForegroundInverted};inset:0;margin:auto;position:absolute;width:calc(var(--size) * 0.625)}:host(:not([slot='input']))::after{content:'' / '';position:absolute;display:block;inset:-8px;box-sizing:border-box;outline:none;border:${strokeWidthThick} solid ${colorTransparentStroke};border-radius:${borderRadiusMedium}}:host(:not([slot='input']):focus-visible)::after{border-color:${colorStrokeFocus2}}:host(:hover){border-color:${colorNeutralStrokeAccessibleHover}}:host(${checkedState}){border-color:${colorCompoundBrandStroke}}:host(${checkedState}) .checked-indicator{background-color:${colorCompoundBrandBackground}}:host(${checkedState}:hover) .checked-indicator{background-color:${colorCompoundBrandBackgroundHover}}:host(:active){border-color:${colorNeutralStrokeAccessiblePressed}}:host(${checkedState}:active) .checked-indicator{background-color:${colorCompoundBrandBackgroundPressed}}:host(:focus-visible){outline:none}:host(${disabledState}){background-color:${colorNeutralBackgroundDisabled};border-color:${colorNeutralStrokeDisabled}}:host(${checkedState}${disabledState}) .checked-indicator{background-color:${colorNeutralStrokeDisabled}}`.withBehaviors(forcedColorsStylesheetBehavior(css`
|
|
8538
|
+
:host{border-color:FieldText}:host(:not([slot='input']:focus-visible))::after{border-color:Canvas}:host(:not(${disabledState}):hover),:host(:not([slot='input']):focus-visible)::after{border-color:Highlight}.checked-indicator{color:HighlightText}:host(${checkedState}) .checked-indicator{background-color:FieldText}:host(${checkedState}:not(${disabledState}):hover) .checked-indicator{background-color:Highlight}:host(${disabledState}){border-color:GrayText;color:GrayText}:host(${disabledState}${checkedState}) .checked-indicator{background-color:GrayText}`));
|
|
8539
|
+
|
|
8540
|
+
const checkedIndicator = html.partial( /* html */
|
|
8541
|
+
`
|
|
8542
|
+
<span part="checked-indicator" class="checked-indicator" role="presentation"></span>
|
|
8543
|
+
`);
|
|
8544
|
+
function radioTemplate(options = {}) {
|
|
8545
|
+
return html`<template @click="${(x, c) => x.clickHandler(c.event)}" @keydown="${(x, c) => x.keydownHandler(c.event)}" @keyup="${(x, c) => x.keyupHandler(c.event)}"><slot name="checked-indicator">${staticallyCompose(options.checkedIndicator)}</slot></template>`;
|
|
8546
|
+
}
|
|
8547
|
+
const template$a = radioTemplate({
|
|
8548
|
+
checkedIndicator
|
|
8549
|
+
});
|
|
8550
|
+
|
|
8551
|
+
const definition$a = Radio.compose({
|
|
8552
|
+
name: `${FluentDesignSystem.prefix}-radio`,
|
|
8553
|
+
template: template$a,
|
|
8554
|
+
styles: styles$a
|
|
8555
|
+
});
|
|
8556
|
+
|
|
8557
|
+
definition$a.define(FluentDesignSystem.registry);
|
|
8558
|
+
|
|
8559
|
+
var __defProp$7 = Object.defineProperty;
|
|
8560
|
+
var __getOwnPropDesc$7 = Object.getOwnPropertyDescriptor;
|
|
8561
|
+
var __decorateClass$7 = (decorators, target, key, kind) => {
|
|
8562
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$7(target, key) : target;
|
|
8563
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
8564
|
+
if (kind && result) __defProp$7(target, key, result);
|
|
8565
|
+
return result;
|
|
8566
|
+
};
|
|
8567
|
+
class RatingDisplay extends FASTElement {
|
|
8568
|
+
constructor() {
|
|
8569
|
+
super();
|
|
8570
|
+
/**
|
|
8571
|
+
* The internal {@link https://developer.mozilla.org/docs/Web/API/ElementInternals | `ElementInternals`} instance for the component.
|
|
8572
|
+
*
|
|
8573
|
+
* @internal
|
|
8574
|
+
*/
|
|
8575
|
+
this.elementInternals = this.attachInternals();
|
|
8576
|
+
this.compact = false;
|
|
8577
|
+
this.intlNumberFormatter = new Intl.NumberFormat();
|
|
8578
|
+
this.elementInternals.role = "img";
|
|
8579
|
+
}
|
|
8580
|
+
/**
|
|
8581
|
+
* Handles changes to the color attribute.
|
|
8582
|
+
*
|
|
8583
|
+
* @param prev - The previous state
|
|
8584
|
+
* @param next - The next state
|
|
8585
|
+
*/
|
|
8586
|
+
colorChanged(prev, next) {
|
|
8587
|
+
if (prev) toggleState(this.elementInternals, prev, false);
|
|
8588
|
+
if (next) toggleState(this.elementInternals, next, true);
|
|
8589
|
+
}
|
|
8590
|
+
/**
|
|
8591
|
+
* Handles changes to the size attribute.
|
|
8592
|
+
*
|
|
8593
|
+
* @param prev - The previous state
|
|
8594
|
+
* @param next - The next state
|
|
8595
|
+
*/
|
|
8596
|
+
sizeChanged(prev, next) {
|
|
8597
|
+
if (prev) toggleState(this.elementInternals, prev, false);
|
|
8598
|
+
if (next) toggleState(this.elementInternals, next, true);
|
|
8599
|
+
}
|
|
8600
|
+
/**
|
|
8601
|
+
* Returns "count" as string, formatted according to the locale.
|
|
8602
|
+
*
|
|
8603
|
+
* @internal
|
|
8604
|
+
*/
|
|
8605
|
+
get formattedCount() {
|
|
8606
|
+
return this.count ? this.intlNumberFormatter.format(this.count) : "";
|
|
8607
|
+
}
|
|
8608
|
+
/**
|
|
8609
|
+
* Generates the icon SVG elements based on the "max" attribute.
|
|
8610
|
+
*
|
|
8611
|
+
* @internal
|
|
8612
|
+
*/
|
|
8613
|
+
generateIcons() {
|
|
8614
|
+
let htmlString = "";
|
|
8615
|
+
const selectedValue = Math.round((this.compact ? 1 : this.value ?? 0) * 2) / 2;
|
|
8616
|
+
for (let i = 0; i < (this.compact ? 1 : this.max ?? 5) * 2; i++) {
|
|
8617
|
+
const iconValue = (i + 1) / 2;
|
|
8618
|
+
htmlString += `<svg aria-hidden="true" ${iconValue === selectedValue ? "selected" : ""}><use href="#star"></use></svg>`;
|
|
8619
|
+
}
|
|
8620
|
+
return htmlString;
|
|
8621
|
+
}
|
|
8622
|
+
}
|
|
8623
|
+
__decorateClass$7([attr], RatingDisplay.prototype, "color", 2);
|
|
8624
|
+
__decorateClass$7([attr({
|
|
8625
|
+
mode: "boolean"
|
|
8626
|
+
})], RatingDisplay.prototype, "compact", 2);
|
|
8627
|
+
__decorateClass$7([attr({
|
|
8628
|
+
converter: nullableNumberConverter
|
|
8629
|
+
})], RatingDisplay.prototype, "count", 2);
|
|
8630
|
+
__decorateClass$7([attr({
|
|
8631
|
+
converter: nullableNumberConverter
|
|
8632
|
+
})], RatingDisplay.prototype, "max", 2);
|
|
8633
|
+
__decorateClass$7([attr], RatingDisplay.prototype, "size", 2);
|
|
8634
|
+
__decorateClass$7([attr({
|
|
8635
|
+
converter: nullableNumberConverter
|
|
8636
|
+
})], RatingDisplay.prototype, "value", 2);
|
|
8637
|
+
|
|
8638
|
+
const styles$9 = css`
|
|
8639
|
+
${display("inline-flex")}
|
|
8640
|
+
|
|
8641
|
+
:host{--icon-size:16px;align-items:center;color:${colorNeutralForeground1};font-family:${fontFamilyBase};font-size:${fontSizeBase200};line-height:${lineHeightBase200};contain:layout style;user-select:none}:host(${smallState}){--icon-size:12px}:host(${largeState}){--icon-size:20px;font-size:${fontSizeBase300};line-height:${lineHeightBase300}}svg{width:var(--icon-size);height:var(--icon-size);fill:${colorPaletteMarigoldBackground3};margin-inline-end:${spacingHorizontalXXS}}svg:nth-child(even){clip-path:inset(0 50% 0 0);margin-inline-end:calc(0px - var(--icon-size))}:host(${neutralState}) svg{fill:${colorNeutralForeground1}}:host(${brandState}) svg{fill:${colorBrandBackground}}:host(:is([value^='-'],[value='0'])) svg,:host(:not([value])) svg,svg[selected] ~ svg{fill:${colorPaletteMarigoldBackground2}}:host(${neutralState}:is([value^='-'],[value='0'])) svg,:host(${neutralState}:not([value])) svg,:host(${neutralState}) svg[selected] ~ svg{fill:${colorNeutralBackground1Pressed}}:host(${brandState}:is([value^='-'],[value='0'])) svg,:host(${brandState}:not([value])) svg,:host(${brandState}) svg[selected] ~ svg{fill:${colorBrandStroke2}}.value-label,::slotted([slot='value']){display:block;margin-inline-start:${spacingHorizontalXS};font-weight:${fontWeightSemibold}}:host(${smallState}) .value-label,:host(${smallState}) ::slotted([slot='value']){margin-inline-start:${spacingHorizontalXXS}}:host(${largeState}) .value-label,:host(${largeState}) ::slotted([slot='value']){margin-inline-start:${spacingHorizontalSNudge}}:host(:not([count])) .count-label{display:none}.count-label::before,::slotted([slot='count'])::before{content:'·';margin-inline:${spacingHorizontalXS}}:host(${smallState}) .count-label::before,:host(${smallState}) ::slotted([slot='count'])::before{margin-inline:${spacingHorizontalXXS}}:host(${largeState}) .count-label::before,:host(${largeState}) ::slotted([slot='count'])::before{margin-inline:${spacingHorizontalSNudge}}`.withBehaviors(forcedColorsStylesheetBehavior(css`
|
|
8642
|
+
:host([color]) svg{fill:CanvasText}:host([color]:is([value^='-'],[value='0'])) svg,:host(:not([value])) svg,:host([color]) svg[selected] ~ svg{fill:Canvas;stroke:CanvasText}`));
|
|
8643
|
+
|
|
8644
|
+
const star = html`<svg xmlns="http://www.w3.org/2000/svg" style="display: none"><symbol id="star" viewBox="0 0 12 12"><path d="M5.28347 1.54556C5.57692 0.95096 6.42479 0.950961 6.71825 1.54556L7.82997 3.79817L10.3159 4.15939C10.9721 4.25474 11.2341 5.06112 10.7592 5.52394L8.96043 7.27736L9.38507 9.75321C9.49716 10.4067 8.81122 10.9051 8.22431 10.5966L6.00086 9.42761L3.7774 10.5966C3.19049 10.9051 2.50455 10.4067 2.61664 9.75321L3.04128 7.27736L1.24246 5.52394C0.767651 5.06111 1.02966 4.25474 1.68584 4.15939L4.17174 3.79817L5.28347 1.54556Z" /></symbol></svg>`;
|
|
8645
|
+
function ratingDisplayTemplate() {
|
|
8646
|
+
return html` ${star} ${x => html`${html.partial(x.generateIcons())}`}<slot name="value"><span class="value-label" aria-hidden="true">${x => x.value}</span></slot><slot name="count"><span class="count-label" aria-hidden="true">${x => x.formattedCount}</span></slot>`;
|
|
8647
|
+
}
|
|
8648
|
+
const template$9 = ratingDisplayTemplate();
|
|
8649
|
+
|
|
8650
|
+
const definition$9 = RatingDisplay.compose({
|
|
8651
|
+
name: `${FluentDesignSystem.prefix}-rating-display`,
|
|
8652
|
+
template: template$9,
|
|
8653
|
+
styles: styles$9
|
|
8654
|
+
});
|
|
8655
|
+
|
|
8656
|
+
definition$9.define(FluentDesignSystem.registry);
|
|
8657
|
+
|
|
8658
|
+
Orientation;
|
|
8659
|
+
const SliderMode = {
|
|
8660
|
+
singleValue: "single-value"
|
|
8661
|
+
};
|
|
8662
|
+
|
|
8663
|
+
const proxySlotName = "form-associated-proxy";
|
|
8664
|
+
const ElementInternalsKey = "ElementInternals";
|
|
8665
|
+
const supportsElementInternals = ElementInternalsKey in window && "setFormValue" in window[ElementInternalsKey].prototype;
|
|
8666
|
+
const InternalsMap = /* @__PURE__ */new WeakMap();
|
|
8667
|
+
function FormAssociated(BaseCtor) {
|
|
8668
|
+
const C = class extends BaseCtor {
|
|
8669
|
+
constructor(...args) {
|
|
8670
|
+
super(...args);
|
|
8671
|
+
/**
|
|
8672
|
+
* Track whether the value has been changed from the initial value
|
|
8673
|
+
*/
|
|
8674
|
+
this.dirtyValue = false;
|
|
8675
|
+
/**
|
|
8676
|
+
* The initial value of the form. This value sets the `value` property
|
|
8677
|
+
* only when the `value` property has not been explicitly set.
|
|
8678
|
+
*
|
|
8679
|
+
* @remarks
|
|
8680
|
+
* HTML Attribute: value
|
|
8681
|
+
*/
|
|
8682
|
+
this.initialValue = "";
|
|
8683
|
+
/**
|
|
8684
|
+
* Sets the element's disabled state. A disabled element will not be included during form submission.
|
|
8685
|
+
*
|
|
8686
|
+
* @remarks
|
|
8687
|
+
* HTML Attribute: disabled
|
|
8688
|
+
*/
|
|
8689
|
+
this.disabled = false;
|
|
8690
|
+
/**
|
|
8691
|
+
* These are events that are still fired by the proxy
|
|
8692
|
+
* element based on user / programmatic interaction.
|
|
8693
|
+
*
|
|
8694
|
+
* The proxy implementation should be transparent to
|
|
8695
|
+
* the app author, so block these events from emitting.
|
|
8696
|
+
*/
|
|
8697
|
+
this.proxyEventsToBlock = ["change", "click"];
|
|
8698
|
+
this.proxyInitialized = false;
|
|
8699
|
+
this.required = false;
|
|
8700
|
+
this.initialValue = this.initialValue || "";
|
|
8701
|
+
if (!this.elementInternals) {
|
|
8702
|
+
this.formResetCallback = this.formResetCallback.bind(this);
|
|
8703
|
+
}
|
|
8704
|
+
}
|
|
8705
|
+
/**
|
|
8706
|
+
* Must evaluate to true to enable elementInternals.
|
|
8707
|
+
* Feature detects API support and resolve respectively
|
|
8708
|
+
*
|
|
8709
|
+
* @internal
|
|
8710
|
+
*/
|
|
8711
|
+
static get formAssociated() {
|
|
8712
|
+
return supportsElementInternals;
|
|
8713
|
+
}
|
|
8714
|
+
/**
|
|
8715
|
+
* Returns the validity state of the element
|
|
8716
|
+
*
|
|
8717
|
+
* @beta
|
|
8718
|
+
*/
|
|
8719
|
+
get validity() {
|
|
8720
|
+
return this.elementInternals ? this.elementInternals.validity : this.proxy.validity;
|
|
7929
8721
|
}
|
|
7930
8722
|
/**
|
|
7931
8723
|
* Retrieve a reference to the associated form.
|
|
@@ -8153,715 +8945,73 @@ function FormAssociated(BaseCtor) {
|
|
|
8153
8945
|
this.proxy.name = this.name;
|
|
8154
8946
|
}
|
|
8155
8947
|
if (typeof this.value === "string") {
|
|
8156
|
-
this.proxy.value = this.value;
|
|
8157
|
-
}
|
|
8158
|
-
this.proxy.setAttribute("slot", proxySlotName);
|
|
8159
|
-
this.proxySlot = document.createElement("slot");
|
|
8160
|
-
this.proxySlot.setAttribute("name", proxySlotName);
|
|
8161
|
-
}
|
|
8162
|
-
this.shadowRoot?.appendChild(this.proxySlot);
|
|
8163
|
-
this.appendChild(this.proxy);
|
|
8164
|
-
}
|
|
8165
|
-
/**
|
|
8166
|
-
* Detach the proxy element from the DOM
|
|
8167
|
-
*/
|
|
8168
|
-
detachProxy() {
|
|
8169
|
-
this.removeChild(this.proxy);
|
|
8170
|
-
this.shadowRoot?.removeChild(this.proxySlot);
|
|
8171
|
-
}
|
|
8172
|
-
/** {@inheritDoc (FormAssociated:interface).validate} */
|
|
8173
|
-
validate(anchor) {
|
|
8174
|
-
if (this.proxy instanceof HTMLElement) {
|
|
8175
|
-
this.setValidity(this.proxy.validity, this.proxy.validationMessage, anchor);
|
|
8176
|
-
}
|
|
8177
|
-
}
|
|
8178
|
-
/**
|
|
8179
|
-
* Associates the provided value (and optional state) with the parent form.
|
|
8180
|
-
* @param value - The value to set
|
|
8181
|
-
* @param state - The state object provided to during session restores and when autofilling.
|
|
8182
|
-
*/
|
|
8183
|
-
setFormValue(value, state) {
|
|
8184
|
-
if (this.elementInternals) {
|
|
8185
|
-
this.elementInternals.setFormValue(value, state || value);
|
|
8186
|
-
}
|
|
8187
|
-
}
|
|
8188
|
-
_keypressHandler(e) {
|
|
8189
|
-
switch (e.key) {
|
|
8190
|
-
case keyEnter:
|
|
8191
|
-
if (this.form instanceof HTMLFormElement) {
|
|
8192
|
-
const defaultButton = this.form.querySelector("[type=submit]");
|
|
8193
|
-
defaultButton?.click();
|
|
8194
|
-
}
|
|
8195
|
-
break;
|
|
8196
|
-
}
|
|
8197
|
-
}
|
|
8198
|
-
/**
|
|
8199
|
-
* Used to stop propagation of proxy element events
|
|
8200
|
-
* @param e - Event object
|
|
8201
|
-
*/
|
|
8202
|
-
stopPropagation(e) {
|
|
8203
|
-
e.stopPropagation();
|
|
8204
|
-
}
|
|
8205
|
-
};
|
|
8206
|
-
attr({
|
|
8207
|
-
mode: "boolean"
|
|
8208
|
-
})(C.prototype, "disabled");
|
|
8209
|
-
attr({
|
|
8210
|
-
mode: "fromView",
|
|
8211
|
-
attribute: "value"
|
|
8212
|
-
})(C.prototype, "initialValue");
|
|
8213
|
-
attr({
|
|
8214
|
-
attribute: "current-value"
|
|
8215
|
-
})(C.prototype, "currentValue");
|
|
8216
|
-
attr(C.prototype, "name");
|
|
8217
|
-
attr({
|
|
8218
|
-
mode: "boolean"
|
|
8219
|
-
})(C.prototype, "required");
|
|
8220
|
-
observable(C.prototype, "value");
|
|
8221
|
-
return C;
|
|
8222
|
-
}
|
|
8223
|
-
function CheckableFormAssociated(BaseCtor) {
|
|
8224
|
-
class C extends FormAssociated(BaseCtor) {}
|
|
8225
|
-
class D extends C {
|
|
8226
|
-
constructor(...args) {
|
|
8227
|
-
super(args);
|
|
8228
|
-
/**
|
|
8229
|
-
* Tracks whether the "checked" property has been changed.
|
|
8230
|
-
* This is necessary to provide consistent behavior with
|
|
8231
|
-
* normal input checkboxes
|
|
8232
|
-
*/
|
|
8233
|
-
this.dirtyChecked = false;
|
|
8234
|
-
/**
|
|
8235
|
-
* Provides the default checkedness of the input element
|
|
8236
|
-
* Passed down to proxy
|
|
8237
|
-
*
|
|
8238
|
-
* @public
|
|
8239
|
-
* @remarks
|
|
8240
|
-
* HTML Attribute: checked
|
|
8241
|
-
*/
|
|
8242
|
-
this.checkedAttribute = false;
|
|
8243
|
-
/**
|
|
8244
|
-
* The checked state of the control.
|
|
8245
|
-
*
|
|
8246
|
-
* @public
|
|
8247
|
-
*/
|
|
8248
|
-
this.checked = false;
|
|
8249
|
-
this.dirtyChecked = false;
|
|
8250
|
-
}
|
|
8251
|
-
checkedAttributeChanged() {
|
|
8252
|
-
this.defaultChecked = this.checkedAttribute;
|
|
8253
|
-
}
|
|
8254
|
-
/**
|
|
8255
|
-
* @internal
|
|
8256
|
-
*/
|
|
8257
|
-
defaultCheckedChanged() {
|
|
8258
|
-
if (!this.dirtyChecked) {
|
|
8259
|
-
this.checked = this.defaultChecked;
|
|
8260
|
-
this.dirtyChecked = false;
|
|
8261
|
-
}
|
|
8262
|
-
}
|
|
8263
|
-
checkedChanged(prev, next) {
|
|
8264
|
-
if (!this.dirtyChecked) {
|
|
8265
|
-
this.dirtyChecked = true;
|
|
8266
|
-
}
|
|
8267
|
-
this.currentChecked = this.checked;
|
|
8268
|
-
this.updateForm();
|
|
8269
|
-
if (this.proxy instanceof HTMLInputElement) {
|
|
8270
|
-
this.proxy.checked = this.checked;
|
|
8271
|
-
}
|
|
8272
|
-
if (prev !== void 0) {
|
|
8273
|
-
this.$emit("change");
|
|
8274
|
-
}
|
|
8275
|
-
this.validate();
|
|
8276
|
-
}
|
|
8277
|
-
currentCheckedChanged(prev, next) {
|
|
8278
|
-
this.checked = this.currentChecked;
|
|
8279
|
-
}
|
|
8280
|
-
updateForm() {
|
|
8281
|
-
const value = this.checked ? this.value : null;
|
|
8282
|
-
this.setFormValue(value, value);
|
|
8283
|
-
}
|
|
8284
|
-
connectedCallback() {
|
|
8285
|
-
super.connectedCallback();
|
|
8286
|
-
this.updateForm();
|
|
8287
|
-
}
|
|
8288
|
-
formResetCallback() {
|
|
8289
|
-
super.formResetCallback();
|
|
8290
|
-
this.checked = !!this.checkedAttribute;
|
|
8291
|
-
this.dirtyChecked = false;
|
|
8292
|
-
}
|
|
8293
|
-
}
|
|
8294
|
-
attr({
|
|
8295
|
-
attribute: "checked",
|
|
8296
|
-
mode: "boolean"
|
|
8297
|
-
})(D.prototype, "checkedAttribute");
|
|
8298
|
-
attr({
|
|
8299
|
-
attribute: "current-checked",
|
|
8300
|
-
converter: booleanConverter
|
|
8301
|
-
})(D.prototype, "currentChecked");
|
|
8302
|
-
observable(D.prototype, "defaultChecked");
|
|
8303
|
-
observable(D.prototype, "checked");
|
|
8304
|
-
return D;
|
|
8305
|
-
}
|
|
8306
|
-
|
|
8307
|
-
class _Radio extends FASTElement {}
|
|
8308
|
-
class FormAssociatedRadio extends CheckableFormAssociated(_Radio) {
|
|
8309
|
-
constructor() {
|
|
8310
|
-
super(...arguments);
|
|
8311
|
-
this.proxy = document.createElement("input");
|
|
8312
|
-
}
|
|
8313
|
-
}
|
|
8314
|
-
|
|
8315
|
-
var __defProp$9 = Object.defineProperty;
|
|
8316
|
-
var __getOwnPropDesc$9 = Object.getOwnPropertyDescriptor;
|
|
8317
|
-
var __decorateClass$9 = (decorators, target, key, kind) => {
|
|
8318
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$9(target, key) : target;
|
|
8319
|
-
for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
8320
|
-
if (kind && result) __defProp$9(target, key, result);
|
|
8321
|
-
return result;
|
|
8322
|
-
};
|
|
8323
|
-
class Radio extends FormAssociatedRadio {
|
|
8324
|
-
constructor() {
|
|
8325
|
-
super();
|
|
8326
|
-
/**
|
|
8327
|
-
* The element's value to be included in form submission when checked.
|
|
8328
|
-
* Default to "on" to reach parity with input[type="radio"]
|
|
8329
|
-
*
|
|
8330
|
-
* @internal
|
|
8331
|
-
*/
|
|
8332
|
-
this.initialValue = "on";
|
|
8333
|
-
this.proxy.setAttribute("type", "radio");
|
|
8334
|
-
}
|
|
8335
|
-
get radioGroup() {
|
|
8336
|
-
return this.closest("[role=radiogroup]");
|
|
8337
|
-
}
|
|
8338
|
-
/**
|
|
8339
|
-
* @internal
|
|
8340
|
-
*/
|
|
8341
|
-
defaultCheckedChanged() {
|
|
8342
|
-
if (this.$fastController.isConnected && !this.dirtyChecked) {
|
|
8343
|
-
if (!this.isInsideRadioGroup()) {
|
|
8344
|
-
this.checked = this.defaultChecked ?? false;
|
|
8345
|
-
this.dirtyChecked = false;
|
|
8346
|
-
}
|
|
8347
|
-
}
|
|
8348
|
-
}
|
|
8349
|
-
/**
|
|
8350
|
-
* @internal
|
|
8351
|
-
*/
|
|
8352
|
-
connectedCallback() {
|
|
8353
|
-
super.connectedCallback();
|
|
8354
|
-
this.validate();
|
|
8355
|
-
if (this.parentElement?.getAttribute("role") !== "radiogroup" && this.getAttribute("tabindex") === null) {
|
|
8356
|
-
if (!this.disabled) {
|
|
8357
|
-
this.setAttribute("tabindex", "0");
|
|
8358
|
-
}
|
|
8359
|
-
}
|
|
8360
|
-
if (this.checkedAttribute) {
|
|
8361
|
-
if (!this.dirtyChecked) {
|
|
8362
|
-
if (!this.isInsideRadioGroup()) {
|
|
8363
|
-
this.checked = this.defaultChecked ?? false;
|
|
8364
|
-
this.dirtyChecked = false;
|
|
8365
|
-
}
|
|
8366
|
-
}
|
|
8367
|
-
}
|
|
8368
|
-
}
|
|
8369
|
-
isInsideRadioGroup() {
|
|
8370
|
-
return this.radioGroup !== null;
|
|
8371
|
-
}
|
|
8372
|
-
/**
|
|
8373
|
-
* Handles key presses on the radio.
|
|
8374
|
-
* @beta
|
|
8375
|
-
*/
|
|
8376
|
-
keypressHandler(e) {
|
|
8377
|
-
switch (e.key) {
|
|
8378
|
-
case keySpace:
|
|
8379
|
-
if (!this.checked && !this.radioGroup?.readOnly) {
|
|
8380
|
-
this.checked = true;
|
|
8381
|
-
}
|
|
8382
|
-
return;
|
|
8383
|
-
}
|
|
8384
|
-
return true;
|
|
8385
|
-
}
|
|
8386
|
-
}
|
|
8387
|
-
__decorateClass$9([observable], Radio.prototype, "name", 2);
|
|
8388
|
-
__decorateClass$9([observable], Radio.prototype, "defaultSlottedNodes", 2);
|
|
8389
|
-
|
|
8390
|
-
const RadioGroupOrientation = Orientation;
|
|
8391
|
-
|
|
8392
|
-
var __defProp$8 = Object.defineProperty;
|
|
8393
|
-
var __getOwnPropDesc$8 = Object.getOwnPropertyDescriptor;
|
|
8394
|
-
var __decorateClass$8 = (decorators, target, key, kind) => {
|
|
8395
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$8(target, key) : target;
|
|
8396
|
-
for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
8397
|
-
if (kind && result) __defProp$8(target, key, result);
|
|
8398
|
-
return result;
|
|
8399
|
-
};
|
|
8400
|
-
class RadioGroup extends FASTElement {
|
|
8401
|
-
constructor() {
|
|
8402
|
-
super(...arguments);
|
|
8403
|
-
this.stacked = false;
|
|
8404
|
-
this.orientation = RadioGroupOrientation.horizontal;
|
|
8405
|
-
this.radioChangeHandler = e => {
|
|
8406
|
-
const changedRadio = e.target;
|
|
8407
|
-
if (changedRadio.checked) {
|
|
8408
|
-
this.slottedRadioButtons.forEach(radio => {
|
|
8409
|
-
if (radio instanceof Radio && radio !== changedRadio) {
|
|
8410
|
-
radio.checked = false;
|
|
8411
|
-
if (!this.isInsideFoundationToolbar) {
|
|
8412
|
-
radio.setAttribute("tabindex", "-1");
|
|
8413
|
-
}
|
|
8414
|
-
}
|
|
8415
|
-
});
|
|
8416
|
-
this.selectedRadio = changedRadio;
|
|
8417
|
-
this.value = changedRadio.value;
|
|
8418
|
-
changedRadio.setAttribute("tabindex", "0");
|
|
8419
|
-
this.focusedRadio = changedRadio;
|
|
8420
|
-
}
|
|
8421
|
-
e.stopPropagation();
|
|
8422
|
-
};
|
|
8423
|
-
this.moveToRadioByIndex = (group, index) => {
|
|
8424
|
-
const radio = group[index];
|
|
8425
|
-
if (!this.isInsideToolbar) {
|
|
8426
|
-
radio.setAttribute("tabindex", "0");
|
|
8427
|
-
radio.checked = true;
|
|
8428
|
-
this.selectedRadio = radio;
|
|
8429
|
-
}
|
|
8430
|
-
this.focusedRadio = radio;
|
|
8431
|
-
radio.focus();
|
|
8432
|
-
};
|
|
8433
|
-
this.moveRightOffGroup = () => {
|
|
8434
|
-
this.nextElementSibling?.focus();
|
|
8435
|
-
};
|
|
8436
|
-
this.moveLeftOffGroup = () => {
|
|
8437
|
-
this.previousElementSibling?.focus();
|
|
8438
|
-
};
|
|
8439
|
-
/**
|
|
8440
|
-
* @internal
|
|
8441
|
-
*/
|
|
8442
|
-
this.focusOutHandler = e => {
|
|
8443
|
-
const group = this.slottedRadioButtons;
|
|
8444
|
-
const radio = e.target;
|
|
8445
|
-
const index = radio !== null ? group.indexOf(radio) : 0;
|
|
8446
|
-
const focusedIndex = this.focusedRadio ? group.indexOf(this.focusedRadio) : -1;
|
|
8447
|
-
if (focusedIndex === 0 && index === focusedIndex || focusedIndex === group.length - 1 && focusedIndex === index) {
|
|
8448
|
-
if (!this.selectedRadio) {
|
|
8449
|
-
this.focusedRadio = group[0];
|
|
8450
|
-
this.focusedRadio.setAttribute("tabindex", "0");
|
|
8451
|
-
group.forEach(nextRadio => {
|
|
8452
|
-
if (radio instanceof Radio && nextRadio !== this.focusedRadio) {
|
|
8453
|
-
nextRadio.setAttribute("tabindex", "-1");
|
|
8454
|
-
}
|
|
8455
|
-
});
|
|
8456
|
-
} else {
|
|
8457
|
-
this.focusedRadio = this.selectedRadio;
|
|
8458
|
-
if (!this.isInsideFoundationToolbar) {
|
|
8459
|
-
this.selectedRadio.setAttribute("tabindex", "0");
|
|
8460
|
-
group.forEach(nextRadio => {
|
|
8461
|
-
if (nextRadio !== this.selectedRadio) {
|
|
8462
|
-
nextRadio.setAttribute("tabindex", "-1");
|
|
8463
|
-
}
|
|
8464
|
-
});
|
|
8465
|
-
}
|
|
8466
|
-
}
|
|
8467
|
-
}
|
|
8468
|
-
return true;
|
|
8469
|
-
};
|
|
8470
|
-
/**
|
|
8471
|
-
* @internal
|
|
8472
|
-
*/
|
|
8473
|
-
this.handleDisabledClick = e => {
|
|
8474
|
-
if (this.disabled) {
|
|
8475
|
-
e.preventDefault();
|
|
8476
|
-
return;
|
|
8477
|
-
}
|
|
8478
|
-
return true;
|
|
8479
|
-
};
|
|
8480
|
-
/**
|
|
8481
|
-
* @internal
|
|
8482
|
-
*/
|
|
8483
|
-
this.clickHandler = e => {
|
|
8484
|
-
if (this.disabled) {
|
|
8485
|
-
return;
|
|
8486
|
-
}
|
|
8487
|
-
e.preventDefault();
|
|
8488
|
-
const radio = e.target;
|
|
8489
|
-
if (radio && radio instanceof Radio) {
|
|
8490
|
-
radio.checked = true;
|
|
8491
|
-
radio.setAttribute("tabindex", "0");
|
|
8492
|
-
this.selectedRadio = radio;
|
|
8493
|
-
this.focusedRadio = radio;
|
|
8494
|
-
}
|
|
8495
|
-
};
|
|
8496
|
-
this.shouldMoveOffGroupToTheRight = (index, group, key) => {
|
|
8497
|
-
return index === group.length && this.isInsideToolbar && key === keyArrowRight;
|
|
8498
|
-
};
|
|
8499
|
-
this.shouldMoveOffGroupToTheLeft = (group, key) => {
|
|
8500
|
-
const index = this.focusedRadio ? group.indexOf(this.focusedRadio) - 1 : 0;
|
|
8501
|
-
return index < 0 && this.isInsideToolbar && key === keyArrowLeft;
|
|
8502
|
-
};
|
|
8503
|
-
this.checkFocusedRadio = () => {
|
|
8504
|
-
if (this.focusedRadio !== null && !this.focusedRadio.checked) {
|
|
8505
|
-
this.focusedRadio.checked = true;
|
|
8506
|
-
this.focusedRadio.setAttribute("tabindex", "0");
|
|
8507
|
-
this.focusedRadio.focus();
|
|
8508
|
-
this.selectedRadio = this.focusedRadio;
|
|
8509
|
-
}
|
|
8510
|
-
};
|
|
8511
|
-
this.moveRight = e => {
|
|
8512
|
-
const group = this.slottedRadioButtons;
|
|
8513
|
-
let index = 0;
|
|
8514
|
-
index = this.focusedRadio ? group.indexOf(this.focusedRadio) + 1 : 1;
|
|
8515
|
-
if (this.shouldMoveOffGroupToTheRight(index, group, e.key)) {
|
|
8516
|
-
this.moveRightOffGroup();
|
|
8517
|
-
return;
|
|
8518
|
-
} else if (index === group.length) {
|
|
8519
|
-
index = 0;
|
|
8520
|
-
}
|
|
8521
|
-
while (index < group.length && group.length > 1) {
|
|
8522
|
-
if (!group[index].disabled) {
|
|
8523
|
-
this.moveToRadioByIndex(group, index);
|
|
8524
|
-
break;
|
|
8525
|
-
} else if (this.focusedRadio && index === group.indexOf(this.focusedRadio)) {
|
|
8526
|
-
break;
|
|
8527
|
-
} else if (index + 1 >= group.length) {
|
|
8528
|
-
if (this.isInsideToolbar) {
|
|
8529
|
-
break;
|
|
8530
|
-
} else {
|
|
8531
|
-
index = 0;
|
|
8532
|
-
}
|
|
8533
|
-
} else {
|
|
8534
|
-
index += 1;
|
|
8535
|
-
}
|
|
8536
|
-
}
|
|
8537
|
-
};
|
|
8538
|
-
this.moveLeft = e => {
|
|
8539
|
-
const group = this.slottedRadioButtons;
|
|
8540
|
-
let index = 0;
|
|
8541
|
-
index = this.focusedRadio ? group.indexOf(this.focusedRadio) - 1 : 0;
|
|
8542
|
-
index = index < 0 ? group.length - 1 : index;
|
|
8543
|
-
if (this.shouldMoveOffGroupToTheLeft(group, e.key)) {
|
|
8544
|
-
this.moveLeftOffGroup();
|
|
8545
|
-
return;
|
|
8546
|
-
}
|
|
8547
|
-
while (index >= 0 && group.length > 1) {
|
|
8548
|
-
if (!group[index].disabled) {
|
|
8549
|
-
this.moveToRadioByIndex(group, index);
|
|
8550
|
-
break;
|
|
8551
|
-
} else if (this.focusedRadio && index === group.indexOf(this.focusedRadio)) {
|
|
8552
|
-
break;
|
|
8553
|
-
} else if (index - 1 < 0) {
|
|
8554
|
-
index = group.length - 1;
|
|
8555
|
-
} else {
|
|
8556
|
-
index -= 1;
|
|
8948
|
+
this.proxy.value = this.value;
|
|
8557
8949
|
}
|
|
8950
|
+
this.proxy.setAttribute("slot", proxySlotName);
|
|
8951
|
+
this.proxySlot = document.createElement("slot");
|
|
8952
|
+
this.proxySlot.setAttribute("name", proxySlotName);
|
|
8558
8953
|
}
|
|
8559
|
-
|
|
8954
|
+
this.shadowRoot?.appendChild(this.proxySlot);
|
|
8955
|
+
this.appendChild(this.proxy);
|
|
8956
|
+
}
|
|
8560
8957
|
/**
|
|
8561
|
-
*
|
|
8562
|
-
* navigation is different when there is an ancestor with role='toolbar'
|
|
8563
|
-
*
|
|
8564
|
-
* @internal
|
|
8958
|
+
* Detach the proxy element from the DOM
|
|
8565
8959
|
*/
|
|
8566
|
-
|
|
8567
|
-
|
|
8568
|
-
|
|
8569
|
-
return true;
|
|
8570
|
-
}
|
|
8571
|
-
switch (key) {
|
|
8572
|
-
case keyEnter:
|
|
8573
|
-
{
|
|
8574
|
-
this.checkFocusedRadio();
|
|
8575
|
-
break;
|
|
8576
|
-
}
|
|
8577
|
-
case keyArrowRight:
|
|
8578
|
-
case keyArrowDown:
|
|
8579
|
-
{
|
|
8580
|
-
if (this.direction === Direction.ltr) {
|
|
8581
|
-
this.moveRight(e);
|
|
8582
|
-
} else {
|
|
8583
|
-
this.moveLeft(e);
|
|
8584
|
-
}
|
|
8585
|
-
break;
|
|
8586
|
-
}
|
|
8587
|
-
case keyArrowLeft:
|
|
8588
|
-
case keyArrowUp:
|
|
8589
|
-
{
|
|
8590
|
-
if (this.direction === Direction.ltr) {
|
|
8591
|
-
this.moveLeft(e);
|
|
8592
|
-
} else {
|
|
8593
|
-
this.moveRight(e);
|
|
8594
|
-
}
|
|
8595
|
-
break;
|
|
8596
|
-
}
|
|
8597
|
-
default:
|
|
8598
|
-
{
|
|
8599
|
-
return true;
|
|
8600
|
-
}
|
|
8601
|
-
}
|
|
8602
|
-
};
|
|
8603
|
-
}
|
|
8604
|
-
nameChanged() {
|
|
8605
|
-
if (this.slottedRadioButtons) {
|
|
8606
|
-
this.slottedRadioButtons.forEach(radio => {
|
|
8607
|
-
radio.setAttribute("name", this.name);
|
|
8608
|
-
});
|
|
8609
|
-
}
|
|
8610
|
-
}
|
|
8611
|
-
valueChanged() {
|
|
8612
|
-
if (this.slottedRadioButtons) {
|
|
8613
|
-
this.slottedRadioButtons.forEach(radio => {
|
|
8614
|
-
if (radio instanceof Radio) {
|
|
8615
|
-
if (radio.value === this.value) {
|
|
8616
|
-
radio.checked = true;
|
|
8617
|
-
this.selectedRadio = radio;
|
|
8618
|
-
}
|
|
8619
|
-
}
|
|
8620
|
-
});
|
|
8960
|
+
detachProxy() {
|
|
8961
|
+
this.removeChild(this.proxy);
|
|
8962
|
+
this.shadowRoot?.removeChild(this.proxySlot);
|
|
8621
8963
|
}
|
|
8622
|
-
|
|
8623
|
-
|
|
8624
|
-
|
|
8625
|
-
|
|
8626
|
-
|
|
8964
|
+
/** {@inheritDoc (FormAssociated:interface).validate} */
|
|
8965
|
+
validate(anchor) {
|
|
8966
|
+
if (this.proxy instanceof HTMLElement) {
|
|
8967
|
+
this.setValidity(this.proxy.validity, this.proxy.validationMessage, anchor);
|
|
8968
|
+
}
|
|
8627
8969
|
}
|
|
8628
|
-
|
|
8629
|
-
|
|
8630
|
-
|
|
8631
|
-
|
|
8632
|
-
|
|
8633
|
-
|
|
8634
|
-
|
|
8635
|
-
|
|
8636
|
-
return !!this.parentToolbar?.hasOwnProperty("$fastController");
|
|
8637
|
-
}
|
|
8638
|
-
/**
|
|
8639
|
-
* @internal
|
|
8640
|
-
*/
|
|
8641
|
-
connectedCallback() {
|
|
8642
|
-
super.connectedCallback();
|
|
8643
|
-
this.direction = getDirection(this);
|
|
8644
|
-
this.setupRadioButtons();
|
|
8645
|
-
}
|
|
8646
|
-
disconnectedCallback() {
|
|
8647
|
-
this.slottedRadioButtons.forEach(radio => {
|
|
8648
|
-
if (radio instanceof Radio) {
|
|
8649
|
-
radio.removeEventListener("change", this.radioChangeHandler);
|
|
8970
|
+
/**
|
|
8971
|
+
* Associates the provided value (and optional state) with the parent form.
|
|
8972
|
+
* @param value - The value to set
|
|
8973
|
+
* @param state - The state object provided to during session restores and when autofilling.
|
|
8974
|
+
*/
|
|
8975
|
+
setFormValue(value, state) {
|
|
8976
|
+
if (this.elementInternals) {
|
|
8977
|
+
this.elementInternals.setFormValue(value, state || value);
|
|
8650
8978
|
}
|
|
8651
|
-
}
|
|
8652
|
-
|
|
8653
|
-
|
|
8654
|
-
|
|
8655
|
-
|
|
8656
|
-
|
|
8657
|
-
|
|
8658
|
-
if (numberOfCheckedRadios > 1) {
|
|
8659
|
-
const lastCheckedRadio = checkedRadios[numberOfCheckedRadios - 1];
|
|
8660
|
-
lastCheckedRadio.checked = true;
|
|
8661
|
-
}
|
|
8662
|
-
let foundMatchingVal = false;
|
|
8663
|
-
this.slottedRadioButtons.forEach(radio => {
|
|
8664
|
-
if (radio instanceof Radio) {
|
|
8665
|
-
if (this.name !== void 0) {
|
|
8666
|
-
radio.setAttribute("name", this.name);
|
|
8667
|
-
}
|
|
8668
|
-
if (this.value && this.value === radio.value) {
|
|
8669
|
-
this.selectedRadio = radio;
|
|
8670
|
-
this.focusedRadio = radio;
|
|
8671
|
-
radio.checked = true;
|
|
8672
|
-
radio.setAttribute("tabindex", "0");
|
|
8673
|
-
foundMatchingVal = true;
|
|
8674
|
-
} else {
|
|
8675
|
-
if (!this.isInsideFoundationToolbar) {
|
|
8676
|
-
radio.setAttribute("tabindex", "-1");
|
|
8979
|
+
}
|
|
8980
|
+
_keypressHandler(e) {
|
|
8981
|
+
switch (e.key) {
|
|
8982
|
+
case keyEnter:
|
|
8983
|
+
if (this.form instanceof HTMLFormElement) {
|
|
8984
|
+
const defaultButton = this.form.querySelector("[type=submit]");
|
|
8985
|
+
defaultButton?.click();
|
|
8677
8986
|
}
|
|
8678
|
-
|
|
8679
|
-
}
|
|
8680
|
-
radio.addEventListener("change", this.radioChangeHandler);
|
|
8681
|
-
}
|
|
8682
|
-
});
|
|
8683
|
-
if (this.value === void 0 && this.slottedRadioButtons.length > 0) {
|
|
8684
|
-
const checkedRadios2 = this.slottedRadioButtons.filter(radio => {
|
|
8685
|
-
return radio.hasAttribute("checked");
|
|
8686
|
-
});
|
|
8687
|
-
const numberOfCheckedRadios2 = checkedRadios2 !== null ? checkedRadios2.length : 0;
|
|
8688
|
-
if (numberOfCheckedRadios2 > 0 && !foundMatchingVal) {
|
|
8689
|
-
const lastCheckedRadio = checkedRadios2[numberOfCheckedRadios2 - 1];
|
|
8690
|
-
lastCheckedRadio.checked = true;
|
|
8691
|
-
this.focusedRadio = lastCheckedRadio;
|
|
8692
|
-
lastCheckedRadio.setAttribute("tabindex", "0");
|
|
8693
|
-
} else {
|
|
8694
|
-
this.slottedRadioButtons[0].setAttribute("tabindex", "0");
|
|
8695
|
-
this.focusedRadio = this.slottedRadioButtons[0];
|
|
8987
|
+
break;
|
|
8696
8988
|
}
|
|
8697
8989
|
}
|
|
8698
|
-
}
|
|
8699
|
-
}
|
|
8700
|
-
__decorateClass$8([attr({
|
|
8701
|
-
mode: "boolean"
|
|
8702
|
-
})], RadioGroup.prototype, "stacked", 2);
|
|
8703
|
-
__decorateClass$8([attr({
|
|
8704
|
-
attribute: "readonly",
|
|
8705
|
-
mode: "boolean"
|
|
8706
|
-
})], RadioGroup.prototype, "readOnly", 2);
|
|
8707
|
-
__decorateClass$8([attr({
|
|
8708
|
-
attribute: "disabled",
|
|
8709
|
-
mode: "boolean"
|
|
8710
|
-
})], RadioGroup.prototype, "disabled", 2);
|
|
8711
|
-
__decorateClass$8([attr], RadioGroup.prototype, "name", 2);
|
|
8712
|
-
__decorateClass$8([attr], RadioGroup.prototype, "value", 2);
|
|
8713
|
-
__decorateClass$8([attr], RadioGroup.prototype, "orientation", 2);
|
|
8714
|
-
__decorateClass$8([observable], RadioGroup.prototype, "childItems", 2);
|
|
8715
|
-
__decorateClass$8([observable], RadioGroup.prototype, "slottedRadioButtons", 2);
|
|
8716
|
-
|
|
8717
|
-
const styles$b = css`
|
|
8718
|
-
${display("flex")}
|
|
8719
|
-
|
|
8720
|
-
:host{align-items:flex-start;flex-direction:column;row-gap:${spacingVerticalS}}:host([disabled]) ::slotted([role='radio']){--control-border-color:${colorNeutralForegroundDisabled};--checked-indicator-background-color:${colorNeutralForegroundDisabled};--state-color:${colorNeutralForegroundDisabled}}::slotted([slot='label']){color:${colorNeutralForeground1};padding:${spacingVerticalS} ${spacingHorizontalS} ${spacingVerticalS} ${spacingHorizontalXS};font:${fontWeightRegular} ${fontSizeBase300} / ${lineHeightBase300} ${fontFamilyBase};cursor:default}.positioning-region{display:flex;flex-wrap:wrap}:host([orientation='vertical']) .positioning-region{flex-direction:column;justify-content:flex-start}:host([orientation='horizontal']) .positioning-region{flex-direction:row}:host([orientation='horizontal']) ::slotted([role='radio']){padding-inline-end:${spacingHorizontalS}}:host([orientation='horizontal'][stacked]) ::slotted([role='radio']){display:flex;flex-direction:column;padding-inline:${spacingHorizontalS};height:auto;align-items:center;justify-content:center}:host([disabled]) ::slotted([role='radio']){pointer-events:none}`;
|
|
8721
|
-
|
|
8722
|
-
function radioGroupTemplate() {
|
|
8723
|
-
return html`<template role="radiogroup" tabindex="${x => x.disabled ? -1 : void 0}" aria-disabled="${x => x.disabled}" aria-readonly="${x => x.readOnly}" aria-orientation="${x => x.orientation}" @click="${(x, c) => x.clickHandler(c.event)}" @mousedown="${(x, c) => x.handleDisabledClick(c.event)}" @keydown="${(x, c) => x.keydownHandler(c.event)}" @focusout="${(x, c) => x.focusOutHandler(c.event)}"><slot name="label"></slot><div class="positioning-region ${x => x.orientation === RadioGroupOrientation.horizontal ? "horizontal" : "vertical"}" part="positioning-region"><slot ${slotted({
|
|
8724
|
-
property: "slottedRadioButtons",
|
|
8725
|
-
filter: elements("[role=radio]")
|
|
8726
|
-
})}></slot></div></template>`;
|
|
8727
|
-
}
|
|
8728
|
-
const template$b = radioGroupTemplate();
|
|
8729
|
-
|
|
8730
|
-
const definition$b = RadioGroup.compose({
|
|
8731
|
-
name: `${FluentDesignSystem.prefix}-radio-group`,
|
|
8732
|
-
template: template$b,
|
|
8733
|
-
styles: styles$b
|
|
8734
|
-
});
|
|
8735
|
-
|
|
8736
|
-
definition$b.define(FluentDesignSystem.registry);
|
|
8737
|
-
|
|
8738
|
-
const styles$a = css`
|
|
8739
|
-
${display("inline-grid")}
|
|
8740
|
-
|
|
8741
|
-
:host{grid-auto-flow:column;grid-template-columns:max-content;gap:${spacingHorizontalXS};align-items:center;height:32px;cursor:pointer;outline:none;position:relative;user-select:none;color:blue;color:var(--state-color,${colorNeutralForeground3});padding-inline-end:${spacingHorizontalS};--control-border-color:${colorNeutralStrokeAccessible};--checked-indicator-background-color:${colorCompoundBrandForeground1};--state-color:${colorNeutralForeground3}}:host([disabled]){--control-border-color:${colorNeutralForegroundDisabled};--checked-indicator-background-color:${colorNeutralForegroundDisabled};--state-color:${colorNeutralForegroundDisabled}}.label{cursor:pointer;font-family:${fontFamilyBase};font-size:${fontSizeBase300};font-weight:${fontWeightRegular};line-height:${lineHeightBase300}}.label__hidden{display:none}.control{box-sizing:border-box;align-items:center;border:1px solid var(--control-border-color,${colorNeutralStrokeAccessible});border-radius:${borderRadiusCircular};display:flex;height:16px;justify-content:center;margin:${spacingVerticalS} ${spacingHorizontalS};position:relative;width:16px;justify-self:center}.checked-indicator{border-radius:${borderRadiusCircular};height:10px;opacity:0;width:10px}:host([aria-checked='false']:hover) .control{color:${colorNeutralForeground2}}:host(:focus-visible){border-radius:${borderRadiusSmall};box-shadow:0 0 0 3px ${colorStrokeFocus2};outline:1px solid ${colorStrokeFocus1}}:host(:hover) .control{border-color:${colorNeutralStrokeAccessibleHover}}:host(:active) .control{border-color:${colorNeutralStrokeAccessiblePressed}}:host([aria-checked='true']) .checked-indicator{opacity:1}:host([aria-checked='true']) .control{border-color:var(--control-border-color,${colorNeutralStrokeAccessible})}:host([aria-checked='true']) .checked-indicator{background-color:var(--checked-indicator-background-color,${colorCompoundBrandForeground1})}:host([aria-checked='true']:hover) .control{border-color:${colorCompoundBrandStrokeHover}}:host([aria-checked='true']:hover) .checked-indicator{background-color:${colorCompoundBrandStrokeHover}}:host([aria-checked='true']:active) .control{border-color:${colorCompoundBrandStrokePressed}}:host([aria-checked='true']:active) .checked-indicator{background:${colorCompoundBrandForeground1Pressed}}:host([disabled]){color:${colorNeutralForegroundDisabled};pointer-events:none}:host([disabled]) .control{pointer-events:none;border-color:${colorNeutralForegroundDisabled}}:host([disabled]) .checked-indicator{background:${colorNeutralForegroundDisabled}}`.withBehaviors(forcedColorsStylesheetBehavior(css`
|
|
8742
|
-
:host .control{border-color:InactiveBorder}:host([aria-checked='true']) .checked-indicator,:host([aria-checked='true']:active) .checked-indicator,:host([aria-checked='true']:hover) .checked-indicator{background-color:Highlight;border-color:ActiveBorder}`));
|
|
8743
|
-
|
|
8744
|
-
function radioTemplate(options = {}) {
|
|
8745
|
-
return html`<template role="radio" aria-checked="${x => x.checked}" aria-required="${x => x.required}" aria-disabled="${x => x.disabled}" @keypress="${(x, c) => x.keypressHandler(c.event)}"><div part="control" class="control"><slot name="checked-indicator">${staticallyCompose(options.checkedIndicator)}</slot></div><label part="label" class="${x => ["label", !x.defaultSlottedNodes?.length && "label__hidden"].filter(Boolean).join(" ")}"><slot ${slotted({
|
|
8746
|
-
property: "defaultSlottedNodes",
|
|
8747
|
-
filter: whitespaceFilter
|
|
8748
|
-
})}></slot></label></template>`;
|
|
8749
|
-
}
|
|
8750
|
-
const template$a = radioTemplate({
|
|
8751
|
-
checkedIndicator: html`<div part="checked-indicator" class="checked-indicator"></div>`
|
|
8752
|
-
});
|
|
8753
|
-
|
|
8754
|
-
const definition$a = Radio.compose({
|
|
8755
|
-
name: `${FluentDesignSystem.prefix}-radio`,
|
|
8756
|
-
template: template$a,
|
|
8757
|
-
styles: styles$a
|
|
8758
|
-
});
|
|
8759
|
-
|
|
8760
|
-
definition$a.define(FluentDesignSystem.registry);
|
|
8761
|
-
|
|
8762
|
-
var __defProp$7 = Object.defineProperty;
|
|
8763
|
-
var __getOwnPropDesc$7 = Object.getOwnPropertyDescriptor;
|
|
8764
|
-
var __decorateClass$7 = (decorators, target, key, kind) => {
|
|
8765
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$7(target, key) : target;
|
|
8766
|
-
for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
8767
|
-
if (kind && result) __defProp$7(target, key, result);
|
|
8768
|
-
return result;
|
|
8769
|
-
};
|
|
8770
|
-
class RatingDisplay extends FASTElement {
|
|
8771
|
-
constructor() {
|
|
8772
|
-
super();
|
|
8773
8990
|
/**
|
|
8774
|
-
*
|
|
8775
|
-
*
|
|
8776
|
-
* @internal
|
|
8991
|
+
* Used to stop propagation of proxy element events
|
|
8992
|
+
* @param e - Event object
|
|
8777
8993
|
*/
|
|
8778
|
-
|
|
8779
|
-
|
|
8780
|
-
this.intlNumberFormatter = new Intl.NumberFormat();
|
|
8781
|
-
this.elementInternals.role = "img";
|
|
8782
|
-
}
|
|
8783
|
-
/**
|
|
8784
|
-
* Handles changes to the color attribute.
|
|
8785
|
-
*
|
|
8786
|
-
* @param prev - The previous state
|
|
8787
|
-
* @param next - The next state
|
|
8788
|
-
*/
|
|
8789
|
-
colorChanged(prev, next) {
|
|
8790
|
-
if (prev) toggleState(this.elementInternals, prev, false);
|
|
8791
|
-
if (next) toggleState(this.elementInternals, next, true);
|
|
8792
|
-
}
|
|
8793
|
-
/**
|
|
8794
|
-
* Handles changes to the size attribute.
|
|
8795
|
-
*
|
|
8796
|
-
* @param prev - The previous state
|
|
8797
|
-
* @param next - The next state
|
|
8798
|
-
*/
|
|
8799
|
-
sizeChanged(prev, next) {
|
|
8800
|
-
if (prev) toggleState(this.elementInternals, prev, false);
|
|
8801
|
-
if (next) toggleState(this.elementInternals, next, true);
|
|
8802
|
-
}
|
|
8803
|
-
/**
|
|
8804
|
-
* Returns "count" as string, formatted according to the locale.
|
|
8805
|
-
*
|
|
8806
|
-
* @internal
|
|
8807
|
-
*/
|
|
8808
|
-
get formattedCount() {
|
|
8809
|
-
return this.count ? this.intlNumberFormatter.format(this.count) : "";
|
|
8810
|
-
}
|
|
8811
|
-
/**
|
|
8812
|
-
* Generates the icon SVG elements based on the "max" attribute.
|
|
8813
|
-
*
|
|
8814
|
-
* @internal
|
|
8815
|
-
*/
|
|
8816
|
-
generateIcons() {
|
|
8817
|
-
let htmlString = "";
|
|
8818
|
-
const selectedValue = Math.round((this.compact ? 1 : this.value ?? 0) * 2) / 2;
|
|
8819
|
-
for (let i = 0; i < (this.compact ? 1 : this.max ?? 5) * 2; i++) {
|
|
8820
|
-
const iconValue = (i + 1) / 2;
|
|
8821
|
-
htmlString += `<svg aria-hidden="true" ${iconValue === selectedValue ? "selected" : ""}><use href="#star"></use></svg>`;
|
|
8994
|
+
stopPropagation(e) {
|
|
8995
|
+
e.stopPropagation();
|
|
8822
8996
|
}
|
|
8823
|
-
|
|
8824
|
-
|
|
8825
|
-
|
|
8826
|
-
|
|
8827
|
-
|
|
8828
|
-
|
|
8829
|
-
|
|
8830
|
-
|
|
8831
|
-
|
|
8832
|
-
|
|
8833
|
-
|
|
8834
|
-
|
|
8835
|
-
|
|
8836
|
-
|
|
8837
|
-
|
|
8838
|
-
|
|
8839
|
-
|
|
8840
|
-
|
|
8841
|
-
const styles$9 = css`
|
|
8842
|
-
${display("inline-flex")}
|
|
8843
|
-
|
|
8844
|
-
:host{--icon-size:16px;align-items:center;color:${colorNeutralForeground1};font-family:${fontFamilyBase};font-size:${fontSizeBase200};line-height:${lineHeightBase200};contain:layout style;user-select:none}:host(${smallState}){--icon-size:12px}:host(${largeState}){--icon-size:20px;font-size:${fontSizeBase300};line-height:${lineHeightBase300}}svg{width:var(--icon-size);height:var(--icon-size);fill:${colorPaletteMarigoldBackground3};margin-inline-end:${spacingHorizontalXXS}}svg:nth-child(even){clip-path:inset(0 50% 0 0);margin-inline-end:calc(0px - var(--icon-size))}:host(${neutralState}) svg{fill:${colorNeutralForeground1}}:host(${brandState}) svg{fill:${colorBrandBackground}}:host(:is([value^='-'],[value='0'])) svg,:host(:not([value])) svg,svg[selected] ~ svg{fill:${colorPaletteMarigoldBackground2}}:host(${neutralState}:is([value^='-'],[value='0'])) svg,:host(${neutralState}:not([value])) svg,:host(${neutralState}) svg[selected] ~ svg{fill:${colorNeutralBackground1Pressed}}:host(${brandState}:is([value^='-'],[value='0'])) svg,:host(${brandState}:not([value])) svg,:host(${brandState}) svg[selected] ~ svg{fill:${colorBrandStroke2}}.value-label,::slotted([slot='value']){display:block;margin-inline-start:${spacingHorizontalXS};font-weight:${fontWeightSemibold}}:host(${smallState}) .value-label,:host(${smallState}) ::slotted([slot='value']){margin-inline-start:${spacingHorizontalXXS}}:host(${largeState}) .value-label,:host(${largeState}) ::slotted([slot='value']){margin-inline-start:${spacingHorizontalSNudge}}:host(:not([count])) .count-label{display:none}.count-label::before,::slotted([slot='count'])::before{content:'·';margin-inline:${spacingHorizontalXS}}:host(${smallState}) .count-label::before,:host(${smallState}) ::slotted([slot='count'])::before{margin-inline:${spacingHorizontalXXS}}:host(${largeState}) .count-label::before,:host(${largeState}) ::slotted([slot='count'])::before{margin-inline:${spacingHorizontalSNudge}}`.withBehaviors(forcedColorsStylesheetBehavior(css`
|
|
8845
|
-
:host([color]) svg{fill:CanvasText}:host([color]:is([value^='-'],[value='0'])) svg,:host(:not([value])) svg,:host([color]) svg[selected] ~ svg{fill:Canvas;stroke:CanvasText}`));
|
|
8846
|
-
|
|
8847
|
-
const star = html`<svg xmlns="http://www.w3.org/2000/svg" style="display: none"><symbol id="star" viewBox="0 0 12 12"><path d="M5.28347 1.54556C5.57692 0.95096 6.42479 0.950961 6.71825 1.54556L7.82997 3.79817L10.3159 4.15939C10.9721 4.25474 11.2341 5.06112 10.7592 5.52394L8.96043 7.27736L9.38507 9.75321C9.49716 10.4067 8.81122 10.9051 8.22431 10.5966L6.00086 9.42761L3.7774 10.5966C3.19049 10.9051 2.50455 10.4067 2.61664 9.75321L3.04128 7.27736L1.24246 5.52394C0.767651 5.06111 1.02966 4.25474 1.68584 4.15939L4.17174 3.79817L5.28347 1.54556Z" /></symbol></svg>`;
|
|
8848
|
-
function ratingDisplayTemplate() {
|
|
8849
|
-
return html` ${star} ${x => html`${html.partial(x.generateIcons())}`}<slot name="value"><span class="value-label" aria-hidden="true">${x => x.value}</span></slot><slot name="count"><span class="count-label" aria-hidden="true">${x => x.formattedCount}</span></slot>`;
|
|
8997
|
+
};
|
|
8998
|
+
attr({
|
|
8999
|
+
mode: "boolean"
|
|
9000
|
+
})(C.prototype, "disabled");
|
|
9001
|
+
attr({
|
|
9002
|
+
mode: "fromView",
|
|
9003
|
+
attribute: "value"
|
|
9004
|
+
})(C.prototype, "initialValue");
|
|
9005
|
+
attr({
|
|
9006
|
+
attribute: "current-value"
|
|
9007
|
+
})(C.prototype, "currentValue");
|
|
9008
|
+
attr(C.prototype, "name");
|
|
9009
|
+
attr({
|
|
9010
|
+
mode: "boolean"
|
|
9011
|
+
})(C.prototype, "required");
|
|
9012
|
+
observable(C.prototype, "value");
|
|
9013
|
+
return C;
|
|
8850
9014
|
}
|
|
8851
|
-
const template$9 = ratingDisplayTemplate();
|
|
8852
|
-
|
|
8853
|
-
const definition$9 = RatingDisplay.compose({
|
|
8854
|
-
name: `${FluentDesignSystem.prefix}-rating-display`,
|
|
8855
|
-
template: template$9,
|
|
8856
|
-
styles: styles$9
|
|
8857
|
-
});
|
|
8858
|
-
|
|
8859
|
-
definition$9.define(FluentDesignSystem.registry);
|
|
8860
|
-
|
|
8861
|
-
Orientation;
|
|
8862
|
-
const SliderMode = {
|
|
8863
|
-
singleValue: "single-value"
|
|
8864
|
-
};
|
|
8865
9015
|
|
|
8866
9016
|
class _Slider extends FASTElement {}
|
|
8867
9017
|
class FormAssociatedSlider extends FormAssociated(_Slider) {
|
|
@@ -9324,7 +9474,12 @@ const definition$7 = Spinner.compose({
|
|
|
9324
9474
|
|
|
9325
9475
|
definition$7.define(FluentDesignSystem.registry);
|
|
9326
9476
|
|
|
9327
|
-
class Switch extends BaseCheckbox {
|
|
9477
|
+
class Switch extends BaseCheckbox {
|
|
9478
|
+
constructor() {
|
|
9479
|
+
super();
|
|
9480
|
+
this.elementInternals.role = "switch";
|
|
9481
|
+
}
|
|
9482
|
+
}
|
|
9328
9483
|
|
|
9329
9484
|
function switchTemplate(options = {}) {
|
|
9330
9485
|
return html`<template tabindex="${x => !x.disabled ? 0 : void 0}" @click="${(x, c) => x.clickHandler(c.event)}" @input="${(x, c) => x.inputHandler(c.event)}" @keydown="${(x, c) => x.keydownHandler(c.event)}" @keyup="${(x, c) => x.keyupHandler(c.event)}"><slot name="switch">${staticallyCompose(options.switch)}</slot></template>`;
|
|
@@ -9333,7 +9488,6 @@ const template$6 = switchTemplate({
|
|
|
9333
9488
|
switch: `<span class="checked-indicator" part="checked-indicator"></span>`
|
|
9334
9489
|
});
|
|
9335
9490
|
|
|
9336
|
-
const checkedState = css.partial`:is([state--checked], :state(checked))`;
|
|
9337
9491
|
const styles$6 = css`
|
|
9338
9492
|
${display("inline-flex")}
|
|
9339
9493
|
|