@fluentui/web-components 3.0.0-beta.51 → 3.0.0-beta.53

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.
@@ -1,5 +1,6 @@
1
1
  /// <reference types="web" />
2
2
 
3
+ import { CaptureType } from '@microsoft/fast-element';
3
4
  import { CSSDirective } from '@microsoft/fast-element';
4
5
  import { Direction } from '@microsoft/fast-web-utilities';
5
6
  import { ElementStyles } from '@microsoft/fast-element';
@@ -1633,6 +1634,125 @@ export declare class BaseDivider extends FASTElement {
1633
1634
  orientationChanged(previous: string | null, next: string | null): void;
1634
1635
  }
1635
1636
 
1637
+ /**
1638
+ * A Field Custom HTML Element.
1639
+ *
1640
+ * @public
1641
+ */
1642
+ export declare class BaseField extends FASTElement {
1643
+ /**
1644
+ * The slotted label elements.
1645
+ *
1646
+ * @internal
1647
+ */
1648
+ labelSlot: Node[];
1649
+ /**
1650
+ * Updates attributes on the slotted label elements.
1651
+ *
1652
+ * @param prev - the previous list of slotted label elements
1653
+ * @param next - the current list of slotted label elements
1654
+ */
1655
+ protected labelSlotChanged(prev: Node[], next: Node[]): void;
1656
+ /**
1657
+ * The slotted message elements. Filtered to only include elements with a `flag` attribute.
1658
+ *
1659
+ * @internal
1660
+ */
1661
+ messageSlot: Element[];
1662
+ /**
1663
+ * Adds or removes the `invalid` event listener based on the presence of slotted message elements.
1664
+ *
1665
+ * @param prev - the previous list of slotted message elements
1666
+ * @param next - the current list of slotted message elements
1667
+ * @internal
1668
+ */
1669
+ messageSlotChanged(prev: Element[], next: Element[]): void;
1670
+ /**
1671
+ * The slotted inputs.
1672
+ *
1673
+ * @internal
1674
+ * @privateRemarks
1675
+ * This field is populated with the `children` directive in the template rather than `slotted`.
1676
+ */
1677
+ slottedInputs: SlottableInput[];
1678
+ /**
1679
+ * Sets the `input` property to the first slotted input.
1680
+ *
1681
+ * @param prev - The previous collection of inputs.
1682
+ * @param next - The current collection of inputs.
1683
+ * @internal
1684
+ */
1685
+ slottedInputsChanged(prev: SlottableInput[] | undefined, next: SlottableInput[] | undefined): void;
1686
+ /**
1687
+ * The internal {@link https://developer.mozilla.org/docs/Web/API/ElementInternals | `ElementInternals`} instance for the component.
1688
+ *
1689
+ * @internal
1690
+ */
1691
+ elementInternals: ElementInternals;
1692
+ /**
1693
+ * Reference to the first slotted input.
1694
+ *
1695
+ * @public
1696
+ */
1697
+ input: SlottableInput;
1698
+ /**
1699
+ * Updates the field's states and label properties when the assigned input changes.
1700
+ *
1701
+ * @param prev - the previous input
1702
+ * @param next - the current input
1703
+ */
1704
+ inputChanged(prev: SlottableInput | undefined, next: SlottableInput | undefined): void;
1705
+ /**
1706
+ * Calls the `setStates` method when a `change` event is emitted from the slotted input.
1707
+ *
1708
+ * @param e - the event object
1709
+ * @internal
1710
+ */
1711
+ changeHandler(e: Event): boolean | void;
1712
+ /**
1713
+ * Redirects `click` events to the slotted input.
1714
+ *
1715
+ * @param e - the event object
1716
+ * @internal
1717
+ */
1718
+ clickHandler(e: MouseEvent): boolean | void;
1719
+ constructor();
1720
+ /**
1721
+ * Applies the `focus-visible` state to the element when the slotted input receives visible focus.
1722
+ *
1723
+ * @param e - the focus event
1724
+ * @internal
1725
+ */
1726
+ focusinHandler(e: FocusEvent): boolean | void;
1727
+ /**
1728
+ * Removes the `focus-visible` state from the field when a slotted input loses focus.
1729
+ *
1730
+ * @param e - the focus event
1731
+ * @internal
1732
+ */
1733
+ focusoutHandler(e: FocusEvent): boolean | void;
1734
+ /**
1735
+ * Toggles validity state flags on the element when the slotted input emits an `invalid` event (if slotted validation messages are present).
1736
+ *
1737
+ * @param e - the event object
1738
+ * @internal
1739
+ */
1740
+ invalidHandler(e: Event): boolean | void;
1741
+ /**
1742
+ * Sets ARIA and form-related attributes on slotted label elements.
1743
+ *
1744
+ * @internal
1745
+ */
1746
+ private setLabelProperties;
1747
+ /**
1748
+ * Toggles the field's states based on the slotted input.
1749
+ *
1750
+ * @internal
1751
+ */
1752
+ setStates(): void;
1753
+ setValidationStates(): void;
1754
+ }
1755
+
1636
1756
  /**
1637
1757
  * A Progress HTML Element.
1638
1758
  * Implements the {@link https://www.w3.org/TR/wai-aria-1.1/#progressbar | ARIA progressbar }.
@@ -5483,16 +5603,25 @@ export declare const durationUltraSlow = "var(--durationUltraSlow)";
5483
5603
  * End configuration options
5484
5604
  * @public
5485
5605
  */
5486
- declare type EndOptions<TSource = any, TParent = any> = {
5606
+ export declare type EndOptions<TSource = any, TParent = any> = {
5487
5607
  end?: StaticallyComposableHTML<TSource, TParent>;
5488
5608
  };
5489
5609
 
5610
+ /**
5611
+ * The template for the end slot.
5612
+ * For use with {@link StartEnd}
5613
+ *
5614
+ * @public
5615
+ */
5616
+ export declare function endSlotTemplate<TSource extends StartEnd = StartEnd, TParent = any>(options: EndOptions<TSource, TParent>): CaptureType<TSource, TParent>;
5617
+
5490
5618
  /**
5491
5619
  * A Field Custom HTML Element.
5620
+ * Based on BaseField and includes style and layout specific attributes
5492
5621
  *
5493
5622
  * @public
5494
5623
  */
5495
- export declare class Field extends FASTElement {
5624
+ export declare class Field extends BaseField {
5496
5625
  /**
5497
5626
  * The position of the label relative to the input.
5498
5627
  *
@@ -5501,117 +5630,6 @@ export declare class Field extends FASTElement {
5501
5630
  * HTML Attribute: `label-position`
5502
5631
  */
5503
5632
  labelPosition: FieldLabelPosition;
5504
- /**
5505
- * The slotted label elements.
5506
- *
5507
- * @internal
5508
- */
5509
- labelSlot: Node[];
5510
- /**
5511
- * Updates attributes on the slotted label elements.
5512
- *
5513
- * @param prev - the previous list of slotted label elements
5514
- * @param next - the current list of slotted label elements
5515
- */
5516
- protected labelSlotChanged(prev: Node[], next: Node[]): void;
5517
- /**
5518
- * The slotted message elements. Filtered to only include elements with a `flag` attribute.
5519
- *
5520
- * @internal
5521
- */
5522
- messageSlot: Element[];
5523
- /**
5524
- * Adds or removes the `invalid` event listener based on the presence of slotted message elements.
5525
- *
5526
- * @param prev - the previous list of slotted message elements
5527
- * @param next - the current list of slotted message elements
5528
- * @internal
5529
- */
5530
- messageSlotChanged(prev: Element[], next: Element[]): void;
5531
- /**
5532
- * The slotted inputs.
5533
- *
5534
- * @internal
5535
- * @privateRemarks
5536
- * This field is populated with the `children` directive in the template rather than `slotted`.
5537
- */
5538
- slottedInputs: SlottableInput[];
5539
- /**
5540
- * Sets the `input` property to the first slotted input.
5541
- *
5542
- * @param prev - The previous collection of inputs.
5543
- * @param next - The current collection of inputs.
5544
- * @internal
5545
- */
5546
- slottedInputsChanged(prev: SlottableInput[] | undefined, next: SlottableInput[] | undefined): void;
5547
- /**
5548
- * The internal {@link https://developer.mozilla.org/docs/Web/API/ElementInternals | `ElementInternals`} instance for the component.
5549
- *
5550
- * @internal
5551
- */
5552
- elementInternals: ElementInternals;
5553
- /**
5554
- * Reference to the first slotted input.
5555
- *
5556
- * @public
5557
- */
5558
- input: SlottableInput;
5559
- /**
5560
- * Updates the field's states and label properties when the assigned input changes.
5561
- *
5562
- * @param prev - the previous input
5563
- * @param next - the current input
5564
- */
5565
- inputChanged(prev: SlottableInput | undefined, next: SlottableInput | undefined): void;
5566
- /**
5567
- * Calls the `setStates` method when a `change` event is emitted from the slotted input.
5568
- *
5569
- * @param e - the event object
5570
- * @internal
5571
- */
5572
- changeHandler(e: Event): boolean | void;
5573
- /**
5574
- * Redirects `click` events to the slotted input.
5575
- *
5576
- * @param e - the event object
5577
- * @internal
5578
- */
5579
- clickHandler(e: MouseEvent): boolean | void;
5580
- constructor();
5581
- /**
5582
- * Applies the `focus-visible` state to the element when the slotted input receives visible focus.
5583
- *
5584
- * @param e - the focus event
5585
- * @internal
5586
- */
5587
- focusinHandler(e: FocusEvent): boolean | void;
5588
- /**
5589
- * Removes the `focus-visible` state from the field when a slotted input loses focus.
5590
- *
5591
- * @param e - the focus event
5592
- * @internal
5593
- */
5594
- focusoutHandler(e: FocusEvent): boolean | void;
5595
- /**
5596
- * Toggles validity state flags on the element when the slotted input emits an `invalid` event (if slotted validation messages are present).
5597
- *
5598
- * @param e - the event object
5599
- * @internal
5600
- */
5601
- invalidHandler(e: Event): boolean | void;
5602
- /**
5603
- * Sets ARIA and form-related attributes on slotted label elements.
5604
- *
5605
- * @internal
5606
- */
5607
- private setLabelProperties;
5608
- /**
5609
- * Toggles the field's states based on the slotted input.
5610
- *
5611
- * @internal
5612
- */
5613
- setStates(): void;
5614
- setValidationStates(): void;
5615
5633
  }
5616
5634
 
5617
5635
  /**
@@ -7501,8 +7519,18 @@ export declare const roleForMenuItem: {
7501
7519
  };
7502
7520
 
7503
7521
  /**
7504
- * Sets the theme tokens on defaultNode.
7505
- * @param theme - Flat object of theme token values.
7522
+ * Sets the theme tokens as CSS Custom Properties. The Custom Properties are
7523
+ * set in a constructed stylesheet on `document.adoptedStyleSheets` if
7524
+ * supported, and on `document.documentElement.style` as a fallback.
7525
+ *
7526
+ * @param theme - Flat object of theme tokens. Each object entry must follow
7527
+ * these rules: the key is the name of the token, usually in camel case, it
7528
+ * must be a valid CSS Custom Property name WITHOUT the starting two dashes
7529
+ * (`--`), the two dashes are added inside the function; the value must be
7530
+ * a valid CSS value, e.g. it cannot contain semicolons (`;`).
7531
+ * Note that this argument is not limited to existing theme objects (from
7532
+ * `@fluentui/tokens`), you can pass in an arbitrary theme object as long
7533
+ * as each entry’s value is either a string or a number.
7506
7534
  * @internal
7507
7535
  */
7508
7536
  export declare const setTheme: (theme: Theme) => void;
@@ -8251,7 +8279,7 @@ export declare const SpinnerTemplate: ViewTemplate<Spinner, any>;
8251
8279
  * These are generally used to decorate text elements with icons or other visual indicators.
8252
8280
  * @public
8253
8281
  */
8254
- declare class StartEnd {
8282
+ export declare class StartEnd {
8255
8283
  start: HTMLSlotElement;
8256
8284
  end: HTMLSlotElement;
8257
8285
  }
@@ -8260,16 +8288,24 @@ declare class StartEnd {
8260
8288
  * Start/End configuration options
8261
8289
  * @public
8262
8290
  */
8263
- declare type StartEndOptions<TSource = any, TParent = any> = StartOptions<TSource, TParent> & EndOptions<TSource, TParent>;
8291
+ export declare type StartEndOptions<TSource = any, TParent = any> = StartOptions<TSource, TParent> & EndOptions<TSource, TParent>;
8264
8292
 
8265
8293
  /**
8266
8294
  * Start configuration options
8267
8295
  * @public
8268
8296
  */
8269
- declare type StartOptions<TSource = any, TParent = any> = {
8297
+ export declare type StartOptions<TSource = any, TParent = any> = {
8270
8298
  start?: StaticallyComposableHTML<TSource, TParent>;
8271
8299
  };
8272
8300
 
8301
+ /**
8302
+ * The template for the start slots.
8303
+ * For use with {@link StartEnd}
8304
+ *
8305
+ * @public
8306
+ */
8307
+ export declare function startSlotTemplate<TSource extends StartEnd = StartEnd, TParent = any>(options: StartOptions<TSource, TParent>): CaptureType<TSource, TParent>;
8308
+
8273
8309
  /**
8274
8310
  * A value that can be statically composed into a
8275
8311
  * foundation template.
@@ -6571,10 +6571,9 @@ var __decorateClass$h = (decorators, target, key, kind) => {
6571
6571
  if (kind && result) __defProp$h(target, key, result);
6572
6572
  return result;
6573
6573
  };
6574
- class Field extends FASTElement {
6574
+ class BaseField extends FASTElement {
6575
6575
  constructor() {
6576
6576
  super();
6577
- this.labelPosition = LabelPosition.above;
6578
6577
  this.labelSlot = [];
6579
6578
  /**
6580
6579
  * The internal {@link https://developer.mozilla.org/docs/Web/API/ElementInternals | `ElementInternals`} instance for the component.
@@ -6737,13 +6736,19 @@ class Field extends FASTElement {
6737
6736
  }
6738
6737
  }
6739
6738
  }
6739
+ __decorateClass$h([observable], BaseField.prototype, "labelSlot", 2);
6740
+ __decorateClass$h([observable], BaseField.prototype, "messageSlot", 2);
6741
+ __decorateClass$h([observable], BaseField.prototype, "slottedInputs", 2);
6742
+ __decorateClass$h([observable], BaseField.prototype, "input", 2);
6743
+ class Field extends BaseField {
6744
+ constructor() {
6745
+ super(...arguments);
6746
+ this.labelPosition = LabelPosition.above;
6747
+ }
6748
+ }
6740
6749
  __decorateClass$h([attr({
6741
6750
  attribute: "label-position"
6742
6751
  })], Field.prototype, "labelPosition", 2);
6743
- __decorateClass$h([observable], Field.prototype, "labelSlot", 2);
6744
- __decorateClass$h([observable], Field.prototype, "messageSlot", 2);
6745
- __decorateClass$h([observable], Field.prototype, "slottedInputs", 2);
6746
- __decorateClass$h([observable], Field.prototype, "input", 2);
6747
6752
 
6748
6753
  const focusVisibleState = css.partial`:is([state--focus-visible], :state(focus-visible))`;
6749
6754
  const badInputState = css.partial`:is([state--${ValidationFlags.badInput}], :state(${ValidationFlags.badInput}))`;