@fluentui/web-components 3.0.0-beta.20 → 3.0.0-beta.21
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 +11 -2
- package/dist/dts/text-input/index.d.ts +5 -4
- package/dist/dts/text-input/text-input.d.ts +284 -67
- package/dist/dts/text-input/text-input.definition.d.ts +2 -3
- package/dist/dts/text-input/text-input.options.d.ts +19 -29
- package/dist/dts/text-input/text-input.styles.d.ts +5 -2
- package/dist/dts/text-input/text-input.template.d.ts +9 -3
- package/dist/esm/accordion/accordion.js +1 -6
- package/dist/esm/accordion/accordion.js.map +1 -1
- package/dist/esm/accordion-item/accordion-item.js +1 -6
- package/dist/esm/accordion-item/accordion-item.js.map +1 -1
- package/dist/esm/anchor-button/anchor-button.js +1 -6
- package/dist/esm/anchor-button/anchor-button.js.map +1 -1
- package/dist/esm/avatar/avatar.js +1 -6
- package/dist/esm/avatar/avatar.js.map +1 -1
- package/dist/esm/badge/badge.js +1 -6
- package/dist/esm/badge/badge.js.map +1 -1
- package/dist/esm/button/button.js +1 -6
- package/dist/esm/button/button.js.map +1 -1
- package/dist/esm/checkbox/checkbox.js +1 -6
- package/dist/esm/checkbox/checkbox.js.map +1 -1
- package/dist/esm/counter-badge/counter-badge.js +1 -6
- package/dist/esm/counter-badge/counter-badge.js.map +1 -1
- package/dist/esm/dialog/dialog.js +1 -6
- package/dist/esm/dialog/dialog.js.map +1 -1
- package/dist/esm/divider/divider.js +1 -6
- package/dist/esm/divider/divider.js.map +1 -1
- package/dist/esm/image/image.js +1 -6
- package/dist/esm/image/image.js.map +1 -1
- package/dist/esm/label/label.js +1 -6
- package/dist/esm/label/label.js.map +1 -1
- package/dist/esm/menu/menu.js +1 -6
- package/dist/esm/menu/menu.js.map +1 -1
- package/dist/esm/menu-item/menu-item.js +1 -6
- package/dist/esm/menu-item/menu-item.js.map +1 -1
- package/dist/esm/menu-list/menu-list.js +1 -6
- package/dist/esm/menu-list/menu-list.js.map +1 -1
- package/dist/esm/patterns/aria-globals.js +1 -6
- package/dist/esm/patterns/aria-globals.js.map +1 -1
- package/dist/esm/progress-bar/base-progress.js +1 -6
- package/dist/esm/progress-bar/base-progress.js.map +1 -1
- package/dist/esm/progress-bar/progress-bar.js +1 -6
- package/dist/esm/progress-bar/progress-bar.js.map +1 -1
- package/dist/esm/radio/radio.js +1 -6
- package/dist/esm/radio/radio.js.map +1 -1
- package/dist/esm/radio-group/radio-group.js +1 -6
- package/dist/esm/radio-group/radio-group.js.map +1 -1
- package/dist/esm/slider/slider.js +1 -6
- package/dist/esm/slider/slider.js.map +1 -1
- package/dist/esm/spinner/spinner.js +1 -6
- package/dist/esm/spinner/spinner.js.map +1 -1
- package/dist/esm/switch/switch.js +1 -6
- package/dist/esm/switch/switch.js.map +1 -1
- package/dist/esm/tab/tab.js +1 -6
- package/dist/esm/tab/tab.js.map +1 -1
- package/dist/esm/tabs/tabs.js +1 -6
- package/dist/esm/tabs/tabs.js.map +1 -1
- package/dist/esm/text/text.js +1 -6
- package/dist/esm/text/text.js.map +1 -1
- package/dist/esm/text-input/index.js +3 -3
- package/dist/esm/text-input/index.js.map +1 -1
- package/dist/esm/text-input/text-input.definition.js +2 -3
- package/dist/esm/text-input/text-input.definition.js.map +1 -1
- package/dist/esm/text-input/text-input.js +271 -102
- package/dist/esm/text-input/text-input.js.map +1 -1
- package/dist/esm/text-input/text-input.options.js +25 -18
- package/dist/esm/text-input/text-input.options.js.map +1 -1
- package/dist/esm/text-input/text-input.styles.js +8 -3
- package/dist/esm/text-input/text-input.styles.js.map +1 -1
- package/dist/esm/text-input/text-input.template.js +16 -32
- package/dist/esm/text-input/text-input.template.js.map +1 -1
- package/dist/esm/toggle-button/toggle-button.js +1 -6
- package/dist/esm/toggle-button/toggle-button.js.map +1 -1
- package/dist/fluent-web-components.api.json +346 -217
- package/dist/web-components.d.ts +299 -114
- package/dist/web-components.js +251 -110
- package/dist/web-components.min.js +162 -162
- package/docs/api-report.md +52 -37
- package/package.json +2 -2
- package/dist/dts/text-input/text-field.form-associated.d.ts +0 -14
- package/dist/esm/text-input/text-field.form-associated.js +0 -14
- package/dist/esm/text-input/text-field.form-associated.js.map +0 -1
package/dist/web-components.js
CHANGED
|
@@ -10866,35 +10866,13 @@ const TextInputAppearance = {
|
|
|
10866
10866
|
filledDarker: "filled-darker"
|
|
10867
10867
|
};
|
|
10868
10868
|
const TextInputType = {
|
|
10869
|
-
/**
|
|
10870
|
-
* An email TextInput
|
|
10871
|
-
*/
|
|
10872
10869
|
email: "email",
|
|
10873
|
-
/**
|
|
10874
|
-
* A password TextInput
|
|
10875
|
-
*/
|
|
10876
10870
|
password: "password",
|
|
10877
|
-
/**
|
|
10878
|
-
* A telephone TextInput
|
|
10879
|
-
*/
|
|
10880
10871
|
tel: "tel",
|
|
10881
|
-
/**
|
|
10882
|
-
* A text TextInput
|
|
10883
|
-
*/
|
|
10884
10872
|
text: "text",
|
|
10885
|
-
/**
|
|
10886
|
-
* A URL TextInput
|
|
10887
|
-
*/
|
|
10888
10873
|
url: "url"
|
|
10889
10874
|
};
|
|
10890
|
-
|
|
10891
|
-
class _TextField extends FASTElement {}
|
|
10892
|
-
class FormAssociatedTextField extends FormAssociated(_TextField) {
|
|
10893
|
-
constructor() {
|
|
10894
|
-
super(...arguments);
|
|
10895
|
-
this.proxy = document.createElement("input");
|
|
10896
|
-
}
|
|
10897
|
-
}
|
|
10875
|
+
const ImplicitSubmissionBlockingTypes = ["date", "datetime-local", "email", "month", "number", "password", "search", "tel", "text", "time", "url", "week"];
|
|
10898
10876
|
|
|
10899
10877
|
var __defProp$1 = Object.defineProperty;
|
|
10900
10878
|
var __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor;
|
|
@@ -10904,127 +10882,276 @@ var __decorateClass$1 = (decorators, target, key, kind) => {
|
|
|
10904
10882
|
if (kind && result) __defProp$1(target, key, result);
|
|
10905
10883
|
return result;
|
|
10906
10884
|
};
|
|
10907
|
-
class TextInput extends
|
|
10885
|
+
class TextInput extends FASTElement {
|
|
10908
10886
|
constructor() {
|
|
10909
10887
|
super(...arguments);
|
|
10910
10888
|
this.type = TextInputType.text;
|
|
10889
|
+
/**
|
|
10890
|
+
* The current value of the input.
|
|
10891
|
+
*
|
|
10892
|
+
* @internal
|
|
10893
|
+
*/
|
|
10894
|
+
this._value = this.initialValue;
|
|
10895
|
+
/**
|
|
10896
|
+
* Indicates that the value has been changed by the user.
|
|
10897
|
+
*
|
|
10898
|
+
* @internal
|
|
10899
|
+
*/
|
|
10900
|
+
this.dirtyValue = false;
|
|
10901
|
+
/**
|
|
10902
|
+
* The internal {@link https://developer.mozilla.org/docs/Web/API/ElementInternals | `ElementInternals`} instance for the component.
|
|
10903
|
+
*
|
|
10904
|
+
* @internal
|
|
10905
|
+
*/
|
|
10906
|
+
this.elementInternals = this.attachInternals();
|
|
10911
10907
|
}
|
|
10912
|
-
|
|
10913
|
-
|
|
10914
|
-
|
|
10915
|
-
|
|
10908
|
+
/**
|
|
10909
|
+
* Updates the control label visibility based on the presence of default slotted content.
|
|
10910
|
+
*
|
|
10911
|
+
* @internal
|
|
10912
|
+
*/
|
|
10913
|
+
defaultSlottedNodesChanged(prev, next) {
|
|
10914
|
+
if (this.$fastController.isConnected) {
|
|
10915
|
+
this.controlLabel.hidden = !next?.length;
|
|
10916
10916
|
}
|
|
10917
10917
|
}
|
|
10918
|
-
|
|
10919
|
-
|
|
10920
|
-
|
|
10921
|
-
|
|
10918
|
+
/**
|
|
10919
|
+
* Sets the value of the element to the initial value.
|
|
10920
|
+
*
|
|
10921
|
+
* @internal
|
|
10922
|
+
*/
|
|
10923
|
+
initialValueChanged() {
|
|
10924
|
+
if (!this.dirtyValue) {
|
|
10925
|
+
this.value = this.initialValue;
|
|
10922
10926
|
}
|
|
10923
10927
|
}
|
|
10924
|
-
|
|
10925
|
-
|
|
10926
|
-
|
|
10928
|
+
/**
|
|
10929
|
+
* Syncs the `ElementInternals.ariaReadOnly` property when the `readonly` property changes.
|
|
10930
|
+
*
|
|
10931
|
+
* @internal
|
|
10932
|
+
*/
|
|
10933
|
+
readonlyChanged() {
|
|
10934
|
+
if (this.$fastController.isConnected) {
|
|
10935
|
+
this.elementInternals.ariaReadOnly = `${!!this.readonly}`;
|
|
10927
10936
|
}
|
|
10928
10937
|
}
|
|
10929
|
-
|
|
10930
|
-
|
|
10931
|
-
|
|
10932
|
-
|
|
10938
|
+
/**
|
|
10939
|
+
* Syncs the element's internal `aria-required` state with the `required` attribute.
|
|
10940
|
+
*
|
|
10941
|
+
* @param previous - the previous required state
|
|
10942
|
+
* @param next - the current required state
|
|
10943
|
+
*
|
|
10944
|
+
* @internal
|
|
10945
|
+
*/
|
|
10946
|
+
requiredChanged(previous, next) {
|
|
10947
|
+
if (this.$fastController.isConnected) {
|
|
10948
|
+
this.elementInternals.ariaRequired = `${!!next}`;
|
|
10933
10949
|
}
|
|
10934
10950
|
}
|
|
10935
|
-
|
|
10936
|
-
|
|
10937
|
-
|
|
10938
|
-
|
|
10939
|
-
|
|
10951
|
+
/**
|
|
10952
|
+
* The element's validity state.
|
|
10953
|
+
*
|
|
10954
|
+
* @public
|
|
10955
|
+
* @remarks
|
|
10956
|
+
* Reflects the {@link https://developer.mozilla.org/docs/Web/API/ElementInternals/validity | `ElementInternals.validity`} property.
|
|
10957
|
+
*/
|
|
10958
|
+
get validity() {
|
|
10959
|
+
return this.elementInternals.validity;
|
|
10940
10960
|
}
|
|
10941
|
-
|
|
10942
|
-
|
|
10943
|
-
|
|
10944
|
-
|
|
10945
|
-
|
|
10961
|
+
/**
|
|
10962
|
+
* The validation message.
|
|
10963
|
+
*
|
|
10964
|
+
* @public
|
|
10965
|
+
* @remarks
|
|
10966
|
+
* Reflects the {@link https://developer.mozilla.org/docs/Web/API/ElementInternals/validationMessage | `ElementInternals.validationMessage`} property.
|
|
10967
|
+
*/
|
|
10968
|
+
get validationMessage() {
|
|
10969
|
+
return this.elementInternals.validationMessage;
|
|
10946
10970
|
}
|
|
10947
|
-
|
|
10948
|
-
|
|
10949
|
-
|
|
10950
|
-
|
|
10951
|
-
|
|
10971
|
+
/**
|
|
10972
|
+
* The current value of the input.
|
|
10973
|
+
* @public
|
|
10974
|
+
*/
|
|
10975
|
+
get value() {
|
|
10976
|
+
Observable.track(this, "value");
|
|
10977
|
+
return this._value;
|
|
10952
10978
|
}
|
|
10953
|
-
|
|
10954
|
-
|
|
10955
|
-
|
|
10956
|
-
this.
|
|
10979
|
+
set value(value) {
|
|
10980
|
+
this._value = value;
|
|
10981
|
+
if (this.$fastController.isConnected) {
|
|
10982
|
+
this.control.value = value;
|
|
10983
|
+
this.setFormValue(value);
|
|
10984
|
+
this.setValidity();
|
|
10985
|
+
Observable.notify(this, "value");
|
|
10957
10986
|
}
|
|
10958
10987
|
}
|
|
10959
|
-
|
|
10960
|
-
|
|
10961
|
-
|
|
10962
|
-
|
|
10988
|
+
/**
|
|
10989
|
+
* Determines if the control can be submitted for constraint validation.
|
|
10990
|
+
*
|
|
10991
|
+
* @public
|
|
10992
|
+
* @remarks
|
|
10993
|
+
* Reflects the {@link https://developer.mozilla.org/docs/Web/API/ElementInternals/willValidate | `ElementInternals.willValidate`} property.
|
|
10994
|
+
*/
|
|
10995
|
+
get willValidate() {
|
|
10996
|
+
return this.elementInternals.willValidate;
|
|
10963
10997
|
}
|
|
10964
|
-
|
|
10965
|
-
|
|
10966
|
-
|
|
10967
|
-
|
|
10998
|
+
/**
|
|
10999
|
+
* The associated form element.
|
|
11000
|
+
*
|
|
11001
|
+
* @public
|
|
11002
|
+
* @remarks
|
|
11003
|
+
* Reflects the {@link https://developer.mozilla.org/docs/Web/API/ElementInternals/form | `ElementInternals.form`} property.
|
|
11004
|
+
*/
|
|
11005
|
+
get form() {
|
|
11006
|
+
return this.elementInternals.form;
|
|
10968
11007
|
}
|
|
10969
11008
|
/**
|
|
11009
|
+
* Change event handler for inner control.
|
|
11010
|
+
*
|
|
10970
11011
|
* @internal
|
|
10971
|
-
|
|
11012
|
+
* @privateRemarks
|
|
11013
|
+
* "Change" events are not `composable` so they will not permeate the shadow DOM boundary. This function effectively
|
|
11014
|
+
* proxies the change event, emitting a `change` event whenever the internal control emits a `change` event.
|
|
11015
|
+
*/
|
|
11016
|
+
changeHandler(e) {
|
|
11017
|
+
e.preventDefault();
|
|
11018
|
+
this.setValidity();
|
|
11019
|
+
this.$emit("change", e, {
|
|
11020
|
+
bubbles: true,
|
|
11021
|
+
cancelable: false,
|
|
11022
|
+
composed: false
|
|
11023
|
+
});
|
|
11024
|
+
}
|
|
10972
11025
|
connectedCallback() {
|
|
10973
11026
|
super.connectedCallback();
|
|
10974
|
-
this.
|
|
10975
|
-
this.
|
|
10976
|
-
|
|
10977
|
-
|
|
10978
|
-
|
|
10979
|
-
|
|
11027
|
+
this.addEventListener("keypress", this.keypressHandler);
|
|
11028
|
+
this.setFormValue(this.value);
|
|
11029
|
+
this.setValidity();
|
|
11030
|
+
}
|
|
11031
|
+
disconnectedCallback() {
|
|
11032
|
+
this.removeEventListener("keypress", this.keypressHandler);
|
|
11033
|
+
super.disconnectedCallback();
|
|
11034
|
+
}
|
|
11035
|
+
/**
|
|
11036
|
+
* Resets the value to its initial value when the form is reset.
|
|
11037
|
+
*
|
|
11038
|
+
* @internal
|
|
11039
|
+
*/
|
|
11040
|
+
formResetCallback() {
|
|
11041
|
+
this.value = this.initialValue;
|
|
11042
|
+
this.dirtyValue = false;
|
|
11043
|
+
}
|
|
11044
|
+
/**
|
|
11045
|
+
* Handles implicit form submission when the user presses the "Enter" key.
|
|
11046
|
+
*
|
|
11047
|
+
* @internal
|
|
11048
|
+
*/
|
|
11049
|
+
implicitSubmit() {
|
|
11050
|
+
if (!this.elementInternals.form) {
|
|
11051
|
+
return;
|
|
10980
11052
|
}
|
|
11053
|
+
if (this.elementInternals.form.elements.length === 1) {
|
|
11054
|
+
this.elementInternals.form.requestSubmit();
|
|
11055
|
+
return;
|
|
11056
|
+
}
|
|
11057
|
+
const formElements = [...this.elementInternals.form.elements];
|
|
11058
|
+
const submitButton = formElements.find(x => x.getAttribute("type") === "submit");
|
|
11059
|
+
if (submitButton) {
|
|
11060
|
+
submitButton.click();
|
|
11061
|
+
return;
|
|
11062
|
+
}
|
|
11063
|
+
const filteredElements = formElements.filter(x => ImplicitSubmissionBlockingTypes.includes(x.getAttribute("type") ?? ""));
|
|
11064
|
+
if (filteredElements.length > 1) {
|
|
11065
|
+
return;
|
|
11066
|
+
}
|
|
11067
|
+
this.elementInternals.form.requestSubmit();
|
|
10981
11068
|
}
|
|
10982
11069
|
/**
|
|
10983
|
-
*
|
|
11070
|
+
* Handles the internal control's `input` event.
|
|
11071
|
+
*
|
|
11072
|
+
* @internal
|
|
11073
|
+
*/
|
|
11074
|
+
inputHandler(e) {
|
|
11075
|
+
this.dirtyValue = true;
|
|
11076
|
+
this.value = this.control.value;
|
|
11077
|
+
return true;
|
|
11078
|
+
}
|
|
11079
|
+
/**
|
|
11080
|
+
* Handles the internal control's `keypress` event.
|
|
11081
|
+
*
|
|
11082
|
+
* @internal
|
|
11083
|
+
*/
|
|
11084
|
+
keypressHandler(e) {
|
|
11085
|
+
if (e.key === keyEnter) {
|
|
11086
|
+
this.implicitSubmit();
|
|
11087
|
+
}
|
|
11088
|
+
return true;
|
|
11089
|
+
}
|
|
11090
|
+
/**
|
|
11091
|
+
* Selects all the text in the text field.
|
|
10984
11092
|
*
|
|
10985
11093
|
* @public
|
|
11094
|
+
* @privateRemarks
|
|
11095
|
+
* The `select` event does not permeate the shadow DOM boundary. This function effectively proxies the event,
|
|
11096
|
+
* emitting a `select` event whenever the internal control emits a `select` event
|
|
11097
|
+
*
|
|
10986
11098
|
*/
|
|
10987
11099
|
select() {
|
|
10988
11100
|
this.control.select();
|
|
10989
11101
|
this.$emit("select");
|
|
10990
11102
|
}
|
|
10991
11103
|
/**
|
|
10992
|
-
*
|
|
11104
|
+
* Reflects the {@link https://developer.mozilla.org/docs/Web/API/ElementInternals/setFormValue | `ElementInternals.setFormValue()`} method.
|
|
11105
|
+
*
|
|
10993
11106
|
* @internal
|
|
10994
11107
|
*/
|
|
10995
|
-
|
|
10996
|
-
this.value
|
|
11108
|
+
setFormValue(value, state) {
|
|
11109
|
+
this.elementInternals.setFormValue(value, value ?? state);
|
|
10997
11110
|
}
|
|
10998
11111
|
/**
|
|
10999
|
-
*
|
|
11000
|
-
*
|
|
11001
|
-
*
|
|
11002
|
-
*
|
|
11003
|
-
*
|
|
11004
|
-
*
|
|
11112
|
+
* Sets the validity of the control.
|
|
11113
|
+
*
|
|
11114
|
+
* @param flags - Validity flags. If not provided, the control's `validity` will be used.
|
|
11115
|
+
* @param message - Optional message to supply. If not provided, the control's `validationMessage` will be used. If the control does not have a `validationMessage`, the message will be empty.
|
|
11116
|
+
* @param anchor - Optional anchor to use for the validation message. If not provided, the control will be used.
|
|
11117
|
+
*
|
|
11005
11118
|
* @internal
|
|
11006
11119
|
*/
|
|
11007
|
-
|
|
11008
|
-
this
|
|
11009
|
-
|
|
11010
|
-
|
|
11011
|
-
|
|
11012
|
-
|
|
11120
|
+
setValidity(flags = this.control.validity, message = this.control.validationMessage, anchor = this.control) {
|
|
11121
|
+
if (this.disabled) {
|
|
11122
|
+
this.elementInternals.setValidity({});
|
|
11123
|
+
return;
|
|
11124
|
+
}
|
|
11125
|
+
this.elementInternals.setValidity(flags, message ?? "", anchor);
|
|
11013
11126
|
}
|
|
11014
11127
|
}
|
|
11128
|
+
/**
|
|
11129
|
+
* The form-associated flag.
|
|
11130
|
+
* @see {@link https://html.spec.whatwg.org/multipage/custom-elements.html#custom-elements-face-example | Form-associated custom elements}
|
|
11131
|
+
*
|
|
11132
|
+
* @public
|
|
11133
|
+
*/
|
|
11134
|
+
TextInput.formAssociated = true;
|
|
11135
|
+
__decorateClass$1([attr], TextInput.prototype, "appearance", 2);
|
|
11136
|
+
__decorateClass$1([attr], TextInput.prototype, "autocomplete", 2);
|
|
11137
|
+
__decorateClass$1([attr({
|
|
11138
|
+
mode: "boolean"
|
|
11139
|
+
})], TextInput.prototype, "autofocus", 2);
|
|
11015
11140
|
__decorateClass$1([attr({
|
|
11016
11141
|
attribute: "control-size"
|
|
11017
11142
|
})], TextInput.prototype, "controlSize", 2);
|
|
11018
|
-
__decorateClass$1([
|
|
11143
|
+
__decorateClass$1([observable], TextInput.prototype, "defaultSlottedNodes", 2);
|
|
11144
|
+
__decorateClass$1([attr], TextInput.prototype, "dirname", 2);
|
|
11019
11145
|
__decorateClass$1([attr({
|
|
11020
|
-
attribute: "readonly",
|
|
11021
11146
|
mode: "boolean"
|
|
11022
|
-
})], TextInput.prototype, "
|
|
11147
|
+
})], TextInput.prototype, "disabled", 2);
|
|
11023
11148
|
__decorateClass$1([attr({
|
|
11024
|
-
|
|
11025
|
-
})], TextInput.prototype, "
|
|
11026
|
-
__decorateClass$1([attr
|
|
11027
|
-
|
|
11149
|
+
attribute: "form"
|
|
11150
|
+
})], TextInput.prototype, "formAttribute", 2);
|
|
11151
|
+
__decorateClass$1([attr({
|
|
11152
|
+
attribute: "value",
|
|
11153
|
+
mode: "fromView"
|
|
11154
|
+
})], TextInput.prototype, "initialValue", 2);
|
|
11028
11155
|
__decorateClass$1([attr], TextInput.prototype, "list", 2);
|
|
11029
11156
|
__decorateClass$1([attr({
|
|
11030
11157
|
converter: nullableNumberConverter
|
|
@@ -11032,30 +11159,44 @@ __decorateClass$1([attr({
|
|
|
11032
11159
|
__decorateClass$1([attr({
|
|
11033
11160
|
converter: nullableNumberConverter
|
|
11034
11161
|
})], TextInput.prototype, "minlength", 2);
|
|
11162
|
+
__decorateClass$1([attr({
|
|
11163
|
+
mode: "boolean"
|
|
11164
|
+
})], TextInput.prototype, "multiple", 2);
|
|
11165
|
+
__decorateClass$1([attr], TextInput.prototype, "name", 2);
|
|
11035
11166
|
__decorateClass$1([attr], TextInput.prototype, "pattern", 2);
|
|
11167
|
+
__decorateClass$1([attr], TextInput.prototype, "placeholder", 2);
|
|
11168
|
+
__decorateClass$1([attr({
|
|
11169
|
+
attribute: "readonly",
|
|
11170
|
+
mode: "boolean"
|
|
11171
|
+
})], TextInput.prototype, "readonly", 2);
|
|
11172
|
+
__decorateClass$1([attr({
|
|
11173
|
+
mode: "boolean"
|
|
11174
|
+
})], TextInput.prototype, "required", 2);
|
|
11036
11175
|
__decorateClass$1([attr({
|
|
11037
11176
|
converter: nullableNumberConverter
|
|
11038
11177
|
})], TextInput.prototype, "size", 2);
|
|
11039
11178
|
__decorateClass$1([attr({
|
|
11040
|
-
|
|
11179
|
+
converter: {
|
|
11180
|
+
fromView: value => typeof value === "string" ? ["true", ""].includes(value.trim().toLowerCase()) : null,
|
|
11181
|
+
toView: value => value.toString()
|
|
11182
|
+
}
|
|
11041
11183
|
})], TextInput.prototype, "spellcheck", 2);
|
|
11042
|
-
__decorateClass$1([
|
|
11043
|
-
|
|
11044
|
-
applyMixins(
|
|
11045
|
-
applyMixins(TextInput, StartEnd, DelegatesARIATextbox);
|
|
11046
|
-
|
|
11047
|
-
function textFieldTemplate(options = {}) {
|
|
11048
|
-
return html`<label part="label" for="control" class="${x => x.defaultSlottedNodes && x.defaultSlottedNodes.length ? "label" : "label label__hidden"}"><slot ${slotted({
|
|
11049
|
-
property: "defaultSlottedNodes",
|
|
11050
|
-
filter: whitespaceFilter
|
|
11051
|
-
})}></slot></label><div class="root" part="root">${startSlotTemplate(options)}<input class="control" part="control" id="control" @input="${x => x.handleTextInput()}" @change="${x => x.handleChange()}" ?autofocus="${x => x.autofocus}" ?disabled="${x => x.disabled}" list="${x => x.list}" maxlength="${x => x.maxlength}" name="${x => x.name}" minlength="${x => x.minlength}" pattern="${x => x.pattern}" placeholder="${x => x.placeholder}" ?readonly="${x => x.readOnly}" ?required="${x => x.required}" size="${x => x.size}" ?spellcheck="${x => x.spellcheck}" :value="${x => x.value}" type="${x => x.type}" aria-atomic="${x => x.ariaAtomic}" aria-busy="${x => x.ariaBusy}" aria-controls="${x => x.ariaControls}" aria-current="${x => x.ariaCurrent}" aria-describedby="${x => x.ariaDescribedby}" aria-details="${x => x.ariaDetails}" aria-disabled="${x => x.ariaDisabled}" aria-errormessage="${x => x.ariaErrormessage}" aria-flowto="${x => x.ariaFlowto}" aria-haspopup="${x => x.ariaHaspopup}" aria-hidden="${x => x.ariaHidden}" aria-invalid="${x => x.ariaInvalid}" aria-keyshortcuts="${x => x.ariaKeyshortcuts}" aria-label="${x => x.ariaLabel}" aria-labelledby="${x => x.ariaLabelledby}" aria-live="${x => x.ariaLive}" aria-owns="${x => x.ariaOwns}" aria-relevant="${x => x.ariaRelevant}" aria-roledescription="${x => x.ariaRoledescription}" ${ref("control")} />${endSlotTemplate(options)}</div>`;
|
|
11052
|
-
}
|
|
11053
|
-
const template$1 = textFieldTemplate();
|
|
11184
|
+
__decorateClass$1([attr], TextInput.prototype, "type", 2);
|
|
11185
|
+
__decorateClass$1([observable], TextInput.prototype, "controlLabel", 2);
|
|
11186
|
+
applyMixins(TextInput, StartEnd);
|
|
11054
11187
|
|
|
11055
11188
|
const styles$1 = css`
|
|
11056
11189
|
${display("block")}
|
|
11057
11190
|
|
|
11058
|
-
:host{font-family:${fontFamilyBase};font-size:${fontSizeBase300};font-weight:${fontWeightRegular};line-height:${lineHeightBase300};max-width:400px}.label{display:flex;color:${colorNeutralForeground1};padding-bottom:${spacingVerticalXS};flex-shrink:0;padding-inline-end:${spacingHorizontalXS}}.
|
|
11191
|
+
:host{font-family:${fontFamilyBase};font-size:${fontSizeBase300};font-weight:${fontWeightRegular};line-height:${lineHeightBase300};max-width:400px}.label{display:flex;color:${colorNeutralForeground1};padding-bottom:${spacingVerticalXS};flex-shrink:0;padding-inline-end:${spacingHorizontalXS}}.label[hidden],:host(:empty) .label{display:none}.root{position:relative;box-sizing:border-box;height:32px;display:inline-flex;align-items:center;flex-direction:row;width:100%;padding:0 ${spacingHorizontalMNudge};border:${strokeWidthThin} solid ${colorNeutralStroke1};border-bottom-color:${colorNeutralStrokeAccessible};border-radius:${borderRadiusMedium};gap:${spacingHorizontalXXS}}.root::after{box-sizing:border-box;content:'';position:absolute;left:-1px;bottom:0px;right:-1px;height:max(2px,${borderRadiusMedium});border-radius:0 0 ${borderRadiusMedium} ${borderRadiusMedium};border-bottom:2px solid ${colorCompoundBrandStroke};clip-path:inset(calc(100% - 2px) 1px 0px);transform:scaleX(0);transition-property:transform;transition-duration:${durationUltraFast};transition-delay:${curveAccelerateMid}}.control{width:100%;height:100%;box-sizing:border-box;color:${colorNeutralForeground1};border-radius:${borderRadiusMedium};background:${colorTransparentBackground};font-family:${fontFamilyBase};font-weight:${fontWeightRegular};font-size:${fontSizeBase300};border:none;background:transparent;vertical-align:center}.control:focus-visible{outline:0;border:0}.control::placeholder{color:${colorNeutralForeground4}}:host ::slotted([slot='start']),:host ::slotted([slot='end']){display:flex;align-items:center;justify-content:center;color:${colorNeutralForeground3};font-size:${fontSizeBase500}}:host ::slotted([slot='start']){padding-right:${spacingHorizontalXXS}}:host ::slotted([slot='end']){padding-left:${spacingHorizontalXXS};gap:${spacingHorizontalXS}}:host(:hover) .root{border-color:${colorNeutralStroke1Hover};border-bottom-color:${colorNeutralStrokeAccessibleHover}}:host(:active) .root{border-color:${colorNeutralStroke1Pressed}}:host(:focus-within) .root{outline:transparent solid 2px;border-bottom:0}:host(:focus-within) .root::after{transform:scaleX(1);transition-property:transform;transition-duration:${durationNormal};transition-delay:${curveDecelerateMid}}:host(:focus-within:active) .root:after{border-bottom-color:${colorCompoundBrandStrokePressed}}:host([appearance='outline']:focus-within) .root{border:${strokeWidthThin} solid ${colorNeutralStroke1}}:host(:focus-within) .control{color:${colorNeutralForeground1}}:host([disabled]) .root{background:${colorTransparentBackground};border:${strokeWidthThin} solid ${colorNeutralStrokeDisabled}}:host([disabled]) .control::placeholder,:host([disabled]) ::slotted([slot='start']),:host([disabled]) ::slotted([slot='end']){color:${colorNeutralForegroundDisabled}}::selection{color:${colorNeutralForegroundInverted};background-color:${colorNeutralBackgroundInverted}}:host([control-size='small']) .control{font-size:${fontSizeBase200};font-weight:${fontWeightRegular};line-height:${lineHeightBase200}}:host([control-size='small']) .root{height:24px;gap:${spacingHorizontalXXS};padding:0 ${spacingHorizontalSNudge}}:host([control-size='small']) ::slotted([slot='start']),:host([control-size='small']) ::slotted([slot='end']){font-size:${fontSizeBase400}}:host([control-size='large']) .control{font-size:${fontSizeBase400};font-weight:${fontWeightRegular};line-height:${lineHeightBase400}}:host([control-size='large']) .root{height:40px;gap:${spacingHorizontalS};padding:0 ${spacingHorizontalM}}:host([control-size='large']) ::slotted([slot='start']),:host([control-size='large']) ::slotted([slot='end']){font-size:${fontSizeBase600}}:host([appearance='underline']) .root{background:${colorTransparentBackground};border:0;border-radius:0;border-bottom:${strokeWidthThin} solid ${colorNeutralStrokeAccessible}}:host([appearance='underline']:hover) .root{border-bottom-color:${colorNeutralStrokeAccessibleHover}}:host([appearance='underline']:active) .root{border-bottom-color:${colorNeutralStrokeAccessiblePressed}}:host([appearance='underline']:focus-within) .root{border:0;border-bottom-color:${colorNeutralStrokeAccessiblePressed}}:host([appearance='underline'][disabled]) .root{border-bottom-color:${colorNeutralStrokeDisabled}}:host([appearance='filled-lighter']) .root,:host([appearance='filled-darker']) .root{border:${strokeWidthThin} solid ${colorTransparentStroke};box-shadow:${shadow2}}:host([appearance='filled-lighter']) .root{background:${colorNeutralBackground1}}:host([appearance='filled-darker']) .root{background:${colorNeutralBackground3}}:host([appearance='filled-lighter']:hover) .root,:host([appearance='filled-darker']:hover) .root{border-color:${colorTransparentStrokeInteractive}}:host([appearance='filled-lighter']:active) .root,:host([appearance='filled-darker']:active) .root{border-color:${colorTransparentStrokeInteractive};background:${colorNeutralBackground3}}`;
|
|
11192
|
+
|
|
11193
|
+
function textInputTemplate(options = {}) {
|
|
11194
|
+
return html`<label part="label" for="control" class="label" ${ref("controlLabel")}><slot ${slotted({
|
|
11195
|
+
property: "defaultSlottedNodes",
|
|
11196
|
+
filter: whitespaceFilter
|
|
11197
|
+
})}></slot></label><div class="root" part="root">${startSlotTemplate(options)}<input class="control" part="control" id="control" @change="${(x, c) => x.changeHandler(c.event)}" @input="${(x, c) => x.inputHandler(c.event)}" ?autofocus="${x => x.autofocus}" autocomplete="${x => x.autocomplete}" ?disabled="${x => x.disabled}" list="${x => x.list}" maxlength="${x => x.maxlength}" minlength="${x => x.minlength}" ?multiple="${x => x.multiple}" name="${x => x.name}" pattern="${x => x.pattern}" placeholder="${x => x.placeholder}" ?readonly="${x => x.readonly}" ?required="${x => x.required}" size="${x => x.size}" spellcheck="${x => x.spellcheck}" type="${x => x.type}" value="${x => x.initialValue}" ${ref("control")} />${endSlotTemplate(options)}</div>`;
|
|
11198
|
+
}
|
|
11199
|
+
const template$1 = textInputTemplate();
|
|
11059
11200
|
|
|
11060
11201
|
const definition$1 = TextInput.compose({
|
|
11061
11202
|
name: `${FluentDesignSystem.prefix}-text-input`,
|