@govtechsg/sgds-web-component 3.30.1-rc.5 → 3.30.1-rc.6

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.
Files changed (51) hide show
  1. package/components/Datepicker/index.umd.min.js +3 -3
  2. package/components/Datepicker/index.umd.min.js.map +1 -1
  3. package/components/Datepicker/sgds-datepicker.d.ts +1 -1
  4. package/components/Datepicker/sgds-datepicker.js +5 -1
  5. package/components/Datepicker/sgds-datepicker.js.map +1 -1
  6. package/components/Input/index.umd.min.js +2 -2
  7. package/components/Input/index.umd.min.js.map +1 -1
  8. package/components/Input/sgds-input.d.ts +1 -0
  9. package/components/Input/sgds-input.js +7 -0
  10. package/components/Input/sgds-input.js.map +1 -1
  11. package/components/QuantityToggle/index.umd.min.js +230 -230
  12. package/components/QuantityToggle/index.umd.min.js.map +1 -1
  13. package/components/QuantityToggle/sgds-quantity-toggle.d.ts +1 -0
  14. package/components/QuantityToggle/sgds-quantity-toggle.js +9 -0
  15. package/components/QuantityToggle/sgds-quantity-toggle.js.map +1 -1
  16. package/components/Radio/index.umd.min.js +1 -1
  17. package/components/Radio/index.umd.min.js.map +1 -1
  18. package/components/Radio/sgds-radio-group.d.ts +1 -1
  19. package/components/Radio/sgds-radio-group.js +5 -1
  20. package/components/Radio/sgds-radio-group.js.map +1 -1
  21. package/components/Textarea/index.umd.min.js +1 -1
  22. package/components/Textarea/index.umd.min.js.map +1 -1
  23. package/components/Textarea/sgds-textarea.d.ts +1 -1
  24. package/components/Textarea/sgds-textarea.js +6 -2
  25. package/components/Textarea/sgds-textarea.js.map +1 -1
  26. package/components/index.umd.min.js +7 -7
  27. package/components/index.umd.min.js.map +1 -1
  28. package/custom-elements.json +11 -1
  29. package/index.umd.min.js +7 -7
  30. package/index.umd.min.js.map +1 -1
  31. package/package.json +1 -1
  32. package/react/components/Datepicker/sgds-datepicker.cjs.js +5 -1
  33. package/react/components/Datepicker/sgds-datepicker.cjs.js.map +1 -1
  34. package/react/components/Datepicker/sgds-datepicker.js +5 -1
  35. package/react/components/Datepicker/sgds-datepicker.js.map +1 -1
  36. package/react/components/Input/sgds-input.cjs.js +7 -0
  37. package/react/components/Input/sgds-input.cjs.js.map +1 -1
  38. package/react/components/Input/sgds-input.js +7 -0
  39. package/react/components/Input/sgds-input.js.map +1 -1
  40. package/react/components/QuantityToggle/sgds-quantity-toggle.cjs.js +9 -0
  41. package/react/components/QuantityToggle/sgds-quantity-toggle.cjs.js.map +1 -1
  42. package/react/components/QuantityToggle/sgds-quantity-toggle.js +9 -0
  43. package/react/components/QuantityToggle/sgds-quantity-toggle.js.map +1 -1
  44. package/react/components/Radio/sgds-radio-group.cjs.js +5 -1
  45. package/react/components/Radio/sgds-radio-group.cjs.js.map +1 -1
  46. package/react/components/Radio/sgds-radio-group.js +5 -1
  47. package/react/components/Radio/sgds-radio-group.js.map +1 -1
  48. package/react/components/Textarea/sgds-textarea.cjs.js +6 -2
  49. package/react/components/Textarea/sgds-textarea.cjs.js.map +1 -1
  50. package/react/components/Textarea/sgds-textarea.js +6 -2
  51. package/react/components/Textarea/sgds-textarea.js.map +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@govtechsg/sgds-web-component",
3
- "version": "3.30.1-rc.5",
3
+ "version": "3.30.1-rc.6",
4
4
  "description": "",
5
5
  "main": "./index.umd.js",
6
6
  "module": "./index.js",
@@ -183,8 +183,12 @@ var SgdsDatepicker = class extends require_validatorMixin.SgdsFormValidatorMixin
183
183
  this.focusedTabIndex = (this.focusedTabIndex + 1 + tabIndexArray.length) % tabIndexArray.length;
184
184
  }
185
185
  }
186
- _handleValueChange() {
186
+ async _handleValueChange() {
187
+ this._mixinSetFormValue();
187
188
  this.emit("sgds-change-date");
189
+ await this.updateComplete;
190
+ if (this._mixinShouldSkipSgdsValidation()) return;
191
+ this._mixinValidate(this.input);
188
192
  }
189
193
  async _handleCloseMenu() {
190
194
  if (this.selectedDateRange.length === 0) this.displayDate = this.initialDisplayDate;
@@ -1 +1 @@
1
- {"version":3,"file":"sgds-datepicker.cjs.js","names":["SgdsFormValidatorMixin","DropdownElement","dropdownMenuStyle","datepickerStyle","DatepickerInput","DatepickerCalendar","DatepickerHeader","SgdsButton","SgdsIconButton","formatDate","DATE_PATTERNS","setTimeToNoon","parseDate","live","ifDefined","ref","classMap","property","defaultValue","state","queryAsync","query","watch"],"sources":["../../../../src/components/Datepicker/sgds-datepicker.ts"],"sourcesContent":["import { formatDate, parseDate } from \"../../utils/date-helpers\";\nimport { html, PropertyValueMap } from \"lit\";\nimport { property, query, queryAsync, state } from \"lit/decorators.js\";\nimport { live } from \"lit/directives/live.js\";\nimport { ref } from \"lit/directives/ref.js\";\nimport { DropdownElement } from \"../../base/dropdown-element\";\nimport { type SgdsFormControl } from \"../../utils/formSubmitController\";\nimport { DATE_PATTERNS, setTimeToNoon } from \"../../utils/time\";\nimport { watch } from \"../../utils/watch\";\nimport { SgdsButton } from \"../Button/sgds-button\";\nimport dropdownMenuStyle from \"../Dropdown/dropdown-menu.css\";\nimport { DatepickerCalendar } from \"./datepicker-calendar\";\nimport { DatepickerHeader } from \"./datepicker-header\";\nimport DatepickerInput from \"./datepicker-input\";\nimport datepickerStyle from \"./datepicker.css\";\nimport { ViewEnum } from \"./types\";\nimport SgdsIconButton from \"../IconButton/sgds-icon-button\";\nimport { SgdsFormValidatorMixin } from \"../../utils/validatorMixin\";\nimport { ifDefined } from \"lit/directives/if-defined.js\";\nimport { classMap } from \"lit/directives/class-map.js\";\nimport { defaultValue } from \"../../utils/defaultvalue\";\n\nexport type DateFormat = \"MM/DD/YYYY\" | \"DD/MM/YYYY\" | \"YYYY/MM/DD\";\n\n/**\n * @summary The `DatePicker` Component is built using `Dropdown`, `Input` and `Button` components. By default, the Calendar points to today's date and input has no value. Users can either pick dates from the calendar or type dates through the input\n *\n * @event sgds-change-date - Emitted when the state of datepicker's input changes during first load, close button reset click & date click. Date values can be accessed via event.target.value\n * @event sgds-invalid - Emitted when the combo box's invalid state is set to true.\n * @event sgds-valid - Emitted when the combo box's invalid state is set to false.\n *\n * @description displayDate sets the month, year views of the calendar while focusedDate follows the focus which also directly changes\n * displayDate on certain occasions. Example, when keyboard moves up to the next month, it updates displayDate which then affect the current\n * date view of the calendar\n */\nexport class SgdsDatepicker extends SgdsFormValidatorMixin(DropdownElement) implements SgdsFormControl {\n static styles = [...DropdownElement.styles, dropdownMenuStyle, datepickerStyle];\n /**@internal */\n static dependencies = {\n \"sgds-datepicker-input\": DatepickerInput,\n \"sgds-datepicker-calendar\": DatepickerCalendar,\n \"sgds-datepicker-header\": DatepickerHeader,\n \"sgds-button\": SgdsButton,\n \"sgds-icon-button\": SgdsIconButton\n };\n\n constructor() {\n super();\n this.floatingOpts = {\n placement: \"bottom-end\"\n };\n }\n\n /** When true, adds required attribute to input element */\n @property({ type: Boolean, reflect: true }) required = false;\n /**The datepicker input's name attribute */\n @property({ reflect: true }) name: string;\n /** When true, adds disabled attribute to input and button element */\n @property({ type: Boolean, reflect: true }) disabled = false;\n\n /** Disables native and sgds validation for the datepicker. */\n @property({ type: Boolean, reflect: true }) noValidate = false;\n\n /** Sets the initial value of the datepicker. Replaces deprecated `initialValue`.\n * Pass in dates in this format `dd/mm/yyyy` for single mode and `dd/mm/yyyy - dd/mm/yyyy` for range mode\n * For example, `value=\"22/12/2023\"` for single mode or `value=\"22/12/2023 - 25/12/2023\"` for range mode\n */\n @property({ type: String, reflect: true }) value = \"\";\n\n /**\n * The initial value of DatePicker on first load for single &\n * range mode as array of string. eg.'[\"22/12/2023\"]' for single &\n * '[\"22/12/2023\",\"25/12/2023\"]' for range respectively.\n * @deprecated since v3.3.0 — use `value` instead.\n */\n @property({ type: Array, reflect: true }) initialValue: string[] = [];\n\n private dateFormat = \"DD/MM/YYYY\";\n\n /** ISO date string to set the lowest allowable date value. e.g. \"2016-05-19T12:00:00.000Z\" */\n @property({ type: String }) minDate = \"\";\n\n /** ISO date string to set the highest allowable date value. e.g. \"2016-05-19T12:00:00.000Z\" */\n @property({ type: String }) maxDate = \"\";\n\n /** Changes DatePicker to single date selection or range date selection */\n @property({ type: String, reflect: true }) mode: \"single\" | \"range\" = \"single\";\n\n /**Feedback text for error state when date input is invalid */\n @property({ type: String, reflect: true }) invalidFeedback: string;\n\n /** Allows invalidFeedback and invalid styles to be visible with the input */\n @property({ type: Boolean, reflect: true }) hasFeedback = false;\n\n /** The datepicker input's label */\n @property({ reflect: true }) label = \"\";\n\n /** The datepicker input's hint text below the label */\n @property({ reflect: true }) hintText = \"\";\n\n /** Controls auto-flipping of menu */\n @property({ type: Boolean, reflect: true, state: false })\n noFlip = false;\n\n /** The drop position of menu relative to the toggle button */\n @property({ type: String, reflect: true, state: false })\n drop: \"up\" | \"down\" = \"down\";\n\n /** Provides the date context for Calendar to present the appropriate view. Defaults to today's date */\n @property({ attribute: false }) displayDate: Date;\n\n /**Gets or sets the default value used to reset this element. The initial value corresponds to the one originally specified in the HTML that created this element. */\n @defaultValue()\n defaultValue = \"\";\n\n /** Marks the component as invalid. Replace the pseudo :invalid selector. */\n @property({ type: Boolean, reflect: true }) invalid = false;\n\n @state()\n private view: ViewEnum = \"days\";\n\n @state() private selectedDateRange: Date[] = [];\n\n @state() private focusedDate: Date;\n\n @state() private focusedTabIndex = 3;\n\n private isValueEmpty() {\n return this.value === \"\" || this.value === \"DD/MM/YYYY\" || this.value === \"DD/MM/YYYY - DD/MM/YYYY\";\n }\n\n private initialDisplayDate: Date = new Date();\n\n @queryAsync(\"sgds-datepicker-calendar\")\n private calendar: Promise<DatepickerCalendar>;\n\n @queryAsync(\"sgds-datepicker-input\")\n private datepickerInputAsync: Promise<DatepickerInput>;\n\n @query(\"sgds-datepicker-input\")\n private datepickerInput: DatepickerInput;\n /**\n * Checks for validity. Under the hood, HTMLFormElement's reportValidity method calls this method to check for component's validity state\n * Note that the native error popup is prevented for SGDS form components by default. Instead the validation message shows up in the feedback container of SgdsInput\n */\n public reportValidity(): boolean {\n return this._mixinReportValidity();\n }\n /**\n * Checks for validity without any native error popup message\n */\n public checkValidity(): boolean {\n return this._mixinCheckValidity();\n }\n\n /**\n * Programmatically sets the invalid state of the datepicker.\n * Use together with `noValidate` (or `novalidate` on the parent `<form>`) and `invalidFeedback`\n * to integrate 3rd-party or custom validation logic.\n */\n public setInvalid(bool: boolean) {\n this.invalid = bool;\n if (this.datepickerInput) {\n this.datepickerInput.setInvalid(bool);\n }\n }\n\n /**\n * Checks for validity without any native error popup message\n */\n public setValidity(flags?: ValidityStateFlags, message?: string, anchor?: HTMLElement): void {\n return this._mixinSetValidity(flags, message, anchor);\n }\n\n /**\n * Returns the ValidityState object\n */\n public get validity(): ValidityState {\n return this._mixinGetValidity();\n }\n /**\n * Returns the validation message based on the ValidityState\n */\n public get validationMessage() {\n return this._mixinGetValidationMessage();\n }\n\n async connectedCallback() {\n super.connectedCallback();\n this.addEventListener(\"sgds-view\", this._handleViewChanged);\n this.addEventListener(\"sgds-change-calendar\", this._handleDateChanged);\n this.addEventListener(\"sgds-update-focus\", this._handleFocusDateChanged);\n this.addEventListener(\"sgds-selectmonth\", this._handleSelectMonth);\n this.addEventListener(\"sgds-selectyear\", this._handleSelectYear);\n this.addEventListener(\"sgds-selectdates\", this._handleSelectDatesAndClose);\n this.addEventListener(\"i-sgds-selectdates-input\", this._handleSelectDatesInput);\n this.addEventListener(\"i-sgds-empty-input\", this._handleEmptyInput);\n this.addEventListener(\"keydown\", this._handleTab);\n this.addEventListener(\"sgds-hide\", this._handleCloseMenu);\n this.addEventListener(\"sgds-show\", this._handleOpenMenu);\n this.addEventListener(\"blur\", this._mixinCheckValidity);\n\n this.initialValue = this.value ? this.value.split(\" - \").map(v => v.trim()) : this.initialValue;\n this.initialDisplayDate = this.displayDate || new Date();\n if (this.initialValue && this.initialValue.length > 0) {\n // Validate initialValue against the dateFormat regex\n const dateFormatRegex = new RegExp(this._getDateFormatRegex());\n // const startDateString = this.initialValue[0];\n const invalidDates = this.initialValue.filter(v => !dateFormatRegex.test(v));\n if (invalidDates.length > 0) {\n return console.error(\"Invalid date format in initialValue:\", invalidDates);\n } else {\n const initialSelectedDates = this.initialValue.map(v =>\n setTimeToNoon(parseDate(v, DATE_PATTERNS[this.dateFormat].fnsPattern))\n );\n this._handleSelectDates(initialSelectedDates);\n }\n } else {\n this.displayDate = this.initialDisplayDate;\n }\n\n const input = await this.datepickerInputAsync;\n input.setInvalid(this.invalid);\n }\n\n async firstUpdated(changedProperties: PropertyValueMap<this>) {\n super.firstUpdated(changedProperties);\n if (this.menuIsOpen) {\n const input = await this.datepickerInputAsync;\n await this.updateFloatingPosition();\n const cal = await this.calendar;\n cal.focusOnCalendar(input);\n }\n }\n\n /** @internal */\n private _getDateFormatRegex(): string {\n // validate date strings and adhere to the specified date format\n return (\n this.dateFormat\n // Replace any special characters with their escaped version using \"\\\\$&\"\n .replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\")\n // Replace 'MM' with '\\\\d{2}', which matches two digits representing the month (e.g., 01, 12)\n .replace(\"MM\", \"\\\\d{2}\")\n // Replace 'DD' with '\\\\d{2}', which matches two digits representing the day (e.g., 01, 31)\n .replace(\"DD\", \"\\\\d{2}\")\n // Replace 'YYYY' with '\\\\d{4}', which matches four digits representing the year (e.g., 2021)\n .replace(\"YYYY\", \"\\\\d{4}\")\n // Replace '/' with '\\\\/', which matches the forward slash character\n .replace(\"/\", \"\\\\/\")\n );\n }\n private _handleTab(event: KeyboardEvent) {\n if (!this.menuIsOpen) {\n return;\n }\n const tabIndexArray = Array(4);\n if (event.shiftKey && event.key === \"Tab\") {\n event.preventDefault();\n this.focusedTabIndex = (this.focusedTabIndex - 1 + tabIndexArray.length) % tabIndexArray.length;\n } else if (event.key === \"Tab\") {\n event.preventDefault();\n this.focusedTabIndex = (this.focusedTabIndex + 1 + tabIndexArray.length) % tabIndexArray.length;\n }\n }\n\n @watch(\"value\", { waitUntilFirstUpdate: true })\n _handleValueChange() {\n this.emit(\"sgds-change-date\");\n }\n\n private async _handleCloseMenu() {\n if (this.selectedDateRange.length === 0) {\n this.displayDate = this.initialDisplayDate;\n } else {\n const selectedDatesLength = this.selectedDateRange.length;\n this.displayDate = this.selectedDateRange[selectedDatesLength - 1];\n const calendar = await this.calendar;\n calendar._updateFocusedDate();\n }\n\n // Focus input after displayDate reset and calendar re-render to prevent\n // the calendar's updated() from stealing focus during the hide animation\n await this.updateComplete;\n const input = await this.datepickerInputAsync;\n input.focus();\n }\n private async _handleOpenMenu() {\n const cal = await this.calendar;\n const input = await this.datepickerInputAsync;\n cal.focusOnCalendar(input);\n }\n\n private _makeInputValueString = (startDate: Date, endDate: Date, dateFormat: string) => {\n if (!startDate && !endDate) return this.value;\n const fmtDate = (date: Date) => formatDate(date, DATE_PATTERNS[dateFormat].fnsPattern);\n switch (this.mode) {\n case \"single\": {\n if (startDate) {\n this.value = fmtDate(startDate);\n }\n break;\n }\n case \"range\": {\n if (startDate && endDate) {\n this.value = `${fmtDate(startDate)} - ${fmtDate(endDate)}`;\n }\n if (startDate && !endDate) {\n this.value = `${fmtDate(startDate)} - ${this.dateFormat}`;\n }\n break;\n }\n }\n return this.value;\n };\n private _handleSelectDatesInput(event: CustomEvent<Date[]>) {\n this._handleSelectDates(event.detail);\n }\n private async _handleSelectDates(newSelectedDates: Date[]) {\n newSelectedDates.sort((a: Date, b: Date) => a.getTime() - b.getTime());\n this.displayDate = newSelectedDates[0];\n this.focusedDate = newSelectedDates[0];\n this.selectedDateRange = newSelectedDates;\n // Get the formattedDate value for the selected dates\n const formattedDate = this._makeInputValueString(\n this.selectedDateRange[0],\n this.selectedDateRange[1],\n this.dateFormat\n );\n\n // Set formattedDate value as the new value for sgds-input\n this.value = formattedDate;\n const input = await this.datepickerInputAsync;\n input.updateMaskValue();\n this._manageInternalsValid();\n }\n\n private async _handleSelectDatesAndClose(event: CustomEvent<Date[]>) {\n await this._handleSelectDates(event.detail);\n\n if (this.mode === \"range\" && this.selectedDateRange.length === 2) {\n this.hideMenu();\n } else if (this.mode === \"single\" && this.selectedDateRange.length === 1) {\n this.hideMenu();\n }\n }\n\n /** update latest view state from datepicker-header */\n private _handleViewChanged(event: CustomEvent<string>) {\n this.view = event.detail as ViewEnum;\n }\n\n private _handleDateChanged(event: CustomEvent<Date>) {\n this.displayDate = event.detail;\n }\n private _handleFocusDateChanged(event: CustomEvent<Date>) {\n this.focusedDate = event.detail;\n }\n\n private _handleSelectMonth(event: CustomEvent<Date>) {\n this.displayDate = event.detail;\n }\n\n private _handleSelectYear(event: CustomEvent<Date>) {\n this.displayDate = event.detail;\n }\n private async _handleInvalidInput() {\n this.selectedDateRange = [];\n this.displayDate = this.initialDisplayDate;\n if (this._mixinShouldSkipSgdsValidation()) return;\n\n this.invalid = true;\n this._manageInternalsBadInput();\n }\n private async _handleEmptyInput() {\n if (this.required) {\n this._manageEmptyInput();\n }\n return;\n }\n private async _resetDatepicker(resetValue = \"\") {\n this.displayDate = this.initialDisplayDate;\n this.selectedDateRange = [];\n this.value = resetValue;\n this.view = \"days\";\n const input = await this.datepickerInputAsync;\n input.setInvalid(this.invalid);\n input.destroyInputMask();\n await input.applyInputMask();\n\n this._mixinResetValidity(input);\n if (this.isValueEmpty()) {\n this._handleEmptyInput();\n }\n }\n\n private _manageInternalsBadInput() {\n this._mixinSetValidity(\n {\n badInput: true\n },\n \"Invalid date input\",\n this.datepickerInput\n );\n }\n /**\n * Even though element internals handles the required constraint validation. This custom one is still needed as\n * datepicker input has a special case where the default input mask \"DD/MM/YYYY\" means an empty input.\n * However, the required constraint validation sees \"DD/MM/YYYY\" as a non-empty input.\n */\n private _manageEmptyInput() {\n this._mixinSetValidity(\n {\n valueMissing: true\n },\n \"Please fill in this field\",\n this.datepickerInput\n );\n }\n\n /**\n * Called when a valid date is entered via input or selected by calendar\n * 1. sets validity state to valid\n * 2. updates invalid prop\n * 3. sets the form value of datepicker\n */\n private _manageInternalsValid() {\n this._mixinSetFormValue();\n if (this._mixinShouldSkipSgdsValidation()) return;\n\n this._mixinSetValidity({});\n\n this.invalid = this.datepickerInput.invalid = false;\n }\n\n /**\n * Handles the form \"reset\" event\n */\n private async _mixinResetFormControl() {\n this._resetDatepicker(this.defaultValue);\n }\n private async _handleInputMaskChange(e: CustomEvent) {\n this.value = e.detail;\n\n if (this.isValueEmpty()) {\n this._resetDatepicker();\n }\n }\n\n private _dialogAriaLabels = {\n days: \"Choose date\",\n months: \"Choose month\",\n years: \"Choose year\"\n };\n render() {\n return html`\n <div class=\"datepicker-container m-width-160\">\n <sgds-datepicker-input\n .value=${live(this.value)}\n ?required=${this.required}\n ?disabled=${this.disabled}\n placeholder=${this.mode === \"single\" ? \"DD/MM/YYYY\" : \"DD/MM/YYYY - DD/MM/YYYY\"}\n mode=${this.mode}\n invalidFeedback=${ifDefined(this.invalidFeedback ? this.invalidFeedback : this._mixinGetValidationMessage())}\n @i-sgds-mask-input-change=${this._handleInputMaskChange}\n @i-sgds-invalid-input=${this._handleInvalidInput}\n minDate=${this.minDate}\n maxDate=${this.maxDate}\n label=${this.label}\n hintText=${this.hintText}\n name=${this.name}\n ?invalid=${this.invalid}\n hasFeedback=${ifDefined(this.hasFeedback ? \"both\" : undefined)}\n ?readonly=${this.readonly}\n >\n <sgds-icon-button\n slot=\"calendar-btn\"\n ${ref(this.myDropdown)}\n tone=\"neutral\"\n class=${classMap({\n \"calendar-btn\": true,\n \"with-hint-text\": this.hintText || this.invalid,\n \"with-label\": this.label\n })}\n aria-expanded=\"${this.menuIsOpen}\"\n aria-haspopup=\"dialog\"\n aria-controls=${this.dropdownMenuId}\n @click=${() => this.toggleMenu()}\n ariaLabel=${this.menuIsOpen ? \"Close Calendar\" : \"Open Calendar\"}\n ?disabled=${this.disabled || this.readonly}\n ?active=${this.menuIsOpen}\n variant=\"outline\"\n name=\"calendar\"\n >\n </sgds-icon-button>\n </sgds-datepicker-input>\n <div\n id=${this.dropdownMenuId}\n class=\"sgds datepicker dropdown-menu\"\n role=\"dialog\"\n aria-label=${this._dialogAriaLabels[this.view]}\n @click=${(event: MouseEvent) => event.stopPropagation()}\n ${ref(this.menuRef)}\n >\n <sgds-datepicker-header\n .view=${this.view}\n .displayDate=${this.displayDate}\n .focusedDate=${this.focusedDate}\n .selectedDate=${this.selectedDateRange}\n .focusedTabIndex=${this.focusedTabIndex}\n ></sgds-datepicker-header>\n <sgds-datepicker-calendar\n .show=${this.menuIsOpen}\n .view=${this.view}\n .displayDate=${this.displayDate}\n .mode=${this.mode}\n minDate=${this.minDate}\n maxDate=${this.maxDate}\n .selectedDate=${this.selectedDateRange}\n .focusedTabIndex=${this.focusedTabIndex}\n ></sgds-datepicker-calendar>\n </div>\n </div>\n `;\n }\n}\n\nexport default SgdsDatepicker;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,IAAa,iBAAb,cAAoCA,uBAAAA,uBAAuBC,yBAAAA,eAAe,CAAC,CAA4B;;EACrF,KAAA,SAAA;GAAC,GAAGA,yBAAAA,gBAAgB;GAAQC,sBAAAA;GAAmBC,mBAAAA;EAAe;;;EAExD,KAAA,eAAA;GACpB,yBAAyBC,yBAAAA;GACzB,4BAA4BC,4BAAAA;GAC5B,0BAA0BC,0BAAAA;GAC1B,eAAeC,oBAAAA;GACf,oBAAoBC,yBAAAA;EACtB;;CAEA,cAAc;EACZ,MAAM;EAO+C,KAAA,WAAA;EAIA,KAAA,WAAA;EAGE,KAAA,aAAA;EAMN,KAAA,QAAA;EAQgB,KAAA,eAAA,CAAC;EAE/C,KAAA,aAAA;EAGiB,KAAA,UAAA;EAGA,KAAA,UAAA;EAGgC,KAAA,OAAA;EAMZ,KAAA,cAAA;EAGrB,KAAA,QAAA;EAGG,KAAA,WAAA;EAI/B,KAAA,SAAA;EAIa,KAAA,OAAA;EAOP,KAAA,eAAA;EAGuC,KAAA,UAAA;EAG7B,KAAA,OAAA;EAEoB,KAAA,oBAAA,CAAC;EAIX,KAAA,kBAAA;EAMA,KAAA,qCAAA,IAAI,KAAK;EAkKX,KAAA,yBAAA,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,"file":"sgds-datepicker.cjs.js","names":["SgdsFormValidatorMixin","DropdownElement","dropdownMenuStyle","datepickerStyle","DatepickerInput","DatepickerCalendar","DatepickerHeader","SgdsButton","SgdsIconButton","formatDate","DATE_PATTERNS","setTimeToNoon","parseDate","live","ifDefined","ref","classMap","property","defaultValue","state","queryAsync","query","watch"],"sources":["../../../../src/components/Datepicker/sgds-datepicker.ts"],"sourcesContent":["import { formatDate, parseDate } from \"../../utils/date-helpers\";\nimport { html, PropertyValueMap } from \"lit\";\nimport { property, query, queryAsync, state } from \"lit/decorators.js\";\nimport { live } from \"lit/directives/live.js\";\nimport { ref } from \"lit/directives/ref.js\";\nimport { DropdownElement } from \"../../base/dropdown-element\";\nimport { type SgdsFormControl } from \"../../utils/formSubmitController\";\nimport { DATE_PATTERNS, setTimeToNoon } from \"../../utils/time\";\nimport { watch } from \"../../utils/watch\";\nimport { SgdsButton } from \"../Button/sgds-button\";\nimport dropdownMenuStyle from \"../Dropdown/dropdown-menu.css\";\nimport { DatepickerCalendar } from \"./datepicker-calendar\";\nimport { DatepickerHeader } from \"./datepicker-header\";\nimport DatepickerInput from \"./datepicker-input\";\nimport datepickerStyle from \"./datepicker.css\";\nimport { ViewEnum } from \"./types\";\nimport SgdsIconButton from \"../IconButton/sgds-icon-button\";\nimport { SgdsFormValidatorMixin } from \"../../utils/validatorMixin\";\nimport { ifDefined } from \"lit/directives/if-defined.js\";\nimport { classMap } from \"lit/directives/class-map.js\";\nimport { defaultValue } from \"../../utils/defaultvalue\";\n\nexport type DateFormat = \"MM/DD/YYYY\" | \"DD/MM/YYYY\" | \"YYYY/MM/DD\";\n\n/**\n * @summary The `DatePicker` Component is built using `Dropdown`, `Input` and `Button` components. By default, the Calendar points to today's date and input has no value. Users can either pick dates from the calendar or type dates through the input\n *\n * @event sgds-change-date - Emitted when the state of datepicker's input changes during first load, close button reset click & date click. Date values can be accessed via event.target.value\n * @event sgds-invalid - Emitted when the combo box's invalid state is set to true.\n * @event sgds-valid - Emitted when the combo box's invalid state is set to false.\n *\n * @description displayDate sets the month, year views of the calendar while focusedDate follows the focus which also directly changes\n * displayDate on certain occasions. Example, when keyboard moves up to the next month, it updates displayDate which then affect the current\n * date view of the calendar\n */\nexport class SgdsDatepicker extends SgdsFormValidatorMixin(DropdownElement) implements SgdsFormControl {\n static styles = [...DropdownElement.styles, dropdownMenuStyle, datepickerStyle];\n /**@internal */\n static dependencies = {\n \"sgds-datepicker-input\": DatepickerInput,\n \"sgds-datepicker-calendar\": DatepickerCalendar,\n \"sgds-datepicker-header\": DatepickerHeader,\n \"sgds-button\": SgdsButton,\n \"sgds-icon-button\": SgdsIconButton\n };\n\n constructor() {\n super();\n this.floatingOpts = {\n placement: \"bottom-end\"\n };\n }\n\n /** When true, adds required attribute to input element */\n @property({ type: Boolean, reflect: true }) required = false;\n /**The datepicker input's name attribute */\n @property({ reflect: true }) name: string;\n /** When true, adds disabled attribute to input and button element */\n @property({ type: Boolean, reflect: true }) disabled = false;\n\n /** Disables native and sgds validation for the datepicker. */\n @property({ type: Boolean, reflect: true }) noValidate = false;\n\n /** Sets the initial value of the datepicker. Replaces deprecated `initialValue`.\n * Pass in dates in this format `dd/mm/yyyy` for single mode and `dd/mm/yyyy - dd/mm/yyyy` for range mode\n * For example, `value=\"22/12/2023\"` for single mode or `value=\"22/12/2023 - 25/12/2023\"` for range mode\n */\n @property({ type: String, reflect: true }) value = \"\";\n\n /**\n * The initial value of DatePicker on first load for single &\n * range mode as array of string. eg.'[\"22/12/2023\"]' for single &\n * '[\"22/12/2023\",\"25/12/2023\"]' for range respectively.\n * @deprecated since v3.3.0 — use `value` instead.\n */\n @property({ type: Array, reflect: true }) initialValue: string[] = [];\n\n private dateFormat = \"DD/MM/YYYY\";\n\n /** ISO date string to set the lowest allowable date value. e.g. \"2016-05-19T12:00:00.000Z\" */\n @property({ type: String }) minDate = \"\";\n\n /** ISO date string to set the highest allowable date value. e.g. \"2016-05-19T12:00:00.000Z\" */\n @property({ type: String }) maxDate = \"\";\n\n /** Changes DatePicker to single date selection or range date selection */\n @property({ type: String, reflect: true }) mode: \"single\" | \"range\" = \"single\";\n\n /**Feedback text for error state when date input is invalid */\n @property({ type: String, reflect: true }) invalidFeedback: string;\n\n /** Allows invalidFeedback and invalid styles to be visible with the input */\n @property({ type: Boolean, reflect: true }) hasFeedback = false;\n\n /** The datepicker input's label */\n @property({ reflect: true }) label = \"\";\n\n /** The datepicker input's hint text below the label */\n @property({ reflect: true }) hintText = \"\";\n\n /** Controls auto-flipping of menu */\n @property({ type: Boolean, reflect: true, state: false })\n noFlip = false;\n\n /** The drop position of menu relative to the toggle button */\n @property({ type: String, reflect: true, state: false })\n drop: \"up\" | \"down\" = \"down\";\n\n /** Provides the date context for Calendar to present the appropriate view. Defaults to today's date */\n @property({ attribute: false }) displayDate: Date;\n\n /**Gets or sets the default value used to reset this element. The initial value corresponds to the one originally specified in the HTML that created this element. */\n @defaultValue()\n defaultValue = \"\";\n\n /** Marks the component as invalid. Replace the pseudo :invalid selector. */\n @property({ type: Boolean, reflect: true }) invalid = false;\n\n @state()\n private view: ViewEnum = \"days\";\n\n @state() private selectedDateRange: Date[] = [];\n\n @state() private focusedDate: Date;\n\n @state() private focusedTabIndex = 3;\n\n private isValueEmpty() {\n return this.value === \"\" || this.value === \"DD/MM/YYYY\" || this.value === \"DD/MM/YYYY - DD/MM/YYYY\";\n }\n\n private initialDisplayDate: Date = new Date();\n\n @queryAsync(\"sgds-datepicker-calendar\")\n private calendar: Promise<DatepickerCalendar>;\n\n @queryAsync(\"sgds-datepicker-input\")\n private datepickerInputAsync: Promise<DatepickerInput>;\n\n @query(\"sgds-datepicker-input\")\n private datepickerInput: DatepickerInput;\n /**\n * Checks for validity. Under the hood, HTMLFormElement's reportValidity method calls this method to check for component's validity state\n * Note that the native error popup is prevented for SGDS form components by default. Instead the validation message shows up in the feedback container of SgdsInput\n */\n public reportValidity(): boolean {\n return this._mixinReportValidity();\n }\n /**\n * Checks for validity without any native error popup message\n */\n public checkValidity(): boolean {\n return this._mixinCheckValidity();\n }\n\n /**\n * Programmatically sets the invalid state of the datepicker.\n * Use together with `noValidate` (or `novalidate` on the parent `<form>`) and `invalidFeedback`\n * to integrate 3rd-party or custom validation logic.\n */\n public setInvalid(bool: boolean) {\n this.invalid = bool;\n if (this.datepickerInput) {\n this.datepickerInput.setInvalid(bool);\n }\n }\n\n /**\n * Checks for validity without any native error popup message\n */\n public setValidity(flags?: ValidityStateFlags, message?: string, anchor?: HTMLElement): void {\n return this._mixinSetValidity(flags, message, anchor);\n }\n\n /**\n * Returns the ValidityState object\n */\n public get validity(): ValidityState {\n return this._mixinGetValidity();\n }\n /**\n * Returns the validation message based on the ValidityState\n */\n public get validationMessage() {\n return this._mixinGetValidationMessage();\n }\n\n async connectedCallback() {\n super.connectedCallback();\n this.addEventListener(\"sgds-view\", this._handleViewChanged);\n this.addEventListener(\"sgds-change-calendar\", this._handleDateChanged);\n this.addEventListener(\"sgds-update-focus\", this._handleFocusDateChanged);\n this.addEventListener(\"sgds-selectmonth\", this._handleSelectMonth);\n this.addEventListener(\"sgds-selectyear\", this._handleSelectYear);\n this.addEventListener(\"sgds-selectdates\", this._handleSelectDatesAndClose);\n this.addEventListener(\"i-sgds-selectdates-input\", this._handleSelectDatesInput);\n this.addEventListener(\"i-sgds-empty-input\", this._handleEmptyInput);\n this.addEventListener(\"keydown\", this._handleTab);\n this.addEventListener(\"sgds-hide\", this._handleCloseMenu);\n this.addEventListener(\"sgds-show\", this._handleOpenMenu);\n this.addEventListener(\"blur\", this._mixinCheckValidity);\n\n this.initialValue = this.value ? this.value.split(\" - \").map(v => v.trim()) : this.initialValue;\n this.initialDisplayDate = this.displayDate || new Date();\n if (this.initialValue && this.initialValue.length > 0) {\n // Validate initialValue against the dateFormat regex\n const dateFormatRegex = new RegExp(this._getDateFormatRegex());\n // const startDateString = this.initialValue[0];\n const invalidDates = this.initialValue.filter(v => !dateFormatRegex.test(v));\n if (invalidDates.length > 0) {\n return console.error(\"Invalid date format in initialValue:\", invalidDates);\n } else {\n const initialSelectedDates = this.initialValue.map(v =>\n setTimeToNoon(parseDate(v, DATE_PATTERNS[this.dateFormat].fnsPattern))\n );\n this._handleSelectDates(initialSelectedDates);\n }\n } else {\n this.displayDate = this.initialDisplayDate;\n }\n\n const input = await this.datepickerInputAsync;\n input.setInvalid(this.invalid);\n }\n\n async firstUpdated(changedProperties: PropertyValueMap<this>) {\n super.firstUpdated(changedProperties);\n if (this.menuIsOpen) {\n const input = await this.datepickerInputAsync;\n await this.updateFloatingPosition();\n const cal = await this.calendar;\n cal.focusOnCalendar(input);\n }\n }\n\n /** @internal */\n private _getDateFormatRegex(): string {\n // validate date strings and adhere to the specified date format\n return (\n this.dateFormat\n // Replace any special characters with their escaped version using \"\\\\$&\"\n .replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\")\n // Replace 'MM' with '\\\\d{2}', which matches two digits representing the month (e.g., 01, 12)\n .replace(\"MM\", \"\\\\d{2}\")\n // Replace 'DD' with '\\\\d{2}', which matches two digits representing the day (e.g., 01, 31)\n .replace(\"DD\", \"\\\\d{2}\")\n // Replace 'YYYY' with '\\\\d{4}', which matches four digits representing the year (e.g., 2021)\n .replace(\"YYYY\", \"\\\\d{4}\")\n // Replace '/' with '\\\\/', which matches the forward slash character\n .replace(\"/\", \"\\\\/\")\n );\n }\n private _handleTab(event: KeyboardEvent) {\n if (!this.menuIsOpen) {\n return;\n }\n const tabIndexArray = Array(4);\n if (event.shiftKey && event.key === \"Tab\") {\n event.preventDefault();\n this.focusedTabIndex = (this.focusedTabIndex - 1 + tabIndexArray.length) % tabIndexArray.length;\n } else if (event.key === \"Tab\") {\n event.preventDefault();\n this.focusedTabIndex = (this.focusedTabIndex + 1 + tabIndexArray.length) % tabIndexArray.length;\n }\n }\n\n @watch(\"value\", { waitUntilFirstUpdate: true })\n async _handleValueChange() {\n this._mixinSetFormValue();\n this.emit(\"sgds-change-date\");\n await this.updateComplete;\n if (this._mixinShouldSkipSgdsValidation()) return;\n this._mixinValidate(this.input);\n }\n\n private async _handleCloseMenu() {\n if (this.selectedDateRange.length === 0) {\n this.displayDate = this.initialDisplayDate;\n } else {\n const selectedDatesLength = this.selectedDateRange.length;\n this.displayDate = this.selectedDateRange[selectedDatesLength - 1];\n const calendar = await this.calendar;\n calendar._updateFocusedDate();\n }\n\n // Focus input after displayDate reset and calendar re-render to prevent\n // the calendar's updated() from stealing focus during the hide animation\n await this.updateComplete;\n const input = await this.datepickerInputAsync;\n input.focus();\n }\n private async _handleOpenMenu() {\n const cal = await this.calendar;\n const input = await this.datepickerInputAsync;\n cal.focusOnCalendar(input);\n }\n\n private _makeInputValueString = (startDate: Date, endDate: Date, dateFormat: string) => {\n if (!startDate && !endDate) return this.value;\n const fmtDate = (date: Date) => formatDate(date, DATE_PATTERNS[dateFormat].fnsPattern);\n switch (this.mode) {\n case \"single\": {\n if (startDate) {\n this.value = fmtDate(startDate);\n }\n break;\n }\n case \"range\": {\n if (startDate && endDate) {\n this.value = `${fmtDate(startDate)} - ${fmtDate(endDate)}`;\n }\n if (startDate && !endDate) {\n this.value = `${fmtDate(startDate)} - ${this.dateFormat}`;\n }\n break;\n }\n }\n return this.value;\n };\n private _handleSelectDatesInput(event: CustomEvent<Date[]>) {\n this._handleSelectDates(event.detail);\n }\n private async _handleSelectDates(newSelectedDates: Date[]) {\n newSelectedDates.sort((a: Date, b: Date) => a.getTime() - b.getTime());\n this.displayDate = newSelectedDates[0];\n this.focusedDate = newSelectedDates[0];\n this.selectedDateRange = newSelectedDates;\n // Get the formattedDate value for the selected dates\n const formattedDate = this._makeInputValueString(\n this.selectedDateRange[0],\n this.selectedDateRange[1],\n this.dateFormat\n );\n\n // Set formattedDate value as the new value for sgds-input\n this.value = formattedDate;\n const input = await this.datepickerInputAsync;\n input.updateMaskValue();\n this._manageInternalsValid();\n }\n\n private async _handleSelectDatesAndClose(event: CustomEvent<Date[]>) {\n await this._handleSelectDates(event.detail);\n\n if (this.mode === \"range\" && this.selectedDateRange.length === 2) {\n this.hideMenu();\n } else if (this.mode === \"single\" && this.selectedDateRange.length === 1) {\n this.hideMenu();\n }\n }\n\n /** update latest view state from datepicker-header */\n private _handleViewChanged(event: CustomEvent<string>) {\n this.view = event.detail as ViewEnum;\n }\n\n private _handleDateChanged(event: CustomEvent<Date>) {\n this.displayDate = event.detail;\n }\n private _handleFocusDateChanged(event: CustomEvent<Date>) {\n this.focusedDate = event.detail;\n }\n\n private _handleSelectMonth(event: CustomEvent<Date>) {\n this.displayDate = event.detail;\n }\n\n private _handleSelectYear(event: CustomEvent<Date>) {\n this.displayDate = event.detail;\n }\n private async _handleInvalidInput() {\n this.selectedDateRange = [];\n this.displayDate = this.initialDisplayDate;\n if (this._mixinShouldSkipSgdsValidation()) return;\n\n this.invalid = true;\n this._manageInternalsBadInput();\n }\n private async _handleEmptyInput() {\n if (this.required) {\n this._manageEmptyInput();\n }\n return;\n }\n private async _resetDatepicker(resetValue = \"\") {\n this.displayDate = this.initialDisplayDate;\n this.selectedDateRange = [];\n this.value = resetValue;\n this.view = \"days\";\n const input = await this.datepickerInputAsync;\n input.setInvalid(this.invalid);\n input.destroyInputMask();\n await input.applyInputMask();\n\n this._mixinResetValidity(input);\n if (this.isValueEmpty()) {\n this._handleEmptyInput();\n }\n }\n\n private _manageInternalsBadInput() {\n this._mixinSetValidity(\n {\n badInput: true\n },\n \"Invalid date input\",\n this.datepickerInput\n );\n }\n /**\n * Even though element internals handles the required constraint validation. This custom one is still needed as\n * datepicker input has a special case where the default input mask \"DD/MM/YYYY\" means an empty input.\n * However, the required constraint validation sees \"DD/MM/YYYY\" as a non-empty input.\n */\n private _manageEmptyInput() {\n this._mixinSetValidity(\n {\n valueMissing: true\n },\n \"Please fill in this field\",\n this.datepickerInput\n );\n }\n\n /**\n * Called when a valid date is entered via input or selected by calendar\n * 1. sets validity state to valid\n * 2. updates invalid prop\n * 3. sets the form value of datepicker\n */\n private _manageInternalsValid() {\n this._mixinSetFormValue();\n if (this._mixinShouldSkipSgdsValidation()) return;\n\n this._mixinSetValidity({});\n\n this.invalid = this.datepickerInput.invalid = false;\n }\n\n /**\n * Handles the form \"reset\" event\n */\n private async _mixinResetFormControl() {\n this._resetDatepicker(this.defaultValue);\n }\n private async _handleInputMaskChange(e: CustomEvent) {\n this.value = e.detail;\n\n if (this.isValueEmpty()) {\n this._resetDatepicker();\n }\n }\n\n private _dialogAriaLabels = {\n days: \"Choose date\",\n months: \"Choose month\",\n years: \"Choose year\"\n };\n render() {\n return html`\n <div class=\"datepicker-container m-width-160\">\n <sgds-datepicker-input\n .value=${live(this.value)}\n ?required=${this.required}\n ?disabled=${this.disabled}\n placeholder=${this.mode === \"single\" ? \"DD/MM/YYYY\" : \"DD/MM/YYYY - DD/MM/YYYY\"}\n mode=${this.mode}\n invalidFeedback=${ifDefined(this.invalidFeedback ? this.invalidFeedback : this._mixinGetValidationMessage())}\n @i-sgds-mask-input-change=${this._handleInputMaskChange}\n @i-sgds-invalid-input=${this._handleInvalidInput}\n minDate=${this.minDate}\n maxDate=${this.maxDate}\n label=${this.label}\n hintText=${this.hintText}\n name=${this.name}\n ?invalid=${this.invalid}\n hasFeedback=${ifDefined(this.hasFeedback ? \"both\" : undefined)}\n ?readonly=${this.readonly}\n >\n <sgds-icon-button\n slot=\"calendar-btn\"\n ${ref(this.myDropdown)}\n tone=\"neutral\"\n class=${classMap({\n \"calendar-btn\": true,\n \"with-hint-text\": this.hintText || this.invalid,\n \"with-label\": this.label\n })}\n aria-expanded=\"${this.menuIsOpen}\"\n aria-haspopup=\"dialog\"\n aria-controls=${this.dropdownMenuId}\n @click=${() => this.toggleMenu()}\n ariaLabel=${this.menuIsOpen ? \"Close Calendar\" : \"Open Calendar\"}\n ?disabled=${this.disabled || this.readonly}\n ?active=${this.menuIsOpen}\n variant=\"outline\"\n name=\"calendar\"\n >\n </sgds-icon-button>\n </sgds-datepicker-input>\n <div\n id=${this.dropdownMenuId}\n class=\"sgds datepicker dropdown-menu\"\n role=\"dialog\"\n aria-label=${this._dialogAriaLabels[this.view]}\n @click=${(event: MouseEvent) => event.stopPropagation()}\n ${ref(this.menuRef)}\n >\n <sgds-datepicker-header\n .view=${this.view}\n .displayDate=${this.displayDate}\n .focusedDate=${this.focusedDate}\n .selectedDate=${this.selectedDateRange}\n .focusedTabIndex=${this.focusedTabIndex}\n ></sgds-datepicker-header>\n <sgds-datepicker-calendar\n .show=${this.menuIsOpen}\n .view=${this.view}\n .displayDate=${this.displayDate}\n .mode=${this.mode}\n minDate=${this.minDate}\n maxDate=${this.maxDate}\n .selectedDate=${this.selectedDateRange}\n .focusedTabIndex=${this.focusedTabIndex}\n ></sgds-datepicker-calendar>\n </div>\n </div>\n `;\n }\n}\n\nexport default SgdsDatepicker;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,IAAa,iBAAb,cAAoCA,uBAAAA,uBAAuBC,yBAAAA,eAAe,CAAC,CAA4B;;EACrF,KAAA,SAAA;GAAC,GAAGA,yBAAAA,gBAAgB;GAAQC,sBAAAA;GAAmBC,mBAAAA;EAAe;;;EAExD,KAAA,eAAA;GACpB,yBAAyBC,yBAAAA;GACzB,4BAA4BC,4BAAAA;GAC5B,0BAA0BC,0BAAAA;GAC1B,eAAeC,oBAAAA;GACf,oBAAoBC,yBAAAA;EACtB;;CAEA,cAAc;EACZ,MAAM;EAO+C,KAAA,WAAA;EAIA,KAAA,WAAA;EAGE,KAAA,aAAA;EAMN,KAAA,QAAA;EAQgB,KAAA,eAAA,CAAC;EAE/C,KAAA,aAAA;EAGiB,KAAA,UAAA;EAGA,KAAA,UAAA;EAGgC,KAAA,OAAA;EAMZ,KAAA,cAAA;EAGrB,KAAA,QAAA;EAGG,KAAA,WAAA;EAI/B,KAAA,SAAA;EAIa,KAAA,OAAA;EAOP,KAAA,eAAA;EAGuC,KAAA,UAAA;EAG7B,KAAA,OAAA;EAEoB,KAAA,oBAAA,CAAC;EAIX,KAAA,kBAAA;EAMA,KAAA,qCAA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A,KAAA,CAAA;AA+H7BC,iBAAAA,QAAAA,CAAAA,cAAAA,MAAM,SAAS,EAAE,sBAAsB,KAAK,CAAC,CAAA,GAAA,eAAA,WAAA,sBAAA,IAAA"}
@@ -183,8 +183,12 @@ var SgdsDatepicker = class extends SgdsFormValidatorMixin(DropdownElement) {
183
183
  this.focusedTabIndex = (this.focusedTabIndex + 1 + tabIndexArray.length) % tabIndexArray.length;
184
184
  }
185
185
  }
186
- _handleValueChange() {
186
+ async _handleValueChange() {
187
+ this._mixinSetFormValue();
187
188
  this.emit("sgds-change-date");
189
+ await this.updateComplete;
190
+ if (this._mixinShouldSkipSgdsValidation()) return;
191
+ this._mixinValidate(this.input);
188
192
  }
189
193
  async _handleCloseMenu() {
190
194
  if (this.selectedDateRange.length === 0) this.displayDate = this.initialDisplayDate;
@@ -1 +1 @@
1
- {"version":3,"file":"sgds-datepicker.js","names":["dropdownMenuStyle","datepickerStyle"],"sources":["../../../../src/components/Datepicker/sgds-datepicker.ts"],"sourcesContent":["import { formatDate, parseDate } from \"../../utils/date-helpers\";\nimport { html, PropertyValueMap } from \"lit\";\nimport { property, query, queryAsync, state } from \"lit/decorators.js\";\nimport { live } from \"lit/directives/live.js\";\nimport { ref } from \"lit/directives/ref.js\";\nimport { DropdownElement } from \"../../base/dropdown-element\";\nimport { type SgdsFormControl } from \"../../utils/formSubmitController\";\nimport { DATE_PATTERNS, setTimeToNoon } from \"../../utils/time\";\nimport { watch } from \"../../utils/watch\";\nimport { SgdsButton } from \"../Button/sgds-button\";\nimport dropdownMenuStyle from \"../Dropdown/dropdown-menu.css\";\nimport { DatepickerCalendar } from \"./datepicker-calendar\";\nimport { DatepickerHeader } from \"./datepicker-header\";\nimport DatepickerInput from \"./datepicker-input\";\nimport datepickerStyle from \"./datepicker.css\";\nimport { ViewEnum } from \"./types\";\nimport SgdsIconButton from \"../IconButton/sgds-icon-button\";\nimport { SgdsFormValidatorMixin } from \"../../utils/validatorMixin\";\nimport { ifDefined } from \"lit/directives/if-defined.js\";\nimport { classMap } from \"lit/directives/class-map.js\";\nimport { defaultValue } from \"../../utils/defaultvalue\";\n\nexport type DateFormat = \"MM/DD/YYYY\" | \"DD/MM/YYYY\" | \"YYYY/MM/DD\";\n\n/**\n * @summary The `DatePicker` Component is built using `Dropdown`, `Input` and `Button` components. By default, the Calendar points to today's date and input has no value. Users can either pick dates from the calendar or type dates through the input\n *\n * @event sgds-change-date - Emitted when the state of datepicker's input changes during first load, close button reset click & date click. Date values can be accessed via event.target.value\n * @event sgds-invalid - Emitted when the combo box's invalid state is set to true.\n * @event sgds-valid - Emitted when the combo box's invalid state is set to false.\n *\n * @description displayDate sets the month, year views of the calendar while focusedDate follows the focus which also directly changes\n * displayDate on certain occasions. Example, when keyboard moves up to the next month, it updates displayDate which then affect the current\n * date view of the calendar\n */\nexport class SgdsDatepicker extends SgdsFormValidatorMixin(DropdownElement) implements SgdsFormControl {\n static styles = [...DropdownElement.styles, dropdownMenuStyle, datepickerStyle];\n /**@internal */\n static dependencies = {\n \"sgds-datepicker-input\": DatepickerInput,\n \"sgds-datepicker-calendar\": DatepickerCalendar,\n \"sgds-datepicker-header\": DatepickerHeader,\n \"sgds-button\": SgdsButton,\n \"sgds-icon-button\": SgdsIconButton\n };\n\n constructor() {\n super();\n this.floatingOpts = {\n placement: \"bottom-end\"\n };\n }\n\n /** When true, adds required attribute to input element */\n @property({ type: Boolean, reflect: true }) required = false;\n /**The datepicker input's name attribute */\n @property({ reflect: true }) name: string;\n /** When true, adds disabled attribute to input and button element */\n @property({ type: Boolean, reflect: true }) disabled = false;\n\n /** Disables native and sgds validation for the datepicker. */\n @property({ type: Boolean, reflect: true }) noValidate = false;\n\n /** Sets the initial value of the datepicker. Replaces deprecated `initialValue`.\n * Pass in dates in this format `dd/mm/yyyy` for single mode and `dd/mm/yyyy - dd/mm/yyyy` for range mode\n * For example, `value=\"22/12/2023\"` for single mode or `value=\"22/12/2023 - 25/12/2023\"` for range mode\n */\n @property({ type: String, reflect: true }) value = \"\";\n\n /**\n * The initial value of DatePicker on first load for single &\n * range mode as array of string. eg.'[\"22/12/2023\"]' for single &\n * '[\"22/12/2023\",\"25/12/2023\"]' for range respectively.\n * @deprecated since v3.3.0 — use `value` instead.\n */\n @property({ type: Array, reflect: true }) initialValue: string[] = [];\n\n private dateFormat = \"DD/MM/YYYY\";\n\n /** ISO date string to set the lowest allowable date value. e.g. \"2016-05-19T12:00:00.000Z\" */\n @property({ type: String }) minDate = \"\";\n\n /** ISO date string to set the highest allowable date value. e.g. \"2016-05-19T12:00:00.000Z\" */\n @property({ type: String }) maxDate = \"\";\n\n /** Changes DatePicker to single date selection or range date selection */\n @property({ type: String, reflect: true }) mode: \"single\" | \"range\" = \"single\";\n\n /**Feedback text for error state when date input is invalid */\n @property({ type: String, reflect: true }) invalidFeedback: string;\n\n /** Allows invalidFeedback and invalid styles to be visible with the input */\n @property({ type: Boolean, reflect: true }) hasFeedback = false;\n\n /** The datepicker input's label */\n @property({ reflect: true }) label = \"\";\n\n /** The datepicker input's hint text below the label */\n @property({ reflect: true }) hintText = \"\";\n\n /** Controls auto-flipping of menu */\n @property({ type: Boolean, reflect: true, state: false })\n noFlip = false;\n\n /** The drop position of menu relative to the toggle button */\n @property({ type: String, reflect: true, state: false })\n drop: \"up\" | \"down\" = \"down\";\n\n /** Provides the date context for Calendar to present the appropriate view. Defaults to today's date */\n @property({ attribute: false }) displayDate: Date;\n\n /**Gets or sets the default value used to reset this element. The initial value corresponds to the one originally specified in the HTML that created this element. */\n @defaultValue()\n defaultValue = \"\";\n\n /** Marks the component as invalid. Replace the pseudo :invalid selector. */\n @property({ type: Boolean, reflect: true }) invalid = false;\n\n @state()\n private view: ViewEnum = \"days\";\n\n @state() private selectedDateRange: Date[] = [];\n\n @state() private focusedDate: Date;\n\n @state() private focusedTabIndex = 3;\n\n private isValueEmpty() {\n return this.value === \"\" || this.value === \"DD/MM/YYYY\" || this.value === \"DD/MM/YYYY - DD/MM/YYYY\";\n }\n\n private initialDisplayDate: Date = new Date();\n\n @queryAsync(\"sgds-datepicker-calendar\")\n private calendar: Promise<DatepickerCalendar>;\n\n @queryAsync(\"sgds-datepicker-input\")\n private datepickerInputAsync: Promise<DatepickerInput>;\n\n @query(\"sgds-datepicker-input\")\n private datepickerInput: DatepickerInput;\n /**\n * Checks for validity. Under the hood, HTMLFormElement's reportValidity method calls this method to check for component's validity state\n * Note that the native error popup is prevented for SGDS form components by default. Instead the validation message shows up in the feedback container of SgdsInput\n */\n public reportValidity(): boolean {\n return this._mixinReportValidity();\n }\n /**\n * Checks for validity without any native error popup message\n */\n public checkValidity(): boolean {\n return this._mixinCheckValidity();\n }\n\n /**\n * Programmatically sets the invalid state of the datepicker.\n * Use together with `noValidate` (or `novalidate` on the parent `<form>`) and `invalidFeedback`\n * to integrate 3rd-party or custom validation logic.\n */\n public setInvalid(bool: boolean) {\n this.invalid = bool;\n if (this.datepickerInput) {\n this.datepickerInput.setInvalid(bool);\n }\n }\n\n /**\n * Checks for validity without any native error popup message\n */\n public setValidity(flags?: ValidityStateFlags, message?: string, anchor?: HTMLElement): void {\n return this._mixinSetValidity(flags, message, anchor);\n }\n\n /**\n * Returns the ValidityState object\n */\n public get validity(): ValidityState {\n return this._mixinGetValidity();\n }\n /**\n * Returns the validation message based on the ValidityState\n */\n public get validationMessage() {\n return this._mixinGetValidationMessage();\n }\n\n async connectedCallback() {\n super.connectedCallback();\n this.addEventListener(\"sgds-view\", this._handleViewChanged);\n this.addEventListener(\"sgds-change-calendar\", this._handleDateChanged);\n this.addEventListener(\"sgds-update-focus\", this._handleFocusDateChanged);\n this.addEventListener(\"sgds-selectmonth\", this._handleSelectMonth);\n this.addEventListener(\"sgds-selectyear\", this._handleSelectYear);\n this.addEventListener(\"sgds-selectdates\", this._handleSelectDatesAndClose);\n this.addEventListener(\"i-sgds-selectdates-input\", this._handleSelectDatesInput);\n this.addEventListener(\"i-sgds-empty-input\", this._handleEmptyInput);\n this.addEventListener(\"keydown\", this._handleTab);\n this.addEventListener(\"sgds-hide\", this._handleCloseMenu);\n this.addEventListener(\"sgds-show\", this._handleOpenMenu);\n this.addEventListener(\"blur\", this._mixinCheckValidity);\n\n this.initialValue = this.value ? this.value.split(\" - \").map(v => v.trim()) : this.initialValue;\n this.initialDisplayDate = this.displayDate || new Date();\n if (this.initialValue && this.initialValue.length > 0) {\n // Validate initialValue against the dateFormat regex\n const dateFormatRegex = new RegExp(this._getDateFormatRegex());\n // const startDateString = this.initialValue[0];\n const invalidDates = this.initialValue.filter(v => !dateFormatRegex.test(v));\n if (invalidDates.length > 0) {\n return console.error(\"Invalid date format in initialValue:\", invalidDates);\n } else {\n const initialSelectedDates = this.initialValue.map(v =>\n setTimeToNoon(parseDate(v, DATE_PATTERNS[this.dateFormat].fnsPattern))\n );\n this._handleSelectDates(initialSelectedDates);\n }\n } else {\n this.displayDate = this.initialDisplayDate;\n }\n\n const input = await this.datepickerInputAsync;\n input.setInvalid(this.invalid);\n }\n\n async firstUpdated(changedProperties: PropertyValueMap<this>) {\n super.firstUpdated(changedProperties);\n if (this.menuIsOpen) {\n const input = await this.datepickerInputAsync;\n await this.updateFloatingPosition();\n const cal = await this.calendar;\n cal.focusOnCalendar(input);\n }\n }\n\n /** @internal */\n private _getDateFormatRegex(): string {\n // validate date strings and adhere to the specified date format\n return (\n this.dateFormat\n // Replace any special characters with their escaped version using \"\\\\$&\"\n .replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\")\n // Replace 'MM' with '\\\\d{2}', which matches two digits representing the month (e.g., 01, 12)\n .replace(\"MM\", \"\\\\d{2}\")\n // Replace 'DD' with '\\\\d{2}', which matches two digits representing the day (e.g., 01, 31)\n .replace(\"DD\", \"\\\\d{2}\")\n // Replace 'YYYY' with '\\\\d{4}', which matches four digits representing the year (e.g., 2021)\n .replace(\"YYYY\", \"\\\\d{4}\")\n // Replace '/' with '\\\\/', which matches the forward slash character\n .replace(\"/\", \"\\\\/\")\n );\n }\n private _handleTab(event: KeyboardEvent) {\n if (!this.menuIsOpen) {\n return;\n }\n const tabIndexArray = Array(4);\n if (event.shiftKey && event.key === \"Tab\") {\n event.preventDefault();\n this.focusedTabIndex = (this.focusedTabIndex - 1 + tabIndexArray.length) % tabIndexArray.length;\n } else if (event.key === \"Tab\") {\n event.preventDefault();\n this.focusedTabIndex = (this.focusedTabIndex + 1 + tabIndexArray.length) % tabIndexArray.length;\n }\n }\n\n @watch(\"value\", { waitUntilFirstUpdate: true })\n _handleValueChange() {\n this.emit(\"sgds-change-date\");\n }\n\n private async _handleCloseMenu() {\n if (this.selectedDateRange.length === 0) {\n this.displayDate = this.initialDisplayDate;\n } else {\n const selectedDatesLength = this.selectedDateRange.length;\n this.displayDate = this.selectedDateRange[selectedDatesLength - 1];\n const calendar = await this.calendar;\n calendar._updateFocusedDate();\n }\n\n // Focus input after displayDate reset and calendar re-render to prevent\n // the calendar's updated() from stealing focus during the hide animation\n await this.updateComplete;\n const input = await this.datepickerInputAsync;\n input.focus();\n }\n private async _handleOpenMenu() {\n const cal = await this.calendar;\n const input = await this.datepickerInputAsync;\n cal.focusOnCalendar(input);\n }\n\n private _makeInputValueString = (startDate: Date, endDate: Date, dateFormat: string) => {\n if (!startDate && !endDate) return this.value;\n const fmtDate = (date: Date) => formatDate(date, DATE_PATTERNS[dateFormat].fnsPattern);\n switch (this.mode) {\n case \"single\": {\n if (startDate) {\n this.value = fmtDate(startDate);\n }\n break;\n }\n case \"range\": {\n if (startDate && endDate) {\n this.value = `${fmtDate(startDate)} - ${fmtDate(endDate)}`;\n }\n if (startDate && !endDate) {\n this.value = `${fmtDate(startDate)} - ${this.dateFormat}`;\n }\n break;\n }\n }\n return this.value;\n };\n private _handleSelectDatesInput(event: CustomEvent<Date[]>) {\n this._handleSelectDates(event.detail);\n }\n private async _handleSelectDates(newSelectedDates: Date[]) {\n newSelectedDates.sort((a: Date, b: Date) => a.getTime() - b.getTime());\n this.displayDate = newSelectedDates[0];\n this.focusedDate = newSelectedDates[0];\n this.selectedDateRange = newSelectedDates;\n // Get the formattedDate value for the selected dates\n const formattedDate = this._makeInputValueString(\n this.selectedDateRange[0],\n this.selectedDateRange[1],\n this.dateFormat\n );\n\n // Set formattedDate value as the new value for sgds-input\n this.value = formattedDate;\n const input = await this.datepickerInputAsync;\n input.updateMaskValue();\n this._manageInternalsValid();\n }\n\n private async _handleSelectDatesAndClose(event: CustomEvent<Date[]>) {\n await this._handleSelectDates(event.detail);\n\n if (this.mode === \"range\" && this.selectedDateRange.length === 2) {\n this.hideMenu();\n } else if (this.mode === \"single\" && this.selectedDateRange.length === 1) {\n this.hideMenu();\n }\n }\n\n /** update latest view state from datepicker-header */\n private _handleViewChanged(event: CustomEvent<string>) {\n this.view = event.detail as ViewEnum;\n }\n\n private _handleDateChanged(event: CustomEvent<Date>) {\n this.displayDate = event.detail;\n }\n private _handleFocusDateChanged(event: CustomEvent<Date>) {\n this.focusedDate = event.detail;\n }\n\n private _handleSelectMonth(event: CustomEvent<Date>) {\n this.displayDate = event.detail;\n }\n\n private _handleSelectYear(event: CustomEvent<Date>) {\n this.displayDate = event.detail;\n }\n private async _handleInvalidInput() {\n this.selectedDateRange = [];\n this.displayDate = this.initialDisplayDate;\n if (this._mixinShouldSkipSgdsValidation()) return;\n\n this.invalid = true;\n this._manageInternalsBadInput();\n }\n private async _handleEmptyInput() {\n if (this.required) {\n this._manageEmptyInput();\n }\n return;\n }\n private async _resetDatepicker(resetValue = \"\") {\n this.displayDate = this.initialDisplayDate;\n this.selectedDateRange = [];\n this.value = resetValue;\n this.view = \"days\";\n const input = await this.datepickerInputAsync;\n input.setInvalid(this.invalid);\n input.destroyInputMask();\n await input.applyInputMask();\n\n this._mixinResetValidity(input);\n if (this.isValueEmpty()) {\n this._handleEmptyInput();\n }\n }\n\n private _manageInternalsBadInput() {\n this._mixinSetValidity(\n {\n badInput: true\n },\n \"Invalid date input\",\n this.datepickerInput\n );\n }\n /**\n * Even though element internals handles the required constraint validation. This custom one is still needed as\n * datepicker input has a special case where the default input mask \"DD/MM/YYYY\" means an empty input.\n * However, the required constraint validation sees \"DD/MM/YYYY\" as a non-empty input.\n */\n private _manageEmptyInput() {\n this._mixinSetValidity(\n {\n valueMissing: true\n },\n \"Please fill in this field\",\n this.datepickerInput\n );\n }\n\n /**\n * Called when a valid date is entered via input or selected by calendar\n * 1. sets validity state to valid\n * 2. updates invalid prop\n * 3. sets the form value of datepicker\n */\n private _manageInternalsValid() {\n this._mixinSetFormValue();\n if (this._mixinShouldSkipSgdsValidation()) return;\n\n this._mixinSetValidity({});\n\n this.invalid = this.datepickerInput.invalid = false;\n }\n\n /**\n * Handles the form \"reset\" event\n */\n private async _mixinResetFormControl() {\n this._resetDatepicker(this.defaultValue);\n }\n private async _handleInputMaskChange(e: CustomEvent) {\n this.value = e.detail;\n\n if (this.isValueEmpty()) {\n this._resetDatepicker();\n }\n }\n\n private _dialogAriaLabels = {\n days: \"Choose date\",\n months: \"Choose month\",\n years: \"Choose year\"\n };\n render() {\n return html`\n <div class=\"datepicker-container m-width-160\">\n <sgds-datepicker-input\n .value=${live(this.value)}\n ?required=${this.required}\n ?disabled=${this.disabled}\n placeholder=${this.mode === \"single\" ? \"DD/MM/YYYY\" : \"DD/MM/YYYY - DD/MM/YYYY\"}\n mode=${this.mode}\n invalidFeedback=${ifDefined(this.invalidFeedback ? this.invalidFeedback : this._mixinGetValidationMessage())}\n @i-sgds-mask-input-change=${this._handleInputMaskChange}\n @i-sgds-invalid-input=${this._handleInvalidInput}\n minDate=${this.minDate}\n maxDate=${this.maxDate}\n label=${this.label}\n hintText=${this.hintText}\n name=${this.name}\n ?invalid=${this.invalid}\n hasFeedback=${ifDefined(this.hasFeedback ? \"both\" : undefined)}\n ?readonly=${this.readonly}\n >\n <sgds-icon-button\n slot=\"calendar-btn\"\n ${ref(this.myDropdown)}\n tone=\"neutral\"\n class=${classMap({\n \"calendar-btn\": true,\n \"with-hint-text\": this.hintText || this.invalid,\n \"with-label\": this.label\n })}\n aria-expanded=\"${this.menuIsOpen}\"\n aria-haspopup=\"dialog\"\n aria-controls=${this.dropdownMenuId}\n @click=${() => this.toggleMenu()}\n ariaLabel=${this.menuIsOpen ? \"Close Calendar\" : \"Open Calendar\"}\n ?disabled=${this.disabled || this.readonly}\n ?active=${this.menuIsOpen}\n variant=\"outline\"\n name=\"calendar\"\n >\n </sgds-icon-button>\n </sgds-datepicker-input>\n <div\n id=${this.dropdownMenuId}\n class=\"sgds datepicker dropdown-menu\"\n role=\"dialog\"\n aria-label=${this._dialogAriaLabels[this.view]}\n @click=${(event: MouseEvent) => event.stopPropagation()}\n ${ref(this.menuRef)}\n >\n <sgds-datepicker-header\n .view=${this.view}\n .displayDate=${this.displayDate}\n .focusedDate=${this.focusedDate}\n .selectedDate=${this.selectedDateRange}\n .focusedTabIndex=${this.focusedTabIndex}\n ></sgds-datepicker-header>\n <sgds-datepicker-calendar\n .show=${this.menuIsOpen}\n .view=${this.view}\n .displayDate=${this.displayDate}\n .mode=${this.mode}\n minDate=${this.minDate}\n maxDate=${this.maxDate}\n .selectedDate=${this.selectedDateRange}\n .focusedTabIndex=${this.focusedTabIndex}\n ></sgds-datepicker-calendar>\n </div>\n </div>\n `;\n }\n}\n\nexport default SgdsDatepicker;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,IAAa,iBAAb,cAAoC,uBAAuB,eAAe,CAAC,CAA4B;;EACrF,KAAA,SAAA;GAAC,GAAG,gBAAgB;GAAQA;GAAmBC;EAAe;;;EAExD,KAAA,eAAA;GACpB,yBAAyB;GACzB,4BAA4B;GAC5B,0BAA0B;GAC1B,eAAe;GACf,oBAAoB;EACtB;;CAEA,cAAc;EACZ,MAAM;EAO+C,KAAA,WAAA;EAIA,KAAA,WAAA;EAGE,KAAA,aAAA;EAMN,KAAA,QAAA;EAQgB,KAAA,eAAA,CAAC;EAE/C,KAAA,aAAA;EAGiB,KAAA,UAAA;EAGA,KAAA,UAAA;EAGgC,KAAA,OAAA;EAMZ,KAAA,cAA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CAAA,MAAM,CAAA,GAAA,eAAA,WAAA,mBAAA,KAAA,CAAA;AAQN,WAAA,CAAA,WAAW,0BAA0B,CAAA,GAAA,eAAA,WAAA,YAAA,KAAA,CAAA;AAGrC,WAAA,CAAA,WAAW,uBAAuB,CAAA,GAAA,eAAA,WAAA,wBAAA,KAAA,CAAA;AAGlC,WAAA,CAAA,MAAM,uBAAuB,CAAA,GAAA,eAAA,WAAA,mBAAA,KAAA,CAAA;AA+H7B,WAAA,CAAA,MAAM,SAAS,EAAE,sBAAsB,KAAK,CAAC,CAAA,GAAA,eAAA,WAAA,sBAAA,IAAA"}
1
+ {"version":3,"file":"sgds-datepicker.js","names":["dropdownMenuStyle","datepickerStyle"],"sources":["../../../../src/components/Datepicker/sgds-datepicker.ts"],"sourcesContent":["import { formatDate, parseDate } from \"../../utils/date-helpers\";\nimport { html, PropertyValueMap } from \"lit\";\nimport { property, query, queryAsync, state } from \"lit/decorators.js\";\nimport { live } from \"lit/directives/live.js\";\nimport { ref } from \"lit/directives/ref.js\";\nimport { DropdownElement } from \"../../base/dropdown-element\";\nimport { type SgdsFormControl } from \"../../utils/formSubmitController\";\nimport { DATE_PATTERNS, setTimeToNoon } from \"../../utils/time\";\nimport { watch } from \"../../utils/watch\";\nimport { SgdsButton } from \"../Button/sgds-button\";\nimport dropdownMenuStyle from \"../Dropdown/dropdown-menu.css\";\nimport { DatepickerCalendar } from \"./datepicker-calendar\";\nimport { DatepickerHeader } from \"./datepicker-header\";\nimport DatepickerInput from \"./datepicker-input\";\nimport datepickerStyle from \"./datepicker.css\";\nimport { ViewEnum } from \"./types\";\nimport SgdsIconButton from \"../IconButton/sgds-icon-button\";\nimport { SgdsFormValidatorMixin } from \"../../utils/validatorMixin\";\nimport { ifDefined } from \"lit/directives/if-defined.js\";\nimport { classMap } from \"lit/directives/class-map.js\";\nimport { defaultValue } from \"../../utils/defaultvalue\";\n\nexport type DateFormat = \"MM/DD/YYYY\" | \"DD/MM/YYYY\" | \"YYYY/MM/DD\";\n\n/**\n * @summary The `DatePicker` Component is built using `Dropdown`, `Input` and `Button` components. By default, the Calendar points to today's date and input has no value. Users can either pick dates from the calendar or type dates through the input\n *\n * @event sgds-change-date - Emitted when the state of datepicker's input changes during first load, close button reset click & date click. Date values can be accessed via event.target.value\n * @event sgds-invalid - Emitted when the combo box's invalid state is set to true.\n * @event sgds-valid - Emitted when the combo box's invalid state is set to false.\n *\n * @description displayDate sets the month, year views of the calendar while focusedDate follows the focus which also directly changes\n * displayDate on certain occasions. Example, when keyboard moves up to the next month, it updates displayDate which then affect the current\n * date view of the calendar\n */\nexport class SgdsDatepicker extends SgdsFormValidatorMixin(DropdownElement) implements SgdsFormControl {\n static styles = [...DropdownElement.styles, dropdownMenuStyle, datepickerStyle];\n /**@internal */\n static dependencies = {\n \"sgds-datepicker-input\": DatepickerInput,\n \"sgds-datepicker-calendar\": DatepickerCalendar,\n \"sgds-datepicker-header\": DatepickerHeader,\n \"sgds-button\": SgdsButton,\n \"sgds-icon-button\": SgdsIconButton\n };\n\n constructor() {\n super();\n this.floatingOpts = {\n placement: \"bottom-end\"\n };\n }\n\n /** When true, adds required attribute to input element */\n @property({ type: Boolean, reflect: true }) required = false;\n /**The datepicker input's name attribute */\n @property({ reflect: true }) name: string;\n /** When true, adds disabled attribute to input and button element */\n @property({ type: Boolean, reflect: true }) disabled = false;\n\n /** Disables native and sgds validation for the datepicker. */\n @property({ type: Boolean, reflect: true }) noValidate = false;\n\n /** Sets the initial value of the datepicker. Replaces deprecated `initialValue`.\n * Pass in dates in this format `dd/mm/yyyy` for single mode and `dd/mm/yyyy - dd/mm/yyyy` for range mode\n * For example, `value=\"22/12/2023\"` for single mode or `value=\"22/12/2023 - 25/12/2023\"` for range mode\n */\n @property({ type: String, reflect: true }) value = \"\";\n\n /**\n * The initial value of DatePicker on first load for single &\n * range mode as array of string. eg.'[\"22/12/2023\"]' for single &\n * '[\"22/12/2023\",\"25/12/2023\"]' for range respectively.\n * @deprecated since v3.3.0 — use `value` instead.\n */\n @property({ type: Array, reflect: true }) initialValue: string[] = [];\n\n private dateFormat = \"DD/MM/YYYY\";\n\n /** ISO date string to set the lowest allowable date value. e.g. \"2016-05-19T12:00:00.000Z\" */\n @property({ type: String }) minDate = \"\";\n\n /** ISO date string to set the highest allowable date value. e.g. \"2016-05-19T12:00:00.000Z\" */\n @property({ type: String }) maxDate = \"\";\n\n /** Changes DatePicker to single date selection or range date selection */\n @property({ type: String, reflect: true }) mode: \"single\" | \"range\" = \"single\";\n\n /**Feedback text for error state when date input is invalid */\n @property({ type: String, reflect: true }) invalidFeedback: string;\n\n /** Allows invalidFeedback and invalid styles to be visible with the input */\n @property({ type: Boolean, reflect: true }) hasFeedback = false;\n\n /** The datepicker input's label */\n @property({ reflect: true }) label = \"\";\n\n /** The datepicker input's hint text below the label */\n @property({ reflect: true }) hintText = \"\";\n\n /** Controls auto-flipping of menu */\n @property({ type: Boolean, reflect: true, state: false })\n noFlip = false;\n\n /** The drop position of menu relative to the toggle button */\n @property({ type: String, reflect: true, state: false })\n drop: \"up\" | \"down\" = \"down\";\n\n /** Provides the date context for Calendar to present the appropriate view. Defaults to today's date */\n @property({ attribute: false }) displayDate: Date;\n\n /**Gets or sets the default value used to reset this element. The initial value corresponds to the one originally specified in the HTML that created this element. */\n @defaultValue()\n defaultValue = \"\";\n\n /** Marks the component as invalid. Replace the pseudo :invalid selector. */\n @property({ type: Boolean, reflect: true }) invalid = false;\n\n @state()\n private view: ViewEnum = \"days\";\n\n @state() private selectedDateRange: Date[] = [];\n\n @state() private focusedDate: Date;\n\n @state() private focusedTabIndex = 3;\n\n private isValueEmpty() {\n return this.value === \"\" || this.value === \"DD/MM/YYYY\" || this.value === \"DD/MM/YYYY - DD/MM/YYYY\";\n }\n\n private initialDisplayDate: Date = new Date();\n\n @queryAsync(\"sgds-datepicker-calendar\")\n private calendar: Promise<DatepickerCalendar>;\n\n @queryAsync(\"sgds-datepicker-input\")\n private datepickerInputAsync: Promise<DatepickerInput>;\n\n @query(\"sgds-datepicker-input\")\n private datepickerInput: DatepickerInput;\n /**\n * Checks for validity. Under the hood, HTMLFormElement's reportValidity method calls this method to check for component's validity state\n * Note that the native error popup is prevented for SGDS form components by default. Instead the validation message shows up in the feedback container of SgdsInput\n */\n public reportValidity(): boolean {\n return this._mixinReportValidity();\n }\n /**\n * Checks for validity without any native error popup message\n */\n public checkValidity(): boolean {\n return this._mixinCheckValidity();\n }\n\n /**\n * Programmatically sets the invalid state of the datepicker.\n * Use together with `noValidate` (or `novalidate` on the parent `<form>`) and `invalidFeedback`\n * to integrate 3rd-party or custom validation logic.\n */\n public setInvalid(bool: boolean) {\n this.invalid = bool;\n if (this.datepickerInput) {\n this.datepickerInput.setInvalid(bool);\n }\n }\n\n /**\n * Checks for validity without any native error popup message\n */\n public setValidity(flags?: ValidityStateFlags, message?: string, anchor?: HTMLElement): void {\n return this._mixinSetValidity(flags, message, anchor);\n }\n\n /**\n * Returns the ValidityState object\n */\n public get validity(): ValidityState {\n return this._mixinGetValidity();\n }\n /**\n * Returns the validation message based on the ValidityState\n */\n public get validationMessage() {\n return this._mixinGetValidationMessage();\n }\n\n async connectedCallback() {\n super.connectedCallback();\n this.addEventListener(\"sgds-view\", this._handleViewChanged);\n this.addEventListener(\"sgds-change-calendar\", this._handleDateChanged);\n this.addEventListener(\"sgds-update-focus\", this._handleFocusDateChanged);\n this.addEventListener(\"sgds-selectmonth\", this._handleSelectMonth);\n this.addEventListener(\"sgds-selectyear\", this._handleSelectYear);\n this.addEventListener(\"sgds-selectdates\", this._handleSelectDatesAndClose);\n this.addEventListener(\"i-sgds-selectdates-input\", this._handleSelectDatesInput);\n this.addEventListener(\"i-sgds-empty-input\", this._handleEmptyInput);\n this.addEventListener(\"keydown\", this._handleTab);\n this.addEventListener(\"sgds-hide\", this._handleCloseMenu);\n this.addEventListener(\"sgds-show\", this._handleOpenMenu);\n this.addEventListener(\"blur\", this._mixinCheckValidity);\n\n this.initialValue = this.value ? this.value.split(\" - \").map(v => v.trim()) : this.initialValue;\n this.initialDisplayDate = this.displayDate || new Date();\n if (this.initialValue && this.initialValue.length > 0) {\n // Validate initialValue against the dateFormat regex\n const dateFormatRegex = new RegExp(this._getDateFormatRegex());\n // const startDateString = this.initialValue[0];\n const invalidDates = this.initialValue.filter(v => !dateFormatRegex.test(v));\n if (invalidDates.length > 0) {\n return console.error(\"Invalid date format in initialValue:\", invalidDates);\n } else {\n const initialSelectedDates = this.initialValue.map(v =>\n setTimeToNoon(parseDate(v, DATE_PATTERNS[this.dateFormat].fnsPattern))\n );\n this._handleSelectDates(initialSelectedDates);\n }\n } else {\n this.displayDate = this.initialDisplayDate;\n }\n\n const input = await this.datepickerInputAsync;\n input.setInvalid(this.invalid);\n }\n\n async firstUpdated(changedProperties: PropertyValueMap<this>) {\n super.firstUpdated(changedProperties);\n if (this.menuIsOpen) {\n const input = await this.datepickerInputAsync;\n await this.updateFloatingPosition();\n const cal = await this.calendar;\n cal.focusOnCalendar(input);\n }\n }\n\n /** @internal */\n private _getDateFormatRegex(): string {\n // validate date strings and adhere to the specified date format\n return (\n this.dateFormat\n // Replace any special characters with their escaped version using \"\\\\$&\"\n .replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\")\n // Replace 'MM' with '\\\\d{2}', which matches two digits representing the month (e.g., 01, 12)\n .replace(\"MM\", \"\\\\d{2}\")\n // Replace 'DD' with '\\\\d{2}', which matches two digits representing the day (e.g., 01, 31)\n .replace(\"DD\", \"\\\\d{2}\")\n // Replace 'YYYY' with '\\\\d{4}', which matches four digits representing the year (e.g., 2021)\n .replace(\"YYYY\", \"\\\\d{4}\")\n // Replace '/' with '\\\\/', which matches the forward slash character\n .replace(\"/\", \"\\\\/\")\n );\n }\n private _handleTab(event: KeyboardEvent) {\n if (!this.menuIsOpen) {\n return;\n }\n const tabIndexArray = Array(4);\n if (event.shiftKey && event.key === \"Tab\") {\n event.preventDefault();\n this.focusedTabIndex = (this.focusedTabIndex - 1 + tabIndexArray.length) % tabIndexArray.length;\n } else if (event.key === \"Tab\") {\n event.preventDefault();\n this.focusedTabIndex = (this.focusedTabIndex + 1 + tabIndexArray.length) % tabIndexArray.length;\n }\n }\n\n @watch(\"value\", { waitUntilFirstUpdate: true })\n async _handleValueChange() {\n this._mixinSetFormValue();\n this.emit(\"sgds-change-date\");\n await this.updateComplete;\n if (this._mixinShouldSkipSgdsValidation()) return;\n this._mixinValidate(this.input);\n }\n\n private async _handleCloseMenu() {\n if (this.selectedDateRange.length === 0) {\n this.displayDate = this.initialDisplayDate;\n } else {\n const selectedDatesLength = this.selectedDateRange.length;\n this.displayDate = this.selectedDateRange[selectedDatesLength - 1];\n const calendar = await this.calendar;\n calendar._updateFocusedDate();\n }\n\n // Focus input after displayDate reset and calendar re-render to prevent\n // the calendar's updated() from stealing focus during the hide animation\n await this.updateComplete;\n const input = await this.datepickerInputAsync;\n input.focus();\n }\n private async _handleOpenMenu() {\n const cal = await this.calendar;\n const input = await this.datepickerInputAsync;\n cal.focusOnCalendar(input);\n }\n\n private _makeInputValueString = (startDate: Date, endDate: Date, dateFormat: string) => {\n if (!startDate && !endDate) return this.value;\n const fmtDate = (date: Date) => formatDate(date, DATE_PATTERNS[dateFormat].fnsPattern);\n switch (this.mode) {\n case \"single\": {\n if (startDate) {\n this.value = fmtDate(startDate);\n }\n break;\n }\n case \"range\": {\n if (startDate && endDate) {\n this.value = `${fmtDate(startDate)} - ${fmtDate(endDate)}`;\n }\n if (startDate && !endDate) {\n this.value = `${fmtDate(startDate)} - ${this.dateFormat}`;\n }\n break;\n }\n }\n return this.value;\n };\n private _handleSelectDatesInput(event: CustomEvent<Date[]>) {\n this._handleSelectDates(event.detail);\n }\n private async _handleSelectDates(newSelectedDates: Date[]) {\n newSelectedDates.sort((a: Date, b: Date) => a.getTime() - b.getTime());\n this.displayDate = newSelectedDates[0];\n this.focusedDate = newSelectedDates[0];\n this.selectedDateRange = newSelectedDates;\n // Get the formattedDate value for the selected dates\n const formattedDate = this._makeInputValueString(\n this.selectedDateRange[0],\n this.selectedDateRange[1],\n this.dateFormat\n );\n\n // Set formattedDate value as the new value for sgds-input\n this.value = formattedDate;\n const input = await this.datepickerInputAsync;\n input.updateMaskValue();\n this._manageInternalsValid();\n }\n\n private async _handleSelectDatesAndClose(event: CustomEvent<Date[]>) {\n await this._handleSelectDates(event.detail);\n\n if (this.mode === \"range\" && this.selectedDateRange.length === 2) {\n this.hideMenu();\n } else if (this.mode === \"single\" && this.selectedDateRange.length === 1) {\n this.hideMenu();\n }\n }\n\n /** update latest view state from datepicker-header */\n private _handleViewChanged(event: CustomEvent<string>) {\n this.view = event.detail as ViewEnum;\n }\n\n private _handleDateChanged(event: CustomEvent<Date>) {\n this.displayDate = event.detail;\n }\n private _handleFocusDateChanged(event: CustomEvent<Date>) {\n this.focusedDate = event.detail;\n }\n\n private _handleSelectMonth(event: CustomEvent<Date>) {\n this.displayDate = event.detail;\n }\n\n private _handleSelectYear(event: CustomEvent<Date>) {\n this.displayDate = event.detail;\n }\n private async _handleInvalidInput() {\n this.selectedDateRange = [];\n this.displayDate = this.initialDisplayDate;\n if (this._mixinShouldSkipSgdsValidation()) return;\n\n this.invalid = true;\n this._manageInternalsBadInput();\n }\n private async _handleEmptyInput() {\n if (this.required) {\n this._manageEmptyInput();\n }\n return;\n }\n private async _resetDatepicker(resetValue = \"\") {\n this.displayDate = this.initialDisplayDate;\n this.selectedDateRange = [];\n this.value = resetValue;\n this.view = \"days\";\n const input = await this.datepickerInputAsync;\n input.setInvalid(this.invalid);\n input.destroyInputMask();\n await input.applyInputMask();\n\n this._mixinResetValidity(input);\n if (this.isValueEmpty()) {\n this._handleEmptyInput();\n }\n }\n\n private _manageInternalsBadInput() {\n this._mixinSetValidity(\n {\n badInput: true\n },\n \"Invalid date input\",\n this.datepickerInput\n );\n }\n /**\n * Even though element internals handles the required constraint validation. This custom one is still needed as\n * datepicker input has a special case where the default input mask \"DD/MM/YYYY\" means an empty input.\n * However, the required constraint validation sees \"DD/MM/YYYY\" as a non-empty input.\n */\n private _manageEmptyInput() {\n this._mixinSetValidity(\n {\n valueMissing: true\n },\n \"Please fill in this field\",\n this.datepickerInput\n );\n }\n\n /**\n * Called when a valid date is entered via input or selected by calendar\n * 1. sets validity state to valid\n * 2. updates invalid prop\n * 3. sets the form value of datepicker\n */\n private _manageInternalsValid() {\n this._mixinSetFormValue();\n if (this._mixinShouldSkipSgdsValidation()) return;\n\n this._mixinSetValidity({});\n\n this.invalid = this.datepickerInput.invalid = false;\n }\n\n /**\n * Handles the form \"reset\" event\n */\n private async _mixinResetFormControl() {\n this._resetDatepicker(this.defaultValue);\n }\n private async _handleInputMaskChange(e: CustomEvent) {\n this.value = e.detail;\n\n if (this.isValueEmpty()) {\n this._resetDatepicker();\n }\n }\n\n private _dialogAriaLabels = {\n days: \"Choose date\",\n months: \"Choose month\",\n years: \"Choose year\"\n };\n render() {\n return html`\n <div class=\"datepicker-container m-width-160\">\n <sgds-datepicker-input\n .value=${live(this.value)}\n ?required=${this.required}\n ?disabled=${this.disabled}\n placeholder=${this.mode === \"single\" ? \"DD/MM/YYYY\" : \"DD/MM/YYYY - DD/MM/YYYY\"}\n mode=${this.mode}\n invalidFeedback=${ifDefined(this.invalidFeedback ? this.invalidFeedback : this._mixinGetValidationMessage())}\n @i-sgds-mask-input-change=${this._handleInputMaskChange}\n @i-sgds-invalid-input=${this._handleInvalidInput}\n minDate=${this.minDate}\n maxDate=${this.maxDate}\n label=${this.label}\n hintText=${this.hintText}\n name=${this.name}\n ?invalid=${this.invalid}\n hasFeedback=${ifDefined(this.hasFeedback ? \"both\" : undefined)}\n ?readonly=${this.readonly}\n >\n <sgds-icon-button\n slot=\"calendar-btn\"\n ${ref(this.myDropdown)}\n tone=\"neutral\"\n class=${classMap({\n \"calendar-btn\": true,\n \"with-hint-text\": this.hintText || this.invalid,\n \"with-label\": this.label\n })}\n aria-expanded=\"${this.menuIsOpen}\"\n aria-haspopup=\"dialog\"\n aria-controls=${this.dropdownMenuId}\n @click=${() => this.toggleMenu()}\n ariaLabel=${this.menuIsOpen ? \"Close Calendar\" : \"Open Calendar\"}\n ?disabled=${this.disabled || this.readonly}\n ?active=${this.menuIsOpen}\n variant=\"outline\"\n name=\"calendar\"\n >\n </sgds-icon-button>\n </sgds-datepicker-input>\n <div\n id=${this.dropdownMenuId}\n class=\"sgds datepicker dropdown-menu\"\n role=\"dialog\"\n aria-label=${this._dialogAriaLabels[this.view]}\n @click=${(event: MouseEvent) => event.stopPropagation()}\n ${ref(this.menuRef)}\n >\n <sgds-datepicker-header\n .view=${this.view}\n .displayDate=${this.displayDate}\n .focusedDate=${this.focusedDate}\n .selectedDate=${this.selectedDateRange}\n .focusedTabIndex=${this.focusedTabIndex}\n ></sgds-datepicker-header>\n <sgds-datepicker-calendar\n .show=${this.menuIsOpen}\n .view=${this.view}\n .displayDate=${this.displayDate}\n .mode=${this.mode}\n minDate=${this.minDate}\n maxDate=${this.maxDate}\n .selectedDate=${this.selectedDateRange}\n .focusedTabIndex=${this.focusedTabIndex}\n ></sgds-datepicker-calendar>\n </div>\n </div>\n `;\n }\n}\n\nexport default SgdsDatepicker;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,IAAa,iBAAb,cAAoC,uBAAuB,eAAe,CAAC,CAA4B;;EACrF,KAAA,SAAA;GAAC,GAAG,gBAAgB;GAAQA;GAAmBC;EAAe;;;EAExD,KAAA,eAAA;GACpB,yBAAyB;GACzB,4BAA4B;GAC5B,0BAA0B;GAC1B,eAAe;GACf,oBAAoB;EACtB;;CAEA,cAAc;EACZ,MAAM;EAO+C,KAAA,WAAA;EAIA,KAAA,WAAA;EAGE,KAAA,aAAA;EAMN,KAAA,QAAA;EAQgB,KAAA,eAAA,CAAC;EAE/C,KAAA,aAAA;EAGiB,KAAA,UAAA;EAGA,KAAA,UAAA;EAGgC,KAAA,OAAA;EAMZ,KAAA,cAAA;EAGrB,KAAA,QAAA;EAGG,KAAA,WAAA;EAI/B,KAAA,SAAA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A,GAAA,eAAA,WAAA,eAAA,KAAA,CAAA;AAEN,WAAA,CAAA,MAAM,CAAA,GAAA,eAAA,WAAA,mBAAA,KAAA,CAAA;AAQN,WAAA,CAAA,WAAW,0BAA0B,CAAA,GAAA,eAAA,WAAA,YAAA,KAAA,CAAA;AAGrC,WAAA,CAAA,WAAW,uBAAuB,CAAA,GAAA,eAAA,WAAA,wBAAA,KAAA,CAAA;AAGlC,WAAA,CAAA,MAAM,uBAAuB,CAAA,GAAA,eAAA,WAAA,mBAAA,KAAA,CAAA;AA+H7B,WAAA,CAAA,MAAM,SAAS,EAAE,sBAAsB,KAAK,CAAC,CAAA,GAAA,eAAA,WAAA,sBAAA,IAAA"}
@@ -131,6 +131,12 @@ var SgdsInput = class extends require_validatorMixin.SgdsFormValidatorMixin(requ
131
131
  _handleDisabledChange() {
132
132
  this.setInvalid(false);
133
133
  }
134
+ async _handleValueChange() {
135
+ this._mixinSetFormValue();
136
+ await this.updateComplete;
137
+ if (this._mixinShouldSkipSgdsValidation()) return;
138
+ this._mixinValidate(this.input);
139
+ }
134
140
  _renderInput() {
135
141
  const wantFeedbackStyle = this.hasFeedback === "both" || this.hasFeedback === "style";
136
142
  const wantFeedbackText = this.hasFeedback === "both" || this.hasFeedback === "text";
@@ -297,6 +303,7 @@ require_decorate.default([(0, lit_decorators_js.state)()], SgdsInput.prototype,
297
303
  require_decorate.default([(0, lit_decorators_js.state)()], SgdsInput.prototype, "_showPassword", void 0);
298
304
  require_decorate.default([require_watch.watch("_isTouched", { waitUntilFirstUpdate: true })], SgdsInput.prototype, "_handleIsTouched", null);
299
305
  require_decorate.default([require_watch.watch("disabled", { waitUntilFirstUpdate: true })], SgdsInput.prototype, "_handleDisabledChange", null);
306
+ require_decorate.default([require_watch.watch("value", { waitUntilFirstUpdate: true })], SgdsInput.prototype, "_handleValueChange", null);
300
307
  //#endregion
301
308
  exports.SgdsInput = SgdsInput;
302
309
  exports.default = SgdsInput;
@@ -1 +1 @@
1
- {"version":3,"file":"sgds-input.cjs.js","names":["SgdsFormValidatorMixin","FormControlElement","formTextControlStyles","formPlaceholderStyles","inputStyle","SgdsSpinner","SgdsIcon","classMap","nothing","ifDefined","live","property","defaultValue","state","watch"],"sources":["../../../../src/components/Input/sgds-input.ts"],"sourcesContent":["import { nothing } from \"lit\";\nimport { property, state } from \"lit/decorators.js\";\nimport { classMap } from \"lit/directives/class-map.js\";\nimport { ifDefined } from \"lit/directives/if-defined.js\";\nimport { live } from \"lit/directives/live.js\";\nimport { html } from \"lit/static-html.js\";\nimport FormControlElement from \"../../base/form-control-element\";\nimport formPlaceholderStyles from \"../../styles/form-placeholder.css\";\nimport formTextControlStyles from \"../../styles/form-text-control.css\";\nimport { defaultValue } from \"../../utils/defaultvalue\";\nimport type { SgdsFormControl } from \"../../utils/formSubmitController\";\nimport { SgdsFormValidatorMixin } from \"../../utils/validatorMixin\";\nimport { watch } from \"../../utils/watch\";\nimport { SgdsSpinner } from \"../Spinner/sgds-spinner\";\nimport inputStyle from \"./input.css\";\nimport SgdsIcon from \"../Icon/sgds-icon\";\n/**\n * @summary Text inputs allow your users to enter letters, numbers and symbols on a single line.\n *\n * @slot icon - The slot for leading icon of text input\n * @slot trailing-icon - The slot for trailing icon of text input. When present, it overrides valid icon and loading spinner rendered when valid prop or loading prop are true\n * @slot action - The slot for call to action of the text input. It is recommended to use sgds-icon-button within this slot\n * @event sgds-change - Emitted when an alteration to the control's value is committed by the user.\n * @event sgds-input - Emitted when the control receives input and its value changes.\n * @event sgds-focus - Emitted when input is in focus.\n * @event sgds-blur - Emitted when input is not in focus.\n * @event sgds-invalid - Emitted when input is invalid\n * @event sgds-valid - Emitted when input is valid\n *\n */\nexport class SgdsInput extends SgdsFormValidatorMixin(FormControlElement) implements SgdsFormControl {\n static styles = [...FormControlElement.styles, formTextControlStyles, formPlaceholderStyles, inputStyle];\n /** @internal */\n static dependencies = {\n \"sgds-spinner\": SgdsSpinner,\n \"sgds-icon\": SgdsIcon\n };\n\n @property({ reflect: true }) type:\n | \"email\"\n | \"number\"\n | \"password\"\n | \"search\"\n | \"tel\"\n | \"text\"\n | \"time\"\n | \"url\"\n | \"datetime-local\" = \"text\";\n\n /** The prefix of the input */\n @property({ type: String }) prefix: string;\n\n /** The suffix of the input */\n @property({ type: String }) suffix: string;\n\n /** Sets the minimum length of the input */\n @property({ type: Number, reflect: true }) minlength: number;\n\n /** Sets the maximum length of the input */\n @property({ type: Number, reflect: true }) maxlength: number;\n\n /** The input's minimum value. Only applies number input types. */\n @property() min: number;\n\n /** The input's maximum value. Only applies number input types. */\n @property() max: number;\n\n /** The input's placeholder text. */\n @property({ type: String, reflect: true }) placeholder = \"placeholder\";\n\n /** A pattern to validate input against. */\n @property({ type: String }) pattern: string;\n\n /** Autofocus the input */\n @property({ type: Boolean, reflect: true }) autofocus = false;\n\n /** Makes the input readonly. */\n @property({ type: Boolean, reflect: true }) readonly = false;\n\n /** Controlling of autocomplete behaviour */\n @property({ type: String, reflect: true }) autocomplete = \"on\";\n\n /**\n * Specifies the granularity that the value must adhere to, or the special value `any` which means no stepping is\n * implied, allowing any numeric value. Only applies to number input types.\n */\n @property() step: number | \"any\";\n\n /** Allows invalidFeedback, invalid and valid styles to be visible with the input */\n @property({ type: String, reflect: true }) hasFeedback: \"style\" | \"text\" | \"both\";\n\n /**Feedback text for error state when validated */\n @property({ type: String, reflect: true }) invalidFeedback: string;\n\n /**Gets or sets the default value used to reset this element. The initial value corresponds to the one originally specified in the HTML that created this element. */\n @defaultValue()\n defaultValue = \"\";\n\n /** Marks the component as valid. */\n @property({ type: Boolean, reflect: true }) valid = false;\n\n /** Marks the component as loading. */\n @property({ type: Boolean, reflect: true }) loading = false;\n\n /** Makes the input a required field. */\n @property({ type: Boolean, reflect: true }) required = false;\n\n /** Disables native and sgds validation for the input. */\n @property({ type: Boolean, reflect: true }) noValidate = false;\n\n /**The input's value attribute. */\n @property({ reflect: true }) value = \"\";\n\n @state() protected _isTouched = false;\n\n @state() private _showPassword = false;\n\n /** Sets focus on the input. */\n public focus(options?: FocusOptions) {\n this.input.focus(options);\n }\n /** Sets blur on the input. */\n public blur() {\n this.input.blur();\n }\n\n /**\n * Checks for validity. Under the hood, HTMLFormElement's reportValidity method calls this method to check for component's validity state\n * Note that the native error popup is prevented for SGDS form components by default. Instead the validation message shows up in the feedback container of SgdsInput\n */\n public reportValidity(): boolean {\n return this._mixinReportValidity();\n }\n /**\n * Checks for validity without any native error popup message\n */\n public checkValidity(): boolean {\n return this._mixinCheckValidity();\n }\n /**\n * Checks for validity without any native error popup message\n */\n public setValidity(flags?: ValidityStateFlags, message?: string, anchor?: HTMLElement): void {\n return this._mixinSetValidity(flags, message, anchor);\n }\n\n /**\n * Returns the ValidityState object\n */\n public get validity(): ValidityState {\n return this._mixinGetValidity();\n }\n /**\n * Returns the validation message based on the ValidityState\n */\n public get validationMessage() {\n return this._mixinGetValidationMessage();\n }\n\n protected _handleFocus() {\n this.emit(\"sgds-focus\");\n }\n\n protected _handleBlur() {\n const sgdsBlur = this.emit(\"sgds-blur\", { cancelable: true });\n if (this._mixinShouldSkipSgdsValidation()) return;\n if (sgdsBlur.defaultPrevented) return;\n\n this.setInvalid(!this._mixinCheckValidity());\n this._isTouched = true;\n }\n private _handleClick() {\n this.focus();\n }\n\n protected _handleChange(e: Event) {\n this.value = this.input.value;\n const sgdsChange = this.emit(\"sgds-change\", { cancelable: true });\n\n if (sgdsChange.defaultPrevented) return;\n\n super._mixinHandleChange(e);\n }\n protected _handleInputChange(e: Event) {\n this.value = this.input.value;\n const sgdsInput = this.emit(\"sgds-input\", { cancelable: true });\n\n if (sgdsInput.defaultPrevented) return;\n\n super._mixinHandleInputChange(e);\n }\n /** @internal */\n @watch(\"_isTouched\", { waitUntilFirstUpdate: true })\n _handleIsTouched() {\n if (this._mixinShouldSkipSgdsValidation()) return;\n if (this._isTouched) {\n this.setInvalid(!this._mixinCheckValidity());\n }\n }\n @watch(\"disabled\", { waitUntilFirstUpdate: true })\n _handleDisabledChange() {\n // Disabled form controls are always valid, so we need to recheck validity when the state changes\n this.setInvalid(false);\n }\n\n protected _renderInput() {\n const wantFeedbackStyle = this.hasFeedback === \"both\" || this.hasFeedback === \"style\";\n const wantFeedbackText = this.hasFeedback === \"both\" || this.hasFeedback === \"text\";\n const ariaDescribedBy =\n [\n this.hintText ? `${this._controlId}Help` : \"\",\n this.invalid && wantFeedbackText ? `${this._controlId}-invalid` : \"\"\n ]\n .filter(Boolean)\n .join(\" \") || undefined;\n return html`\n <div\n class=\"form-control-group ${classMap({\n disabled: this.disabled,\n readonly: this.readonly,\n \"is-invalid\": this.invalid && wantFeedbackStyle\n })}\"\n @click=${this._handleClick}\n >\n <slot name=\"icon\"></slot>\n ${this.prefix ? html`<span class=\"form-control-prefix\">${this.prefix}</span>` : nothing}\n <input\n class=\"form-control\"\n type=${this._inputType()}\n id=${this._controlId}\n name=${ifDefined(this.name)}\n placeholder=${ifDefined(this.placeholder)}\n aria-invalid=${this.invalid ? \"true\" : \"false\"}\n pattern=${ifDefined(this.pattern)}\n ?autofocus=${this.autofocus}\n ?disabled=${this.disabled}\n ?readonly=${this.readonly}\n ?required=${this.required}\n .value=${live(this.value)}\n minlength=${ifDefined(this.minlength)}\n maxlength=${ifDefined(this.maxlength)}\n min=${ifDefined(this.min)}\n max=${ifDefined(this.max)}\n step=${ifDefined(this.step as number)}\n @input=${(e: Event) => this._handleInputChange(e)}\n @change=${(e: Event) => this._handleChange(e)}\n @invalid=${() => this.setInvalid(true)}\n @focus=${this._handleFocus}\n @blur=${this._handleBlur}\n aria-describedby=${ifDefined(ariaDescribedBy)}\n .autocomplete=${this.autocomplete}\n />\n ${this.type === \"password\" ? this._renderPasswordToggle() : nothing}\n ${this.suffix ? html`<span class=\"form-control-suffix\">${this.suffix}</span>` : nothing}\n <slot name=\"trailing-icon\">\n ${this.loading ? html`<sgds-spinner size=\"sm\"></sgds-spinner>` : nothing}\n ${this.valid ? html`<sgds-icon name=\"check-circle-fill\" class=\"valid-icon\"></sgds-icon>` : nothing}\n </slot>\n </div>\n `;\n }\n protected _renderPasswordToggle() {\n return html`<sgds-icon\n tabIndex=\"0\"\n role=\"button\"\n aria-label=${this._showPassword ? \"Hide password\" : \"Show password\"}\n name=${this._showPassword ? \"eye-slash-fill\" : \"eye-fill\"}\n @click=${() => (this._showPassword = !this._showPassword)}\n ></sgds-icon>`;\n }\n protected _inputType() {\n if (this.type === \"password\" && this._showPassword) {\n return \"text\";\n }\n return this.type;\n }\n protected _renderFeedback() {\n const wantFeedbackText = this.hasFeedback === \"both\" || this.hasFeedback === \"text\";\n\n return this.invalid && wantFeedbackText\n ? html` <div class=\"invalid-feedback-container\">\n <sgds-icon name=\"exclamation-circle-fill\" size=\"md\"></sgds-icon>\n <div id=\"${this._controlId}-invalid\" class=\"invalid-feedback\">\n ${this.invalidFeedback ? this.invalidFeedback : this.input.validationMessage}\n </div>\n </div>`\n : html`${this._renderHintText()}`;\n }\n protected _renderLabel() {\n const labelTemplate = html`\n <label\n for=${this._controlId}\n id=${this._labelId}\n class=${classMap({\n \"form-label\": true,\n required: this.required\n })}\n >${this.label}</label\n >\n `;\n return this.label && labelTemplate;\n }\n protected _renderHintText() {\n const hintTextTemplate = html` <div id=\"${this._controlId}Help\" class=\"form-text\">${this.hintText}</div> `;\n return this.hintText && hintTextTemplate;\n }\n render() {\n return html`\n <div\n class=\"form-control-container ${classMap({\n disabled: this.disabled\n })}\"\n >\n ${this._renderLabel()}\n <div class=\"form-control-row\">\n ${this._renderInput()}\n <slot name=\"action\"></slot>\n </div>\n ${this._renderFeedback()}\n </div>\n `;\n }\n}\n\nexport default SgdsInput;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,IAAa,YAAb,cAA+BA,uBAAAA,uBAAuBC,6BAAAA,OAAkB,CAAC,CAA4B;;;EAiB5E,KAAA,OAAA;EAqBkC,KAAA,cAAA;EAMD,KAAA,YAAA;EAGD,KAAA,WAAA;EAGG,KAAA,eAAA;EAgB3C,KAA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holderStyles","inputStyle","SgdsSpinner","SgdsIcon","classMap","nothing","ifDefined","live","property","defaultValue","state","watch"],"sources":["../../../../src/components/Input/sgds-input.ts"],"sourcesContent":["import { nothing } from \"lit\";\nimport { property, state } from \"lit/decorators.js\";\nimport { classMap } from \"lit/directives/class-map.js\";\nimport { ifDefined } from \"lit/directives/if-defined.js\";\nimport { live } from \"lit/directives/live.js\";\nimport { html } from \"lit/static-html.js\";\nimport FormControlElement from \"../../base/form-control-element\";\nimport formPlaceholderStyles from \"../../styles/form-placeholder.css\";\nimport formTextControlStyles from \"../../styles/form-text-control.css\";\nimport { defaultValue } from \"../../utils/defaultvalue\";\nimport type { SgdsFormControl } from \"../../utils/formSubmitController\";\nimport { SgdsFormValidatorMixin } from \"../../utils/validatorMixin\";\nimport { watch } from \"../../utils/watch\";\nimport { SgdsSpinner } from \"../Spinner/sgds-spinner\";\nimport inputStyle from \"./input.css\";\nimport SgdsIcon from \"../Icon/sgds-icon\";\n/**\n * @summary Text inputs allow your users to enter letters, numbers and symbols on a single line.\n *\n * @slot icon - The slot for leading icon of text input\n * @slot trailing-icon - The slot for trailing icon of text input. When present, it overrides valid icon and loading spinner rendered when valid prop or loading prop are true\n * @slot action - The slot for call to action of the text input. It is recommended to use sgds-icon-button within this slot\n * @event sgds-change - Emitted when an alteration to the control's value is committed by the user.\n * @event sgds-input - Emitted when the control receives input and its value changes.\n * @event sgds-focus - Emitted when input is in focus.\n * @event sgds-blur - Emitted when input is not in focus.\n * @event sgds-invalid - Emitted when input is invalid\n * @event sgds-valid - Emitted when input is valid\n *\n */\nexport class SgdsInput extends SgdsFormValidatorMixin(FormControlElement) implements SgdsFormControl {\n static styles = [...FormControlElement.styles, formTextControlStyles, formPlaceholderStyles, inputStyle];\n /** @internal */\n static dependencies = {\n \"sgds-spinner\": SgdsSpinner,\n \"sgds-icon\": SgdsIcon\n };\n\n @property({ reflect: true }) type:\n | \"email\"\n | \"number\"\n | \"password\"\n | \"search\"\n | \"tel\"\n | \"text\"\n | \"time\"\n | \"url\"\n | \"datetime-local\" = \"text\";\n\n /** The prefix of the input */\n @property({ type: String }) prefix: string;\n\n /** The suffix of the input */\n @property({ type: String }) suffix: string;\n\n /** Sets the minimum length of the input */\n @property({ type: Number, reflect: true }) minlength: number;\n\n /** Sets the maximum length of the input */\n @property({ type: Number, reflect: true }) maxlength: number;\n\n /** The input's minimum value. Only applies number input types. */\n @property() min: number;\n\n /** The input's maximum value. Only applies number input types. */\n @property() max: number;\n\n /** The input's placeholder text. */\n @property({ type: String, reflect: true }) placeholder = \"placeholder\";\n\n /** A pattern to validate input against. */\n @property({ type: String }) pattern: string;\n\n /** Autofocus the input */\n @property({ type: Boolean, reflect: true }) autofocus = false;\n\n /** Makes the input readonly. */\n @property({ type: Boolean, reflect: true }) readonly = false;\n\n /** Controlling of autocomplete behaviour */\n @property({ type: String, reflect: true }) autocomplete = \"on\";\n\n /**\n * Specifies the granularity that the value must adhere to, or the special value `any` which means no stepping is\n * implied, allowing any numeric value. Only applies to number input types.\n */\n @property() step: number | \"any\";\n\n /** Allows invalidFeedback, invalid and valid styles to be visible with the input */\n @property({ type: String, reflect: true }) hasFeedback: \"style\" | \"text\" | \"both\";\n\n /**Feedback text for error state when validated */\n @property({ type: String, reflect: true }) invalidFeedback: string;\n\n /**Gets or sets the default value used to reset this element. The initial value corresponds to the one originally specified in the HTML that created this element. */\n @defaultValue()\n defaultValue = \"\";\n\n /** Marks the component as valid. */\n @property({ type: Boolean, reflect: true }) valid = false;\n\n /** Marks the component as loading. */\n @property({ type: Boolean, reflect: true }) loading = false;\n\n /** Makes the input a required field. */\n @property({ type: Boolean, reflect: true }) required = false;\n\n /** Disables native and sgds validation for the input. */\n @property({ type: Boolean, reflect: true }) noValidate = false;\n\n /**The input's value attribute. */\n @property({ reflect: true }) value = \"\";\n\n @state() protected _isTouched = false;\n\n @state() private _showPassword = false;\n\n /** Sets focus on the input. */\n public focus(options?: FocusOptions) {\n this.input.focus(options);\n }\n /** Sets blur on the input. */\n public blur() {\n this.input.blur();\n }\n\n /**\n * Checks for validity. Under the hood, HTMLFormElement's reportValidity method calls this method to check for component's validity state\n * Note that the native error popup is prevented for SGDS form components by default. Instead the validation message shows up in the feedback container of SgdsInput\n */\n public reportValidity(): boolean {\n return this._mixinReportValidity();\n }\n /**\n * Checks for validity without any native error popup message\n */\n public checkValidity(): boolean {\n return this._mixinCheckValidity();\n }\n /**\n * Checks for validity without any native error popup message\n */\n public setValidity(flags?: ValidityStateFlags, message?: string, anchor?: HTMLElement): void {\n return this._mixinSetValidity(flags, message, anchor);\n }\n\n /**\n * Returns the ValidityState object\n */\n public get validity(): ValidityState {\n return this._mixinGetValidity();\n }\n /**\n * Returns the validation message based on the ValidityState\n */\n public get validationMessage() {\n return this._mixinGetValidationMessage();\n }\n\n protected _handleFocus() {\n this.emit(\"sgds-focus\");\n }\n\n protected _handleBlur() {\n const sgdsBlur = this.emit(\"sgds-blur\", { cancelable: true });\n if (this._mixinShouldSkipSgdsValidation()) return;\n if (sgdsBlur.defaultPrevented) return;\n\n this.setInvalid(!this._mixinCheckValidity());\n this._isTouched = true;\n }\n private _handleClick() {\n this.focus();\n }\n\n protected _handleChange(e: Event) {\n this.value = this.input.value;\n const sgdsChange = this.emit(\"sgds-change\", { cancelable: true });\n\n if (sgdsChange.defaultPrevented) return;\n\n super._mixinHandleChange(e);\n }\n protected _handleInputChange(e: Event) {\n this.value = this.input.value;\n const sgdsInput = this.emit(\"sgds-input\", { cancelable: true });\n\n if (sgdsInput.defaultPrevented) return;\n\n super._mixinHandleInputChange(e);\n }\n /** @internal */\n @watch(\"_isTouched\", { waitUntilFirstUpdate: true })\n _handleIsTouched() {\n if (this._mixinShouldSkipSgdsValidation()) return;\n if (this._isTouched) {\n this.setInvalid(!this._mixinCheckValidity());\n }\n }\n @watch(\"disabled\", { waitUntilFirstUpdate: true })\n _handleDisabledChange() {\n // Disabled form controls are always valid, so we need to recheck validity when the state changes\n this.setInvalid(false);\n }\n\n @watch(\"value\", { waitUntilFirstUpdate: true })\n async _handleValueChange() {\n this._mixinSetFormValue();\n await this.updateComplete;\n if (this._mixinShouldSkipSgdsValidation()) return;\n this._mixinValidate(this.input);\n }\n\n protected _renderInput() {\n const wantFeedbackStyle = this.hasFeedback === \"both\" || this.hasFeedback === \"style\";\n const wantFeedbackText = this.hasFeedback === \"both\" || this.hasFeedback === \"text\";\n const ariaDescribedBy =\n [\n this.hintText ? `${this._controlId}Help` : \"\",\n this.invalid && wantFeedbackText ? `${this._controlId}-invalid` : \"\"\n ]\n .filter(Boolean)\n .join(\" \") || undefined;\n return html`\n <div\n class=\"form-control-group ${classMap({\n disabled: this.disabled,\n readonly: this.readonly,\n \"is-invalid\": this.invalid && wantFeedbackStyle\n })}\"\n @click=${this._handleClick}\n >\n <slot name=\"icon\"></slot>\n ${this.prefix ? html`<span class=\"form-control-prefix\">${this.prefix}</span>` : nothing}\n <input\n class=\"form-control\"\n type=${this._inputType()}\n id=${this._controlId}\n name=${ifDefined(this.name)}\n placeholder=${ifDefined(this.placeholder)}\n aria-invalid=${this.invalid ? \"true\" : \"false\"}\n pattern=${ifDefined(this.pattern)}\n ?autofocus=${this.autofocus}\n ?disabled=${this.disabled}\n ?readonly=${this.readonly}\n ?required=${this.required}\n .value=${live(this.value)}\n minlength=${ifDefined(this.minlength)}\n maxlength=${ifDefined(this.maxlength)}\n min=${ifDefined(this.min)}\n max=${ifDefined(this.max)}\n step=${ifDefined(this.step as number)}\n @input=${(e: Event) => this._handleInputChange(e)}\n @change=${(e: Event) => this._handleChange(e)}\n @invalid=${() => this.setInvalid(true)}\n @focus=${this._handleFocus}\n @blur=${this._handleBlur}\n aria-describedby=${ifDefined(ariaDescribedBy)}\n .autocomplete=${this.autocomplete}\n />\n ${this.type === \"password\" ? this._renderPasswordToggle() : nothing}\n ${this.suffix ? html`<span class=\"form-control-suffix\">${this.suffix}</span>` : nothing}\n <slot name=\"trailing-icon\">\n ${this.loading ? html`<sgds-spinner size=\"sm\"></sgds-spinner>` : nothing}\n ${this.valid ? html`<sgds-icon name=\"check-circle-fill\" class=\"valid-icon\"></sgds-icon>` : nothing}\n </slot>\n </div>\n `;\n }\n protected _renderPasswordToggle() {\n return html`<sgds-icon\n tabIndex=\"0\"\n role=\"button\"\n aria-label=${this._showPassword ? \"Hide password\" : \"Show password\"}\n name=${this._showPassword ? \"eye-slash-fill\" : \"eye-fill\"}\n @click=${() => (this._showPassword = !this._showPassword)}\n ></sgds-icon>`;\n }\n protected _inputType() {\n if (this.type === \"password\" && this._showPassword) {\n return \"text\";\n }\n return this.type;\n }\n protected _renderFeedback() {\n const wantFeedbackText = this.hasFeedback === \"both\" || this.hasFeedback === \"text\";\n\n return this.invalid && wantFeedbackText\n ? html` <div class=\"invalid-feedback-container\">\n <sgds-icon name=\"exclamation-circle-fill\" size=\"md\"></sgds-icon>\n <div id=\"${this._controlId}-invalid\" class=\"invalid-feedback\">\n ${this.invalidFeedback ? this.invalidFeedback : this.input.validationMessage}\n </div>\n </div>`\n : html`${this._renderHintText()}`;\n }\n protected _renderLabel() {\n const labelTemplate = html`\n <label\n for=${this._controlId}\n id=${this._labelId}\n class=${classMap({\n \"form-label\": true,\n required: this.required\n })}\n >${this.label}</label\n >\n `;\n return this.label && labelTemplate;\n }\n protected _renderHintText() {\n const hintTextTemplate = html` <div id=\"${this._controlId}Help\" class=\"form-text\">${this.hintText}</div> `;\n return this.hintText && hintTextTemplate;\n }\n render() {\n return html`\n <div\n class=\"form-control-container ${classMap({\n disabled: this.disabled\n })}\"\n >\n ${this._renderLabel()}\n <div class=\"form-control-row\">\n ${this._renderInput()}\n <slot name=\"action\"></slot>\n </div>\n ${this._renderFeedback()}\n </div>\n `;\n }\n}\n\nexport default SgdsInput;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,IAAa,YAAb,cAA+BA,uBAAAA,uBAAuBC,6BAAAA,OAAkB,CAAC,CAA4B;;;EAiB5E,KAAA,OAAA;EAqBkC,KAAA,cAA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AAOlDA,iBAAAA,QAAAA,CAAAA,cAAAA,MAAM,YAAY,EAAE,sBAAsB,KAAK,CAAC,CAAA,GAAA,UAAA,WAAA,yBAAA,IAAA;AAMhDA,iBAAAA,QAAAA,CAAAA,cAAAA,MAAM,SAAS,EAAE,sBAAsB,KAAK,CAAC,CAAA,GAAA,UAAA,WAAA,sBAAA,IAAA"}
@@ -131,6 +131,12 @@ var SgdsInput = class extends SgdsFormValidatorMixin(FormControlElement) {
131
131
  _handleDisabledChange() {
132
132
  this.setInvalid(false);
133
133
  }
134
+ async _handleValueChange() {
135
+ this._mixinSetFormValue();
136
+ await this.updateComplete;
137
+ if (this._mixinShouldSkipSgdsValidation()) return;
138
+ this._mixinValidate(this.input);
139
+ }
134
140
  _renderInput() {
135
141
  const wantFeedbackStyle = this.hasFeedback === "both" || this.hasFeedback === "style";
136
142
  const wantFeedbackText = this.hasFeedback === "both" || this.hasFeedback === "text";
@@ -297,6 +303,7 @@ __decorate([state()], SgdsInput.prototype, "_isTouched", void 0);
297
303
  __decorate([state()], SgdsInput.prototype, "_showPassword", void 0);
298
304
  __decorate([watch("_isTouched", { waitUntilFirstUpdate: true })], SgdsInput.prototype, "_handleIsTouched", null);
299
305
  __decorate([watch("disabled", { waitUntilFirstUpdate: true })], SgdsInput.prototype, "_handleDisabledChange", null);
306
+ __decorate([watch("value", { waitUntilFirstUpdate: true })], SgdsInput.prototype, "_handleValueChange", null);
300
307
  //#endregion
301
308
  export { SgdsInput, SgdsInput as default };
302
309
 
@@ -1 +1 @@
1
- {"version":3,"file":"sgds-input.js","names":["formTextControlStyles","formPlaceholderStyles","inputStyle"],"sources":["../../../../src/components/Input/sgds-input.ts"],"sourcesContent":["import { nothing } from \"lit\";\nimport { property, state } from \"lit/decorators.js\";\nimport { classMap } from \"lit/directives/class-map.js\";\nimport { ifDefined } from \"lit/directives/if-defined.js\";\nimport { live } from \"lit/directives/live.js\";\nimport { html } from \"lit/static-html.js\";\nimport FormControlElement from \"../../base/form-control-element\";\nimport formPlaceholderStyles from \"../../styles/form-placeholder.css\";\nimport formTextControlStyles from \"../../styles/form-text-control.css\";\nimport { defaultValue } from \"../../utils/defaultvalue\";\nimport type { SgdsFormControl } from \"../../utils/formSubmitController\";\nimport { SgdsFormValidatorMixin } from \"../../utils/validatorMixin\";\nimport { watch } from \"../../utils/watch\";\nimport { SgdsSpinner } from \"../Spinner/sgds-spinner\";\nimport inputStyle from \"./input.css\";\nimport SgdsIcon from \"../Icon/sgds-icon\";\n/**\n * @summary Text inputs allow your users to enter letters, numbers and symbols on a single line.\n *\n * @slot icon - The slot for leading icon of text input\n * @slot trailing-icon - The slot for trailing icon of text input. When present, it overrides valid icon and loading spinner rendered when valid prop or loading prop are true\n * @slot action - The slot for call to action of the text input. It is recommended to use sgds-icon-button within this slot\n * @event sgds-change - Emitted when an alteration to the control's value is committed by the user.\n * @event sgds-input - Emitted when the control receives input and its value changes.\n * @event sgds-focus - Emitted when input is in focus.\n * @event sgds-blur - Emitted when input is not in focus.\n * @event sgds-invalid - Emitted when input is invalid\n * @event sgds-valid - Emitted when input is valid\n *\n */\nexport class SgdsInput extends SgdsFormValidatorMixin(FormControlElement) implements SgdsFormControl {\n static styles = [...FormControlElement.styles, formTextControlStyles, formPlaceholderStyles, inputStyle];\n /** @internal */\n static dependencies = {\n \"sgds-spinner\": SgdsSpinner,\n \"sgds-icon\": SgdsIcon\n };\n\n @property({ reflect: true }) type:\n | \"email\"\n | \"number\"\n | \"password\"\n | \"search\"\n | \"tel\"\n | \"text\"\n | \"time\"\n | \"url\"\n | \"datetime-local\" = \"text\";\n\n /** The prefix of the input */\n @property({ type: String }) prefix: string;\n\n /** The suffix of the input */\n @property({ type: String }) suffix: string;\n\n /** Sets the minimum length of the input */\n @property({ type: Number, reflect: true }) minlength: number;\n\n /** Sets the maximum length of the input */\n @property({ type: Number, reflect: true }) maxlength: number;\n\n /** The input's minimum value. Only applies number input types. */\n @property() min: number;\n\n /** The input's maximum value. Only applies number input types. */\n @property() max: number;\n\n /** The input's placeholder text. */\n @property({ type: String, reflect: true }) placeholder = \"placeholder\";\n\n /** A pattern to validate input against. */\n @property({ type: String }) pattern: string;\n\n /** Autofocus the input */\n @property({ type: Boolean, reflect: true }) autofocus = false;\n\n /** Makes the input readonly. */\n @property({ type: Boolean, reflect: true }) readonly = false;\n\n /** Controlling of autocomplete behaviour */\n @property({ type: String, reflect: true }) autocomplete = \"on\";\n\n /**\n * Specifies the granularity that the value must adhere to, or the special value `any` which means no stepping is\n * implied, allowing any numeric value. Only applies to number input types.\n */\n @property() step: number | \"any\";\n\n /** Allows invalidFeedback, invalid and valid styles to be visible with the input */\n @property({ type: String, reflect: true }) hasFeedback: \"style\" | \"text\" | \"both\";\n\n /**Feedback text for error state when validated */\n @property({ type: String, reflect: true }) invalidFeedback: string;\n\n /**Gets or sets the default value used to reset this element. The initial value corresponds to the one originally specified in the HTML that created this element. */\n @defaultValue()\n defaultValue = \"\";\n\n /** Marks the component as valid. */\n @property({ type: Boolean, reflect: true }) valid = false;\n\n /** Marks the component as loading. */\n @property({ type: Boolean, reflect: true }) loading = false;\n\n /** Makes the input a required field. */\n @property({ type: Boolean, reflect: true }) required = false;\n\n /** Disables native and sgds validation for the input. */\n @property({ type: Boolean, reflect: true }) noValidate = false;\n\n /**The input's value attribute. */\n @property({ reflect: true }) value = \"\";\n\n @state() protected _isTouched = false;\n\n @state() private _showPassword = false;\n\n /** Sets focus on the input. */\n public focus(options?: FocusOptions) {\n this.input.focus(options);\n }\n /** Sets blur on the input. */\n public blur() {\n this.input.blur();\n }\n\n /**\n * Checks for validity. Under the hood, HTMLFormElement's reportValidity method calls this method to check for component's validity state\n * Note that the native error popup is prevented for SGDS form components by default. Instead the validation message shows up in the feedback container of SgdsInput\n */\n public reportValidity(): boolean {\n return this._mixinReportValidity();\n }\n /**\n * Checks for validity without any native error popup message\n */\n public checkValidity(): boolean {\n return this._mixinCheckValidity();\n }\n /**\n * Checks for validity without any native error popup message\n */\n public setValidity(flags?: ValidityStateFlags, message?: string, anchor?: HTMLElement): void {\n return this._mixinSetValidity(flags, message, anchor);\n }\n\n /**\n * Returns the ValidityState object\n */\n public get validity(): ValidityState {\n return this._mixinGetValidity();\n }\n /**\n * Returns the validation message based on the ValidityState\n */\n public get validationMessage() {\n return this._mixinGetValidationMessage();\n }\n\n protected _handleFocus() {\n this.emit(\"sgds-focus\");\n }\n\n protected _handleBlur() {\n const sgdsBlur = this.emit(\"sgds-blur\", { cancelable: true });\n if (this._mixinShouldSkipSgdsValidation()) return;\n if (sgdsBlur.defaultPrevented) return;\n\n this.setInvalid(!this._mixinCheckValidity());\n this._isTouched = true;\n }\n private _handleClick() {\n this.focus();\n }\n\n protected _handleChange(e: Event) {\n this.value = this.input.value;\n const sgdsChange = this.emit(\"sgds-change\", { cancelable: true });\n\n if (sgdsChange.defaultPrevented) return;\n\n super._mixinHandleChange(e);\n }\n protected _handleInputChange(e: Event) {\n this.value = this.input.value;\n const sgdsInput = this.emit(\"sgds-input\", { cancelable: true });\n\n if (sgdsInput.defaultPrevented) return;\n\n super._mixinHandleInputChange(e);\n }\n /** @internal */\n @watch(\"_isTouched\", { waitUntilFirstUpdate: true })\n _handleIsTouched() {\n if (this._mixinShouldSkipSgdsValidation()) return;\n if (this._isTouched) {\n this.setInvalid(!this._mixinCheckValidity());\n }\n }\n @watch(\"disabled\", { waitUntilFirstUpdate: true })\n _handleDisabledChange() {\n // Disabled form controls are always valid, so we need to recheck validity when the state changes\n this.setInvalid(false);\n }\n\n protected _renderInput() {\n const wantFeedbackStyle = this.hasFeedback === \"both\" || this.hasFeedback === \"style\";\n const wantFeedbackText = this.hasFeedback === \"both\" || this.hasFeedback === \"text\";\n const ariaDescribedBy =\n [\n this.hintText ? `${this._controlId}Help` : \"\",\n this.invalid && wantFeedbackText ? `${this._controlId}-invalid` : \"\"\n ]\n .filter(Boolean)\n .join(\" \") || undefined;\n return html`\n <div\n class=\"form-control-group ${classMap({\n disabled: this.disabled,\n readonly: this.readonly,\n \"is-invalid\": this.invalid && wantFeedbackStyle\n })}\"\n @click=${this._handleClick}\n >\n <slot name=\"icon\"></slot>\n ${this.prefix ? html`<span class=\"form-control-prefix\">${this.prefix}</span>` : nothing}\n <input\n class=\"form-control\"\n type=${this._inputType()}\n id=${this._controlId}\n name=${ifDefined(this.name)}\n placeholder=${ifDefined(this.placeholder)}\n aria-invalid=${this.invalid ? \"true\" : \"false\"}\n pattern=${ifDefined(this.pattern)}\n ?autofocus=${this.autofocus}\n ?disabled=${this.disabled}\n ?readonly=${this.readonly}\n ?required=${this.required}\n .value=${live(this.value)}\n minlength=${ifDefined(this.minlength)}\n maxlength=${ifDefined(this.maxlength)}\n min=${ifDefined(this.min)}\n max=${ifDefined(this.max)}\n step=${ifDefined(this.step as number)}\n @input=${(e: Event) => this._handleInputChange(e)}\n @change=${(e: Event) => this._handleChange(e)}\n @invalid=${() => this.setInvalid(true)}\n @focus=${this._handleFocus}\n @blur=${this._handleBlur}\n aria-describedby=${ifDefined(ariaDescribedBy)}\n .autocomplete=${this.autocomplete}\n />\n ${this.type === \"password\" ? this._renderPasswordToggle() : nothing}\n ${this.suffix ? html`<span class=\"form-control-suffix\">${this.suffix}</span>` : nothing}\n <slot name=\"trailing-icon\">\n ${this.loading ? html`<sgds-spinner size=\"sm\"></sgds-spinner>` : nothing}\n ${this.valid ? html`<sgds-icon name=\"check-circle-fill\" class=\"valid-icon\"></sgds-icon>` : nothing}\n </slot>\n </div>\n `;\n }\n protected _renderPasswordToggle() {\n return html`<sgds-icon\n tabIndex=\"0\"\n role=\"button\"\n aria-label=${this._showPassword ? \"Hide password\" : \"Show password\"}\n name=${this._showPassword ? \"eye-slash-fill\" : \"eye-fill\"}\n @click=${() => (this._showPassword = !this._showPassword)}\n ></sgds-icon>`;\n }\n protected _inputType() {\n if (this.type === \"password\" && this._showPassword) {\n return \"text\";\n }\n return this.type;\n }\n protected _renderFeedback() {\n const wantFeedbackText = this.hasFeedback === \"both\" || this.hasFeedback === \"text\";\n\n return this.invalid && wantFeedbackText\n ? html` <div class=\"invalid-feedback-container\">\n <sgds-icon name=\"exclamation-circle-fill\" size=\"md\"></sgds-icon>\n <div id=\"${this._controlId}-invalid\" class=\"invalid-feedback\">\n ${this.invalidFeedback ? this.invalidFeedback : this.input.validationMessage}\n </div>\n </div>`\n : html`${this._renderHintText()}`;\n }\n protected _renderLabel() {\n const labelTemplate = html`\n <label\n for=${this._controlId}\n id=${this._labelId}\n class=${classMap({\n \"form-label\": true,\n required: this.required\n })}\n >${this.label}</label\n >\n `;\n return this.label && labelTemplate;\n }\n protected _renderHintText() {\n const hintTextTemplate = html` <div id=\"${this._controlId}Help\" class=\"form-text\">${this.hintText}</div> `;\n return this.hintText && hintTextTemplate;\n }\n render() {\n return html`\n <div\n class=\"form-control-container ${classMap({\n disabled: this.disabled\n })}\"\n >\n ${this._renderLabel()}\n <div class=\"form-control-row\">\n ${this._renderInput()}\n <slot name=\"action\"></slot>\n </div>\n ${this._renderFeedback()}\n </div>\n `;\n }\n}\n\nexport default SgdsInput;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,IAAa,YAAb,cAA+B,uBAAuB,kBAAkB,CAAC,CAA4B;;;EAiB5E,KAAA,OAAA;EAqBkC,KAAA,cAAA;EAMD,KAAA,YAAA;EAGD,KAAA,WAAA;EAGG,KAAA,eAAA;EAgB3C,KAAA,eAAA;EAGqC,KAAA,QAAA;EAGE,KAAA,UAAA;EAGC,KAAA,WAAA;EAGE,KAAA,aAAA;EAGpB,KAAA,QAAA;EAEL,KAAA,aAAA;EAEC,KAAA,gBAAA;;;EApFjB,KAAA,SAAA;GAAC,GAAG,mBAAmB;GAAQA;GAAuBC;GAAuBC;EAAU;;;EAEjF,KAAA,eAAA;GACpB,gBAAgB;GAChB,aAAa;EACf;;;CAkFA,MAAa,SAAwB;EACnC,KAAK,MAAM,MAAM,OAAO;CAC1B;;CAEA,OAAc;EACZ,KAAK,MAAM,KAAK;CAClB;;;;;CAMA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E,MAAM;CAAS,SAAS;AAAK,CAAC,CAAA,GAAA,UAAA,WAAA,WAAA,KAAA,CAAA;AAGzC,WAAA,CAAA,SAAS;CAAE,MAAM;CAAS,SAAS;AAAK,CAAC,CAAA,GAAA,UAAA,WAAA,YAAA,KAAA,CAAA;AAGzC,WAAA,CAAA,SAAS;CAAE,MAAM;CAAS,SAAS;AAAK,CAAC,CAAA,GAAA,UAAA,WAAA,cAAA,KAAA,CAAA;AAGzC,WAAA,CAAA,SAAS,EAAE,SAAS,KAAK,CAAC,CAAA,GAAA,UAAA,WAAA,SAAA,KAAA,CAAA;AAE1B,WAAA,CAAA,MAAM,CAAA,GAAA,UAAA,WAAA,cAAA,KAAA,CAAA;AAEN,WAAA,CAAA,MAAM,CAAA,GAAA,UAAA,WAAA,iBAAA,KAAA,CAAA;AA6EN,WAAA,CAAA,MAAM,cAAc,EAAE,sBAAsB,KAAK,CAAC,CAAA,GAAA,UAAA,WAAA,oBAAA,IAAA;AAOlD,WAAA,CAAA,MAAM,YAAY,EAAE,sBAAsB,KAAK,CAAC,CAAA,GAAA,UAAA,WAAA,yBAAA,IAAA"}
1
+ {"version":3,"file":"sgds-input.js","names":["formTextControlStyles","formPlaceholderStyles","inputStyle"],"sources":["../../../../src/components/Input/sgds-input.ts"],"sourcesContent":["import { nothing } from \"lit\";\nimport { property, state } from \"lit/decorators.js\";\nimport { classMap } from \"lit/directives/class-map.js\";\nimport { ifDefined } from \"lit/directives/if-defined.js\";\nimport { live } from \"lit/directives/live.js\";\nimport { html } from \"lit/static-html.js\";\nimport FormControlElement from \"../../base/form-control-element\";\nimport formPlaceholderStyles from \"../../styles/form-placeholder.css\";\nimport formTextControlStyles from \"../../styles/form-text-control.css\";\nimport { defaultValue } from \"../../utils/defaultvalue\";\nimport type { SgdsFormControl } from \"../../utils/formSubmitController\";\nimport { SgdsFormValidatorMixin } from \"../../utils/validatorMixin\";\nimport { watch } from \"../../utils/watch\";\nimport { SgdsSpinner } from \"../Spinner/sgds-spinner\";\nimport inputStyle from \"./input.css\";\nimport SgdsIcon from \"../Icon/sgds-icon\";\n/**\n * @summary Text inputs allow your users to enter letters, numbers and symbols on a single line.\n *\n * @slot icon - The slot for leading icon of text input\n * @slot trailing-icon - The slot for trailing icon of text input. When present, it overrides valid icon and loading spinner rendered when valid prop or loading prop are true\n * @slot action - The slot for call to action of the text input. It is recommended to use sgds-icon-button within this slot\n * @event sgds-change - Emitted when an alteration to the control's value is committed by the user.\n * @event sgds-input - Emitted when the control receives input and its value changes.\n * @event sgds-focus - Emitted when input is in focus.\n * @event sgds-blur - Emitted when input is not in focus.\n * @event sgds-invalid - Emitted when input is invalid\n * @event sgds-valid - Emitted when input is valid\n *\n */\nexport class SgdsInput extends SgdsFormValidatorMixin(FormControlElement) implements SgdsFormControl {\n static styles = [...FormControlElement.styles, formTextControlStyles, formPlaceholderStyles, inputStyle];\n /** @internal */\n static dependencies = {\n \"sgds-spinner\": SgdsSpinner,\n \"sgds-icon\": SgdsIcon\n };\n\n @property({ reflect: true }) type:\n | \"email\"\n | \"number\"\n | \"password\"\n | \"search\"\n | \"tel\"\n | \"text\"\n | \"time\"\n | \"url\"\n | \"datetime-local\" = \"text\";\n\n /** The prefix of the input */\n @property({ type: String }) prefix: string;\n\n /** The suffix of the input */\n @property({ type: String }) suffix: string;\n\n /** Sets the minimum length of the input */\n @property({ type: Number, reflect: true }) minlength: number;\n\n /** Sets the maximum length of the input */\n @property({ type: Number, reflect: true }) maxlength: number;\n\n /** The input's minimum value. Only applies number input types. */\n @property() min: number;\n\n /** The input's maximum value. Only applies number input types. */\n @property() max: number;\n\n /** The input's placeholder text. */\n @property({ type: String, reflect: true }) placeholder = \"placeholder\";\n\n /** A pattern to validate input against. */\n @property({ type: String }) pattern: string;\n\n /** Autofocus the input */\n @property({ type: Boolean, reflect: true }) autofocus = false;\n\n /** Makes the input readonly. */\n @property({ type: Boolean, reflect: true }) readonly = false;\n\n /** Controlling of autocomplete behaviour */\n @property({ type: String, reflect: true }) autocomplete = \"on\";\n\n /**\n * Specifies the granularity that the value must adhere to, or the special value `any` which means no stepping is\n * implied, allowing any numeric value. Only applies to number input types.\n */\n @property() step: number | \"any\";\n\n /** Allows invalidFeedback, invalid and valid styles to be visible with the input */\n @property({ type: String, reflect: true }) hasFeedback: \"style\" | \"text\" | \"both\";\n\n /**Feedback text for error state when validated */\n @property({ type: String, reflect: true }) invalidFeedback: string;\n\n /**Gets or sets the default value used to reset this element. The initial value corresponds to the one originally specified in the HTML that created this element. */\n @defaultValue()\n defaultValue = \"\";\n\n /** Marks the component as valid. */\n @property({ type: Boolean, reflect: true }) valid = false;\n\n /** Marks the component as loading. */\n @property({ type: Boolean, reflect: true }) loading = false;\n\n /** Makes the input a required field. */\n @property({ type: Boolean, reflect: true }) required = false;\n\n /** Disables native and sgds validation for the input. */\n @property({ type: Boolean, reflect: true }) noValidate = false;\n\n /**The input's value attribute. */\n @property({ reflect: true }) value = \"\";\n\n @state() protected _isTouched = false;\n\n @state() private _showPassword = false;\n\n /** Sets focus on the input. */\n public focus(options?: FocusOptions) {\n this.input.focus(options);\n }\n /** Sets blur on the input. */\n public blur() {\n this.input.blur();\n }\n\n /**\n * Checks for validity. Under the hood, HTMLFormElement's reportValidity method calls this method to check for component's validity state\n * Note that the native error popup is prevented for SGDS form components by default. Instead the validation message shows up in the feedback container of SgdsInput\n */\n public reportValidity(): boolean {\n return this._mixinReportValidity();\n }\n /**\n * Checks for validity without any native error popup message\n */\n public checkValidity(): boolean {\n return this._mixinCheckValidity();\n }\n /**\n * Checks for validity without any native error popup message\n */\n public setValidity(flags?: ValidityStateFlags, message?: string, anchor?: HTMLElement): void {\n return this._mixinSetValidity(flags, message, anchor);\n }\n\n /**\n * Returns the ValidityState object\n */\n public get validity(): ValidityState {\n return this._mixinGetValidity();\n }\n /**\n * Returns the validation message based on the ValidityState\n */\n public get validationMessage() {\n return this._mixinGetValidationMessage();\n }\n\n protected _handleFocus() {\n this.emit(\"sgds-focus\");\n }\n\n protected _handleBlur() {\n const sgdsBlur = this.emit(\"sgds-blur\", { cancelable: true });\n if (this._mixinShouldSkipSgdsValidation()) return;\n if (sgdsBlur.defaultPrevented) return;\n\n this.setInvalid(!this._mixinCheckValidity());\n this._isTouched = true;\n }\n private _handleClick() {\n this.focus();\n }\n\n protected _handleChange(e: Event) {\n this.value = this.input.value;\n const sgdsChange = this.emit(\"sgds-change\", { cancelable: true });\n\n if (sgdsChange.defaultPrevented) return;\n\n super._mixinHandleChange(e);\n }\n protected _handleInputChange(e: Event) {\n this.value = this.input.value;\n const sgdsInput = this.emit(\"sgds-input\", { cancelable: true });\n\n if (sgdsInput.defaultPrevented) return;\n\n super._mixinHandleInputChange(e);\n }\n /** @internal */\n @watch(\"_isTouched\", { waitUntilFirstUpdate: true })\n _handleIsTouched() {\n if (this._mixinShouldSkipSgdsValidation()) return;\n if (this._isTouched) {\n this.setInvalid(!this._mixinCheckValidity());\n }\n }\n @watch(\"disabled\", { waitUntilFirstUpdate: true })\n _handleDisabledChange() {\n // Disabled form controls are always valid, so we need to recheck validity when the state changes\n this.setInvalid(false);\n }\n\n @watch(\"value\", { waitUntilFirstUpdate: true })\n async _handleValueChange() {\n this._mixinSetFormValue();\n await this.updateComplete;\n if (this._mixinShouldSkipSgdsValidation()) return;\n this._mixinValidate(this.input);\n }\n\n protected _renderInput() {\n const wantFeedbackStyle = this.hasFeedback === \"both\" || this.hasFeedback === \"style\";\n const wantFeedbackText = this.hasFeedback === \"both\" || this.hasFeedback === \"text\";\n const ariaDescribedBy =\n [\n this.hintText ? `${this._controlId}Help` : \"\",\n this.invalid && wantFeedbackText ? `${this._controlId}-invalid` : \"\"\n ]\n .filter(Boolean)\n .join(\" \") || undefined;\n return html`\n <div\n class=\"form-control-group ${classMap({\n disabled: this.disabled,\n readonly: this.readonly,\n \"is-invalid\": this.invalid && wantFeedbackStyle\n })}\"\n @click=${this._handleClick}\n >\n <slot name=\"icon\"></slot>\n ${this.prefix ? html`<span class=\"form-control-prefix\">${this.prefix}</span>` : nothing}\n <input\n class=\"form-control\"\n type=${this._inputType()}\n id=${this._controlId}\n name=${ifDefined(this.name)}\n placeholder=${ifDefined(this.placeholder)}\n aria-invalid=${this.invalid ? \"true\" : \"false\"}\n pattern=${ifDefined(this.pattern)}\n ?autofocus=${this.autofocus}\n ?disabled=${this.disabled}\n ?readonly=${this.readonly}\n ?required=${this.required}\n .value=${live(this.value)}\n minlength=${ifDefined(this.minlength)}\n maxlength=${ifDefined(this.maxlength)}\n min=${ifDefined(this.min)}\n max=${ifDefined(this.max)}\n step=${ifDefined(this.step as number)}\n @input=${(e: Event) => this._handleInputChange(e)}\n @change=${(e: Event) => this._handleChange(e)}\n @invalid=${() => this.setInvalid(true)}\n @focus=${this._handleFocus}\n @blur=${this._handleBlur}\n aria-describedby=${ifDefined(ariaDescribedBy)}\n .autocomplete=${this.autocomplete}\n />\n ${this.type === \"password\" ? this._renderPasswordToggle() : nothing}\n ${this.suffix ? html`<span class=\"form-control-suffix\">${this.suffix}</span>` : nothing}\n <slot name=\"trailing-icon\">\n ${this.loading ? html`<sgds-spinner size=\"sm\"></sgds-spinner>` : nothing}\n ${this.valid ? html`<sgds-icon name=\"check-circle-fill\" class=\"valid-icon\"></sgds-icon>` : nothing}\n </slot>\n </div>\n `;\n }\n protected _renderPasswordToggle() {\n return html`<sgds-icon\n tabIndex=\"0\"\n role=\"button\"\n aria-label=${this._showPassword ? \"Hide password\" : \"Show password\"}\n name=${this._showPassword ? \"eye-slash-fill\" : \"eye-fill\"}\n @click=${() => (this._showPassword = !this._showPassword)}\n ></sgds-icon>`;\n }\n protected _inputType() {\n if (this.type === \"password\" && this._showPassword) {\n return \"text\";\n }\n return this.type;\n }\n protected _renderFeedback() {\n const wantFeedbackText = this.hasFeedback === \"both\" || this.hasFeedback === \"text\";\n\n return this.invalid && wantFeedbackText\n ? html` <div class=\"invalid-feedback-container\">\n <sgds-icon name=\"exclamation-circle-fill\" size=\"md\"></sgds-icon>\n <div id=\"${this._controlId}-invalid\" class=\"invalid-feedback\">\n ${this.invalidFeedback ? this.invalidFeedback : this.input.validationMessage}\n </div>\n </div>`\n : html`${this._renderHintText()}`;\n }\n protected _renderLabel() {\n const labelTemplate = html`\n <label\n for=${this._controlId}\n id=${this._labelId}\n class=${classMap({\n \"form-label\": true,\n required: this.required\n })}\n >${this.label}</label\n >\n `;\n return this.label && labelTemplate;\n }\n protected _renderHintText() {\n const hintTextTemplate = html` <div id=\"${this._controlId}Help\" class=\"form-text\">${this.hintText}</div> `;\n return this.hintText && hintTextTemplate;\n }\n render() {\n return html`\n <div\n class=\"form-control-container ${classMap({\n disabled: this.disabled\n })}\"\n >\n ${this._renderLabel()}\n <div class=\"form-control-row\">\n ${this._renderInput()}\n <slot name=\"action\"></slot>\n </div>\n ${this._renderFeedback()}\n </div>\n `;\n }\n}\n\nexport default SgdsInput;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,IAAa,YAAb,cAA+B,uBAAuB,kBAAkB,CAAC,CAA4B;;;EAiB5E,KAAA,OAAA;EAqBkC,KAAA,cAAA;EAMD,KAAA,YAAA;EAGD,KAAA,WAAA;EAGG,KAAA,eAAA;EAgB3C,KAAA,eAAA;EAGqC,KAAA,QAAA;EAGE,KAAA,UAAA;EAGC,KAAA,WAAA;EAGE,KAAA,aAAA;EAGpB,KAAA,QAAA;EAEL,KAAA,aAAA;EAEC,KAAA,gBAAA;;;EApFjB,KAAA,SAAA;GAAC,GAAG,mBAAmB;GAAQA;GAAuBC;GAAuBC;EAAU;;;EAEjF,KAAA,eAAA;GACpB,gBAAgB;GAChB,aAAa;EACf;;;CAkFA,MAAa,SAAwB;EACnC,KAAK,MAAM,MAAM,OAAO;CAC1B;;CAEA,OAAc;EACZ,KAAK,MAAM,KAAK;CAClB;;;;;CAMA,iBAAiC;EAC/B,OAAO,KAAK,qBAAqB;CACnC;;;;CAIA,gBAAgC;EAC9B,OAAO,KAAK,oBAAoB;CAClC;;;;CAIA,YAAmB,O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