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AA,SAAQH,KAAUI,EAAAA,EAAAA,SAAQJ,GACpB,GAIPC,EAAKI,OAASJ,EAAKK,MAEZhE,EAAAA,EAAAA,GAAE0D,EAAMO,KAAKC,GAlC5B,SACIC,EACAR,GAEA,MAAMS,EAA6C,CAAC,EASpD,OAPAC,OAAOC,QAAQX,GAAMY,SAAQC,IAAoC,IAAlCC,EAAmBC,GAAUF,EAEpDE,IAAaC,EAAAA,EAAAA,WAAUR,EAAWO,MAClCN,EAAcK,GAAqBN,EAAWO,GAClD,IAGGE,EAAAA,GAAmBC,OAAOT,EACrC,CAoBqCU,CAA4BZ,EAAMP,MAI5DD,CACX,CAkBqCqB,OAA+BrB,EAAOC,GAQ/D,OANAC,EAAiBW,SAASL,IACtB,IAAKA,QAAsBxC,IAAdwC,EAAKF,WAAqCtC,IAAfwC,EAAKH,MACzC,MAAM,IAAIiB,MAAM,4CAADC,OAA6CC,KAAKC,UAAUjB,IAC/E,IAGGN,CACV,EAVM,EAWX,E","sources":["src/helpers/wrap-with-promise.ts","src/components/action-sheet.hbs","src/components/action-sheet.ts","src/components/element-host.hbs","src/components/element-host.ts","src/helpers/create-dropdown-items.ts"],"sourcesContent":["/**\n * Helper function that returns a Promise that passes down argument to an async method.\n */\nexport default function wrapWithPromise(\n fn: (...args: any[]) => Promise,\n ...args: any[]\n): Promise {\n return new Promise((resolve) => {\n fn(...args).then((result) => resolve(result));\n });\n}\n\ndeclare module '@glint/environment-ember-loose/registry' {\n export default interface Registry {\n /**\n * Helper function that returns a Promise that passes down argument to an async method.\n */\n 'wrap-with-promise': typeof wrapWithPromise;\n }\n}\n","import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{#if (has-block \\\"trigger\\\")}}\\n {{yield to=\\\"trigger\\\"}}\\n{{/if}}\\n{{#if @isActive}}\\n \\n \\n
\\n
\\n {{#if @title}}\\n

{{@title}}

\\n {{else if (has-block \\\"header\\\")}}\\n {{yield to=\\\"header\\\"}}\\n {{/if}}\\n
\\n \\n
\\n {{#if (has-block \\\"subheader\\\")}}\\n
\\n {{yield to=\\\"subheader\\\"}}\\n
\\n {{/if}}\\n \\n
\\n {{yield}}\\n\\n \\n {{#if buttons}}\\n
\\n {{#each buttons as |btn|}}\\n \\n {{/each}}\\n
\\n {{/if}}\\n
\\n
\\n
\\n {{#if (has-block \\\"footer\\\")}}\\n {{yield to=\\\"footer\\\"}}\\n {{/if}}\\n {{#if (and @imageSrc @imageAlt)}}\\n {{@imageAlt}}\\n {{/if}}\\n \\n
\\n{{/if}}\")","import Component from '@glimmer/component';\nimport { tracked } from '@glimmer/tracking';\nimport { isEscapeCode } from '@adc/ember-utils/utils/a11y';\nimport { A } from '@ember/array';\nimport { assert } from '@ember/debug';\nimport { action, computed } from '@ember/object';\nimport { notEmpty } from '@ember/object/computed';\nimport { or } from '@ember/object/computed';\nimport { inject as service } from '@ember/service';\nimport { toggleBodyScroll } from '../utils/general.ts';\n\nimport type DomService from '@adc/ember-utils/services/dom';\nimport type ModalService from '../services/modals.ts';\nimport type { ButtonSimpleSignature } from './button/simple';\n\nexport interface ActionSheetButton {\n text: string;\n fn: VoidFunction;\n disabled?: boolean;\n color?: ButtonSimpleSignature['Args']['buttonColor'];\n}\n\nexport interface ActionSheetSignature {\n Element: HTMLDivElement;\n Args: {\n /** Indicates the action sheet is open. */\n isActive: boolean;\n /** Triggered when the user wants to close the action sheet. */\n close(): void;\n /** Optional title for the action sheet. */\n title?: string;\n /** Optional URI for the image to be displayed at the bottom of the action sheet. */\n imageSrc?: string;\n /** Alt text for the bottom image (must be provided if the image src is). */\n imageAlt?: string;\n /** Collection of buttons to render at the bottom of the body of the action sheet. When docked the buttons will appear stacked, 100% width, with primary buttons sorted to the top. When not docked the buttons will appear at the bottom, right aligned, with primary buttons sorted to the right. */\n buttons?: ActionSheetButton[] | Promise;\n };\n Blocks: {\n /** Optional block for rendering a trigger element. */\n trigger: [];\n /** Will render into the action sheet header, but only if a `@title` was not provided. */\n header: [];\n /** Will render into a space just below the action sheet header. */\n subheader: [];\n /** The body of the action sheet. */\n default: [];\n /** Will render below the body. */\n footer: [];\n };\n}\n\n/**\n * @classdesc\n * A popup container with a customizable title, sub-header, footer and content. Renders as a popup on large screens, and docked to the bottom of the screen with a max height slightly shorter than the screen on small screens. The main content will scroll if it overflows the action sheet.\n *\n * @see https://bitbucket.corp.adcinternal.com/projects/FALCOR/repos/adc-web-frontend/browse/addons/adc-ui-components/package/doc/action-sheet.md\n */\nexport default class ActionSheet extends Component {\n @service declare media: ADCResponsiveMediaService;\n @service declare modals: ModalService;\n @service declare dom: DomService;\n\n @tracked isFocusTrapActive = false;\n\n @notEmpty('modals.modalsToRender')\n declare areAnyModalsOpen: boolean;\n\n curtain?: Element | null;\n closeListener?: string;\n\n focusTrapOptions = {\n allowOutsideClick: true,\n escapeDeactivates: false\n };\n\n @or('media.isMobile', 'media.isTabletPortrait')\n declare isDocked: boolean;\n\n @computed('args.buttons.[]', 'isDocked')\n get buttons(): Promise {\n return (async () => {\n const all = A((await this.args.buttons) ?? []),\n buttons = [...all.filterBy('color', 'primary'), ...all.rejectBy('color', 'primary')];\n\n return this.isDocked ? buttons : buttons.reverse();\n })();\n }\n\n /**\n * Called when the action sheet element is inserted.\n */\n @action opened(el: Element): void {\n // Cache curtain so we can access in closed.\n this.curtain = this.toggleCurtain(true, el);\n\n // Is the sheet NOT docked?\n if (!this.isDocked) {\n // Need to set focus trap here because element will not transition.\n this.isFocusTrapActive = true;\n\n const { close } = this.args;\n this.closeListener = this.dom.addListener(this, el, 'keyup', (evt: KeyboardEvent & { target: Element }) => {\n if (isEscapeCode(evt.code) && evt.target.tagName.toLowerCase() !== 'input') {\n close();\n }\n });\n }\n }\n\n /**\n * Called when the action sheet element is about to be removed.\n */\n @action closed(): void {\n const { closeListener } = this;\n if (closeListener) {\n this.dom.removeListener(this, closeListener);\n }\n\n this.toggleCurtain(false);\n this.isFocusTrapActive = false;\n this.curtain = null;\n }\n\n private toggleCurtain(isOpen: boolean, el = this.curtain): Element {\n assert('[@adc/ui-components] Action sheet element not found', el);\n\n toggleBodyScroll(isOpen);\n\n const curtain = el.closest('.action-sheet-host')?.querySelector('.curtain');\n assert(\n '[@adc/ui-components] Action sheet found no host or curtain, are you sure the action-sheet-host is rendered?',\n curtain\n );\n\n curtain.classList.toggle('is-open', isOpen);\n return curtain;\n }\n}\n","import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"
\\n{{#if this.isReady}}\\n {{#in-element this.hostEl}}\\n {{yield}}\\n {{/in-element}}\\n{{/if}}\")","import Component from '@glimmer/component';\nimport { tracked } from '@glimmer/tracking';\nimport { action } from '@ember/object';\nimport { scheduleOnce } from '@ember/runloop';\n\nexport interface ElementHostSignature {\n Args: {\n /** A valid CSS selector to the element that should host the yielded content. */\n hostSelector: string;\n };\n Blocks: {\n default: [];\n };\n}\n\nexport default class ElementHost extends Component {\n @tracked isReady = false;\n\n /**\n * Returns the target host element.\n */\n get hostEl(): HTMLElement {\n return document.querySelector(this.args.hostSelector)!;\n }\n\n @action scheduleRender(): void {\n // Do not copy this deprecated usage. If you see this, please fix it\n // eslint-disable-next-line ember/no-runloop\n scheduleOnce('afterRender', this, this.updateIsReady);\n }\n\n private updateIsReady(): void {\n this.isReady = true;\n }\n}\n","import { isArray, A } from '@ember/array';\nimport Helper from '@ember/component/helper';\nimport { isEmpty, isPresent } from '@ember/utils';\nimport DropdownSelectItem from '../utils/dropdown-select-item.js';\n\nfunction convertToDropdownSelectItem(\n customItem: any,\n keys: Record\n): DropdownSelectItem {\n const newItemObject: Partial = {};\n\n Object.entries(keys).forEach(([dropdownSelectKey, customKey]) => {\n // Was a key defined and does the custom object have a value for that key?\n if (customKey && isPresent(customItem[customKey])) {\n newItemObject[dropdownSelectKey] = customItem[customKey];\n }\n });\n\n return DropdownSelectItem.create(newItemObject);\n}\n\n/**\n * Transforms the items resolved in the promise into the correct format for use in the dropdown-select.\n *\n * @note This allows a developer to define a mapping and then have the dropdown-select component handle the\n * conversion once the promise resolves.\n */\nfunction transformItemsCollection(items: any[], keys: Record): DropdownSelectItem[] {\n // NOTE: The order of checks is important here. The order of precedence is:\n // 1. Value and name mapping\n // 2. No mapping (return the same array)\n\n if (!isArray(items) || isEmpty(items)) {\n return [];\n }\n\n // Is there a known mapping of value and name?\n if (keys.value && keys.name) {\n // Create a DropdownSelectItem for each item returned from the promise.\n return A(items.map((item) => convertToDropdownSelectItem(item, keys)));\n }\n\n // No mapping was specified. Return the same array.\n return items as DropdownSelectItem[];\n}\n\nexport interface CreateDropdownItemsSignature {\n Args: {\n Named: { items: any[] | Promise; keys: Record };\n };\n Return: DropdownSelectItem[] | Promise;\n}\n\n/**\n * A template helper for generating a list of dropdown items with specific key/value pairs\n */\nexport default class CreateDropdownItems extends Helper {\n compute(\n _: [],\n { items, keys }: CreateDropdownItemsSignature['Args']['Named']\n ): CreateDropdownItemsSignature['Return'] {\n return (async () => {\n const transformedItems = transformItemsCollection(await items, keys);\n // Does each item have the correct DropdownSelectItem structure?\n transformedItems.forEach((item) => {\n if (!item || item.name === undefined || item.value === undefined) {\n throw new Error(`Item must have value and name properties ${JSON.stringify(item)}`);\n }\n });\n\n return transformedItems;\n })();\n }\n}\n"],"names":["wrapWithPromise","fn","_len","arguments","length","args","Array","_key","Promise","resolve","then","result","TEMPLATE","createTemplateFactory","scope","elementHost_","addDelayedCss_","didInsert_","onClickOutside_","preventDefault_","stopPropagation_","on","willDestroy_","focusTrap_","and_","not_","buttonIcon_","t_","scrollContainer_","asyncLoader_","buttonAsync_","_media","WeakMap","_modals","_dom","_isFocusTrapActive","_areAnyModalsOpen","_isDocked","ActionSheet","Component","constructor","_classPrivateFieldInitSpec","i","_defineProperty","allowOutsideClick","escapeDeactivates","buttons","async","all","A","_await$this$args$butt","this","filterBy","rejectBy","isDocked","reverse","opened","el","curtain","toggleCurtain","isFocusTrapActive","close","closeListener","dom","addListener","evt","isEscapeCode","code","target","tagName","toLowerCase","closed","removeListener","isOpen","_el$closest","undefined","toggleBodyScroll","closest","querySelector","classList","toggle","_ActionSheet","g","prototype","inject","tracked","notEmpty","or","n","computed","action","setComponentTemplate","_isReady","ElementHost","hostEl","document","hostSelector","scheduleRender","scheduleOnce","updateIsReady","isReady","_ElementHost","CreateDropdownItems","Helper","compute","_","_ref2","items","keys","transformedItems","isArray","isEmpty","value","name","map","item","customItem","newItemObject","Object","entries","forEach","_ref","dropdownSelectKey","customKey","isPresent","DropdownSelectItem","create","convertToDropdownSelectItem","transformItemsCollection","Error","concat","JSON","stringify"],"sourceRoot":""}