@nanoporetech-digital/components 5.1.0 → 5.1.2
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 +25 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/nano-components.cjs.js +1 -1
- package/dist/cjs/nano-global-nav-user-profile_3.cjs.entry.js +1 -1
- package/dist/cjs/nano-input.cjs.entry.js +3 -3
- package/dist/cjs/nano-input.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-sortable.cjs.entry.js +68 -43
- package/dist/cjs/nano-sortable.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-tab-group.cjs.entry.js +2 -0
- package/dist/cjs/nano-tab-group.cjs.entry.js.map +1 -1
- package/dist/cjs/{nano-table-5587101f.js → nano-table-0a720c5f.js} +8 -3
- package/dist/cjs/nano-table-0a720c5f.js.map +1 -0
- package/dist/cjs/nano-table.cjs.entry.js +1 -1
- package/dist/cjs/{table.worker-abba820e.js → table.worker-347d4d31.js} +2 -2
- package/dist/cjs/table.worker-347d4d31.js.map +1 -0
- package/dist/collection/components/input/input.css +1 -1
- package/dist/collection/components/input/input.js +2 -2
- package/dist/collection/components/input/input.js.map +1 -1
- package/dist/collection/components/select/select.css +1 -1
- package/dist/collection/components/sortable/sortable.js +69 -44
- package/dist/collection/components/sortable/sortable.js.map +1 -1
- package/dist/collection/components/table/table.js +28 -1
- package/dist/collection/components/table/table.js.map +1 -1
- package/dist/collection/components/tabs/tab-group.js +2 -0
- package/dist/collection/components/tabs/tab-group.js.map +1 -1
- package/dist/components/input.js +3 -3
- package/dist/components/input.js.map +1 -1
- package/dist/components/nano-sortable.js +68 -43
- package/dist/components/nano-sortable.js.map +1 -1
- package/dist/components/nano-tab-group.js +2 -0
- package/dist/components/nano-tab-group.js.map +1 -1
- package/dist/components/select.js +1 -1
- package/dist/components/table.js +7 -1
- package/dist/components/table.js.map +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/nano-components.js +1 -1
- package/dist/esm/nano-global-nav-user-profile_3.entry.js +1 -1
- package/dist/esm/nano-input.entry.js +3 -3
- package/dist/esm/nano-input.entry.js.map +1 -1
- package/dist/esm/nano-sortable.entry.js +68 -43
- package/dist/esm/nano-sortable.entry.js.map +1 -1
- package/dist/esm/nano-tab-group.entry.js +2 -0
- package/dist/esm/nano-tab-group.entry.js.map +1 -1
- package/dist/esm/{nano-table-fb6b3bcb.js → nano-table-9767860f.js} +8 -3
- package/dist/esm/nano-table-9767860f.js.map +1 -0
- package/dist/esm/nano-table.entry.js +1 -1
- package/dist/esm/{table.worker-43365547.js → table.worker-d252307c.js} +2 -2
- package/dist/esm/table.worker-d252307c.js.map +1 -0
- 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-f7535f45.entry.js → p-1b687f96.entry.js} +2 -2
- package/dist/nano-components/p-1b687f96.entry.js.map +1 -0
- package/dist/nano-components/{p-99914796.js → p-633c778c.js} +2 -2
- package/dist/nano-components/p-633c778c.js.map +1 -0
- package/dist/nano-components/{p-daa6f834.js → p-66631f50.js} +2 -2
- package/dist/nano-components/{p-deb0799c.entry.js → p-75735a91.entry.js} +2 -2
- package/dist/nano-components/{p-deb0799c.entry.js.map → p-75735a91.entry.js.map} +1 -1
- package/dist/nano-components/{p-913cf45f.entry.js → p-8a79a7ca.entry.js} +2 -2
- package/dist/nano-components/p-c8ccb57a.entry.js +5 -0
- package/dist/nano-components/p-c8ccb57a.entry.js.map +1 -0
- package/dist/nano-components/{p-553acf24.entry.js → p-d1a5326f.entry.js} +2 -2
- package/dist/types/components/sortable/sortable.d.ts +2 -3
- package/dist/types/components/table/table.d.ts +1 -0
- package/dist/types/components.d.ts +2 -0
- package/docs-json.json +19 -2
- package/hydrate/index.js +81 -48
- package/package.json +2 -2
- package/dist/cjs/nano-table-5587101f.js.map +0 -1
- package/dist/cjs/table.worker-abba820e.js.map +0 -1
- package/dist/esm/nano-table-fb6b3bcb.js.map +0 -1
- package/dist/esm/table.worker-43365547.js.map +0 -1
- package/dist/nano-components/p-99914796.js.map +0 -1
- package/dist/nano-components/p-d79c6862.entry.js +0 -5
- package/dist/nano-components/p-d79c6862.entry.js.map +0 -1
- package/dist/nano-components/p-f7535f45.entry.js.map +0 -1
- /package/dist/nano-components/{p-913cf45f.entry.js.map → p-66631f50.js.map} +0 -0
- /package/dist/nano-components/{p-daa6f834.js.map → p-8a79a7ca.entry.js.map} +0 -0
- /package/dist/nano-components/{p-553acf24.entry.js.map → p-d1a5326f.entry.js.map} +0 -0
@@ -1 +1 @@
|
|
1
|
-
{"file":"nano-input.entry.cjs.js","mappings":";;;;;;;;;;;;;AAAA,MAAM,QAAQ,GAAG,i4hBAAi4hB;;AC4Bl5hB,IAAI,QAAQ,GAAG,CAAC,CAAC;MAqBJ,KAAK;EAYhB,IAAY,eAAe;IACzB,OAAO,IAAI,CAAC,gBAAgB,CAAC;GAC9B;EACD,IAAY,eAAe,CAAC,GAAgB;IAC1C,IAAI,IAAI,CAAC,gBAAgB,KAAK,GAAG;MAAE,OAAO;IAC1C,IAAI,CAAC,gBAAgB,GAAG,GAAG,CAAC;IAC5B,IAAI,CAAC,eAAe,EAAE,CAAC;GACxB;EAED;;;;;;;;;IAnBQ,YAAO,GAAG,cAAc,QAAQ,EAAE,EAAE,CAAC;IACrC,qBAAgB,GAAG,KAAK,CAAC;IACzB,QAAG,GAAY,KAAK,CAAC;IAErB,cAAS,GAAG,CAAC,CAAC;IACd,gBAAW,GAAG,KAAK,CAAC;IAyapB,aAAQ,GAAG,CAAC,EAAU;MAC5B,IAAI,IAAI,CAAC,UAAU,KAAK,iBAAiB;QAAE,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC;MAErE,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,KAAK,EAAE;QACpC,IAAI,IAAI,CAAC,eAAe,EAAE;UACxB,IAAI,EAAE;YAAE,EAAE,CAAC,c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AAG,GAAG,WAAW,EAC3D,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,cAAc,EAAE,IAAI,CAAC,cAAc,EACnC,WAAW,EAAE,IAAI,CAAC,WAAW,EAC7B,SAAS,EAAE,IAAI,CAAC,SAAS,EACzB,SAAS,EAAE,IAAI,CAAC,SAAS,EACzB,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,SAAS,EAAE,IAAI,CAAC,SAAS,EACzB,SAAS,EAAE,IAAI,CAAC,SAAS,EACzB,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,WAAW,EAAE,IAAI,CAAC,WAAW,EAC7B,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,UAAU,EAAE,IAAI,CAAC,UAAU,EAC3B,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,QAAQ,EAAE,IAAI,CAAC,OAAO,EACtB,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,SAAS,EAAE,IAAI,CAAC,SAAS,EACzB,SAAS,EAAE,IAAI,CAAC,QAAQ,EACxB,MAAM,EAAE,IAAI,CAAC,UAAU,GACb,CACb,CACW,EACdA,qBAAQ,CACQ,CACb,EACP;GACH;;;;;;;;;;;;;;;;;;;;;","names":["debounce","debounceEvent","closestElement","h","Host","createColorClasses","FormControlWrap","FormControl"],"sources":["./src/components/input/input.scss?tag=nano-input&encapsulation=scoped","./src/components/input/input.tsx"],"sourcesContent":["@import '../../global/style/utilities/globals';\n@import '../../global/style/nano-theme/form';\n@import '../form-control/form-control';\n@import '../form-control/form-control-vars';\n\n:host {\n @include formControlVars;\n\n position: relative;\n inline-size: 100%;\n padding: 0 !important;\n color: currentcolor;\n display: block;\n}\n\n:host(.nano-color) {\n color: current-color(base);\n\n --input-border-style--focus:\n #{$input-border-style} var(\n --nano-color-tint,\n #{nano-color(\n primary,\n tint\n )}\n );\n}\n\n.input__native-ctrl {\n @include text-inherit();\n\n padding-block: 0;\n padding-inline: var(--padding-start) var(--padding-end);\n border-radius: var(--input-border-radius);\n text-overflow: ellipsis;\n color: var(--input-text-color);\n display: inline-block;\n flex: 1;\n inline-size: 100%;\n max-inline-size: 100%;\n max-block-size: 100%;\n border: 0;\n outline: none;\n background: transparent;\n appearance: none;\n margin: 0;\n box-sizing: border-box;\n resize: none;\n overflow: hidden;\n line-height: 2.5em;\n // min-height: 2.5em;\n\n .has-float-label & {\n line-height: 2.1em;\n min-height: 2.1em;\n padding-block-start: 1.4em;\n }\n\n &::placeholder {\n color: var(--placeholder-color);\n font-family: inherit;\n font-style: var(--placeholder-font-style);\n font-weight: var(--placeholder-font-weight);\n opacity: var(--placeholder-opacity);\n line-height: inherit;\n min-height: initial;\n }\n\n /* stylelint-disable-next-line selector-no-vendor-prefix */\n &::-moz-placeholder {\n line-height: 2.8em;\n text-overflow: ellipsis;\n }\n\n &:-webkit-autofill {\n background-color: transparent;\n }\n\n &::-webkit-search-decoration,\n &::-webkit-search-cancel-button,\n &::-webkit-search-results-button,\n &::-webkit-search-results-decoration {\n appearance: none;\n }\n\n &:invalid {\n box-shadow: none;\n }\n\n &::-ms-clear,\n &::-ms-reveal {\n display: none;\n }\n\n &.input__resizable {\n resize: vertical;\n overflow: auto;\n }\n\n .form-ctrl__textarea & {\n line-height: 1.5em;\n padding-block: var(--padding-top) 0.25em;\n white-space: pre-wrap;\n\n &::placeholder {\n line-height: 1.5em;\n }\n\n .has-float-label & {\n padding-block-start: 1.75em;\n }\n }\n\n :host([readonly]:not([readonly='false'])) & {\n user-select: none;\n }\n}\n","import {\n Build,\n Component,\n ComponentInterface,\n Element,\n Event,\n EventEmitter,\n Host,\n Method,\n Prop,\n State,\n Watch,\n h,\n Listen,\n} from '@stencil/core';\n\nimport { closestElement } from '../../utils/dom';\nimport { createColorClasses } from '../../utils/theme';\nimport { debounceEvent, debounce } from '../../utils/throttle';\nimport { FormControl, FormControlWrap } from '../form-control/form-control';\nimport type {\n Color,\n ControlValidity,\n ControlValidityEventDetail,\n InputChangeEventDetail,\n TextFieldTypes,\n} from '../../interface';\n\nlet inputIds = 0;\n\n/**\n * The input component is a wrapper to the HTML input element with custom styling and additional functionality. It accepts most of the same properties as the HTML [input](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input).\n *\nIt is meant for text type inputs only, such as \"text\", \"password\", \"email\", \"number\", \"search\", \"tel\", and \"url\". It supports all standard text input events including keyup, keydown, keypress, and more.\nThe default styling reference comes from the [ONT styleguide](https://nanoporetech.zeroheight.com/styleguide/s/31282/p/230c74-text-input--textarea/b/942ee4)\n * @slot start - suitable for inline action buttons or icons that may add extra contextual information\n * @slot end - suitable for inline action buttons or icons that may add extra contextual information\n * @slot value-start - similar to 'start', however clicking elements using this slot will activate the input control. This would be suitable to show a secodary 'value' for context or to show a dropdown arrow if using a datalist\n * @slot value-end - similar to 'end', however clicking elements using this slot will activate the input control. This would be suitable to show a secodary 'value' for context or to show a dropdown arrow if using a datalist\n * @slot label - if you do not set a label attribute, you can use this slot for more complex markup\n * @slot helper - helper text to accompany the form field underneath.\n * @slot helper-end - helper text to accompany the form field on the side.\n * @slot - can be used with a `nano-datalist`. See the `nano-datalist` docs for more information\n */\n@Component({\n tag: 'nano-input',\n styleUrl: 'input.scss',\n scoped: true,\n})\nexport class Input implements ComponentInterface {\n private nativeInput?: HTMLInputElement | HTMLTextAreaElement;\n private inputId = `nano-input-${inputIds++}`;\n private didBlurAfterEdit = false;\n private rtl: boolean = false;\n private mo?: MutationObserver;\n private charCount = 0;\n private hasRendered = false;\n\n // we don't want these rendered eles decorated with @State\n // because that will cause re-renders. User get/set to set datalist options\n private _nativeInputWrap: HTMLElement;\n private get nativeInputWrap() {\n return this._nativeInputWrap;\n }\n private set nativeInputWrap(ele: HTMLElement) {\n if (this._nativeInputWrap === ele) return;\n this._nativeInputWrap = ele;\n this.setDataListOpts();\n }\n\n constructor() {\n this.validate = debounce(this.validate, 50);\n this.handleBlur = this.handleBlur.bind(this);\n }\n\n @State() hasFocus = false;\n @State() hasLabelSlot = false;\n @State() hasHelperSlot = false;\n @State() hasHelperEndSlot = false;\n @State() errorMessage: string = '';\n @State() datalist: HTMLNanoDatalistElement = null;\n\n @Watch('datalist')\n setDataListOpts() {\n if (!this.datalist) return;\n const currDWConfig = this.datalist.dropDownConfig || {};\n this.datalist.dropDownConfig = {\n ...currDWConfig,\n skidding: -1,\n tetherTo: this.nativeInputWrap,\n };\n }\n\n @Element() el!: HTMLNanoInputElement;\n\n /**\n * This will be true when the control is in an invalid state.\n * Validity is determined by the `required` prop. Or if custom validity message is set. @readonly\n */\n @Prop({ reflect: true })\n get invalid() {\n return this._invalid;\n }\n @State() _invalid = false;\n\n /**\n * Current validation message - if any. @readonly\n */\n @Prop()\n get validityMessage() {\n if (!this.nativeInput) return '';\n return this.nativeInput.validationMessage;\n }\n\n /**\n * The color to use from the application's color palette.\n */\n @Prop() color?: Color;\n\n /**\n * If the value of the type attribute is `\"file\"`, then this attribute will indicate the types of files that the server accepts, otherwise it will be ignored. The value must be a comma-separated list of unique content type specifiers.\n */\n @Prop() accept?: string;\n\n /**\n * Indicates whether and how the text value should be automatically capitalized as it is entered/edited by the user.\n */\n @Prop() autocapitalise: 'none' | 'sentences' | 'words' | 'characters' =\n 'none';\n\n /**\n * Indicates whether the value of the control can be automatically completed by the browser.\n */\n @Prop() autocomplete: 'on' | 'off' = 'off';\n\n /**\n * Whether auto correction should be enabled when the user is entering/editing the text value.\n */\n @Prop() autocorrect: 'on' | 'off' = 'off';\n\n /**\n * This Boolean attribute lets you specify that a form control should have input focus when the page loads.\n */\n @Prop() autofocus = false;\n\n /**\n * If `true`, a clear icon will appear in the input when there is a value. Clicking it clears the input.\n */\n @Prop() clearInput = false;\n\n /**\n * If `true`, the value will be cleared after focus upon edit. Defaults to `true` when `type` is `\"password\"`, `false` for all other types.\n */\n @Prop() clearOnEdit?: boolean;\n\n /**\n * Set the amount of time, in milliseconds, to wait to trigger the `nanoChange` event after each keystroke.\n */\n @Prop() debounce = 0;\n\n /**\n * If `true`, the user cannot interact with the input.\n */\n @Prop({ reflect: true }) disabled = false;\n\n /**\n * A hint to the browser for which keyboard to display.\n * Possible values: `\"none\"`, `\"text\"`, `\"tel\"`, `\"url\"`,\n * `\"email\"`, `\"numeric\"`, `\"decimal\"`, and `\"search\"`.\n */\n @Prop() inputmode?:\n | 'none'\n | 'text'\n | 'tel'\n | 'url'\n | 'email'\n | 'numeric'\n | 'decimal'\n | 'search';\n\n /**\n * When should the field perform validation\n */\n @Prop({ mutable: true }) validateOn: 'dirty' | 'submit' | 'submitThenDirty' =\n 'submitThenDirty';\n\n /**\n * Whether to show validation errors underneath input\n */\n @Prop({ reflect: true }) showInlineError = true;\n\n /**\n * String to place within a label element. Alternatively you may use a label slot.\n */\n @Prop() label!: string;\n\n /**\n * Visually hide the label - but make it accessible.\n */\n @Prop() hideLabel?: boolean = false;\n\n /**\n * Enable floating label behaviour. Will disable placeholder if set.\n */\n @Prop() floatLabel: boolean = false;\n\n /**\n * The maximum value, which must not be less than its minimum (min attribute) value.\n */\n @Prop() max?: string;\n\n /**\n * If the value of the type attribute is `text`, `email`, `search`, `password`, `tel`, or `url`, this attribute specifies the maximum number of characters that the user can enter.\n */\n @Prop() maxlength?: number;\n\n /**\n * The minimum value, which must not be greater than its maximum (max attribute) value.\n */\n @Prop() min?: string;\n\n /**\n * If the value of the type attribute is `text`, `email`, `search`, `password`, `tel`, or `url`, this attribute specifies the minimum number of characters that the user can enter.\n */\n @Prop() minlength?: number;\n\n /**\n * If `true`, the user can enter more than one value. This attribute applies when the type attribute is set to `\"email\"` or `\"file\"`, otherwise it is ignored.\n */\n @Prop() multiple?: boolean;\n\n /**\n * The name of the control, which is submitted with the form data.\n */\n @Prop() name: string = this.inputId;\n\n /**\n * A regular expression that the value is checked against. The pattern must match the entire value, not just some subset. Use the title attribute to describe the pattern to help the user. This attribute applies when the value of the type attribute is `\"text\"`, `\"search\"`, `\"tel\"`, `\"url\"`, `\"email\"`, or `\"password\"`, otherwise it is ignored.\n */\n @Prop() pattern?: string;\n\n /**\n * Instructional text that shows before the input has a value.\n */\n @Prop() placeholder?: string | null;\n\n /**\n * If `true`, the user cannot modify the value.\n */\n @Prop({ reflect: true }) readonly = false;\n\n /**\n * If `true`, the user must fill in a value before submitting a form.\n */\n @Prop() required = false;\n\n /**\n * If `true`, the element will have its spelling and grammar checked.\n */\n @Prop() spellcheck = false;\n\n /**\n * Works with the min and max attributes to limit the increments at which a value can be set.\n * Possible values are: `\"any\"` or a positive floating point number.\n */\n @Prop() step?: string;\n\n /**\n * The initial size of the control. This value is in pixels unless the value of the type attribute is `\"text\"` or `\"password\"`, in which case it is an integer number of characters. This attribute applies only when the `type` attribute is set to `\"text\"`, `\"search\"`, `\"tel\"`, `\"url\"`, `\"email\"`, or `\"password\"`, otherwise it is ignored.\n */\n @Prop() size?: number;\n\n /**\n * The type of control to display. The default type is text.\n */\n @Prop({ reflect: true }) type: TextFieldTypes = 'text';\n\n /**\n * The form element to associate the input with (its form owner). Must be the id of a form.\n */\n @Prop() form?: string | null;\n\n /**\n * The value of the input.\n */\n @Prop({ mutable: true }) value?: string | null = '';\n\n /**\n * relevant to type=\"textarea\". Vertical resizing - enable / disable or make automatic.\n */\n @Prop() resize: 'true' | 'false' | 'auto' = 'auto';\n\n /**\n * relevant to type=\"textarea\". Default number of rows to show\n */\n @Prop() rows = 2;\n\n /**\n * relevant to type=\"textarea\".\n */\n @Prop() showCharCount = false;\n\n @Watch('minlength')\n @Watch('maxlength')\n @Watch('min')\n @Watch('max')\n @Watch('required')\n @Watch('disabled')\n @Watch('readonly')\n @Watch('pattern')\n @Watch('inputmode')\n protected shouldValidate() {\n if (!this.hasRendered) return;\n requestAnimationFrame(() => {\n if (this.validateOn === 'dirty') this.validate();\n });\n }\n\n /**\n * Update the native input element when the value changes\n */\n @Watch('value')\n protected valueChanged() {\n this.nanoChange.emit({ value: this.value });\n this.charCount = this.value.length;\n\n if (this.type === 'textarea' && this.resize === 'auto') {\n this.nativeInput.style.height = 'auto';\n if (this.value.length)\n this.nativeInput.style.height = this.nativeInput.scrollHeight + 'px';\n }\n\n requestAnimationFrame(() => {\n if (this.validateOn === 'dirty') this.validate();\n });\n }\n\n @Watch('debounce')\n protected debounceChanged() {\n this.nanoChange = debounceEvent(this.nanoChange, this.debounce);\n }\n\n /**\n * Emitted when a keyboard input occurred.\n */\n @Event() nanoInput!: EventEmitter<InputEvent>;\n\n /**\n * Emitted when the value has changed.\n */\n @Event() nanoChange!: EventEmitter<InputChangeEventDetail>;\n\n /**\n * Emitted when the input loses focus.\n */\n @Event() nanoBlur!: EventEmitter<void>;\n\n /**\n * Emitted when the input has focus.\n */\n @Event() nanoFocus!: EventEmitter<void>;\n\n /**\n * Emitted when the input has been created.\n * @internal\n */\n @Event() nanoDidLoad!: EventEmitter<void>;\n\n /**\n * Emitted when the input has been removed.\n * @internal\n */\n @Event() nanoDidUnload!: EventEmitter<void>;\n\n /**\n * Called when validation is performed (which depends on `validateOn`).\n * @returns event.detail: `{ isValid: boolean, errorMessage: string, originalEvent: Event }`.\n */\n @Event() nanoValidate: EventEmitter<ControlValidityEventDetail>;\n\n /**\n * Get the current state of the control.\n * @param validateFirst - perform validation first before reporting\n * @returns `{ isValid: boolean, errorMessage: string }`\n */\n @Method()\n async reportValidity(validateFirst: boolean): Promise<ControlValidity> {\n return new Promise((resolve) => {\n if (validateFirst) this.validate();\n setTimeout(() => {\n resolve({\n isValid: !this._invalid,\n errorMessage: this.nativeInput.validationMessage,\n });\n }, 50);\n });\n }\n\n /**\n * Sets focus on the specified `nano-input`. Use this method instead of the global\n * `input.focus()`.\n */\n @Method()\n async setFocus() {\n if (this.nativeInput) {\n this.nativeInput.focus();\n this.nativeInput.click();\n }\n }\n\n /**\n * Sets focus and select the text on the specified `nano-input`. Use this method instead of the global\n * `input.select()`.\n */\n @Method()\n async select() {\n if (this.nativeInput) {\n this.nativeInput.select();\n }\n }\n\n /**\n * @returns the native `<input>` element used under the hood.\n */\n @Method()\n getInputElement(): Promise<HTMLInputElement | HTMLTextAreaElement> {\n return Promise.resolve(this.nativeInput);\n }\n\n /**\n * Invalidate the field and show a custom error message. To clear the error you will need to re-call this method with an empty string.\n */\n @Method()\n async showError(message: string) {\n if (this.nativeInput) {\n this.nativeInput.setCustomValidity(message);\n this.validate();\n }\n }\n\n @Listen('reset', { target: 'body' })\n onReset(e) {\n const form = this.form\n ? document.querySelector('#' + this.form)\n : this.el.closest('form');\n if (!form || e.target !== this.el.closest('form')) return;\n\n this.value = '';\n }\n\n @Listen('mousedown', { target: 'body' })\n @Listen('keydown')\n handleBlur(e: KeyboardEvent | MouseEvent | FocusEvent) {\n if (!this.hasFocus) return;\n\n const kev = e as KeyboardEvent;\n let target: Element;\n\n requestAnimationFrame(() => {\n if (e instanceof KeyboardEvent && kev.key) {\n if (kev.key !== 'Tab') return;\n target = document.activeElement;\n } else if (e instanceof FocusEvent) {\n target = document.activeElement;\n } else target = e.target as Element;\n\n if (closestElement(this.el.tagName.toLowerCase(), target) !== this.el) {\n this.onBlur();\n }\n });\n }\n\n private shouldClearOnEdit() {\n const { type, clearOnEdit } = this;\n return clearOnEdit === undefined ? type === 'password' : clearOnEdit;\n }\n\n private getValue(): string {\n return this.value || '';\n }\n\n private validate = (ev?: Event) => {\n if (this.validateOn === 'submitThenDirty') this.validateOn = 'dirty';\n\n if (!this.nativeInput.validity.valid) {\n if (this.showInlineError) {\n if (ev) ev.preventDefault();\n this.errorMessage = this.nativeInput.validationMessage;\n }\n this._invalid = true;\n } else this._invalid = false;\n\n this.nanoValidate.emit({\n isValid: !this._invalid,\n errorMessage: this.nativeInput.validationMessage,\n originalEvent: ev,\n });\n };\n\n private onInput = (ev: InputEvent) => {\n const input = ev.target as HTMLInputElement | null;\n this.value = input?.value || '';\n this.nanoInput.emit(ev);\n };\n\n private onBlur = () => {\n this.hasFocus = false;\n this.focusChanged();\n if (this.validateOn === 'dirty') this.validate();\n this.nanoBlur.emit();\n };\n\n private onFocus = () => {\n this.hasFocus = true;\n this.focusChanged();\n this.nanoFocus.emit();\n };\n\n private onKeydown = () => {\n if (this.shouldClearOnEdit()) {\n // Did the input value change after it was blurred and edited?\n if (this.didBlurAfterEdit && this.hasValue()) {\n // Clear the input\n this.clearTextInput();\n }\n\n // Reset the flag\n this.didBlurAfterEdit = false;\n }\n };\n\n private clearTextInput = (ev?: Event) => {\n if (this.clearInput && !this.readonly && !this.disabled && ev) {\n ev.preventDefault();\n ev.stopPropagation();\n }\n\n this.value = '';\n this.nativeInput.value = '';\n const event = new window.Event('change');\n this.nativeInput.dispatchEvent(event);\n };\n\n private focusChanged() {\n // If clearOnEdit is enabled and the input blurred but has a value, set a flag\n if (!this.hasFocus && this.shouldClearOnEdit() && this.hasValue()) {\n this.didBlurAfterEdit = true;\n }\n }\n\n private hasValue(): boolean {\n return this.getValue().length > 0;\n }\n\n private slotChangeObserver() {\n if (!Build.isBrowser) return;\n\n if (this.mo) this.mo.disconnect();\n const mo = (this.mo = new MutationObserver(() =>\n this.processSlottedContent()\n ));\n mo.observe(this.el, { childList: true, subtree: true });\n }\n\n private processSlottedContent() {\n // see if we have label / button content\n this.hasLabelSlot = !!this.el.querySelectorAll('[slot=\"label\"]');\n this.hasHelperSlot = !!this.el.querySelector('[slot=\"helper\"]');\n this.hasHelperEndSlot = !!this.el.querySelector('[slot=\"helper-end\"]');\n this.datalist = this.el.querySelector('nano-datalist:not([slot])');\n\n // breaking change introduced in v2. Rm in v3\n if (!!this.el.querySelector('[slot=\"inline-button\"]')) {\n console.warn(\n 'The `inline-button` slot was renamed to `end` in v2 - please update your code',\n this.el\n );\n }\n }\n\n connectedCallback() {\n this.debounceChanged();\n if (Build.isBrowser) {\n this.el.dispatchEvent(\n new CustomEvent('nanoDidLoad', {\n detail: this.el,\n })\n );\n }\n }\n\n disconnectedCallback() {\n if (Build.isBrowser) {\n document.dispatchEvent(\n new CustomEvent('nanoDidUnload', {\n detail: this.el,\n })\n );\n }\n if (this.mo) this.mo.disconnect();\n }\n\n componentDidLoad() {\n this.slotChangeObserver();\n this.hasRendered = true;\n if (this.autofocus) setTimeout((_) => this.setFocus(), 300);\n }\n\n componentWillLoad() {\n this.processSlottedContent();\n }\n\n render() {\n const value = this.getValue();\n const labelId = this.inputId + '-lbl';\n const moreId =\n this.showInlineError || this.hasHelperSlot ? this.inputId + '-more' : '';\n const helperEndId = this.hasHelperEndSlot ? this.inputId + '-helper' : '';\n this.rtl = (this.el.ownerDocument as Document).dir === 'rtl';\n\n const compWrapOptions = (({\n el,\n floatLabel,\n label,\n errorMessage,\n type,\n showInlineError,\n hasHelperSlot,\n hasLabelSlot,\n hideLabel,\n placeholder,\n maxlength,\n charCount,\n showCharCount,\n rtl,\n hasHelperEndSlot,\n }) => ({\n el,\n floatLabel,\n label,\n errorMessage,\n type,\n showInlineError,\n hasHelperSlot,\n hasLabelSlot,\n hideLabel,\n placeholder,\n maxlength,\n charCount,\n showCharCount,\n rtl,\n hasHelperEndSlot,\n }))(this);\n const wrapOptions = {\n ...compWrapOptions,\n labelId,\n moreId,\n helperEndId,\n hasValue: this.hasValue(),\n controlId: this.inputId,\n };\n\n const controlOptions = (({ clearInput, readonly, disabled }) => ({\n clearInput,\n readonly,\n disabled,\n clearControl: this.clearInput,\n }))(this);\n\n return (\n <Host\n aria-disabled={this.disabled ? 'true' : null}\n dir={this.rtl ? 'rtl' : null}\n class={{\n ...createColorClasses(this.color),\n 'has-value': this.hasValue(),\n 'has-focus': this.hasFocus,\n 'is-invalid': this._invalid,\n }}\n >\n <FormControlWrap {...wrapOptions}>\n <FormControl\n {...controlOptions}\n onClearText={this.clearTextInput}\n control={this.el}\n ref={(el) => (this.nativeInputWrap = el)}\n >\n {this.type !== 'textarea' && (\n <input\n id={this.inputId}\n class=\"input__native-ctrl\"\n ref={(input) => (this.nativeInput = input)}\n aria-labelledby={labelId + ' ' + moreId + ' ' + helperEndId}\n disabled={this.disabled}\n accept={this.accept}\n autoCapitalize={this.autocapitalise}\n autoComplete={this.autocomplete}\n autoCorrect={this.autocorrect}\n autoFocus={this.autofocus}\n inputMode={this.inputmode}\n form={this.form}\n min={this.min}\n max={this.max}\n minLength={this.minlength}\n maxLength={this.maxlength}\n multiple={this.multiple}\n name={this.name}\n pattern={this.pattern}\n placeholder={this.placeholder}\n readOnly={this.readonly}\n required={this.required}\n spellcheck={this.spellcheck}\n step={this.step}\n size={this.size}\n type={this.type}\n value={value}\n onInput={this.onInput}\n onChange={this.onInput}\n onFocus={this.onFocus}\n onBlur={this.handleBlur}\n onKeyDown={this.onKeydown}\n onInvalid={this.validate}\n />\n )}\n {this.type === 'textarea' && (\n <textarea\n rows={this.floatLabel ? 1 : this.rows}\n id={this.inputId}\n class={{\n 'input__native-ctrl': true,\n input__resizable: this.resize === 'true',\n }}\n ref={(input) => (this.nativeInput = input)}\n aria-labelledby={labelId + ' ' + moreId + ' ' + helperEndId}\n disabled={this.disabled}\n autoCapitalize={this.autocapitalise}\n autoCorrect={this.autocorrect}\n autoFocus={this.autofocus}\n inputMode={this.inputmode}\n form={this.form}\n minLength={this.minlength}\n maxLength={this.maxlength}\n name={this.name}\n placeholder={this.placeholder}\n readOnly={this.readonly}\n required={this.required}\n spellcheck={this.spellcheck}\n value={value}\n onInput={this.onInput}\n onChange={this.onInput}\n onFocus={this.onFocus}\n onKeyDown={this.onKeydown}\n onInvalid={this.validate}\n onBlur={this.handleBlur}\n ></textarea>\n )}\n </FormControl>\n <slot />\n </FormControlWrap>\n </Host>\n );\n }\n}\n"],"version":3}
|
1
|
+
{"file":"nano-input.entry.cjs.js","mappings":";;;;;;;;;;;;;AAAA,MAAM,QAAQ,GAAG,i4hBAAi4hB;;AC4Bl5hB,IAAI,QAAQ,GAAG,CAAC,CAAC;MAqBJ,KAAK;EAYhB,IAAY,eAAe;IACzB,OAAO,IAAI,CAAC,gBAAgB,CAAC;GAC9B;EACD,IAAY,eAAe,CAAC,GAAgB;IAC1C,IAAI,IAAI,CAAC,gBAAgB,KAAK,GAAG;MA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,EAAE,IAAI,CAAC,QAAQ,EACxB,MAAM,EAAE,IAAI,CAAC,UAAU,GACb,CACb,CACW,CACE,EAClBA,qBAAQ,CACJ,CACD,EACP;GACH;;;;;;;;;;;;;;;;;;;;;","names":["debounce","debounceEvent","closestElement","h","Host","createColorClasses","FormControlWrap","FormControl"],"sources":["./src/components/input/input.scss?tag=nano-input&encapsulation=scoped","./src/components/input/input.tsx"],"sourcesContent":["@import '../../global/style/utilities/globals';\n@import '../../global/style/nano-theme/form';\n@import '../form-control/form-control';\n@import '../form-control/form-control-vars';\n\n:host {\n @include formControlVars;\n\n position: relative;\n inline-size: 100%;\n padding: 0 !important;\n color: currentcolor;\n display: block;\n}\n\n:host(.nano-color) {\n color: current-color(base);\n\n --input-border-style--focus:\n #{$input-border-style} var(\n --nano-color-tint,\n #{nano-color(\n primary,\n tint\n )}\n );\n}\n\n.input__native-ctrl {\n @include text-inherit();\n\n padding-block: 0;\n padding-inline: var(--padding-start) var(--padding-end);\n border-radius: var(--input-border-radius);\n text-overflow: ellipsis;\n color: var(--input-text-color);\n display: inline-block;\n flex: 1;\n inline-size: 100%;\n max-inline-size: 100%;\n max-block-size: 100%;\n border: 0;\n outline: none;\n background: transparent;\n appearance: none;\n margin: 0;\n box-sizing: border-box;\n resize: none;\n overflow: hidden;\n line-height: 2.5em;\n // min-height: 2.5em;\n\n .has-float-label & {\n line-height: 2.1em;\n min-height: 2.1em;\n padding-block-start: 1.4em;\n }\n\n &::placeholder {\n color: var(--placeholder-color);\n font-family: inherit;\n font-style: var(--placeholder-font-style);\n font-weight: var(--placeholder-font-weight);\n opacity: var(--placeholder-opacity);\n line-height: inherit;\n min-height: initial;\n }\n\n /* stylelint-disable-next-line selector-no-vendor-prefix */\n &::-moz-placeholder {\n line-height: 2.8em;\n text-overflow: ellipsis;\n }\n\n &:-webkit-autofill {\n background-color: transparent;\n }\n\n &::-webkit-search-decoration,\n &::-webkit-search-cancel-button,\n &::-webkit-search-results-button,\n &::-webkit-search-results-decoration {\n appearance: none;\n }\n\n &:invalid {\n box-shadow: none;\n }\n\n &::-ms-clear,\n &::-ms-reveal {\n display: none;\n }\n\n &.input__resizable {\n resize: vertical;\n overflow: auto;\n }\n\n .form-ctrl__textarea & {\n line-height: 1.5em;\n padding-block: var(--padding-top) 0.25em;\n white-space: pre-wrap;\n\n &::placeholder {\n line-height: 1.5em;\n }\n\n .has-float-label & {\n padding-block-start: 1.75em;\n }\n }\n\n :host([readonly]:not([readonly='false'])) & {\n user-select: none;\n }\n}\n","import {\n Build,\n Component,\n ComponentInterface,\n Element,\n Event,\n EventEmitter,\n Host,\n Method,\n Prop,\n State,\n Watch,\n h,\n Listen,\n} from '@stencil/core';\n\nimport { closestElement } from '../../utils/dom';\nimport { createColorClasses } from '../../utils/theme';\nimport { debounceEvent, debounce } from '../../utils/throttle';\nimport { FormControl, FormControlWrap } from '../form-control/form-control';\nimport type {\n Color,\n ControlValidity,\n ControlValidityEventDetail,\n InputChangeEventDetail,\n TextFieldTypes,\n} from '../../interface';\n\nlet inputIds = 0;\n\n/**\n * The input component is a wrapper to the HTML input element with custom styling and additional functionality. It accepts most of the same properties as the HTML [input](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input).\n *\nIt is meant for text type inputs only, such as \"text\", \"password\", \"email\", \"number\", \"search\", \"tel\", and \"url\". It supports all standard text input events including keyup, keydown, keypress, and more.\nThe default styling reference comes from the [ONT styleguide](https://nanoporetech.zeroheight.com/styleguide/s/31282/p/230c74-text-input--textarea/b/942ee4)\n * @slot start - suitable for inline action buttons or icons that may add extra contextual information\n * @slot end - suitable for inline action buttons or icons that may add extra contextual information\n * @slot value-start - similar to 'start', however clicking elements using this slot will activate the input control. This would be suitable to show a secodary 'value' for context or to show a dropdown arrow if using a datalist\n * @slot value-end - similar to 'end', however clicking elements using this slot will activate the input control. This would be suitable to show a secodary 'value' for context or to show a dropdown arrow if using a datalist\n * @slot label - if you do not set a label attribute, you can use this slot for more complex markup\n * @slot helper - helper text to accompany the form field underneath.\n * @slot helper-end - helper text to accompany the form field on the side.\n * @slot - can be used with a `nano-datalist`. See the `nano-datalist` docs for more information\n */\n@Component({\n tag: 'nano-input',\n styleUrl: 'input.scss',\n scoped: true,\n})\nexport class Input implements ComponentInterface {\n private nativeInput?: HTMLInputElement | HTMLTextAreaElement;\n private inputId = `nano-input-${inputIds++}`;\n private didBlurAfterEdit = false;\n private rtl: boolean = false;\n private mo?: MutationObserver;\n private charCount = 0;\n private hasRendered = false;\n\n // we don't want these rendered eles decorated with @State\n // because that will cause re-renders. User get/set to set datalist options\n private _nativeInputWrap: HTMLElement;\n private get nativeInputWrap() {\n return this._nativeInputWrap;\n }\n private set nativeInputWrap(ele: HTMLElement) {\n if (this._nativeInputWrap === ele) return;\n this._nativeInputWrap = ele;\n this.setDataListOpts();\n }\n\n constructor() {\n this.validate = debounce(this.validate, 50);\n this.handleBlur = this.handleBlur.bind(this);\n }\n\n @State() hasFocus = false;\n @State() hasLabelSlot = false;\n @State() hasHelperSlot = false;\n @State() hasHelperEndSlot = false;\n @State() errorMessage: string = '';\n @State() datalist: HTMLNanoDatalistElement = null;\n\n @Watch('datalist')\n setDataListOpts() {\n if (!this.datalist) return;\n const currDWConfig = this.datalist.dropDownConfig || {};\n this.datalist.dropDownConfig = {\n ...currDWConfig,\n skidding: -1,\n tetherTo: this.nativeInputWrap,\n };\n }\n\n @Element() el!: HTMLNanoInputElement;\n\n /**\n * This will be true when the control is in an invalid state.\n * Validity is determined by the `required` prop. Or if custom validity message is set. @readonly\n */\n @Prop({ reflect: true })\n get invalid() {\n return this._invalid;\n }\n @State() _invalid = false;\n\n /**\n * Current validation message - if any. @readonly\n */\n @Prop()\n get validityMessage() {\n if (!this.nativeInput) return '';\n return this.nativeInput.validationMessage;\n }\n\n /**\n * The color to use from the application's color palette.\n */\n @Prop() color?: Color;\n\n /**\n * If the value of the type attribute is `\"file\"`, then this attribute will indicate the types of files that the server accepts, otherwise it will be ignored. The value must be a comma-separated list of unique content type specifiers.\n */\n @Prop() accept?: string;\n\n /**\n * Indicates whether and how the text value should be automatically capitalized as it is entered/edited by the user.\n */\n @Prop() autocapitalise: 'none' | 'sentences' | 'words' | 'characters' =\n 'none';\n\n /**\n * Indicates whether the value of the control can be automatically completed by the browser.\n */\n @Prop() autocomplete: 'on' | 'off' = 'off';\n\n /**\n * Whether auto correction should be enabled when the user is entering/editing the text value.\n */\n @Prop() autocorrect: 'on' | 'off' = 'off';\n\n /**\n * This Boolean attribute lets you specify that a form control should have input focus when the page loads.\n */\n @Prop() autofocus = false;\n\n /**\n * If `true`, a clear icon will appear in the input when there is a value. Clicking it clears the input.\n */\n @Prop() clearInput = false;\n\n /**\n * If `true`, the value will be cleared after focus upon edit. Defaults to `true` when `type` is `\"password\"`, `false` for all other types.\n */\n @Prop() clearOnEdit?: boolean;\n\n /**\n * Set the amount of time, in milliseconds, to wait to trigger the `nanoChange` event after each keystroke.\n */\n @Prop() debounce = 0;\n\n /**\n * If `true`, the user cannot interact with the input.\n */\n @Prop({ reflect: true }) disabled = false;\n\n /**\n * A hint to the browser for which keyboard to display.\n * Possible values: `\"none\"`, `\"text\"`, `\"tel\"`, `\"url\"`,\n * `\"email\"`, `\"numeric\"`, `\"decimal\"`, and `\"search\"`.\n */\n @Prop() inputmode?:\n | 'none'\n | 'text'\n | 'tel'\n | 'url'\n | 'email'\n | 'numeric'\n | 'decimal'\n | 'search';\n\n /**\n * When should the field perform validation\n */\n @Prop({ mutable: true }) validateOn: 'dirty' | 'submit' | 'submitThenDirty' =\n 'submitThenDirty';\n\n /**\n * Whether to show validation errors underneath input\n */\n @Prop({ reflect: true }) showInlineError = true;\n\n /**\n * String to place within a label element. Alternatively you may use a label slot.\n */\n @Prop() label!: string;\n\n /**\n * Visually hide the label - but make it accessible.\n */\n @Prop() hideLabel?: boolean = false;\n\n /**\n * Enable floating label behaviour. Will disable placeholder if set.\n */\n @Prop() floatLabel: boolean = false;\n\n /**\n * The maximum value, which must not be less than its minimum (min attribute) value.\n */\n @Prop() max?: string;\n\n /**\n * If the value of the type attribute is `text`, `email`, `search`, `password`, `tel`, or `url`, this attribute specifies the maximum number of characters that the user can enter.\n */\n @Prop() maxlength?: number;\n\n /**\n * The minimum value, which must not be greater than its maximum (max attribute) value.\n */\n @Prop() min?: string;\n\n /**\n * If the value of the type attribute is `text`, `email`, `search`, `password`, `tel`, or `url`, this attribute specifies the minimum number of characters that the user can enter.\n */\n @Prop() minlength?: number;\n\n /**\n * If `true`, the user can enter more than one value. This attribute applies when the type attribute is set to `\"email\"` or `\"file\"`, otherwise it is ignored.\n */\n @Prop() multiple?: boolean;\n\n /**\n * The name of the control, which is submitted with the form data.\n */\n @Prop() name: string = this.inputId;\n\n /**\n * A regular expression that the value is checked against. The pattern must match the entire value, not just some subset. Use the title attribute to describe the pattern to help the user. This attribute applies when the value of the type attribute is `\"text\"`, `\"search\"`, `\"tel\"`, `\"url\"`, `\"email\"`, or `\"password\"`, otherwise it is ignored.\n */\n @Prop() pattern?: string;\n\n /**\n * Instructional text that shows before the input has a value.\n */\n @Prop() placeholder?: string | null;\n\n /**\n * If `true`, the user cannot modify the value.\n */\n @Prop({ reflect: true }) readonly = false;\n\n /**\n * If `true`, the user must fill in a value before submitting a form.\n */\n @Prop() required = false;\n\n /**\n * If `true`, the element will have its spelling and grammar checked.\n */\n @Prop() spellcheck = false;\n\n /**\n * Works with the min and max attributes to limit the increments at which a value can be set.\n * Possible values are: `\"any\"` or a positive floating point number.\n */\n @Prop() step?: string;\n\n /**\n * The initial size of the control. This value is in pixels unless the value of the type attribute is `\"text\"` or `\"password\"`, in which case it is an integer number of characters. This attribute applies only when the `type` attribute is set to `\"text\"`, `\"search\"`, `\"tel\"`, `\"url\"`, `\"email\"`, or `\"password\"`, otherwise it is ignored.\n */\n @Prop() size?: number;\n\n /**\n * The type of control to display. The default type is text.\n */\n @Prop({ reflect: true }) type: TextFieldTypes = 'text';\n\n /**\n * The form element to associate the input with (its form owner). Must be the id of a form.\n */\n @Prop() form?: string | null;\n\n /**\n * The value of the input.\n */\n @Prop({ mutable: true }) value?: string | null = '';\n\n /**\n * relevant to type=\"textarea\". Vertical resizing - enable / disable or make automatic.\n */\n @Prop() resize: 'true' | 'false' | 'auto' = 'auto';\n\n /**\n * relevant to type=\"textarea\". Default number of rows to show\n */\n @Prop() rows = 2;\n\n /**\n * relevant to type=\"textarea\".\n */\n @Prop() showCharCount = false;\n\n @Watch('minlength')\n @Watch('maxlength')\n @Watch('min')\n @Watch('max')\n @Watch('required')\n @Watch('disabled')\n @Watch('readonly')\n @Watch('pattern')\n @Watch('inputmode')\n protected shouldValidate() {\n if (!this.hasRendered) return;\n requestAnimationFrame(() => {\n if (this.validateOn === 'dirty') this.validate();\n });\n }\n\n /**\n * Update the native input element when the value changes\n */\n @Watch('value')\n protected valueChanged() {\n this.nanoChange.emit({ value: this.value });\n this.charCount = this.value.length;\n\n if (this.type === 'textarea' && this.resize === 'auto') {\n this.nativeInput.style.height = 'auto';\n if (this.value.length)\n this.nativeInput.style.height = this.nativeInput.scrollHeight + 'px';\n }\n\n requestAnimationFrame(() => {\n if (this.validateOn === 'dirty') this.validate();\n });\n }\n\n @Watch('debounce')\n protected debounceChanged() {\n this.nanoChange = debounceEvent(this.nanoChange, this.debounce);\n }\n\n /**\n * Emitted when a keyboard input occurred.\n */\n @Event() nanoInput!: EventEmitter<InputEvent>;\n\n /**\n * Emitted when the value has changed.\n */\n @Event() nanoChange!: EventEmitter<InputChangeEventDetail>;\n\n /**\n * Emitted when the input loses focus.\n */\n @Event() nanoBlur!: EventEmitter<void>;\n\n /**\n * Emitted when the input has focus.\n */\n @Event() nanoFocus!: EventEmitter<void>;\n\n /**\n * Emitted when the input has been created.\n * @internal\n */\n @Event() nanoDidLoad!: EventEmitter<void>;\n\n /**\n * Emitted when the input has been removed.\n * @internal\n */\n @Event() nanoDidUnload!: EventEmitter<void>;\n\n /**\n * Called when validation is performed (which depends on `validateOn`).\n * @returns event.detail: `{ isValid: boolean, errorMessage: string, originalEvent: Event }`.\n */\n @Event() nanoValidate: EventEmitter<ControlValidityEventDetail>;\n\n /**\n * Get the current state of the control.\n * @param validateFirst - perform validation first before reporting\n * @returns `{ isValid: boolean, errorMessage: string }`\n */\n @Method()\n async reportValidity(validateFirst: boolean): Promise<ControlValidity> {\n return new Promise((resolve) => {\n if (validateFirst) this.validate();\n setTimeout(() => {\n resolve({\n isValid: !this._invalid,\n errorMessage: this.nativeInput.validationMessage,\n });\n }, 50);\n });\n }\n\n /**\n * Sets focus on the specified `nano-input`. Use this method instead of the global\n * `input.focus()`.\n */\n @Method()\n async setFocus() {\n if (this.nativeInput) {\n this.nativeInput.focus();\n this.nativeInput.click();\n }\n }\n\n /**\n * Sets focus and select the text on the specified `nano-input`. Use this method instead of the global\n * `input.select()`.\n */\n @Method()\n async select() {\n if (this.nativeInput) {\n this.nativeInput.select();\n }\n }\n\n /**\n * @returns the native `<input>` element used under the hood.\n */\n @Method()\n getInputElement(): Promise<HTMLInputElement | HTMLTextAreaElement> {\n return Promise.resolve(this.nativeInput);\n }\n\n /**\n * Invalidate the field and show a custom error message. To clear the error you will need to re-call this method with an empty string.\n */\n @Method()\n async showError(message: string) {\n if (this.nativeInput) {\n this.nativeInput.setCustomValidity(message);\n this.validate();\n }\n }\n\n @Listen('reset', { target: 'body' })\n onReset(e) {\n const form = this.form\n ? document.querySelector('#' + this.form)\n : this.el.closest('form');\n if (!form || e.target !== this.el.closest('form')) return;\n\n this.value = '';\n }\n\n @Listen('mousedown', { target: 'body' })\n @Listen('keydown')\n handleBlur(e: KeyboardEvent | MouseEvent | FocusEvent) {\n if (!this.hasFocus) return;\n\n const kev = e as KeyboardEvent;\n let target: Element;\n\n requestAnimationFrame(() => {\n if (e instanceof KeyboardEvent && kev.key) {\n if (kev.key !== 'Tab') return;\n target = document.activeElement;\n } else if (e instanceof FocusEvent) {\n target = document.activeElement;\n } else target = e.target as Element;\n\n if (closestElement(this.el.tagName.toLowerCase(), target) !== this.el) {\n this.onBlur();\n }\n });\n }\n\n private shouldClearOnEdit() {\n const { type, clearOnEdit } = this;\n return clearOnEdit === undefined ? type === 'password' : clearOnEdit;\n }\n\n private getValue(): string {\n return this.value || '';\n }\n\n private validate = (ev?: Event) => {\n if (this.validateOn === 'submitThenDirty') this.validateOn = 'dirty';\n\n if (!this.nativeInput.validity.valid) {\n if (this.showInlineError) {\n if (ev) ev.preventDefault();\n this.errorMessage = this.nativeInput.validationMessage;\n }\n this._invalid = true;\n } else this._invalid = false;\n\n this.nanoValidate.emit({\n isValid: !this._invalid,\n errorMessage: this.nativeInput.validationMessage,\n originalEvent: ev,\n });\n };\n\n private onInput = (ev: InputEvent) => {\n const input = ev.target as HTMLInputElement | null;\n this.value = input?.value || '';\n this.nanoInput.emit(ev);\n };\n\n private onBlur = () => {\n this.hasFocus = false;\n this.focusChanged();\n if (this.validateOn === 'dirty') this.validate();\n this.nanoBlur.emit();\n };\n\n private onFocus = () => {\n this.hasFocus = true;\n this.focusChanged();\n this.nanoFocus.emit();\n };\n\n private onKeydown = () => {\n if (this.shouldClearOnEdit()) {\n // Did the input value change after it was blurred and edited?\n if (this.didBlurAfterEdit && this.hasValue()) {\n // Clear the input\n this.clearTextInput();\n }\n\n // Reset the flag\n this.didBlurAfterEdit = false;\n }\n };\n\n private clearTextInput = (ev?: Event) => {\n if (this.clearInput && !this.readonly && !this.disabled && ev) {\n ev.preventDefault();\n ev.stopPropagation();\n }\n\n this.value = '';\n this.nativeInput.value = '';\n const event = new window.Event('change');\n this.nativeInput.dispatchEvent(event);\n };\n\n private focusChanged() {\n // If clearOnEdit is enabled and the input blurred but has a value, set a flag\n if (!this.hasFocus && this.shouldClearOnEdit() && this.hasValue()) {\n this.didBlurAfterEdit = true;\n }\n }\n\n private hasValue(): boolean {\n return this.getValue().length > 0;\n }\n\n private slotChangeObserver() {\n if (!Build.isBrowser) return;\n\n if (this.mo) this.mo.disconnect();\n const mo = (this.mo = new MutationObserver(() =>\n this.processSlottedContent()\n ));\n mo.observe(this.el, { childList: true, subtree: true });\n }\n\n private processSlottedContent() {\n // see if we have label / button content\n this.hasLabelSlot = !!this.el.querySelectorAll('[slot=\"label\"]');\n this.hasHelperSlot = !!this.el.querySelector('[slot=\"helper\"]');\n this.hasHelperEndSlot = !!this.el.querySelector('[slot=\"helper-end\"]');\n this.datalist = this.el.querySelector('nano-datalist:not([slot])');\n\n // breaking change introduced in v2. Rm in v3\n if (!!this.el.querySelector('[slot=\"inline-button\"]')) {\n console.warn(\n 'The `inline-button` slot was renamed to `end` in v2 - please update your code',\n this.el\n );\n }\n }\n\n connectedCallback() {\n this.debounceChanged();\n if (Build.isBrowser) {\n this.el.dispatchEvent(\n new CustomEvent('nanoDidLoad', {\n detail: this.el,\n })\n );\n }\n }\n\n disconnectedCallback() {\n if (Build.isBrowser) {\n document.dispatchEvent(\n new CustomEvent('nanoDidUnload', {\n detail: this.el,\n })\n );\n }\n if (this.mo) this.mo.disconnect();\n }\n\n componentDidLoad() {\n this.slotChangeObserver();\n this.hasRendered = true;\n if (this.autofocus) setTimeout((_) => this.setFocus(), 300);\n }\n\n componentWillLoad() {\n this.processSlottedContent();\n }\n\n render() {\n const value = this.getValue();\n const labelId = this.inputId + '-lbl';\n const moreId =\n this.showInlineError || this.hasHelperSlot ? this.inputId + '-more' : '';\n const helperEndId = this.hasHelperEndSlot ? this.inputId + '-helper' : '';\n this.rtl = (this.el.ownerDocument as Document).dir === 'rtl';\n\n const compWrapOptions = (({\n el,\n floatLabel,\n label,\n errorMessage,\n type,\n showInlineError,\n hasHelperSlot,\n hasLabelSlot,\n hideLabel,\n placeholder,\n maxlength,\n charCount,\n showCharCount,\n rtl,\n hasHelperEndSlot,\n }) => ({\n el,\n floatLabel,\n label,\n errorMessage,\n type,\n showInlineError,\n hasHelperSlot,\n hasLabelSlot,\n hideLabel,\n placeholder,\n maxlength,\n charCount,\n showCharCount,\n rtl,\n hasHelperEndSlot,\n }))(this);\n const wrapOptions = {\n ...compWrapOptions,\n labelId,\n moreId,\n helperEndId,\n hasValue: this.hasValue(),\n controlId: this.inputId,\n };\n\n const controlOptions = (({ clearInput, readonly, disabled }) => ({\n clearInput,\n readonly,\n disabled,\n clearControl: this.clearInput,\n }))(this);\n\n return (\n <Host\n aria-disabled={this.disabled ? 'true' : null}\n dir={this.rtl ? 'rtl' : null}\n class={{\n ...createColorClasses(this.color),\n 'has-value': this.hasValue(),\n 'has-focus': this.hasFocus,\n 'is-invalid': this._invalid,\n }}\n >\n <div>\n <FormControlWrap {...wrapOptions}>\n <FormControl\n {...controlOptions}\n onClearText={this.clearTextInput}\n control={this.el}\n ref={(el) => (this.nativeInputWrap = el)}\n >\n {this.type !== 'textarea' && (\n <input\n id={this.inputId}\n class=\"input__native-ctrl\"\n ref={(input) => (this.nativeInput = input)}\n aria-labelledby={labelId + ' ' + moreId + ' ' + helperEndId}\n disabled={this.disabled}\n accept={this.accept}\n autoCapitalize={this.autocapitalise}\n autoComplete={this.autocomplete}\n autoCorrect={this.autocorrect}\n autoFocus={this.autofocus}\n inputMode={this.inputmode}\n form={this.form}\n min={this.min}\n max={this.max}\n minLength={this.minlength}\n maxLength={this.maxlength}\n multiple={this.multiple}\n name={this.name}\n pattern={this.pattern}\n placeholder={this.placeholder}\n readOnly={this.readonly}\n required={this.required}\n spellcheck={this.spellcheck}\n step={this.step}\n size={this.size}\n type={this.type}\n value={value}\n onInput={this.onInput}\n onChange={this.onInput}\n onFocus={this.onFocus}\n onBlur={this.handleBlur}\n onKeyDown={this.onKeydown}\n onInvalid={this.validate}\n />\n )}\n {this.type === 'textarea' && (\n <textarea\n rows={this.floatLabel ? 1 : this.rows}\n id={this.inputId}\n class={{\n 'input__native-ctrl': true,\n input__resizable: this.resize === 'true',\n }}\n ref={(input) => (this.nativeInput = input)}\n aria-labelledby={labelId + ' ' + moreId + ' ' + helperEndId}\n disabled={this.disabled}\n autoCapitalize={this.autocapitalise}\n autoCorrect={this.autocorrect}\n autoFocus={this.autofocus}\n inputMode={this.inputmode}\n form={this.form}\n minLength={this.minlength}\n maxLength={this.maxlength}\n name={this.name}\n placeholder={this.placeholder}\n readOnly={this.readonly}\n required={this.required}\n spellcheck={this.spellcheck}\n value={value}\n onInput={this.onInput}\n onChange={this.onInput}\n onFocus={this.onFocus}\n onKeyDown={this.onKeydown}\n onInvalid={this.validate}\n onBlur={this.handleBlur}\n ></textarea>\n )}\n </FormControl>\n </FormControlWrap>\n <slot />\n </div>\n </Host>\n );\n }\n}\n"],"version":3}
|
@@ -263,6 +263,11 @@ const Sortable = class {
|
|
263
263
|
return node.parentNode.appendChild(clone);
|
264
264
|
}
|
265
265
|
/// Event handlers ///
|
266
|
+
addListeners(el, events, fn, opts) {
|
267
|
+
events
|
268
|
+
.split(' ')
|
269
|
+
.forEach((e) => el.addEventListener(e, fn, opts));
|
270
|
+
}
|
266
271
|
removeEventHandlers(ele) {
|
267
272
|
ele = ele || this.sortableHost;
|
268
273
|
ele.removeEventListener('mousedown', this.handleTrack);
|
@@ -271,8 +276,7 @@ const Sortable = class {
|
|
271
276
|
}
|
272
277
|
addEventHandlers(ele) {
|
273
278
|
ele = ele || this.sortableHost;
|
274
|
-
|
275
|
-
ele.addEventListener('touchstart', this.handleTrack);
|
279
|
+
this.addListeners(ele, 'mousedown touchstart', this.handleTrack);
|
276
280
|
ele.addEventListener('keydown', this.handleKeydown);
|
277
281
|
}
|
278
282
|
/**
|
@@ -414,16 +418,35 @@ const Sortable = class {
|
|
414
418
|
else
|
415
419
|
focus();
|
416
420
|
}
|
417
|
-
/**
|
418
|
-
* Tracks a pointer from touchstart/mousedown to touchend/mouseup. Note that the start state is fired following
|
419
|
-
* the first actual move event following a touchstart/mousedown */
|
421
|
+
/** Tracks a pointer from touchstart/mousedown to touchend/mouseup. */
|
420
422
|
handleTrack(e) {
|
423
|
+
// ignore if we've started dragging or right click
|
421
424
|
if (this.dragRequestPending || (e.button && e.button !== 1))
|
422
425
|
return;
|
423
|
-
|
426
|
+
// ignore touchmove events (namespace it so we can remove it)
|
427
|
+
const handleMove = (e) => {
|
428
|
+
if (e.cancelable)
|
429
|
+
e.preventDefault();
|
430
|
+
clearTimeout(this.mouseDownTimer);
|
431
|
+
};
|
432
|
+
// remove temporary events and reset timer
|
433
|
+
const resetTrack = () => {
|
434
|
+
clearTimeout(this.mouseDownTimer);
|
435
|
+
document.removeEventListener('touchmove', handleMove);
|
436
|
+
document.removeEventListener('contextmenu', this.finishOrder);
|
437
|
+
};
|
438
|
+
resetTrack();
|
439
|
+
// start a timer - only start dragging if pressed for 150ms
|
424
440
|
this.mouseDownTimer = window === null || window === void 0 ? void 0 : window.setTimeout(() => {
|
441
|
+
// ignore if this is not a valid drag target
|
425
442
|
if (!this.trackStart(e))
|
426
443
|
return;
|
444
|
+
// ignore touchmove events (they scroll the screen)
|
445
|
+
document.addEventListener('touchmove', handleMove, {
|
446
|
+
passive: false,
|
447
|
+
});
|
448
|
+
// cancel if user presses and holds (without move) for context menu
|
449
|
+
document.addEventListener('contextmenu', this.finishOrder);
|
427
450
|
this.addAriaMsg(this.grabbedHelperText(this.draggedElement));
|
428
451
|
drag.drag(this.sortableHost, {
|
429
452
|
initialEvent: e,
|
@@ -433,6 +456,7 @@ const Sortable = class {
|
|
433
456
|
},
|
434
457
|
onStop: () => {
|
435
458
|
this.nanoDropped.emit({ element: this.draggedElement });
|
459
|
+
resetTrack();
|
436
460
|
const didStop = () => {
|
437
461
|
this.addAriaMsg(this.droppedHelperText(this.draggedElement));
|
438
462
|
requestAnimationFrame(() => this.finishOrder());
|
@@ -444,8 +468,9 @@ const Sortable = class {
|
|
444
468
|
didStop();
|
445
469
|
},
|
446
470
|
});
|
447
|
-
},
|
448
|
-
|
471
|
+
}, 150);
|
472
|
+
// reset track timer & cancel DnD on mouseup / touchend / touchmove
|
473
|
+
this.addListeners(document, 'mouseup touchend touchmove', () => clearTimeout(this.mouseDownTimer), { once: true });
|
449
474
|
}
|
450
475
|
/**
|
451
476
|
* Initialized a drag and drop sequence if a child node was clicked that matches the itemSelector property.
|
@@ -488,40 +513,6 @@ const Sortable = class {
|
|
488
513
|
this.draggedElement.classList.add(this.placeholderClass);
|
489
514
|
return true;
|
490
515
|
}
|
491
|
-
/** Ends re-ordering */
|
492
|
-
finishOrder() {
|
493
|
-
if (!this.draggedElement)
|
494
|
-
return;
|
495
|
-
const updated = Array.from(this.sortableHost.querySelectorAll(this.itemSelector)).filter((ele) => ele !== this.draggedElementClone);
|
496
|
-
const originalIndex = this.sortableNodes.indexOf(this.draggedElement);
|
497
|
-
const targetIndex = updated.indexOf(this.draggedElement);
|
498
|
-
if (this.handleSelector) {
|
499
|
-
const targetHandle = this.draggedElement.querySelector(this.handleSelector);
|
500
|
-
targetHandle.classList.remove(this.handleDraggedClass);
|
501
|
-
}
|
502
|
-
if (originalIndex !== targetIndex) {
|
503
|
-
const orderChangeEv = this.nanoOrderChange.emit({
|
504
|
-
element: this.draggedElement,
|
505
|
-
originalIndex,
|
506
|
-
targetIndex,
|
507
|
-
});
|
508
|
-
if (orderChangeEv.defaultPrevented) {
|
509
|
-
/** Event was prevented, wait a moment to send element back to whence it came - gives a nicer visual queue */
|
510
|
-
this.animationPromise = new Promise((resolve) => {
|
511
|
-
setTimeout(() => {
|
512
|
-
this.insertAtTarget(this.draggedElement, updated[originalIndex]);
|
513
|
-
this.reset();
|
514
|
-
this.dragRequestPending = false;
|
515
|
-
resolve();
|
516
|
-
}, 200);
|
517
|
-
});
|
518
|
-
return;
|
519
|
-
}
|
520
|
-
this.addAriaMsg(this.reorderHelperText(this.draggedElement, updated, targetIndex + 1));
|
521
|
-
}
|
522
|
-
this.reset();
|
523
|
-
this.dragRequestPending = false;
|
524
|
-
}
|
525
516
|
/// Component lifecycle ///
|
526
517
|
constructor(hostRef) {
|
527
518
|
index.registerInstance(this, hostRef);
|
@@ -534,6 +525,40 @@ const Sortable = class {
|
|
534
525
|
this.animatedElements = [];
|
535
526
|
this.keyboardHandleMap = new Map();
|
536
527
|
this.sortableId = `nano-sortable-${sortableIds++}`;
|
528
|
+
/** Ends re-ordering */
|
529
|
+
this.finishOrder = () => {
|
530
|
+
if (!this.draggedElement)
|
531
|
+
return;
|
532
|
+
const updated = Array.from(this.sortableHost.querySelectorAll(this.itemSelector)).filter((ele) => ele !== this.draggedElementClone);
|
533
|
+
const originalIndex = this.sortableNodes.indexOf(this.draggedElement);
|
534
|
+
const targetIndex = updated.indexOf(this.draggedElement);
|
535
|
+
if (this.handleSelector) {
|
536
|
+
const targetHandle = this.draggedElement.querySelector(this.handleSelector);
|
537
|
+
targetHandle.classList.remove(this.handleDraggedClass);
|
538
|
+
}
|
539
|
+
if (originalIndex !== targetIndex) {
|
540
|
+
const orderChangeEv = this.nanoOrderChange.emit({
|
541
|
+
element: this.draggedElement,
|
542
|
+
originalIndex,
|
543
|
+
targetIndex,
|
544
|
+
});
|
545
|
+
if (orderChangeEv.defaultPrevented) {
|
546
|
+
/** Event was prevented, wait a moment to send element back to whence it came - gives a nicer visual queue */
|
547
|
+
this.animationPromise = new Promise((resolve) => {
|
548
|
+
setTimeout(() => {
|
549
|
+
this.insertAtTarget(this.draggedElement, updated[originalIndex]);
|
550
|
+
this.reset();
|
551
|
+
this.dragRequestPending = false;
|
552
|
+
resolve();
|
553
|
+
}, 200);
|
554
|
+
});
|
555
|
+
return;
|
556
|
+
}
|
557
|
+
this.addAriaMsg(this.reorderHelperText(this.draggedElement, updated, targetIndex + 1));
|
558
|
+
}
|
559
|
+
this.reset();
|
560
|
+
this.dragRequestPending = false;
|
561
|
+
};
|
537
562
|
/**
|
538
563
|
* Moves the active node's clone to follow the pointer. The node that the clone intersects with (via hitTest) is
|
539
564
|
* the insert point for updated sorting */
|
@@ -584,7 +609,7 @@ const Sortable = class {
|
|
584
609
|
this.dropzoneSelector = undefined;
|
585
610
|
this.helperText = 'Press "Space" or "Enter" to enable element reordering and use the arrow keys to reorder items.' +
|
586
611
|
'Press "Escape" to cancel reordering. Alternatively, use your mouse to drag / reorder.';
|
587
|
-
this.itemDescriptor = (el) => `"${el.textContent.trim()}"`;
|
612
|
+
this.itemDescriptor = (el) => `"${el === null || el === void 0 ? void 0 : el.textContent.trim()}"`;
|
588
613
|
this.grabbedHelperText = (el) => `${this.itemDescriptor(el)} grabbed`;
|
589
614
|
this.droppedHelperText = (el) => `${this.itemDescriptor(el)} dropped`;
|
590
615
|
this.reorderHelperText = (el, elements, position) => `The list has been reordered, ${this.itemDescriptor(el)} is now item ${position} of ${elements.length}`;
|
@@ -1 +1 @@
|
|
1
|
-
{"file":"nano-sortable.entry.cjs.js","mappings":";;;;;;;;;;;AAAA,MAAM,WAAW,GAAG,8UAA8U;;ACmBlW;AACA,MAAM,cAAc,GAAG;EACrB,UAAU,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE;EAC1B,QAAQ,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE;CACzB,CAAC;AAEF,IAAI,WAAW,GAAG,CAAC,CAAC;MAkBP,QAAQ;EAMnB,wBAAwB;IACtB,IAAI,CAAC,sBAAsB,EAAE,CAAC;GAC/B;EAOD,0BAA0B;IACxB,IAAI,CAAC,sBAAsB,EAAE,CAAC;IAC9B,IAAI,CAAC,sBAAsB,EAAE,CAAC;GAC/B;EAmFD,gCAAgC;IAC9B,IAAI,CAAC,sBAAsB,EAAE,CAAC;GAC/B;EAMD,yBAAyB,CAAC,OAAQ,EAAE,MAAoB;IACtD,IAAI,MAAM;MAAE,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC;IAE7C,IAAI,CAAC,gBAAgB,EAAE,CAAC;IACxB,IAAI,CAAC,sBAAsB,EAAE,CAAC;IAC9B,IAAI,CAAC,sBAAsB,EAAE,CAAC;IAE9B,IAAI,IAAI,CAAC,mBAAmB,EAAE;;MAE5B,IAAI,CAAC,mBAAmB,CAAC,KAAK,CAAC,QAAQ,GAAG,UAAU,CAAC;KACtD;GACF;;EA6CD,MAAM,sBAAsB;;IAC1B,IAAI,IAAI,CAAC,cAAc,E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B,GAAG,CACJ,CAAC;GACH;EAED,iBAAiB;IACf,IAAI,CAAC,gBAAgB,EAAE,CAAC;IACxB,IAAI,CAAC,sBAAsB,EAAE,CAAC;IAC9B,IAAI,CAAC,sBAAsB,EAAE,CAAC;IAE9B,IAAuB,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC,EAAE;;MAEtE,IAAI,CAAC,IAAI,CAAC,kBAAkB,CAC1B,WAAW,EACX,oCAAoC,IAAI,CAAC,UAAU,KAAK,IAAI,CAAC,UAAU,QAAQ,CAChF,CAAC;KACH;GACF;EAED,oBAAoB;;IAClB,IAAI,CAAC,mBAAmB,EAAE,CAAC;IAC3B,MAAA,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC,0CAAE,MAAM,EAAE,CAAC;IAEzD,IAAI,IAAI,CAAC,gBAAgB,EAAE;MACzB,IAAI,CAAC,gBAAgB,CAAC,UAAU,EAAE,CAAC;MACnC,IAAI,CAAC,gBAAgB,GAAG,SAAS,CAAC;KACnC;GACF;EAED,MAAM;IACJ,QACEC,QAACC,UAAI,QACHD,iBACE,KAAK,EAAC,uBAAuB,eACnB,QAAQ,mBACJ,WAAW,iBACb,MAAM,EAClB,IAAI,EAAC,KAAK,EACV,IAAI,EAAC,eAAe,IAEnB,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,GAAG,MACzBA,qBAAM,GAAG,CAAO,CACjB,CAAC,CACE,EACNA,qBAAQ,CACH,EACP;GACH;;;;;;;;;;;;;","names":["writeTask","drag","readTask","nanoDebounce","h","Host"],"sources":["./src/components/sortable/sortable.scss?tag=nano-sortable&encapsulation=shadow","./src/components/sortable/sortable.tsx"],"sourcesContent":["@use '../../global/style/utilities/globals' as g;\n\n:host {\n position: relative;\n display: block;\n}\n\n.sortable__live-region {\n @include g.visually-hide();\n}\n","import {\n Prop,\n Element,\n Event,\n EventEmitter,\n h,\n Component,\n ComponentInterface,\n Watch,\n Method,\n State,\n Host,\n readTask,\n writeTask,\n Build,\n} from '@stencil/core';\nimport { drag } from '../../utils/drag';\nimport { nanoDebounce } from '../..';\n\n// Orientation map to limit dragging to horizontal or vertical.\nconst orientationMap = {\n horizontal: { x: 1, y: 0 },\n vertical: { x: 0, y: 1 },\n};\n\nlet sortableIds = 0;\n\n/**\n * An accessible and flexible re-order / sort utility component.\n *\n *- Drag and drop via mouse, touch or keyboard\n *- Live announcements for screen readers\n *- Works with or without an explicit handle (although with is preferable)\n\n * @part announcements - the a11y, live region. Visually hidden by default\n *\n * @slot - The default slot containing any items you might want to sort\n */\n@Component({\n tag: 'nano-sortable',\n shadow: true,\n styleUrl: 'sortable.scss',\n})\nexport class Sortable implements ComponentInterface {\n /// Public API & surface ///\n\n /** A css query selector which matches a set of elements that should be sortable. e.g. `<li>` or `<tr>` */\n @Prop() itemSelector = 'li';\n @Watch('itemSelector')\n handleItemSelectorChange() {\n this.refreshKeyboardHandles();\n }\n\n /** A css query selector which matches an element *within* the `itemSelector` element\n * which will act like a drag handle. **Note** For keyboard a11y it's recommended\n * to use `handleSelector` when possible. Alternatively, the `createKeyboardHandle` prop will be used */\n @Prop() handleSelector?: string;\n @Watch('handleSelector')\n handleHandleSelectorChange() {\n this.refreshKeyboardHandles();\n this.attachMutationObserver();\n }\n\n /** When dragging between grouped collections of items, it is possible to drag all sortable items from one group to another.\n * At that point, you will not be able to drag items back to the original group.\n * A `dropzoneSelector` allows you to define a placeholder area where items can always be dropped.\n */\n @Prop() dropzoneSelector?: string;\n\n /** Accessibility helper text applied to handle controls */\n @Prop() helperText =\n 'Press \"Space\" or \"Enter\" to enable element reordering and use the arrow keys to reorder items.' +\n 'Press \"Escape\" to cancel reordering. Alternatively, use your mouse to drag / reorder.';\n\n /**\n * As a sortable element is interacted with, announcements are made to screen readers\n * - informing the user what is changing.\n * By default, the text from the element is extracted to describe the interacted with element.\n * Use this function to provide a more meaningful, concise item descriptor\n * @param el the element being interacted with\n * @returns a string, describing the element being interacted with\n */\n @Prop() itemDescriptor = (el: Element) => `\"${el.textContent.trim()}\"`;\n\n /**\n * Used to generate a screen reader live update, informing the user of the current element being grabbed.\n * @param el the element that has been grabbed by the user\n * @returns a string, describing the element being grabbed\n */\n @Prop() grabbedHelperText = (el: Element) =>\n `${this.itemDescriptor(el)} grabbed`;\n\n /**\n * Used to generate a screen reader live update, informing the user of the current element being dropped.\n * @param el the element that has been dropped by the user\n * @returns a string, describing the element that has been dropped\n */\n @Prop() droppedHelperText = (el: Element) =>\n `${this.itemDescriptor(el)} dropped`;\n\n /**\n * Used to generate a screen reader live update, informing the user when items have been reordered.\n * @param el the element that has been reordered by the user\n * @param elements the elements in the sortable list\n * @param position the new position of the dropped element\n * @returns a string, describing the element being dropped\n */\n @Prop() reorderHelperText = (\n el: Element,\n elements: Element[],\n position: number\n ) =>\n `The list has been reordered, ${this.itemDescriptor(\n el\n )} is now item ${position} of ${elements.length}`;\n\n /**\n * A function that should attach a keyboard accessible control.\n * When a `handleSelector` is not used - to allow keyboard accessibility -\n * `createKeyboardHandle` should render a focusable element.\n *\n * If your sortable item is itself focusable,\n * you must use this function to render a control *outside* of the focusable element.\n * @param _number\n * @param _element\n * @returns a function that attaches a keyboard accessible handle control element.\n * The function itself *must* return the handle element.\n */\n @Prop() createKeyboardHandle = (_number: number, _element: Element) => {\n const handleTpl = /* html */ `\n <nano-icon-button\n slot=\"end\"\n icon-name=\"light/arrows\"\n class=\"nano-sortable__keyboard-handle visually-hidden\"\n label=\"Re-order this item\"\n ></nano-icon-button>`;\n const div = globalThis.document.createElement('div');\n div.innerHTML = handleTpl;\n\n const handle = div.children[0] as HTMLElement;\n _element.append(handle);\n return handle;\n };\n @Watch('createKeyboardHandle')\n handleCreateKeyboardHandleChange() {\n this.refreshKeyboardHandles();\n }\n\n /** use `sortableHostElement` to watch a sortable list without needing to wrap in `nano-sortable`.\n * Note that the `sortableHostElement` element css `position` will be set to `relative` */\n @Prop() sortableHostElement?: HTMLElement;\n @Watch('sortableHostElement')\n handleSortableHostElement(_newVal?, oldVal?: HTMLElement) {\n if (oldVal) this.removeEventHandlers(oldVal);\n\n this.addEventHandlers();\n this.refreshKeyboardHandles();\n this.attachMutationObserver();\n\n if (this.sortableHostElement) {\n // sortable host must have position relative\n this.sortableHostElement.style.position = 'relative';\n }\n }\n\n /** Items being sorted will animate into place */\n @Prop() animationEnabled = true;\n\n /** Use this class to change how the element looks whilst being sorted */\n @Prop() draggedClass = 'nano-sortable__dragged';\n\n /** Use this class to change how the handle looks whilst being sorted */\n @Prop() handleDraggedClass = 'nano-sortable__handle-dragged';\n\n /** Use this class to change how the element looks when acting as a placeholder */\n @Prop() placeholderClass = 'nano-sortable__placeholder';\n\n /** Used in-conjunction with `dropzoneSelector`, applied when a dropzone is dragged over */\n @Prop() dropzoneActiveClass?: string = '';\n\n /** The css animation timing applied when `animationEnabled` is `true` */\n @Prop() animationTiming: any = { duration: 200, easing: 'ease-out' };\n\n /** The axis to lock dragging elements to. `undefined` means any axis */\n @Prop() orientation?: 'horizontal' | 'vertical';\n\n /** Dragged items by default, will take whatever default css is applied in situ.\n * When sortable items' dimensions are dynamic (i.e they can shrink / grow via the space allowed) dragging items can look 'wrong'.\n * Apply `dragResize` to read & recreate the dragged items current dimensions when dragged. */\n @Prop() dragResize = false;\n\n /** Fired when an the order changes. Use this to update any underlying data model.\n * `event.preventDefault()` to prevent the element being moved; will revert to original position. */\n @Event() nanoOrderChange: EventEmitter<{\n element: HTMLElement;\n originalIndex: number;\n targetIndex: number;\n }>;\n\n /** Fired when a sortable element is picked-up; via keyboard, mouse or touch.\n * `event.preventDefault()` to prevent the element being picked-up. */\n @Event() nanoGrabbed: EventEmitter<{ element: HTMLElement; index: number }>;\n\n /** Fired when a sortable element is dropped after having been picked up. */\n @Event() nanoDropped: EventEmitter<{ element: HTMLElement }>;\n\n /** If sortable elements change dynamically, use this method to add handle controls to new elements */\n @Method()\n async refreshKeyboardHandles() {\n if (this.handleSelector) {\n if (this.keyboardHandleMap?.size) {\n this.keyboardHandleMap.clear();\n }\n\n this.sortableHost\n .querySelectorAll<HTMLElement>(this.handleSelector)\n .forEach((handle) => {\n if (!handle.getAttribute('aria-describedby'))\n handle.setAttribute('aria-describedby', this.sortableId);\n const sortEle = handle.closest<HTMLElement>(this.itemSelector);\n if (sortEle) this.keyboardHandleMap.set(handle, sortEle);\n });\n return;\n }\n\n if (this.keyboardHandleMap?.size) {\n this.keyboardHandleMap?.forEach((_ele, handle) => handle.remove());\n this.keyboardHandleMap.clear();\n }\n this.sortableHost\n .querySelectorAll<HTMLElement>(this.itemSelector)\n .forEach((ele, i) => {\n const handle = this.createKeyboardHandle(i, ele);\n if (!handle) {\n console.error(\n '`createKeyboardHandle` *must* return the handle element it creates'\n );\n return;\n }\n this.keyboardHandleMap.set(handle, ele);\n handle.setAttribute('aria-describedby', this.sortableId);\n });\n }\n\n /// Private state & logic ///\n\n @Element() host: HTMLNanoSortableElement;\n private dragRequestPending = false;\n private draggedElement?: HTMLElement;\n private draggedElementClone?: HTMLElement;\n private draggedElementOrigin?: HTMLElement;\n private sortableNodes: HTMLElement[] = [];\n private dropzoneNodes: HTMLElement[] = [];\n private animatedElements: HTMLElement[] = [];\n private animationPromise?: Promise<void>;\n private keyboardHandleMap: Map<HTMLElement, HTMLElement> = new Map();\n private sortableId = `nano-sortable-${sortableIds++}`;\n private mouseDownTimer: number;\n private mutationObserver: MutationObserver;\n\n @State() keyboardSortActive = false;\n @State() ariaTextList: string[] = [];\n\n /**\n * Get instance of sortable host.\n * By default it is `nano-sortable` which can be overridden by property `sortableHostElement`\n */\n get sortableHost() {\n if (this.sortableHostElement) return this.sortableHostElement;\n return this.host;\n }\n\n /**\n * Queues aria messages which are then displayed in a 'live' region.\n * Messages are cleared after 10s\n * @param msg aria message to announce\n */\n private addAriaMsg(msg: string) {\n this.ariaTextList = [...this.ariaTextList, msg];\n\n setTimeout(() => {\n const mIdx = this.ariaTextList.indexOf(msg);\n this.ariaTextList.splice(mIdx, 1);\n this.ariaTextList = [...this.ariaTextList];\n }, 10000);\n }\n\n /**\n * Try to stop text highlight whilst dragging\n * @param userSelect\n */\n private updateUserSelectStyle(userSelect: '' | 'none') {\n this.host.style.userSelect = userSelect;\n // @ts-ignore\n this.host.style.MozUserSelect = userSelect;\n // @ts-ignore\n this.host.style.msUserSelect = userSelect;\n this.host.style.webkitUserSelect = userSelect;\n }\n\n /**\n * Fast and simple hit test to check whether the center of a node intersects with the rectangle of any of the\n * given targets. Returns an array of matches.\n * @param node\n * @param targets\n * @returns all the items that currently intersect with the target node\n */\n private hitTest(node: HTMLElement, targets: HTMLElement[]): HTMLElement[] {\n const {\n left: l,\n top: t,\n width: w,\n height: h,\n } = node.getBoundingClientRect();\n const x = l + w / 2;\n const y = t + h / 2;\n\n return targets.filter((item) => {\n const { left, right, top, bottom } = item.getBoundingClientRect();\n return !(x < left || x > right || y < top || y > bottom);\n });\n }\n\n /**\n * Returns a boolean indicating whether the node is currently in an animation.\n * @param node\n * @returns whether a node is currently animating or not\n */\n private isAnimating(node: HTMLElement) {\n return this.animatedElements.indexOf(node) !== -1;\n }\n\n /**\n * Triggers a CSS animation on a node with the given dx and dy. Used following dom updates to make it appear as\n * if nodes animate from their old to their new position in the dom. */\n private animateNode(node: HTMLElement, dx = 0, dy = 0) {\n if (!node.animate) {\n return;\n }\n\n // keep a stack of currently animating nodes to exclude as drag & drop targets.\n this.animatedElements.push(node);\n\n node.style.willChange = 'transform';\n\n // animate from dx/dy (old node position) to none (new node position)\n writeTask(() => {\n this.animationPromise = new Promise((resolve) => {\n node\n .animate(\n [\n { transform: `translate3d(${dx}px, ${dy}px, 0)` },\n { transform: 'none' },\n ],\n this.animationTiming\n )\n .addEventListener(\n 'finish',\n () => {\n const index = this.animatedElements.indexOf(node);\n node.style.willChange = '';\n\n if (index !== -1) {\n // splice out when done to unlock as a valid target\n this.animatedElements.splice(index, 1);\n }\n\n resolve();\n delete this.animationPromise;\n },\n { once: true }\n );\n });\n });\n }\n\n /**\n * Inserts node at target to update sibling sorting. If the node precedes the target, it is inserted after it;\n * If it follows the target, it is inserted before it. This ensures any node can be dragged from the very\n * beginning to the very end and vice versa. The animateNode function is called for all nodes that moved because\n * of this dom update */\n private insertAtTarget(node: Element, target: HTMLElement) {\n if (!node || !target) return;\n\n let offsets: any[] = [];\n if (this.animationEnabled) {\n offsets = this.sortableNodes.map((item) => ({\n x: item.offsetLeft,\n y: item.offsetTop,\n }));\n }\n\n if (!node.isConnected || !target.isConnected) return;\n\n if (this.dropzoneNodes.indexOf(target) > -1) {\n target.append(node);\n } else {\n const nodeComparison = node.compareDocumentPosition(target);\n let position;\n\n if (nodeComparison & this.host.DOCUMENT_POSITION_FOLLOWING) {\n position =\n target.parentNode === node.parentNode ? 'afterend' : 'beforebegin';\n }\n if (nodeComparison & this.host.DOCUMENT_POSITION_PRECEDING) {\n position =\n target.parentNode === node.parentNode ? 'beforebegin' : 'afterend';\n }\n if (position) target.insertAdjacentElement(position, node);\n }\n\n if (this.animationEnabled) {\n this.sortableNodes.forEach((sortableNode, i) => {\n const { x, y } = offsets[i];\n const dx = x - sortableNode.offsetLeft;\n const dy = y - sortableNode.offsetTop;\n if (dx !== 0 || dy !== 0) {\n this.animateNode(sortableNode, dx, dy);\n }\n });\n }\n }\n\n private reset() {\n if (\n this.draggedElementClone !== undefined &&\n this.draggedElementClone.parentNode !== null\n ) {\n this.draggedElementClone.parentNode.removeChild(this.draggedElementClone);\n }\n\n if (\n this.draggedElement &&\n this.draggedElement.parentNode &&\n this.draggedElementOrigin\n ) {\n this.draggedElement.classList.remove(this.placeholderClass);\n }\n\n if (this.dropzoneActiveClass && this.dropzoneNodes.length) {\n this.dropzoneNodes.forEach((dze) =>\n dze.classList.remove(this.dropzoneActiveClass)\n );\n }\n\n delete this.draggedElementClone;\n delete this.draggedElement;\n\n this.dropzoneNodes = [];\n this.sortableNodes = [];\n this.animatedElements = [];\n this.dragRequestPending = false;\n this.updateUserSelectStyle('');\n }\n\n /**\n * Clones a given node to visually drag around. The original node is left in the same flow as its siblings.\n * Clone styles are added onto the style object directly, since the ::slotted()\n * selector can't universally target nodes that may be nested an unknown amount of shadow dom levels deep\n * @param node html node to clone\n * @returns the cloned html node\n */\n private createClone(node: HTMLElement): HTMLElement {\n const clone = node.cloneNode(true) as HTMLElement;\n if (node.id) clone.id = 'clone__' + clone.id;\n\n /**\n * Bugfix for table row sorting.\n * During dragging table rows shrink, so we manually set them width of original node.\n */\n Array.from(clone.children).forEach((nodeChild: HTMLElement, index) => {\n const clonedNodeChild = nodeChild;\n const originalNodeChild = node.children.item(index) as HTMLElement;\n\n if (originalNodeChild) {\n clonedNodeChild.style.width = `${originalNodeChild.offsetWidth}px`;\n }\n });\n const {\n offsetLeft: x,\n offsetTop: y,\n offsetWidth: w,\n offsetHeight: h,\n } = node;\n\n Object.assign(clone.style, {\n position: 'absolute',\n left: `calc(${x}px - var(--grab-offset-x, 0px))`,\n top: `calc(${y}px - var(--grab-offset-y, 0px))`,\n height: this.dragResize ? `${h}px` : undefined,\n width: this.dragResize ? `${w}px` : undefined,\n willChange: 'transform,opacity',\n });\n\n clone.classList.add(this.draggedClass);\n\n return node.parentNode!.appendChild(clone);\n }\n\n /// Event handlers ///\n\n private removeEventHandlers(ele?: HTMLElement) {\n ele = ele || this.sortableHost;\n ele.removeEventListener('mousedown', this.handleTrack);\n ele.removeEventListener('touchstart', this.handleTrack);\n ele.removeEventListener('keydown', this.handleKeydown);\n }\n\n private addEventHandlers(ele?: HTMLElement) {\n ele = ele || this.sortableHost;\n ele.addEventListener('mousedown', this.handleTrack);\n ele.addEventListener('touchstart', this.handleTrack);\n ele.addEventListener('keydown', this.handleKeydown);\n }\n\n /**\n * Watch for any changes in grab-able handle elements.\n */\n private attachMutationObserver() {\n if (!Build.isBrowser) return;\n\n if (this.mutationObserver) {\n this.mutationObserver.disconnect();\n this.mutationObserver = undefined;\n }\n\n this.mutationObserver = new MutationObserver(() => {\n const currHandles = Array.from(this.keyboardHandleMap.values());\n const newHandles = Array.from(\n this.sortableHost.querySelectorAll<HTMLElement>(this.itemSelector)\n );\n\n // simple test for equality\n if (\n currHandles.length !== newHandles.length ||\n !!newHandles.find((h) => !currHandles.includes(h))\n ) {\n this.refreshKeyboardHandles();\n }\n });\n this.mutationObserver.observe(this.sortableHost, {\n subtree: true,\n childList: true,\n });\n }\n\n private handleKeydown(e: KeyboardEvent) {\n const targetElement = e.target as HTMLElement;\n let foundHandle: HTMLElement;\n let sortEle: HTMLElement;\n\n if (this.handleSelector) {\n foundHandle = targetElement.closest(this.handleSelector);\n sortEle = targetElement.closest(this.itemSelector);\n } else {\n sortEle = this.keyboardHandleMap.get(targetElement);\n foundHandle = targetElement;\n }\n\n // have we found a handle and matching sort element from the keydown element\n if (!foundHandle || !sortEle) return;\n\n const activateSort = (isActive: boolean) => {\n this.keyboardSortActive = isActive;\n this.draggedElement = isActive ? sortEle : undefined;\n sortEle.classList.toggle(this.draggedClass, isActive);\n foundHandle.classList.toggle(this.handleDraggedClass, isActive);\n\n if (isActive) {\n this.addAriaMsg(this.grabbedHelperText(sortEle));\n document.addEventListener('mousedown', () => activateSort(false), {\n once: true,\n });\n } else {\n this.addAriaMsg(this.droppedHelperText(sortEle));\n }\n };\n\n // start editing this element's order?\n if ([' ', 'Space', 'Enter'].includes(e.key)) {\n e.preventDefault();\n\n if (!this.keyboardSortActive) {\n // grabbed the element\n activateSort(true);\n\n this.sortableNodes =\n Array.from(this.sortableHost.querySelectorAll(this.itemSelector)) ||\n [];\n const nanoGrabbedEv = this.nanoGrabbed.emit({\n element: sortEle,\n index: this.sortableNodes.indexOf(sortEle),\n });\n\n if (nanoGrabbedEv.defaultPrevented) {\n activateSort(false);\n return;\n }\n } else {\n // dropped the element\n activateSort(false);\n this.nanoDropped.emit({ element: sortEle });\n }\n return;\n }\n if (!this.keyboardSortActive) return;\n\n // Tabbing away from this handle - deactivate\n if (['Escape', 'Tab'].includes(e.key)) activateSort(false);\n\n let moveKeys = ['Home', 'End'];\n if (!this.orientation || this.orientation === 'horizontal')\n moveKeys = [...moveKeys, 'ArrowRight', 'ArrowLeft'];\n if (!this.orientation || this.orientation === 'vertical')\n moveKeys = [...moveKeys, 'ArrowUp', 'ArrowDown'];\n\n if (!moveKeys.includes(e.key)) return;\n\n // move the element with the keyboard\n e.preventDefault();\n\n /** Collect all elements that have drag positions.\n * Both sortable elements and 'dropzones' (placeholders where items can always be placed) */\n\n this.sortableNodes =\n Array.from(this.sortableHost.querySelectorAll(this.itemSelector)) || [];\n this.dropzoneNodes =\n Array.from(this.sortableHost.querySelectorAll(this.dropzoneSelector)) ||\n [];\n const currIdx = this.sortableNodes.indexOf(this.draggedElement);\n let curDzIdx: number = -1;\n\n if (this.dropzoneNodes.length) {\n const curDropzone = this.draggedElement.closest<HTMLElement>(\n this.dropzoneSelector\n );\n curDzIdx = this.dropzoneNodes.indexOf(curDropzone);\n curDzIdx = curDzIdx > -1 ? curDzIdx : -1;\n }\n\n /** If we don't have a next / prev sortable element in our list, test to see if there's a dropzone instead */\n const prevEle =\n currIdx - 1 < 0 && curDzIdx > -1\n ? this.dropzoneNodes[curDzIdx - 1]\n : this.sortableNodes[currIdx - 1];\n const nextEle =\n currIdx + 1 === this.sortableNodes.length && curDzIdx > -1\n ? this.dropzoneNodes[curDzIdx + 1]\n : this.sortableNodes[currIdx + 1];\n\n if (e.key === 'Home') {\n this.insertAtTarget(this.draggedElement, this.sortableNodes[0]);\n }\n if (e.key === 'End') {\n this.insertAtTarget(\n this.draggedElement,\n this.sortableNodes[this.sortableNodes.length - 1]\n );\n }\n if (['ArrowRight', 'ArrowDown'].includes(e.key)) {\n this.insertAtTarget(this.draggedElement, nextEle);\n }\n if (['ArrowLeft', 'ArrowUp'].includes(e.key)) {\n this.insertAtTarget(this.draggedElement, prevEle);\n }\n\n this.finishOrder();\n this.draggedElement = sortEle;\n\n const focus = () => {\n requestAnimationFrame(() => {\n typeof foundHandle['setFocus'] === 'function'\n ? (foundHandle as HTMLNanoIconButtonElement).setFocus()\n : foundHandle.focus();\n });\n };\n\n // replace focus to handle so we don't 'drop' the element\n if (this.animationPromise) this.animationPromise.then(() => focus());\n else focus();\n }\n\n /**\n * Tracks a pointer from touchstart/mousedown to touchend/mouseup. Note that the start state is fired following\n * the first actual move event following a touchstart/mousedown */\n private handleTrack(e: PointerEvent) {\n if (this.dragRequestPending || (e.button && e.button !== 1)) return;\n\n clearTimeout(this.mouseDownTimer);\n this.mouseDownTimer = window?.setTimeout(() => {\n if (!this.trackStart(e)) return;\n\n this.addAriaMsg(this.grabbedHelperText(this.draggedElement));\n\n drag(this.sortableHost, {\n initialEvent: e,\n relative: true,\n onMove: (x, y) => {\n this.trackMove(x, y);\n },\n onStop: () => {\n this.nanoDropped.emit({ element: this.draggedElement });\n\n const didStop = () => {\n this.addAriaMsg(this.droppedHelperText(this.draggedElement));\n requestAnimationFrame(() => this.finishOrder());\n };\n if (this.animationPromise) {\n this.animationPromise.then(() => didStop());\n } else didStop();\n },\n });\n }, 100);\n document.addEventListener(\n 'mouseup',\n () => clearTimeout(this.mouseDownTimer),\n { once: true }\n );\n }\n\n /**\n * Initialized a drag and drop sequence if a child node was clicked that matches the itemSelector property.\n * OR If a handleSelector is defined, a node matching this selector must be clicked instead\n * @returns boolean - whether tracking for this event should continue or not\n */\n private trackStart(e: Event) {\n const targetElement = e.target as HTMLElement;\n let targetHandle: HTMLElement;\n\n // If we have a handle set, return now if not being pressed\n if (this.handleSelector) {\n targetHandle = targetElement.closest(this.handleSelector);\n\n if (!targetHandle) return;\n targetHandle.classList.add(this.handleDraggedClass);\n }\n\n // Check that we've found the target element via itemSelector\n const node = targetElement.closest<HTMLElement>(this.itemSelector);\n if (!node) return false;\n\n this.sortableNodes =\n Array.from(this.sortableHost.querySelectorAll(this.itemSelector)) || [];\n const nanoGrabbedEv = this.nanoGrabbed.emit({\n element: node,\n index: this.sortableNodes.indexOf(node),\n });\n if (nanoGrabbedEv.defaultPrevented) return false;\n\n // Element found... start everything\n e.preventDefault();\n this.updateUserSelectStyle('none');\n this.dragRequestPending = true;\n this.draggedElement = node;\n this.dropzoneNodes =\n Array.from(this.sortableHost.querySelectorAll(this.dropzoneSelector)) ||\n [];\n this.draggedElementClone = this.createClone(node);\n this.draggedElementOrigin = node.nextSibling as HTMLElement;\n this.animatedElements = [];\n this.draggedElement!.classList.add(this.placeholderClass);\n return true;\n }\n\n /** Ends re-ordering */\n private finishOrder() {\n if (!this.draggedElement) return;\n\n const updated = Array.from(\n this.sortableHost.querySelectorAll<HTMLElement>(this.itemSelector)\n ).filter((ele) => ele !== this.draggedElementClone);\n const originalIndex = this.sortableNodes.indexOf(this.draggedElement);\n const targetIndex = updated.indexOf(this.draggedElement);\n\n if (this.handleSelector) {\n const targetHandle = this.draggedElement.querySelector(\n this.handleSelector\n );\n targetHandle.classList.remove(this.handleDraggedClass);\n }\n\n if (originalIndex !== targetIndex) {\n const orderChangeEv = this.nanoOrderChange.emit({\n element: this.draggedElement,\n originalIndex,\n targetIndex,\n });\n\n if (orderChangeEv.defaultPrevented) {\n /** Event was prevented, wait a moment to send element back to whence it came - gives a nicer visual queue */\n this.animationPromise = new Promise((resolve) => {\n setTimeout(() => {\n this.insertAtTarget(this.draggedElement, updated[originalIndex]);\n this.reset();\n this.dragRequestPending = false;\n resolve();\n }, 200);\n });\n return;\n }\n this.addAriaMsg(\n this.reorderHelperText(this.draggedElement, updated, targetIndex + 1)\n );\n }\n\n this.reset();\n this.dragRequestPending = false;\n }\n\n /**\n * Moves the active node's clone to follow the pointer. The node that the clone intersects with (via hitTest) is\n * the insert point for updated sorting */\n private trackMove = (x: number, y: number) => {\n if (!this.draggedElementClone) {\n return;\n }\n\n if (this.orientation) {\n x = x * orientationMap[this.orientation].x;\n y = y * orientationMap[this.orientation].y;\n }\n\n writeTask(() => {\n Object.assign(this.draggedElementClone!.style, {\n transform: `translate3d(${x}px, ${y}px, 0)`,\n });\n });\n\n let target = this.hitTest(this.draggedElementClone!, this.sortableNodes)[0];\n let activeDropzone: HTMLElement;\n\n if (this.dropzoneSelector && this.dropzoneActiveClass) {\n readTask(() => {\n activeDropzone = this.draggedElement.closest(this.dropzoneSelector);\n\n writeTask(() => {\n this.dropzoneNodes\n .filter((dze) => dze !== activeDropzone)\n .forEach((dze) => dze.classList.remove(this.dropzoneActiveClass));\n activeDropzone.classList.add(this.dropzoneActiveClass);\n });\n });\n }\n\n // didn't find a target - let's test to see if we can use a drop-zone instead\n if (!target && this.dropzoneNodes.length) {\n target = this.hitTest(this.draggedElementClone!, this.dropzoneNodes)[0];\n if (this.draggedElement.closest(this.dropzoneSelector) === target) return;\n }\n\n if (\n // if clone intersects with a valid target,\n target &&\n // other than its own origin,\n target !== this.draggedElement &&\n // and the target isn't currently animating, which causes false hit tests,\n !this.isAnimating(target)\n ) {\n this.insertAtTarget(this.draggedElement!, target);\n }\n };\n\n /// Component lifecycle ///\n\n constructor() {\n this.handleTrack = this.handleTrack.bind(this);\n this.handleKeydown = this.handleKeydown.bind(this);\n this.refreshKeyboardHandles = this.refreshKeyboardHandles.bind(this);\n this.refreshKeyboardHandles = nanoDebounce(\n this.refreshKeyboardHandles,\n 500\n );\n }\n\n connectedCallback() {\n this.addEventHandlers();\n this.refreshKeyboardHandles();\n this.attachMutationObserver();\n\n if (Build.isBrowser && !this.host.querySelector(`#${this.sortableId}`)) {\n // inject a light-dom / a11y description that we can connect sortable items to\n this.host.insertAdjacentHTML(\n 'beforeend',\n `<div class=\"visually-hidden\" id=\"${this.sortableId}\">${this.helperText}</div>`\n );\n }\n }\n\n disconnectedCallback() {\n this.removeEventHandlers();\n this.host.querySelector(`#${this.sortableId}`)?.remove();\n\n if (this.mutationObserver) {\n this.mutationObserver.disconnect();\n this.mutationObserver = undefined;\n }\n }\n\n render() {\n return (\n <Host>\n <div\n class=\"sortable__live-region\"\n aria-live=\"polite\"\n aria-relevant=\"additions\"\n aria-atomic=\"true\"\n role=\"log\"\n part=\"announcements\"\n >\n {this.aria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,IAAI,CAAC,gBAAgB,GAAG,SAAS,CAAC;KACnC;GACF;EAED,MAAM;IACJ,QACEC,QAACC,UAAI,QACHD,iBACE,KAAK,EAAC,uBAAuB,eACnB,QAAQ,mBACJ,WAAW,iBACb,MAAM,EAClB,IAAI,EAAC,KAAK,EACV,IAAI,EAAC,eAAe,IAEnB,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,GAAG,MACzBA,qBAAM,GAAG,CAAO,CACjB,CAAC,CACE,EACNA,qBAAQ,CACH,EACP;GACH;;;;;;;;;;;;;","names":["writeTask","drag","readTask","nanoDebounce","h","Host"],"sources":["./src/components/sortable/sortable.scss?tag=nano-sortable&encapsulation=shadow","./src/components/sortable/sortable.tsx"],"sourcesContent":["@use '../../global/style/utilities/globals' as g;\n\n:host {\n position: relative;\n display: block;\n}\n\n.sortable__live-region {\n @include g.visually-hide();\n}\n","import {\n Prop,\n Element,\n Event,\n EventEmitter,\n h,\n Component,\n ComponentInterface,\n Watch,\n Method,\n State,\n Host,\n readTask,\n writeTask,\n Build,\n} from '@stencil/core';\nimport { drag } from '../../utils/drag';\nimport { nanoDebounce } from '../..';\n\n// Orientation map to limit dragging to horizontal or vertical.\nconst orientationMap = {\n horizontal: { x: 1, y: 0 },\n vertical: { x: 0, y: 1 },\n};\n\nlet sortableIds = 0;\n\n/**\n * An accessible and flexible re-order / sort utility component.\n *\n *- Drag and drop via mouse, touch or keyboard\n *- Live announcements for screen readers\n *- Works with or without an explicit handle (although with is preferable)\n\n * @part announcements - the a11y, live region. Visually hidden by default\n *\n * @slot - The default slot containing any items you might want to sort\n */\n@Component({\n tag: 'nano-sortable',\n shadow: true,\n styleUrl: 'sortable.scss',\n})\nexport class Sortable implements ComponentInterface {\n /// Public API & surface ///\n\n /** A css query selector which matches a set of elements that should be sortable. e.g. `<li>` or `<tr>` */\n @Prop() itemSelector = 'li';\n @Watch('itemSelector')\n handleItemSelectorChange() {\n this.refreshKeyboardHandles();\n }\n\n /** A css query selector which matches an element *within* the `itemSelector` element\n * which will act like a drag handle. **Note** For keyboard a11y it's recommended\n * to use `handleSelector` when possible. Alternatively, the `createKeyboardHandle` prop will be used */\n @Prop() handleSelector?: string;\n @Watch('handleSelector')\n handleHandleSelectorChange() {\n this.refreshKeyboardHandles();\n this.attachMutationObserver();\n }\n\n /** When dragging between grouped collections of items, it is possible to drag all sortable items from one group to another.\n * At that point, you will not be able to drag items back to the original group.\n * A `dropzoneSelector` allows you to define a placeholder area where items can always be dropped.\n */\n @Prop() dropzoneSelector?: string;\n\n /** Accessibility helper text applied to handle controls */\n @Prop() helperText =\n 'Press \"Space\" or \"Enter\" to enable element reordering and use the arrow keys to reorder items.' +\n 'Press \"Escape\" to cancel reordering. Alternatively, use your mouse to drag / reorder.';\n\n /**\n * As a sortable element is interacted with, announcements are made to screen readers\n * - informing the user what is changing.\n * By default, the text from the element is extracted to describe the interacted with element.\n * Use this function to provide a more meaningful, concise item descriptor\n * @param el the element being interacted with\n * @returns a string, describing the element being interacted with\n */\n @Prop() itemDescriptor = (el: Element) => `\"${el?.textContent.trim()}\"`;\n\n /**\n * Used to generate a screen reader live update, informing the user of the current element being grabbed.\n * @param el the element that has been grabbed by the user\n * @returns a string, describing the element being grabbed\n */\n @Prop() grabbedHelperText = (el: Element) =>\n `${this.itemDescriptor(el)} grabbed`;\n\n /**\n * Used to generate a screen reader live update, informing the user of the current element being dropped.\n * @param el the element that has been dropped by the user\n * @returns a string, describing the element that has been dropped\n */\n @Prop() droppedHelperText = (el: Element) =>\n `${this.itemDescriptor(el)} dropped`;\n\n /**\n * Used to generate a screen reader live update, informing the user when items have been reordered.\n * @param el the element that has been reordered by the user\n * @param elements the elements in the sortable list\n * @param position the new position of the dropped element\n * @returns a string, describing the element being dropped\n */\n @Prop() reorderHelperText = (\n el: Element,\n elements: Element[],\n position: number\n ) =>\n `The list has been reordered, ${this.itemDescriptor(\n el\n )} is now item ${position} of ${elements.length}`;\n\n /**\n * A function that should attach a keyboard accessible control.\n * When a `handleSelector` is not used - to allow keyboard accessibility -\n * `createKeyboardHandle` should render a focusable element.\n *\n * If your sortable item is itself focusable,\n * you must use this function to render a control *outside* of the focusable element.\n * @param _number\n * @param _element\n * @returns a function that attaches a keyboard accessible handle control element.\n * The function itself *must* return the handle element.\n */\n @Prop() createKeyboardHandle = (_number: number, _element: Element) => {\n const handleTpl = /* html */ `\n <nano-icon-button\n slot=\"end\"\n icon-name=\"light/arrows\"\n class=\"nano-sortable__keyboard-handle visually-hidden\"\n label=\"Re-order this item\"\n ></nano-icon-button>`;\n const div = globalThis.document.createElement('div');\n div.innerHTML = handleTpl;\n\n const handle = div.children[0] as HTMLElement;\n _element.append(handle);\n return handle;\n };\n @Watch('createKeyboardHandle')\n handleCreateKeyboardHandleChange() {\n this.refreshKeyboardHandles();\n }\n\n /** use `sortableHostElement` to watch a sortable list without needing to wrap in `nano-sortable`.\n * Note that the `sortableHostElement` element css `position` will be set to `relative` */\n @Prop() sortableHostElement?: HTMLElement;\n @Watch('sortableHostElement')\n handleSortableHostElement(_newVal?, oldVal?: HTMLElement) {\n if (oldVal) this.removeEventHandlers(oldVal);\n\n this.addEventHandlers();\n this.refreshKeyboardHandles();\n this.attachMutationObserver();\n\n if (this.sortableHostElement) {\n // sortable host must have position relative\n this.sortableHostElement.style.position = 'relative';\n }\n }\n\n /** Items being sorted will animate into place */\n @Prop() animationEnabled = true;\n\n /** Use this class to change how the element looks whilst being sorted */\n @Prop() draggedClass = 'nano-sortable__dragged';\n\n /** Use this class to change how the handle looks whilst being sorted */\n @Prop() handleDraggedClass = 'nano-sortable__handle-dragged';\n\n /** Use this class to change how the element looks when acting as a placeholder */\n @Prop() placeholderClass = 'nano-sortable__placeholder';\n\n /** Used in-conjunction with `dropzoneSelector`, applied when a dropzone is dragged over */\n @Prop() dropzoneActiveClass?: string = '';\n\n /** The css animation timing applied when `animationEnabled` is `true` */\n @Prop() animationTiming: any = { duration: 200, easing: 'ease-out' };\n\n /** The axis to lock dragging elements to. `undefined` means any axis */\n @Prop() orientation?: 'horizontal' | 'vertical';\n\n /** Dragged items by default, will take whatever default css is applied in situ.\n * When sortable items' dimensions are dynamic (i.e they can shrink / grow via the space allowed) dragging items can look 'wrong'.\n * Apply `dragResize` to read & recreate the dragged items current dimensions when dragged. */\n @Prop() dragResize = false;\n\n /** Fired when an the order changes. Use this to update any underlying data model.\n * `event.preventDefault()` to prevent the element being moved; will revert to original position. */\n @Event() nanoOrderChange: EventEmitter<{\n element: HTMLElement;\n originalIndex: number;\n targetIndex: number;\n }>;\n\n /** Fired when a sortable element is picked-up; via keyboard, mouse or touch.\n * `event.preventDefault()` to prevent the element being picked-up. */\n @Event() nanoGrabbed: EventEmitter<{ element: HTMLElement; index: number }>;\n\n /** Fired when a sortable element is dropped after having been picked up. */\n @Event() nanoDropped: EventEmitter<{ element: HTMLElement }>;\n\n /** If sortable elements change dynamically, use this method to add handle controls to new elements */\n @Method()\n async refreshKeyboardHandles() {\n if (this.handleSelector) {\n if (this.keyboardHandleMap?.size) {\n this.keyboardHandleMap.clear();\n }\n\n this.sortableHost\n .querySelectorAll<HTMLElement>(this.handleSelector)\n .forEach((handle) => {\n if (!handle.getAttribute('aria-describedby'))\n handle.setAttribute('aria-describedby', this.sortableId);\n const sortEle = handle.closest<HTMLElement>(this.itemSelector);\n if (sortEle) this.keyboardHandleMap.set(handle, sortEle);\n });\n return;\n }\n\n if (this.keyboardHandleMap?.size) {\n this.keyboardHandleMap?.forEach((_ele, handle) => handle.remove());\n this.keyboardHandleMap.clear();\n }\n this.sortableHost\n .querySelectorAll<HTMLElement>(this.itemSelector)\n .forEach((ele, i) => {\n const handle = this.createKeyboardHandle(i, ele);\n if (!handle) {\n console.error(\n '`createKeyboardHandle` *must* return the handle element it creates'\n );\n return;\n }\n this.keyboardHandleMap.set(handle, ele);\n handle.setAttribute('aria-describedby', this.sortableId);\n });\n }\n\n /// Private state & logic ///\n\n @Element() host: HTMLNanoSortableElement;\n private dragRequestPending = false;\n private draggedElement?: HTMLElement;\n private draggedElementClone?: HTMLElement;\n private draggedElementOrigin?: HTMLElement;\n private sortableNodes: HTMLElement[] = [];\n private dropzoneNodes: HTMLElement[] = [];\n private animatedElements: HTMLElement[] = [];\n private animationPromise?: Promise<void>;\n private keyboardHandleMap: Map<HTMLElement, HTMLElement> = new Map();\n private sortableId = `nano-sortable-${sortableIds++}`;\n private mouseDownTimer: number;\n private mutationObserver: MutationObserver;\n\n @State() keyboardSortActive = false;\n @State() ariaTextList: string[] = [];\n\n /**\n * Get instance of sortable host.\n * By default it is `nano-sortable` which can be overridden by property `sortableHostElement`\n */\n get sortableHost() {\n if (this.sortableHostElement) return this.sortableHostElement;\n return this.host;\n }\n\n /**\n * Queues aria messages which are then displayed in a 'live' region.\n * Messages are cleared after 10s\n * @param msg aria message to announce\n */\n private addAriaMsg(msg: string) {\n this.ariaTextList = [...this.ariaTextList, msg];\n\n setTimeout(() => {\n const mIdx = this.ariaTextList.indexOf(msg);\n this.ariaTextList.splice(mIdx, 1);\n this.ariaTextList = [...this.ariaTextList];\n }, 10000);\n }\n\n /**\n * Try to stop text highlight whilst dragging\n * @param userSelect\n */\n private updateUserSelectStyle(userSelect: '' | 'none') {\n this.host.style.userSelect = userSelect;\n // @ts-ignore\n this.host.style.MozUserSelect = userSelect;\n // @ts-ignore\n this.host.style.msUserSelect = userSelect;\n this.host.style.webkitUserSelect = userSelect;\n }\n\n /**\n * Fast and simple hit test to check whether the center of a node intersects with the rectangle of any of the\n * given targets. Returns an array of matches.\n * @param node\n * @param targets\n * @returns all the items that currently intersect with the target node\n */\n private hitTest(node: HTMLElement, targets: HTMLElement[]): HTMLElement[] {\n const {\n left: l,\n top: t,\n width: w,\n height: h,\n } = node.getBoundingClientRect();\n const x = l + w / 2;\n const y = t + h / 2;\n\n return targets.filter((item) => {\n const { left, right, top, bottom } = item.getBoundingClientRect();\n return !(x < left || x > right || y < top || y > bottom);\n });\n }\n\n /**\n * Returns a boolean indicating whether the node is currently in an animation.\n * @param node\n * @returns whether a node is currently animating or not\n */\n private isAnimating(node: HTMLElement) {\n return this.animatedElements.indexOf(node) !== -1;\n }\n\n /**\n * Triggers a CSS animation on a node with the given dx and dy. Used following dom updates to make it appear as\n * if nodes animate from their old to their new position in the dom. */\n private animateNode(node: HTMLElement, dx = 0, dy = 0) {\n if (!node.animate) {\n return;\n }\n\n // keep a stack of currently animating nodes to exclude as drag & drop targets.\n this.animatedElements.push(node);\n\n node.style.willChange = 'transform';\n\n // animate from dx/dy (old node position) to none (new node position)\n writeTask(() => {\n this.animationPromise = new Promise((resolve) => {\n node\n .animate(\n [\n { transform: `translate3d(${dx}px, ${dy}px, 0)` },\n { transform: 'none' },\n ],\n this.animationTiming\n )\n .addEventListener(\n 'finish',\n () => {\n const index = this.animatedElements.indexOf(node);\n node.style.willChange = '';\n\n if (index !== -1) {\n // splice out when done to unlock as a valid target\n this.animatedElements.splice(index, 1);\n }\n\n resolve();\n delete this.animationPromise;\n },\n { once: true }\n );\n });\n });\n }\n\n /**\n * Inserts node at target to update sibling sorting. If the node precedes the target, it is inserted after it;\n * If it follows the target, it is inserted before it. This ensures any node can be dragged from the very\n * beginning to the very end and vice versa. The animateNode function is called for all nodes that moved because\n * of this dom update */\n private insertAtTarget(node: Element, target: HTMLElement) {\n if (!node || !target) return;\n\n let offsets: any[] = [];\n if (this.animationEnabled) {\n offsets = this.sortableNodes.map((item) => ({\n x: item.offsetLeft,\n y: item.offsetTop,\n }));\n }\n\n if (!node.isConnected || !target.isConnected) return;\n\n if (this.dropzoneNodes.indexOf(target) > -1) {\n target.append(node);\n } else {\n const nodeComparison = node.compareDocumentPosition(target);\n let position;\n\n if (nodeComparison & this.host.DOCUMENT_POSITION_FOLLOWING) {\n position =\n target.parentNode === node.parentNode ? 'afterend' : 'beforebegin';\n }\n if (nodeComparison & this.host.DOCUMENT_POSITION_PRECEDING) {\n position =\n target.parentNode === node.parentNode ? 'beforebegin' : 'afterend';\n }\n if (position) target.insertAdjacentElement(position, node);\n }\n\n if (this.animationEnabled) {\n this.sortableNodes.forEach((sortableNode, i) => {\n const { x, y } = offsets[i];\n const dx = x - sortableNode.offsetLeft;\n const dy = y - sortableNode.offsetTop;\n if (dx !== 0 || dy !== 0) {\n this.animateNode(sortableNode, dx, dy);\n }\n });\n }\n }\n\n private reset() {\n if (\n this.draggedElementClone !== undefined &&\n this.draggedElementClone.parentNode !== null\n ) {\n this.draggedElementClone.parentNode.removeChild(this.draggedElementClone);\n }\n\n if (\n this.draggedElement &&\n this.draggedElement.parentNode &&\n this.draggedElementOrigin\n ) {\n this.draggedElement.classList.remove(this.placeholderClass);\n }\n\n if (this.dropzoneActiveClass && this.dropzoneNodes.length) {\n this.dropzoneNodes.forEach((dze) =>\n dze.classList.remove(this.dropzoneActiveClass)\n );\n }\n\n delete this.draggedElementClone;\n delete this.draggedElement;\n\n this.dropzoneNodes = [];\n this.sortableNodes = [];\n this.animatedElements = [];\n this.dragRequestPending = false;\n this.updateUserSelectStyle('');\n }\n\n /**\n * Clones a given node to visually drag around. The original node is left in the same flow as its siblings.\n * Clone styles are added onto the style object directly, since the ::slotted()\n * selector can't universally target nodes that may be nested an unknown amount of shadow dom levels deep\n * @param node html node to clone\n * @returns the cloned html node\n */\n private createClone(node: HTMLElement): HTMLElement {\n const clone = node.cloneNode(true) as HTMLElement;\n if (node.id) clone.id = 'clone__' + clone.id;\n\n /**\n * Bugfix for table row sorting.\n * During dragging table rows shrink, so we manually set them width of original node.\n */\n Array.from(clone.children).forEach((nodeChild: HTMLElement, index) => {\n const clonedNodeChild = nodeChild;\n const originalNodeChild = node.children.item(index) as HTMLElement;\n\n if (originalNodeChild) {\n clonedNodeChild.style.width = `${originalNodeChild.offsetWidth}px`;\n }\n });\n const {\n offsetLeft: x,\n offsetTop: y,\n offsetWidth: w,\n offsetHeight: h,\n } = node;\n\n Object.assign(clone.style, {\n position: 'absolute',\n left: `calc(${x}px - var(--grab-offset-x, 0px))`,\n top: `calc(${y}px - var(--grab-offset-y, 0px))`,\n height: this.dragResize ? `${h}px` : undefined,\n width: this.dragResize ? `${w}px` : undefined,\n willChange: 'transform,opacity',\n });\n\n clone.classList.add(this.draggedClass);\n\n return node.parentNode!.appendChild(clone);\n }\n\n /// Event handlers ///\n\n private addListeners(\n el: Element | Document,\n events: string,\n fn: (e: Event) => void,\n opts?: AddEventListenerOptions\n ) {\n events\n .split(' ')\n .forEach((e) =>\n el.addEventListener(e as keyof HTMLElementEventMap, fn, opts)\n );\n }\n\n private removeEventHandlers(ele?: HTMLElement) {\n ele = ele || this.sortableHost;\n ele.removeEventListener('mousedown', this.handleTrack);\n ele.removeEventListener('touchstart', this.handleTrack);\n ele.removeEventListener('keydown', this.handleKeydown);\n }\n\n private addEventHandlers(ele?: HTMLElement) {\n ele = ele || this.sortableHost;\n this.addListeners(ele, 'mousedown touchstart', this.handleTrack);\n ele.addEventListener('keydown', this.handleKeydown);\n }\n\n /**\n * Watch for any changes in grab-able handle elements.\n */\n private attachMutationObserver() {\n if (!Build.isBrowser) return;\n\n if (this.mutationObserver) {\n this.mutationObserver.disconnect();\n this.mutationObserver = undefined;\n }\n\n this.mutationObserver = new MutationObserver(() => {\n const currHandles = Array.from(this.keyboardHandleMap.values());\n const newHandles = Array.from(\n this.sortableHost.querySelectorAll<HTMLElement>(this.itemSelector)\n );\n\n // simple test for equality\n if (\n currHandles.length !== newHandles.length ||\n !!newHandles.find((h) => !currHandles.includes(h))\n ) {\n this.refreshKeyboardHandles();\n }\n });\n this.mutationObserver.observe(this.sortableHost, {\n subtree: true,\n childList: true,\n });\n }\n\n private handleKeydown(e: KeyboardEvent) {\n const targetElement = e.target as HTMLElement;\n let foundHandle: HTMLElement;\n let sortEle: HTMLElement;\n\n if (this.handleSelector) {\n foundHandle = targetElement.closest(this.handleSelector);\n sortEle = targetElement.closest(this.itemSelector);\n } else {\n sortEle = this.keyboardHandleMap.get(targetElement);\n foundHandle = targetElement;\n }\n\n // have we found a handle and matching sort element from the keydown element\n if (!foundHandle || !sortEle) return;\n\n const activateSort = (isActive: boolean) => {\n this.keyboardSortActive = isActive;\n this.draggedElement = isActive ? sortEle : undefined;\n sortEle.classList.toggle(this.draggedClass, isActive);\n foundHandle.classList.toggle(this.handleDraggedClass, isActive);\n\n if (isActive) {\n this.addAriaMsg(this.grabbedHelperText(sortEle));\n document.addEventListener('mousedown', () => activateSort(false), {\n once: true,\n });\n } else {\n this.addAriaMsg(this.droppedHelperText(sortEle));\n }\n };\n\n // start editing this element's order?\n if ([' ', 'Space', 'Enter'].includes(e.key)) {\n e.preventDefault();\n\n if (!this.keyboardSortActive) {\n // grabbed the element\n activateSort(true);\n\n this.sortableNodes =\n Array.from(this.sortableHost.querySelectorAll(this.itemSelector)) ||\n [];\n const nanoGrabbedEv = this.nanoGrabbed.emit({\n element: sortEle,\n index: this.sortableNodes.indexOf(sortEle),\n });\n\n if (nanoGrabbedEv.defaultPrevented) {\n activateSort(false);\n return;\n }\n } else {\n // dropped the element\n activateSort(false);\n this.nanoDropped.emit({ element: sortEle });\n }\n return;\n }\n if (!this.keyboardSortActive) return;\n\n // Tabbing away from this handle - deactivate\n if (['Escape', 'Tab'].includes(e.key)) activateSort(false);\n\n let moveKeys = ['Home', 'End'];\n if (!this.orientation || this.orientation === 'horizontal')\n moveKeys = [...moveKeys, 'ArrowRight', 'ArrowLeft'];\n if (!this.orientation || this.orientation === 'vertical')\n moveKeys = [...moveKeys, 'ArrowUp', 'ArrowDown'];\n\n if (!moveKeys.includes(e.key)) return;\n\n // move the element with the keyboard\n e.preventDefault();\n\n /** Collect all elements that have drag positions.\n * Both sortable elements and 'dropzones' (placeholders where items can always be placed) */\n\n this.sortableNodes =\n Array.from(this.sortableHost.querySelectorAll(this.itemSelector)) || [];\n this.dropzoneNodes =\n Array.from(this.sortableHost.querySelectorAll(this.dropzoneSelector)) ||\n [];\n const currIdx = this.sortableNodes.indexOf(this.draggedElement);\n let curDzIdx: number = -1;\n\n if (this.dropzoneNodes.length) {\n const curDropzone = this.draggedElement.closest<HTMLElement>(\n this.dropzoneSelector\n );\n curDzIdx = this.dropzoneNodes.indexOf(curDropzone);\n curDzIdx = curDzIdx > -1 ? curDzIdx : -1;\n }\n\n /** If we don't have a next / prev sortable element in our list, test to see if there's a dropzone instead */\n const prevEle =\n currIdx - 1 < 0 && curDzIdx > -1\n ? this.dropzoneNodes[curDzIdx - 1]\n : this.sortableNodes[currIdx - 1];\n const nextEle =\n currIdx + 1 === this.sortableNodes.length && curDzIdx > -1\n ? this.dropzoneNodes[curDzIdx + 1]\n : this.sortableNodes[currIdx + 1];\n\n if (e.key === 'Home') {\n this.insertAtTarget(this.draggedElement, this.sortableNodes[0]);\n }\n if (e.key === 'End') {\n this.insertAtTarget(\n this.draggedElement,\n this.sortableNodes[this.sortableNodes.length - 1]\n );\n }\n if (['ArrowRight', 'ArrowDown'].includes(e.key)) {\n this.insertAtTarget(this.draggedElement, nextEle);\n }\n if (['ArrowLeft', 'ArrowUp'].includes(e.key)) {\n this.insertAtTarget(this.draggedElement, prevEle);\n }\n\n this.finishOrder();\n this.draggedElement = sortEle;\n\n const focus = () => {\n requestAnimationFrame(() => {\n typeof foundHandle['setFocus'] === 'function'\n ? (foundHandle as HTMLNanoIconButtonElement).setFocus()\n : foundHandle.focus();\n });\n };\n\n // replace focus to handle so we don't 'drop' the element\n if (this.animationPromise) this.animationPromise.then(() => focus());\n else focus();\n }\n\n /** Tracks a pointer from touchstart/mousedown to touchend/mouseup. */\n private handleTrack(e: PointerEvent) {\n // ignore if we've started dragging or right click\n if (this.dragRequestPending || (e.button && e.button !== 1)) return;\n\n // ignore touchmove events (namespace it so we can remove it)\n const handleMove = (e: Event) => {\n if (e.cancelable) e.preventDefault();\n clearTimeout(this.mouseDownTimer);\n };\n\n // remove temporary events and reset timer\n const resetTrack = () => {\n clearTimeout(this.mouseDownTimer);\n document.removeEventListener('touchmove', handleMove);\n document.removeEventListener('contextmenu', this.finishOrder);\n };\n resetTrack();\n\n // start a timer - only start dragging if pressed for 150ms\n this.mouseDownTimer = window?.setTimeout(() => {\n // ignore if this is not a valid drag target\n if (!this.trackStart(e)) return;\n\n // ignore touchmove events (they scroll the screen)\n document.addEventListener('touchmove', handleMove, {\n passive: false,\n });\n // cancel if user presses and holds (without move) for context menu\n document.addEventListener('contextmenu', this.finishOrder);\n\n this.addAriaMsg(this.grabbedHelperText(this.draggedElement));\n\n drag(this.sortableHost, {\n initialEvent: e,\n relative: true,\n onMove: (x, y) => {\n this.trackMove(x, y);\n },\n onStop: () => {\n this.nanoDropped.emit({ element: this.draggedElement });\n resetTrack();\n\n const didStop = () => {\n this.addAriaMsg(this.droppedHelperText(this.draggedElement));\n requestAnimationFrame(() => this.finishOrder());\n };\n if (this.animationPromise) {\n this.animationPromise.then(() => didStop());\n } else didStop();\n },\n });\n }, 150);\n\n // reset track timer & cancel DnD on mouseup / touchend / touchmove\n this.addListeners(\n document,\n 'mouseup touchend touchmove',\n () => clearTimeout(this.mouseDownTimer),\n { once: true }\n );\n }\n\n /**\n * Initialized a drag and drop sequence if a child node was clicked that matches the itemSelector property.\n * OR If a handleSelector is defined, a node matching this selector must be clicked instead\n * @returns boolean - whether tracking for this event should continue or not\n */\n private trackStart(e: Event) {\n const targetElement = e.target as HTMLElement;\n let targetHandle: HTMLElement;\n\n // If we have a handle set, return now if not being pressed\n if (this.handleSelector) {\n targetHandle = targetElement.closest(this.handleSelector);\n\n if (!targetHandle) return;\n targetHandle.classList.add(this.handleDraggedClass);\n }\n\n // Check that we've found the target element via itemSelector\n const node = targetElement.closest<HTMLElement>(this.itemSelector);\n if (!node) return false;\n\n this.sortableNodes =\n Array.from(this.sortableHost.querySelectorAll(this.itemSelector)) || [];\n const nanoGrabbedEv = this.nanoGrabbed.emit({\n element: node,\n index: this.sortableNodes.indexOf(node),\n });\n if (nanoGrabbedEv.defaultPrevented) return false;\n\n // Element found... start everything\n e.preventDefault();\n this.updateUserSelectStyle('none');\n this.dragRequestPending = true;\n this.draggedElement = node;\n this.dropzoneNodes =\n Array.from(this.sortableHost.querySelectorAll(this.dropzoneSelector)) ||\n [];\n this.draggedElementClone = this.createClone(node);\n this.draggedElementOrigin = node.nextSibling as HTMLElement;\n this.animatedElements = [];\n this.draggedElement!.classList.add(this.placeholderClass);\n return true;\n }\n\n /** Ends re-ordering */\n private finishOrder = () => {\n if (!this.draggedElement) return;\n\n const updated = Array.from(\n this.sortableHost.querySelectorAll<HTMLElement>(this.itemSelector)\n ).filter((ele) => ele !== this.draggedElementClone);\n const originalIndex = this.sortableNodes.indexOf(this.draggedElement);\n const targetIndex = updated.indexOf(this.draggedElement);\n\n if (this.handleSelector) {\n const targetHandle = this.draggedElement.querySelector(\n this.handleSelector\n );\n targetHandle.classList.remove(this.handleDraggedClass);\n }\n\n if (originalIndex !== targetIndex) {\n const orderChangeEv = this.nanoOrderChange.emit({\n element: this.draggedElement,\n originalIndex,\n targetIndex,\n });\n\n if (orderChangeEv.defaultPrevented) {\n /** Event was prevented, wait a moment to send element back to whence it came - gives a nicer visual queue */\n this.animationPromise = new Promise((resolve) => {\n setTimeout(() => {\n this.insertAtTarget(this.draggedElement, updated[originalIndex]);\n this.reset();\n this.dragRequestPending = false;\n resolve();\n }, 200);\n });\n return;\n }\n this.addAriaMsg(\n this.reorderHelperText(this.draggedElement, updated, targetIndex + 1)\n );\n }\n\n this.reset();\n this.dragRequestPending = false;\n };\n\n /**\n * Moves the active node's clone to follow the pointer. The node that the clone intersects with (via hitTest) is\n * the insert point for updated sorting */\n private trackMove = (x: number, y: number) => {\n if (!this.draggedElementClone) {\n return;\n }\n\n if (this.orientation) {\n x = x * orientationMap[this.orientation].x;\n y = y * orientationMap[this.orientation].y;\n }\n\n writeTask(() => {\n Object.assign(this.draggedElementClone!.style, {\n transform: `translate3d(${x}px, ${y}px, 0)`,\n });\n });\n\n let target = this.hitTest(this.draggedElementClone!, this.sortableNodes)[0];\n let activeDropzone: HTMLElement;\n\n if (this.dropzoneSelector && this.dropzoneActiveClass) {\n readTask(() => {\n activeDropzone = this.draggedElement.closest(this.dropzoneSelector);\n\n writeTask(() => {\n this.dropzoneNodes\n .filter((dze) => dze !== activeDropzone)\n .forEach((dze) => dze.classList.remove(this.dropzoneActiveClass));\n activeDropzone.classList.add(this.dropzoneActiveClass);\n });\n });\n }\n\n // didn't find a target - let's test to see if we can use a drop-zone instead\n if (!target && this.dropzoneNodes.length) {\n target = this.hitTest(this.draggedElementClone!, this.dropzoneNodes)[0];\n if (this.draggedElement.closest(this.dropzoneSelector) === target) return;\n }\n\n if (\n // if clone intersects with a valid target,\n target &&\n // other than its own origin,\n target !== this.draggedElement &&\n // and the target isn't currently animating, which causes false hit tests,\n !this.isAnimating(target)\n ) {\n this.insertAtTarget(this.draggedElement!, target);\n }\n };\n\n /// Component lifecycle ///\n\n constructor() {\n this.handleTrack = this.handleTrack.bind(this);\n this.handleKeydown = this.handleKeydown.bind(this);\n this.refreshKeyboardHandles = this.refreshKeyboardHandles.bind(this);\n this.refreshKeyboardHandles = nanoDebounce(\n this.refreshKeyboardHandles,\n 500\n );\n }\n\n connectedCallback() {\n this.addEventHandlers();\n this.refreshKeyboardHandles();\n this.attachMutationObserver();\n\n if (Build.isBrowser && !this.host.querySelector(`#${this.sortableId}`)) {\n // inject a light-dom / a11y description that we can connect sortable items to\n this.host.insertAdjacentHTML(\n 'beforeend',\n `<div class=\"visually-hidden\" id=\"${this.sortableId}\">${this.helperText}</div>`\n );\n }\n }\n\n disconnectedCallback() {\n this.removeEventHandlers();\n this.host.querySelector(`#${this.sortableId}`)?.remove();\n\n if (this.mutationObserver) {\n this.mutationObserver.disconnect();\n this.mutationObserver = undefined;\n }\n }\n\n render() {\n return (\n <Host>\n <div\n class=\"sortable__live-region\"\n aria-live=\"polite\"\n aria-relevant=\"additions\"\n aria-atomic=\"true\"\n role=\"log\"\n part=\"announcements\"\n >\n {this.ariaTextList.map((str) => (\n <div>{str}</div>\n ))}\n </div>\n <slot />\n </Host>\n );\n }\n}\n"],"version":3}
|