@ukic/web-components 2.27.1 → 2.29.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. package/dist/cjs/core.cjs.js +1 -1
  2. package/dist/cjs/ic-accordion.cjs.entry.js +1 -1
  3. package/dist/cjs/ic-accordion.cjs.entry.js.map +1 -1
  4. package/dist/cjs/ic-alert.cjs.entry.js +9 -4
  5. package/dist/cjs/ic-alert.cjs.entry.js.map +1 -1
  6. package/dist/cjs/ic-badge.cjs.entry.js +2 -2
  7. package/dist/cjs/ic-badge.cjs.entry.js.map +1 -1
  8. package/dist/cjs/ic-dialog.cjs.entry.js.map +1 -1
  9. package/dist/cjs/ic-text-field.cjs.entry.js +2 -1
  10. package/dist/cjs/ic-text-field.cjs.entry.js.map +1 -1
  11. package/dist/cjs/ic-toast-region.cjs.entry.js +6 -0
  12. package/dist/cjs/ic-toast-region.cjs.entry.js.map +1 -1
  13. package/dist/cjs/loader.cjs.js +1 -1
  14. package/dist/collection/components/ic-accordion/ic-accordion.css +6 -0
  15. package/dist/collection/components/ic-alert/ic-alert.css +9 -1
  16. package/dist/collection/components/ic-alert/ic-alert.js +27 -3
  17. package/dist/collection/components/ic-alert/ic-alert.js.map +1 -1
  18. package/dist/collection/components/ic-alert/test/basic/ic-alert.spec.js +114 -0
  19. package/dist/collection/components/ic-alert/test/basic/ic-alert.spec.js.map +1 -1
  20. package/dist/collection/components/ic-badge/ic-badge.css +5 -0
  21. package/dist/collection/components/ic-badge/ic-badge.js +1 -1
  22. package/dist/collection/components/ic-badge/ic-badge.js.map +1 -1
  23. package/dist/collection/components/ic-dialog/ic-dialog.js +1 -1
  24. package/dist/collection/components/ic-dialog/ic-dialog.js.map +1 -1
  25. package/dist/collection/components/ic-text-field/ic-text-field.js +20 -1
  26. package/dist/collection/components/ic-text-field/ic-text-field.js.map +1 -1
  27. package/dist/collection/components/ic-text-field/test/basic/ic-text-field.input.spec.js +7 -0
  28. package/dist/collection/components/ic-text-field/test/basic/ic-text-field.input.spec.js.map +1 -1
  29. package/dist/collection/components/ic-text-field/test/basic/ic-text-field.textarea.spec.js +47 -17
  30. package/dist/collection/components/ic-text-field/test/basic/ic-text-field.textarea.spec.js.map +1 -1
  31. package/dist/collection/components/ic-toast-region/ic-toast-region.js +6 -0
  32. package/dist/collection/components/ic-toast-region/ic-toast-region.js.map +1 -1
  33. package/dist/components/ic-accordion.js +1 -1
  34. package/dist/components/ic-accordion.js.map +1 -1
  35. package/dist/components/ic-alert2.js +11 -5
  36. package/dist/components/ic-alert2.js.map +1 -1
  37. package/dist/components/ic-badge.js +2 -2
  38. package/dist/components/ic-badge.js.map +1 -1
  39. package/dist/components/ic-dialog.js.map +1 -1
  40. package/dist/components/ic-text-field2.js +3 -1
  41. package/dist/components/ic-text-field2.js.map +1 -1
  42. package/dist/components/ic-toast-region.js +6 -0
  43. package/dist/components/ic-toast-region.js.map +1 -1
  44. package/dist/core/core.esm.js +1 -1
  45. package/dist/core/core.esm.js.map +1 -1
  46. package/dist/core/p-3969d3c0.entry.js +2 -0
  47. package/dist/core/p-3969d3c0.entry.js.map +1 -0
  48. package/dist/core/{p-9146a7f9.entry.js → p-4562904d.entry.js} +2 -2
  49. package/dist/core/p-4562904d.entry.js.map +1 -0
  50. package/dist/core/p-55b11f6f.entry.js.map +1 -1
  51. package/dist/core/p-78605899.entry.js +2 -0
  52. package/dist/core/p-78605899.entry.js.map +1 -0
  53. package/dist/core/p-9e15d0e1.entry.js +2 -0
  54. package/dist/core/p-9e15d0e1.entry.js.map +1 -0
  55. package/dist/core/{p-49e997c7.entry.js → p-b1879a44.entry.js} +2 -2
  56. package/dist/core/p-b1879a44.entry.js.map +1 -0
  57. package/dist/esm/core.js +1 -1
  58. package/dist/esm/ic-accordion.entry.js +1 -1
  59. package/dist/esm/ic-accordion.entry.js.map +1 -1
  60. package/dist/esm/ic-alert.entry.js +10 -5
  61. package/dist/esm/ic-alert.entry.js.map +1 -1
  62. package/dist/esm/ic-badge.entry.js +2 -2
  63. package/dist/esm/ic-badge.entry.js.map +1 -1
  64. package/dist/esm/ic-dialog.entry.js.map +1 -1
  65. package/dist/esm/ic-text-field.entry.js +2 -1
  66. package/dist/esm/ic-text-field.entry.js.map +1 -1
  67. package/dist/esm/ic-toast-region.entry.js +6 -0
  68. package/dist/esm/ic-toast-region.entry.js.map +1 -1
  69. package/dist/esm/loader.js +1 -1
  70. package/dist/types/components/ic-alert/ic-alert.d.ts +5 -0
  71. package/dist/types/components/ic-dialog/ic-dialog.d.ts +1 -1
  72. package/dist/types/components/ic-text-field/ic-text-field.d.ts +4 -0
  73. package/dist/types/components/ic-toast-region/ic-toast-region.d.ts +1 -0
  74. package/dist/types/components.d.ts +18 -2
  75. package/hydrate/index.js +23 -8
  76. package/package.json +2 -2
  77. package/vscode-data.json +9 -1
  78. package/dist/core/p-1145e33c.entry.js +0 -2
  79. package/dist/core/p-1145e33c.entry.js.map +0 -1
  80. package/dist/core/p-49e997c7.entry.js.map +0 -1
  81. package/dist/core/p-9146a7f9.entry.js.map +0 -1
  82. package/dist/core/p-ad67c84f.entry.js +0 -2
  83. package/dist/core/p-ad67c84f.entry.js.map +0 -1
  84. package/dist/core/p-f735a277.entry.js +0 -2
  85. package/dist/core/p-f735a277.entry.js.map +0 -1
@@ -90,6 +90,7 @@ export class TextField {
90
90
  this.max = undefined;
91
91
  this.maxCharacters = 0;
92
92
  this.maxLength = 0;
93
+ this.maxLengthMessage = "Maximum length exceeded";
93
94
  this.min = undefined;
94
95
  this.minCharacters = 0;
95
96
  this.name = this.inputId;
@@ -181,7 +182,7 @@ export class TextField {
181
182
  : IcInformationStatus.Error
182
183
  : validationStatus;
183
184
  const currentValidationText = maxLengthExceeded
184
- ? "Maximum length exceeded"
185
+ ? this.maxLengthMessage
185
186
  : maxCharactersError
186
187
  ? `Maximum input is ${maxCharacters} characters`
187
188
  : maxValueExceeded
@@ -631,6 +632,24 @@ export class TextField {
631
632
  "reflect": false,
632
633
  "defaultValue": "0"
633
634
  },
635
+ "maxLengthMessage": {
636
+ "type": "string",
637
+ "mutable": false,
638
+ "complexType": {
639
+ "original": "string",
640
+ "resolved": "string",
641
+ "references": {}
642
+ },
643
+ "required": false,
644
+ "optional": false,
645
+ "docs": {
646
+ "tags": [],
647
+ "text": "The text to display as the validation message when the maximum length is exceeded."
648
+ },
649
+ "attribute": "max-length-message",
650
+ "reflect": false,
651
+ "defaultValue": "\"Maximum length exceeded\""
652
+ },
634
653
  "min": {
635
654
  "type": "any",
636
655
  "mutable": false,
@@ -1 +1 @@
1
- {"version":3,"file":"ic-text-field.js","sourceRoot":"","sources":["../../../src/components/ic-text-field/ic-text-field.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,OAAO,EACP,KAAK,EAEL,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,KAAK,EACL,KAAK,EACL,MAAM,EACN,CAAC,EACD,WAAW,GACZ,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,mBAAmB,GAMpB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,uBAAuB,EACvB,iBAAiB,EACjB,aAAa,EACb,gCAAgC,EAChC,oBAAoB,EACpB,uBAAuB,EACvB,UAAU,EACV,mBAAmB,EACnB,yBAAyB,GAC1B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAO1D,IAAI,QAAQ,GAAG,CAAC,CAAC;AACjB,MAAM,kBAAkB,GAAG,CAAC,GAAG,iBAAiB,EAAE,OAAO,CAAC,CAAC;AAE3D;;GAEG;AAMH,MAAM,OAAO,SAAS;;QACZ,wBAAmB,GAA4B,EAAE,CAAC;QAElD,yBAAoB,GAAqB,IAAI,CAAC;QAuU9C,yBAAoB,GAAG,CAAC,KAAa,EAAE,EAAE;YAC/C,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAC;YAE7B,IAAI,IAAI,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;gBAC3B,IA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {\n Component,\n Element,\n Event,\n EventEmitter,\n Host,\n Listen,\n Prop,\n State,\n Watch,\n Method,\n h,\n forceUpdate,\n} from \"@stencil/core\";\nimport {\n IcInformationStatus,\n IcAutocompleteTypes,\n IcAutocorrectStates,\n IcInformationStatusOrEmpty,\n IcValueEventDetail,\n IcSizesNoLarge,\n} from \"../../utils/types\";\nimport {\n inheritAttributes,\n debounceEvent,\n getInputDescribedByText,\n renderHiddenInput,\n isEmptyString,\n onComponentRequiredPropUndefined,\n addFormResetListener,\n removeFormResetListener,\n isSlotUsed,\n removeDisabledFalse,\n checkSlotInChildMutations,\n} from \"../../utils/helpers\";\nimport { IC_INHERITED_ARIA } from \"../../utils/constants\";\nimport {\n IcAriaAutocompleteTypes,\n IcTextFieldInputModes,\n IcTextFieldTypes,\n} from \"./ic-text-field.types\";\n\nlet inputIds = 0;\nconst MUTABLE_ATTRIBUTES = [...IC_INHERITED_ARIA, \"title\"];\n\n/**\n * @slot icon - Content will be placed to the left of the text input.\n */\n@Component({\n tag: \"ic-text-field\",\n styleUrl: \"ic-text-field.css\",\n shadow: true,\n})\nexport class TextField {\n private inheritedAttributes: { [k: string]: string } = {};\n private inputEl: HTMLInputElement | HTMLTextAreaElement;\n private hostMutationObserver: MutationObserver = null;\n\n @Element() el: HTMLIcTextFieldElement;\n\n @State() numChars: number = 0;\n @State() maxCharactersReached: boolean = false;\n @State() maxCharactersError: boolean = false;\n @State() minCharactersUnattained: boolean = false;\n @State() maxLengthExceeded: boolean = false;\n @State() maxValueExceeded: boolean = false;\n @State() minValueUnattained: boolean = false;\n\n /**\n * @slot clear-button - an ic-button clear component will render as an end adornment to the input.\n * @slot search-submit-button - an ic-button search submit component will render as an end adornment to the input.\n * @slot menu - an ic-menu component will appear below the input.\n */\n\n /**\n * @internal The active element when focus is on the ic-menu items.\n */\n @Prop() ariaActiveDescendant?: string;\n\n /**\n * @internal Used to identify whether inputting any text triggers more predictions\n */\n @Prop() ariaAutocomplete: IcAriaAutocompleteTypes = undefined;\n\n /**\n * @internal Used to identify if the slotted menu is rendered\n */\n @Prop() ariaExpanded: string;\n\n /**\n * @internal Used to identify any related child component\n */\n @Prop() ariaOwns: string;\n\n /**\n * The automatic capitalisation of the text value as it is entered/edited by the user.\n * Available options: \"off\", \"none\", \"on\", \"sentences\", \"words\", \"characters\".\n */\n @Prop() autocapitalize = \"off\";\n\n /**\n * The state of autocompletion the browser can apply on the text value.\n */\n @Prop() autocomplete: IcAutocompleteTypes = \"off\";\n\n /**\n * The state of autocorrection the browser can apply when the user is entering/editing the text value.\n */\n @Prop() autocorrect: IcAutocorrectStates = \"off\";\n\n /**\n * If `true`, the form control will have input focus when the page loads.\n */\n @Prop() autoFocus = false;\n\n /**\n * If `true`, the disabled state will be set.\n */\n @Prop() disabled: boolean = false;\n\n /**\n * Specify whether the text field fills the full width of the container.\n * If `true`, this overrides the --input-width CSS variable.\n */\n @Prop() fullWidth: boolean = false;\n\n /**\n * The helper text that will be displayed for additional field guidance.\n */\n @Prop() helperText: string = \"\";\n\n /**\n * If `true`, the label will be hidden and the required label value will be applied as an aria-label.\n */\n @Prop() hideLabel: boolean = false;\n\n /**\n * @internal If `true`, the hidden form input will stop rendering for form submission.\n */\n @Prop() hiddenInput: boolean = true;\n\n /**\n * The ID for the input.\n */\n @Prop() inputId?: string = `ic-text-field-input-${inputIds++}`;\n\n /**\n * A hint to the browser for which keyboard to display.\n * Possible values: `\"none\"`, `\"text\"`, `\"tel\"`, `\"url\"`,\n * `\"email\"`, `\"numeric\"`, `\"decimal\"`, and `\"search\"`.\n */\n @Prop() inputmode: IcTextFieldInputModes = \"text\";\n\n /**\n * The label for the input.\n */\n @Prop() label!: string;\n\n /**\n * The maximum number that can be accepted as a value, when `type` is `number` and `rows` is `1`. (NOTE: Ensure to include visual indication of max value in `helperText` or `label`)\n */\n @Prop() max: string | number = undefined;\n\n /**\n * The maximum number of characters that can be entered in the field. Will display an error if too many characters are entered.\n */\n @Prop() maxCharacters: number = 0;\n\n /**\n * The count of characters in the field. Will display a warning if the bound is reached.\n */\n @Prop() maxLength: number = 0;\n\n /**\n * The minimum number that can be accepted as a value, when `type` is `number` and `rows` is `1`. (NOTE: Ensure to include visual indication of min value in `helperText` or `label`)\n */\n @Prop() min: string | number = undefined;\n\n /**\n * The minimum number of characters that can be entered in the field.\n */\n @Prop() minCharacters: number = 0;\n\n /**\n * The name of the control, which is submitted with the form data.\n */\n @Prop() name: string = this.inputId;\n\n /**\n * The placeholder value to be displayed.\n */\n @Prop() placeholder: string = \"\";\n\n /**\n * If `true`, the read only state will be set.\n */\n @Prop({ reflect: true }) readonly: boolean = false;\n\n /**\n * If `true`, the input will require a value.\n */\n @Prop() required: boolean = false;\n\n /**\n * If `true`, the multiline text area will be resizeable.\n */\n @Prop() resize: boolean = false;\n\n /**\n * @internal Used to set the role if not default textbox;\n */\n @Prop() role: string;\n\n /**\n * The number of rows to transform the text field into a text area with a specific height.\n */\n @Prop() rows: number = 1;\n\n /**\n * The size of the text field component.\n */\n @Prop() size?: IcSizesNoLarge = \"default\";\n\n /**\n * @deprecated This prop should not be used anymore. Set prop `size` to \"small\" instead.\n */\n @Prop() small?: boolean = false;\n\n /**\n * If `true`, the value of the text field will have its spelling and grammar checked.\n */\n @Prop() spellcheck: boolean = false;\n /**\n * @internal If `true`, an ellipsis will be displayed at the end of the value if the value is longer than the container.\n */\n @Prop() truncateValue?: boolean;\n\n /**\n * The type of control to display. The default type is text.\n */\n @Prop() type: IcTextFieldTypes = \"text\";\n\n /**\n * If `true`, the icon in input control will be displayed - only applies when validationStatus ='success'.\n */\n @Prop() validationInline: boolean = false;\n\n /**\n * @internal If `true`, the validation will display inline.\n */\n @Prop() validationInlineInternal: boolean = false;\n\n /**\n * The validation state - e.g. 'error' | 'warning' | 'success'.\n */\n @Prop() validationStatus: IcInformationStatusOrEmpty = \"\";\n\n /**\n * The validation state - e.g. 'error' | 'warning' | 'success'.\n */\n @Prop() validationText: string = \"\";\n\n /**\n * The amount of time, in milliseconds, to wait to trigger the `icChange` event after each keystroke.\n */\n @Prop() debounce: number = 0;\n\n @Watch(\"debounce\")\n private debounceChanged() {\n this.icChange = debounceEvent(this.icChange, this.debounce);\n }\n\n /**\n * The value of the text field.\n */\n @Prop({ reflect: true, mutable: true }) value: string = \"\";\n @State() initialValue = this.value;\n\n @Watch(\"value\")\n private watchValueHandler(newValue: string): void {\n if (this.inputEl && this.inputEl.value !== newValue) {\n this.inputEl.value = newValue;\n }\n\n this.getMaxLengthExceeded(newValue);\n\n this.getMaxCharactersReached(newValue);\n\n this.icChange.emit({ value: newValue });\n }\n\n /**\n * @internal Emitted when the validationInlineInternal is `true`\n */\n @Event() getValidationText: EventEmitter<IcValueEventDetail>;\n\n /**\n * Emitted when input loses focus.\n */\n @Event() icBlur: EventEmitter<IcValueEventDetail>;\n\n /**\n * Emitted when the value has changed.\n */\n @Event() icChange: EventEmitter<IcValueEventDetail>;\n\n /**\n * Emitted when input gains focus.\n */\n @Event() icFocus: EventEmitter<IcValueEventDetail>;\n\n /**\n * Emitted when a keyboard input occurred.\n */\n @Event() icInput: EventEmitter<IcValueEventDetail>;\n\n /**\n * Emitted when a keydown event occurred.\n */\n @Event() icKeydown: EventEmitter<{ event: KeyboardEvent }>;\n\n connectedCallback(): void {\n this.debounceChanged();\n }\n\n disconnectedCallback(): void {\n removeFormResetListener(this.el, this.handleFormReset);\n this.hostMutationObserver?.disconnect();\n }\n\n componentWillLoad(): void {\n if (this.value !== this.initialValue) {\n this.watchValueHandler(this.value);\n }\n\n this.getMaxLengthExceeded(this.value);\n\n this.getMaxCharactersReached(this.value);\n\n this.inheritedAttributes = inheritAttributes(this.el, MUTABLE_ATTRIBUTES);\n\n if (this.readonly) {\n this.maxLengthExceeded = false;\n this.maxValueExceeded = false;\n this.minValueUnattained = false;\n }\n\n addFormResetListener(this.el, this.handleFormReset);\n\n removeDisabledFalse(this.disabled, this.el);\n }\n\n componentDidLoad(): void {\n onComponentRequiredPropUndefined(\n [{ prop: this.label, propName: \"label\" }],\n \"Text Field\"\n );\n if (this.validationInlineInternal) {\n this.getValidationText.emit({ value: this.validationText });\n }\n\n this.hostMutationObserver = new MutationObserver(this.hostMutationCallback);\n this.hostMutationObserver.observe(this.el, {\n attributes: true,\n childList: true,\n });\n }\n\n @Listen(\"keydown\", {})\n handleKeyDown(ev: KeyboardEvent): void {\n this.icKeydown.emit({ event: ev });\n this.maxCharactersError = this.maxCharactersReached;\n }\n\n /**\n * Sets focus on the native `input`.\n */\n\n @Method()\n async setFocus(): Promise<void> {\n this.inputEl?.focus();\n }\n\n private getMaxLengthExceeded = (value: string) => {\n this.numChars = value.length;\n\n if (this.type === \"number\") {\n this.minValueUnattained = value && Number(value) < Number(this.min);\n this.maxValueExceeded = Number(value) > Number(this.max);\n }\n\n if (this.maxLength > 0) {\n this.maxLengthExceeded = this.numChars > this.maxLength;\n }\n };\n\n private getMaxCharactersReached = (value: string) => {\n this.numChars = value.length;\n this.maxCharactersReached =\n this.maxCharacters > 0 ? this.numChars >= this.maxCharacters : false;\n\n if (this.maxCharactersError && !this.maxCharactersReached) {\n this.maxCharactersError = false;\n }\n };\n\n private onInput = (ev: Event) => {\n this.value = (ev.target as HTMLInputElement).value;\n this.icInput.emit({ value: this.value });\n };\n\n private onBlur = (ev: Event) => {\n const value = (ev.target as HTMLInputElement).value;\n this.numChars = value.length;\n this.minCharactersUnattained =\n this.minCharacters > 0 ? this.numChars < this.minCharacters : false;\n this.icBlur.emit({ value: value });\n };\n\n private onFocus = (ev: Event) => {\n this.icFocus.emit({ value: (ev.target as HTMLInputElement).value });\n };\n\n private hasStatus = (status: IcInformationStatusOrEmpty) =>\n status !== \"\" && !this.disabled;\n\n private handleFormReset = (): void => {\n this.value = this.initialValue;\n };\n\n // triggered when attributes of host element change\n private hostMutationCallback = (mutationList: MutationRecord[]): void => {\n let forceComponentUpdate = false;\n mutationList.forEach(\n ({ attributeName, type, addedNodes, removedNodes }) => {\n if (MUTABLE_ATTRIBUTES.includes(attributeName)) {\n this.inheritedAttributes[attributeName] =\n this.el.getAttribute(attributeName);\n forceComponentUpdate = true;\n } else if (type === \"childList\") {\n forceComponentUpdate = checkSlotInChildMutations(\n addedNodes,\n removedNodes,\n \"icon\"\n );\n }\n }\n );\n if (forceComponentUpdate) {\n forceUpdate(this);\n }\n };\n\n render() {\n const {\n inputId,\n name,\n label,\n required,\n size,\n small,\n placeholder,\n helperText,\n rows,\n resize,\n disabled,\n value,\n min,\n max,\n maxLength,\n numChars,\n readonly,\n maxLengthExceeded,\n maxCharacters,\n maxCharactersError,\n maxCharactersReached,\n minCharacters,\n minCharactersUnattained,\n minValueUnattained,\n maxValueExceeded,\n validationStatus,\n validationText,\n validationInline,\n validationInlineInternal,\n spellcheck,\n inputmode,\n fullWidth,\n truncateValue,\n hiddenInput,\n } = this;\n\n const disabledMode = readonly ? true : disabled;\n\n const currentStatus =\n maxLengthExceeded ||\n maxValueExceeded ||\n minValueUnattained ||\n minCharactersUnattained ||\n maxCharactersError\n ? maxCharactersError\n ? IcInformationStatus.Warning\n : IcInformationStatus.Error\n : validationStatus;\n\n const currentValidationText = maxLengthExceeded\n ? \"Maximum length exceeded\"\n : maxCharactersError\n ? `Maximum input is ${maxCharacters} characters`\n : maxValueExceeded\n ? `Maximum value of ${max} exceeded`\n : minValueUnattained\n ? `Minimum value of ${min} not met`\n : minCharactersUnattained\n ? `Minimum input is ${minCharacters} characters`\n : validationText;\n\n const maxNumChars = readonly ? 0 : maxLength;\n const messageAriaLive =\n maxLengthExceeded ||\n maxCharactersError ||\n maxValueExceeded ||\n minValueUnattained ||\n (maxLength === 0 && currentStatus === IcInformationStatus.Error)\n ? \"assertive\"\n : \"polite\";\n\n const showStatusText =\n this.hasStatus(currentStatus) &&\n !(currentStatus == IcInformationStatus.Success && validationInline) &&\n !validationInlineInternal;\n\n const multiline = rows > 1;\n const hiddenCharCountDescId =\n maxLength > 0 ? `${inputId}-charcount-desc` : \"\";\n\n const describedBy = `${hiddenCharCountDescId} ${getInputDescribedByText(\n inputId,\n helperText !== \"\",\n showStatusText\n )}`.trim();\n\n const disabledText = disabledMode && !readonly;\n const showLeftIcon =\n !!this.el.querySelector(`[slot=\"icon\"]`) && !disabledText;\n\n const invalid = `${currentStatus === IcInformationStatus.Error}`;\n\n if (hiddenInput) {\n renderHiddenInput(true, this.el, name, value, disabledMode);\n }\n return (\n <Host class={{ [\"fullwidth\"]: fullWidth }}>\n <ic-input-container readonly={readonly} disabled={disabledMode}>\n {!this.hideLabel && (\n <ic-input-label\n for={inputId}\n label={label}\n helperText={helperText}\n required={required}\n disabled={disabledText}\n readonly={readonly}\n ></ic-input-label>\n )}\n\n <ic-input-component-container\n size={small ? \"small\" : size}\n validationStatus={currentStatus}\n multiLine={multiline}\n disabled={disabledMode}\n readonly={readonly}\n validationInline={validationInline}\n fullWidth={fullWidth}\n >\n {showLeftIcon && (\n <span\n class={{\n [\"readonly\"]: readonly,\n [\"has-value\"]: value.length > 0,\n }}\n slot=\"left-icon\"\n >\n <slot name=\"icon\" />\n </span>\n )}\n\n {!multiline ? (\n <input\n id={inputId}\n name={name}\n ref={(el) => (this.inputEl = el as HTMLInputElement)}\n type={this.type}\n min={min}\n max={max}\n value={value}\n class={{\n [\"no-left-pad\"]: !showLeftIcon && readonly,\n [\"readonly\"]: readonly,\n [\"truncate-value\"]: truncateValue,\n }}\n placeholder={placeholder ? placeholder : \"\"}\n required={required}\n disabled={disabledMode}\n readonly={readonly}\n onInput={this.onInput}\n onBlur={this.onBlur}\n onFocus={this.onFocus}\n aria-label={label}\n aria-describedby={describedBy}\n aria-invalid={invalid}\n aria-activedescendant={this.ariaActiveDescendant}\n aria-expanded={this.ariaExpanded}\n aria-owns={this.ariaOwns}\n autocomplete={this.autocomplete}\n autocapitalize={this.autocapitalize}\n autoFocus={this.autoFocus}\n spellcheck={spellcheck}\n inputmode={inputmode}\n role={this.role}\n maxlength={maxCharactersReached ? maxCharacters : null}\n minlength={minCharactersUnattained ? minCharacters : null}\n {...this.inheritedAttributes}\n ></input>\n ) : (\n <textarea\n id={inputId}\n class={{\n [\"no-resize\"]: resize === false || readonly,\n [\"no-left-pad\"]: !showLeftIcon && readonly,\n [\"readonly\"]: readonly,\n }}\n name={name}\n ref={(el) => (this.inputEl = el as HTMLTextAreaElement)}\n value={value}\n rows={rows}\n required={required}\n disabled={disabledMode}\n placeholder={placeholder ? placeholder : \"\"}\n readonly={readonly}\n onInput={this.onInput}\n onBlur={this.onBlur}\n onFocus={this.onFocus}\n aria-label={label}\n aria-describedby={describedBy}\n aria-invalid={invalid}\n autocapitalize={this.autocapitalize}\n autoFocus={this.autoFocus}\n spellcheck={spellcheck}\n inputmode={inputmode}\n maxlength={maxCharactersReached ? maxCharacters : null}\n minlength={minCharactersUnattained ? minCharacters : null}\n {...this.inheritedAttributes}\n ></textarea>\n )}\n {isSlotUsed(this.el, \"clear-button\") && (\n <slot name=\"clear-button\"></slot>\n )}\n {isSlotUsed(this.el, \"search-submit-button\") && (\n <slot name=\"search-submit-button\"></slot>\n )}\n </ic-input-component-container>\n {isSlotUsed(this.el, \"menu\") && <slot name=\"menu\"></slot>}\n {(!isEmptyString(validationStatus) ||\n !isEmptyString(validationText) ||\n maxNumChars > 0 ||\n maxValueExceeded ||\n maxCharactersError ||\n minCharactersUnattained ||\n minValueUnattained) &&\n !validationInlineInternal && (\n <ic-input-validation\n status={\n this.hasStatus(currentStatus) === false ||\n (currentStatus === IcInformationStatus.Success &&\n validationInline) ||\n validationInlineInternal\n ? \"\"\n : currentStatus\n }\n message={showStatusText ? currentValidationText : \"\"}\n ariaLiveMode={messageAriaLive}\n for={inputId}\n fullWidth={fullWidth}\n >\n {!readonly && maxNumChars > 0 && (\n <div slot=\"validation-message-adornment\">\n <ic-typography\n variant=\"caption\"\n class={{\n [\"maxlengthtext\"]: true,\n [\"error\"]: maxLengthExceeded,\n [\"disabled\"]: disabledText,\n }}\n >\n <span\n aria-live=\"polite\"\n id={`${inputId}-charcount`}\n class=\"charcount\"\n >\n {numChars}/{maxNumChars}\n </span>\n <span hidden={true} id={hiddenCharCountDescId}>\n Field can contain a maximum of {maxNumChars} characters.\n </span>\n </ic-typography>\n </div>\n )}\n </ic-input-validation>\n )}\n </ic-input-container>\n </Host>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"ic-text-field.js","sourceRoot":"","sources":["../../../src/components/ic-text-field/ic-text-field.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,OAAO,EACP,KAAK,EAEL,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,KAAK,EACL,KAAK,EACL,MAAM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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {\n Component,\n Element,\n Event,\n EventEmitter,\n Host,\n Listen,\n Prop,\n State,\n Watch,\n Method,\n h,\n forceUpdate,\n} from \"@stencil/core\";\nimport {\n IcInformationStatus,\n IcAutocompleteTypes,\n IcAutocorrectStates,\n IcInformationStatusOrEmpty,\n IcValueEventDetail,\n IcSizesNoLarge,\n} from \"../../utils/types\";\nimport {\n inheritAttributes,\n debounceEvent,\n getInputDescribedByText,\n renderHiddenInput,\n isEmptyString,\n onComponentRequiredPropUndefined,\n addFormResetListener,\n removeFormResetListener,\n isSlotUsed,\n removeDisabledFalse,\n checkSlotInChildMutations,\n} from \"../../utils/helpers\";\nimport { IC_INHERITED_ARIA } from \"../../utils/constants\";\nimport {\n IcAriaAutocompleteTypes,\n IcTextFieldInputModes,\n IcTextFieldTypes,\n} from \"./ic-text-field.types\";\n\nlet inputIds = 0;\nconst MUTABLE_ATTRIBUTES = [...IC_INHERITED_ARIA, \"title\"];\n\n/**\n * @slot icon - Content will be placed to the left of the text input.\n */\n@Component({\n tag: \"ic-text-field\",\n styleUrl: \"ic-text-field.css\",\n shadow: true,\n})\nexport class TextField {\n private inheritedAttributes: { [k: string]: string } = {};\n private inputEl: HTMLInputElement | HTMLTextAreaElement;\n private hostMutationObserver: MutationObserver = null;\n\n @Element() el: HTMLIcTextFieldElement;\n\n @State() numChars: number = 0;\n @State() maxCharactersReached: boolean = false;\n @State() maxCharactersError: boolean = false;\n @State() minCharactersUnattained: boolean = false;\n @State() maxLengthExceeded: boolean = false;\n @State() maxValueExceeded: boolean = false;\n @State() minValueUnattained: boolean = false;\n\n /**\n * @slot clear-button - an ic-button clear component will render as an end adornment to the input.\n * @slot search-submit-button - an ic-button search submit component will render as an end adornment to the input.\n * @slot menu - an ic-menu component will appear below the input.\n */\n\n /**\n * @internal The active element when focus is on the ic-menu items.\n */\n @Prop() ariaActiveDescendant?: string;\n\n /**\n * @internal Used to identify whether inputting any text triggers more predictions\n */\n @Prop() ariaAutocomplete: IcAriaAutocompleteTypes = undefined;\n\n /**\n * @internal Used to identify if the slotted menu is rendered\n */\n @Prop() ariaExpanded: string;\n\n /**\n * @internal Used to identify any related child component\n */\n @Prop() ariaOwns: string;\n\n /**\n * The automatic capitalisation of the text value as it is entered/edited by the user.\n * Available options: \"off\", \"none\", \"on\", \"sentences\", \"words\", \"characters\".\n */\n @Prop() autocapitalize = \"off\";\n\n /**\n * The state of autocompletion the browser can apply on the text value.\n */\n @Prop() autocomplete: IcAutocompleteTypes = \"off\";\n\n /**\n * The state of autocorrection the browser can apply when the user is entering/editing the text value.\n */\n @Prop() autocorrect: IcAutocorrectStates = \"off\";\n\n /**\n * If `true`, the form control will have input focus when the page loads.\n */\n @Prop() autoFocus = false;\n\n /**\n * If `true`, the disabled state will be set.\n */\n @Prop() disabled: boolean = false;\n\n /**\n * Specify whether the text field fills the full width of the container.\n * If `true`, this overrides the --input-width CSS variable.\n */\n @Prop() fullWidth: boolean = false;\n\n /**\n * The helper text that will be displayed for additional field guidance.\n */\n @Prop() helperText: string = \"\";\n\n /**\n * If `true`, the label will be hidden and the required label value will be applied as an aria-label.\n */\n @Prop() hideLabel: boolean = false;\n\n /**\n * @internal If `true`, the hidden form input will stop rendering for form submission.\n */\n @Prop() hiddenInput: boolean = true;\n\n /**\n * The ID for the input.\n */\n @Prop() inputId?: string = `ic-text-field-input-${inputIds++}`;\n\n /**\n * A hint to the browser for which keyboard to display.\n * Possible values: `\"none\"`, `\"text\"`, `\"tel\"`, `\"url\"`,\n * `\"email\"`, `\"numeric\"`, `\"decimal\"`, and `\"search\"`.\n */\n @Prop() inputmode: IcTextFieldInputModes = \"text\";\n\n /**\n * The label for the input.\n */\n @Prop() label!: string;\n\n /**\n * The maximum number that can be accepted as a value, when `type` is `number` and `rows` is `1`. (NOTE: Ensure to include visual indication of max value in `helperText` or `label`)\n */\n @Prop() max: string | number = undefined;\n\n /**\n * The maximum number of characters that can be entered in the field. Will display an error if too many characters are entered.\n */\n @Prop() maxCharacters: number = 0;\n\n /**\n * The count of characters in the field. Will display a warning if the bound is reached.\n */\n @Prop() maxLength: number = 0;\n\n /**\n * The text to display as the validation message when the maximum length is exceeded.\n */\n @Prop() maxLengthMessage: string = \"Maximum length exceeded\";\n\n /**\n * The minimum number that can be accepted as a value, when `type` is `number` and `rows` is `1`. (NOTE: Ensure to include visual indication of min value in `helperText` or `label`)\n */\n @Prop() min: string | number = undefined;\n\n /**\n * The minimum number of characters that can be entered in the field.\n */\n @Prop() minCharacters: number = 0;\n\n /**\n * The name of the control, which is submitted with the form data.\n */\n @Prop() name: string = this.inputId;\n\n /**\n * The placeholder value to be displayed.\n */\n @Prop() placeholder: string = \"\";\n\n /**\n * If `true`, the read only state will be set.\n */\n @Prop({ reflect: true }) readonly: boolean = false;\n\n /**\n * If `true`, the input will require a value.\n */\n @Prop() required: boolean = false;\n\n /**\n * If `true`, the multiline text area will be resizeable.\n */\n @Prop() resize: boolean = false;\n\n /**\n * @internal Used to set the role if not default textbox;\n */\n @Prop() role: string;\n\n /**\n * The number of rows to transform the text field into a text area with a specific height.\n */\n @Prop() rows: number = 1;\n\n /**\n * The size of the text field component.\n */\n @Prop() size?: IcSizesNoLarge = \"default\";\n\n /**\n * @deprecated This prop should not be used anymore. Set prop `size` to \"small\" instead.\n */\n @Prop() small?: boolean = false;\n\n /**\n * If `true`, the value of the text field will have its spelling and grammar checked.\n */\n @Prop() spellcheck: boolean = false;\n /**\n * @internal If `true`, an ellipsis will be displayed at the end of the value if the value is longer than the container.\n */\n @Prop() truncateValue?: boolean;\n\n /**\n * The type of control to display. The default type is text.\n */\n @Prop() type: IcTextFieldTypes = \"text\";\n\n /**\n * If `true`, the icon in input control will be displayed - only applies when validationStatus ='success'.\n */\n @Prop() validationInline: boolean = false;\n\n /**\n * @internal If `true`, the validation will display inline.\n */\n @Prop() validationInlineInternal: boolean = false;\n\n /**\n * The validation state - e.g. 'error' | 'warning' | 'success'.\n */\n @Prop() validationStatus: IcInformationStatusOrEmpty = \"\";\n\n /**\n * The validation state - e.g. 'error' | 'warning' | 'success'.\n */\n @Prop() validationText: string = \"\";\n\n /**\n * The amount of time, in milliseconds, to wait to trigger the `icChange` event after each keystroke.\n */\n @Prop() debounce: number = 0;\n\n @Watch(\"debounce\")\n private debounceChanged() {\n this.icChange = debounceEvent(this.icChange, this.debounce);\n }\n\n /**\n * The value of the text field.\n */\n @Prop({ reflect: true, mutable: true }) value: string = \"\";\n @State() initialValue = this.value;\n\n @Watch(\"value\")\n private watchValueHandler(newValue: string): void {\n if (this.inputEl && this.inputEl.value !== newValue) {\n this.inputEl.value = newValue;\n }\n\n this.getMaxLengthExceeded(newValue);\n\n this.getMaxCharactersReached(newValue);\n\n this.icChange.emit({ value: newValue });\n }\n\n /**\n * @internal Emitted when the validationInlineInternal is `true`\n */\n @Event() getValidationText: EventEmitter<IcValueEventDetail>;\n\n /**\n * Emitted when input loses focus.\n */\n @Event() icBlur: EventEmitter<IcValueEventDetail>;\n\n /**\n * Emitted when the value has changed.\n */\n @Event() icChange: EventEmitter<IcValueEventDetail>;\n\n /**\n * Emitted when input gains focus.\n */\n @Event() icFocus: EventEmitter<IcValueEventDetail>;\n\n /**\n * Emitted when a keyboard input occurred.\n */\n @Event() icInput: EventEmitter<IcValueEventDetail>;\n\n /**\n * Emitted when a keydown event occurred.\n */\n @Event() icKeydown: EventEmitter<{ event: KeyboardEvent }>;\n\n connectedCallback(): void {\n this.debounceChanged();\n }\n\n disconnectedCallback(): void {\n removeFormResetListener(this.el, this.handleFormReset);\n this.hostMutationObserver?.disconnect();\n }\n\n componentWillLoad(): void {\n if (this.value !== this.initialValue) {\n this.watchValueHandler(this.value);\n }\n\n this.getMaxLengthExceeded(this.value);\n\n this.getMaxCharactersReached(this.value);\n\n this.inheritedAttributes = inheritAttributes(this.el, MUTABLE_ATTRIBUTES);\n\n if (this.readonly) {\n this.maxLengthExceeded = false;\n this.maxValueExceeded = false;\n this.minValueUnattained = false;\n }\n\n addFormResetListener(this.el, this.handleFormReset);\n\n removeDisabledFalse(this.disabled, this.el);\n }\n\n componentDidLoad(): void {\n onComponentRequiredPropUndefined(\n [{ prop: this.label, propName: \"label\" }],\n \"Text Field\"\n );\n if (this.validationInlineInternal) {\n this.getValidationText.emit({ value: this.validationText });\n }\n\n this.hostMutationObserver = new MutationObserver(this.hostMutationCallback);\n this.hostMutationObserver.observe(this.el, {\n attributes: true,\n childList: true,\n });\n }\n\n @Listen(\"keydown\", {})\n handleKeyDown(ev: KeyboardEvent): void {\n this.icKeydown.emit({ event: ev });\n this.maxCharactersError = this.maxCharactersReached;\n }\n\n /**\n * Sets focus on the native `input`.\n */\n\n @Method()\n async setFocus(): Promise<void> {\n this.inputEl?.focus();\n }\n\n private getMaxLengthExceeded = (value: string) => {\n this.numChars = value.length;\n\n if (this.type === \"number\") {\n this.minValueUnattained = value && Number(value) < Number(this.min);\n this.maxValueExceeded = Number(value) > Number(this.max);\n }\n\n if (this.maxLength > 0) {\n this.maxLengthExceeded = this.numChars > this.maxLength;\n }\n };\n\n private getMaxCharactersReached = (value: string) => {\n this.numChars = value.length;\n this.maxCharactersReached =\n this.maxCharacters > 0 ? this.numChars >= this.maxCharacters : false;\n\n if (this.maxCharactersError && !this.maxCharactersReached) {\n this.maxCharactersError = false;\n }\n };\n\n private onInput = (ev: Event) => {\n this.value = (ev.target as HTMLInputElement).value;\n this.icInput.emit({ value: this.value });\n };\n\n private onBlur = (ev: Event) => {\n const value = (ev.target as HTMLInputElement).value;\n this.numChars = value.length;\n this.minCharactersUnattained =\n this.minCharacters > 0 ? this.numChars < this.minCharacters : false;\n this.icBlur.emit({ value: value });\n };\n\n private onFocus = (ev: Event) => {\n this.icFocus.emit({ value: (ev.target as HTMLInputElement).value });\n };\n\n private hasStatus = (status: IcInformationStatusOrEmpty) =>\n status !== \"\" && !this.disabled;\n\n private handleFormReset = (): void => {\n this.value = this.initialValue;\n };\n\n // triggered when attributes of host element change\n private hostMutationCallback = (mutationList: MutationRecord[]): void => {\n let forceComponentUpdate = false;\n mutationList.forEach(\n ({ attributeName, type, addedNodes, removedNodes }) => {\n if (MUTABLE_ATTRIBUTES.includes(attributeName)) {\n this.inheritedAttributes[attributeName] =\n this.el.getAttribute(attributeName);\n forceComponentUpdate = true;\n } else if (type === \"childList\") {\n forceComponentUpdate = checkSlotInChildMutations(\n addedNodes,\n removedNodes,\n \"icon\"\n );\n }\n }\n );\n if (forceComponentUpdate) {\n forceUpdate(this);\n }\n };\n\n render() {\n const {\n inputId,\n name,\n label,\n required,\n size,\n small,\n placeholder,\n helperText,\n rows,\n resize,\n disabled,\n value,\n min,\n max,\n maxLength,\n numChars,\n readonly,\n maxLengthExceeded,\n maxCharacters,\n maxCharactersError,\n maxCharactersReached,\n minCharacters,\n minCharactersUnattained,\n minValueUnattained,\n maxValueExceeded,\n validationStatus,\n validationText,\n validationInline,\n validationInlineInternal,\n spellcheck,\n inputmode,\n fullWidth,\n truncateValue,\n hiddenInput,\n } = this;\n\n const disabledMode = readonly ? true : disabled;\n\n const currentStatus =\n maxLengthExceeded ||\n maxValueExceeded ||\n minValueUnattained ||\n minCharactersUnattained ||\n maxCharactersError\n ? maxCharactersError\n ? IcInformationStatus.Warning\n : IcInformationStatus.Error\n : validationStatus;\n\n const currentValidationText = maxLengthExceeded\n ? this.maxLengthMessage\n : maxCharactersError\n ? `Maximum input is ${maxCharacters} characters`\n : maxValueExceeded\n ? `Maximum value of ${max} exceeded`\n : minValueUnattained\n ? `Minimum value of ${min} not met`\n : minCharactersUnattained\n ? `Minimum input is ${minCharacters} characters`\n : validationText;\n\n const maxNumChars = readonly ? 0 : maxLength;\n const messageAriaLive =\n maxLengthExceeded ||\n maxCharactersError ||\n maxValueExceeded ||\n minValueUnattained ||\n (maxLength === 0 && currentStatus === IcInformationStatus.Error)\n ? \"assertive\"\n : \"polite\";\n\n const showStatusText =\n this.hasStatus(currentStatus) &&\n !(currentStatus == IcInformationStatus.Success && validationInline) &&\n !validationInlineInternal;\n\n const multiline = rows > 1;\n const hiddenCharCountDescId =\n maxLength > 0 ? `${inputId}-charcount-desc` : \"\";\n\n const describedBy = `${hiddenCharCountDescId} ${getInputDescribedByText(\n inputId,\n helperText !== \"\",\n showStatusText\n )}`.trim();\n\n const disabledText = disabledMode && !readonly;\n const showLeftIcon =\n !!this.el.querySelector(`[slot=\"icon\"]`) && !disabledText;\n\n const invalid = `${currentStatus === IcInformationStatus.Error}`;\n\n if (hiddenInput) {\n renderHiddenInput(true, this.el, name, value, disabledMode);\n }\n return (\n <Host class={{ [\"fullwidth\"]: fullWidth }}>\n <ic-input-container readonly={readonly} disabled={disabledMode}>\n {!this.hideLabel && (\n <ic-input-label\n for={inputId}\n label={label}\n helperText={helperText}\n required={required}\n disabled={disabledText}\n readonly={readonly}\n ></ic-input-label>\n )}\n\n <ic-input-component-container\n size={small ? \"small\" : size}\n validationStatus={currentStatus}\n multiLine={multiline}\n disabled={disabledMode}\n readonly={readonly}\n validationInline={validationInline}\n fullWidth={fullWidth}\n >\n {showLeftIcon && (\n <span\n class={{\n [\"readonly\"]: readonly,\n [\"has-value\"]: value.length > 0,\n }}\n slot=\"left-icon\"\n >\n <slot name=\"icon\" />\n </span>\n )}\n\n {!multiline ? (\n <input\n id={inputId}\n name={name}\n ref={(el) => (this.inputEl = el as HTMLInputElement)}\n type={this.type}\n min={min}\n max={max}\n value={value}\n class={{\n [\"no-left-pad\"]: !showLeftIcon && readonly,\n [\"readonly\"]: readonly,\n [\"truncate-value\"]: truncateValue,\n }}\n placeholder={placeholder ? placeholder : \"\"}\n required={required}\n disabled={disabledMode}\n readonly={readonly}\n onInput={this.onInput}\n onBlur={this.onBlur}\n onFocus={this.onFocus}\n aria-label={label}\n aria-describedby={describedBy}\n aria-invalid={invalid}\n aria-activedescendant={this.ariaActiveDescendant}\n aria-expanded={this.ariaExpanded}\n aria-owns={this.ariaOwns}\n autocomplete={this.autocomplete}\n autocapitalize={this.autocapitalize}\n autoFocus={this.autoFocus}\n spellcheck={spellcheck}\n inputmode={inputmode}\n role={this.role}\n maxlength={maxCharactersReached ? maxCharacters : null}\n minlength={minCharactersUnattained ? minCharacters : null}\n {...this.inheritedAttributes}\n ></input>\n ) : (\n <textarea\n id={inputId}\n class={{\n [\"no-resize\"]: resize === false || readonly,\n [\"no-left-pad\"]: !showLeftIcon && readonly,\n [\"readonly\"]: readonly,\n }}\n name={name}\n ref={(el) => (this.inputEl = el as HTMLTextAreaElement)}\n value={value}\n rows={rows}\n required={required}\n disabled={disabledMode}\n placeholder={placeholder ? placeholder : \"\"}\n readonly={readonly}\n onInput={this.onInput}\n onBlur={this.onBlur}\n onFocus={this.onFocus}\n aria-label={label}\n aria-describedby={describedBy}\n aria-invalid={invalid}\n autocapitalize={this.autocapitalize}\n autoFocus={this.autoFocus}\n spellcheck={spellcheck}\n inputmode={inputmode}\n maxlength={maxCharactersReached ? maxCharacters : null}\n minlength={minCharactersUnattained ? minCharacters : null}\n {...this.inheritedAttributes}\n ></textarea>\n )}\n {isSlotUsed(this.el, \"clear-button\") && (\n <slot name=\"clear-button\"></slot>\n )}\n {isSlotUsed(this.el, \"search-submit-button\") && (\n <slot name=\"search-submit-button\"></slot>\n )}\n </ic-input-component-container>\n {isSlotUsed(this.el, \"menu\") && <slot name=\"menu\"></slot>}\n {(!isEmptyString(validationStatus) ||\n !isEmptyString(validationText) ||\n maxNumChars > 0 ||\n maxValueExceeded ||\n maxCharactersError ||\n minCharactersUnattained ||\n minValueUnattained) &&\n !validationInlineInternal && (\n <ic-input-validation\n status={\n this.hasStatus(currentStatus) === false ||\n (currentStatus === IcInformationStatus.Success &&\n validationInline) ||\n validationInlineInternal\n ? \"\"\n : currentStatus\n }\n message={showStatusText ? currentValidationText : \"\"}\n ariaLiveMode={messageAriaLive}\n for={inputId}\n fullWidth={fullWidth}\n >\n {!readonly && maxNumChars > 0 && (\n <div slot=\"validation-message-adornment\">\n <ic-typography\n variant=\"caption\"\n class={{\n [\"maxlengthtext\"]: true,\n [\"error\"]: maxLengthExceeded,\n [\"disabled\"]: disabledText,\n }}\n >\n <span\n aria-live=\"polite\"\n id={`${inputId}-charcount`}\n class=\"charcount\"\n >\n {numChars}/{maxNumChars}\n </span>\n <span hidden={true} id={hiddenCharCountDescId}>\n Field can contain a maximum of {maxNumChars} characters.\n </span>\n </ic-typography>\n </div>\n )}\n </ic-input-validation>\n )}\n </ic-input-container>\n </Host>\n );\n }\n}\n"]}
@@ -86,6 +86,13 @@ describe("ic-text-field", () => {
86
86
  });
87
87
  expect(page.root).toMatchSnapshot("renders-with-maxlength");
88
88
  });
89
+ it("should render with max length message", async () => {
90
+ const page = await newSpecPage({
91
+ components: [TextField],
92
+ html: `<ic-text-field label="Test label" value="a long test value to exceed limit" max-length=25 max-length-message="You have exceeded the maximum length"></ic-text-field>`,
93
+ });
94
+ expect(page.root).toMatchSnapshot("renders-with-max-length-message");
95
+ });
89
96
  it("should render with name & full width", async () => {
90
97
  const page = await newSpecPage({
91
98
  components: [TextField],
@@ -1 +1 @@
1
- {"version":3,"file":"ic-text-field.input.spec.js","sourceRoot":"","sources":["../../../../../src/components/ic-text-field/test/basic/ic-text-field.input.spec.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,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,IAAI,EAAE;IACrF,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC;QAC7B,UAAU,EAAE,CAAC,SAAS,CAAC;QACvB,IAAI,EAAE,oDAAoD;KAC3D,CAAC,CAAC;IACH,MAAM,CACJ,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,YAAY,CAAC,OAAO,CAAC,CAClE,CAAC,QAAQ,EAAE,CAAC;IAEb,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;IAC7C,IAAI,CAAC,YAAY,CAAC,oBAAoB,CAAC,CAAC,EAAE,aAAa,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC;IACrE,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;IAE5B,MAAM,CACJ,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,YAAY,CAAC,OAAO,CAAC,CAClE,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;AACtB,CAAC,CAAC,CAAC","sourcesContent":["import { TextField } from \"../../ic-text-field\";\nimport { newSpecPage } from \"@stencil/core/testing\";\nimport { waitForTimeout } from \"../../../../testspec.setup\";\n\ndescribe(\"ic-text-field\", () => {\n it(\"should render\", async () => {\n const page = await newSpecPage({\n components: [TextField],\n html: `<ic-text-field label=\"Test label\" rows=1></ic-text-field>`,\n });\n\n expect(page.root).toMatchSnapshot(\"renders\");\n });\n\n it(\"should render with placeholder\", async () => {\n const page = await newSpecPage({\n components: [TextField],\n html: `<ic-text-field label=\"Test label\" placeholder=\"placeholder\" rows=0></ic-text-field>`,\n });\n\n expect(page.root).toMatchSnapshot(\"renders-with-placeholder\");\n });\n\n it(\"should render with value\", async () => {\n const page = await newSpecPage({\n components: [TextField],\n html: `<ic-text-field label=\"Test label\" value=\"test value\"></ic-text-field>`,\n });\n\n expect(page.root).toMatchSnapshot(\"renders-with-value\");\n });\n\n it(\"should render with helperText, required and small\", async () => {\n const page = await newSpecPage({\n components: [TextField],\n html: `<ic-text-field label=\"Test label\" helper-text=\"helper text value\" required=true size=\"small\"></ic-text-field>`,\n });\n\n expect(page.root).toMatchSnapshot(\"renders-with-helpertext\");\n });\n\n it(\"should render with autoprops\", async () => {\n const page = await newSpecPage({\n components: [TextField],\n html: `<ic-text-field label=\"Test label\" value=\"test value\" autofocus=true autocapitalize=\"on\" autocomplete=\"on\" autocorrect=\"on\"></ic-text-field>`,\n });\n\n expect(page.root).toMatchSnapshot(\"renders-with-autoprops\");\n });\n\n it(\"should render with hidden label\", async () => {\n const page = await newSpecPage({\n components: [TextField],\n html: `<ic-text-field label=\"Test label\" value=\"test value\" hide-label=true></ic-text-field>`,\n });\n\n expect(page.root).toMatchSnapshot(\"renders-with-hidden-label\");\n });\n\n it(\"should render with icon\", async () => {\n const page = await newSpecPage({\n components: [TextField],\n html: `<ic-text-field label=\"Test label\">\n <svg\n slot=\"icon\"\n xmlns=\"http://www.w3.org/2000/svg\"\n height=\"24px\"\n viewBox=\"0 0 24 24\"\n width=\"24px\"\n fill=\"#000000\"\n >\n <path d=\"M0 0h24v24H0z\" fill=\"none\" />\n <path\n d=\"M17 3H7c-1.1 0-1.99.9-1.99 2L5 21l7-3 7 3V5c0-1.1-.9-2-2-2z\"\n />\n </svg>\n </ic-text-field>`,\n });\n\n expect(page.root).toMatchSnapshot(\"renders-with-icon\");\n });\n\n it(\"should render disabled\", async () => {\n const page = await newSpecPage({\n components: [TextField],\n html: `<ic-text-field label=\"Test label\" value=\"test value\" disabled=true></ic-text-field>`,\n });\n\n expect(page.root).toMatchSnapshot(\"renders-disabled\");\n });\n\n it(\"should render readonly\", async () => {\n const page = await newSpecPage({\n components: [TextField],\n html: `<ic-text-field label=\"Test label\" value=\"test value\" readonly=true></ic-text-field>`,\n });\n\n expect(page.root).toMatchSnapshot(\"renders-readonly\");\n });\n\n it(\"should render with max length\", async () => {\n const page = await newSpecPage({\n components: [TextField],\n html: `<ic-text-field label=\"Test label\" value=\"a long test value to exceed limit\" max-length=25></ic-text-field>`,\n });\n\n expect(page.root).toMatchSnapshot(\"renders-with-maxlength\");\n });\n\n it(\"should render with name & full width\", async () => {\n const page = await newSpecPage({\n components: [TextField],\n html: `<ic-text-field label=\"Test label\" value=\"test value\" name=\"mycontrolname\" full-width=true></ic-text-field>`,\n });\n\n expect(page.root).toMatchSnapshot(\"renders-with-name-full-width\");\n });\n\n it(\"should render with success validation\", async () => {\n const page = await newSpecPage({\n components: [TextField],\n html: `<ic-text-field label=\"Test label\" validation-status=\"success\" validation-text=\"Good choice!\" value=\"test value\"></ic-text-field>`,\n });\n\n expect(page.root).toMatchSnapshot(\"renders-with-success-validation\");\n });\n\n it(\"should render with warning validation\", async () => {\n const page = await newSpecPage({\n components: [TextField],\n html: `<ic-text-field label=\"Test label\" validation-status=\"warning\" validation-text=\"warning text\" value=\"test value\"></ic-text-field>`,\n });\n\n expect(page.root).toMatchSnapshot(\"renders-with-warning-validation\");\n });\n\n it(\"should render with error validation\", async () => {\n const page = await newSpecPage({\n components: [TextField],\n html: `<ic-text-field label=\"Test label\" validation-status=\"error\" validation-text=\"error text\" value=\"test value\"></ic-text-field>`,\n });\n\n expect(page.root).toMatchSnapshot(\"renders-with-error-validation\");\n });\n\n it(\"should render with inline success validation\", async () => {\n const page = await newSpecPage({\n components: [TextField],\n html: `<ic-text-field label=\"Test label\" validation-status=\"success\" validation-text=\"Good choice!\" validation-inline=\"true\" value=\"test value\"></ic-text-field>`,\n });\n\n expect(page.root).toMatchSnapshot(\"renders-with-inline-success-validation\");\n });\n\n it(\"should focus\", async () => {\n const page = await newSpecPage({\n components: [TextField],\n html: `<ic-text-field label=\"Test label\" rows=1></ic-text-field>`,\n });\n\n const callbackFn = jest.fn();\n page.doc.addEventListener(\"icFocus\", callbackFn);\n const input = page.root.shadowRoot.querySelector(\"input\");\n await input.focus();\n expect(callbackFn).toHaveBeenCalled();\n });\n\n it(\"should blur\", async () => {\n const page = await newSpecPage({\n components: [TextField],\n html: `<ic-text-field label=\"Test label\" rows=1></ic-text-field>`,\n });\n\n const callbackFn = jest.fn();\n page.doc.addEventListener(\"icBlur\", callbackFn);\n const input = page.root.shadowRoot.querySelector(\"input\");\n await input.blur();\n expect(callbackFn).toHaveBeenCalled();\n });\n\n it(\"should not show left icon if text field is disabled\", async () => {\n const page = await newSpecPage({\n components: [TextField],\n html: `<ic-text-field label=\"Test label\" rows=1 disabled>\n <svg\n slot=\"icon\"\n xmlns=\"http://www.w3.org/2000/svg\"\n height=\"24px\"\n viewBox=\"0 0 24 24\"\n width=\"24px\"\n fill=\"#000000\"\n >\n <path d=\"M0 0h24v24H0z\" fill=\"none\" />\n <path\n d=\"M17 3H7c-1.1 0-1.99.9-1.99 2L5 21l7-3 7 3V5c0-1.1-.9-2-2-2z\"\n />\n </svg>\n </ic-text-field>`,\n });\n\n const slot = page.root.shadowRoot.querySelector(`[slot=\"icon\"]`);\n expect(slot).toBeNull();\n });\n\n it(\"should not exceed max length if new value < max length\", async () => {\n const page = await newSpecPage({\n components: [TextField],\n html: `<ic-text-field label=\"Test label\" rows=1 max-length=5></ic-text-field>`,\n });\n\n page.rootInstance.watchValueHandler(\"test\");\n expect(page.rootInstance.maxLengthExceeded).toBe(false);\n });\n\n it(\"should test keydown\", async () => {\n const page = await newSpecPage({\n components: [TextField],\n html: `<ic-text-field label=\"Test label\"></ic-text-field>`,\n });\n\n const eventSpy = jest.fn();\n page.win.addEventListener(\"icKeydown\", eventSpy);\n const event = new KeyboardEvent(\"keydown\", { key: \"A\" });\n await page.rootInstance.handleKeyDown(event);\n await page.waitForChanges();\n\n expect(eventSpy).toHaveBeenCalled();\n });\n\n it(\"should test input\", async () => {\n const page = await newSpecPage({\n components: [TextField],\n html: `<ic-text-field label=\"Test label\"></ic-text-field>`,\n });\n\n const event = jest.fn();\n page.win.addEventListener(\"icInput\", event);\n\n await page.rootInstance.onInput({ target: { value: \"test value\" } });\n await page.waitForChanges();\n expect(page.rootInstance.value).toBe(\"test value\");\n expect(event).toHaveBeenCalled();\n });\n\n it(\"should test form reset event\", async () => {\n const page = await newSpecPage({\n components: [TextField],\n html: `<form>\n <ic-text-field label=\"Test label\"></ic-text-field>\n <button id=\"resetButton\" type=\"reset\">Reset</button> \n </form>`,\n });\n\n expect(page.rootInstance.value).toBe(\"\");\n page.rootInstance.value = \"New value\";\n await page.waitForChanges();\n\n expect(page.rootInstance.value).toBe(\"New value\");\n\n await page.rootInstance.handleFormReset();\n await page.waitForChanges();\n\n expect(page.rootInstance.value).toBe(\"\");\n\n //test disconnected callback\n //delay to wait for icchange event to prevent console warning\n await waitForTimeout(500);\n page.setContent(\"\");\n });\n});\n\nit(\"should render with min/max and max validation\", async () => {\n const page = await newSpecPage({\n components: [TextField],\n html: `<ic-text-field label=\"Test label\" rows=1 min=1 max=4 value=\"6\" inputmode=\"numeric\" type=\"number\"></ic-text-field>`,\n });\n\n expect(page.root).toMatchSnapshot(\"renders-with-max\");\n});\n\nit(\"should render with min/max and min validation\", async () => {\n const page = await newSpecPage({\n components: [TextField],\n html: `<ic-text-field label=\"Test label\" rows=1 min=1 max=4 value=\"0\" inputmode=\"numeric\" type=\"number\"></ic-text-field>`,\n });\n\n expect(page.root).toMatchSnapshot(\"renders-with-min\");\n});\n\nit(\"should test maxCharacters method\", async () => {\n const page = await newSpecPage({\n components: [TextField],\n html: `<ic-text-field label=\"Test label\" rows=1 max-characters=5></ic-text-field>`,\n });\n\n page.rootInstance.watchValueHandler(\"test\");\n expect(page.rootInstance.maxCharactersReached).toBe(false);\n page.rootInstance.watchValueHandler(\"testing\");\n expect(page.rootInstance.maxCharactersReached).toBe(true);\n});\n\nit(\"should test minCharacters method\", async () => {\n const page = await newSpecPage({\n components: [TextField],\n html: `<ic-text-field label=\"Test label\" rows=1 min-characters=5 value=\"test\"></ic-text-field>`,\n });\n\n const input = page.root.shadowRoot.querySelector(\"input\");\n input.blur();\n expect(page.rootInstance.minCharactersUnattained).toBe(true);\n\n page.rootInstance.value = \"testing\";\n await page.waitForChanges();\n\n input.blur();\n expect(page.rootInstance.minCharactersUnattained).toBe(false);\n});\n\nit(\"should update any attributes that are inherited from the root element\", async () => {\n const page = await newSpecPage({\n components: [TextField],\n html: `<ic-text-field label=\"Test label\"></ic-text-field>`,\n });\n expect(\n page.root.shadowRoot.querySelector(\"input\").getAttribute(\"title\")\n ).toBeNull();\n\n page.root.setAttribute(\"title\", \"new-label\");\n page.rootInstance.hostMutationCallback([{ attributeName: \"title\" }]);\n await page.waitForChanges();\n\n expect(\n page.root.shadowRoot.querySelector(\"input\").getAttribute(\"title\")\n ).toBe(\"new-label\");\n});\n"]}
1
+ {"version":3,"file":"ic-text-field.input.spec.js","sourceRoot":"","sources":["../../../../../src/components/ic-text-field/test/basic/ic-text-field.input.spec.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAE5D,QAAQ,CAAC,eAAe,EAAE,GAAG,EAAE;IAC7B,EAAE,CAAC,eAAe,EAAE,KAAK,IAAI,EAAE;QAC7B,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC;YAC7B,UAAU,EAAE,CAAC,SAAS,CAAC;YACvB,IAAI,EAAE,2DAA2D;SAClE,CAAC,CAAC;QAEH,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC;IAC/C,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,gCAAgC,EAAE,KAAK,IAAI,EAAE;QAC9C,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC;YAC7B,UAAU,EAAE,CAAC,SAAS,CAAC;YACvB,IAAI,EAAE,qFAAqF;SAC5F,CAAC,CAAC;QAEH,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,eAAe,CAAC,0BAA0B,CAAC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WAAW,CAAC,CAAC;IAC7C,IAAI,CAAC,YAAY,CAAC,oBAAoB,CAAC,CAAC,EAAE,aAAa,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC;IACrE,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;IAE5B,MAAM,CACJ,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,YAAY,CAAC,OAAO,CAAC,CAClE,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;AACtB,CAAC,CAAC,CAAC","sourcesContent":["import { TextField } from \"../../ic-text-field\";\nimport { newSpecPage } from \"@stencil/core/testing\";\nimport { waitForTimeout } from \"../../../../testspec.setup\";\n\ndescribe(\"ic-text-field\", () => {\n it(\"should render\", async () => {\n const page = await newSpecPage({\n components: [TextField],\n html: `<ic-text-field label=\"Test label\" rows=1></ic-text-field>`,\n });\n\n expect(page.root).toMatchSnapshot(\"renders\");\n });\n\n it(\"should render with placeholder\", async () => {\n const page = await newSpecPage({\n components: [TextField],\n html: `<ic-text-field label=\"Test label\" placeholder=\"placeholder\" rows=0></ic-text-field>`,\n });\n\n expect(page.root).toMatchSnapshot(\"renders-with-placeholder\");\n });\n\n it(\"should render with value\", async () => {\n const page = await newSpecPage({\n components: [TextField],\n html: `<ic-text-field label=\"Test label\" value=\"test value\"></ic-text-field>`,\n });\n\n expect(page.root).toMatchSnapshot(\"renders-with-value\");\n });\n\n it(\"should render with helperText, required and small\", async () => {\n const page = await newSpecPage({\n components: [TextField],\n html: `<ic-text-field label=\"Test label\" helper-text=\"helper text value\" required=true size=\"small\"></ic-text-field>`,\n });\n\n expect(page.root).toMatchSnapshot(\"renders-with-helpertext\");\n });\n\n it(\"should render with autoprops\", async () => {\n const page = await newSpecPage({\n components: [TextField],\n html: `<ic-text-field label=\"Test label\" value=\"test value\" autofocus=true autocapitalize=\"on\" autocomplete=\"on\" autocorrect=\"on\"></ic-text-field>`,\n });\n\n expect(page.root).toMatchSnapshot(\"renders-with-autoprops\");\n });\n\n it(\"should render with hidden label\", async () => {\n const page = await newSpecPage({\n components: [TextField],\n html: `<ic-text-field label=\"Test label\" value=\"test value\" hide-label=true></ic-text-field>`,\n });\n\n expect(page.root).toMatchSnapshot(\"renders-with-hidden-label\");\n });\n\n it(\"should render with icon\", async () => {\n const page = await newSpecPage({\n components: [TextField],\n html: `<ic-text-field label=\"Test label\">\n <svg\n slot=\"icon\"\n xmlns=\"http://www.w3.org/2000/svg\"\n height=\"24px\"\n viewBox=\"0 0 24 24\"\n width=\"24px\"\n fill=\"#000000\"\n >\n <path d=\"M0 0h24v24H0z\" fill=\"none\" />\n <path\n d=\"M17 3H7c-1.1 0-1.99.9-1.99 2L5 21l7-3 7 3V5c0-1.1-.9-2-2-2z\"\n />\n </svg>\n </ic-text-field>`,\n });\n\n expect(page.root).toMatchSnapshot(\"renders-with-icon\");\n });\n\n it(\"should render disabled\", async () => {\n const page = await newSpecPage({\n components: [TextField],\n html: `<ic-text-field label=\"Test label\" value=\"test value\" disabled=true></ic-text-field>`,\n });\n\n expect(page.root).toMatchSnapshot(\"renders-disabled\");\n });\n\n it(\"should render readonly\", async () => {\n const page = await newSpecPage({\n components: [TextField],\n html: `<ic-text-field label=\"Test label\" value=\"test value\" readonly=true></ic-text-field>`,\n });\n\n expect(page.root).toMatchSnapshot(\"renders-readonly\");\n });\n\n it(\"should render with max length\", async () => {\n const page = await newSpecPage({\n components: [TextField],\n html: `<ic-text-field label=\"Test label\" value=\"a long test value to exceed limit\" max-length=25></ic-text-field>`,\n });\n\n expect(page.root).toMatchSnapshot(\"renders-with-maxlength\");\n });\n\n it(\"should render with max length message\", async () => {\n const page = await newSpecPage({\n components: [TextField],\n html: `<ic-text-field label=\"Test label\" value=\"a long test value to exceed limit\" max-length=25 max-length-message=\"You have exceeded the maximum length\"></ic-text-field>`,\n });\n\n expect(page.root).toMatchSnapshot(\"renders-with-max-length-message\");\n });\n\n it(\"should render with name & full width\", async () => {\n const page = await newSpecPage({\n components: [TextField],\n html: `<ic-text-field label=\"Test label\" value=\"test value\" name=\"mycontrolname\" full-width=true></ic-text-field>`,\n });\n\n expect(page.root).toMatchSnapshot(\"renders-with-name-full-width\");\n });\n\n it(\"should render with success validation\", async () => {\n const page = await newSpecPage({\n components: [TextField],\n html: `<ic-text-field label=\"Test label\" validation-status=\"success\" validation-text=\"Good choice!\" value=\"test value\"></ic-text-field>`,\n });\n\n expect(page.root).toMatchSnapshot(\"renders-with-success-validation\");\n });\n\n it(\"should render with warning validation\", async () => {\n const page = await newSpecPage({\n components: [TextField],\n html: `<ic-text-field label=\"Test label\" validation-status=\"warning\" validation-text=\"warning text\" value=\"test value\"></ic-text-field>`,\n });\n\n expect(page.root).toMatchSnapshot(\"renders-with-warning-validation\");\n });\n\n it(\"should render with error validation\", async () => {\n const page = await newSpecPage({\n components: [TextField],\n html: `<ic-text-field label=\"Test label\" validation-status=\"error\" validation-text=\"error text\" value=\"test value\"></ic-text-field>`,\n });\n\n expect(page.root).toMatchSnapshot(\"renders-with-error-validation\");\n });\n\n it(\"should render with inline success validation\", async () => {\n const page = await newSpecPage({\n components: [TextField],\n html: `<ic-text-field label=\"Test label\" validation-status=\"success\" validation-text=\"Good choice!\" validation-inline=\"true\" value=\"test value\"></ic-text-field>`,\n });\n\n expect(page.root).toMatchSnapshot(\"renders-with-inline-success-validation\");\n });\n\n it(\"should focus\", async () => {\n const page = await newSpecPage({\n components: [TextField],\n html: `<ic-text-field label=\"Test label\" rows=1></ic-text-field>`,\n });\n\n const callbackFn = jest.fn();\n page.doc.addEventListener(\"icFocus\", callbackFn);\n const input = page.root.shadowRoot.querySelector(\"input\");\n await input.focus();\n expect(callbackFn).toHaveBeenCalled();\n });\n\n it(\"should blur\", async () => {\n const page = await newSpecPage({\n components: [TextField],\n html: `<ic-text-field label=\"Test label\" rows=1></ic-text-field>`,\n });\n\n const callbackFn = jest.fn();\n page.doc.addEventListener(\"icBlur\", callbackFn);\n const input = page.root.shadowRoot.querySelector(\"input\");\n await input.blur();\n expect(callbackFn).toHaveBeenCalled();\n });\n\n it(\"should not show left icon if text field is disabled\", async () => {\n const page = await newSpecPage({\n components: [TextField],\n html: `<ic-text-field label=\"Test label\" rows=1 disabled>\n <svg\n slot=\"icon\"\n xmlns=\"http://www.w3.org/2000/svg\"\n height=\"24px\"\n viewBox=\"0 0 24 24\"\n width=\"24px\"\n fill=\"#000000\"\n >\n <path d=\"M0 0h24v24H0z\" fill=\"none\" />\n <path\n d=\"M17 3H7c-1.1 0-1.99.9-1.99 2L5 21l7-3 7 3V5c0-1.1-.9-2-2-2z\"\n />\n </svg>\n </ic-text-field>`,\n });\n\n const slot = page.root.shadowRoot.querySelector(`[slot=\"icon\"]`);\n expect(slot).toBeNull();\n });\n\n it(\"should not exceed max length if new value < max length\", async () => {\n const page = await newSpecPage({\n components: [TextField],\n html: `<ic-text-field label=\"Test label\" rows=1 max-length=5></ic-text-field>`,\n });\n\n page.rootInstance.watchValueHandler(\"test\");\n expect(page.rootInstance.maxLengthExceeded).toBe(false);\n });\n\n it(\"should test keydown\", async () => {\n const page = await newSpecPage({\n components: [TextField],\n html: `<ic-text-field label=\"Test label\"></ic-text-field>`,\n });\n\n const eventSpy = jest.fn();\n page.win.addEventListener(\"icKeydown\", eventSpy);\n const event = new KeyboardEvent(\"keydown\", { key: \"A\" });\n await page.rootInstance.handleKeyDown(event);\n await page.waitForChanges();\n\n expect(eventSpy).toHaveBeenCalled();\n });\n\n it(\"should test input\", async () => {\n const page = await newSpecPage({\n components: [TextField],\n html: `<ic-text-field label=\"Test label\"></ic-text-field>`,\n });\n\n const event = jest.fn();\n page.win.addEventListener(\"icInput\", event);\n\n await page.rootInstance.onInput({ target: { value: \"test value\" } });\n await page.waitForChanges();\n expect(page.rootInstance.value).toBe(\"test value\");\n expect(event).toHaveBeenCalled();\n });\n\n it(\"should test form reset event\", async () => {\n const page = await newSpecPage({\n components: [TextField],\n html: `<form>\n <ic-text-field label=\"Test label\"></ic-text-field>\n <button id=\"resetButton\" type=\"reset\">Reset</button> \n </form>`,\n });\n\n expect(page.rootInstance.value).toBe(\"\");\n page.rootInstance.value = \"New value\";\n await page.waitForChanges();\n\n expect(page.rootInstance.value).toBe(\"New value\");\n\n await page.rootInstance.handleFormReset();\n await page.waitForChanges();\n\n expect(page.rootInstance.value).toBe(\"\");\n\n //test disconnected callback\n //delay to wait for icchange event to prevent console warning\n await waitForTimeout(500);\n page.setContent(\"\");\n });\n});\n\nit(\"should render with min/max and max validation\", async () => {\n const page = await newSpecPage({\n components: [TextField],\n html: `<ic-text-field label=\"Test label\" rows=1 min=1 max=4 value=\"6\" inputmode=\"numeric\" type=\"number\"></ic-text-field>`,\n });\n\n expect(page.root).toMatchSnapshot(\"renders-with-max\");\n});\n\nit(\"should render with min/max and min validation\", async () => {\n const page = await newSpecPage({\n components: [TextField],\n html: `<ic-text-field label=\"Test label\" rows=1 min=1 max=4 value=\"0\" inputmode=\"numeric\" type=\"number\"></ic-text-field>`,\n });\n\n expect(page.root).toMatchSnapshot(\"renders-with-min\");\n});\n\nit(\"should test maxCharacters method\", async () => {\n const page = await newSpecPage({\n components: [TextField],\n html: `<ic-text-field label=\"Test label\" rows=1 max-characters=5></ic-text-field>`,\n });\n\n page.rootInstance.watchValueHandler(\"test\");\n expect(page.rootInstance.maxCharactersReached).toBe(false);\n page.rootInstance.watchValueHandler(\"testing\");\n expect(page.rootInstance.maxCharactersReached).toBe(true);\n});\n\nit(\"should test minCharacters method\", async () => {\n const page = await newSpecPage({\n components: [TextField],\n html: `<ic-text-field label=\"Test label\" rows=1 min-characters=5 value=\"test\"></ic-text-field>`,\n });\n\n const input = page.root.shadowRoot.querySelector(\"input\");\n input.blur();\n expect(page.rootInstance.minCharactersUnattained).toBe(true);\n\n page.rootInstance.value = \"testing\";\n await page.waitForChanges();\n\n input.blur();\n expect(page.rootInstance.minCharactersUnattained).toBe(false);\n});\n\nit(\"should update any attributes that are inherited from the root element\", async () => {\n const page = await newSpecPage({\n components: [TextField],\n html: `<ic-text-field label=\"Test label\"></ic-text-field>`,\n });\n expect(\n page.root.shadowRoot.querySelector(\"input\").getAttribute(\"title\")\n ).toBeNull();\n\n page.root.setAttribute(\"title\", \"new-label\");\n page.rootInstance.hostMutationCallback([{ attributeName: \"title\" }]);\n await page.waitForChanges();\n\n expect(\n page.root.shadowRoot.querySelector(\"input\").getAttribute(\"title\")\n ).toBe(\"new-label\");\n});\n"]}
@@ -213,6 +213,36 @@ describe("ic-text-field", () => {
213
213
  </ic-text-field>
214
214
  `);
215
215
  });
216
+ it("should render textarea with max length message", async () => {
217
+ const page = await newSpecPage({
218
+ components: [TextField],
219
+ html: `<ic-text-field rows=6 label="Test label" value="a long test value to exceed limit" max-length=25 max-length-message="You have exceeded the maximum length"></ic-text-field>`,
220
+ });
221
+ expect(page.root).toEqualHtml(`
222
+ <ic-text-field label="Test label" max-length="25" max-length-message="You have exceeded the maximum length" rows="6" value="a long test value to exceed limit">
223
+ <mock:shadow-root>
224
+ <ic-input-container>
225
+ <ic-input-label for="ic-text-field-input-10" helpertext="" label="Test label"></ic-input-label>
226
+ <ic-input-component-container multiline="" size="default" validationstatus="error"><textarea aria-describedby="ic-text-field-input-10-charcount-desc ic-text-field-input-10-validation-text" aria-invalid="true" aria-label="Test label" autocapitalize="off" class="no-resize" id="ic-text-field-input-10" inputmode="text" name="ic-text-field-input-10" placeholder="" rows="6" value="a long test value to exceed limit"></textarea>
227
+ </ic-input-component-container>
228
+ <ic-input-validation arialivemode="assertive" for="ic-text-field-input-10" message="You have exceeded the maximum length" status="error">
229
+ <div slot="validation-message-adornment">
230
+ <ic-typography class="error maxlengthtext" variant="caption">
231
+ <span aria-live="polite" id="ic-text-field-input-10-charcount" class="charcount">
232
+ 33/25
233
+ </span>
234
+ <span hidden="" id="ic-text-field-input-10-charcount-desc">
235
+ Field can contain a maximum of 25 characters.
236
+ </span>
237
+ </ic-typography>
238
+ </div>
239
+ </ic-input-validation>
240
+ </ic-input-container>
241
+ </mock:shadow-root>
242
+ <input class="ic-input" name="ic-text-field-input-10" type="hidden" value="a long test value to exceed limit">
243
+ </ic-text-field>
244
+ `);
245
+ });
216
246
  it("should render textarea with name & full width", async () => {
217
247
  const page = await newSpecPage({
218
248
  components: [TextField],
@@ -222,8 +252,8 @@ describe("ic-text-field", () => {
222
252
  <ic-text-field class="fullwidth" full-width="true" label="Test label" name="mycontrolname" rows="2" value="test value">
223
253
  <mock:shadow-root>
224
254
  <ic-input-container>
225
- <ic-input-label for="ic-text-field-input-10" helpertext="" label="Test label"></ic-input-label>
226
- <ic-input-component-container fullwidth="" size="default" multiline="" validationstatus=""><textarea aria-describedby="" aria-invalid="false" aria-label="Test label" autocapitalize="off" class="no-resize" id="ic-text-field-input-10" inputmode="text" name="mycontrolname" placeholder="" rows="2" value="test value"></textarea>
255
+ <ic-input-label for="ic-text-field-input-11" helpertext="" label="Test label"></ic-input-label>
256
+ <ic-input-component-container fullwidth="" size="default" multiline="" validationstatus=""><textarea aria-describedby="" aria-invalid="false" aria-label="Test label" autocapitalize="off" class="no-resize" id="ic-text-field-input-11" inputmode="text" name="mycontrolname" placeholder="" rows="2" value="test value"></textarea>
227
257
  </ic-input-component-container>
228
258
  </ic-input-container>
229
259
  </mock:shadow-root>
@@ -240,13 +270,13 @@ describe("ic-text-field", () => {
240
270
  <ic-text-field label="Test label" rows="6" validation-status="success" validation-text="Good choice!" value="test value">
241
271
  <mock:shadow-root>
242
272
  <ic-input-container>
243
- <ic-input-label for="ic-text-field-input-11" helpertext="" label="Test label"></ic-input-label>
244
- <ic-input-component-container multiline="" size="default" validationstatus="success"><textarea aria-describedby="ic-text-field-input-11-validation-text" aria-invalid="false" aria-label="Test label" autocapitalize="off" class="no-resize" id="ic-text-field-input-11" inputmode="text" name="ic-text-field-input-11" placeholder="" rows="6" value="test value"></textarea>
273
+ <ic-input-label for="ic-text-field-input-12" helpertext="" label="Test label"></ic-input-label>
274
+ <ic-input-component-container multiline="" size="default" validationstatus="success"><textarea aria-describedby="ic-text-field-input-12-validation-text" aria-invalid="false" aria-label="Test label" autocapitalize="off" class="no-resize" id="ic-text-field-input-12" inputmode="text" name="ic-text-field-input-12" placeholder="" rows="6" value="test value"></textarea>
245
275
  </ic-input-component-container>
246
- <ic-input-validation arialivemode="polite" for="ic-text-field-input-11" message="Good choice!" status="success"></ic-input-validation>
276
+ <ic-input-validation arialivemode="polite" for="ic-text-field-input-12" message="Good choice!" status="success"></ic-input-validation>
247
277
  </ic-input-container>
248
278
  </mock:shadow-root>
249
- <input class="ic-input" name="ic-text-field-input-11" type="hidden" value="test value">
279
+ <input class="ic-input" name="ic-text-field-input-12" type="hidden" value="test value">
250
280
  </ic-text-field>
251
281
  `);
252
282
  });
@@ -259,13 +289,13 @@ describe("ic-text-field", () => {
259
289
  <ic-text-field label="Test label" rows="6" validation-status="warning" validation-text="warning text" value="test value">
260
290
  <mock:shadow-root>
261
291
  <ic-input-container>
262
- <ic-input-label for="ic-text-field-input-12" helpertext="" label="Test label"></ic-input-label>
263
- <ic-input-component-container multiline="" size="default" validationstatus="warning"><textarea aria-describedby="ic-text-field-input-12-validation-text" aria-invalid="false" aria-label="Test label" autocapitalize="off" class="no-resize" id="ic-text-field-input-12" inputmode="text" name="ic-text-field-input-12" placeholder="" rows="6" value="test value"></textarea>
292
+ <ic-input-label for="ic-text-field-input-13" helpertext="" label="Test label"></ic-input-label>
293
+ <ic-input-component-container multiline="" size="default" validationstatus="warning"><textarea aria-describedby="ic-text-field-input-13-validation-text" aria-invalid="false" aria-label="Test label" autocapitalize="off" class="no-resize" id="ic-text-field-input-13" inputmode="text" name="ic-text-field-input-13" placeholder="" rows="6" value="test value"></textarea>
264
294
  </ic-input-component-container>
265
- <ic-input-validation arialivemode="polite" for="ic-text-field-input-12" message="warning text" status="warning"></ic-input-validation>
295
+ <ic-input-validation arialivemode="polite" for="ic-text-field-input-13" message="warning text" status="warning"></ic-input-validation>
266
296
  </ic-input-container>
267
297
  </mock:shadow-root>
268
- <input class="ic-input" name="ic-text-field-input-12" type="hidden" value="test value">
298
+ <input class="ic-input" name="ic-text-field-input-13" type="hidden" value="test value">
269
299
  </ic-text-field>
270
300
  `);
271
301
  });
@@ -278,13 +308,13 @@ describe("ic-text-field", () => {
278
308
  <ic-text-field label="Test label" rows="6" validation-status="error" validation-text="error text" value="test value">
279
309
  <mock:shadow-root>
280
310
  <ic-input-container>
281
- <ic-input-label for="ic-text-field-input-13" helpertext="" label="Test label"></ic-input-label>
282
- <ic-input-component-container multiline="" size="default" validationstatus="error"><textarea aria-describedby="ic-text-field-input-13-validation-text" aria-invalid="true" aria-label="Test label" autocapitalize="off" class="no-resize" id="ic-text-field-input-13" inputmode="text" name="ic-text-field-input-13" placeholder="" rows="6" value="test value"></textarea>
311
+ <ic-input-label for="ic-text-field-input-14" helpertext="" label="Test label"></ic-input-label>
312
+ <ic-input-component-container multiline="" size="default" validationstatus="error"><textarea aria-describedby="ic-text-field-input-14-validation-text" aria-invalid="true" aria-label="Test label" autocapitalize="off" class="no-resize" id="ic-text-field-input-14" inputmode="text" name="ic-text-field-input-14" placeholder="" rows="6" value="test value"></textarea>
283
313
  </ic-input-component-container>
284
- <ic-input-validation arialivemode="assertive" for="ic-text-field-input-13" message="error text" status="error"></ic-input-validation>
314
+ <ic-input-validation arialivemode="assertive" for="ic-text-field-input-14" message="error text" status="error"></ic-input-validation>
285
315
  </ic-input-container>
286
316
  </mock:shadow-root>
287
- <input class="ic-input" name="ic-text-field-input-13" type="hidden" value="test value">
317
+ <input class="ic-input" name="ic-text-field-input-14" type="hidden" value="test value">
288
318
  </ic-text-field>
289
319
  `);
290
320
  });
@@ -297,12 +327,12 @@ describe("ic-text-field", () => {
297
327
  <ic-text-field label="Test label" resize="true" rows="6" value="test value">
298
328
  <mock:shadow-root>
299
329
  <ic-input-container>
300
- <ic-input-label for="ic-text-field-input-14" helpertext="" label="Test label"></ic-input-label>
301
- <ic-input-component-container multiline="" size="default" validationstatus=""><textarea aria-describedby="" aria-invalid="false" aria-label="Test label" autocapitalize="off" id="ic-text-field-input-14" inputmode="text" name="ic-text-field-input-14" placeholder="" rows="6" value="test value"></textarea>
330
+ <ic-input-label for="ic-text-field-input-15" helpertext="" label="Test label"></ic-input-label>
331
+ <ic-input-component-container multiline="" size="default" validationstatus=""><textarea aria-describedby="" aria-invalid="false" aria-label="Test label" autocapitalize="off" id="ic-text-field-input-15" inputmode="text" name="ic-text-field-input-15" placeholder="" rows="6" value="test value"></textarea>
302
332
  </ic-input-component-container>
303
333
  </ic-input-container>
304
334
  </mock:shadow-root>
305
- <input class="ic-input" name="ic-text-field-input-14" type="hidden" value="test value">
335
+ <input class="ic-input" name="ic-text-field-input-15" type="hidden" value="test value">
306
336
  </ic-text-field>
307
337
  `);
308
338
  });