@fluentui/web-components 3.0.0-beta.30 → 3.0.0-beta.31
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 +12 -2
- package/dist/dts/anchor-button/anchor-button.d.ts +38 -3
- package/dist/dts/anchor-button/anchor-button.options.d.ts +0 -1
- package/dist/dts/badge/badge.d.ts +30 -0
- package/dist/dts/button/button.d.ts +25 -1
- package/dist/dts/button/button.options.d.ts +0 -1
- package/dist/dts/compound-button/compound-button.options.d.ts +0 -5
- package/dist/dts/counter-badge/counter-badge.d.ts +36 -0
- package/dist/dts/menu-button/menu-button.options.d.ts +0 -1
- package/dist/dts/styles/states/index.d.ts +110 -0
- package/dist/dts/toggle-button/toggle-button.options.d.ts +0 -1
- package/dist/esm/anchor-button/anchor-button.js +76 -8
- package/dist/esm/anchor-button/anchor-button.js.map +1 -1
- package/dist/esm/anchor-button/anchor-button.styles.js +8 -1
- package/dist/esm/anchor-button/anchor-button.styles.js.map +1 -1
- package/dist/esm/anchor-button/anchor-button.template.js +2 -2
- package/dist/esm/anchor-button/anchor-button.template.js.map +1 -1
- package/dist/esm/badge/badge.js +59 -0
- package/dist/esm/badge/badge.js.map +1 -1
- package/dist/esm/badge/badge.styles.js +6 -5
- package/dist/esm/badge/badge.styles.js.map +1 -1
- package/dist/esm/button/button.js +48 -0
- package/dist/esm/button/button.js.map +1 -1
- package/dist/esm/button/button.options.js +0 -1
- package/dist/esm/button/button.options.js.map +1 -1
- package/dist/esm/button/button.styles.js +40 -49
- package/dist/esm/button/button.styles.js.map +1 -1
- package/dist/esm/compound-button/compound-button.styles.js +14 -15
- package/dist/esm/compound-button/compound-button.styles.js.map +1 -1
- package/dist/esm/counter-badge/counter-badge.js +67 -0
- package/dist/esm/counter-badge/counter-badge.js.map +1 -1
- package/dist/esm/counter-badge/counter-badge.styles.js +12 -6
- package/dist/esm/counter-badge/counter-badge.styles.js.map +1 -1
- package/dist/esm/link/link.styles.js +6 -0
- package/dist/esm/link/link.styles.js.map +1 -1
- package/dist/esm/link/link.template.js +2 -2
- package/dist/esm/link/link.template.js.map +1 -1
- package/dist/esm/styles/partials/badge.partials.js +43 -42
- package/dist/esm/styles/partials/badge.partials.js.map +1 -1
- package/dist/esm/styles/states/index.js +112 -0
- package/dist/esm/styles/states/index.js.map +1 -0
- package/dist/esm/toggle-button/toggle-button.js +2 -1
- package/dist/esm/toggle-button/toggle-button.js.map +1 -1
- package/dist/esm/toggle-button/toggle-button.styles.js +24 -23
- package/dist/esm/toggle-button/toggle-button.styles.js.map +1 -1
- package/dist/web-components.d.ts +129 -13
- package/dist/web-components.js +343 -80
- package/dist/web-components.min.js +305 -304
- package/package.json +3 -2
package/dist/web-components.js
CHANGED
|
@@ -4177,6 +4177,20 @@ const definition$u = Accordion.compose({
|
|
|
4177
4177
|
|
|
4178
4178
|
definition$u.define(FluentDesignSystem.registry);
|
|
4179
4179
|
|
|
4180
|
+
const CustomStatesSetSupported = CSS.supports("selector(:state(g))");
|
|
4181
|
+
function toggleState(elementInternals, state, force) {
|
|
4182
|
+
if (!CustomStatesSetSupported) {
|
|
4183
|
+
elementInternals.shadowRoot.host.toggleAttribute(`state--${state}`, force);
|
|
4184
|
+
return;
|
|
4185
|
+
}
|
|
4186
|
+
force = force ?? !elementInternals.states.has(state);
|
|
4187
|
+
if (force) {
|
|
4188
|
+
elementInternals.states.add(state);
|
|
4189
|
+
return;
|
|
4190
|
+
}
|
|
4191
|
+
elementInternals.states.delete(state);
|
|
4192
|
+
}
|
|
4193
|
+
|
|
4180
4194
|
const ButtonType = {
|
|
4181
4195
|
submit: "submit",
|
|
4182
4196
|
reset: "reset",
|
|
@@ -4205,6 +4219,11 @@ var __decorateClass$p = (decorators, target, key, kind) => {
|
|
|
4205
4219
|
class BaseAnchor extends FASTElement {
|
|
4206
4220
|
constructor() {
|
|
4207
4221
|
super();
|
|
4222
|
+
/**
|
|
4223
|
+
* Holds a reference to the platform to manage ctrl+click on Windows and cmd+click on Mac
|
|
4224
|
+
* @internal
|
|
4225
|
+
*/
|
|
4226
|
+
this.isMac = navigator.userAgent.includes("Mac");
|
|
4208
4227
|
/**
|
|
4209
4228
|
* The internal {@link https://developer.mozilla.org/docs/Web/API/ElementInternals | `ElementInternals`} instance for the component.
|
|
4210
4229
|
*
|
|
@@ -4250,24 +4269,38 @@ class BaseAnchor extends FASTElement {
|
|
|
4250
4269
|
* @param e - The event object
|
|
4251
4270
|
* @internal
|
|
4252
4271
|
*/
|
|
4253
|
-
clickHandler() {
|
|
4254
|
-
this.
|
|
4272
|
+
clickHandler(e) {
|
|
4273
|
+
if (this.href) {
|
|
4274
|
+
const newTab = !this.isMac ? e.ctrlKey : e.metaKey;
|
|
4275
|
+
this.handleNavigation(newTab);
|
|
4276
|
+
}
|
|
4255
4277
|
return true;
|
|
4256
4278
|
}
|
|
4257
4279
|
/**
|
|
4258
|
-
* Handles
|
|
4280
|
+
* Handles keydown events for the anchor.
|
|
4259
4281
|
*
|
|
4260
4282
|
* @param e - the keyboard event
|
|
4261
4283
|
* @returns - the return value of the click handler
|
|
4262
4284
|
* @public
|
|
4263
4285
|
*/
|
|
4264
|
-
|
|
4265
|
-
if (
|
|
4266
|
-
|
|
4267
|
-
|
|
4286
|
+
keydownHandler(e) {
|
|
4287
|
+
if (this.href) {
|
|
4288
|
+
if (e.key === keyEnter) {
|
|
4289
|
+
const newTab = !this.isMac ? e.ctrlKey : e.metaKey || e.ctrlKey;
|
|
4290
|
+
this.handleNavigation(newTab);
|
|
4291
|
+
return;
|
|
4292
|
+
}
|
|
4268
4293
|
}
|
|
4269
4294
|
return true;
|
|
4270
4295
|
}
|
|
4296
|
+
/**
|
|
4297
|
+
* Handles navigation based on input
|
|
4298
|
+
* If the metaKey is pressed, opens the href in a new window, if false, uses the click on the proxy
|
|
4299
|
+
* @internal
|
|
4300
|
+
*/
|
|
4301
|
+
handleNavigation(newTab) {
|
|
4302
|
+
newTab ? window.open(this.href, "_blank") : this.internalProxyAnchor.click();
|
|
4303
|
+
}
|
|
4271
4304
|
/**
|
|
4272
4305
|
* A method for updating proxy attributes when attributes have changed
|
|
4273
4306
|
* @internal
|
|
@@ -4283,7 +4316,8 @@ class BaseAnchor extends FASTElement {
|
|
|
4283
4316
|
}
|
|
4284
4317
|
createProxyElement() {
|
|
4285
4318
|
const proxy = this.internalProxyAnchor ?? document.createElement("a");
|
|
4286
|
-
proxy.
|
|
4319
|
+
proxy.ariaHidden = "true";
|
|
4320
|
+
proxy.tabIndex = -1;
|
|
4287
4321
|
return proxy;
|
|
4288
4322
|
}
|
|
4289
4323
|
}
|
|
@@ -4300,6 +4334,53 @@ class AnchorButton extends BaseAnchor {
|
|
|
4300
4334
|
super(...arguments);
|
|
4301
4335
|
this.iconOnly = false;
|
|
4302
4336
|
}
|
|
4337
|
+
/**
|
|
4338
|
+
* Handles changes to appearance attribute custom states
|
|
4339
|
+
* @param prev - the previous state
|
|
4340
|
+
* @param next - the next state
|
|
4341
|
+
*/
|
|
4342
|
+
appearanceChanged(prev, next) {
|
|
4343
|
+
if (prev) {
|
|
4344
|
+
toggleState(this.elementInternals, `${prev}`, false);
|
|
4345
|
+
}
|
|
4346
|
+
if (next) {
|
|
4347
|
+
toggleState(this.elementInternals, `${next}`, true);
|
|
4348
|
+
}
|
|
4349
|
+
}
|
|
4350
|
+
/**
|
|
4351
|
+
* Handles changes to shape attribute custom states
|
|
4352
|
+
* @param prev - the previous state
|
|
4353
|
+
* @param next - the next state
|
|
4354
|
+
*/
|
|
4355
|
+
shapeChanged(prev, next) {
|
|
4356
|
+
if (prev) {
|
|
4357
|
+
toggleState(this.elementInternals, `${prev}`, false);
|
|
4358
|
+
}
|
|
4359
|
+
if (next) {
|
|
4360
|
+
toggleState(this.elementInternals, `${next}`, true);
|
|
4361
|
+
}
|
|
4362
|
+
}
|
|
4363
|
+
/**
|
|
4364
|
+
* Handles changes to size attribute custom states
|
|
4365
|
+
* @param prev - the previous state
|
|
4366
|
+
* @param next - the next state
|
|
4367
|
+
*/
|
|
4368
|
+
sizeChanged(prev, next) {
|
|
4369
|
+
if (prev) {
|
|
4370
|
+
toggleState(this.elementInternals, `${prev}`, false);
|
|
4371
|
+
}
|
|
4372
|
+
if (next) {
|
|
4373
|
+
toggleState(this.elementInternals, `${next}`, true);
|
|
4374
|
+
}
|
|
4375
|
+
}
|
|
4376
|
+
/**
|
|
4377
|
+
* Handles changes to icon only custom states
|
|
4378
|
+
* @param prev - the previous state
|
|
4379
|
+
* @param next - the next state
|
|
4380
|
+
*/
|
|
4381
|
+
iconOnlyChanged(prev, next) {
|
|
4382
|
+
toggleState(this.elementInternals, "icon", !!next);
|
|
4383
|
+
}
|
|
4303
4384
|
}
|
|
4304
4385
|
__decorateClass$p([attr], AnchorButton.prototype, "appearance", 2);
|
|
4305
4386
|
__decorateClass$p([attr], AnchorButton.prototype, "shape", 2);
|
|
@@ -4310,21 +4391,47 @@ __decorateClass$p([attr({
|
|
|
4310
4391
|
})], AnchorButton.prototype, "iconOnly", 2);
|
|
4311
4392
|
applyMixins(AnchorButton, StartEnd);
|
|
4312
4393
|
|
|
4394
|
+
const ghostState = css.partial`:is([state--ghost], :state(ghost))`;
|
|
4395
|
+
const primaryState = css.partial`:is([state--primary], :state(primary))`;
|
|
4396
|
+
const outlineState = css.partial`:is([state--outline], :state(outline))`;
|
|
4397
|
+
const subtleState = css.partial`:is([state--subtle], :state(subtle))`;
|
|
4398
|
+
const tintState = css.partial`:is([state--tint], :state(tint))`;
|
|
4399
|
+
const transparentState = css.partial`:is([state--transparent], :state(transparent))`;
|
|
4400
|
+
const circularState = css.partial`:is([state--circular], :state(circular))`;
|
|
4401
|
+
const roundedState = css.partial`:is([state--rounded], :state(rounded))`;
|
|
4402
|
+
const squareState = css.partial`:is([state--square], :state(square))`;
|
|
4403
|
+
const tinyState = css.partial`:is([state--tiny], :state(tiny))`;
|
|
4404
|
+
const extraSmallState = css.partial`:is([state--extra-small], :state(extra-small))`;
|
|
4405
|
+
const smallState = css.partial`:is([state--small], :state(small))`;
|
|
4406
|
+
const largeState = css.partial`:is([state--large], :state(large))`;
|
|
4407
|
+
const extraLargeState = css.partial`:is([state--extra-large], :state(extra-large))`;
|
|
4408
|
+
const iconOnlyState = css.partial`:is([state--icon], :state(icon))`;
|
|
4409
|
+
const pressedState = css.partial`:is([state--pressed], :state(pressed))`;
|
|
4410
|
+
const dangerState = css.partial`:is([state--danger], :state(danger))`;
|
|
4411
|
+
const importantState = css.partial`:is([state--important], :state(important))`;
|
|
4412
|
+
const informativeState = css.partial`:is([state--informative], :state(informative))`;
|
|
4413
|
+
const severeState = css.partial`:is([state--severe], :state(severe))`;
|
|
4414
|
+
const successState = css.partial`:is([state--success], :state(success))`;
|
|
4415
|
+
const warningState = css.partial`:is([state--warning], :state(warning))`;
|
|
4416
|
+
|
|
4313
4417
|
const baseButtonStyles = css`
|
|
4314
4418
|
${display("inline-flex")}
|
|
4315
4419
|
|
|
4316
|
-
:host{--icon-spacing:${spacingHorizontalSNudge};contain:layout style;vertical-align:middle;align-items:center;box-sizing:border-box;justify-content:center;text-align:center;text-decoration-line:none;margin:0;min-height:32px;outline-style:none;background-color:${colorNeutralBackground1};color:${colorNeutralForeground1};border:${strokeWidthThin} solid ${colorNeutralStroke1};padding:0 ${spacingHorizontalM};min-width:96px;border-radius:${borderRadiusMedium};font-size:${fontSizeBase300};font-family:${fontFamilyBase};font-weight:${fontWeightSemibold};line-height:${lineHeightBase300};transition-duration:${durationFaster};transition-property:background,border,color;transition-timing-function:${curveEasyEase};cursor:pointer;user-select:none}.content{display:inherit}:host(:hover){background-color:${colorNeutralBackground1Hover};color:${colorNeutralForeground1Hover};border-color:${colorNeutralStroke1Hover}}:host(:hover:active){background-color:${colorNeutralBackground1Pressed};border-color:${colorNeutralStroke1Pressed};color:${colorNeutralForeground1Pressed};outline-style:none}:host(:focus-visible){border-color:${colorTransparentStroke};outline:${strokeWidthThick} solid ${colorTransparentStroke};box-shadow:${shadow4},0 0 0 2px ${colorStrokeFocus2}}@media screen and (prefers-reduced-motion:reduce){transition-duration:0.01ms}::slotted(svg){font-size:20px;height:20px;width:20px;fill:currentColor}[slot='start'],::slotted([slot='start']){margin-inline-end:var(--icon-spacing)}[slot='end'],::slotted([slot='end']){margin-inline-start:var(--icon-spacing)}:host(
|
|
4420
|
+
:host{--icon-spacing:${spacingHorizontalSNudge};position:relative;contain:layout style;vertical-align:middle;align-items:center;box-sizing:border-box;justify-content:center;text-align:center;text-decoration-line:none;margin:0;min-height:32px;outline-style:none;background-color:${colorNeutralBackground1};color:${colorNeutralForeground1};border:${strokeWidthThin} solid ${colorNeutralStroke1};padding:0 ${spacingHorizontalM};min-width:96px;border-radius:${borderRadiusMedium};font-size:${fontSizeBase300};font-family:${fontFamilyBase};font-weight:${fontWeightSemibold};line-height:${lineHeightBase300};transition-duration:${durationFaster};transition-property:background,border,color;transition-timing-function:${curveEasyEase};cursor:pointer;user-select:none}.content{display:inherit}:host(:hover){background-color:${colorNeutralBackground1Hover};color:${colorNeutralForeground1Hover};border-color:${colorNeutralStroke1Hover}}:host(:hover:active){background-color:${colorNeutralBackground1Pressed};border-color:${colorNeutralStroke1Pressed};color:${colorNeutralForeground1Pressed};outline-style:none}:host(:focus-visible){border-color:${colorTransparentStroke};outline:${strokeWidthThick} solid ${colorTransparentStroke};box-shadow:${shadow4},0 0 0 2px ${colorStrokeFocus2}}@media screen and (prefers-reduced-motion:reduce){transition-duration:0.01ms}::slotted(svg){font-size:20px;height:20px;width:20px;fill:currentColor}:is([slot='start'],::slotted([slot='start'])){margin-inline-end:var(--icon-spacing)}:is([slot='end'],::slotted([slot='end'])){margin-inline-start:var(--icon-spacing)}:host(${iconOnlyState}){min-width:32px;max-width:32px}:host(${smallState}){--icon-spacing:${spacingHorizontalXS};min-height:24px;min-width:64px;padding:0 ${spacingHorizontalS};border-radius:${borderRadiusSmall};font-size:${fontSizeBase200};line-height:${lineHeightBase200};font-weight:${fontWeightRegular}}:host(${smallState}${iconOnlyState}){min-width:24px;max-width:24px}:host(${largeState}){min-height:40px;border-radius:${borderRadiusLarge};padding:0 ${spacingHorizontalL};font-size:${fontSizeBase400};line-height:${lineHeightBase400}}:host(${largeState}${iconOnlyState}){min-width:40px;max-width:40px}:host(${largeState}) ::slotted(svg){font-size:24px;height:24px;width:24px}:host(:is(${circularState},${circularState}:focus-visible)){border-radius:${borderRadiusCircular}}:host(:is(${squareState},${squareState}:focus-visible)){border-radius:${borderRadiusNone}}:host(${primaryState}){background-color:${colorBrandBackground};color:${colorNeutralForegroundOnBrand};border-color:transparent}:host(${primaryState}:hover){background-color:${colorBrandBackgroundHover}}:host(${primaryState}:is(:hover,:hover:active)){border-color:transparent;color:${colorNeutralForegroundOnBrand}}:host(${primaryState}:hover:active){background-color:${colorBrandBackgroundPressed}}:host(${primaryState}:focus-visible){border-color:${colorNeutralForegroundOnBrand};box-shadow:${shadow2},0 0 0 2px ${colorStrokeFocus2}}:host(${outlineState}){background-color:${colorTransparentBackground}}:host(${outlineState}:hover){background-color:${colorTransparentBackgroundHover}}:host(${outlineState}:hover:active){background-color:${colorTransparentBackgroundPressed}}:host(${subtleState}){background-color:${colorSubtleBackground};color:${colorNeutralForeground2};border-color:transparent}:host(${subtleState}:hover){background-color:${colorSubtleBackgroundHover};color:${colorNeutralForeground2Hover};border-color:transparent}:host(${subtleState}:hover:active){background-color:${colorSubtleBackgroundPressed};color:${colorNeutralForeground2Pressed};border-color:transparent}:host(${subtleState}:hover) ::slotted(svg){fill:${colorNeutralForeground2BrandHover}}:host(${subtleState}:hover:active) ::slotted(svg){fill:${colorNeutralForeground2BrandPressed}}:host(${transparentState}){background-color:${colorTransparentBackground};color:${colorNeutralForeground2}}:host(${transparentState}:hover){background-color:${colorTransparentBackgroundHover};color:${colorNeutralForeground2BrandHover}}:host(${transparentState}:hover:active){background-color:${colorTransparentBackgroundPressed};color:${colorNeutralForeground2BrandPressed}}:host(:is(${transparentState},${transparentState}:is(:hover,:active))){border-color:transparent}`;
|
|
4317
4421
|
const styles$s = css`
|
|
4318
4422
|
${baseButtonStyles}
|
|
4319
4423
|
|
|
4320
|
-
:host(:is(
|
|
4424
|
+
:host(:is(:disabled,[disabled-focusable],[appearance]:disabled,[appearance][disabled-focusable])),:host(:is(:disabled,[disabled-focusable],[appearance]:disabled,[appearance][disabled-focusable]):hover),:host(:is(:disabled,[disabled-focusable],[appearance]:disabled,[appearance][disabled-focusable]):hover:active){background-color:${colorNeutralBackgroundDisabled};border-color:${colorNeutralStrokeDisabled};color:${colorNeutralForegroundDisabled};cursor:not-allowed}:host(${primaryState}:is(:disabled,[disabled-focusable])),:host(${primaryState}:is(:disabled,[disabled-focusable]):is(:hover,:hover:active)){border-color:transparent}:host(${outlineState}:is(:disabled,[disabled-focusable])),:host(${outlineState}:is(:disabled,[disabled-focusable]):is(:hover,:hover:active)){background-color:${colorTransparentBackground}}:host(${subtleState}:is(:disabled,[disabled-focusable])),:host(${subtleState}:is(:disabled,[disabled-focusable]):is(:hover,:hover:active)){background-color:${colorTransparentBackground};border-color:transparent}:host(${transparentState}:is(:disabled,[disabled-focusable])),:host(${transparentState}:is(:disabled,[disabled-focusable]):is(:hover,:hover:active)){border-color:transparent;background-color:${colorTransparentBackground}}`.withBehaviors(forcedColorsStylesheetBehavior(css`
|
|
4321
4425
|
:host{background:ButtonFace;color:ButtonText}:host(:is(:hover,:focus-visible)){border-color:Highlight}`));
|
|
4322
4426
|
|
|
4323
|
-
const styles$r =
|
|
4427
|
+
const styles$r = css`
|
|
4428
|
+
${baseButtonStyles}
|
|
4429
|
+
|
|
4430
|
+
::slotted(a){position:absolute;inset:0}`.withBehaviors(forcedColorsStylesheetBehavior(css`
|
|
4324
4431
|
:host{border-color:LinkText;color:LinkText}`));
|
|
4325
4432
|
|
|
4326
4433
|
function anchorTemplate$1(options = {}) {
|
|
4327
|
-
return html`<template tabindex="0" @click="${x => x.clickHandler()}" @
|
|
4434
|
+
return html`<template tabindex="0" @click="${(x, c) => x.clickHandler(c.event)}" @keydown="${(x, c) => x.keydownHandler(c.event)}">${startSlotTemplate(options)}<span class="content" part="content"><slot></slot></span>${endSlotTemplate(options)}</template>`;
|
|
4328
4435
|
}
|
|
4329
4436
|
const template$t = anchorTemplate$1();
|
|
4330
4437
|
|
|
@@ -4377,20 +4484,6 @@ function getInitials(displayName, isRtl, options) {
|
|
|
4377
4484
|
return getInitialsLatin(displayName, isRtl, options?.firstInitialOnly);
|
|
4378
4485
|
}
|
|
4379
4486
|
|
|
4380
|
-
const CustomStatesSetSupported = CSS.supports("selector(:state(g))");
|
|
4381
|
-
function toggleState(elementInternals, state, force) {
|
|
4382
|
-
if (!CustomStatesSetSupported) {
|
|
4383
|
-
elementInternals.shadowRoot.host.toggleAttribute(`state--${state}`, force);
|
|
4384
|
-
return;
|
|
4385
|
-
}
|
|
4386
|
-
force = force ?? !elementInternals.states.has(state);
|
|
4387
|
-
if (force) {
|
|
4388
|
-
elementInternals.states.add(state);
|
|
4389
|
-
return;
|
|
4390
|
-
}
|
|
4391
|
-
elementInternals.states.delete(state);
|
|
4392
|
-
}
|
|
4393
|
-
|
|
4394
4487
|
const AvatarNamedColor = {
|
|
4395
4488
|
darkRed: "dark-red",
|
|
4396
4489
|
cranberry: "cranberry",
|
|
@@ -4580,9 +4673,67 @@ var __decorateClass$n = (decorators, target, key, kind) => {
|
|
|
4580
4673
|
class Badge extends FASTElement {
|
|
4581
4674
|
constructor() {
|
|
4582
4675
|
super(...arguments);
|
|
4676
|
+
/**
|
|
4677
|
+
* The internal {@link https://developer.mozilla.org/docs/Web/API/ElementInternals | `ElementInternals`} instance for the component.
|
|
4678
|
+
*
|
|
4679
|
+
* @internal
|
|
4680
|
+
*/
|
|
4681
|
+
this.elementInternals = this.attachInternals();
|
|
4583
4682
|
this.appearance = BadgeAppearance.filled;
|
|
4584
4683
|
this.color = BadgeColor.brand;
|
|
4585
4684
|
}
|
|
4685
|
+
/**
|
|
4686
|
+
* Handles changes to appearance attribute custom states
|
|
4687
|
+
* @param prev - the previous state
|
|
4688
|
+
* @param next - the next state
|
|
4689
|
+
*/
|
|
4690
|
+
appearanceChanged(prev, next) {
|
|
4691
|
+
if (prev) {
|
|
4692
|
+
toggleState(this.elementInternals, `${prev}`, false);
|
|
4693
|
+
}
|
|
4694
|
+
if (next) {
|
|
4695
|
+
toggleState(this.elementInternals, `${next}`, true);
|
|
4696
|
+
}
|
|
4697
|
+
}
|
|
4698
|
+
/**
|
|
4699
|
+
* Handles changes to color attribute custom states
|
|
4700
|
+
* @param prev - the previous state
|
|
4701
|
+
* @param next - the next state
|
|
4702
|
+
*/
|
|
4703
|
+
colorChanged(prev, next) {
|
|
4704
|
+
if (prev) {
|
|
4705
|
+
toggleState(this.elementInternals, `${prev}`, false);
|
|
4706
|
+
}
|
|
4707
|
+
if (next) {
|
|
4708
|
+
toggleState(this.elementInternals, `${next}`, true);
|
|
4709
|
+
}
|
|
4710
|
+
}
|
|
4711
|
+
/**
|
|
4712
|
+
* Handles changes to shape attribute custom states
|
|
4713
|
+
* @param prev - the previous state
|
|
4714
|
+
* @param next - the next state
|
|
4715
|
+
*/
|
|
4716
|
+
shapeChanged(prev, next) {
|
|
4717
|
+
if (prev) {
|
|
4718
|
+
toggleState(this.elementInternals, `${prev}`, false);
|
|
4719
|
+
}
|
|
4720
|
+
if (next) {
|
|
4721
|
+
toggleState(this.elementInternals, `${next}`, true);
|
|
4722
|
+
}
|
|
4723
|
+
}
|
|
4724
|
+
/**
|
|
4725
|
+
* Handles changes to size attribute custom states
|
|
4726
|
+
* @param prev - the previous state
|
|
4727
|
+
* @param next - the next state
|
|
4728
|
+
*/
|
|
4729
|
+
sizeChanged(prev, next) {
|
|
4730
|
+
if (prev) {
|
|
4731
|
+
toggleState(this.elementInternals, `${prev}`, false);
|
|
4732
|
+
}
|
|
4733
|
+
if (next) {
|
|
4734
|
+
toggleState(this.elementInternals, `${next}`, true);
|
|
4735
|
+
}
|
|
4736
|
+
}
|
|
4586
4737
|
}
|
|
4587
4738
|
__decorateClass$n([attr], Badge.prototype, "appearance", 2);
|
|
4588
4739
|
__decorateClass$n([attr], Badge.prototype, "color", 2);
|
|
@@ -4615,7 +4766,7 @@ const badgeBaseStyles = css.partial`
|
|
|
4615
4766
|
font-size: 12px;
|
|
4616
4767
|
}
|
|
4617
4768
|
|
|
4618
|
-
:host(:not(
|
|
4769
|
+
:host(:not(${ghostState}))::after {
|
|
4619
4770
|
position: absolute;
|
|
4620
4771
|
content: '';
|
|
4621
4772
|
top: 0;
|
|
@@ -4629,7 +4780,7 @@ const badgeBaseStyles = css.partial`
|
|
|
4629
4780
|
}
|
|
4630
4781
|
`;
|
|
4631
4782
|
const badgeSizeStyles = css.partial`
|
|
4632
|
-
:host(
|
|
4783
|
+
:host(${tinyState}) {
|
|
4633
4784
|
width: 6px;
|
|
4634
4785
|
height: 6px;
|
|
4635
4786
|
font-size: 4px;
|
|
@@ -4637,10 +4788,10 @@ const badgeSizeStyles = css.partial`
|
|
|
4637
4788
|
padding-inline: 0;
|
|
4638
4789
|
min-width: unset;
|
|
4639
4790
|
}
|
|
4640
|
-
:host(
|
|
4791
|
+
:host(${tinyState}) ::slotted(svg) {
|
|
4641
4792
|
font-size: 6px;
|
|
4642
4793
|
}
|
|
4643
|
-
:host(
|
|
4794
|
+
:host(${extraSmallState}) {
|
|
4644
4795
|
width: 10px;
|
|
4645
4796
|
height: 10px;
|
|
4646
4797
|
font-size: 6px;
|
|
@@ -4648,191 +4799,191 @@ const badgeSizeStyles = css.partial`
|
|
|
4648
4799
|
padding-inline: 0;
|
|
4649
4800
|
min-width: unset;
|
|
4650
4801
|
}
|
|
4651
|
-
:host(
|
|
4802
|
+
:host(${extraSmallState}) ::slotted(svg) {
|
|
4652
4803
|
font-size: 10px;
|
|
4653
4804
|
}
|
|
4654
|
-
:host(
|
|
4805
|
+
:host(${smallState}) {
|
|
4655
4806
|
min-width: 16px;
|
|
4656
4807
|
height: 16px;
|
|
4657
4808
|
font-size: ${fontSizeBase100};
|
|
4658
4809
|
line-height: ${lineHeightBase100};
|
|
4659
4810
|
padding-inline: calc(${spacingHorizontalXXS} + ${textPadding});
|
|
4660
4811
|
}
|
|
4661
|
-
:host(
|
|
4812
|
+
:host(${smallState}) ::slotted(svg) {
|
|
4662
4813
|
font-size: 12px;
|
|
4663
4814
|
}
|
|
4664
|
-
:host(
|
|
4815
|
+
:host(${largeState}) {
|
|
4665
4816
|
min-width: 24px;
|
|
4666
4817
|
height: 24px;
|
|
4667
4818
|
font-size: ${fontSizeBase200};
|
|
4668
4819
|
line-height: ${lineHeightBase200};
|
|
4669
4820
|
padding-inline: calc(${spacingHorizontalXS} + ${textPadding});
|
|
4670
4821
|
}
|
|
4671
|
-
:host(
|
|
4822
|
+
:host(${largeState}) ::slotted(svg) {
|
|
4672
4823
|
font-size: 16px;
|
|
4673
4824
|
}
|
|
4674
|
-
:host(
|
|
4825
|
+
:host(${extraLargeState}) {
|
|
4675
4826
|
min-width: 32px;
|
|
4676
4827
|
height: 32px;
|
|
4677
4828
|
font-size: ${fontSizeBase200};
|
|
4678
4829
|
line-height: ${lineHeightBase200};
|
|
4679
4830
|
padding-inline: calc(${spacingHorizontalSNudge} + ${textPadding});
|
|
4680
4831
|
}
|
|
4681
|
-
:host(
|
|
4832
|
+
:host(${extraLargeState}) ::slotted(svg) {
|
|
4682
4833
|
font-size: 20px;
|
|
4683
4834
|
}
|
|
4684
4835
|
`;
|
|
4685
4836
|
const badgeFilledStyles = css.partial`
|
|
4686
|
-
:host(
|
|
4837
|
+
:host(${dangerState}) {
|
|
4687
4838
|
background-color: ${colorPaletteRedBackground3};
|
|
4688
4839
|
color: ${colorNeutralForegroundOnBrand};
|
|
4689
4840
|
}
|
|
4690
4841
|
|
|
4691
|
-
:host(
|
|
4842
|
+
:host(${importantState}) {
|
|
4692
4843
|
background-color: ${colorNeutralForeground1};
|
|
4693
4844
|
color: ${colorNeutralBackground1};
|
|
4694
4845
|
}
|
|
4695
4846
|
|
|
4696
|
-
:host(
|
|
4847
|
+
:host(${informativeState}) {
|
|
4697
4848
|
background-color: ${colorNeutralBackground5};
|
|
4698
4849
|
color: ${colorNeutralForeground3};
|
|
4699
4850
|
}
|
|
4700
4851
|
|
|
4701
|
-
:host(
|
|
4852
|
+
:host(${severeState}) {
|
|
4702
4853
|
background-color: ${colorPaletteDarkOrangeBackground3};
|
|
4703
4854
|
color: ${colorNeutralForegroundOnBrand};
|
|
4704
4855
|
}
|
|
4705
4856
|
|
|
4706
|
-
:host(
|
|
4857
|
+
:host(${subtleState}) {
|
|
4707
4858
|
background-color: ${colorNeutralBackground1};
|
|
4708
4859
|
color: ${colorNeutralForeground1};
|
|
4709
4860
|
}
|
|
4710
4861
|
|
|
4711
|
-
:host(
|
|
4862
|
+
:host(${successState}) {
|
|
4712
4863
|
background-color: ${colorPaletteGreenBackground3};
|
|
4713
4864
|
color: ${colorNeutralForegroundOnBrand};
|
|
4714
4865
|
}
|
|
4715
4866
|
|
|
4716
|
-
:host(
|
|
4867
|
+
:host(${warningState}) {
|
|
4717
4868
|
background-color: ${colorPaletteYellowBackground3};
|
|
4718
4869
|
color: ${colorNeutralForeground1Static};
|
|
4719
4870
|
}
|
|
4720
4871
|
`;
|
|
4721
4872
|
const badgeGhostStyles = css.partial`
|
|
4722
|
-
:host(
|
|
4873
|
+
:host(${ghostState}) {
|
|
4723
4874
|
color: ${colorBrandForeground1};
|
|
4724
4875
|
background-color: initial;
|
|
4725
4876
|
}
|
|
4726
4877
|
|
|
4727
|
-
:host(
|
|
4878
|
+
:host(${ghostState}${dangerState}) {
|
|
4728
4879
|
color: ${colorPaletteRedForeground3};
|
|
4729
4880
|
}
|
|
4730
4881
|
|
|
4731
|
-
:host(
|
|
4882
|
+
:host(${ghostState}${importantState}) {
|
|
4732
4883
|
color: ${colorNeutralForeground1};
|
|
4733
4884
|
}
|
|
4734
4885
|
|
|
4735
|
-
:host(
|
|
4886
|
+
:host(${ghostState}${informativeState}) {
|
|
4736
4887
|
color: ${colorNeutralForeground3};
|
|
4737
4888
|
}
|
|
4738
4889
|
|
|
4739
|
-
:host(
|
|
4890
|
+
:host(${ghostState}${severeState}) {
|
|
4740
4891
|
color: ${colorPaletteDarkOrangeForeground3};
|
|
4741
4892
|
}
|
|
4742
4893
|
|
|
4743
|
-
:host(
|
|
4894
|
+
:host(${ghostState}${subtleState}) {
|
|
4744
4895
|
color: ${colorNeutralForegroundInverted};
|
|
4745
4896
|
}
|
|
4746
4897
|
|
|
4747
|
-
:host(
|
|
4898
|
+
:host(${ghostState}${successState}) {
|
|
4748
4899
|
color: ${colorPaletteGreenForeground3};
|
|
4749
4900
|
}
|
|
4750
4901
|
|
|
4751
|
-
:host(
|
|
4902
|
+
:host(${ghostState}${warningState}) {
|
|
4752
4903
|
color: ${colorPaletteYellowForeground2};
|
|
4753
4904
|
}
|
|
4754
4905
|
`;
|
|
4755
4906
|
const badgeOutlineStyles = css.partial`
|
|
4756
|
-
:host(
|
|
4907
|
+
:host(${outlineState}) {
|
|
4757
4908
|
border-color: currentColor;
|
|
4758
4909
|
color: ${colorBrandForeground1};
|
|
4759
4910
|
background-color: initial;
|
|
4760
4911
|
}
|
|
4761
4912
|
|
|
4762
|
-
:host(
|
|
4913
|
+
:host(${outlineState}${dangerState}) {
|
|
4763
4914
|
color: ${colorPaletteRedForeground3};
|
|
4764
4915
|
}
|
|
4765
4916
|
|
|
4766
|
-
:host(
|
|
4917
|
+
:host(${outlineState}${importantState}) {
|
|
4767
4918
|
color: ${colorNeutralForeground3};
|
|
4768
4919
|
border-color: ${colorNeutralStrokeAccessible};
|
|
4769
4920
|
}
|
|
4770
4921
|
|
|
4771
|
-
:host(
|
|
4922
|
+
:host(${outlineState}${informativeState}) {
|
|
4772
4923
|
color: ${colorNeutralForeground3};
|
|
4773
4924
|
border-color: ${colorNeutralStroke2};
|
|
4774
4925
|
}
|
|
4775
4926
|
|
|
4776
|
-
:host(
|
|
4927
|
+
:host(${outlineState}${severeState}) {
|
|
4777
4928
|
color: ${colorPaletteDarkOrangeForeground3};
|
|
4778
4929
|
}
|
|
4779
4930
|
|
|
4780
|
-
:host(
|
|
4931
|
+
:host(${outlineState}${subtleState}) {
|
|
4781
4932
|
color: ${colorNeutralForegroundStaticInverted};
|
|
4782
4933
|
}
|
|
4783
4934
|
|
|
4784
|
-
:host(
|
|
4935
|
+
:host(${outlineState}${successState}) {
|
|
4785
4936
|
color: ${colorPaletteGreenForeground2};
|
|
4786
4937
|
}
|
|
4787
4938
|
|
|
4788
|
-
:host(
|
|
4939
|
+
:host(${outlineState}${warningState}) {
|
|
4789
4940
|
color: ${colorPaletteYellowForeground2};
|
|
4790
4941
|
}
|
|
4791
4942
|
`;
|
|
4792
4943
|
const badgeTintStyles = css.partial`
|
|
4793
|
-
:host(
|
|
4944
|
+
:host(${tintState}) {
|
|
4794
4945
|
background-color: ${colorBrandBackground2};
|
|
4795
4946
|
color: ${colorBrandForeground2};
|
|
4796
4947
|
border-color: ${colorBrandStroke2};
|
|
4797
4948
|
}
|
|
4798
4949
|
|
|
4799
|
-
:host(
|
|
4950
|
+
:host(${tintState}${dangerState}) {
|
|
4800
4951
|
background-color: ${colorPaletteRedBackground1};
|
|
4801
4952
|
color: ${colorPaletteRedForeground1};
|
|
4802
4953
|
border-color: ${colorPaletteRedBorder1};
|
|
4803
4954
|
}
|
|
4804
4955
|
|
|
4805
|
-
:host(
|
|
4956
|
+
:host(${tintState}${importantState}) {
|
|
4806
4957
|
background-color: ${colorNeutralForeground3};
|
|
4807
4958
|
color: ${colorNeutralBackground1};
|
|
4808
4959
|
border-color: ${colorTransparentStroke};
|
|
4809
4960
|
}
|
|
4810
4961
|
|
|
4811
|
-
:host(
|
|
4962
|
+
:host(${tintState}${informativeState}) {
|
|
4812
4963
|
background-color: ${colorNeutralBackground4};
|
|
4813
4964
|
color: ${colorNeutralForeground3};
|
|
4814
4965
|
border-color: ${colorNeutralStroke2};
|
|
4815
4966
|
}
|
|
4816
4967
|
|
|
4817
|
-
:host(
|
|
4968
|
+
:host(${tintState}${severeState}) {
|
|
4818
4969
|
background-color: ${colorPaletteDarkOrangeBackground1};
|
|
4819
4970
|
color: ${colorPaletteDarkOrangeForeground1};
|
|
4820
4971
|
border-color: ${colorPaletteDarkOrangeBorder1};
|
|
4821
4972
|
}
|
|
4822
4973
|
|
|
4823
|
-
:host(
|
|
4974
|
+
:host(${tintState}${subtleState}) {
|
|
4824
4975
|
background-color: ${colorNeutralBackground1};
|
|
4825
4976
|
color: ${colorNeutralForeground3};
|
|
4826
4977
|
border-color: ${colorNeutralStroke2};
|
|
4827
4978
|
}
|
|
4828
4979
|
|
|
4829
|
-
:host(
|
|
4980
|
+
:host(${tintState}${successState}) {
|
|
4830
4981
|
background-color: ${colorPaletteGreenBackground1};
|
|
4831
4982
|
color: ${colorPaletteGreenForeground1};
|
|
4832
4983
|
border-color: ${colorPaletteGreenBorder2};
|
|
4833
4984
|
}
|
|
4834
4985
|
|
|
4835
|
-
:host(
|
|
4986
|
+
:host(${tintState}${warningState}) {
|
|
4836
4987
|
background-color: ${colorPaletteYellowBackground1};
|
|
4837
4988
|
color: ${colorPaletteYellowForeground2};
|
|
4838
4989
|
border-color: ${colorPaletteYellowBorder1};
|
|
@@ -4943,7 +5094,7 @@ css.partial`
|
|
|
4943
5094
|
`;
|
|
4944
5095
|
|
|
4945
5096
|
const styles$p = css`
|
|
4946
|
-
:host(
|
|
5097
|
+
:host(${squareState}){border-radius:${borderRadiusNone}}:host(${roundedState}){border-radius:${borderRadiusMedium}}:host(${roundedState}${tinyState}),:host(${roundedState}${extraSmallState}),:host(${roundedState}${smallState}){border-radius:${borderRadiusSmall}}${badgeSizeStyles}
|
|
4947
5098
|
${badgeFilledStyles}
|
|
4948
5099
|
${badgeGhostStyles}
|
|
4949
5100
|
${badgeOutlineStyles}
|
|
@@ -4986,6 +5137,19 @@ class Button extends FASTElement {
|
|
|
4986
5137
|
this.iconOnly = false;
|
|
4987
5138
|
this.elementInternals.role = "button";
|
|
4988
5139
|
}
|
|
5140
|
+
/**
|
|
5141
|
+
* Handles changes to appearance attribute custom states
|
|
5142
|
+
* @param prev - the previous state
|
|
5143
|
+
* @param next - the next state
|
|
5144
|
+
*/
|
|
5145
|
+
appearanceChanged(prev, next) {
|
|
5146
|
+
if (prev) {
|
|
5147
|
+
toggleState(this.elementInternals, `${prev}`, false);
|
|
5148
|
+
}
|
|
5149
|
+
if (next) {
|
|
5150
|
+
toggleState(this.elementInternals, `${next}`, true);
|
|
5151
|
+
}
|
|
5152
|
+
}
|
|
4989
5153
|
/**
|
|
4990
5154
|
* Sets the element's internal disabled state when the element is focusable while disabled.
|
|
4991
5155
|
*
|
|
@@ -5006,6 +5170,14 @@ class Button extends FASTElement {
|
|
|
5006
5170
|
get form() {
|
|
5007
5171
|
return this.elementInternals.form;
|
|
5008
5172
|
}
|
|
5173
|
+
/**
|
|
5174
|
+
* Handles changes to icon only custom states
|
|
5175
|
+
* @param prev - the previous state
|
|
5176
|
+
* @param next - the next state
|
|
5177
|
+
*/
|
|
5178
|
+
iconOnlyChanged(prev, next) {
|
|
5179
|
+
toggleState(this.elementInternals, "icon", next);
|
|
5180
|
+
}
|
|
5009
5181
|
/**
|
|
5010
5182
|
* A reference to all associated label elements.
|
|
5011
5183
|
*
|
|
@@ -5014,6 +5186,32 @@ class Button extends FASTElement {
|
|
|
5014
5186
|
get labels() {
|
|
5015
5187
|
return Object.freeze(Array.from(this.elementInternals.labels));
|
|
5016
5188
|
}
|
|
5189
|
+
/**
|
|
5190
|
+
* Handles changes to shape attribute custom states
|
|
5191
|
+
* @param prev - the previous state
|
|
5192
|
+
* @param next - the next state
|
|
5193
|
+
*/
|
|
5194
|
+
shapeChanged(prev, next) {
|
|
5195
|
+
if (prev) {
|
|
5196
|
+
toggleState(this.elementInternals, `${prev}`, false);
|
|
5197
|
+
}
|
|
5198
|
+
if (next) {
|
|
5199
|
+
toggleState(this.elementInternals, `${next}`, true);
|
|
5200
|
+
}
|
|
5201
|
+
}
|
|
5202
|
+
/**
|
|
5203
|
+
* Handles changes to size attribute custom states
|
|
5204
|
+
* @param prev - the previous state
|
|
5205
|
+
* @param next - the next state
|
|
5206
|
+
*/
|
|
5207
|
+
sizeChanged(prev, next) {
|
|
5208
|
+
if (prev) {
|
|
5209
|
+
toggleState(this.elementInternals, `${prev}`, false);
|
|
5210
|
+
}
|
|
5211
|
+
if (next) {
|
|
5212
|
+
toggleState(this.elementInternals, `${next}`, true);
|
|
5213
|
+
}
|
|
5214
|
+
}
|
|
5017
5215
|
/**
|
|
5018
5216
|
* Removes the form submission fallback control when the type changes.
|
|
5019
5217
|
*
|
|
@@ -5633,10 +5831,8 @@ class CompoundButton extends Button {}
|
|
|
5633
5831
|
const styles$n = css`
|
|
5634
5832
|
${styles$s}
|
|
5635
5833
|
|
|
5636
|
-
:host,:host(:is([size])){gap:12px;height:auto;padding-top:14px;padding-inline:12px;padding-bottom:16px;font-size:${fontSizeBase300};line-height:${lineHeightBase300}}.content{display:flex;flex-direction:column;text-align:start}::slotted([slot='description']){color:${colorNeutralForeground2};line-height:100%;font-size:${fontSizeBase200};font-weight:${fontWeightRegular}}::slotted(svg),:host(
|
|
5637
|
-
::slotted([slot='description']){color:${
|
|
5638
|
-
::slotted([slot='description']),:host([appearance='transparent']) ::slotted([slot='description']){color:${colorNeutralForeground2}}:host([appearance='transparent']:hover) ::slotted([slot='description']){color:${colorNeutralForeground2BrandHover}}:host([appearance='transparent']:active) ::slotted([slot='description']){color:${colorNeutralForeground2BrandPressed}}:host(:is([disabled],[disabled][appearance],[disabled-focusable],[disabled-focusable][appearance]))
|
|
5639
|
-
::slotted([slot='description']){color:${colorNeutralForegroundDisabled}}:host([size='small']){padding:8px;padding-bottom:10px}:host([icon-only]){min-width:52px;max-width:52px;padding:${spacingHorizontalSNudge}}:host([icon-only][size='small']){min-width:48px;max-width:48px;padding:${spacingHorizontalXS}}:host([icon-only][size='large']){min-width:56px;max-width:56px;padding:${spacingHorizontalS}}:host([size='large']){padding-top:18px;padding-inline:16px;padding-bottom:20px;font-size:${fontSizeBase400};line-height:${lineHeightBase400}}:host([size='large']) ::slotted([slot='description']){font-size:${fontSizeBase300}}`;
|
|
5834
|
+
:host,:host(:is([size])){gap:12px;height:auto;padding-top:14px;padding-inline:12px;padding-bottom:16px;font-size:${fontSizeBase300};line-height:${lineHeightBase300}}.content{display:flex;flex-direction:column;text-align:start}::slotted([slot='description']){color:${colorNeutralForeground2};line-height:100%;font-size:${fontSizeBase200};font-weight:${fontWeightRegular}}::slotted(svg),:host(${largeState}) ::slotted(svg){font-size:40px;height:40px;width:40px}:host(:hover) ::slotted([slot='description']){color:${colorNeutralForeground2Hover}}:host(:active) ::slotted([slot='description']){color:${colorNeutralForeground2Pressed}}:host(:is(${primaryState},${primaryState}:hover,${primaryState}:active)) ::slotted([slot='description']){color:${colorNeutralForegroundOnBrand}}:host(:is(${subtleState},${subtleState}:hover,${subtleState}:active)) ::slotted([slot='description']),:host(${transparentState}) ::slotted([slot='description']){color:${colorNeutralForeground2}}:host(${transparentState}:hover) ::slotted([slot='description']){color:${colorNeutralForeground2BrandHover}}:host(${transparentState}:active) ::slotted([slot='description']){color:${colorNeutralForeground2BrandPressed}}:host(:is(:disabled,:disabled[appearance],[disabled-focusable],[disabled-focusable][appearance]))
|
|
5835
|
+
::slotted([slot='description']){color:${colorNeutralForegroundDisabled}}:host(${smallState}){padding:8px;padding-bottom:10px}:host(${iconOnlyState}){min-width:52px;max-width:52px;padding:${spacingHorizontalSNudge}}:host(${iconOnlyState}${smallState}){min-width:48px;max-width:48px;padding:${spacingHorizontalXS}}:host(${iconOnlyState}${largeState}){min-width:56px;max-width:56px;padding:${spacingHorizontalS}}:host(${largeState}){padding-top:18px;padding-inline:16px;padding-bottom:20px;font-size:${fontSizeBase400};line-height:${lineHeightBase400}}:host(${largeState}) ::slotted([slot='description']){font-size:${fontSizeBase300}}`;
|
|
5640
5836
|
|
|
5641
5837
|
function buttonTemplate(options = {}) {
|
|
5642
5838
|
return html`<template ?disabled="${x => x.disabled}" tabindex="${x => x.disabled ? -1 : 0}">${startSlotTemplate(options)}<span class="content" part="content"><slot ${slotted("defaultSlottedContent")}></slot><slot name="description"></slot></span>${endSlotTemplate(options)}</template>`;
|
|
@@ -5662,17 +5858,83 @@ var __decorateClass$k = (decorators, target, key, kind) => {
|
|
|
5662
5858
|
class CounterBadge extends FASTElement {
|
|
5663
5859
|
constructor() {
|
|
5664
5860
|
super(...arguments);
|
|
5861
|
+
/**
|
|
5862
|
+
* The internal {@link https://developer.mozilla.org/docs/Web/API/ElementInternals | `ElementInternals`} instance for the component.
|
|
5863
|
+
*
|
|
5864
|
+
* @internal
|
|
5865
|
+
*/
|
|
5866
|
+
this.elementInternals = this.attachInternals();
|
|
5665
5867
|
this.count = 0;
|
|
5666
5868
|
this.overflowCount = 99;
|
|
5667
5869
|
this.showZero = false;
|
|
5668
5870
|
this.dot = false;
|
|
5669
5871
|
}
|
|
5872
|
+
/**
|
|
5873
|
+
* Handles changes to appearance attribute custom states
|
|
5874
|
+
* @param prev - the previous state
|
|
5875
|
+
* @param next - the next state
|
|
5876
|
+
*/
|
|
5877
|
+
appearanceChanged(prev, next) {
|
|
5878
|
+
if (prev) {
|
|
5879
|
+
toggleState(this.elementInternals, `${prev}`, false);
|
|
5880
|
+
}
|
|
5881
|
+
if (next) {
|
|
5882
|
+
toggleState(this.elementInternals, `${next}`, true);
|
|
5883
|
+
}
|
|
5884
|
+
}
|
|
5885
|
+
/**
|
|
5886
|
+
* Handles changes to color attribute custom states
|
|
5887
|
+
* @param prev - the previous state
|
|
5888
|
+
* @param next - the next state
|
|
5889
|
+
*/
|
|
5890
|
+
colorChanged(prev, next) {
|
|
5891
|
+
if (prev) {
|
|
5892
|
+
toggleState(this.elementInternals, `${prev}`, false);
|
|
5893
|
+
}
|
|
5894
|
+
if (next) {
|
|
5895
|
+
toggleState(this.elementInternals, `${next}`, true);
|
|
5896
|
+
}
|
|
5897
|
+
}
|
|
5898
|
+
/**
|
|
5899
|
+
* Handles changes to shape attribute custom states
|
|
5900
|
+
* @param prev - the previous state
|
|
5901
|
+
* @param next - the next state
|
|
5902
|
+
*/
|
|
5903
|
+
shapeChanged(prev, next) {
|
|
5904
|
+
if (prev) {
|
|
5905
|
+
toggleState(this.elementInternals, `${prev}`, false);
|
|
5906
|
+
}
|
|
5907
|
+
if (next) {
|
|
5908
|
+
toggleState(this.elementInternals, `${next}`, true);
|
|
5909
|
+
}
|
|
5910
|
+
}
|
|
5911
|
+
/**
|
|
5912
|
+
* Handles changes to size attribute custom states
|
|
5913
|
+
* @param prev - the previous state
|
|
5914
|
+
* @param next - the next state
|
|
5915
|
+
*/
|
|
5916
|
+
sizeChanged(prev, next) {
|
|
5917
|
+
if (prev) {
|
|
5918
|
+
toggleState(this.elementInternals, `${prev}`, false);
|
|
5919
|
+
}
|
|
5920
|
+
if (next) {
|
|
5921
|
+
toggleState(this.elementInternals, `${next}`, true);
|
|
5922
|
+
}
|
|
5923
|
+
}
|
|
5670
5924
|
countChanged() {
|
|
5671
5925
|
this.setCount();
|
|
5672
5926
|
}
|
|
5673
5927
|
overflowCountChanged() {
|
|
5674
5928
|
this.setCount();
|
|
5675
5929
|
}
|
|
5930
|
+
/**
|
|
5931
|
+
* Handles changes to dot attribute custom states
|
|
5932
|
+
* @param prev - the previous state
|
|
5933
|
+
* @param next - the next state
|
|
5934
|
+
*/
|
|
5935
|
+
dotChanged(prev, next) {
|
|
5936
|
+
toggleState(this.elementInternals, "dot", !!next);
|
|
5937
|
+
}
|
|
5676
5938
|
/**
|
|
5677
5939
|
* @internal
|
|
5678
5940
|
* Function to set the count
|
|
@@ -5707,13 +5969,14 @@ __decorateClass$k([attr({
|
|
|
5707
5969
|
})], CounterBadge.prototype, "dot", 2);
|
|
5708
5970
|
applyMixins(CounterBadge, StartEnd);
|
|
5709
5971
|
|
|
5972
|
+
const dotState = css.partial`:is([state--dot], :state(dot))`;
|
|
5710
5973
|
const styles$m = css`
|
|
5711
|
-
:host(
|
|
5974
|
+
:host(${roundedState}){border-radius:${borderRadiusMedium}}:host(${roundedState}${tinyState}),:host(${roundedState}${extraSmallState}),:host(${roundedState}${smallState}){border-radius:${borderRadiusSmall}}${badgeSizeStyles}
|
|
5712
5975
|
${badgeFilledStyles}
|
|
5713
5976
|
${badgeGhostStyles}
|
|
5714
5977
|
${badgeBaseStyles}
|
|
5715
5978
|
|
|
5716
|
-
:host(
|
|
5979
|
+
:host(${dotState}),:host(${dotState}[appearance][size]){min-width:auto;width:6px;height:6px;padding:0}`;
|
|
5717
5980
|
|
|
5718
5981
|
function composeTemplate(options = {}) {
|
|
5719
5982
|
return badgeTemplate({
|
|
@@ -6263,11 +6526,11 @@ __decorateClass$d([attr({
|
|
|
6263
6526
|
const styles$f = css`
|
|
6264
6527
|
${display("inline")}
|
|
6265
6528
|
|
|
6266
|
-
:host{box-sizing:border-box;background-color:transparent;color:${colorBrandForegroundLink};cursor:pointer;font-family:${fontFamilyBase};font-size:${fontSizeBase300};font-weight:${fontWeightRegular};margin:0;padding:0;overflow:inherit;text-align:left;text-decoration:none;text-decoration-thinkness:${strokeWidthThin};text-overflow:inherit;user-select:text}:host(:is(:hover,:focus-visible)){outline:none;text-decoration-line:underline}@media (hover:hover){:host(:hover){color:${colorBrandForegroundLinkHover}}:host(:active){color:${colorBrandForegroundLinkPressed}}:host([appearance='subtle']:hover){color:${colorNeutralForeground2LinkHover}}:host([appearance='subtle']:active){color:${colorNeutralForeground2LinkPressed}}}:host([appearance='subtle']){color:${colorNeutralForeground2Link}}:host-context(:is(h1,h2,h3,h4,h5,h6,p,fluent-text)),:host([inline]){font:inherit;text-decoration:underline}:host(:not([href])){color:inherit;text-decoration:none}`.withBehaviors(forcedColorsStylesheetBehavior(css`
|
|
6529
|
+
:host{position:relative;box-sizing:border-box;background-color:transparent;color:${colorBrandForegroundLink};cursor:pointer;font-family:${fontFamilyBase};font-size:${fontSizeBase300};font-weight:${fontWeightRegular};margin:0;padding:0;overflow:inherit;text-align:left;text-decoration:none;text-decoration-thinkness:${strokeWidthThin};text-overflow:inherit;user-select:text}:host(:is(:hover,:focus-visible)){outline:none;text-decoration-line:underline}@media (hover:hover){:host(:hover){color:${colorBrandForegroundLinkHover}}:host(:active){color:${colorBrandForegroundLinkPressed}}:host([appearance='subtle']:hover){color:${colorNeutralForeground2LinkHover}}:host([appearance='subtle']:active){color:${colorNeutralForeground2LinkPressed}}}:host([appearance='subtle']){color:${colorNeutralForeground2Link}}:host-context(:is(h1,h2,h3,h4,h5,h6,p,fluent-text)),:host([inline]){font:inherit;text-decoration:underline}:host(:not([href])){color:inherit;text-decoration:none}::slotted(a){position:absolute;inset:0}`.withBehaviors(forcedColorsStylesheetBehavior(css`
|
|
6267
6530
|
:host{color:LinkText}`));
|
|
6268
6531
|
|
|
6269
6532
|
function anchorTemplate() {
|
|
6270
|
-
return html`<template tabindex="0" @click="${x => x.clickHandler()}" @
|
|
6533
|
+
return html`<template tabindex="0" @click="${(x, c) => x.clickHandler(c.event)}" @keydown="${(x, c) => x.keydownHandler(c.event)}"><slot></slot></template>`;
|
|
6271
6534
|
}
|
|
6272
6535
|
const template$g = anchorTemplate();
|
|
6273
6536
|
|
|
@@ -10572,7 +10835,7 @@ class ToggleButton extends Button {
|
|
|
10572
10835
|
if (this.$fastController.isConnected) {
|
|
10573
10836
|
const ariaPressed = `${this.mixed ? "mixed" : !!this.pressed}`;
|
|
10574
10837
|
this.elementInternals.ariaPressed = ariaPressed;
|
|
10575
|
-
this.
|
|
10838
|
+
toggleState(this.elementInternals, "pressed", !!this.pressed || !!this.mixed);
|
|
10576
10839
|
}
|
|
10577
10840
|
}
|
|
10578
10841
|
}
|
|
@@ -10586,8 +10849,8 @@ __decorateClass([attr({
|
|
|
10586
10849
|
const styles = css`
|
|
10587
10850
|
${styles$s}
|
|
10588
10851
|
|
|
10589
|
-
:host(
|
|
10590
|
-
:host(
|
|
10852
|
+
:host(${pressedState}){border-color:${colorNeutralStroke1};background-color:${colorNeutralBackground1Selected};color:${colorNeutralForeground1};border-width:${strokeWidthThin}}:host(${pressedState}:hover){border-color:${colorNeutralStroke1Hover};background-color:${colorNeutralBackground1Hover}}:host(${pressedState}:active){border-color:${colorNeutralStroke1Pressed};background-color:${colorNeutralBackground1Pressed}}:host(${pressedState}${primaryState}){border-color:transparent;background-color:${colorBrandBackgroundSelected};color:${colorNeutralForegroundOnBrand}}:host(${pressedState}${primaryState}:hover){background-color:${colorBrandBackgroundHover}}:host(${pressedState}${primaryState}:active){background-color:${colorBrandBackgroundPressed}}:host(${pressedState}${subtleState}){border-color:transparent;background-color:${colorSubtleBackgroundSelected};color:${colorNeutralForeground2Selected}}:host(${pressedState}${subtleState}:hover){background-color:${colorSubtleBackgroundHover};color:${colorNeutralForeground2Hover}}:host(${pressedState}${subtleState}:active){background-color:${colorSubtleBackgroundPressed};color:${colorNeutralForeground2Pressed}}:host(${pressedState}${outlineState}),:host(${pressedState}${transparentState}){background-color:${colorTransparentBackgroundSelected}}:host(${pressedState}${outlineState}:hover),:host(${pressedState}${transparentState}:hover){background-color:${colorTransparentBackgroundHover}}:host(${pressedState}${outlineState}:active),:host(${pressedState}${transparentState}:active){background-color:${colorTransparentBackgroundPressed}}:host(${pressedState}${transparentState}){border-color:transparent;color:${colorNeutralForeground2BrandSelected}}:host(${pressedState}${transparentState}:hover){color:${colorNeutralForeground2BrandHover}}:host(${pressedState}${transparentState}:active){color:${colorNeutralForeground2BrandPressed}}`.withBehaviors(forcedColorsStylesheetBehavior(css`
|
|
10853
|
+
:host(${pressedState}),:host(${pressedState}${primaryState}),:host(${pressedState}${subtleState}),:host(${pressedState}${outlineState}),:host(${pressedState}${transparentState}){background:SelectedItem;color:SelectedItemText}`));
|
|
10591
10854
|
|
|
10592
10855
|
const template = buttonTemplate$1();
|
|
10593
10856
|
|