@nanoporetech-digital/components 4.5.3 → 4.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +39 -0
- package/dist/cjs/index.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{modal-5884a6de.js → modal-b9b40f6d.js} +2 -2
- package/dist/cjs/{modal-5884a6de.js.map → modal-b9b40f6d.js.map} +1 -1
- package/dist/cjs/nano-alert.cjs.entry.js +2 -2
- package/dist/cjs/nano-components.cjs.js +1 -1
- package/dist/cjs/nano-datalist_3.cjs.entry.js +6 -0
- package/dist/cjs/nano-datalist_3.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-dialog.cjs.entry.js +3 -3
- package/dist/cjs/nano-dialog.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-drawer.cjs.entry.js +2 -2
- package/dist/cjs/nano-dropdown.cjs.entry.js +1 -1
- package/dist/cjs/nano-field-validator.cjs.entry.js +43 -29
- package/dist/cjs/nano-field-validator.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-global-nav-user-profile_3.cjs.entry.js +1 -1
- package/dist/cjs/nano-global-nav.cjs.entry.js +1 -1
- package/dist/cjs/nano-global-nav.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-icon-button_2.cjs.entry.js +2 -1
- package/dist/cjs/nano-icon-button_2.cjs.entry.js.map +1 -1
- package/dist/cjs/{nano-table-f47280ac.js → nano-table-3231e33a.js} +2 -2
- package/dist/cjs/{nano-table-f47280ac.js.map → nano-table-3231e33a.js.map} +1 -1
- package/dist/cjs/nano-table.cjs.entry.js +1 -1
- package/dist/cjs/{tabbable-bdf10c84.js → tabbable-4a2b1566.js} +10 -4
- package/dist/cjs/tabbable-4a2b1566.js.map +1 -0
- package/dist/cjs/{table.worker-9a1585c7.js → table.worker-1cf646db.js} +2 -2
- package/dist/cjs/table.worker-1cf646db.js.map +1 -0
- package/dist/collection/components/datalist/datalist.js +6 -0
- package/dist/collection/components/datalist/datalist.js.map +1 -1
- package/dist/collection/components/dialog/dialog.css +1 -0
- package/dist/collection/components/dialog/dialog.js +1 -1
- package/dist/collection/components/dialog/dialog.js.map +1 -1
- package/dist/collection/components/field-validator/field-validator.js +81 -33
- package/dist/collection/components/field-validator/field-validator.js.map +1 -1
- package/dist/collection/components/global-nav/global-nav.js +3 -2
- package/dist/collection/components/global-nav/global-nav.js.map +1 -1
- package/dist/collection/components/tooltip/tooltip.js +2 -1
- package/dist/collection/components/tooltip/tooltip.js.map +1 -1
- package/dist/collection/utils/tabbable.js +9 -3
- package/dist/collection/utils/tabbable.js.map +1 -1
- package/dist/components/datalist.js +6 -0
- package/dist/components/datalist.js.map +1 -1
- package/dist/components/nano-dialog.js +1 -1
- package/dist/components/nano-dialog.js.map +1 -1
- package/dist/components/nano-field-validator.js +45 -30
- package/dist/components/nano-field-validator.js.map +1 -1
- package/dist/components/nano-global-nav.js +1 -1
- package/dist/components/nano-global-nav.js.map +1 -1
- package/dist/components/tabbable.js +9 -3
- package/dist/components/tabbable.js.map +1 -1
- package/dist/components/tooltip.js +2 -1
- package/dist/components/tooltip.js.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{modal-1f3223cd.js → modal-bd9638c0.js} +2 -2
- package/dist/esm/{modal-1f3223cd.js.map → modal-bd9638c0.js.map} +1 -1
- package/dist/esm/nano-alert.entry.js +2 -2
- package/dist/esm/nano-components.js +1 -1
- package/dist/esm/nano-datalist_3.entry.js +6 -0
- package/dist/esm/nano-datalist_3.entry.js.map +1 -1
- package/dist/esm/nano-dialog.entry.js +3 -3
- package/dist/esm/nano-dialog.entry.js.map +1 -1
- package/dist/esm/nano-drawer.entry.js +2 -2
- package/dist/esm/nano-dropdown.entry.js +1 -1
- package/dist/esm/nano-field-validator.entry.js +43 -29
- package/dist/esm/nano-field-validator.entry.js.map +1 -1
- package/dist/esm/nano-global-nav-user-profile_3.entry.js +1 -1
- package/dist/esm/nano-global-nav.entry.js +1 -1
- package/dist/esm/nano-global-nav.entry.js.map +1 -1
- package/dist/esm/nano-icon-button_2.entry.js +2 -1
- package/dist/esm/nano-icon-button_2.entry.js.map +1 -1
- package/dist/esm/{nano-table-7d22e310.js → nano-table-073a807b.js} +2 -2
- package/dist/esm/{nano-table-7d22e310.js.map → nano-table-073a807b.js.map} +1 -1
- package/dist/esm/nano-table.entry.js +1 -1
- package/dist/esm/{tabbable-31485ff7.js → tabbable-26a66a22.js} +10 -4
- package/dist/esm/tabbable-26a66a22.js.map +1 -0
- package/dist/esm/{table.worker-55bb0326.js → table.worker-3db952f1.js} +2 -2
- package/dist/esm/table.worker-3db952f1.js.map +1 -0
- package/dist/nano-components/index.esm.js +1 -1
- package/dist/nano-components/nano-components.esm.js +1 -1
- package/dist/nano-components/nano-components.esm.js.map +1 -1
- package/dist/nano-components/{p-dbf47e49.js → p-0ee2a9bf.js} +2 -2
- package/dist/nano-components/{p-e04f2333.js → p-2234694a.js} +2 -2
- package/dist/nano-components/{p-0c077605.entry.js → p-241056f4.entry.js} +2 -2
- package/dist/nano-components/{p-d5b63150.entry.js → p-272b2f59.entry.js} +2 -2
- package/dist/nano-components/p-272b2f59.entry.js.map +1 -0
- package/dist/nano-components/p-3dd8ae89.entry.js +5 -0
- package/dist/nano-components/p-3dd8ae89.entry.js.map +1 -0
- package/dist/nano-components/{p-ffb57a0d.js → p-4384a4c2.js} +2 -2
- package/dist/nano-components/{p-691c4268.entry.js → p-64b56ee6.entry.js} +2 -2
- package/dist/nano-components/{p-691c4268.entry.js.map → p-64b56ee6.entry.js.map} +1 -1
- package/dist/nano-components/{p-27b5e10c.entry.js → p-692ae029.entry.js} +2 -2
- package/dist/nano-components/{p-578f5e8d.entry.js → p-acd0ec64.entry.js} +2 -2
- package/dist/nano-components/{p-b6306aff.entry.js → p-b04fd7ca.entry.js} +2 -2
- package/dist/nano-components/p-b0c60290.entry.js +5 -0
- package/dist/nano-components/p-b0c60290.entry.js.map +1 -0
- package/dist/nano-components/{p-dc2c37d5.entry.js → p-e2b2b015.entry.js} +2 -2
- package/dist/nano-components/{p-27eb26ef.entry.js → p-eb6c9191.entry.js} +2 -2
- package/dist/nano-components/{p-27eb26ef.entry.js.map → p-eb6c9191.entry.js.map} +1 -1
- package/dist/nano-components/{p-45abbbdd.js → p-f88fa15c.js} +2 -2
- package/dist/nano-components/p-f88fa15c.js.map +1 -0
- package/dist/types/components/datalist/datalist.d.ts +1 -0
- package/dist/types/components/field-validator/field-validator.d.ts +11 -3
- package/dist/types/components/global-nav/global-nav.d.ts +2 -1
- package/dist/types/components.d.ts +7 -1
- package/dist/types/utils/tabbable.d.ts +8 -0
- package/docs-json.json +38 -5
- package/hydrate/index.js +66 -37
- package/package.json +2 -2
- package/dist/cjs/tabbable-bdf10c84.js.map +0 -1
- package/dist/cjs/table.worker-9a1585c7.js.map +0 -1
- package/dist/esm/tabbable-31485ff7.js.map +0 -1
- package/dist/esm/table.worker-55bb0326.js.map +0 -1
- package/dist/nano-components/p-2ad0d9a3.entry.js +0 -5
- package/dist/nano-components/p-2ad0d9a3.entry.js.map +0 -1
- package/dist/nano-components/p-357a0a3f.entry.js +0 -5
- package/dist/nano-components/p-357a0a3f.entry.js.map +0 -1
- package/dist/nano-components/p-45abbbdd.js.map +0 -1
- package/dist/nano-components/p-d5b63150.entry.js.map +0 -1
- /package/dist/nano-components/{p-27b5e10c.entry.js.map → p-0ee2a9bf.js.map} +0 -0
- /package/dist/nano-components/{p-e04f2333.js.map → p-2234694a.js.map} +0 -0
- /package/dist/nano-components/{p-0c077605.entry.js.map → p-241056f4.entry.js.map} +0 -0
- /package/dist/nano-components/{p-ffb57a0d.js.map → p-4384a4c2.js.map} +0 -0
- /package/dist/nano-components/{p-dbf47e49.js.map → p-692ae029.entry.js.map} +0 -0
- /package/dist/nano-components/{p-578f5e8d.entry.js.map → p-acd0ec64.entry.js.map} +0 -0
- /package/dist/nano-components/{p-b6306aff.entry.js.map → p-b04fd7ca.entry.js.map} +0 -0
- /package/dist/nano-components/{p-dc2c37d5.entry.js.map → p-e2b2b015.entry.js.map} +0 -0
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Object.defineProperty(exports, '__esModule', { value: true });
|
7
7
|
|
8
|
-
const nanoTable_entry = require('./nano-table-
|
8
|
+
const nanoTable_entry = require('./nano-table-3231e33a.js');
|
9
9
|
require('./index-71f899a7.js');
|
10
10
|
require('./math-a8123703.js');
|
11
11
|
require('./throttle-f55496c8.js');
|
@@ -58,8 +58,14 @@ function isTabbable(el) {
|
|
58
58
|
'summary',
|
59
59
|
].includes(tag);
|
60
60
|
}
|
61
|
-
|
62
|
-
|
61
|
+
/**
|
62
|
+
* Recursively locate all tabbable elements within an element.
|
63
|
+
* If the target element is tabbable, it will be included in the
|
64
|
+
* resulting array. This function will also look in open shadow roots.
|
65
|
+
* @param root the root to search from
|
66
|
+
* @param first return the first tabbable element found
|
67
|
+
* @returns an array of tabbable elements
|
68
|
+
*/
|
63
69
|
function getTabbableElements(root, first = false) {
|
64
70
|
const tabbableElements = [];
|
65
71
|
if (root instanceof HTMLElement) {
|
@@ -87,7 +93,7 @@ function getTabbableElements(root, first = false) {
|
|
87
93
|
}
|
88
94
|
}
|
89
95
|
// Look for tabbable elements in children
|
90
|
-
Array.from(root.
|
96
|
+
Array.from(root.children).map((el) => {
|
91
97
|
getTabbableElements(el, first).map((el) => {
|
92
98
|
if (!tabbableElements.includes(el))
|
93
99
|
tabbableElements.push(el);
|
@@ -103,4 +109,4 @@ function getNearestTabbableElement(el) {
|
|
103
109
|
exports.getNearestTabbableElement = getNearestTabbableElement;
|
104
110
|
exports.getTabbableElements = getTabbableElements;
|
105
111
|
|
106
|
-
//# sourceMappingURL=tabbable-
|
112
|
+
//# sourceMappingURL=tabbable-4a2b1566.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"file":"tabbable-4a2b1566.js","mappings":";;;;;AAAA;AACA,SAAS,UAAU,CAAC,EA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,CAAC;KAC/D,CAAC,CAAC;GACJ,CAAC,CAAC;EAEH,OAAO,gBAAgB,CAAC;AAC1B,CAAC;SAEe,yBAAyB,CAAC,EAAW;EACnD,MAAM,gBAAgB,GAAG,mBAAmB,CAAC,EAAiB,EAAE,IAAI,CAAC,CAAC;EACtE,OAAO,gBAAgB,CAAC,MAAM,GAAG,gBAAgB,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;AAC9D;;;;;","names":[],"sources":["./src/utils/tabbable.ts"],"sourcesContent":["// Determines if the specified element is tabbable using heuristics inspired by https://github.com/focus-trap/tabbable\nfunction isTabbable(el: HTMLElement) {\n const tag = el.tagName.toLowerCase();\n\n // Elements with a -1 tab index are not tabbable\n if (el.getAttribute('tabindex') === '-1') {\n return false;\n }\n\n // Elements with a disabled attribute are not tabbable\n if (el.hasAttribute('disabled')) {\n return false;\n }\n\n // Elements with aria-disabled are not tabbable\n if (\n el.hasAttribute('aria-disabled') &&\n el.getAttribute('aria-disabled') !== 'false'\n ) {\n return false;\n }\n\n // Elements with a tabindex other than -1 are tabbable\n if (el.hasAttribute('tabindex')) {\n return true;\n }\n\n // Elements with a contenteditable attribute are tabbable\n if (\n el.hasAttribute('contenteditable') &&\n el.getAttribute('contenteditable') !== 'false'\n ) {\n return true;\n }\n\n // Audio and video elements with the controls attribute are tabbable\n if ((tag === 'audio' || tag === 'video') && el.hasAttribute('controls')) {\n return true;\n }\n\n // Radios without a checked attribute are not tabbable\n if (\n tag === 'input' &&\n el.getAttribute('type') === 'radio' &&\n !el.hasAttribute('checked')\n ) {\n return false;\n }\n\n // Elements that are hidden have no offsetParent and are not tabbable\n if (!el.offsetParent) {\n return false;\n }\n\n // Elements without visibility are not tabbable (calculated last due to performance)\n if (window.getComputedStyle(el).visibility === 'hidden') {\n return false;\n }\n\n // At this point, the following elements are considered tabbable\n return [\n 'button',\n 'input',\n 'select',\n 'textarea',\n 'a',\n 'audio',\n 'video',\n 'summary',\n ].includes(tag);\n}\n\n/**\n * Recursively locate all tabbable elements within an element.\n * If the target element is tabbable, it will be included in the\n * resulting array. This function will also look in open shadow roots.\n * @param root the root to search from\n * @param first return the first tabbable element found\n * @returns an array of tabbable elements\n */\nexport function getTabbableElements(\n root: HTMLElement | ShadowRoot,\n first: boolean = false\n) {\n const tabbableElements: HTMLElement[] = [];\n\n if (root instanceof HTMLElement) {\n // Is the root element tabbable?\n if (isTabbable(root)) {\n tabbableElements.push(root);\n\n if (first) return tabbableElements;\n }\n\n // Look for tabbable elements in the shadow root\n if (root.shadowRoot && root.shadowRoot.mode === 'open') {\n getTabbableElements(root.shadowRoot, first).map((el) => {\n if (!tabbableElements.includes(el)) tabbableElements.push(el);\n });\n }\n\n // Look at slotted elements\n if (HTMLSlotElement && root instanceof HTMLSlotElement) {\n root.assignedElements().map((slottedEl: HTMLElement) => {\n getTabbableElements(slottedEl, first).map((el) => {\n if (!tabbableElements.includes(el)) tabbableElements.push(el);\n });\n });\n }\n }\n\n // Look for tabbable elements in children\n Array.from(root.children).map((el: HTMLElement) => {\n getTabbableElements(el, first).map((el) => {\n if (!tabbableElements.includes(el)) tabbableElements.push(el);\n });\n });\n\n return tabbableElements;\n}\n\nexport function getNearestTabbableElement(el: Element): HTMLElement | null {\n const tabbableElements = getTabbableElements(el as HTMLElement, true);\n return tabbableElements.length ? tabbableElements[0] : null;\n}\n"],"version":3}
|
@@ -3,7 +3,7 @@
|
|
3
3
|
*/
|
4
4
|
'use strict';
|
5
5
|
|
6
|
-
const nanoTable_entry = require('./nano-table-
|
6
|
+
const nanoTable_entry = require('./nano-table-3231e33a.js');
|
7
7
|
require('./index-71f899a7.js');
|
8
8
|
require('./math-a8123703.js');
|
9
9
|
require('./throttle-f55496c8.js');
|
@@ -22,4 +22,4 @@ exports.workerMsgId = workerMsgId;
|
|
22
22
|
exports.workerName = workerName;
|
23
23
|
exports.workerPath = workerPath;
|
24
24
|
|
25
|
-
//# sourceMappingURL=table.worker-
|
25
|
+
//# sourceMappingURL=table.worker-1cf646db.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"file":"table.worker-1cf646db.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":[],"sourcesContent":[],"version":3}
|
@@ -481,6 +481,12 @@ export class DataList {
|
|
481
481
|
console.warn('no `nano-input` found. `nano-datalist` should be nested within an `nano-input` or linked via `input` prop', this.host);
|
482
482
|
}, 500);
|
483
483
|
}
|
484
|
+
disconnectedCallback() {
|
485
|
+
if (!!this.mo) {
|
486
|
+
this.mo.disconnect();
|
487
|
+
this.mo = undefined;
|
488
|
+
}
|
489
|
+
}
|
484
490
|
render() {
|
485
491
|
return (h(Host, { role: this.actvOptEles.length ? 'listbox' : undefined, "aria-owns": this.optionIds.length ? this.optionIds.join(' ') : undefined, "aria-label": this.optionIds.length
|
486
492
|
? 'Select options from the list below'
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"datalist.js","sourceRoot":"","sources":["../../../src/components/datalist/datalist.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EAET,CAAC,EACD,IAAI,EACJ,OAAO,EACP,KAAK,EACL,KAAK,EACL,IAAI,EACJ,KAAK,EACL,SAAS,EACT,KAAK,GAEN,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAIhD,SAAS,SAAS,CAAC,QAAiB;EAClC,IAAI,UAA4B,CAAC;EAEjC,IAAI,QAAQ,CAAC,EAAE,EAAE;IACf,UAAU,GAAG,QAAQ,CAAC,aAAa,CAAC,cAAc,QAAQ,CAAC,EAAE,IAAI,CAAC,CAAC;GACpE;EACD,IAAI,CAAC,UAAU,EAAE;IACf,UAAU,GAAG,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;GACxC;EACD,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,IAAI,OAAO,GAAG,CAAC,CAAC;AAEhB;;;;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G,CACf;QACX,CAAC,CAAC,IAAI,CAAC,WAAW,IAAI,CACrB,WAAK,KAAK,EAAC,eAAe;UACvB,IAAI,CAAC,WAAW,CAAC,MAAM;;UACvB,IAAI,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE;wBACnC,CACP,CACa,CACX,CACR,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {\n Component,\n ComponentInterface,\n h,\n Host,\n Element,\n State,\n Watch,\n Prop,\n Event,\n writeTask,\n Build,\n EventEmitter,\n} from '@stencil/core';\nimport { getActiveElement } from '../../utils/active-element';\nimport { debounce } from '../../utils/throttle';\nimport type { NanoMenuCustomEvent, OptionInterface } from '../../interface';\nimport type { Dropdown } from '../dropdown/dropdown';\n\nfunction findLabel(formCtrl: Element) {\n let foundLabel: HTMLLabelElement;\n\n if (formCtrl.id) {\n foundLabel = document.querySelector(`label[for='${formCtrl.id}']`);\n }\n if (!foundLabel) {\n foundLabel = formCtrl.closest('label');\n }\n return foundLabel;\n}\n\nlet listIds = 0;\n\n/**\n * `nano-datalist` a visually consistent and more flexible replacement for a native\n * [datalist](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/datalist). Can be nested within a `nano-input`\n * or linked to any input control via the `input` prop. Is used internally within `nano-select`.\n * Options can be defined declaratively by nesting `<nano-option>` elements or imperatively using the `options` prop\n *\n * @slot - use `<nano-option>` elements for more complex html. Alternatively use the `options` prop\n * @slot list-top - shows at the top of the list when there are options present\n * @slot list-bottom - shows at the bottom of the list when there are options present\n * @slot no-result - shown when there are no results otherwise nothing will be shown\n */\n@Component({\n tag: 'nano-datalist',\n styleUrl: 'datalist.scss',\n shadow: true,\n})\nexport class DataList implements ComponentInterface {\n // Private State\n\n private isNanoInput = false;\n private typeToSelect = '';\n private typeToSelectTimeout: number;\n private nanoDropdown: HTMLNanoDropdownElement;\n private listBox: HTMLNanoMenuElement;\n private mo?: MutationObserver;\n private listId = `nano-datalist-${listIds++}`;\n private isFiltered = false;\n private shouldFocus = false;\n // all potential option eles. Set via slot or `options` prop.\n // Some may get hidden due to filtering\n private get allOptEles() {\n return this._allOptEles;\n }\n private set allOptEles(opts) {\n // when allOptEles are initially set (on slot change / options) -\n // add options to 'selected' and fire selected event *if*\n // value isn't set on the input\n this._allOptEles = opts;\n if (this.connectedInput?.value) return;\n\n opts.forEach((opt) => {\n if (opt.selected && !this.selected.includes(opt.value)) {\n this.changeInputValue(opt);\n }\n });\n }\n private _allOptEles: HTMLNanoOptionElement[] = [];\n\n @Element() host: HTMLNanoDatalistElement;\n\n // active option eles that are not hidden.\n @State() actvOptEles: HTMLNanoOptionElement[] = [];\n @State() connectedInput: HTMLInputElement | HTMLTextAreaElement;\n @State() inputLabel: HTMLLabelElement;\n @State() hasNoResult: boolean;\n @State() shouldOpen: boolean;\n @State() canOpen: boolean = true;\n @State() optionIds: string[] = [];\n\n constructor() {\n this.inputChange = debounce(this.inputChange.bind(this), 50);\n }\n\n // Public API\n\n /** By default, items in the list will appear 'selected' when the value in the linked input control matches.\n * However you can add other selected options via the the selected prop. */\n @Prop({ mutable: true }) selected: string[] = [];\n\n /** nano-dropdown config options you can pass to the nested dropdown component */\n @Prop()\n get dropDownConfig() {\n return this._dropDownConfig;\n }\n set dropDownConfig(ddc: Partial<Dropdown>) {\n this._dropDownConfig = { ...this._dropDownConfig, ...ddc };\n }\n private _dropDownConfig: Partial<Dropdown> = {\n skidding: -1,\n };\n\n /** Provide an option list.\n * Options can be defined declaratively by nesting `<nano-option>` elements or imperatively using this prop */\n @Prop() options?: OptionInterface[] = [];\n\n /** A selector to a HTMLInputElement */\n @Prop() input?: string | HTMLInputElement;\n\n /** Tweaks the datalist behaviour and linked control semantics and behaviour.\n * e.g. 'select' will make the linked input control `readonly`.\n */\n @Prop() type: 'select' | 'selctMulti' | 'input' = 'input';\n\n /** return all the active options currently within the datalist. Can be useful for validation */\n @Prop()\n get activeOptions() {\n return this.allOptEles;\n }\n\n /** Force datalist open */\n @Prop({ mutable: true }) open: boolean = false;\n\n @Watch('open')\n openWatcher() {\n writeTask(() => {\n this.nanoDropdown.open = this.open;\n if (this.connectedInput)\n this.connectedInput.setAttribute('aria-expanded', this.open.toString());\n });\n }\n\n /** Use this option to disable to default filtering. This is useful if filtering happens\n * externally via another method (e.g. via ajax)\n */\n @Prop() disableFilter = false;\n\n /** Activate / deactivate the datalist control */\n @Prop() disabled = false;\n\n // State change watchers\n\n @Watch('input')\n async watchInputChange() {\n let nanoInput;\n if ((nanoInput = this.host.closest('nano-input'))) {\n this.isNanoInput = true;\n this.connectedInput = await nanoInput.getInputElement();\n } else if (\n this.input &&\n typeof this.input === 'string' &&\n (nanoInput = document.querySelector(this.input))\n ) {\n this.isNanoInput = false;\n this.connectedInput = nanoInput;\n } else if (typeof this.input === 'object') {\n this.connectedInput = this.input;\n }\n }\n\n @Watch('options')\n manageSlotChangeListener() {\n if (!this.host) return;\n\n // we're not using `options` - setup new MO\n if ((!this.options || !this.options.length) && !this.mo) {\n if (Build.isBrowser) {\n const mo = (this.mo = new MutationObserver(() =>\n this.processSlottedContent()\n ));\n mo.observe(this.host, { childList: true, subtree: true });\n }\n this.processSlottedContent();\n return;\n }\n\n // we're using `options` - trash current MO\n if (this.options?.length) {\n if (!!this.mo) {\n this.mo.disconnect();\n this.mo = undefined;\n }\n\n const previousOptions = this.host.querySelectorAll(\n '[slot=\"internal-opts\"]'\n );\n\n // add imperative `options`\n writeTask(() => {\n // clear all previous\n if (previousOptions?.length)\n previousOptions.forEach((internalOpt) => internalOpt.remove());\n\n this.allOptEles = this.options.flatMap((option, i) => {\n if (option.value || option.label) {\n const opt = Object.assign(document.createElement('nano-option'), {\n label: option.label,\n value: option.value,\n ariaPosinset: i,\n ariaSetsize: this.options.length,\n selected: option.selected,\n id: this.listId + '-option-' + i,\n textContent: option.label ? option.label : option.value,\n slot: 'internal-opts',\n });\n this.host.append(opt);\n return opt;\n }\n });\n\n if (this.connectedInput?.value.length && this.type !== 'select') {\n this.inputChange();\n } else {\n this.actvOptEles = [...this.allOptEles];\n }\n });\n }\n // forceUpdate(this.host);\n }\n\n @Watch('type')\n @Watch('connectedInput')\n watchTypeChange() {\n if (!this.connectedInput) return;\n\n let dwConfig: Partial<Dropdown> = { closeOnSelect: false };\n let autocompleteType: 'list' | 'both' = 'both';\n let readonly = false;\n\n switch (this.type) {\n case 'input':\n dwConfig = { closeOnSelect: true };\n break;\n case 'select':\n autocompleteType = 'list';\n readonly = true;\n dwConfig = { closeOnSelect: true, placement: 'center' };\n break;\n }\n\n if (!this.isNanoInput) {\n dwConfig.tetherTo = this.connectedInput;\n }\n\n this.dropDownConfig = { ...this.dropDownConfig, ...dwConfig };\n this.connectedInput.setAttribute('aria-autocomplete', autocompleteType);\n this.connectedInput.readOnly = readonly;\n }\n\n @Watch('connectedInput')\n manageInputEvents(newInput?: HTMLInputElement, oldInput?: HTMLInputElement) {\n if (!!oldInput) {\n const nanoInput = oldInput.closest('nano-input');\n if (nanoInput) {\n nanoInput.removeEventListener('nanoChange', this.inputChange);\n }\n oldInput.removeEventListener('change', this.inputChange);\n oldInput.removeEventListener('click', this.inputClick);\n oldInput.removeEventListener('keydown', this.inputKeydown);\n oldInput.removeEventListener('input', this.inputChange);\n\n this.inputLabel = null;\n\n writeTask(() => {\n oldInput.removeAttribute('role');\n oldInput.removeAttribute('aria-expanded');\n oldInput.removeAttribute('aria-controls');\n oldInput.removeAttribute('aria-owns');\n oldInput.removeAttribute('aria-haspopup');\n oldInput.removeAttribute('aria-autocomplete');\n oldInput.removeAttribute('autocomplete');\n });\n }\n if (!!newInput) {\n const nanoInput = newInput.closest('nano-input');\n if (nanoInput) {\n nanoInput.addEventListener('nanoChange', this.inputChange);\n }\n newInput.addEventListener('change', this.inputChange);\n newInput.addEventListener('click', this.inputClick);\n newInput.addEventListener('keydown', this.inputKeydown);\n newInput.addEventListener('input', this.inputChange);\n this.listId = this.host.id || this.listId;\n\n this.inputLabel = newInput?.labels?.item(0) || findLabel(newInput);\n\n writeTask(() => {\n this.host.id = this.listId;\n newInput.setAttribute('role', 'combobox');\n newInput.setAttribute('aria-expanded', 'false');\n newInput.setAttribute('aria-controls', this.listId);\n newInput.setAttribute('aria-owns', this.listId);\n newInput.setAttribute('aria-haspopup', 'listbox');\n newInput.setAttribute('autocomplete', 'off');\n });\n }\n }\n\n @Watch('selected')\n @Watch('actvOptEles')\n watchActvOptChange() {\n let c = 0;\n const val = this.connectedInput?.value || '';\n const optIds = [];\n\n writeTask(() => {\n this.allOptEles.forEach((opt, i) => {\n if (this.actvOptEles.includes(opt)) {\n c++;\n opt.setAttribute('aria-posinset', c + '');\n opt.setAttribute('aria-setsize', this.actvOptEles.length + '');\n opt.hidden = false;\n this.isSelected(opt, val);\n } else {\n opt.removeAttribute('aria-posinset');\n opt.removeAttribute('aria-setsize');\n opt.hidden = true;\n opt.selected = false;\n }\n opt.id = this.listId + '-option-' + i;\n optIds.push(opt.id);\n });\n this.optionIds = optIds;\n });\n }\n\n @Watch('actvOptEles')\n @Watch('hasNoResult')\n manageCanOpen() {\n if (this.actvOptEles.length || this.hasNoResult) this.canOpen = true;\n else this.canOpen = false;\n }\n\n /**\n * Opens the dropdown if it can, it should and there are items to display.\n */\n @Watch('shouldOpen')\n @Watch('canOpen')\n manageDropdownDisplay() {\n if (this.shouldOpen && this.canOpen && !this.disabled) this.open = true;\n if (!this.shouldOpen || !this.canOpen) this.open = false;\n this.openWatcher();\n }\n\n @Watch('actvOptEles')\n fireActiveOptsEvent() {\n this.nanoOptionsUpdated.emit(this.actvOptEles);\n }\n\n // Events\n\n /** Fired when an item is selected. */\n @Event() nanoSelect: EventEmitter<HTMLNanoOptionElement>;\n\n /** Fired when a currently selected item is reselected. */\n @Event() nanoDeselect: EventEmitter<HTMLNanoOptionElement>;\n\n /** Fired when active options change */\n @Event() nanoOptionsUpdated: EventEmitter<HTMLNanoOptionElement[]>;\n\n // Private logic\n\n private isSelected(opt: HTMLNanoOptionElement, val: string) {\n if (val === opt.value || this.selected.includes(opt.value)) {\n opt.selected = true;\n } else opt.selected = false;\n }\n\n private get dropwdownOpen() {\n if (!this.nanoDropdown || !this.open) return false;\n return true;\n }\n\n private get exactMatch() {\n return this.allOptEles.find(\n (opt) => this.connectedInput.value === opt.value\n );\n }\n\n /** reflect value back to the connected input unless the event is cancelled */\n private changeInputValue(opt: HTMLNanoOptionElement) {\n let nanoSelected;\n\n if (this.selected.includes(opt.value)) {\n // deselect option\n this.selected = this.selected.filter((val) => val !== opt.value);\n nanoSelected = this.nanoDeselect.emit(opt);\n } else {\n // select new option\n this.selected = [...this.selected];\n nanoSelected = this.nanoSelect.emit(opt);\n }\n\n if (!nanoSelected.defaultPrevented) {\n if (this.connectedInput) this.connectedInput.value = opt.value;\n\n const event = new window.Event('change');\n this.connectedInput?.dispatchEvent(event);\n }\n }\n\n // a new option has been picked\n private optSelected = (e: NanoMenuCustomEvent<HTMLNanoOptionElement>) => {\n e.stopPropagation();\n this.changeInputValue(e.detail);\n requestAnimationFrame(() => this.inputChange());\n\n if (this.type !== 'selctMulti') this.shouldOpen = false;\n };\n\n // this is for type=\"select\" only.\n // Filter options that start with text - aggregates letters (as opposed to getting the value from input)\n private setOptStartsWith() {\n const attrFind = (toFind: string) =>\n toFind.toLowerCase().substring(0, this.typeToSelect.length) ===\n this.typeToSelect;\n\n const foundEle = this.allOptEles.find(\n (opt) =>\n opt.value.trim().length > 0 &&\n !opt.disabled &&\n (attrFind(opt.textContent) ||\n attrFind(opt.value) ||\n attrFind(opt.label) ||\n attrFind(opt.filterMeta))\n );\n if (foundEle) this.changeInputValue(foundEle);\n }\n\n // Event handlers\n\n private processSlottedContent() {\n requestAnimationFrame(() => {\n this.allOptEles = Array.from(this.host.querySelectorAll('nano-option'));\n this.hasNoResult = !!this.host.querySelector('[slot=\"no-result\"]');\n\n if (this.connectedInput?.value.length && this.type !== 'select') {\n this.inputChange();\n } else this.actvOptEles = this.allOptEles;\n });\n }\n\n // sets focus immediately on open when 'select' - mirroring native behaviour\n private handleShow = async () => {\n if (this.shouldFocus) {\n this.shouldFocus = false;\n this.listBox.setFocus();\n } else if (this.type === 'select') this.listBox.showActiveElement();\n };\n\n private handleHide = () => {\n this.open = false;\n const activeElement = getActiveElement();\n if (activeElement.closest(this.host.tagName.toLowerCase())) {\n this.connectedInput.select();\n }\n };\n\n // any changes to the connected input value will filter the list of active options\n private inputChange() {\n if (this.disableFilter) {\n this.actvOptEles = this.allOptEles;\n return;\n }\n\n const val = this.connectedInput.value;\n const valStr = val.trim().toLowerCase();\n\n let exactMatch = false;\n const activeEles = [];\n const attrFind = (toFind: string) =>\n toFind.toLowerCase().indexOf(valStr) > -1;\n\n this.allOptEles.forEach((opt) => {\n if (\n (val === opt.value || val === opt.label) &&\n this.type !== 'selctMulti'\n ) {\n opt.selected = true;\n exactMatch = true;\n } else this.isSelected(opt, val);\n });\n\n this.allOptEles.forEach((opt) => {\n if (!valStr.length || exactMatch) {\n activeEles.push(opt);\n } else if (\n opt.value.trim().length > 0 &&\n !opt.disabled &&\n (attrFind(opt.textContent) ||\n attrFind(opt.value) ||\n attrFind(opt.label) ||\n attrFind(opt.filterMeta))\n ) {\n activeEles.push(opt);\n }\n });\n\n this.isFiltered = valStr.length && !exactMatch;\n this.actvOptEles = activeEles;\n }\n\n private inputClick = () => {\n this.shouldOpen = true;\n // open dropdown if possible\n this.manageDropdownDisplay();\n };\n\n private inputKeydown = (e: KeyboardEvent) => {\n const ignoreKeys = [\n 'Shift',\n 'ArrowRight',\n 'ArrowLeft',\n 'Escape',\n 'Enter',\n 'Tab',\n ];\n if (ignoreKeys.includes(e.key)) {\n if (e.key === 'Tab') this.shouldOpen = false;\n return;\n }\n\n // When select, mirror native select behaviour. Search on closed list\n if (\n this.type === 'select' &&\n !['ArrowDown', 'ArrowUp'].includes(e.key) &&\n (e.key !== ' ' || this.typeToSelectTimeout)\n ) {\n if (e.key === ' ' || /^[a-z0-9]+$/i.test(e.key)) {\n clearTimeout(this.typeToSelectTimeout);\n this.typeToSelectTimeout = window.setTimeout(() => {\n this.typeToSelect = '';\n this.typeToSelectTimeout = 0;\n }, 750);\n this.typeToSelect += e.key;\n this.setOptStartsWith();\n }\n return;\n }\n\n this.shouldOpen = true;\n // open dropdown if possible\n this.manageDropdownDisplay();\n if (['ArrowDown', 'ArrowUp'].includes(e.key)) {\n e.preventDefault();\n this.shouldFocus = true;\n }\n };\n\n // handles key down on options. Either 'picks'\n // an option or passes event back to input for search / filter\n private optionKeyDown = (\n e: KeyboardEvent & { target: HTMLNanoOptionElement }\n ) => {\n const ignoreKeys = [\n 'Shift',\n 'ArrowUp',\n 'ArrowDown',\n 'Escape',\n 'Enter',\n 'Tab',\n 'Space',\n 'PageUp',\n 'PageDown',\n 'Home',\n 'End',\n ' ',\n ];\n if (ignoreKeys.includes(e.key)) {\n if (e.key === 'Escape') this.connectedInput.focus();\n return;\n }\n\n const deleteKeys = ['Delete', 'Backspace'];\n // this passes whatever's typed back to our input control\n if (\n this.type !== 'select' &&\n (!this.exactMatch || deleteKeys.includes(e.key))\n ) {\n this.connectedInput.focus();\n }\n };\n\n // Component lifecycle\n\n connectedCallback() {\n this.watchInputChange();\n }\n\n componentDidLoad() {\n this.manageSlotChangeListener();\n this.openWatcher();\n }\n\n componentDidRender(): void {\n setTimeout(() => {\n if (!this.connectedInput)\n console.warn(\n 'no `nano-input` found. `nano-datalist` should be nested within an `nano-input` or linked via `input` prop',\n this.host\n );\n }, 500);\n }\n\n render() {\n return (\n <Host\n role={this.actvOptEles.length ? 'listbox' : undefined}\n aria-owns={this.optionIds.length ? this.optionIds.join(' ') : undefined}\n aria-label={\n this.optionIds.length\n ? 'Select options from the list below'\n : undefined\n }\n >\n <nano-dropdown\n {...this.dropDownConfig}\n ref={(el) => (this.nanoDropdown = el)}\n dialogTitle=\"Select options from the list below\"\n class={{\n dlist__dropdown: true,\n 'dlist--isfiltered': this.isFiltered,\n }}\n onNanoAfterShow={this.handleShow}\n onNanoAfterHide={this.handleHide}\n role=\"group\"\n >\n <nano-menu\n hidden={!this.actvOptEles.length}\n type=\"listbox\"\n label={this.inputLabel ? this.inputLabel.textContent : undefined}\n class={{\n dlist__menu: true,\n 'dlist__menu--open': this.dropwdownOpen,\n }}\n tabIndex={-1}\n onNanoSelect={this.optSelected}\n onKeyDown={this.optionKeyDown}\n ref={(el) => (this.listBox = el)}\n role=\"list\"\n >\n <slot name=\"list-top\" />\n {!this.options.length && <slot />}\n {!!this.options.length && <slot name=\"internal-opts\" />}\n <slot name=\"list-bottom\" />\n </nano-menu>\n <nano-menu\n type=\"listbox\"\n label=\"No results found\"\n hidden={!!this.actvOptEles.length}\n class={{\n dlist__menu: true,\n 'dlist__menu--open': this.dropwdownOpen,\n }}\n >\n <slot name=\"no-result\" />\n </nano-menu>\n {!!this.actvOptEles && (\n <div class=\"dlist__status\">\n {this.actvOptEles.length} result\n {this.actvOptEles.length > 1 ? 's' : ''} available.\n </div>\n )}\n </nano-dropdown>\n </Host>\n );\n }\n}\n"]}
|
1
|
+
{"version":3,"file":"datalist.js","sourceRoot":"","sources":["../../../src/components/datalist/datalist.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EAET,CAAC,EACD,IAAI,EACJ,OAAO,EACP,KAAK,EACL,KAAK,EACL,IAAI,EACJ,KAAK,EACL,SAAS,EACT,KAAK,GAEN,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,gBAAgB,EA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ent":["import {\n Component,\n ComponentInterface,\n h,\n Host,\n Element,\n State,\n Watch,\n Prop,\n Event,\n writeTask,\n Build,\n EventEmitter,\n} from '@stencil/core';\nimport { getActiveElement } from '../../utils/active-element';\nimport { debounce } from '../../utils/throttle';\nimport type { NanoMenuCustomEvent, OptionInterface } from '../../interface';\nimport type { Dropdown } from '../dropdown/dropdown';\n\nfunction findLabel(formCtrl: Element) {\n let foundLabel: HTMLLabelElement;\n\n if (formCtrl.id) {\n foundLabel = document.querySelector(`label[for='${formCtrl.id}']`);\n }\n if (!foundLabel) {\n foundLabel = formCtrl.closest('label');\n }\n return foundLabel;\n}\n\nlet listIds = 0;\n\n/**\n * `nano-datalist` a visually consistent and more flexible replacement for a native\n * [datalist](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/datalist). Can be nested within a `nano-input`\n * or linked to any input control via the `input` prop. Is used internally within `nano-select`.\n * Options can be defined declaratively by nesting `<nano-option>` elements or imperatively using the `options` prop\n *\n * @slot - use `<nano-option>` elements for more complex html. Alternatively use the `options` prop\n * @slot list-top - shows at the top of the list when there are options present\n * @slot list-bottom - shows at the bottom of the list when there are options present\n * @slot no-result - shown when there are no results otherwise nothing will be shown\n */\n@Component({\n tag: 'nano-datalist',\n styleUrl: 'datalist.scss',\n shadow: true,\n})\nexport class DataList implements ComponentInterface {\n // Private State\n\n private isNanoInput = false;\n private typeToSelect = '';\n private typeToSelectTimeout: number;\n private nanoDropdown: HTMLNanoDropdownElement;\n private listBox: HTMLNanoMenuElement;\n private mo?: MutationObserver;\n private listId = `nano-datalist-${listIds++}`;\n private isFiltered = false;\n private shouldFocus = false;\n // all potential option eles. Set via slot or `options` prop.\n // Some may get hidden due to filtering\n private get allOptEles() {\n return this._allOptEles;\n }\n private set allOptEles(opts) {\n // when allOptEles are initially set (on slot change / options) -\n // add options to 'selected' and fire selected event *if*\n // value isn't set on the input\n this._allOptEles = opts;\n if (this.connectedInput?.value) return;\n\n opts.forEach((opt) => {\n if (opt.selected && !this.selected.includes(opt.value)) {\n this.changeInputValue(opt);\n }\n });\n }\n private _allOptEles: HTMLNanoOptionElement[] = [];\n\n @Element() host: HTMLNanoDatalistElement;\n\n // active option eles that are not hidden.\n @State() actvOptEles: HTMLNanoOptionElement[] = [];\n @State() connectedInput: HTMLInputElement | HTMLTextAreaElement;\n @State() inputLabel: HTMLLabelElement;\n @State() hasNoResult: boolean;\n @State() shouldOpen: boolean;\n @State() canOpen: boolean = true;\n @State() optionIds: string[] = [];\n\n constructor() {\n this.inputChange = debounce(this.inputChange.bind(this), 50);\n }\n\n // Public API\n\n /** By default, items in the list will appear 'selected' when the value in the linked input control matches.\n * However you can add other selected options via the the selected prop. */\n @Prop({ mutable: true }) selected: string[] = [];\n\n /** nano-dropdown config options you can pass to the nested dropdown component */\n @Prop()\n get dropDownConfig() {\n return this._dropDownConfig;\n }\n set dropDownConfig(ddc: Partial<Dropdown>) {\n this._dropDownConfig = { ...this._dropDownConfig, ...ddc };\n }\n private _dropDownConfig: Partial<Dropdown> = {\n skidding: -1,\n };\n\n /** Provide an option list.\n * Options can be defined declaratively by nesting `<nano-option>` elements or imperatively using this prop */\n @Prop() options?: OptionInterface[] = [];\n\n /** A selector to a HTMLInputElement */\n @Prop() input?: string | HTMLInputElement;\n\n /** Tweaks the datalist behaviour and linked control semantics and behaviour.\n * e.g. 'select' will make the linked input control `readonly`.\n */\n @Prop() type: 'select' | 'selctMulti' | 'input' = 'input';\n\n /** return all the active options currently within the datalist. Can be useful for validation */\n @Prop()\n get activeOptions() {\n return this.allOptEles;\n }\n\n /** Force datalist open */\n @Prop({ mutable: true }) open: boolean = false;\n\n @Watch('open')\n openWatcher() {\n writeTask(() => {\n this.nanoDropdown.open = this.open;\n if (this.connectedInput)\n this.connectedInput.setAttribute('aria-expanded', this.open.toString());\n });\n }\n\n /** Use this option to disable to default filtering. This is useful if filtering happens\n * externally via another method (e.g. via ajax)\n */\n @Prop() disableFilter = false;\n\n /** Activate / deactivate the datalist control */\n @Prop() disabled = false;\n\n // State change watchers\n\n @Watch('input')\n async watchInputChange() {\n let nanoInput;\n if ((nanoInput = this.host.closest('nano-input'))) {\n this.isNanoInput = true;\n this.connectedInput = await nanoInput.getInputElement();\n } else if (\n this.input &&\n typeof this.input === 'string' &&\n (nanoInput = document.querySelector(this.input))\n ) {\n this.isNanoInput = false;\n this.connectedInput = nanoInput;\n } else if (typeof this.input === 'object') {\n this.connectedInput = this.input;\n }\n }\n\n @Watch('options')\n manageSlotChangeListener() {\n if (!this.host) return;\n\n // we're not using `options` - setup new MO\n if ((!this.options || !this.options.length) && !this.mo) {\n if (Build.isBrowser) {\n const mo = (this.mo = new MutationObserver(() =>\n this.processSlottedContent()\n ));\n mo.observe(this.host, { childList: true, subtree: true });\n }\n this.processSlottedContent();\n return;\n }\n\n // we're using `options` - trash current MO\n if (this.options?.length) {\n if (!!this.mo) {\n this.mo.disconnect();\n this.mo = undefined;\n }\n\n const previousOptions = this.host.querySelectorAll(\n '[slot=\"internal-opts\"]'\n );\n\n // add imperative `options`\n writeTask(() => {\n // clear all previous\n if (previousOptions?.length)\n previousOptions.forEach((internalOpt) => internalOpt.remove());\n\n this.allOptEles = this.options.flatMap((option, i) => {\n if (option.value || option.label) {\n const opt = Object.assign(document.createElement('nano-option'), {\n label: option.label,\n value: option.value,\n ariaPosinset: i,\n ariaSetsize: this.options.length,\n selected: option.selected,\n id: this.listId + '-option-' + i,\n textContent: option.label ? option.label : option.value,\n slot: 'internal-opts',\n });\n this.host.append(opt);\n return opt;\n }\n });\n\n if (this.connectedInput?.value.length && this.type !== 'select') {\n this.inputChange();\n } else {\n this.actvOptEles = [...this.allOptEles];\n }\n });\n }\n // forceUpdate(this.host);\n }\n\n @Watch('type')\n @Watch('connectedInput')\n watchTypeChange() {\n if (!this.connectedInput) return;\n\n let dwConfig: Partial<Dropdown> = { closeOnSelect: false };\n let autocompleteType: 'list' | 'both' = 'both';\n let readonly = false;\n\n switch (this.type) {\n case 'input':\n dwConfig = { closeOnSelect: true };\n break;\n case 'select':\n autocompleteType = 'list';\n readonly = true;\n dwConfig = { closeOnSelect: true, placement: 'center' };\n break;\n }\n\n if (!this.isNanoInput) {\n dwConfig.tetherTo = this.connectedInput;\n }\n\n this.dropDownConfig = { ...this.dropDownConfig, ...dwConfig };\n this.connectedInput.setAttribute('aria-autocomplete', autocompleteType);\n this.connectedInput.readOnly = readonly;\n }\n\n @Watch('connectedInput')\n manageInputEvents(newInput?: HTMLInputElement, oldInput?: HTMLInputElement) {\n if (!!oldInput) {\n const nanoInput = oldInput.closest('nano-input');\n if (nanoInput) {\n nanoInput.removeEventListener('nanoChange', this.inputChange);\n }\n oldInput.removeEventListener('change', this.inputChange);\n oldInput.removeEventListener('click', this.inputClick);\n oldInput.removeEventListener('keydown', this.inputKeydown);\n oldInput.removeEventListener('input', this.inputChange);\n\n this.inputLabel = null;\n\n writeTask(() => {\n oldInput.removeAttribute('role');\n oldInput.removeAttribute('aria-expanded');\n oldInput.removeAttribute('aria-controls');\n oldInput.removeAttribute('aria-owns');\n oldInput.removeAttribute('aria-haspopup');\n oldInput.removeAttribute('aria-autocomplete');\n oldInput.removeAttribute('autocomplete');\n });\n }\n if (!!newInput) {\n const nanoInput = newInput.closest('nano-input');\n if (nanoInput) {\n nanoInput.addEventListener('nanoChange', this.inputChange);\n }\n newInput.addEventListener('change', this.inputChange);\n newInput.addEventListener('click', this.inputClick);\n newInput.addEventListener('keydown', this.inputKeydown);\n newInput.addEventListener('input', this.inputChange);\n this.listId = this.host.id || this.listId;\n\n this.inputLabel = newInput?.labels?.item(0) || findLabel(newInput);\n\n writeTask(() => {\n this.host.id = this.listId;\n newInput.setAttribute('role', 'combobox');\n newInput.setAttribute('aria-expanded', 'false');\n newInput.setAttribute('aria-controls', this.listId);\n newInput.setAttribute('aria-owns', this.listId);\n newInput.setAttribute('aria-haspopup', 'listbox');\n newInput.setAttribute('autocomplete', 'off');\n });\n }\n }\n\n @Watch('selected')\n @Watch('actvOptEles')\n watchActvOptChange() {\n let c = 0;\n const val = this.connectedInput?.value || '';\n const optIds = [];\n\n writeTask(() => {\n this.allOptEles.forEach((opt, i) => {\n if (this.actvOptEles.includes(opt)) {\n c++;\n opt.setAttribute('aria-posinset', c + '');\n opt.setAttribute('aria-setsize', this.actvOptEles.length + '');\n opt.hidden = false;\n this.isSelected(opt, val);\n } else {\n opt.removeAttribute('aria-posinset');\n opt.removeAttribute('aria-setsize');\n opt.hidden = true;\n opt.selected = false;\n }\n opt.id = this.listId + '-option-' + i;\n optIds.push(opt.id);\n });\n this.optionIds = optIds;\n });\n }\n\n @Watch('actvOptEles')\n @Watch('hasNoResult')\n manageCanOpen() {\n if (this.actvOptEles.length || this.hasNoResult) this.canOpen = true;\n else this.canOpen = false;\n }\n\n /**\n * Opens the dropdown if it can, it should and there are items to display.\n */\n @Watch('shouldOpen')\n @Watch('canOpen')\n manageDropdownDisplay() {\n if (this.shouldOpen && this.canOpen && !this.disabled) this.open = true;\n if (!this.shouldOpen || !this.canOpen) this.open = false;\n this.openWatcher();\n }\n\n @Watch('actvOptEles')\n fireActiveOptsEvent() {\n this.nanoOptionsUpdated.emit(this.actvOptEles);\n }\n\n // Events\n\n /** Fired when an item is selected. */\n @Event() nanoSelect: EventEmitter<HTMLNanoOptionElement>;\n\n /** Fired when a currently selected item is reselected. */\n @Event() nanoDeselect: EventEmitter<HTMLNanoOptionElement>;\n\n /** Fired when active options change */\n @Event() nanoOptionsUpdated: EventEmitter<HTMLNanoOptionElement[]>;\n\n // Private logic\n\n private isSelected(opt: HTMLNanoOptionElement, val: string) {\n if (val === opt.value || this.selected.includes(opt.value)) {\n opt.selected = true;\n } else opt.selected = false;\n }\n\n private get dropwdownOpen() {\n if (!this.nanoDropdown || !this.open) return false;\n return true;\n }\n\n private get exactMatch() {\n return this.allOptEles.find(\n (opt) => this.connectedInput.value === opt.value\n );\n }\n\n /** reflect value back to the connected input unless the event is cancelled */\n private changeInputValue(opt: HTMLNanoOptionElement) {\n let nanoSelected;\n\n if (this.selected.includes(opt.value)) {\n // deselect option\n this.selected = this.selected.filter((val) => val !== opt.value);\n nanoSelected = this.nanoDeselect.emit(opt);\n } else {\n // select new option\n this.selected = [...this.selected];\n nanoSelected = this.nanoSelect.emit(opt);\n }\n\n if (!nanoSelected.defaultPrevented) {\n if (this.connectedInput) this.connectedInput.value = opt.value;\n\n const event = new window.Event('change');\n this.connectedInput?.dispatchEvent(event);\n }\n }\n\n // a new option has been picked\n private optSelected = (e: NanoMenuCustomEvent<HTMLNanoOptionElement>) => {\n e.stopPropagation();\n this.changeInputValue(e.detail);\n requestAnimationFrame(() => this.inputChange());\n\n if (this.type !== 'selctMulti') this.shouldOpen = false;\n };\n\n // this is for type=\"select\" only.\n // Filter options that start with text - aggregates letters (as opposed to getting the value from input)\n private setOptStartsWith() {\n const attrFind = (toFind: string) =>\n toFind.toLowerCase().substring(0, this.typeToSelect.length) ===\n this.typeToSelect;\n\n const foundEle = this.allOptEles.find(\n (opt) =>\n opt.value.trim().length > 0 &&\n !opt.disabled &&\n (attrFind(opt.textContent) ||\n attrFind(opt.value) ||\n attrFind(opt.label) ||\n attrFind(opt.filterMeta))\n );\n if (foundEle) this.changeInputValue(foundEle);\n }\n\n // Event handlers\n\n private processSlottedContent() {\n requestAnimationFrame(() => {\n this.allOptEles = Array.from(this.host.querySelectorAll('nano-option'));\n this.hasNoResult = !!this.host.querySelector('[slot=\"no-result\"]');\n\n if (this.connectedInput?.value.length && this.type !== 'select') {\n this.inputChange();\n } else this.actvOptEles = this.allOptEles;\n });\n }\n\n // sets focus immediately on open when 'select' - mirroring native behaviour\n private handleShow = async () => {\n if (this.shouldFocus) {\n this.shouldFocus = false;\n this.listBox.setFocus();\n } else if (this.type === 'select') this.listBox.showActiveElement();\n };\n\n private handleHide = () => {\n this.open = false;\n const activeElement = getActiveElement();\n if (activeElement.closest(this.host.tagName.toLowerCase())) {\n this.connectedInput.select();\n }\n };\n\n // any changes to the connected input value will filter the list of active options\n private inputChange() {\n if (this.disableFilter) {\n this.actvOptEles = this.allOptEles;\n return;\n }\n\n const val = this.connectedInput.value;\n const valStr = val.trim().toLowerCase();\n\n let exactMatch = false;\n const activeEles = [];\n const attrFind = (toFind: string) =>\n toFind.toLowerCase().indexOf(valStr) > -1;\n\n this.allOptEles.forEach((opt) => {\n if (\n (val === opt.value || val === opt.label) &&\n this.type !== 'selctMulti'\n ) {\n opt.selected = true;\n exactMatch = true;\n } else this.isSelected(opt, val);\n });\n\n this.allOptEles.forEach((opt) => {\n if (!valStr.length || exactMatch) {\n activeEles.push(opt);\n } else if (\n opt.value.trim().length > 0 &&\n !opt.disabled &&\n (attrFind(opt.textContent) ||\n attrFind(opt.value) ||\n attrFind(opt.label) ||\n attrFind(opt.filterMeta))\n ) {\n activeEles.push(opt);\n }\n });\n\n this.isFiltered = valStr.length && !exactMatch;\n this.actvOptEles = activeEles;\n }\n\n private inputClick = () => {\n this.shouldOpen = true;\n // open dropdown if possible\n this.manageDropdownDisplay();\n };\n\n private inputKeydown = (e: KeyboardEvent) => {\n const ignoreKeys = [\n 'Shift',\n 'ArrowRight',\n 'ArrowLeft',\n 'Escape',\n 'Enter',\n 'Tab',\n ];\n if (ignoreKeys.includes(e.key)) {\n if (e.key === 'Tab') this.shouldOpen = false;\n return;\n }\n\n // When select, mirror native select behaviour. Search on closed list\n if (\n this.type === 'select' &&\n !['ArrowDown', 'ArrowUp'].includes(e.key) &&\n (e.key !== ' ' || this.typeToSelectTimeout)\n ) {\n if (e.key === ' ' || /^[a-z0-9]+$/i.test(e.key)) {\n clearTimeout(this.typeToSelectTimeout);\n this.typeToSelectTimeout = window.setTimeout(() => {\n this.typeToSelect = '';\n this.typeToSelectTimeout = 0;\n }, 750);\n this.typeToSelect += e.key;\n this.setOptStartsWith();\n }\n return;\n }\n\n this.shouldOpen = true;\n // open dropdown if possible\n this.manageDropdownDisplay();\n if (['ArrowDown', 'ArrowUp'].includes(e.key)) {\n e.preventDefault();\n this.shouldFocus = true;\n }\n };\n\n // handles key down on options. Either 'picks'\n // an option or passes event back to input for search / filter\n private optionKeyDown = (\n e: KeyboardEvent & { target: HTMLNanoOptionElement }\n ) => {\n const ignoreKeys = [\n 'Shift',\n 'ArrowUp',\n 'ArrowDown',\n 'Escape',\n 'Enter',\n 'Tab',\n 'Space',\n 'PageUp',\n 'PageDown',\n 'Home',\n 'End',\n ' ',\n ];\n if (ignoreKeys.includes(e.key)) {\n if (e.key === 'Escape') this.connectedInput.focus();\n return;\n }\n\n const deleteKeys = ['Delete', 'Backspace'];\n // this passes whatever's typed back to our input control\n if (\n this.type !== 'select' &&\n (!this.exactMatch || deleteKeys.includes(e.key))\n ) {\n this.connectedInput.focus();\n }\n };\n\n // Component lifecycle\n\n connectedCallback() {\n this.watchInputChange();\n }\n\n componentDidLoad() {\n this.manageSlotChangeListener();\n this.openWatcher();\n }\n\n componentDidRender(): void {\n setTimeout(() => {\n if (!this.connectedInput)\n console.warn(\n 'no `nano-input` found. `nano-datalist` should be nested within an `nano-input` or linked via `input` prop',\n this.host\n );\n }, 500);\n }\n\n disconnectedCallback(): void {\n if (!!this.mo) {\n this.mo.disconnect();\n this.mo = undefined;\n }\n }\n\n render() {\n return (\n <Host\n role={this.actvOptEles.length ? 'listbox' : undefined}\n aria-owns={this.optionIds.length ? this.optionIds.join(' ') : undefined}\n aria-label={\n this.optionIds.length\n ? 'Select options from the list below'\n : undefined\n }\n >\n <nano-dropdown\n {...this.dropDownConfig}\n ref={(el) => (this.nanoDropdown = el)}\n dialogTitle=\"Select options from the list below\"\n class={{\n dlist__dropdown: true,\n 'dlist--isfiltered': this.isFiltered,\n }}\n onNanoAfterShow={this.handleShow}\n onNanoAfterHide={this.handleHide}\n role=\"group\"\n >\n <nano-menu\n hidden={!this.actvOptEles.length}\n type=\"listbox\"\n label={this.inputLabel ? this.inputLabel.textContent : undefined}\n class={{\n dlist__menu: true,\n 'dlist__menu--open': this.dropwdownOpen,\n }}\n tabIndex={-1}\n onNanoSelect={this.optSelected}\n onKeyDown={this.optionKeyDown}\n ref={(el) => (this.listBox = el)}\n role=\"list\"\n >\n <slot name=\"list-top\" />\n {!this.options.length && <slot />}\n {!!this.options.length && <slot name=\"internal-opts\" />}\n <slot name=\"list-bottom\" />\n </nano-menu>\n <nano-menu\n type=\"listbox\"\n label=\"No results found\"\n hidden={!!this.actvOptEles.length}\n class={{\n dlist__menu: true,\n 'dlist__menu--open': this.dropwdownOpen,\n }}\n >\n <slot name=\"no-result\" />\n </nano-menu>\n {!!this.actvOptEles && (\n <div class=\"dlist__status\">\n {this.actvOptEles.length} result\n {this.actvOptEles.length > 1 ? 's' : ''} available.\n </div>\n )}\n </nano-dropdown>\n </Host>\n );\n }\n}\n"]}
|
@@ -20,6 +20,7 @@
|
|
20
20
|
* @prop --scrim-color: overlay colour of alert display. Defaults to var(--nano-layer-overlay-dark, rgb(74 74 74 / 50%));
|
21
21
|
* @prop --tint-color: colour used to highlight items in the dialog - top ribbon, bottom close button. Default #007495;
|
22
22
|
* @prop --width: defaults to 31rem;
|
23
|
+
* @prop --nano-layer-overlay-blur: inheritable theme applied to backdrop. Default to var(--nano-layer-overlay-blur, 3px)
|
23
24
|
*/
|
24
25
|
:host {
|
25
26
|
--border-radius: var(--nano-layer-border-radius, var(--nano-border-radius-medium, 4px));
|
@@ -166,7 +166,7 @@ export class Dialog {
|
|
166
166
|
'dialog--has-header': !this.noHeader,
|
167
167
|
'dialog--nodismiss': this.noDismiss,
|
168
168
|
'dialog--with-ribbon': this.showRibbon,
|
169
|
-
}, onKeyDown: this.handleKeyDown }, h("div", { part: "overlay", class: "dialog__overlay", ref: (el) => (this.overlay = el), onClick: this.requestClose }), h("div", { ref: (el) => (this.panel = el), part: "panel", class: "dialog__panel", role: "dialog", "aria-modal": "true", "aria-hidden": this.open ? 'false' : 'true', "aria-label": this.noHeader ? this.label : null, "aria-labelledby": !this.noHeader ? `${this.componentId}-title` : null, tabIndex: 0 }, h("div", { class: "dialog__body-wrap" }, !this.noHeader && (h("nano-sticker", null, h("header", { part: "header", class: "dialog__header" }, h("span", { part: "title", class: "dialog__title", id: `${this.componentId}-title` }, h("slot", { name: "label" }, this.label || String.fromCharCode(65279))), !this.noUserDismiss && (h("nano-icon-button", { exportparts: "base:close-button", class: "dialog__close-icon", label: "close dialog", onClick: this.requestClose, iconName: "light/times" }))))), h("div", { part: "body", class: "dialog__body" }, h("slot", null)), !this.noFooter && (this.hasFooter || !this.noUserDismiss) && (h("nano-sticker", { position: "bottom" }, h("footer", { part: "footer", class: "dialog__footer" }, h("slot", { name: "footer", onSlotchange: this.handleSlotChange }), !this.noUserDismiss && (h("button", { class: "dialog__close-txt", onClick: this.requestClose }, "Close"))))))))));
|
169
|
+
}, onKeyDown: this.handleKeyDown }, h("div", { part: "overlay", class: "dialog__overlay", ref: (el) => (this.overlay = el), onClick: this.requestClose }), h("div", { ref: (el) => (this.panel = el), part: "panel", class: "dialog__panel", role: "dialog", "aria-modal": "true", "aria-hidden": this.open ? 'false' : 'true', "aria-label": this.noHeader ? this.label : null, "aria-labelledby": !this.noHeader ? `${this.componentId}-title` : null, tabIndex: 0 }, h("div", { class: "dialog__body-wrap" }, !this.noHeader && (h("nano-sticker", null, h("header", { part: "header", class: "dialog__header" }, h("span", { part: "title", class: "dialog__title", id: `${this.componentId}-title` }, h("slot", { name: "label" }, this.label || String.fromCharCode(65279))), !this.noUserDismiss && (h("nano-icon-button", { exportparts: "base:close-button", class: "dialog__close-icon", label: "close dialog", onClick: this.requestClose, iconName: "light/times" }))))), h("div", { part: "body", class: "dialog__body", style: { display: !this.isVisible ? 'none' : '' } }, h("slot", null)), !this.noFooter && (this.hasFooter || !this.noUserDismiss) && (h("nano-sticker", { position: "bottom" }, h("footer", { part: "footer", class: "dialog__footer" }, h("slot", { name: "footer", onSlotchange: this.handleSlotChange }), !this.noUserDismiss && (h("button", { class: "dialog__close-txt", onClick: this.requestClose }, "Close"))))))))));
|
170
170
|
}
|
171
171
|
static get is() { return "nano-dialog"; }
|
172
172
|
static get encapsulation() { return "shadow"; }
|
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AC5D,oBAAc,QAAQ,EAAC,QAAQ;cAC7B,cAAQ,IAAI,EAAC,QAAQ,EAAC,KAAK,EAAC,gBAAgB;gBAC1C,YAAM,IAAI,EAAC,QAAQ,EAAC,YAAY,EAAE,IAAI,CAAC,gBAAgB,GAAI;gBAC1D,CAAC,IAAI,CAAC,aAAa,IAAI,CACtB,cACE,KAAK,EAAC,mBAAmB,EACzB,OAAO,EAAE,IAAI,CAAC,YAAY,YAGnB,CACV,CACM,CACI,CAChB,CACG,CACF,CACF,CACD,CACR,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {\n Component,\n Element,\n Event,\n EventEmitter,\n Method,\n Prop,\n State,\n Watch,\n h,\n Host,\n ComponentInterface,\n} from '@stencil/core';\nimport Modal from '../../utils/modal';\nimport { lockBodyScrolling, unlockBodyScrolling } from '../../utils/scroll';\nimport { hasSlot } from '../../utils/slot';\nimport {\n ComponentStore,\n StorageMethods,\n} from '../../utils/store/component-store';\n\nlet id = 0;\n\n/**\n * Dialogs, sometimes called \"modals\", appear above the page and require the user's immediate attention.\n *\n * @slot - The dialog's content.\n * @slot label - The dialog's label. Alternatively, you can use the label prop.\n * @slot footer - The dialog's footer, usually one or more buttons representing various options.\n */\n@Component({\n tag: 'nano-dialog',\n styleUrl: 'dialog.scss',\n shadow: true,\n})\nexport class Dialog implements ComponentInterface {\n private componentId = `dialog-${++id}`;\n private modal: Modal;\n private panel: HTMLElement;\n private willShow = false;\n private willHide = false;\n private originalTrigger: HTMLElement | null;\n private overlay: HTMLElement;\n private addedTransEnd = false;\n\n @Element() host: HTMLNanoDialogElement;\n @State() isVisible = false;\n @State() noDismiss = false;\n @State() hasFooter = false;\n\n /** Show a colour ribbon at the top of the modal */\n @Prop() showRibbon = true;\n\n /** Indicates whether or not the dialog is open. You can use this in lieu of the show/hide methods. */\n @Prop({ mutable: true, reflect: true }) open = false;\n\n @Watch('open')\n handleOpenChange() {\n this.open ? this.show() : this.hide();\n }\n\n /** The dialog's label as displayed in the header. You should always include a relevant\n * label even when using `no-header`, as it is required for proper accessibility. */\n @Prop() label!: string;\n\n /** Set to true to disable the header. This will also remove the default close button,\n * so please ensure you provide an easy, accessible way for users to dismiss the dialog. */\n @Prop() noHeader = false;\n\n /** Set to true to disable the footer. This will also remove the footer close button,\n * so please ensure you provide an easy, accessible way for users to dismiss the dialog. */\n @Prop() noFooter = false;\n\n /** An alternative to `preventDefault()` on the `nanoRequestClose` event. This will hide the close button and disable clicks on the overlay or presses the `Escape` key */\n @Prop() noUserDismiss = false;\n\n /** Store search queries (against this ID) to the component store. Use in conjunction with storeMethod */\n @Prop() storeId?: string;\n\n /** The method of storage. Either session storage, url hash (after the '#') or url query (after the '?'). */\n @Prop() storeMethod: StorageMethods = 'url-hash';\n\n /** Relocate the dialog to the root of the DOM. Useful for elements bound via css `transform: ...` */\n @Prop() hoist = false;\n\n @Watch('hoist')\n handleHoistChange() {\n if (!this.hoist || document.body.children[0] === this.host) return;\n document.body.prepend(this.host);\n }\n\n /** Emitted when the dialog opens. Calling `event.preventDefault()` will prevent it from being opened. */\n @Event() nanoShow: EventEmitter;\n\n /** Emitted after the dialog opens and all transitions are complete. */\n @Event() nanoAfterShow: EventEmitter;\n\n /** Emitted when the dialog closes. Calling `event.preventDefault()` will prevent it from being closed. */\n @Event() nanoHide: EventEmitter;\n\n /** Emitted after the dialog closes and all transitions are complete. */\n @Event() nanoAfterHide: EventEmitter;\n\n /** Emitted when the dialog opens and the panel gains focus. Calling `event.preventDefault()` will prevent\n * focus and allow you to set it on a different element in the dialog, such as an input or button. */\n @Event() nanoInitialFocus: EventEmitter;\n\n /** Emitted when the user clicks the close button, clicks the overlay, or presses the `Escape` key. Calling `event.preventDefault()` will prevent the dialog from closing. */\n @Event() nanoRequestClose: EventEmitter;\n\n /** Shows the dialog */\n @Method()\n async show() {\n if (this.willShow) {\n return;\n }\n\n const nanoShow = this.nanoShow.emit();\n if (nanoShow.defaultPrevented) {\n this.open = false;\n return;\n }\n\n this.originalTrigger = document.activeElement as HTMLElement;\n this.willShow = true;\n this.isVisible = true;\n this.open = true;\n this.modal.activate();\n\n lockBodyScrolling(this.host);\n\n if (this.open) {\n // Wait for the next frame before setting initial focus so the dialog is technically visible\n this.host.addEventListener(\n 'nanoAfterShow',\n () => {\n const nanoInitialFocus = this.nanoInitialFocus.emit();\n if (!nanoInitialFocus.defaultPrevented) {\n this.panel.focus({ preventScroll: true });\n }\n },\n { once: true }\n );\n }\n }\n\n /** Hides the dialog */\n @Method()\n async hide() {\n if (this.willHide) {\n return;\n }\n\n const nanoHide = this.nanoHide.emit();\n if (nanoHide.defaultPrevented) {\n this.open = true;\n return;\n }\n\n this.willHide = true;\n this.open = false;\n this.modal.deactivate();\n unlockBodyScrolling(this.host);\n this.stopVideos();\n\n // Restore focus to the original trigger\n const trigger = this.originalTrigger;\n if (trigger && typeof trigger.focus === 'function') {\n setTimeout(() => trigger.focus());\n }\n }\n\n private handleKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n this.requestClose();\n }\n };\n\n private requestClose = () => {\n const nanoOverlayDismiss = this.nanoRequestClose.emit();\n\n if (!nanoOverlayDismiss.defaultPrevented && !this.noUserDismiss) {\n this.hide();\n } else {\n this.noDismiss = true;\n setTimeout((_) => (this.noDismiss = false), 250);\n }\n };\n\n private handleTransitionEnd = (event: TransitionEvent) => {\n if (\n event.propertyName === 'opacity' &&\n event\n .composedPath()\n .find((node) => node === this.panel || node === this.overlay)\n ) {\n // Ensure we only emit one event when the target element is no longer visible\n this.isVisible = this.open;\n this.willShow = false;\n this.willHide = false;\n this.open ? this.nanoAfterShow.emit() : this.nanoAfterHide.emit();\n }\n };\n\n private handleSlotChange = () => {\n this.hasFooter = hasSlot(this.host, 'footer');\n };\n\n private stopVideos() {\n const videos: (HTMLVideoElement | HTMLIFrameElement)[] = Array.from(\n this.host.querySelectorAll('iframe,video')\n );\n videos.forEach((video) => {\n if (video.tagName.toLowerCase() === 'video')\n (video as HTMLVideoElement).pause();\n else {\n const src = video.src;\n video.src = src;\n }\n });\n }\n\n connectedCallback() {\n this.handleHoistChange();\n this.modal = new Modal(this.host);\n if (this.panel) {\n this.addedTransEnd = true;\n this.panel.addEventListener('transitionend', this.handleTransitionEnd);\n }\n }\n\n componentWillLoad() {\n this.handleSlotChange();\n // Show on init if open\n if (this.open) this.show();\n if (this.storeId)\n ComponentStore.init(this, ['open'], this.storeMethod, this.storeId);\n }\n\n componentDidLoad() {\n if (!this.addedTransEnd) {\n this.panel.addEventListener('transitionend', this.handleTransitionEnd);\n }\n }\n\n disconnectedCallback() {\n if (!this.panel) return;\n unlockBodyScrolling(this.host);\n this.addedTransEnd = false;\n this.panel.removeEventListener('transitionend', this.handleTransitionEnd);\n }\n\n render() {\n return (\n <Host showing={this.isVisible ? true : undefined}>\n <div\n part=\"base\"\n class={{\n dialog: true,\n 'dialog--open': this.open,\n 'dialog--visible': this.isVisible,\n 'dialog--has-footer': !this.noFooter,\n 'dialog--has-header': !this.noHeader,\n 'dialog--nodismiss': this.noDismiss,\n 'dialog--with-ribbon': this.showRibbon,\n }}\n onKeyDown={this.handleKeyDown}\n >\n <div\n part=\"overlay\"\n class=\"dialog__overlay\"\n ref={(el) => (this.overlay = el)}\n onClick={this.requestClose}\n />\n\n <div\n ref={(el) => (this.panel = el)}\n part=\"panel\"\n class=\"dialog__panel\"\n role=\"dialog\"\n aria-modal=\"true\"\n aria-hidden={this.open ? 'false' : 'true'}\n aria-label={this.noHeader ? this.label : null}\n aria-labelledby={\n !this.noHeader ? `${this.componentId}-title` : null\n }\n tabIndex={0}\n >\n <div class=\"dialog__body-wrap\">\n {!this.noHeader && (\n <nano-sticker>\n <header part=\"header\" class=\"dialog__header\">\n <span\n part=\"title\"\n class=\"dialog__title\"\n id={`${this.componentId}-title`}\n >\n <slot name=\"label\">\n {/* If there's no label, use an invisible character to prevent the heading from collapsing */}\n {this.label || String.fromCharCode(65279)}\n </slot>\n </span>\n {!this.noUserDismiss && (\n <nano-icon-button\n exportparts=\"base:close-button\"\n class=\"dialog__close-icon\"\n label=\"close dialog\"\n onClick={this.requestClose}\n iconName=\"light/times\"\n />\n )}\n </header>\n </nano-sticker>\n )}\n <div part=\"body\" class=\"dialog__body\">\n <slot />\n </div>\n {!this.noFooter && (this.hasFooter || !this.noUserDismiss) && (\n <nano-sticker position=\"bottom\">\n <footer part=\"footer\" class=\"dialog__footer\">\n <slot name=\"footer\" onSlotchange={this.handleSlotChange} />\n {!this.noUserDismiss && (\n <button\n class=\"dialog__close-txt\"\n onClick={this.requestClose}\n >\n Close\n </button>\n )}\n </footer>\n </nano-sticker>\n )}\n </div>\n </div>\n </div>\n </Host>\n );\n }\n}\n"]}
|
1
|
+
{"version":3,"file":"dialog.js","sourceRoot":"","sources":["../../../src/components/dialog/dialog.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,OAAO,EACP,KAAK,EAEL,MAAM,EACN,IAAI,EACJ,KAAK,EACL,KAAK,EACL,CAAC,EACD,IAAI,GAEL,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,MAAM,mBAAmB,CAAC;AACtC,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAC5E,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EACL,cAAc,GAEf,MAAM,mCAAm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ACD,CACR,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {\n Component,\n Element,\n Event,\n EventEmitter,\n Method,\n Prop,\n State,\n Watch,\n h,\n Host,\n ComponentInterface,\n} from '@stencil/core';\nimport Modal from '../../utils/modal';\nimport { lockBodyScrolling, unlockBodyScrolling } from '../../utils/scroll';\nimport { hasSlot } from '../../utils/slot';\nimport {\n ComponentStore,\n StorageMethods,\n} from '../../utils/store/component-store';\n\nlet id = 0;\n\n/**\n * Dialogs, sometimes called \"modals\", appear above the page and require the user's immediate attention.\n *\n * @slot - The dialog's content.\n * @slot label - The dialog's label. Alternatively, you can use the label prop.\n * @slot footer - The dialog's footer, usually one or more buttons representing various options.\n */\n@Component({\n tag: 'nano-dialog',\n styleUrl: 'dialog.scss',\n shadow: true,\n})\nexport class Dialog implements ComponentInterface {\n private componentId = `dialog-${++id}`;\n private modal: Modal;\n private panel: HTMLElement;\n private willShow = false;\n private willHide = false;\n private originalTrigger: HTMLElement | null;\n private overlay: HTMLElement;\n private addedTransEnd = false;\n\n @Element() host: HTMLNanoDialogElement;\n @State() isVisible = false;\n @State() noDismiss = false;\n @State() hasFooter = false;\n\n /** Show a colour ribbon at the top of the modal */\n @Prop() showRibbon = true;\n\n /** Indicates whether or not the dialog is open. You can use this in lieu of the show/hide methods. */\n @Prop({ mutable: true, reflect: true }) open = false;\n\n @Watch('open')\n handleOpenChange() {\n this.open ? this.show() : this.hide();\n }\n\n /** The dialog's label as displayed in the header. You should always include a relevant\n * label even when using `no-header`, as it is required for proper accessibility. */\n @Prop() label!: string;\n\n /** Set to true to disable the header. This will also remove the default close button,\n * so please ensure you provide an easy, accessible way for users to dismiss the dialog. */\n @Prop() noHeader = false;\n\n /** Set to true to disable the footer. This will also remove the footer close button,\n * so please ensure you provide an easy, accessible way for users to dismiss the dialog. */\n @Prop() noFooter = false;\n\n /** An alternative to `preventDefault()` on the `nanoRequestClose` event. This will hide the close button and disable clicks on the overlay or presses the `Escape` key */\n @Prop() noUserDismiss = false;\n\n /** Store search queries (against this ID) to the component store. Use in conjunction with storeMethod */\n @Prop() storeId?: string;\n\n /** The method of storage. Either session storage, url hash (after the '#') or url query (after the '?'). */\n @Prop() storeMethod: StorageMethods = 'url-hash';\n\n /** Relocate the dialog to the root of the DOM. Useful for elements bound via css `transform: ...` */\n @Prop() hoist = false;\n\n @Watch('hoist')\n handleHoistChange() {\n if (!this.hoist || document.body.children[0] === this.host) return;\n document.body.prepend(this.host);\n }\n\n /** Emitted when the dialog opens. Calling `event.preventDefault()` will prevent it from being opened. */\n @Event() nanoShow: EventEmitter;\n\n /** Emitted after the dialog opens and all transitions are complete. */\n @Event() nanoAfterShow: EventEmitter;\n\n /** Emitted when the dialog closes. Calling `event.preventDefault()` will prevent it from being closed. */\n @Event() nanoHide: EventEmitter;\n\n /** Emitted after the dialog closes and all transitions are complete. */\n @Event() nanoAfterHide: EventEmitter;\n\n /** Emitted when the dialog opens and the panel gains focus. Calling `event.preventDefault()` will prevent\n * focus and allow you to set it on a different element in the dialog, such as an input or button. */\n @Event() nanoInitialFocus: EventEmitter;\n\n /** Emitted when the user clicks the close button, clicks the overlay, or presses the `Escape` key. Calling `event.preventDefault()` will prevent the dialog from closing. */\n @Event() nanoRequestClose: EventEmitter;\n\n /** Shows the dialog */\n @Method()\n async show() {\n if (this.willShow) {\n return;\n }\n\n const nanoShow = this.nanoShow.emit();\n if (nanoShow.defaultPrevented) {\n this.open = false;\n return;\n }\n\n this.originalTrigger = document.activeElement as HTMLElement;\n this.willShow = true;\n this.isVisible = true;\n this.open = true;\n this.modal.activate();\n\n lockBodyScrolling(this.host);\n\n if (this.open) {\n // Wait for the next frame before setting initial focus so the dialog is technically visible\n this.host.addEventListener(\n 'nanoAfterShow',\n () => {\n const nanoInitialFocus = this.nanoInitialFocus.emit();\n if (!nanoInitialFocus.defaultPrevented) {\n this.panel.focus({ preventScroll: true });\n }\n },\n { once: true }\n );\n }\n }\n\n /** Hides the dialog */\n @Method()\n async hide() {\n if (this.willHide) {\n return;\n }\n\n const nanoHide = this.nanoHide.emit();\n if (nanoHide.defaultPrevented) {\n this.open = true;\n return;\n }\n\n this.willHide = true;\n this.open = false;\n this.modal.deactivate();\n unlockBodyScrolling(this.host);\n this.stopVideos();\n\n // Restore focus to the original trigger\n const trigger = this.originalTrigger;\n if (trigger && typeof trigger.focus === 'function') {\n setTimeout(() => trigger.focus());\n }\n }\n\n private handleKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n this.requestClose();\n }\n };\n\n private requestClose = () => {\n const nanoOverlayDismiss = this.nanoRequestClose.emit();\n\n if (!nanoOverlayDismiss.defaultPrevented && !this.noUserDismiss) {\n this.hide();\n } else {\n this.noDismiss = true;\n setTimeout((_) => (this.noDismiss = false), 250);\n }\n };\n\n private handleTransitionEnd = (event: TransitionEvent) => {\n if (\n event.propertyName === 'opacity' &&\n event\n .composedPath()\n .find((node) => node === this.panel || node === this.overlay)\n ) {\n // Ensure we only emit one event when the target element is no longer visible\n this.isVisible = this.open;\n this.willShow = false;\n this.willHide = false;\n this.open ? this.nanoAfterShow.emit() : this.nanoAfterHide.emit();\n }\n };\n\n private handleSlotChange = () => {\n this.hasFooter = hasSlot(this.host, 'footer');\n };\n\n private stopVideos() {\n const videos: (HTMLVideoElement | HTMLIFrameElement)[] = Array.from(\n this.host.querySelectorAll('iframe,video')\n );\n videos.forEach((video) => {\n if (video.tagName.toLowerCase() === 'video')\n (video as HTMLVideoElement).pause();\n else {\n const src = video.src;\n video.src = src;\n }\n });\n }\n\n connectedCallback() {\n this.handleHoistChange();\n this.modal = new Modal(this.host);\n if (this.panel) {\n this.addedTransEnd = true;\n this.panel.addEventListener('transitionend', this.handleTransitionEnd);\n }\n }\n\n componentWillLoad() {\n this.handleSlotChange();\n // Show on init if open\n if (this.open) this.show();\n if (this.storeId)\n ComponentStore.init(this, ['open'], this.storeMethod, this.storeId);\n }\n\n componentDidLoad() {\n if (!this.addedTransEnd) {\n this.panel.addEventListener('transitionend', this.handleTransitionEnd);\n }\n }\n\n disconnectedCallback() {\n if (!this.panel) return;\n unlockBodyScrolling(this.host);\n this.addedTransEnd = false;\n this.panel.removeEventListener('transitionend', this.handleTransitionEnd);\n }\n\n render() {\n return (\n <Host showing={this.isVisible ? true : undefined}>\n <div\n part=\"base\"\n class={{\n dialog: true,\n 'dialog--open': this.open,\n 'dialog--visible': this.isVisible,\n 'dialog--has-footer': !this.noFooter,\n 'dialog--has-header': !this.noHeader,\n 'dialog--nodismiss': this.noDismiss,\n 'dialog--with-ribbon': this.showRibbon,\n }}\n onKeyDown={this.handleKeyDown}\n >\n <div\n part=\"overlay\"\n class=\"dialog__overlay\"\n ref={(el) => (this.overlay = el)}\n onClick={this.requestClose}\n />\n\n <div\n ref={(el) => (this.panel = el)}\n part=\"panel\"\n class=\"dialog__panel\"\n role=\"dialog\"\n aria-modal=\"true\"\n aria-hidden={this.open ? 'false' : 'true'}\n aria-label={this.noHeader ? this.label : null}\n aria-labelledby={\n !this.noHeader ? `${this.componentId}-title` : null\n }\n tabIndex={0}\n >\n <div class=\"dialog__body-wrap\">\n {!this.noHeader && (\n <nano-sticker>\n <header part=\"header\" class=\"dialog__header\">\n <span\n part=\"title\"\n class=\"dialog__title\"\n id={`${this.componentId}-title`}\n >\n <slot name=\"label\">\n {/* If there's no label, use an invisible character to prevent the heading from collapsing */}\n {this.label || String.fromCharCode(65279)}\n </slot>\n </span>\n {!this.noUserDismiss && (\n <nano-icon-button\n exportparts=\"base:close-button\"\n class=\"dialog__close-icon\"\n label=\"close dialog\"\n onClick={this.requestClose}\n iconName=\"light/times\"\n />\n )}\n </header>\n </nano-sticker>\n )}\n <div\n part=\"body\"\n class=\"dialog__body\"\n style={{ display: !this.isVisible ? 'none' : '' }}\n >\n <slot />\n </div>\n {!this.noFooter && (this.hasFooter || !this.noUserDismiss) && (\n <nano-sticker position=\"bottom\">\n <footer part=\"footer\" class=\"dialog__footer\">\n <slot name=\"footer\" onSlotchange={this.handleSlotChange} />\n {!this.noUserDismiss && (\n <button\n class=\"dialog__close-txt\"\n onClick={this.requestClose}\n >\n Close\n </button>\n )}\n </footer>\n </nano-sticker>\n )}\n </div>\n </div>\n </div>\n </Host>\n );\n }\n}\n"]}
|
@@ -87,7 +87,7 @@ export class FieldValidator {
|
|
87
87
|
return;
|
88
88
|
}
|
89
89
|
}
|
90
|
-
this.scrollToFirstInvalid();
|
90
|
+
this.scrollToFirstInvalid(false);
|
91
91
|
this.nanoInvalid.emit();
|
92
92
|
};
|
93
93
|
this.submitted = false;
|
@@ -234,14 +234,19 @@ export class FieldValidator {
|
|
234
234
|
}
|
235
235
|
/**
|
236
236
|
* Sets custom validity for all / some form fields.
|
237
|
-
* @param validity - a validity object of `{fieldName: errorString}` pairs.
|
237
|
+
* @param validity - a validity object of `{fieldName: errorString}` pairs.
|
238
|
+
* Set as an empty string to clear the error.
|
239
|
+
* @param scrollToInvalid - whether to scroll to the first invalid field.
|
240
|
+
* If not present, will follow the value set on `scrollToInvalid` prop.
|
238
241
|
*/
|
239
|
-
async setCustomValidity(validity) {
|
242
|
+
async setCustomValidity(validity, scrollToInvalid) {
|
240
243
|
return await Promise.all(Object.entries(validity).map(async ([key, err]) => {
|
241
244
|
const field = this.allFields.find((f) => this.getName(f) === key);
|
242
245
|
if (!!field)
|
243
246
|
await this.setFieldError(field, err);
|
244
|
-
}))
|
247
|
+
})).finally(() => {
|
248
|
+
this.scrollToFirstInvalid(scrollToInvalid);
|
249
|
+
});
|
245
250
|
}
|
246
251
|
/**
|
247
252
|
* Clear all custom validation.
|
@@ -250,6 +255,23 @@ export class FieldValidator {
|
|
250
255
|
async resetValidity() {
|
251
256
|
return await Promise.all(this.allFields.map(async (field) => await this.setFieldError(field, '')));
|
252
257
|
}
|
258
|
+
/**
|
259
|
+
* Scrolls to first invalid form field.
|
260
|
+
* @param force - forces the scroll behaviour (default). Otherwise will use the default set in `scrollToInvalid` prop
|
261
|
+
*/
|
262
|
+
async scrollToFirstInvalid(force = true) {
|
263
|
+
if (!force && !this.scrollToInvalid)
|
264
|
+
return;
|
265
|
+
setTimeout(() => {
|
266
|
+
const invalidField = this.validationState.find((f) => !f.valid);
|
267
|
+
if (!invalidField)
|
268
|
+
return;
|
269
|
+
invalidField.fields[0].scrollIntoView({
|
270
|
+
behavior: 'smooth',
|
271
|
+
block: 'nearest',
|
272
|
+
});
|
273
|
+
}, 200);
|
274
|
+
}
|
253
275
|
// private methods
|
254
276
|
attachSlotObserver() {
|
255
277
|
if (!!this.mo)
|
@@ -346,6 +368,15 @@ export class FieldValidator {
|
|
346
368
|
field.value = this._store.state[fieldName];
|
347
369
|
});
|
348
370
|
}
|
371
|
+
getValidityTarget(field) {
|
372
|
+
let validityTarget = field;
|
373
|
+
if (field.tagName === 'NANO-CHECKBOX') {
|
374
|
+
// if we have a checkbox-group, set the validation message there
|
375
|
+
const cbg = field.closest('nano-checkbox-group');
|
376
|
+
validityTarget = cbg || field;
|
377
|
+
}
|
378
|
+
return validityTarget;
|
379
|
+
}
|
349
380
|
/** Loops through all `nano-...` fields and extracts their values into our store */
|
350
381
|
fieldsToStore(fields, init = false) {
|
351
382
|
fields.forEach((field) => {
|
@@ -437,12 +468,7 @@ export class FieldValidator {
|
|
437
468
|
return validityState.fields.map(async (fieldName) => {
|
438
469
|
// switch on/off validation messages
|
439
470
|
const field = this.allFields.find((f) => this.getName(f) === fieldName);
|
440
|
-
|
441
|
-
if (field.tagName === 'NANO-CHECKBOX') {
|
442
|
-
// if we have a checkbox-group, set the validation message there
|
443
|
-
const cbg = field.closest('nano-checkbox-group');
|
444
|
-
validityTarget = cbg || field;
|
445
|
-
}
|
471
|
+
const validityTarget = this.getValidityTarget(field);
|
446
472
|
if ((validityTarget.validityMessage ||
|
447
473
|
validityTarget.validationMessage) === msg &&
|
448
474
|
validityState.valid) {
|
@@ -471,26 +497,14 @@ export class FieldValidator {
|
|
471
497
|
* @param msg
|
472
498
|
*/
|
473
499
|
async setFieldError(field, msg) {
|
474
|
-
|
475
|
-
|
500
|
+
const validityTarget = this.getValidityTarget(field);
|
501
|
+
if (validityTarget['showError']) {
|
502
|
+
await validityTarget.showError(msg);
|
476
503
|
}
|
477
|
-
else if (
|
478
|
-
await
|
504
|
+
else if (validityTarget['setError'])
|
505
|
+
await validityTarget.setError(msg);
|
479
506
|
else
|
480
|
-
|
481
|
-
}
|
482
|
-
scrollToFirstInvalid() {
|
483
|
-
if (!this.scrollToInvalid)
|
484
|
-
return;
|
485
|
-
setTimeout(() => {
|
486
|
-
const invalidField = this.validationState.find((f) => !f.valid);
|
487
|
-
if (!invalidField)
|
488
|
-
return;
|
489
|
-
invalidField.fields[0].scrollIntoView({
|
490
|
-
behavior: 'smooth',
|
491
|
-
block: 'nearest',
|
492
|
-
});
|
493
|
-
}, 200);
|
507
|
+
validityTarget.setCustomValidity(msg);
|
494
508
|
}
|
495
509
|
submitForm() {
|
496
510
|
const nanoSubmit = this.nanoSubmit.emit();
|
@@ -531,7 +545,7 @@ export class FieldValidator {
|
|
531
545
|
this._valid = this.activeForm.checkValidity();
|
532
546
|
this.internalValidate = false;
|
533
547
|
if (!this._valid) {
|
534
|
-
this.scrollToFirstInvalid();
|
548
|
+
this.scrollToFirstInvalid(false);
|
535
549
|
return;
|
536
550
|
}
|
537
551
|
this.submitForm();
|
@@ -882,13 +896,19 @@ export class FieldValidator {
|
|
882
896
|
},
|
883
897
|
"setCustomValidity": {
|
884
898
|
"complexType": {
|
885
|
-
"signature": "(validity: { [key: string]: string; }) => Promise<void[]>",
|
899
|
+
"signature": "(validity: { [key: string]: string; }, scrollToInvalid?: boolean) => Promise<void[]>",
|
886
900
|
"parameters": [{
|
887
901
|
"tags": [{
|
888
902
|
"name": "param",
|
889
|
-
"text": "validity - a validity object of `{fieldName: errorString}` pairs
|
903
|
+
"text": "validity - a validity object of `{fieldName: errorString}` pairs.\nSet as an empty string to clear the error."
|
890
904
|
}],
|
891
|
-
"text": "- a validity object of `{fieldName: errorString}` pairs
|
905
|
+
"text": "- a validity object of `{fieldName: errorString}` pairs.\nSet as an empty string to clear the error."
|
906
|
+
}, {
|
907
|
+
"tags": [{
|
908
|
+
"name": "param",
|
909
|
+
"text": "scrollToInvalid - whether to scroll to the first invalid field.\nIf not present, will follow the value set on `scrollToInvalid` prop."
|
910
|
+
}],
|
911
|
+
"text": "- whether to scroll to the first invalid field.\nIf not present, will follow the value set on `scrollToInvalid` prop."
|
892
912
|
}],
|
893
913
|
"references": {
|
894
914
|
"Promise": {
|
@@ -901,7 +921,10 @@ export class FieldValidator {
|
|
901
921
|
"text": "Sets custom validity for all / some form fields.",
|
902
922
|
"tags": [{
|
903
923
|
"name": "param",
|
904
|
-
"text": "validity - a validity object of `{fieldName: errorString}` pairs
|
924
|
+
"text": "validity - a validity object of `{fieldName: errorString}` pairs.\nSet as an empty string to clear the error."
|
925
|
+
}, {
|
926
|
+
"name": "param",
|
927
|
+
"text": "scrollToInvalid - whether to scroll to the first invalid field.\nIf not present, will follow the value set on `scrollToInvalid` prop."
|
905
928
|
}]
|
906
929
|
}
|
907
930
|
},
|
@@ -923,6 +946,31 @@ export class FieldValidator {
|
|
923
946
|
"text": "a promise, resolved when all errors are cleared"
|
924
947
|
}]
|
925
948
|
}
|
949
|
+
},
|
950
|
+
"scrollToFirstInvalid": {
|
951
|
+
"complexType": {
|
952
|
+
"signature": "(force?: boolean) => Promise<void>",
|
953
|
+
"parameters": [{
|
954
|
+
"tags": [{
|
955
|
+
"name": "param",
|
956
|
+
"text": "force - forces the scroll behaviour (default). Otherwise will use the default set in `scrollToInvalid` prop"
|
957
|
+
}],
|
958
|
+
"text": "- forces the scroll behaviour (default). Otherwise will use the default set in `scrollToInvalid` prop"
|
959
|
+
}],
|
960
|
+
"references": {
|
961
|
+
"Promise": {
|
962
|
+
"location": "global"
|
963
|
+
}
|
964
|
+
},
|
965
|
+
"return": "Promise<void>"
|
966
|
+
},
|
967
|
+
"docs": {
|
968
|
+
"text": "Scrolls to first invalid form field.",
|
969
|
+
"tags": [{
|
970
|
+
"name": "param",
|
971
|
+
"text": "force - forces the scroll behaviour (default). Otherwise will use the default set in `scrollToInvalid` prop"
|
972
|
+
}]
|
973
|
+
}
|
926
974
|
}
|
927
975
|
};
|
928
976
|
}
|