@api-client/ui 0.5.29 → 0.5.31
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/build/src/core/ActivityManager.d.ts +112 -4
- package/build/src/core/ActivityManager.d.ts.map +1 -1
- package/build/src/core/ActivityManager.js +251 -62
- package/build/src/core/ActivityManager.js.map +1 -1
- package/build/src/elements/currency/internals/Picker.d.ts.map +1 -1
- package/build/src/elements/currency/internals/Picker.js +0 -1
- package/build/src/elements/currency/internals/Picker.js.map +1 -1
- package/build/src/md/menu/internal/Menu.d.ts.map +1 -1
- package/build/src/md/menu/internal/Menu.js +20 -8
- package/build/src/md/menu/internal/Menu.js.map +1 -1
- package/build/src/md/select/internals/Select.d.ts +2 -1
- package/build/src/md/select/internals/Select.d.ts.map +1 -1
- package/build/src/md/select/internals/Select.js +46 -16
- package/build/src/md/select/internals/Select.js.map +1 -1
- package/build/src/md/select/internals/Select.styles.d.ts.map +1 -1
- package/build/src/md/select/internals/Select.styles.js +0 -5
- package/build/src/md/select/internals/Select.styles.js.map +1 -1
- package/demo/elements/currency/index.ts +80 -0
- package/demo/md/select/index.ts +1 -1
- package/package.json +1 -1
- package/src/core/ActivityManager.ts +334 -61
- package/src/elements/currency/internals/Picker.ts +0 -1
- package/src/md/menu/internal/Menu.ts +23 -8
- package/src/md/select/internals/Select.styles.ts +0 -5
- package/src/md/select/internals/Select.ts +47 -17
- package/test/core/activity_manager.spec.ts +4 -4
- package/test/md/select/Select.test.ts +229 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActivityManager.js","sourceRoot":"","sources":["../../../src/core/ActivityManager.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAEtD,MAAM,CAAN,IAAY,iBAoCX;AApCD,WAAY,iBAAiB;IAC3B;;;OAGG;IACH,uEAAW,CAAA;IACX;;;OAGG;IACH,+DAAO,CAAA;IACP;;;OAGG;IACH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;IAED,kBAAkB,CAAC,MAAc;QAC/B,OAAO,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,KAAK,MAAM,CAAC,EAAE,QAAQ,CAAA;IAC9E,CAAC;CACF","sourcesContent":["import type { Activity } from './Activity.js'\nimport type { Application } from './Application.js'\nimport { navigateScreen } from './ApplicationRoute.js'\n\nexport enum ActivityLifecycle {\n /**\n * The activity is initialized, but not yet created.\n * This is the initial state of the activity.\n */\n Initialized,\n /**\n * The activity is created, but not yet started.\n * This is the state after the `onCreate()` method is called.\n */\n Created,\n /**\n * The activity is started, but not yet resumed.\n * This is the state after the `onStart()` method is called.\n */\n Started,\n /**\n * The activity is resumed and visible to the user.\n * This is the state after the `onResume()` method is called.\n */\n Resumed,\n /**\n * The activity is paused, but still visible to the user.\n * This is the state after the `onPause()` method is called.\n */\n Paused,\n /**\n * The activity is stopped and no longer visible to the user.\n * This is the state after the `onStop()` method is called.\n */\n Stopped,\n /**\n * The activity is destroyed and no longer exists.\n * This is the state after the `onDestroy()` method is called.\n */\n Destroyed,\n}\n\nexport enum IntentFlags {\n /**\n * Marks that the activity should be rendered as a modal.\n */\n Modal = 1 << 0,\n /**\n * The activity is started for result.\n */\n ForResult = 1 << 1,\n /**\n * When set, the intent data is passed by reference.\n * By default the activity manager makes a copy of the intent data.\n * This is useful when the data is large and you want to avoid copying it\n * or when you want to share the same data between activities.\n */\n ByReference = 1 << 2,\n}\n\nexport interface Intent {\n action: string\n data?: unknown\n category?: string[]\n flags?: number\n /**\n * The request code used to distinguish between different activities.\n */\n requestCode?: number\n}\n\nexport enum IntentResult {\n RESULT_CANCELED,\n RESULT_OK,\n}\n\n/**\n * Defines the information stored for each activity on the stack:\n * the Activity instance, a unique id, and optionally the Intent that started the activity\n * (useful for restoring state).\n */\ninterface ActivityStackEntry {\n /**\n * The instance of the activity.\n */\n activity: Activity\n /**\n * Activity's unique ID.\n */\n id: string\n /**\n * The intent that started the activity.\n */\n intent: Intent\n /**\n * The action name the activity is registered for.\n */\n action: string\n}\n\n/**\n * Manages application activities.\n *\n * An activity is a screen or a portion of a rendered screen that has its own\n * lifecycle methods and routing.\n *\n * An activity is registered by its class definition. Because of that, activities\n * cannot have constructors that require own parameters. Activities have to be\n * self contained or use the event system to request data.\n */\nexport class ActivityManager {\n private currentActivity?: Activity\n\n /**\n * Stores activity *classes* by unique ID (action name).\n */\n private activityClasses = new Map<string, typeof Activity>()\n\n /**\n * Represents the activity stack. It is used to manage\n * the UI state after calling the back action.\n */\n private activityStack: ActivityStackEntry[] = []\n\n /**\n * A stack of activities that are rendered over other activities\n * in a dialog.\n */\n private modalActivityStack: ActivityStackEntry[] = []\n\n private generateActivityId(): string {\n return Math.random().toString(36).substring(2, 15)\n }\n\n #parent: Application\n\n constructor(parent: Application) {\n this.#parent = parent\n // this.reflectEvent = this.reflectEvent.bind(this)\n }\n\n registerActivity(action: string, activityClass: typeof Activity): void {\n if (this.activityClasses.has(action)) {\n // eslint-disable-next-line no-console\n console.warn(`Activity with action \"${action}\" already registered.`, new Error().stack)\n }\n this.activityClasses.set(action, activityClass)\n }\n\n // protected reflectEvent<T extends Event>(event: T): T {\n // const copy = Reflect.construct(event.constructor, [event.type, event])\n // const dispatched = this.#parent.events.dispatchEvent(copy)\n // if (!dispatched) {\n // event.preventDefault()\n // }\n // return copy\n // }\n\n /**\n * Creates an activity and pushes it into the stack, but it does not initialize any of the lifecycle methods.\n * It is a way to put an activity at some place of the stack,\n * but it will be only initialized when other activities finis.\n *\n * Note, if you add an uninitialized activity and you won't add more activities then this activity may never run.\n * Make sure that there's always another activity.\n *\n * @param intent The intent that created this activity.\n */\n async createActivity(intent: Intent): Promise<void> {\n const activity = this.buildActivity(intent)\n const activityId = this.generateActivityId()\n const stackEntry: ActivityStackEntry = { activity, id: activityId, intent, action: intent.action }\n this.activityStack.push(stackEntry)\n }\n\n setupRoute(intent: Intent): void {\n if (intent.data) {\n const typed = intent.data as { uri?: string }\n if (typed.uri) {\n navigateScreen(typed.uri)\n }\n }\n }\n\n /**\n * Starts a new activity and brings it to the foreground.\n *\n * @param intent The intent that created this activity.\n */\n async startActivity(intent: Intent): Promise<void> {\n const { currentActivity, activityStack } = this\n const lastIndex = activityStack.findLastIndex((entry) => entry.action === intent.action)\n // if the activity is in the history list, we bring it up and update intent.\n if (lastIndex > -1) {\n const info = activityStack[lastIndex]\n activityStack.splice(lastIndex, 1)\n activityStack.push({\n id: info.id,\n activity: info.activity,\n action: info.action,\n intent,\n })\n await info.activity.onNewIntent(intent)\n // TODO: Check if the activity is destroyed.\n this.setupRoute(intent)\n await this.updateCurrentActivity(info.activity, false)\n return\n }\n const activity = this.buildActivity(intent)\n if (currentActivity) {\n await currentActivity.onPause()\n currentActivity.lifecycle = ActivityLifecycle.Paused\n }\n\n const activityId = this.generateActivityId()\n const stackEntry: ActivityStackEntry = { activity, id: activityId, intent, action: intent.action }\n // Modal activities are pretty much the same as regular activities but are rendered on top\n // of other activities. We keep track of them on another stack as all modal activities must\n // finish before returning to the regular stack.\n const isModal = (intent.flags ?? 0) & IntentFlags.Modal\n if (isModal) {\n this.modalActivityStack.push(stackEntry)\n } else {\n this.activityStack.push(stackEntry)\n }\n await activity.onCreate(intent)\n if (this.isDestroyed(activity)) {\n // the activity finished and the manager already took care of this situation.\n return\n }\n activity.lifecycle = ActivityLifecycle.Created\n\n await this.updateCurrentActivity(activity, !!isModal)\n if (this.isDestroyed(activity)) {\n // the activity finished and the manager already took care of this situation.\n return\n }\n this.setupRoute(intent)\n }\n\n private buildActivity(intent: Intent): Activity {\n const action = intent.action\n if (!this.activityClasses.has(action)) {\n throw new Error(`No activity class registered for action: ${action}`)\n }\n\n const ActivityClass = this.activityClasses.get(action)\n if (!ActivityClass) {\n throw new Error(`No activity class registered for action: ${action}`)\n }\n\n // We use the container to resolve dependencies, if any.\n // const activity = (await container.make(ActivityClass, [this.#parent])) as Activity\n return new ActivityClass(this.#parent)\n }\n\n /**\n * Starts an activity that should return a result to the calling activity.\n * The result should be a unique number across the application.\n * @param intent The intent to start the activity.\n * @param requestCode The request code used to match the activity result.\n */\n async startActivityForResult(intent: Intent, requestCode: number): Promise<void> {\n intent.requestCode = requestCode\n const byReference = (intent.flags ?? 0) & IntentFlags.ByReference\n const shallowCopy = { ...intent }\n const data = shallowCopy.data\n if (byReference) {\n delete shallowCopy.data\n }\n const deepCopy = structuredClone(shallowCopy)\n if (data && byReference) {\n deepCopy.data = data\n }\n if (deepCopy.flags) {\n deepCopy.flags = deepCopy.flags | IntentFlags.ForResult\n } else {\n deepCopy.flags = IntentFlags.ForResult\n }\n await this.startActivity(deepCopy)\n }\n\n isDestroyed(activity: Activity): boolean {\n return activity.lifecycle === ActivityLifecycle.Destroyed\n }\n\n /**\n * @param activity The activity to finish.\n */\n async finishActivity(activity: Activity): Promise<void> {\n this.setupStyles(undefined, activity)\n const isModal = this.modalActivityStack.some((entry) => entry.activity === activity)\n const stack = isModal ? this.modalActivityStack : this.activityStack\n const index = stack.findIndex((entry) => entry.activity === activity)\n if (index !== -1) {\n const stackEntry = stack.splice(index, 1)[0]\n\n await stackEntry.activity.onPause()\n stackEntry.activity.lifecycle = ActivityLifecycle.Paused\n await stackEntry.activity.onStop()\n stackEntry.activity.lifecycle = ActivityLifecycle.Stopped\n await stackEntry.activity.onDestroy()\n stackEntry.activity.lifecycle = ActivityLifecycle.Destroyed\n\n await this.manageActivityResult(stackEntry.activity, stackEntry.intent)\n\n // Resume the previous activity\n await this.bringLastActivityToFront()\n } else {\n if (activity.lifecycle === ActivityLifecycle.Created) {\n await activity.onStop()\n activity.lifecycle = ActivityLifecycle.Stopped\n }\n await activity.onDestroy()\n activity.lifecycle = ActivityLifecycle.Destroyed\n // This can happen when an activity finishes in one of the callback methods,\n // before it is added to the stack. In that case, we bring the last activity back to the front.\n await this.bringLastActivityToFront()\n }\n this.#parent.requestUpdate()\n }\n\n private async manageActivityResult(activity: Activity, intent: Intent): Promise<void> {\n const { flags = 0, requestCode = -1 } = intent\n if (flags & IntentFlags.ForResult) {\n const all = [...this.activityStack, ...this.modalActivityStack]\n const target = all.find((entry) => entry.activity.hasRequestCode(requestCode))\n if (target) {\n if (target.activity.lifecycle === ActivityLifecycle.Destroyed) {\n return\n }\n if (target.activity.lifecycle === ActivityLifecycle.Resumed) {\n await target.activity.onPause()\n target.activity.lifecycle = ActivityLifecycle.Paused\n }\n const intentCopy = structuredClone(intent)\n intentCopy.data = activity.getResult()\n await target.activity.onActivityResult(requestCode, activity.resultCode, intentCopy)\n }\n }\n }\n\n private async bringLastActivityToFront(): Promise<void> {\n if (this.modalActivityStack.length > 0) {\n const previousEntry = this.modalActivityStack[this.activityStack.length - 1]\n await this.updateCurrentActivity(previousEntry.activity, false)\n } else if (this.activityStack.length > 0) {\n const previousEntry = this.activityStack[this.activityStack.length - 1]\n await this.updateCurrentActivity(previousEntry.activity, false)\n } else {\n this.currentActivity = undefined // No more activities\n }\n }\n\n getTopActivity(): Activity | undefined {\n const topModal = this.modalActivityStack.findLast((a) => a.activity.lifecycle === ActivityLifecycle.Resumed)\n if (topModal) {\n return topModal.activity\n }\n const top = this.activityStack.findLast((a) => a.activity.lifecycle === ActivityLifecycle.Resumed)\n return top ? top.activity : undefined\n }\n\n getCurrentActivity(): Activity | undefined {\n return this.currentActivity\n }\n\n /**\n * Sets the styles for the current activity.\n * This method adds or removes CSS classes based on the activity's class name\n * and action, allowing for dynamic styling based on the active activity.\n * @param activity The activity to set styles for.\n * If not provided, it will not set any styles.\n * If the activity is the same as the current one, it does nothing.\n */\n setupStyles(activity?: Activity, oldActivity?: Activity): void {\n if (activity === oldActivity) {\n return\n }\n const root = document?.documentElement\n if (!root) {\n return\n }\n if (oldActivity) {\n const ctor = oldActivity.constructor as typeof Activity\n root.classList.remove(ctor.name.toLowerCase())\n if (ctor.action) {\n root.classList.remove(ctor.action.replace(/\\//g, '-'))\n }\n }\n if (activity) {\n const ctor = activity.constructor as typeof Activity\n root.classList.add(ctor.name.toLowerCase())\n if (ctor.action) {\n root.classList.add(ctor.action.replace(/\\//g, '-'))\n }\n }\n }\n\n /**\n * A helper method to handle the transition between activities, ensuring\n * lifecycle methods are called in the correct order (pause the previous activity,\n * then start/resume the new one). This centralizes lifecycle management.\n *\n * @param activity The activity to bring to the foreground.\n */\n private async updateCurrentActivity(activity: Activity, isModal: boolean): Promise<void> {\n this.setupStyles(activity, this.currentActivity)\n if (\n this.currentActivity &&\n this.currentActivity !== activity &&\n this.currentActivity.lifecycle !== ActivityLifecycle.Destroyed &&\n // Make sure we don't pause the current activity if it's already paused.\n this.currentActivity.lifecycle !== ActivityLifecycle.Paused\n ) {\n await this.currentActivity.onPause()\n this.currentActivity.lifecycle = ActivityLifecycle.Paused\n }\n if (activity.lifecycle === ActivityLifecycle.Paused) {\n await activity.onResume()\n if (this.isDestroyed(activity)) {\n return\n }\n activity.lifecycle = ActivityLifecycle.Resumed\n activity.requestUpdate()\n } else if (activity.lifecycle === ActivityLifecycle.Stopped) {\n await activity.onRestart()\n activity.lifecycle = ActivityLifecycle.Resumed\n } else if (activity.lifecycle === ActivityLifecycle.Destroyed) {\n throw new Error(`Invalid state. The activity is already destroyed.`)\n } else if (activity.lifecycle === ActivityLifecycle.Created) {\n await activity.onStart()\n if (this.isDestroyed(activity)) {\n return\n }\n activity.lifecycle = ActivityLifecycle.Started\n await activity.onResume()\n if (this.isDestroyed(activity)) {\n return\n }\n activity.lifecycle = ActivityLifecycle.Resumed\n activity.requestUpdate()\n } else if (activity.lifecycle === ActivityLifecycle.Started) {\n await activity.onResume()\n if (this.isDestroyed(activity)) {\n return\n }\n activity.lifecycle = ActivityLifecycle.Resumed\n activity.requestUpdate()\n } else if (activity.lifecycle === ActivityLifecycle.Initialized) {\n // TODO: Figure out intent passing here.\n await activity.onCreate()\n activity.lifecycle = ActivityLifecycle.Created\n if (this.isDestroyed(activity)) {\n // the activity finished and the manager already took care of this situation.\n return\n }\n await activity.onStart()\n if (this.isDestroyed(activity)) {\n return\n }\n activity.lifecycle = ActivityLifecycle.Started\n await activity.onResume()\n if (this.isDestroyed(activity)) {\n return\n }\n activity.lifecycle = ActivityLifecycle.Resumed\n activity.requestUpdate()\n }\n if (!isModal) {\n // With a modal activity, it renders directly to the `<body>` and renders outside\n // of the normal rendering flow. We keep the previous activity rendered.\n this.currentActivity = activity\n }\n }\n\n /**\n * Allows navigating back through the activity stack.\n * Call `ActivityManager.navigateBack()` when the user performs a back action\n * (e.g., clicks a back button).\n */\n async navigateBack(): Promise<void> {\n if (this.activityStack.length > 1 && this.currentActivity) {\n // Finish current, which will resume previous\n await this.finishActivity(this.currentActivity)\n }\n // Else do nothing (or display a message, or exit the app)\n }\n\n createRequestCode(): number {\n const min = 1000\n const max = 9999\n return Math.floor(Math.random() * (max - min) + min)\n }\n\n findActiveActivity(action: string): Activity | undefined {\n return this.activityStack.find((entry) => entry.action === action)?.activity\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ActivityManager.js","sourceRoot":"","sources":["../../../src/core/ActivityManager.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAEtD,MAAM,CAAN,IAAY,iBAoCX;AApCD,WAAY,iBAAiB;IAC3B;;;OAGG;IACH,uEAAW,CAAA;IACX;;;OAGG;IACH,+DAAO,CAAA;IACP;;;OAGG;IACH,+DAAO,CAAA;IACP;;;OAGG;IACH,+DAAO,CAAA;IACP;;;OAGG;IACH,6DAAM,CAAA;IACN;;;OAGG;IACH,+DAAO,CAAA;IACP;;;OAGG;IACH,mEAAS,CAAA;AACX,CAAC,EApCW,iBAAiB,KAAjB,iBAAiB,QAoC5B;AAED,MAAM,CAAN,IAAY,WAgBX;AAhBD,WAAY,WAAW;IACrB;;OAEG;IACH,+CAAc,CAAA;IACd;;OAEG;IACH,uDAAkB,CAAA;IAClB;;;;;OAKG;IACH,2DAAoB,CAAA;AACtB,CAAC,EAhBW,WAAW,KAAX,WAAW,QAgBtB;AAaD,MAAM,C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A;IACzC,CAAC;CACF","sourcesContent":["import type { Activity } from './Activity.js'\nimport type { Application } from './Application.js'\nimport { navigateScreen } from './ApplicationRoute.js'\n\nexport enum ActivityLifecycle {\n /**\n * The activity is initialized, but not yet created.\n * This is the initial state of the activity.\n */\n Initialized,\n /**\n * The activity is created, but not yet started.\n * This is the state after the `onCreate()` method is called.\n */\n Created,\n /**\n * The activity is started, but not yet resumed.\n * This is the state after the `onStart()` method is called.\n */\n Started,\n /**\n * The activity is resumed and visible to the user.\n * This is the state after the `onResume()` method is called.\n */\n Resumed,\n /**\n * The activity is paused, but still visible to the user.\n * This is the state after the `onPause()` method is called.\n */\n Paused,\n /**\n * The activity is stopped and no longer visible to the user.\n * This is the state after the `onStop()` method is called.\n */\n Stopped,\n /**\n * The activity is destroyed and no longer exists.\n * This is the state after the `onDestroy()` method is called.\n */\n Destroyed,\n}\n\nexport enum IntentFlags {\n /**\n * Marks that the activity should be rendered as a modal.\n */\n Modal = 1 << 0,\n /**\n * The activity is started for result.\n */\n ForResult = 1 << 1,\n /**\n * When set, the intent data is passed by reference.\n * By default the activity manager makes a copy of the intent data.\n * This is useful when the data is large and you want to avoid copying it\n * or when you want to share the same data between activities.\n */\n ByReference = 1 << 2,\n}\n\nexport interface Intent<T = unknown> {\n action: string\n data?: T\n category?: string[]\n flags?: number\n /**\n * The request code used to distinguish between different activities.\n */\n requestCode?: number\n}\n\nexport enum IntentResult {\n RESULT_CANCELED,\n RESULT_OK,\n}\n\n/**\n * Defines the information stored for each activity on the stack:\n * the Activity instance, a unique id, and optionally the Intent that started the activity\n * (useful for restoring state).\n */\ninterface ActivityStackEntry {\n /**\n * The instance of the activity.\n */\n activity: Activity\n /**\n * Activity's unique ID.\n */\n id: string\n /**\n * The intent that started the activity.\n */\n intent: Intent\n /**\n * The action name the activity is registered for.\n */\n action: string\n}\n\n/**\n * Type for activity constructor with static action property.\n */\nexport interface ActivityConstructor {\n new (parent: Application): Activity\n action?: string\n}\n\n/**\n * Enhanced activity registration options.\n */\nexport interface ActivityRegistrationOptions {\n /** Whether to override existing registrations */\n override?: boolean\n /** Optional validation function for intents */\n validateIntent?: (intent: Intent) => boolean\n}\n\n/**\n * Manages application activities.\n *\n * An activity is a screen or a portion of a rendered screen that has its own\n * lifecycle methods and routing.\n *\n * An activity is registered by its class definition. Because of that, activities\n * cannot have constructors that require own parameters. Activities have to be\n * self contained or use the event system to request data.\n */\nexport class ActivityManager {\n private currentActivity?: Activity\n\n /**\n * Stores activity *classes* by unique ID (action name).\n */\n private activityClasses = new Map<string, typeof Activity>()\n\n /**\n * Represents the activity stack. It is used to manage\n * the UI state after calling the back action.\n */\n private activityStack: ActivityStackEntry[] = []\n\n /**\n * A stack of activities that are rendered over other activities\n * in a dialog.\n */\n private modalActivityStack: ActivityStackEntry[] = []\n\n private generateActivityId(): string {\n return Math.random().toString(36).substring(2, 15)\n }\n\n #parent: Application\n\n constructor(parent: Application) {\n this.#parent = parent\n // this.reflectEvent = this.reflectEvent.bind(this)\n }\n\n /**\n * Registers an activity class with enhanced options.\n * @param action The action name to register the activity for.\n * @param activityClass The activity class constructor.\n * @param options Optional registration configuration.\n */\n registerActivity(\n action: string,\n activityClass: ActivityConstructor,\n options: ActivityRegistrationOptions = {}\n ): void {\n const { override = false } = options\n\n if (this.activityClasses.has(action) && !override) {\n // eslint-disable-next-line no-console\n console.warn(`Activity with action \"${action}\" already registered.`, new Error().stack)\n return\n }\n\n // Validate that the class extends Activity\n if (typeof activityClass !== 'function') {\n throw new Error(`Invalid activity class for action \"${action}\": must be a constructor function`)\n }\n\n this.activityClasses.set(action, activityClass as typeof Activity)\n }\n\n // protected reflectEvent<T extends Event>(event: T): T {\n // const copy = Reflect.construct(event.constructor, [event.type, event])\n // const dispatched = this.#parent.events.dispatchEvent(copy)\n // if (!dispatched) {\n // event.preventDefault()\n // }\n // return copy\n // }\n\n /**\n * Creates an activity and pushes it into the stack, but it does not initialize any of the lifecycle methods.\n * It is a way to put an activity at some place of the stack,\n * but it will be only initialized when other activities finis.\n *\n * Note, if you add an uninitialized activity and you won't add more activities then this activity may never run.\n * Make sure that there's always another activity.\n *\n * @param intent The intent that created this activity.\n */\n async createActivity(intent: Intent): Promise<void> {\n const activity = this.buildActivity(intent)\n const activityId = this.generateActivityId()\n const stackEntry: ActivityStackEntry = { activity, id: activityId, intent, action: intent.action }\n this.activityStack.push(stackEntry)\n }\n\n setupRoute(intent: Intent): void {\n if (intent.data) {\n const typed = intent.data as { uri?: string }\n if (typed.uri) {\n navigateScreen(typed.uri)\n }\n }\n }\n\n /**\n * Starts a new activity and brings it to the foreground.\n *\n * @param intent The intent that created this activity.\n */\n async startActivity(intent: Intent): Promise<void> {\n const { currentActivity, activityStack } = this\n const lastIndex = activityStack.findLastIndex((entry) => entry.action === intent.action)\n // if the activity is in the history list, we bring it up and update intent.\n if (lastIndex > -1) {\n const info = activityStack[lastIndex]\n activityStack.splice(lastIndex, 1)\n activityStack.push({\n id: info.id,\n activity: info.activity,\n action: info.action,\n intent,\n })\n await info.activity.onNewIntent(intent)\n // TODO: Check if the activity is destroyed.\n this.setupRoute(intent)\n await this.updateCurrentActivity(info.activity, false)\n return\n }\n const activity = this.buildActivity(intent)\n if (currentActivity) {\n await currentActivity.onPause()\n currentActivity.lifecycle = ActivityLifecycle.Paused\n }\n\n const activityId = this.generateActivityId()\n const stackEntry: ActivityStackEntry = { activity, id: activityId, intent, action: intent.action }\n // Modal activities are pretty much the same as regular activities but are rendered on top\n // of other activities. We keep track of them on another stack as all modal activities must\n // finish before returning to the regular stack.\n const isModal = (intent.flags ?? 0) & IntentFlags.Modal\n if (isModal) {\n this.modalActivityStack.push(stackEntry)\n } else {\n this.activityStack.push(stackEntry)\n }\n await activity.onCreate(intent)\n if (this.isDestroyed(activity)) {\n // the activity finished and the manager already took care of this situation.\n return\n }\n activity.lifecycle = ActivityLifecycle.Created\n\n await this.updateCurrentActivity(activity, !!isModal)\n if (this.isDestroyed(activity)) {\n // the activity finished and the manager already took care of this situation.\n return\n }\n this.setupRoute(intent)\n }\n\n private buildActivity(intent: Intent): Activity {\n const action = intent.action\n if (!this.activityClasses.has(action)) {\n throw new Error(`No activity class registered for action: ${action}`)\n }\n\n const ActivityClass = this.activityClasses.get(action)\n if (!ActivityClass) {\n throw new Error(`No activity class registered for action: ${action}`)\n }\n\n // We use the container to resolve dependencies, if any.\n // const activity = (await container.make(ActivityClass, [this.#parent])) as Activity\n return new ActivityClass(this.#parent)\n }\n\n /**\n * Starts an activity that should return a result to the calling activity.\n * The result should be a unique number across the application.\n * @param intent The intent to start the activity.\n * @param requestCode The request code used to match the activity result.\n */\n async startActivityForResult(intent: Intent, requestCode: number): Promise<void> {\n intent.requestCode = requestCode\n const byReference = (intent.flags ?? 0) & IntentFlags.ByReference\n const shallowCopy = { ...intent }\n const data = shallowCopy.data\n if (byReference) {\n delete shallowCopy.data\n }\n const deepCopy = structuredClone(shallowCopy)\n if (data && byReference) {\n deepCopy.data = data\n }\n if (deepCopy.flags) {\n deepCopy.flags = deepCopy.flags | IntentFlags.ForResult\n } else {\n deepCopy.flags = IntentFlags.ForResult\n }\n await this.startActivity(deepCopy)\n }\n\n isDestroyed(activity: Activity): boolean {\n return activity.lifecycle === ActivityLifecycle.Destroyed\n }\n\n /**\n * @param activity The activity to finish.\n */\n async finishActivity(activity: Activity): Promise<void> {\n this.setupStyles(undefined, activity)\n const isModal = this.modalActivityStack.some((entry) => entry.activity === activity)\n const stack = isModal ? this.modalActivityStack : this.activityStack\n const index = stack.findIndex((entry) => entry.activity === activity)\n if (index !== -1) {\n const stackEntry = stack.splice(index, 1)[0]\n\n await stackEntry.activity.onPause()\n stackEntry.activity.lifecycle = ActivityLifecycle.Paused\n await stackEntry.activity.onStop()\n stackEntry.activity.lifecycle = ActivityLifecycle.Stopped\n await stackEntry.activity.onDestroy()\n stackEntry.activity.lifecycle = ActivityLifecycle.Destroyed\n\n // Clean up resources to prevent memory leaks\n this.cleanupActivity(stackEntry.activity)\n\n await this.manageActivityResult(stackEntry.activity, stackEntry.intent)\n\n // Resume the previous activity\n await this.bringLastActivityToFront()\n } else {\n if (activity.lifecycle === ActivityLifecycle.Created) {\n await activity.onStop()\n activity.lifecycle = ActivityLifecycle.Stopped\n }\n await activity.onDestroy()\n activity.lifecycle = ActivityLifecycle.Destroyed\n // This can happen when an activity finishes in one of the callback methods,\n // before it is added to the stack. In that case, we bring the last activity back to the front.\n await this.bringLastActivityToFront()\n }\n this.#parent.requestUpdate()\n }\n\n private async manageActivityResult(activity: Activity, intent: Intent): Promise<void> {\n const { flags = 0, requestCode = -1 } = intent\n if (flags & IntentFlags.ForResult) {\n const all = [...this.activityStack, ...this.modalActivityStack]\n const target = all.find((entry) => entry.activity.hasRequestCode(requestCode))\n if (target) {\n if (target.activity.lifecycle === ActivityLifecycle.Destroyed) {\n return\n }\n if (target.activity.lifecycle === ActivityLifecycle.Resumed) {\n await target.activity.onPause()\n target.activity.lifecycle = ActivityLifecycle.Paused\n }\n const intentCopy = structuredClone(intent)\n intentCopy.data = activity.getResult()\n await target.activity.onActivityResult(requestCode, activity.resultCode, intentCopy)\n }\n }\n }\n\n private async bringLastActivityToFront(): Promise<void> {\n if (this.modalActivityStack.length > 0) {\n const previousEntry = this.modalActivityStack[this.activityStack.length - 1]\n await this.updateCurrentActivity(previousEntry.activity, false, previousEntry.intent)\n } else if (this.activityStack.length > 0) {\n const previousEntry = this.activityStack[this.activityStack.length - 1]\n await this.updateCurrentActivity(previousEntry.activity, false, previousEntry.intent)\n } else {\n this.currentActivity = undefined // No more activities\n }\n }\n\n getTopActivity(): Activity | undefined {\n const topModal = this.modalActivityStack.findLast((a) => a.activity.lifecycle === ActivityLifecycle.Resumed)\n if (topModal) {\n return topModal.activity\n }\n const top = this.activityStack.findLast((a) => a.activity.lifecycle === ActivityLifecycle.Resumed)\n return top ? top.activity : undefined\n }\n\n getCurrentActivity(): Activity | undefined {\n return this.currentActivity\n }\n\n /**\n * Sets the styles for the current activity.\n * This method adds or removes CSS classes based on the activity's class name\n * and action, allowing for dynamic styling based on the active activity.\n * @param activity The activity to set styles for.\n * If not provided, it will not set any styles.\n * If the activity is the same as the current one, it does nothing.\n */\n setupStyles(activity?: Activity, oldActivity?: Activity): void {\n if (activity === oldActivity) {\n return\n }\n const root = document?.documentElement\n if (!root) {\n return\n }\n if (oldActivity) {\n const ctor = oldActivity.constructor as typeof Activity\n root.classList.remove(ctor.name.toLowerCase())\n if (ctor.action) {\n root.classList.remove(ctor.action.replace(/\\//g, '-'))\n }\n }\n if (activity) {\n const ctor = activity.constructor as typeof Activity\n root.classList.add(ctor.name.toLowerCase())\n if (ctor.action) {\n root.classList.add(ctor.action.replace(/\\//g, '-'))\n }\n }\n }\n\n /**\n * A helper method to handle the transition between activities, ensuring\n * lifecycle methods are called in the correct order (pause the previous activity,\n * then start/resume the new one). This centralizes lifecycle management.\n *\n * @param activity The activity to bring to the foreground.\n */\n private async updateCurrentActivity(activity: Activity, isModal: boolean, intent?: Intent): Promise<void> {\n this.setupStyles(activity, this.currentActivity)\n if (\n this.currentActivity &&\n this.currentActivity !== activity &&\n this.currentActivity.lifecycle !== ActivityLifecycle.Destroyed &&\n // Make sure we don't pause the current activity if it's already paused.\n this.currentActivity.lifecycle !== ActivityLifecycle.Paused\n ) {\n await this.currentActivity.onPause()\n this.currentActivity.lifecycle = ActivityLifecycle.Paused\n }\n switch (activity.lifecycle) {\n case ActivityLifecycle.Paused:\n if (!(await this.transitionStartedToResumed(activity))) {\n return\n }\n break\n\n case ActivityLifecycle.Stopped:\n await this.safeExecuteLifecycleMethod(() => activity.onRestart(), activity, 'onRestart')\n activity.lifecycle = ActivityLifecycle.Resumed\n break\n\n case ActivityLifecycle.Destroyed:\n throw new Error(`Invalid state. The activity is already destroyed.`)\n\n case ActivityLifecycle.Created:\n if (!(await this.transitionCreatedToResumed(activity))) {\n return\n }\n break\n\n case ActivityLifecycle.Started:\n if (!(await this.transitionStartedToResumed(activity))) {\n return\n }\n break\n\n case ActivityLifecycle.Initialized:\n if (!(await this.transitionInitializedToResumed(activity, intent))) {\n return\n }\n break\n }\n if (!isModal) {\n // With a modal activity, it renders directly to the `<body>` and renders outside\n // of the normal rendering flow. We keep the previous activity rendered.\n this.currentActivity = activity\n }\n }\n\n /**\n * Safely executes an async lifecycle method with error handling.\n * @param lifecycleMethod The lifecycle method to execute.\n * @param activity The activity instance.\n * @param methodName The name of the method for error reporting.\n * @returns Promise that resolves when the method completes or rejects with wrapped error.\n */\n private async safeExecuteLifecycleMethod(\n lifecycleMethod: () => void | Promise<void>,\n activity: Activity,\n methodName: string\n ): Promise<void> {\n try {\n await lifecycleMethod()\n } catch (error) {\n const activityName = activity.constructor.name\n const wrappedError = new Error(\n `Error in ${activityName}.${methodName}(): ${error instanceof Error ? error.message : String(error)}`\n )\n wrappedError.cause = error\n // Allow the activity to handle its own errors, but still propagate\n this.#parent.dispatchEvent(\n new CustomEvent('activity-lifecycle-error', {\n detail: { activity, methodName, error: wrappedError },\n })\n )\n throw wrappedError\n }\n }\n\n /**\n * Allows navigating back through the activity stack.\n * Call `ActivityManager.navigateBack()` when the user performs a back action\n * (e.g., clicks a back button).\n * @returns Promise that resolves to true if navigation was successful, false if at root.\n */\n async navigateBack(): Promise<boolean> {\n // Handle modal activities first\n if (this.modalActivityStack.length > 0) {\n const topModal = this.modalActivityStack[this.modalActivityStack.length - 1]\n await this.finishActivity(topModal.activity)\n return true\n }\n\n // Handle regular activities\n if (this.activityStack.length > 1 && this.currentActivity) {\n await this.finishActivity(this.currentActivity)\n return true\n }\n\n // At root, cannot navigate back\n return false\n }\n\n /**\n * Navigates to a specific activity in the stack, clearing activities above it.\n * @param action The action of the activity to navigate to.\n * @returns Promise that resolves to true if navigation was successful.\n */\n async navigateToActivity(action: string): Promise<boolean> {\n const index = this.activityStack.findIndex((entry) => entry.action === action)\n if (index === -1) {\n return false\n }\n\n // Finish all activities above the target\n const activitiesToFinish = this.activityStack.slice(index + 1)\n for (const entry of activitiesToFinish) {\n await this.finishActivity(entry.activity)\n }\n\n // Bring the target activity to the front\n const targetEntry = this.activityStack[index]\n await this.updateCurrentActivity(targetEntry.activity, false, targetEntry.intent)\n return true\n }\n\n /**\n * Clears the entire activity stack and starts a new root activity.\n * @param intent The intent for the new root activity.\n */\n async clearStackAndStart(intent: Intent): Promise<void> {\n // Finish all activities\n const allActivities = [...this.activityStack, ...this.modalActivityStack]\n for (const entry of allActivities) {\n if (entry.activity.lifecycle !== ActivityLifecycle.Destroyed) {\n await this.finishActivity(entry.activity)\n }\n }\n\n // Clear stacks\n this.activityStack.length = 0\n this.modalActivityStack.length = 0\n this.currentActivity = undefined\n\n // Start new root activity\n await this.startActivity(intent)\n }\n\n /**\n * Creates an intent with better type safety and validation.\n * @param action The action name.\n * @param data Optional intent data.\n * @param options Optional intent configuration.\n * @returns A properly formed intent.\n */\n createIntent<T = unknown>(\n action: string,\n data?: T,\n options: {\n category?: string[]\n flags?: number\n requestCode?: number\n } = {}\n ): Intent<T> {\n if (!this.isActionRegistered(action)) {\n throw new Error(`Cannot create intent for unregistered action: ${action}`)\n }\n\n return {\n action,\n data,\n ...options,\n }\n }\n\n createRequestCode(): number {\n const min = 1000\n const max = 9999\n return Math.floor(Math.random() * (max - min) + min)\n }\n\n findActiveActivity(action: string): Activity | undefined {\n return this.activityStack.find((entry) => entry.action === action)?.activity\n }\n\n /**\n * Transitions an activity from Created to Resumed state.\n * @param activity The activity to transition.\n * @returns true if successful, false if activity was destroyed during transition.\n */\n private async transitionCreatedToResumed(activity: Activity): Promise<boolean> {\n await this.safeExecuteLifecycleMethod(() => activity.onStart(), activity, 'onStart')\n if (this.isDestroyed(activity)) {\n return false\n }\n activity.lifecycle = ActivityLifecycle.Started\n\n await this.safeExecuteLifecycleMethod(() => activity.onResume(), activity, 'onResume')\n if (this.isDestroyed(activity)) {\n return false\n }\n activity.lifecycle = ActivityLifecycle.Resumed\n activity.requestUpdate()\n return true\n }\n\n /**\n * Transitions an activity from Started to Resumed state.\n * @param activity The activity to transition.\n * @returns true if successful, false if activity was destroyed during transition.\n */\n private async transitionStartedToResumed(activity: Activity): Promise<boolean> {\n await this.safeExecuteLifecycleMethod(() => activity.onResume(), activity, 'onResume')\n if (this.isDestroyed(activity)) {\n return false\n }\n activity.lifecycle = ActivityLifecycle.Resumed\n activity.requestUpdate()\n return true\n }\n\n /**\n * Transitions an activity from Initialized to Resumed state.\n * @param activity The activity to transition.\n * @param intent The intent used to create the activity.\n * @returns true if successful, false if activity was destroyed during transition.\n */\n private async transitionInitializedToResumed(activity: Activity, intent?: Intent): Promise<boolean> {\n await this.safeExecuteLifecycleMethod(() => activity.onCreate(intent), activity, 'onCreate')\n activity.lifecycle = ActivityLifecycle.Created\n if (this.isDestroyed(activity)) {\n return false\n }\n\n return await this.transitionCreatedToResumed(activity)\n }\n\n /**\n * Cleans up resources for destroyed activities to prevent memory leaks.\n * @param activity The activity to clean up.\n */\n private cleanupActivity(activity: Activity): void {\n // Remove any event listeners that might create memory leaks\n // This changes the entire prototype chain of the activity,\n // effectively making it a new object. We can't do that as the activity will loose some\n // of its properties, so we don't do it for now.\n // if (activity instanceof EventTarget) {\n // // Clear all event listeners by replacing the activity with a new EventTarget\n // // This is a defensive approach since we can't enumerate listeners\n // Object.setPrototypeOf(activity, EventTarget.prototype)\n // }\n\n // Clear any references that might prevent garbage collection\n activity.renderRoot = undefined\n }\n\n /**\n * Validates that an activity stack is in a consistent state.\n * @param stack The activity stack to validate.\n * @returns Array of validation errors, empty if valid.\n */\n private validateStackConsistency(stack: ActivityStackEntry[]): string[] {\n const errors: string[] = []\n const seenIds = new Set<string>()\n\n for (const entry of stack) {\n if (seenIds.has(entry.id)) {\n errors.push(`Duplicate activity ID found: ${entry.id}`)\n }\n seenIds.add(entry.id)\n\n if (!entry.activity || !entry.id || !entry.action) {\n errors.push(`Invalid stack entry: missing required properties`)\n }\n\n if (entry.activity.lifecycle === ActivityLifecycle.Destroyed) {\n errors.push(`Destroyed activity found in stack: ${entry.id}`)\n }\n }\n\n return errors\n }\n\n /**\n * Gets diagnostic information about the current state of the activity manager.\n * Useful for debugging and monitoring.\n * @returns Object containing current state information.\n */\n getDiagnostics(): {\n totalActivities: number\n modalActivities: number\n currentActivity?: string\n topActivity?: string\n stackValidation: string[]\n modalStackValidation: string[]\n } {\n return {\n totalActivities: this.activityStack.length,\n modalActivities: this.modalActivityStack.length,\n currentActivity: this.currentActivity?.constructor.name,\n topActivity: this.getTopActivity()?.constructor.name,\n stackValidation: this.validateStackConsistency(this.activityStack),\n modalStackValidation: this.validateStackConsistency(this.modalActivityStack),\n }\n }\n\n /**\n * Gets all registered activity actions.\n * @returns Array of registered action names.\n */\n getRegisteredActions(): string[] {\n return Array.from(this.activityClasses.keys())\n }\n\n /**\n * Checks if an action is registered.\n * @param action The action to check.\n * @returns true if the action is registered, false otherwise.\n */\n isActionRegistered(action: string): boolean {\n return this.activityClasses.has(action)\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Picker.d.ts","sourceRoot":"","sources":["../../../../../src/elements/currency/internals/Picker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAQ,KAAK,cAAc,EAAE,KAAK,cAAc,EAAE,OAAO,EAAE,MAAM,KAAK,CAAA;AAKzF,OAAO,iCAAiC,CAAA;AACxC,OAAO,6BAA6B,CAAA;AACpC,OAAO,iCAAiC,CAAA;AACxC,OAAO,iCAAiC,CAAA;AAExC;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,kDAAkD;IAClD,IAAI,EAAE,MAAM,CAAA;IACZ,4DAA4D;IAC5D,IAAI,EAAE,MAAM,CAAA;IACZ,uCAAuC;IACvC,MAAM,EAAE,MAAM,CAAA;IACd,uEAAuE;IACvE,OAAO,EAAE,MAAM,CAAA;IACf,oDAAoD;IACpD,IAAI,EAAE,MAAM,CAAA;CACb;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,yEAAyE;IACzE,IAAI,EAAE,YAAY,GAAG,WAAW,GAAG,UAAU,CAAA;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;OAIG;IACH,IAAI,qBAAqB,IAAI,MAAM,EAAE,CAEpC;IAED;;;;;OAKG;IACH,qBAAqB,IAAI,QAAQ,EAAE;IAWnC;;;;;;OAMG;IACH,cAAc;IA+Bd;;;;;;;OAOG;IACH,wBAAwB,CAAC,KAAK,EAAE,MAAM,GAAG,QAAQ,GAAG,IAAI,GAAG,IAAI;IAgB/D;;;;OAIG;IACH,iBAAiB,IAAI,IAAI;IAczB;;;;;OAKG;IACM,MAAM,IAAI,cAAc;IAyCjC;;;;OAIG;IACH,SAAS,CAAC,WAAW,IAAI,cAAc,GAAG,OAAO,OAAO;IAYxD;;;;;OAKG;IACH,SAAS,CAAC,cAAc,IAAI,cAAc,GAAG,OAAO,OAAO;CA2B5D"}
|
|
@@ -737,7 +737,6 @@ let CurrencyPicker = (() => {
|
|
|
737
737
|
<ui-select
|
|
738
738
|
label="${this.label}"
|
|
739
739
|
@change="${this.handleCurrencySelect}"
|
|
740
|
-
menuPositioning="popover"
|
|
741
740
|
?disabled="${this.disabled}"
|
|
742
741
|
?required="${this.required}"
|
|
743
742
|
.supportingText="${this.supportingText || ''}"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Picker.js","sourceRoot":"","sources":["../../../../../src/elements/currency/internals/Picker.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAA4C,OAAO,EAAE,MAAM,KAAK,CAAA;AACzF,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAA;AAGjD,OAAO,iCAAiC,CAAA;AACxC,OAAO,6BAA6B,CAAA;AACpC,OAAO,iCAAiC,CAAA;AACxC,OAAO,iCAAiC,CAAA;;sBAoFI,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAjC,cAAe,SAAQ,WAAU;;;oCA0BnD,QAAQ,CAAC,EAAE,IAA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,KAAK,EAAE,CAAC;gBAChB,OAAO,OAAO,CAAA;YAChB,CAAC;YACD,MAAM,QAAQ,GAAG,IAAI,CAAC,qBAAqB,EAAE,CAAA;YAC7C,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;gBAAE,OAAO,OAAO,CAAA;YAEzC,OAAO,IAAI,CAAA;;UAEL,MAAM,CACN,QAAQ,EACR,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,EAC3B,CAAC,QAAQ,EAAE,EAAE,CAAC,IAAI,CAAA;;2BAED,QAAQ,CAAC,IAAI;;yBAEf,IAAI,CAAC,oBAAoB;4BACtB,IAAI;;oDAEoB,QAAQ,CAAC,IAAI;wCACzB,QAAQ,CAAC,IAAI;;WAE1C,CACF;;KAEJ,CAAA;QACH,CAAC;;;AA/xBH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH","sourcesContent":["import { LitElement, html, type TemplateResult, type PropertyValues, nothing } from 'lit'\nimport { property, state, query } from 'lit/decorators.js'\nimport { repeat } from 'lit/directives/repeat.js'\nimport type { UiSelectChangeEvent, UiSelectElement } from '../../../md/select/ui-select.js'\n\nimport '../../../md/chip/ui-chip-set.js'\nimport '../../../md/chip/ui-chip.js'\nimport '../../../md/select/ui-select.js'\nimport '../../../md/select/ui-option.js'\n\n/**\n * Represents a currency with all its display information.\n */\nexport interface Currency {\n /** ISO 4217 currency code (e.g., 'USD', 'EUR') */\n code: string\n /** Full name of the currency (e.g., 'US Dollar', 'Euro') */\n name: string\n /** Currency symbol (e.g., '$', '€') */\n symbol: string\n /** Country or region name (e.g., 'United States', 'European Union') */\n country: string\n /** Flag emoji representing the currency's origin */\n flag: string\n}\n\n/**\n * Represents an error that can occur in the CurrencyPicker component.\n */\nexport interface CurrencyPickerError {\n /** Type of error: validation, selection constraint, or internal error */\n type: 'validation' | 'selection' | 'internal'\n /** Human-readable error message */\n message: string\n /** Optional additional details about the error for debugging */\n details?: Record<string, unknown>\n}\n\n/**\n * Event detail interface for currency picker error events.\n */\nexport interface CurrencyPickerErrorEvent {\n /** The error information */\n error: CurrencyPickerError\n}\n\n/**\n * A web component for selecting currencies with chips display.\n * Provides a searchable interface with country flags and currency information.\n *\n * This component uses ElementInternals for native form integration and\n * follows web standards for error handling and validation.\n *\n * ## Features\n * - Single or multi-select currency selection\n * - Visual chips display for selected currencies\n * - Native form integration with ElementInternals\n * - Comprehensive validation and error handling\n * - Accessibility support with ARIA attributes\n * - Keyboard navigation support\n * - Currency filtering based on allowed currencies\n *\n * ## Usage\n * ```html\n * <!-- Basic usage -->\n * <currency-picker></currency-picker>\n *\n * <!-- Multi-select with allowed currencies -->\n * <currency-picker multi .allowedCurrencies=\"${['USD', 'EUR', 'GBP']}\"></currency-picker>\n *\n * <!-- Form integration -->\n * <form>\n * <currency-picker name=\"currencies\" required></currency-picker>\n * </form>\n * ```\n *\n * @fires change - Dispatched when selected currencies change due to user interaction.\n * Contains {currencies: Currency[], codes: string[]} in event.detail\n * @fires error - Dispatched when validation or other errors occur.\n * Contains {error: CurrencyPickerError} in event.detail\n *\n * @example\n * ```typescript\n * const picker = document.querySelector('currency-picker');\n * picker.addEventListener('change', (e) => {\n * console.log('Selected currencies:', e.detail.currencies);\n * });\n * picker.addEventListener('error', (e) => {\n * console.error('Picker error:', e.detail.error.message);\n * });\n * ```\n */\nexport default class CurrencyPicker extends LitElement {\n /**\n * Indicates that this custom element is form-associated and can participate in form submission.\n * This enables the component to work with native HTML forms and use ElementInternals.\n */\n static formAssociated = true\n\n /**\n * Private ElementInternals instance for form integration and validation.\n * Provides access to form APIs like setFormValue, setValidity, etc.\n */\n private internals: ElementInternals\n\n /**\n * Shadow root configuration for the component.\n * Uses 'open' mode for accessibility and delegates focus to enable proper focus management.\n */\n static override shadowRootOptions: ShadowRootInit = {\n mode: 'open',\n delegatesFocus: true,\n }\n\n /**\n * The currently selected currency codes.\n * This is an array of ISO 4217 currency codes (e.g., 'USD', 'EUR').\n */\n @property({ type: Array }) accessor selected: string[] = []\n\n /**\n * The currencies that should be available for selection.\n * If not specified, all supported currencies will be available.\n * This is an array of ISO 4217 currency codes (e.g., 'USD', 'EUR').\n */\n @property({ type: Array }) accessor allowedCurrencies: string[] = []\n\n /**\n * The label for the currency selection dropdown.\n * This is displayed as the label for the select input.\n * @attribute\n */\n @property({ type: String }) accessor label = 'Add Currency'\n\n /**\n * The name attribute for the currency selection dropdown.\n * This is used when submitting forms that include this component.\n * @attribute\n */\n @property({ type: String }) accessor name: string | undefined\n\n /**\n * Supporting text for the currency selection dropdown.\n * This is displayed below the select input.\n * @attribute\n */\n @property({ type: String }) accessor supportingText: string | undefined\n\n /**\n * Whether the currency selection is required.\n * If true, the component will enforce at least one currency to be selected.\n * @attribute\n */\n @property({ type: Boolean }) accessor required = false\n\n /**\n * Whether the currency selection is disabled.\n * If true, the component will not allow any changes to the selected currencies.\n * @attribute\n */\n @property({ type: Boolean }) accessor disabled = false\n /**\n * Whether multiple currencies can be selected.\n * If true, the component allows selecting multiple currencies.\n * If false, only one currency can be selected at a time.\n * @attribute\n */\n @property({ type: Boolean }) accessor multi = false\n\n /**\n * Whether to show errors inline within the component.\n * If true, errors will be displayed below the component.\n * If false, errors will only be dispatched as events.\n * @attribute\n */\n @property({ type: Boolean }) accessor showErrors = true\n\n /**\n * The currently selectable currencies (filtered based on selection and allowed currencies).\n * This is automatically updated based on the selected currencies and allowedCurrencies property.\n */\n @state() private accessor selectableCurrencies: Currency[] = []\n\n /**\n * Reference to the Material Design outlined select element.\n * Used to manage the select's internal state and keep it synchronized with the component's selected property.\n */\n @query('ui-select')\n private accessor selectElement!: UiSelectElement\n\n /**\n * Returns the form element that contains this component, if any.\n * Part of the ElementInternals API for form-associated custom elements.\n */\n get form() {\n return this.internals.form\n }\n\n /**\n * Returns the validity state of the component.\n * Part of the ElementInternals API for form-associated custom elements.\n */\n get validity() {\n return this.internals.validity\n }\n\n /**\n * Returns the validation message for the component.\n * Part of the ElementInternals API for form-associated custom elements.\n */\n get validationMessage() {\n return this.internals.validationMessage\n }\n\n /**\n * Returns whether the component will be validated when the form is submitted.\n * Part of the ElementInternals API for form-associated custom elements.\n */\n get willValidate() {\n return this.internals.willValidate\n }\n\n /**\n * Checks the validity of the component without displaying validation UI.\n * Part of the ElementInternals API for form-associated custom elements.\n * @returns True if the component is valid, false otherwise\n */\n checkValidity() {\n return this.internals.checkValidity()\n }\n\n /**\n * Checks the validity of the component and displays validation UI if invalid.\n * Part of the ElementInternals API for form-associated custom elements.\n * @returns True if the component is valid, false otherwise\n */\n reportValidity() {\n return this.internals.reportValidity()\n }\n\n /**\n * Master list of supported currencies with their display information.\n * This includes popular currencies with their ISO codes, names, symbols, countries, and flag emojis.\n * Private and readonly to ensure data integrity.\n */\n private readonly currencies: Currency[] = [\n { code: 'USD', name: 'US Dollar', symbol: '$', country: 'United States', flag: '🇺🇸' },\n { code: 'EUR', name: 'Euro', symbol: '€', country: 'European Union', flag: '🇪🇺' },\n { code: 'GBP', name: 'British Pound', symbol: '£', country: 'United Kingdom', flag: '🇬🇧' },\n { code: 'JPY', name: 'Japanese Yen', symbol: '¥', country: 'Japan', flag: '🇯🇵' },\n { code: 'CAD', name: 'Canadian Dollar', symbol: 'C$', country: 'Canada', flag: '🇨🇦' },\n { code: 'AUD', name: 'Australian Dollar', symbol: 'A$', country: 'Australia', flag: '🇦🇺' },\n { code: 'CHF', name: 'Swiss Franc', symbol: 'Fr', country: 'Switzerland', flag: '🇨🇭' },\n { code: 'CNY', name: 'Chinese Yuan', symbol: '¥', country: 'China', flag: '🇨🇳' },\n { code: 'INR', name: 'Indian Rupee', symbol: '₹', country: 'India', flag: '🇮🇳' },\n { code: 'KRW', name: 'South Korean Won', symbol: '₩', country: 'South Korea', flag: '🇰🇷' },\n { code: 'BRL', name: 'Brazilian Real', symbol: 'R$', country: 'Brazil', flag: '🇧🇷' },\n { code: 'MXN', name: 'Mexican Peso', symbol: '$', country: 'Mexico', flag: '🇲🇽' },\n { code: 'SGD', name: 'Singapore Dollar', symbol: 'S$', country: 'Singapore', flag: '🇸🇬' },\n { code: 'HKD', name: 'Hong Kong Dollar', symbol: 'HK$', country: 'Hong Kong', flag: '🇭🇰' },\n { code: 'NOK', name: 'Norwegian Krone', symbol: 'kr', country: 'Norway', flag: '🇳🇴' },\n { code: 'SEK', name: 'Swedish Krona', symbol: 'kr', country: 'Sweden', flag: '🇸🇪' },\n { code: 'DKK', name: 'Danish Krone', symbol: 'kr', country: 'Denmark', flag: '🇩🇰' },\n { code: 'PLN', name: 'Polish Zloty', symbol: 'zł', country: 'Poland', flag: '🇵🇱' },\n { code: 'RUB', name: 'Russian Ruble', symbol: '₽', country: 'Russia', flag: '🇷🇺' },\n { code: 'ZAR', name: 'South African Rand', symbol: 'R', country: 'South Africa', flag: '🇿🇦' },\n { code: 'TRY', name: 'Turkish Lira', symbol: '₺', country: 'Turkey', flag: '🇹🇷' },\n { code: 'NZD', name: 'New Zealand Dollar', symbol: 'NZ$', country: 'New Zealand', flag: '🇳🇿' },\n { code: 'THB', name: 'Thai Baht', symbol: '฿', country: 'Thailand', flag: '🇹🇭' },\n { code: 'ILS', name: 'Israeli Shekel', symbol: '₪', country: 'Israel', flag: '🇮🇱' },\n { code: 'AED', name: 'UAE Dirham', symbol: 'د.إ', country: 'United Arab Emirates', flag: '🇦🇪' },\n ]\n\n constructor() {\n super()\n this.internals = this.attachInternals()\n }\n\n override connectedCallback() {\n super.connectedCallback()\n this.updateSelectableCurrencies()\n this.updateFormValue()\n }\n\n /**\n * Updates the form value using ElementInternals.\n */\n private updateFormValue(): void {\n const value = this.selected.length > 0 ? this.selected.join(',') : null\n this.internals.setFormValue(value)\n }\n\n protected override willUpdate(changed: PropertyValues<this>): void {\n super.willUpdate(changed)\n\n // Validate selected currencies with error handling\n if (changed.has('selected')) {\n this.selected = this.safeCurrencyValidation(this.selected, 'selected')\n\n // Also validate against allowedCurrencies if specified\n if (this.allowedCurrencies.length > 0) {\n const allowedSet = new Set(this.allowedCurrencies)\n const invalidSelectedCodes = this.selected.filter((code) => !allowedSet.has(code))\n\n if (invalidSelectedCodes.length > 0) {\n this.setError({\n type: 'validation',\n message: `Selected currencies not in allowed list: ${invalidSelectedCodes.join(', ')}`,\n details: {\n property: 'selected',\n invalidCodes: invalidSelectedCodes,\n allowedCurrencies: this.allowedCurrencies,\n },\n })\n\n // Filter out invalid codes\n this.selected = this.selected.filter((code) => allowedSet.has(code))\n }\n }\n\n // Also validate selection constraints when property changes\n if (!this.multi && this.selected.length > 1) {\n // In single-select mode, keep only the first valid selection\n this.selected = this.selected.slice(0, 1)\n this.setError({\n type: 'selection',\n message: 'Multiple currency selection is not allowed when multi=false. Only first selection kept.',\n details: { multi: this.multi, originalSelection: changed.get('selected') },\n })\n }\n\n // Validate required constraint\n if (this.required && this.selected.length === 0) {\n this.internals.setValidity({ valueMissing: true }, 'At least one currency must be selected')\n this.setAttribute('aria-invalid', 'true')\n this.dispatchErrorEvent({\n type: 'selection',\n message: 'At least one currency must be selected when required=true',\n details: { required: this.required, currentSelection: this.selected },\n })\n } else if (!this.required || this.selected.length > 0) {\n // Clear validation if not required or has selection\n this.internals.setValidity({})\n this.setAttribute('aria-invalid', 'false')\n }\n }\n // Validate allowed currencies with error handling\n if (changed.has('allowedCurrencies')) {\n this.allowedCurrencies = this.safeCurrencyValidation(this.allowedCurrencies, 'allowedCurrencies')\n\n // Filter selected currencies to only include allowed ones\n if (this.allowedCurrencies.length > 0) {\n const allowedSet = new Set(this.allowedCurrencies)\n const filteredSelected = this.selected.filter((code) => allowedSet.has(code))\n if (filteredSelected.length !== this.selected.length) {\n this.selected = filteredSelected\n }\n }\n }\n\n if (changed.has('selected') || changed.has('allowedCurrencies') || changed.has('multi')) {\n this.updateSelectableCurrencies()\n }\n\n // Update form value when selected changes\n if (changed.has('selected')) {\n this.updateFormValue()\n }\n\n // Synchronize the select element's value with the component's selected state\n if (changed.has('selected') && this.selectElement) {\n // In single-select mode, set the select value to the first selected currency or empty\n // In multi-select mode, always clear the select after selection to allow adding more\n if (!this.multi) {\n this.selectElement.value = this.selected.length > 0 ? this.selected[0] : ''\n } else {\n // For multi-select, always keep the select cleared to allow adding more currencies\n this.selectElement.value = ''\n }\n }\n }\n\n /**\n * Called after the component has been updated and rendered.\n * Ensures the select element's value stays synchronized with the component's selected state.\n */\n protected override updated(changed: PropertyValues<this>): void {\n super.updated(changed)\n\n // Ensure select element is synchronized after rendering\n if (this.selectElement && (changed.has('selected') || changed.has('multi'))) {\n if (!this.multi) {\n // In single-select mode, show the selected currency or clear the select\n this.selectElement.value = this.selected.length > 0 ? this.selected[0] : ''\n } else {\n // In multi-select mode, always keep the select cleared to allow adding more currencies\n this.selectElement.value = ''\n }\n }\n }\n\n /**\n * Sets an error state using ElementInternals and optionally dispatches an error event.\n * @param error The error to set\n * @param dispatch Whether to dispatch an error event (default: true)\n */\n private setError(error: CurrencyPickerError, dispatch = true): void {\n // Use ElementInternals for native form validation\n this.internals.setValidity({ customError: true }, error.message)\n this.setAttribute('aria-invalid', 'true')\n if (dispatch) {\n this.dispatchErrorEvent(error)\n }\n }\n\n /**\n * Dispatches an error event.\n * @param error The error to dispatch\n */\n private dispatchErrorEvent(error: CurrencyPickerError): void {\n this.dispatchEvent(\n new CustomEvent('error', {\n detail: { error },\n bubbles: false,\n })\n )\n }\n\n /**\n * Clears the current error state using ElementInternals.\n */\n private clearError(): void {\n this.internals.setValidity({})\n this.setAttribute('aria-invalid', 'false')\n }\n\n /**\n * Validates currency codes against the supported currencies.\n * @param codes Array of currency codes to validate\n * @returns Array of invalid currency codes\n */\n private validateCurrencyCodes(codes: string[]): string[] {\n return codes.filter((code) => !this.currencies.some((c) => c.code === code))\n }\n\n /**\n * Safely validates and filters currency codes, setting errors for invalid codes.\n * @param codes Array of currency codes to validate\n * @param property Name of the property being validated\n * @returns Array of valid currency codes\n */\n private safeCurrencyValidation(codes: string[], property: string): string[] {\n if (!Array.isArray(codes)) {\n this.setError({\n type: 'validation',\n message: `Invalid ${property}: expected array of currency codes`,\n details: { property, value: codes },\n })\n return []\n }\n\n const invalidCodes = this.validateCurrencyCodes(codes)\n if (invalidCodes.length > 0) {\n this.setError({\n type: 'validation',\n message: `Invalid currency codes in ${property}: ${invalidCodes.join(', ')}`,\n details: { property, invalidCodes, validCodes: this.currencies.map((c) => c.code) },\n }) // Dispatch error event for validation errors\n\n // Return only valid codes\n return codes.filter((code) => !invalidCodes.includes(code))\n }\n\n // Clear any previous validation errors for this property\n if (!this.internals.validity.valid) {\n this.clearError()\n }\n\n return codes\n }\n\n /**\n * Validates selection constraints using ElementInternals.\n * @param newSelection The new selection to validate\n * @returns Whether the selection is valid\n */\n private validateSelectionConstraints(newSelection: string[]): boolean {\n if (!this.multi && newSelection.length > 1) {\n this.setError({\n type: 'selection',\n message: 'Multiple currency selection is not allowed when multi=false',\n details: { multi: this.multi, attemptedSelection: newSelection },\n })\n return false\n }\n\n if (this.required && newSelection.length === 0) {\n this.internals.setValidity({ valueMissing: true }, 'At least one currency must be selected')\n this.setAttribute('aria-invalid', 'true')\n this.dispatchErrorEvent({\n type: 'selection',\n message: 'At least one currency must be selected when required=true',\n details: { required: this.required, currentSelection: newSelection },\n })\n return false\n }\n\n return true\n }\n\n private updateSelectableCurrencies() {\n const selectedCodes = new Set(this.selected)\n\n // If allowedCurrencies is specified, filter the master list by it\n let availableCurrencies = this.currencies\n if (this.allowedCurrencies.length > 0) {\n const allowedSet = new Set(this.allowedCurrencies)\n availableCurrencies = this.currencies.filter((c) => allowedSet.has(c.code))\n }\n if (this.multi) {\n // Then filter out already selected currencies\n this.selectableCurrencies = availableCurrencies.filter((c) => !selectedCodes.has(c.code))\n } else {\n // If single-select, just use the available currencies\n this.selectableCurrencies = availableCurrencies\n }\n }\n\n private handleCurrencySelect(event: CustomEvent<UiSelectChangeEvent>) {\n event.stopPropagation()\n try {\n const select = event.target as UiSelectElement\n const selectedCode = select.value\n\n if (!selectedCode) return\n\n const currency = this.currencies.find((c) => c.code === selectedCode)\n if (!currency) {\n this.setError({\n type: 'selection',\n message: `Currency not found: ${selectedCode}`,\n details: { attemptedCode: selectedCode },\n })\n return\n }\n\n let newSelection: string[]\n\n if (this.multi) {\n // If multi-select, add the currency to the selection\n if (!this.selected.includes(currency.code)) {\n newSelection = [...this.selected, currency.code]\n } else {\n // Currency already selected, clear any selection errors but don't add duplicate\n if (!this.internals.validity.valid) {\n this.clearError()\n }\n return\n }\n } else {\n // If single-select, replace the current selection\n newSelection = [currency.code]\n }\n\n // Validate the new selection\n if (!this.validateSelectionConstraints(newSelection)) {\n return // Error was set in validateSelectionConstraints\n }\n\n this.selected = newSelection\n this.updateSelectableCurrencies()\n\n // Reset the select for multi-select mode\n if (this.multi) {\n select.value = ''\n }\n\n // Clear any previous errors on successful selection\n this.clearError()\n this.dispatchChangeEvent()\n } catch (error) {\n this.setError({\n type: 'internal',\n message: `Internal error during currency selection: ${error instanceof Error ? error.message : String(error)}`,\n details: { originalError: error },\n })\n }\n }\n\n private handleRemoveCurrency(event: Event) {\n try {\n const chip = event.target as HTMLElement\n const currencyCode = chip.dataset.code\n\n if (!currencyCode) {\n this.setError({\n type: 'internal',\n message: 'Unable to determine currency code from chip element',\n details: { chipElement: chip },\n })\n return\n }\n\n const newSelection = this.selected.filter((code) => code !== currencyCode)\n\n // Validate the new selection (e.g., required constraint)\n if (!this.validateSelectionConstraints(newSelection)) {\n return // Error was set in validateSelectionConstraints\n }\n\n this.selected = newSelection\n this.updateSelectableCurrencies()\n\n // Clear any previous errors on successful removal\n this.clearError()\n this.dispatchChangeEvent()\n } catch (error) {\n this.setError({\n type: 'internal',\n message: `Internal error during currency removal: ${error instanceof Error ? error.message : String(error)}`,\n details: { originalError: error },\n })\n }\n }\n\n private dispatchChangeEvent() {\n const selectedCurrencies = this.getSelectedCurrencies()\n\n // Update form value using ElementInternals\n this.updateFormValue()\n this.dispatchEvent(\n new CustomEvent('change', {\n detail: {\n currencies: selectedCurrencies,\n codes: this.selected,\n },\n bubbles: false,\n })\n )\n }\n\n /**\n * Get the currently selected currency codes as a copy of the array.\n * This is a read-only getter that returns a shallow copy to prevent external modification.\n * @returns Array of selected ISO 4217 currency codes\n */\n get selectedCurrencyCodes(): string[] {\n return [...this.selected]\n }\n\n /**\n * Get the full currency objects for currently selected currencies.\n * This method looks up each selected currency code in the master currencies list\n * and returns the complete currency information including name, symbol, country, and flag.\n * @returns Array of complete Currency objects for selected currencies\n */\n getSelectedCurrencies(): Currency[] {\n const result: Currency[] = []\n for (const code of this.selected) {\n const currency = this.currencies.find((c) => c.code === code)\n if (currency) {\n result.push(currency)\n }\n }\n return result\n }\n\n /**\n * Clear all selected currencies.\n * This method removes all selections, validates constraints (such as required),\n * updates the UI, and dispatches a change event. If validation fails (e.g.,\n * component is required), the operation will be cancelled and an error will be set.\n * @throws Will dispatch an error event if validation fails or an internal error occurs\n */\n clearSelection() {\n try {\n const newSelection: string[] = []\n\n // Validate clearing selection (e.g., required constraint)\n if (!this.validateSelectionConstraints(newSelection)) {\n return // Error was set in validateSelectionConstraints\n }\n\n this.selected = newSelection\n this.updateSelectableCurrencies()\n\n // Clear any previous errors on successful clear\n this.clearError()\n this.dispatchChangeEvent()\n\n // Synchronize the select element to show no selection\n if (this.selectElement) {\n this.selectElement.value = ''\n }\n } catch (error) {\n this.setError({\n type: 'internal',\n message: `Internal error during selection clear: ${error instanceof Error ? error.message : String(error)}`,\n details: { originalError: error },\n })\n } finally {\n this.requestUpdate()\n }\n }\n\n /**\n * Form state restore callback for ElementInternals.\n * This method is called by the browser when form state is being restored\n * (e.g., browser back/forward navigation, form autofill).\n * It parses a comma-separated string of currency codes and restores the selection.\n * @param state The state to restore - typically a comma-separated string of currency codes\n * @param _mode The restore mode (unused in this implementation)\n */\n formStateRestoreCallback(state: string | FormData | null): void {\n if (typeof state === 'string' && state) {\n this.selected = state.split(',').filter(Boolean)\n this.updateSelectableCurrencies()\n\n // Synchronize the select element with restored state\n if (this.selectElement) {\n if (!this.multi && this.selected.length > 0) {\n this.selectElement.value = this.selected[0]\n } else {\n this.selectElement.value = ''\n }\n }\n }\n }\n\n /**\n * Form reset callback for ElementInternals.\n * This method is called by the browser when the containing form is reset.\n * It clears all selections, updates the UI, clears any errors, and updates the form value.\n */\n formResetCallback(): void {\n this.selected = []\n this.updateSelectableCurrencies()\n this.clearError()\n this.updateFormValue()\n\n // Synchronize the select element to show no selection\n if (this.selectElement) {\n this.selectElement.value = ''\n }\n\n this.requestUpdate()\n }\n\n /**\n * Main render method for the component.\n * Renders the currency selector with dropdown, selected chips (if multi-select), and error display.\n * Updates ARIA attributes and error states based on current component state.\n * @returns TemplateResult containing the complete component HTML\n */\n override render(): TemplateResult {\n const ariaLabel = this.multi\n ? `Currency selector. ${this.selected.length} currencies selected.`\n : `Currency selector. ${this.selected.length > 0 ? this.selected[0] + ' selected' : 'No currency selected'}.`\n\n const hasError = !this.internals.validity.valid\n\n return html`\n <div class=\"currency-picker\" role=\"group\" aria-label=\"${ariaLabel}\">\n <ui-select\n label=\"${this.label}\"\n @change=\"${this.handleCurrencySelect}\"\n menuPositioning=\"popover\"\n ?disabled=\"${this.disabled}\"\n ?required=\"${this.required}\"\n .supportingText=\"${this.supportingText || ''}\"\n .name=\"${this.name || ''}\"\n aria-describedby=\"${this.supportingText ? 'supporting-text' : ''}\"\n aria-invalid=\"${hasError ? 'true' : 'false'}\"\n >\n <ui-option value=\"\">\n <div>Select a currency...</div>\n </ui-option>\n ${repeat(\n this.selectableCurrencies,\n (currency) => currency.code,\n (currency) => html`\n <ui-option value=\"${currency.code}\">\n <div slot=\"overline\">${currency.country}</div>\n <div slot=\"supporting-text\">${currency.name}</div>\n <div slot=\"end-text\" class=\"currency-symbol\">${currency.symbol}</div>\n <div slot=\"start\" class=\"flag\">${currency.flag}</div>\n <div>${currency.code}</div>\n </ui-option>\n `\n )}\n </ui-select>\n ${this.renderSelected()}${this.renderError()}\n </div>\n `\n }\n\n /**\n * Renders error messages when showErrors is true and the component is invalid.\n * The error display uses ARIA live regions for accessibility.\n * @returns TemplateResult with error display or nothing if no errors should be shown\n */\n protected renderError(): TemplateResult | typeof nothing {\n if (!this.showErrors || this.internals.validity.valid) {\n return nothing\n }\n\n return html`\n <div class=\"error\" role=\"alert\" aria-live=\"polite\">\n <span class=\"error-message\">${this.internals.validationMessage}</span>\n </div>\n `\n }\n\n /**\n * Renders the selected currencies as removable chips in multi-select mode.\n * Only renders when multi=true and there are selected currencies.\n * Each chip displays the currency flag and code, and can be removed by the user.\n * @returns TemplateResult with chip display or nothing if not applicable\n */\n protected renderSelected(): TemplateResult | typeof nothing {\n if (!this.multi) {\n return nothing\n }\n const selected = this.getSelectedCurrencies()\n if (selected.length === 0) return nothing\n\n return html`\n <ui-chip-set>\n ${repeat(\n selected,\n (currency) => currency.code,\n (currency) => html`\n <ui-chip\n data-code=\"${currency.code}\"\n type=\"input\"\n @remove=\"${this.handleRemoveCurrency}\"\n ?removable=\"${true}\"\n >\n <span slot=\"icon\" class=\"chip-flag\">${currency.flag}</span>\n <span class=\"chip-code\">${currency.code}</span>\n </ui-chip>\n `\n )}\n </ui-chip-set>\n `\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Picker.js","sourceRoot":"","sources":["../../../../../src/elements/currency/internals/Picker.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAA4C,OAAO,EAAE,MAAM,KAAK,CAAA;AACzF,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAA;AAGjD,OAAO,iCAAiC,CAAA;AACxC,OAAO,6BAA6B,CAAA;AACpC,OAAO,iCAAiC,CAAA;AACxC,OAAO,iCAAiC,CAAA;;sBAoFI,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAjC,cAAe,SAAQ,WAAU;;;oCA0BnD,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC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AAO,OAAO,CAAA;YAChB,CAAC;YACD,MAAM,QAAQ,GAAG,IAAI,CAAC,qBAAqB,EAAE,CAAA;YAC7C,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;gBAAE,OAAO,OAAO,CAAA;YAEzC,OAAO,IAAI,CAAA;;UAEL,MAAM,CACN,QAAQ,EACR,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,EAC3B,CAAC,QAAQ,EAAE,EAAE,CAAC,IAAI,CAAA;;2BAED,QAAQ,CAAC,IAAI;;yBAEf,IAAI,CAAC,oBAAoB;4BACtB,IAAI;;oDAEoB,QAAQ,CAAC,IAAI;wCACzB,QAAQ,CAAC,IAAI;;WAE1C,CACF;;KAEJ,CAAA;QACH,CAAC;;;AA9xBH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH","sourcesContent":["import { LitElement, html, type TemplateResult, type PropertyValues, nothing } from 'lit'\nimport { property, state, query } from 'lit/decorators.js'\nimport { repeat } from 'lit/directives/repeat.js'\nimport type { UiSelectChangeEvent, UiSelectElement } from '../../../md/select/ui-select.js'\n\nimport '../../../md/chip/ui-chip-set.js'\nimport '../../../md/chip/ui-chip.js'\nimport '../../../md/select/ui-select.js'\nimport '../../../md/select/ui-option.js'\n\n/**\n * Represents a currency with all its display information.\n */\nexport interface Currency {\n /** ISO 4217 currency code (e.g., 'USD', 'EUR') */\n code: string\n /** Full name of the currency (e.g., 'US Dollar', 'Euro') */\n name: string\n /** Currency symbol (e.g., '$', '€') */\n symbol: string\n /** Country or region name (e.g., 'United States', 'European Union') */\n country: string\n /** Flag emoji representing the currency's origin */\n flag: string\n}\n\n/**\n * Represents an error that can occur in the CurrencyPicker component.\n */\nexport interface CurrencyPickerError {\n /** Type of error: validation, selection constraint, or internal error */\n type: 'validation' | 'selection' | 'internal'\n /** Human-readable error message */\n message: string\n /** Optional additional details about the error for debugging */\n details?: Record<string, unknown>\n}\n\n/**\n * Event detail interface for currency picker error events.\n */\nexport interface CurrencyPickerErrorEvent {\n /** The error information */\n error: CurrencyPickerError\n}\n\n/**\n * A web component for selecting currencies with chips display.\n * Provides a searchable interface with country flags and currency information.\n *\n * This component uses ElementInternals for native form integration and\n * follows web standards for error handling and validation.\n *\n * ## Features\n * - Single or multi-select currency selection\n * - Visual chips display for selected currencies\n * - Native form integration with ElementInternals\n * - Comprehensive validation and error handling\n * - Accessibility support with ARIA attributes\n * - Keyboard navigation support\n * - Currency filtering based on allowed currencies\n *\n * ## Usage\n * ```html\n * <!-- Basic usage -->\n * <currency-picker></currency-picker>\n *\n * <!-- Multi-select with allowed currencies -->\n * <currency-picker multi .allowedCurrencies=\"${['USD', 'EUR', 'GBP']}\"></currency-picker>\n *\n * <!-- Form integration -->\n * <form>\n * <currency-picker name=\"currencies\" required></currency-picker>\n * </form>\n * ```\n *\n * @fires change - Dispatched when selected currencies change due to user interaction.\n * Contains {currencies: Currency[], codes: string[]} in event.detail\n * @fires error - Dispatched when validation or other errors occur.\n * Contains {error: CurrencyPickerError} in event.detail\n *\n * @example\n * ```typescript\n * const picker = document.querySelector('currency-picker');\n * picker.addEventListener('change', (e) => {\n * console.log('Selected currencies:', e.detail.currencies);\n * });\n * picker.addEventListener('error', (e) => {\n * console.error('Picker error:', e.detail.error.message);\n * });\n * ```\n */\nexport default class CurrencyPicker extends LitElement {\n /**\n * Indicates that this custom element is form-associated and can participate in form submission.\n * This enables the component to work with native HTML forms and use ElementInternals.\n */\n static formAssociated = true\n\n /**\n * Private ElementInternals instance for form integration and validation.\n * Provides access to form APIs like setFormValue, setValidity, etc.\n */\n private internals: ElementInternals\n\n /**\n * Shadow root configuration for the component.\n * Uses 'open' mode for accessibility and delegates focus to enable proper focus management.\n */\n static override shadowRootOptions: ShadowRootInit = {\n mode: 'open',\n delegatesFocus: true,\n }\n\n /**\n * The currently selected currency codes.\n * This is an array of ISO 4217 currency codes (e.g., 'USD', 'EUR').\n */\n @property({ type: Array }) accessor selected: string[] = []\n\n /**\n * The currencies that should be available for selection.\n * If not specified, all supported currencies will be available.\n * This is an array of ISO 4217 currency codes (e.g., 'USD', 'EUR').\n */\n @property({ type: Array }) accessor allowedCurrencies: string[] = []\n\n /**\n * The label for the currency selection dropdown.\n * This is displayed as the label for the select input.\n * @attribute\n */\n @property({ type: String }) accessor label = 'Add Currency'\n\n /**\n * The name attribute for the currency selection dropdown.\n * This is used when submitting forms that include this component.\n * @attribute\n */\n @property({ type: String }) accessor name: string | undefined\n\n /**\n * Supporting text for the currency selection dropdown.\n * This is displayed below the select input.\n * @attribute\n */\n @property({ type: String }) accessor supportingText: string | undefined\n\n /**\n * Whether the currency selection is required.\n * If true, the component will enforce at least one currency to be selected.\n * @attribute\n */\n @property({ type: Boolean }) accessor required = false\n\n /**\n * Whether the currency selection is disabled.\n * If true, the component will not allow any changes to the selected currencies.\n * @attribute\n */\n @property({ type: Boolean }) accessor disabled = false\n /**\n * Whether multiple currencies can be selected.\n * If true, the component allows selecting multiple currencies.\n * If false, only one currency can be selected at a time.\n * @attribute\n */\n @property({ type: Boolean }) accessor multi = false\n\n /**\n * Whether to show errors inline within the component.\n * If true, errors will be displayed below the component.\n * If false, errors will only be dispatched as events.\n * @attribute\n */\n @property({ type: Boolean }) accessor showErrors = true\n\n /**\n * The currently selectable currencies (filtered based on selection and allowed currencies).\n * This is automatically updated based on the selected currencies and allowedCurrencies property.\n */\n @state() private accessor selectableCurrencies: Currency[] = []\n\n /**\n * Reference to the Material Design outlined select element.\n * Used to manage the select's internal state and keep it synchronized with the component's selected property.\n */\n @query('ui-select')\n private accessor selectElement!: UiSelectElement\n\n /**\n * Returns the form element that contains this component, if any.\n * Part of the ElementInternals API for form-associated custom elements.\n */\n get form() {\n return this.internals.form\n }\n\n /**\n * Returns the validity state of the component.\n * Part of the ElementInternals API for form-associated custom elements.\n */\n get validity() {\n return this.internals.validity\n }\n\n /**\n * Returns the validation message for the component.\n * Part of the ElementInternals API for form-associated custom elements.\n */\n get validationMessage() {\n return this.internals.validationMessage\n }\n\n /**\n * Returns whether the component will be validated when the form is submitted.\n * Part of the ElementInternals API for form-associated custom elements.\n */\n get willValidate() {\n return this.internals.willValidate\n }\n\n /**\n * Checks the validity of the component without displaying validation UI.\n * Part of the ElementInternals API for form-associated custom elements.\n * @returns True if the component is valid, false otherwise\n */\n checkValidity() {\n return this.internals.checkValidity()\n }\n\n /**\n * Checks the validity of the component and displays validation UI if invalid.\n * Part of the ElementInternals API for form-associated custom elements.\n * @returns True if the component is valid, false otherwise\n */\n reportValidity() {\n return this.internals.reportValidity()\n }\n\n /**\n * Master list of supported currencies with their display information.\n * This includes popular currencies with their ISO codes, names, symbols, countries, and flag emojis.\n * Private and readonly to ensure data integrity.\n */\n private readonly currencies: Currency[] = [\n { code: 'USD', name: 'US Dollar', symbol: '$', country: 'United States', flag: '🇺🇸' },\n { code: 'EUR', name: 'Euro', symbol: '€', country: 'European Union', flag: '🇪🇺' },\n { code: 'GBP', name: 'British Pound', symbol: '£', country: 'United Kingdom', flag: '🇬🇧' },\n { code: 'JPY', name: 'Japanese Yen', symbol: '¥', country: 'Japan', flag: '🇯🇵' },\n { code: 'CAD', name: 'Canadian Dollar', symbol: 'C$', country: 'Canada', flag: '🇨🇦' },\n { code: 'AUD', name: 'Australian Dollar', symbol: 'A$', country: 'Australia', flag: '🇦🇺' },\n { code: 'CHF', name: 'Swiss Franc', symbol: 'Fr', country: 'Switzerland', flag: '🇨🇭' },\n { code: 'CNY', name: 'Chinese Yuan', symbol: '¥', country: 'China', flag: '🇨🇳' },\n { code: 'INR', name: 'Indian Rupee', symbol: '₹', country: 'India', flag: '🇮🇳' },\n { code: 'KRW', name: 'South Korean Won', symbol: '₩', country: 'South Korea', flag: '🇰🇷' },\n { code: 'BRL', name: 'Brazilian Real', symbol: 'R$', country: 'Brazil', flag: '🇧🇷' },\n { code: 'MXN', name: 'Mexican Peso', symbol: '$', country: 'Mexico', flag: '🇲🇽' },\n { code: 'SGD', name: 'Singapore Dollar', symbol: 'S$', country: 'Singapore', flag: '🇸🇬' },\n { code: 'HKD', name: 'Hong Kong Dollar', symbol: 'HK$', country: 'Hong Kong', flag: '🇭🇰' },\n { code: 'NOK', name: 'Norwegian Krone', symbol: 'kr', country: 'Norway', flag: '🇳🇴' },\n { code: 'SEK', name: 'Swedish Krona', symbol: 'kr', country: 'Sweden', flag: '🇸🇪' },\n { code: 'DKK', name: 'Danish Krone', symbol: 'kr', country: 'Denmark', flag: '🇩🇰' },\n { code: 'PLN', name: 'Polish Zloty', symbol: 'zł', country: 'Poland', flag: '🇵🇱' },\n { code: 'RUB', name: 'Russian Ruble', symbol: '₽', country: 'Russia', flag: '🇷🇺' },\n { code: 'ZAR', name: 'South African Rand', symbol: 'R', country: 'South Africa', flag: '🇿🇦' },\n { code: 'TRY', name: 'Turkish Lira', symbol: '₺', country: 'Turkey', flag: '🇹🇷' },\n { code: 'NZD', name: 'New Zealand Dollar', symbol: 'NZ$', country: 'New Zealand', flag: '🇳🇿' },\n { code: 'THB', name: 'Thai Baht', symbol: '฿', country: 'Thailand', flag: '🇹🇭' },\n { code: 'ILS', name: 'Israeli Shekel', symbol: '₪', country: 'Israel', flag: '🇮🇱' },\n { code: 'AED', name: 'UAE Dirham', symbol: 'د.إ', country: 'United Arab Emirates', flag: '🇦🇪' },\n ]\n\n constructor() {\n super()\n this.internals = this.attachInternals()\n }\n\n override connectedCallback() {\n super.connectedCallback()\n this.updateSelectableCurrencies()\n this.updateFormValue()\n }\n\n /**\n * Updates the form value using ElementInternals.\n */\n private updateFormValue(): void {\n const value = this.selected.length > 0 ? this.selected.join(',') : null\n this.internals.setFormValue(value)\n }\n\n protected override willUpdate(changed: PropertyValues<this>): void {\n super.willUpdate(changed)\n\n // Validate selected currencies with error handling\n if (changed.has('selected')) {\n this.selected = this.safeCurrencyValidation(this.selected, 'selected')\n\n // Also validate against allowedCurrencies if specified\n if (this.allowedCurrencies.length > 0) {\n const allowedSet = new Set(this.allowedCurrencies)\n const invalidSelectedCodes = this.selected.filter((code) => !allowedSet.has(code))\n\n if (invalidSelectedCodes.length > 0) {\n this.setError({\n type: 'validation',\n message: `Selected currencies not in allowed list: ${invalidSelectedCodes.join(', ')}`,\n details: {\n property: 'selected',\n invalidCodes: invalidSelectedCodes,\n allowedCurrencies: this.allowedCurrencies,\n },\n })\n\n // Filter out invalid codes\n this.selected = this.selected.filter((code) => allowedSet.has(code))\n }\n }\n\n // Also validate selection constraints when property changes\n if (!this.multi && this.selected.length > 1) {\n // In single-select mode, keep only the first valid selection\n this.selected = this.selected.slice(0, 1)\n this.setError({\n type: 'selection',\n message: 'Multiple currency selection is not allowed when multi=false. Only first selection kept.',\n details: { multi: this.multi, originalSelection: changed.get('selected') },\n })\n }\n\n // Validate required constraint\n if (this.required && this.selected.length === 0) {\n this.internals.setValidity({ valueMissing: true }, 'At least one currency must be selected')\n this.setAttribute('aria-invalid', 'true')\n this.dispatchErrorEvent({\n type: 'selection',\n message: 'At least one currency must be selected when required=true',\n details: { required: this.required, currentSelection: this.selected },\n })\n } else if (!this.required || this.selected.length > 0) {\n // Clear validation if not required or has selection\n this.internals.setValidity({})\n this.setAttribute('aria-invalid', 'false')\n }\n }\n // Validate allowed currencies with error handling\n if (changed.has('allowedCurrencies')) {\n this.allowedCurrencies = this.safeCurrencyValidation(this.allowedCurrencies, 'allowedCurrencies')\n\n // Filter selected currencies to only include allowed ones\n if (this.allowedCurrencies.length > 0) {\n const allowedSet = new Set(this.allowedCurrencies)\n const filteredSelected = this.selected.filter((code) => allowedSet.has(code))\n if (filteredSelected.length !== this.selected.length) {\n this.selected = filteredSelected\n }\n }\n }\n\n if (changed.has('selected') || changed.has('allowedCurrencies') || changed.has('multi')) {\n this.updateSelectableCurrencies()\n }\n\n // Update form value when selected changes\n if (changed.has('selected')) {\n this.updateFormValue()\n }\n\n // Synchronize the select element's value with the component's selected state\n if (changed.has('selected') && this.selectElement) {\n // In single-select mode, set the select value to the first selected currency or empty\n // In multi-select mode, always clear the select after selection to allow adding more\n if (!this.multi) {\n this.selectElement.value = this.selected.length > 0 ? this.selected[0] : ''\n } else {\n // For multi-select, always keep the select cleared to allow adding more currencies\n this.selectElement.value = ''\n }\n }\n }\n\n /**\n * Called after the component has been updated and rendered.\n * Ensures the select element's value stays synchronized with the component's selected state.\n */\n protected override updated(changed: PropertyValues<this>): void {\n super.updated(changed)\n\n // Ensure select element is synchronized after rendering\n if (this.selectElement && (changed.has('selected') || changed.has('multi'))) {\n if (!this.multi) {\n // In single-select mode, show the selected currency or clear the select\n this.selectElement.value = this.selected.length > 0 ? this.selected[0] : ''\n } else {\n // In multi-select mode, always keep the select cleared to allow adding more currencies\n this.selectElement.value = ''\n }\n }\n }\n\n /**\n * Sets an error state using ElementInternals and optionally dispatches an error event.\n * @param error The error to set\n * @param dispatch Whether to dispatch an error event (default: true)\n */\n private setError(error: CurrencyPickerError, dispatch = true): void {\n // Use ElementInternals for native form validation\n this.internals.setValidity({ customError: true }, error.message)\n this.setAttribute('aria-invalid', 'true')\n if (dispatch) {\n this.dispatchErrorEvent(error)\n }\n }\n\n /**\n * Dispatches an error event.\n * @param error The error to dispatch\n */\n private dispatchErrorEvent(error: CurrencyPickerError): void {\n this.dispatchEvent(\n new CustomEvent('error', {\n detail: { error },\n bubbles: false,\n })\n )\n }\n\n /**\n * Clears the current error state using ElementInternals.\n */\n private clearError(): void {\n this.internals.setValidity({})\n this.setAttribute('aria-invalid', 'false')\n }\n\n /**\n * Validates currency codes against the supported currencies.\n * @param codes Array of currency codes to validate\n * @returns Array of invalid currency codes\n */\n private validateCurrencyCodes(codes: string[]): string[] {\n return codes.filter((code) => !this.currencies.some((c) => c.code === code))\n }\n\n /**\n * Safely validates and filters currency codes, setting errors for invalid codes.\n * @param codes Array of currency codes to validate\n * @param property Name of the property being validated\n * @returns Array of valid currency codes\n */\n private safeCurrencyValidation(codes: string[], property: string): string[] {\n if (!Array.isArray(codes)) {\n this.setError({\n type: 'validation',\n message: `Invalid ${property}: expected array of currency codes`,\n details: { property, value: codes },\n })\n return []\n }\n\n const invalidCodes = this.validateCurrencyCodes(codes)\n if (invalidCodes.length > 0) {\n this.setError({\n type: 'validation',\n message: `Invalid currency codes in ${property}: ${invalidCodes.join(', ')}`,\n details: { property, invalidCodes, validCodes: this.currencies.map((c) => c.code) },\n }) // Dispatch error event for validation errors\n\n // Return only valid codes\n return codes.filter((code) => !invalidCodes.includes(code))\n }\n\n // Clear any previous validation errors for this property\n if (!this.internals.validity.valid) {\n this.clearError()\n }\n\n return codes\n }\n\n /**\n * Validates selection constraints using ElementInternals.\n * @param newSelection The new selection to validate\n * @returns Whether the selection is valid\n */\n private validateSelectionConstraints(newSelection: string[]): boolean {\n if (!this.multi && newSelection.length > 1) {\n this.setError({\n type: 'selection',\n message: 'Multiple currency selection is not allowed when multi=false',\n details: { multi: this.multi, attemptedSelection: newSelection },\n })\n return false\n }\n\n if (this.required && newSelection.length === 0) {\n this.internals.setValidity({ valueMissing: true }, 'At least one currency must be selected')\n this.setAttribute('aria-invalid', 'true')\n this.dispatchErrorEvent({\n type: 'selection',\n message: 'At least one currency must be selected when required=true',\n details: { required: this.required, currentSelection: newSelection },\n })\n return false\n }\n\n return true\n }\n\n private updateSelectableCurrencies() {\n const selectedCodes = new Set(this.selected)\n\n // If allowedCurrencies is specified, filter the master list by it\n let availableCurrencies = this.currencies\n if (this.allowedCurrencies.length > 0) {\n const allowedSet = new Set(this.allowedCurrencies)\n availableCurrencies = this.currencies.filter((c) => allowedSet.has(c.code))\n }\n if (this.multi) {\n // Then filter out already selected currencies\n this.selectableCurrencies = availableCurrencies.filter((c) => !selectedCodes.has(c.code))\n } else {\n // If single-select, just use the available currencies\n this.selectableCurrencies = availableCurrencies\n }\n }\n\n private handleCurrencySelect(event: CustomEvent<UiSelectChangeEvent>) {\n event.stopPropagation()\n try {\n const select = event.target as UiSelectElement\n const selectedCode = select.value\n\n if (!selectedCode) return\n\n const currency = this.currencies.find((c) => c.code === selectedCode)\n if (!currency) {\n this.setError({\n type: 'selection',\n message: `Currency not found: ${selectedCode}`,\n details: { attemptedCode: selectedCode },\n })\n return\n }\n\n let newSelection: string[]\n\n if (this.multi) {\n // If multi-select, add the currency to the selection\n if (!this.selected.includes(currency.code)) {\n newSelection = [...this.selected, currency.code]\n } else {\n // Currency already selected, clear any selection errors but don't add duplicate\n if (!this.internals.validity.valid) {\n this.clearError()\n }\n return\n }\n } else {\n // If single-select, replace the current selection\n newSelection = [currency.code]\n }\n\n // Validate the new selection\n if (!this.validateSelectionConstraints(newSelection)) {\n return // Error was set in validateSelectionConstraints\n }\n\n this.selected = newSelection\n this.updateSelectableCurrencies()\n\n // Reset the select for multi-select mode\n if (this.multi) {\n select.value = ''\n }\n\n // Clear any previous errors on successful selection\n this.clearError()\n this.dispatchChangeEvent()\n } catch (error) {\n this.setError({\n type: 'internal',\n message: `Internal error during currency selection: ${error instanceof Error ? error.message : String(error)}`,\n details: { originalError: error },\n })\n }\n }\n\n private handleRemoveCurrency(event: Event) {\n try {\n const chip = event.target as HTMLElement\n const currencyCode = chip.dataset.code\n\n if (!currencyCode) {\n this.setError({\n type: 'internal',\n message: 'Unable to determine currency code from chip element',\n details: { chipElement: chip },\n })\n return\n }\n\n const newSelection = this.selected.filter((code) => code !== currencyCode)\n\n // Validate the new selection (e.g., required constraint)\n if (!this.validateSelectionConstraints(newSelection)) {\n return // Error was set in validateSelectionConstraints\n }\n\n this.selected = newSelection\n this.updateSelectableCurrencies()\n\n // Clear any previous errors on successful removal\n this.clearError()\n this.dispatchChangeEvent()\n } catch (error) {\n this.setError({\n type: 'internal',\n message: `Internal error during currency removal: ${error instanceof Error ? error.message : String(error)}`,\n details: { originalError: error },\n })\n }\n }\n\n private dispatchChangeEvent() {\n const selectedCurrencies = this.getSelectedCurrencies()\n\n // Update form value using ElementInternals\n this.updateFormValue()\n this.dispatchEvent(\n new CustomEvent('change', {\n detail: {\n currencies: selectedCurrencies,\n codes: this.selected,\n },\n bubbles: false,\n })\n )\n }\n\n /**\n * Get the currently selected currency codes as a copy of the array.\n * This is a read-only getter that returns a shallow copy to prevent external modification.\n * @returns Array of selected ISO 4217 currency codes\n */\n get selectedCurrencyCodes(): string[] {\n return [...this.selected]\n }\n\n /**\n * Get the full currency objects for currently selected currencies.\n * This method looks up each selected currency code in the master currencies list\n * and returns the complete currency information including name, symbol, country, and flag.\n * @returns Array of complete Currency objects for selected currencies\n */\n getSelectedCurrencies(): Currency[] {\n const result: Currency[] = []\n for (const code of this.selected) {\n const currency = this.currencies.find((c) => c.code === code)\n if (currency) {\n result.push(currency)\n }\n }\n return result\n }\n\n /**\n * Clear all selected currencies.\n * This method removes all selections, validates constraints (such as required),\n * updates the UI, and dispatches a change event. If validation fails (e.g.,\n * component is required), the operation will be cancelled and an error will be set.\n * @throws Will dispatch an error event if validation fails or an internal error occurs\n */\n clearSelection() {\n try {\n const newSelection: string[] = []\n\n // Validate clearing selection (e.g., required constraint)\n if (!this.validateSelectionConstraints(newSelection)) {\n return // Error was set in validateSelectionConstraints\n }\n\n this.selected = newSelection\n this.updateSelectableCurrencies()\n\n // Clear any previous errors on successful clear\n this.clearError()\n this.dispatchChangeEvent()\n\n // Synchronize the select element to show no selection\n if (this.selectElement) {\n this.selectElement.value = ''\n }\n } catch (error) {\n this.setError({\n type: 'internal',\n message: `Internal error during selection clear: ${error instanceof Error ? error.message : String(error)}`,\n details: { originalError: error },\n })\n } finally {\n this.requestUpdate()\n }\n }\n\n /**\n * Form state restore callback for ElementInternals.\n * This method is called by the browser when form state is being restored\n * (e.g., browser back/forward navigation, form autofill).\n * It parses a comma-separated string of currency codes and restores the selection.\n * @param state The state to restore - typically a comma-separated string of currency codes\n * @param _mode The restore mode (unused in this implementation)\n */\n formStateRestoreCallback(state: string | FormData | null): void {\n if (typeof state === 'string' && state) {\n this.selected = state.split(',').filter(Boolean)\n this.updateSelectableCurrencies()\n\n // Synchronize the select element with restored state\n if (this.selectElement) {\n if (!this.multi && this.selected.length > 0) {\n this.selectElement.value = this.selected[0]\n } else {\n this.selectElement.value = ''\n }\n }\n }\n }\n\n /**\n * Form reset callback for ElementInternals.\n * This method is called by the browser when the containing form is reset.\n * It clears all selections, updates the UI, clears any errors, and updates the form value.\n */\n formResetCallback(): void {\n this.selected = []\n this.updateSelectableCurrencies()\n this.clearError()\n this.updateFormValue()\n\n // Synchronize the select element to show no selection\n if (this.selectElement) {\n this.selectElement.value = ''\n }\n\n this.requestUpdate()\n }\n\n /**\n * Main render method for the component.\n * Renders the currency selector with dropdown, selected chips (if multi-select), and error display.\n * Updates ARIA attributes and error states based on current component state.\n * @returns TemplateResult containing the complete component HTML\n */\n override render(): TemplateResult {\n const ariaLabel = this.multi\n ? `Currency selector. ${this.selected.length} currencies selected.`\n : `Currency selector. ${this.selected.length > 0 ? this.selected[0] + ' selected' : 'No currency selected'}.`\n\n const hasError = !this.internals.validity.valid\n\n return html`\n <div class=\"currency-picker\" role=\"group\" aria-label=\"${ariaLabel}\">\n <ui-select\n label=\"${this.label}\"\n @change=\"${this.handleCurrencySelect}\"\n ?disabled=\"${this.disabled}\"\n ?required=\"${this.required}\"\n .supportingText=\"${this.supportingText || ''}\"\n .name=\"${this.name || ''}\"\n aria-describedby=\"${this.supportingText ? 'supporting-text' : ''}\"\n aria-invalid=\"${hasError ? 'true' : 'false'}\"\n >\n <ui-option value=\"\">\n <div>Select a currency...</div>\n </ui-option>\n ${repeat(\n this.selectableCurrencies,\n (currency) => currency.code,\n (currency) => html`\n <ui-option value=\"${currency.code}\">\n <div slot=\"overline\">${currency.country}</div>\n <div slot=\"supporting-text\">${currency.name}</div>\n <div slot=\"end-text\" class=\"currency-symbol\">${currency.symbol}</div>\n <div slot=\"start\" class=\"flag\">${currency.flag}</div>\n <div>${currency.code}</div>\n </ui-option>\n `\n )}\n </ui-select>\n ${this.renderSelected()}${this.renderError()}\n </div>\n `\n }\n\n /**\n * Renders error messages when showErrors is true and the component is invalid.\n * The error display uses ARIA live regions for accessibility.\n * @returns TemplateResult with error display or nothing if no errors should be shown\n */\n protected renderError(): TemplateResult | typeof nothing {\n if (!this.showErrors || this.internals.validity.valid) {\n return nothing\n }\n\n return html`\n <div class=\"error\" role=\"alert\" aria-live=\"polite\">\n <span class=\"error-message\">${this.internals.validationMessage}</span>\n </div>\n `\n }\n\n /**\n * Renders the selected currencies as removable chips in multi-select mode.\n * Only renders when multi=true and there are selected currencies.\n * Each chip displays the currency flag and code, and can be removed by the user.\n * @returns TemplateResult with chip display or nothing if not applicable\n */\n protected renderSelected(): TemplateResult | typeof nothing {\n if (!this.multi) {\n return nothing\n }\n const selected = this.getSelectedCurrencies()\n if (selected.length === 0) return nothing\n\n return html`\n <ui-chip-set>\n ${repeat(\n selected,\n (currency) => currency.code,\n (currency) => html`\n <ui-chip\n data-code=\"${currency.code}\"\n type=\"input\"\n @remove=\"${this.handleRemoveCurrency}\"\n ?removable=\"${true}\"\n >\n <span slot=\"icon\" class=\"chip-flag\">${currency.flag}</span>\n <span class=\"chip-code\">${currency.code}</span>\n </ui-chip>\n `\n )}\n </ui-chip-set>\n `\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Menu.d.ts","sourceRoot":"","sources":["../../../../../src/md/menu/internal/Menu.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,cAAc,EAAE,cAAc,EAAE,MAAM,KAAK,CAAA;AAI1D,OAAO,MAAM,MAAM,8BAA8B,CAAA;AACjD,OAAO,UAAU,MAAM,eAAe,CAAA;AACtC,OAAO,SAAS,MAAM,cAAc,CAAA;AAEpC,OAAO,UAAU,MAAM,kCAAkC,CAAA;AAGzD;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,OAAO,IAAK,SAAQ,MAAM;IACtC;;;OAGG;IACyC,QAAQ,CAAC,IAAI,UAAQ;IAEjE;;;OAGG;IACyC,QAAQ,CAAC,QAAQ,UAAQ;IAErE;;OAEG;IACM,QAAQ,CAAC,aAAa,EAAE,SAAS,GAAG,IAAI,CAAO;;IAS/C,iBAAiB,IAAI,IAAI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AC,kBAAkB,CAAC,CAAC,EAAE,KAAK,GAAG,IAAI;IAQ5C;;OAEG;IACM,aAAa,CAAC,CAAC,EAAE,aAAa,GAAG,IAAI;IAuB9C,mBAAmB,CAAC,CAAC,EAAE,WAAW,GAAG,IAAI;IAIzC;;OAEG;IACH,SAAS,CAAC,WAAW,IAAI,IAAI;IAO7B;;OAEG;IACH,YAAY,IAAI,IAAI;IAQpB;;OAEG;IACH,gBAAgB,CAAC,OAAO,EAAE,SAAS,GAAG,IAAI,GAAG,IAAI;IAKxC,YAAY,CAAC,IAAI,EAAE,UAAU,GAAG;QAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO;IAQzF;;OAEG;IACH,SAAS,CAAC,cAAc,IAAI,IAAI;IAOhC;;OAEG;IACH,IAAI,YAAY,IAAI,UAAU,GAAG,IAAI,CAGpC;IAED;;OAEG;IACH,eAAe,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI,GAAG,IAAI;IAO9C;;OAEG;IACH,SAAS,CAAC,iBAAiB,CAAC,CAAC,EAAE,WAAW,GAAG,IAAI;IAKjD;;OAEG;IACH,SAAS,CAAC,gBAAgB,IAAI,IAAI;IAKzB,MAAM,IAAI,cAAc;CAWlC"}
|
|
@@ -136,11 +136,16 @@ let Menu = (() => {
|
|
|
136
136
|
// Let CSS anchor positioning handle the positioning automatically
|
|
137
137
|
// Only intervene if we need to set max-height for overflow cases
|
|
138
138
|
const box = this.getBoundingClientRect();
|
|
139
|
-
const menuBottom = box.top + box.height;
|
|
140
|
-
const menuRight = box.left + box.width;
|
|
141
139
|
// Reset any previous manual positioning to let CSS anchor positioning work
|
|
142
140
|
this.style.removeProperty('position-area');
|
|
143
141
|
this.style.removeProperty('max-height');
|
|
142
|
+
this.style.removeProperty('max-width');
|
|
143
|
+
// Check if the menu content is being clipped
|
|
144
|
+
const isVerticallyClipped = this.scrollHeight > this.clientHeight;
|
|
145
|
+
const isHorizontallyClipped = this.scrollWidth > this.clientWidth;
|
|
146
|
+
// Get the actual bottom and right edges of the menu
|
|
147
|
+
const menuBottom = box.top + box.height;
|
|
148
|
+
const menuRight = box.left + box.width;
|
|
144
149
|
// Detect if menu is positioned above or below the anchor
|
|
145
150
|
// by checking if the menu is in the upper or lower half of the viewport
|
|
146
151
|
const viewportMiddle = innerHeight / 2;
|
|
@@ -154,15 +159,22 @@ let Menu = (() => {
|
|
|
154
159
|
this.classList.add('menu-positioned-below');
|
|
155
160
|
this.classList.remove('menu-positioned-above');
|
|
156
161
|
}
|
|
157
|
-
// Only set max-height if the menu would overflow
|
|
158
|
-
if (menuBottom > innerHeight) {
|
|
159
|
-
|
|
162
|
+
// Only set max-height if the menu would overflow the viewport OR is already clipped
|
|
163
|
+
if (menuBottom > innerHeight || isVerticallyClipped) {
|
|
164
|
+
let availableHeight;
|
|
165
|
+
if (isMenuInUpperHalf) {
|
|
166
|
+
// Menu is positioned below the anchor - available space is from top to bottom of viewport
|
|
167
|
+
availableHeight = innerHeight - box.top;
|
|
168
|
+
}
|
|
169
|
+
else {
|
|
170
|
+
// Menu is positioned above the anchor - available space is from top of viewport to bottom of menu
|
|
171
|
+
availableHeight = box.top + box.height;
|
|
172
|
+
}
|
|
160
173
|
this.style.maxHeight = `${Math.max(200, availableHeight - 20)}px`;
|
|
161
174
|
}
|
|
162
|
-
if
|
|
175
|
+
// Only set max-width if the menu would overflow the viewport OR is already clipped
|
|
176
|
+
if (menuRight > innerWidth || isHorizontallyClipped) {
|
|
163
177
|
const availableWidth = innerWidth - box.left;
|
|
164
|
-
// Let CSS anchor positioning handle horizontal flipping
|
|
165
|
-
// We could set max-width if needed
|
|
166
178
|
if (availableWidth < 200) {
|
|
167
179
|
this.style.maxWidth = `${Math.max(180, availableWidth - 20)}px`;
|
|
168
180
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Menu.js","sourceRoot":"","sources":["../../../../../src/md/menu/internal/Menu.ts"],"names":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ACnC,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAA;QACpD,CAAC;QAED;;WAEG;QACH,eAAe,CAAC,IAAuB;YACrC,IAAI,CAAC,cAAc,EAAE,CAAA;YACrB,IAAI,IAAI,EAAE,CAAC;gBACT,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAA;YACtB,CAAC;QACH,CAAC;QAED;;WAEG;QACO,iBAAiB,CAAC,CAAc;YACxC,MAAM,OAAO,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,CAAA;YAChC,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAA;QAChC,CAAC;QAED;;WAEG;QACO,gBAAgB;YACxB,kDAAkD;YAClD,IAAI,CAAC,WAAW,EAAE,CAAA;QACpB,CAAC;QAEQ,MAAM;YACb,MAAM,OAAO,GAAG,QAAQ,CAAC;gBACvB,gBAAgB,EAAE,IAAI;aACvB,CAAC,CAAA;YAEF,OAAO,IAAI,CAAA;mBACI,OAAO;4BACE,IAAI,CAAC,gBAAgB;;KAE5C,CAAA;QACH,CAAC;;;AAtRH;;;;;;;GAOG;AACH,oBA+QC","sourcesContent":["import { html, PropertyValues, TemplateResult } from 'lit'\nimport { property, state } from 'lit/decorators.js'\nimport { classMap } from 'lit/directives/class-map.js'\nimport { nanoid } from 'nanoid'\nimport UiList from '../../list/internals/List.js'\nimport UiMenuItem from './MenuItem.js'\nimport UiSubMenu from './SubMenu.js'\nimport { setDisabled } from '../../../lib/disabled.js'\nimport UiListItem from '../../list/internals/ListItem.js'\nimport { bound } from '../../../decorators/bound.js'\n\n/**\n * Material Design 3 Menu component with sub-menu support.\n * Uses Popover API and Anchor Positioning API for modern positioning.\n *\n * @fires select - Dispatched when a menu item is selected\n * @fires close - Dispatched when the menu is closed\n * @fires open - Dispatched when the menu is opened\n */\nexport default class Menu extends UiList {\n /**\n * Whether the menu is currently open\n * @attribute\n */\n @property({ type: Boolean, reflect: true }) accessor open = false\n\n /**\n * Whether the menu is disabled\n * @attribute\n */\n @property({ type: Boolean, reflect: true }) accessor disabled = false\n\n /**\n * Currently active sub-menu\n */\n @state() accessor activeSubMenu: UiSubMenu | null = null\n\n constructor() {\n super()\n this.selector = 'ui-menu-item'\n this.ariaExpanded = 'false'\n this.addEventListener('beforetoggle', this.handleBeforeToggle.bind(this))\n }\n\n override connectedCallback(): void {\n super.connectedCallback()\n this.setAttribute('role', 'menu')\n this.setAttribute('tabindex', '-1')\n if (!this.hasAttribute('popover')) {\n this.setAttribute('popover', 'auto')\n }\n if (!this.id) {\n this.id = nanoid()\n }\n }\n\n protected override updated(changedProperties: PropertyValues<this>): void {\n super.updated(changedProperties)\n\n if (changedProperties.has('disabled')) {\n setDisabled(this, this.disabled)\n }\n }\n\n override togglePopover(force?: boolean): boolean {\n this.open = !this.open\n this.ariaExpanded = String(this.open)\n this.tabIndex = this.open ? 0 : -1\n const result = super.togglePopover(force)\n if (this.open) {\n this.positionMenu()\n this.focus()\n }\n return result\n }\n\n protected queryMenuItems(): UiMenuItem[] {\n const slot = this.shadowRoot?.querySelector('slot')\n if (!slot) return []\n const { selector } = this\n return Array.from(slot.assignedElements({ flatten: true })).filter((el) => el.matches(selector)) as UiMenuItem[]\n }\n\n show(): void {\n this.showPopover()\n }\n\n hide(): void {\n this.hidePopover()\n }\n\n /**\n * Shows the menu\n */\n override showPopover(): void {\n this.tabIndex = 0 // Make menu focusable\n this.ariaExpanded = 'true'\n super.showPopover()\n this.open = true\n this.positionMenu()\n this.focus()\n this.dispatchEvent(new CustomEvent('open', { bubbles: false, composed: true }))\n }\n\n /**\n * Hides the menu\n */\n override hidePopover(): void {\n this.tabIndex = -1\n this.ariaExpanded = 'false'\n super.hidePopover()\n this.open = false\n this.closeSubMenu()\n this.dispatchEvent(new CustomEvent('close', { bubbles: false, composed: true }))\n }\n\n positionMenu(): void {\n // Let CSS anchor positioning handle the positioning automatically\n // Only intervene if we need to set max-height for overflow cases\n const box = this.getBoundingClientRect()\n const menuBottom = box.top + box.height\n const menuRight = box.left + box.width\n\n // Reset any previous manual positioning to let CSS anchor positioning work\n this.style.removeProperty('position-area')\n this.style.removeProperty('max-height')\n\n // Detect if menu is positioned above or below the anchor\n // by checking if the menu is in the upper or lower half of the viewport\n const viewportMiddle = innerHeight / 2\n const isMenuInUpperHalf = box.top < viewportMiddle\n\n // Add CSS class to control animation direction\n if (isMenuInUpperHalf) {\n this.classList.add('menu-positioned-above')\n this.classList.remove('menu-positioned-below')\n } else {\n this.classList.add('menu-positioned-below')\n this.classList.remove('menu-positioned-above')\n }\n\n // Only set max-height if the menu would overflow\n if (menuBottom > innerHeight) {\n const availableHeight = innerHeight - box.top\n this.style.maxHeight = `${Math.max(200, availableHeight - 20)}px`\n }\n\n if (menuRight > innerWidth) {\n const availableWidth = innerWidth - box.left\n // Let CSS anchor positioning handle horizontal flipping\n // We could set max-width if needed\n if (availableWidth < 200) {\n this.style.maxWidth = `${Math.max(180, availableWidth - 20)}px`\n }\n }\n }\n\n /**\n * Handles beforetoggle event from popover\n */\n protected handleBeforeToggle(e: Event): void {\n const toggleEvent = e as ToggleEvent\n if (toggleEvent.newState === 'closed') {\n this.open = false\n this.closeSubMenu()\n }\n }\n\n /**\n * Handles keyboard navigation for the menu\n */\n override handleKeydown(e: KeyboardEvent): void {\n if (!this.open || e.defaultPrevented) return\n\n switch (e.key) {\n case 'Escape':\n e.preventDefault()\n this.hide()\n break\n case 'ArrowRight':\n e.preventDefault()\n this.openSubMenu()\n break\n case 'ArrowLeft':\n e.preventDefault()\n this.closeSubMenu()\n break\n default:\n // Let the parent UiList handle other keys\n super.handleKeydown(e)\n }\n }\n\n @bound\n handleSubMenuSelect(e: CustomEvent): void {\n super.notifySelect(e.detail.item, e.detail.index)\n }\n\n /**\n * Opens the sub-menu for the currently active item\n */\n protected openSubMenu(): void {\n const activeItem = this.activeListItem as UiMenuItem\n if (activeItem?.hasSubMenu) {\n activeItem.openSubMenu()\n }\n }\n\n /**\n * Closes the currently open sub-menu\n */\n closeSubMenu(): void {\n if (this.activeSubMenu) {\n this.activeSubMenu.removeEventListener('select', this.handleSubMenuSelect as EventListener)\n this.activeSubMenu.hide()\n this.activeSubMenu = null\n }\n }\n\n /**\n * Sets the active sub-menu\n */\n setActiveSubMenu(subMenu: UiSubMenu | null): void {\n this.activeSubMenu = subMenu\n subMenu?.addEventListener('select', this.handleSubMenuSelect as EventListener)\n }\n\n override notifySelect(item: UiListItem & { selected?: boolean }, index?: number): boolean {\n // Handle single selection\n this.clearSelection()\n item.selected = true\n this.hide()\n return super.notifySelect(item, index)\n }\n\n /**\n * Clears selection from all menu items\n */\n protected clearSelection(): void {\n const items = this.queryMenuItems()\n items.forEach((menuItem) => {\n menuItem.selected = false\n })\n }\n\n /**\n * Gets the currently selected menu item\n */\n get selectedItem(): UiMenuItem | null {\n const items = this.queryMenuItems()\n return items.find((item) => item.selected) || null\n }\n\n /**\n * Sets the selected menu item\n */\n setSelectedItem(item: UiMenuItem | null): void {\n this.clearSelection()\n if (item) {\n item.selected = true\n }\n }\n\n /**\n * Handles sub-menu opening\n */\n protected handleSubMenuOpen(e: CustomEvent): void {\n const subMenu = e.detail.subMenu\n this.setActiveSubMenu(subMenu)\n }\n\n /**\n * Handles slot changes to update menu items\n */\n protected handleSlotChange(): void {\n // Update the items list when slot content changes\n this.updateItems()\n }\n\n override render(): TemplateResult {\n const classes = classMap({\n 'menu-container': true,\n })\n\n return html`\n <div class=${classes}>\n <slot @slotchange=${this.handleSlotChange}></slot>\n </div>\n `\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Menu.js","sourceRoot":"","sources":["../../../../../src/md/menu/internal/Menu.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAkC,MAAM,KAAK,CAAA;AAC1D,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6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ACtB,MAAM,KAAK,GAAG,IAAI,CAAC,cAAc,EAAE,CAAA;YACnC,KAAK,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;gBACzB,QAAQ,CAAC,QAAQ,GAAG,KAAK,CAAA;YAC3B,CAAC,CAAC,CAAA;QACJ,CAAC;QAED;;WAEG;QACH,IAAI,YAAY;YACd,MAAM,KAAK,GAAG,IAAI,CAAC,cAAc,EAAE,CAAA;YACnC,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAA;QACpD,CAAC;QAED;;WAEG;QACH,eAAe,CAAC,IAAuB;YACrC,IAAI,CAAC,cAAc,EAAE,CAAA;YACrB,IAAI,IAAI,EAAE,CAAC;gBACT,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAA;YACtB,CAAC;QACH,CAAC;QAED;;WAEG;QACO,iBAAiB,CAAC,CAAc;YACxC,MAAM,OAAO,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,CAAA;YAChC,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAA;QAChC,CAAC;QAED;;WAEG;QACO,gBAAgB;YACxB,kDAAkD;YAClD,IAAI,CAAC,WAAW,EAAE,CAAA;QACpB,CAAC;QAEQ,MAAM;YACb,MAAM,OAAO,GAAG,QAAQ,CAAC;gBACvB,gBAAgB,EAAE,IAAI;aACvB,CAAC,CAAA;YAEF,OAAO,IAAI,CAAA;mBACI,OAAO;4BACE,IAAI,CAAC,gBAAgB;;KAE5C,CAAA;QACH,CAAC;;;AArSH;;;;;;;GAOG;AACH,oBA8RC","sourcesContent":["import { html, PropertyValues, TemplateResult } from 'lit'\nimport { property, state } from 'lit/decorators.js'\nimport { classMap } from 'lit/directives/class-map.js'\nimport { nanoid } from 'nanoid'\nimport UiList from '../../list/internals/List.js'\nimport UiMenuItem from './MenuItem.js'\nimport UiSubMenu from './SubMenu.js'\nimport { setDisabled } from '../../../lib/disabled.js'\nimport UiListItem from '../../list/internals/ListItem.js'\nimport { bound } from '../../../decorators/bound.js'\n\n/**\n * Material Design 3 Menu component with sub-menu support.\n * Uses Popover API and Anchor Positioning API for modern positioning.\n *\n * @fires select - Dispatched when a menu item is selected\n * @fires close - Dispatched when the menu is closed\n * @fires open - Dispatched when the menu is opened\n */\nexport default class Menu extends UiList {\n /**\n * Whether the menu is currently open\n * @attribute\n */\n @property({ type: Boolean, reflect: true }) accessor open = false\n\n /**\n * Whether the menu is disabled\n * @attribute\n */\n @property({ type: Boolean, reflect: true }) accessor disabled = false\n\n /**\n * Currently active sub-menu\n */\n @state() accessor activeSubMenu: UiSubMenu | null = null\n\n constructor() {\n super()\n this.selector = 'ui-menu-item'\n this.ariaExpanded = 'false'\n this.addEventListener('beforetoggle', this.handleBeforeToggle.bind(this))\n }\n\n override connectedCallback(): void {\n super.connectedCallback()\n this.setAttribute('role', 'menu')\n this.setAttribute('tabindex', '-1')\n if (!this.hasAttribute('popover')) {\n this.setAttribute('popover', 'auto')\n }\n if (!this.id) {\n this.id = nanoid()\n }\n }\n\n protected override updated(changedProperties: PropertyValues<this>): void {\n super.updated(changedProperties)\n\n if (changedProperties.has('disabled')) {\n setDisabled(this, this.disabled)\n }\n }\n\n override togglePopover(force?: boolean): boolean {\n this.open = !this.open\n this.ariaExpanded = String(this.open)\n this.tabIndex = this.open ? 0 : -1\n const result = super.togglePopover(force)\n if (this.open) {\n this.positionMenu()\n this.focus()\n }\n return result\n }\n\n protected queryMenuItems(): UiMenuItem[] {\n const slot = this.shadowRoot?.querySelector('slot')\n if (!slot) return []\n const { selector } = this\n return Array.from(slot.assignedElements({ flatten: true })).filter((el) => el.matches(selector)) as UiMenuItem[]\n }\n\n show(): void {\n this.showPopover()\n }\n\n hide(): void {\n this.hidePopover()\n }\n\n /**\n * Shows the menu\n */\n override showPopover(): void {\n this.tabIndex = 0 // Make menu focusable\n this.ariaExpanded = 'true'\n super.showPopover()\n this.open = true\n this.positionMenu()\n this.focus()\n this.dispatchEvent(new CustomEvent('open', { bubbles: false, composed: true }))\n }\n\n /**\n * Hides the menu\n */\n override hidePopover(): void {\n this.tabIndex = -1\n this.ariaExpanded = 'false'\n super.hidePopover()\n this.open = false\n this.closeSubMenu()\n this.dispatchEvent(new CustomEvent('close', { bubbles: false, composed: true }))\n }\n\n positionMenu(): void {\n // Let CSS anchor positioning handle the positioning automatically\n // Only intervene if we need to set max-height for overflow cases\n const box = this.getBoundingClientRect()\n\n // Reset any previous manual positioning to let CSS anchor positioning work\n this.style.removeProperty('position-area')\n this.style.removeProperty('max-height')\n this.style.removeProperty('max-width')\n\n // Check if the menu content is being clipped\n const isVerticallyClipped = this.scrollHeight > this.clientHeight\n const isHorizontallyClipped = this.scrollWidth > this.clientWidth\n\n // Get the actual bottom and right edges of the menu\n const menuBottom = box.top + box.height\n const menuRight = box.left + box.width\n\n // Detect if menu is positioned above or below the anchor\n // by checking if the menu is in the upper or lower half of the viewport\n const viewportMiddle = innerHeight / 2\n const isMenuInUpperHalf = box.top < viewportMiddle\n\n // Add CSS class to control animation direction\n if (isMenuInUpperHalf) {\n this.classList.add('menu-positioned-above')\n this.classList.remove('menu-positioned-below')\n } else {\n this.classList.add('menu-positioned-below')\n this.classList.remove('menu-positioned-above')\n }\n\n // Only set max-height if the menu would overflow the viewport OR is already clipped\n if (menuBottom > innerHeight || isVerticallyClipped) {\n let availableHeight: number\n\n if (isMenuInUpperHalf) {\n // Menu is positioned below the anchor - available space is from top to bottom of viewport\n availableHeight = innerHeight - box.top\n } else {\n // Menu is positioned above the anchor - available space is from top of viewport to bottom of menu\n availableHeight = box.top + box.height\n }\n\n this.style.maxHeight = `${Math.max(200, availableHeight - 20)}px`\n }\n\n // Only set max-width if the menu would overflow the viewport OR is already clipped\n if (menuRight > innerWidth || isHorizontallyClipped) {\n const availableWidth = innerWidth - box.left\n if (availableWidth < 200) {\n this.style.maxWidth = `${Math.max(180, availableWidth - 20)}px`\n }\n }\n }\n\n /**\n * Handles beforetoggle event from popover\n */\n protected handleBeforeToggle(e: Event): void {\n const toggleEvent = e as ToggleEvent\n if (toggleEvent.newState === 'closed') {\n this.open = false\n this.closeSubMenu()\n }\n }\n\n /**\n * Handles keyboard navigation for the menu\n */\n override handleKeydown(e: KeyboardEvent): void {\n if (!this.open || e.defaultPrevented) return\n\n switch (e.key) {\n case 'Escape':\n e.preventDefault()\n this.hide()\n break\n case 'ArrowRight':\n e.preventDefault()\n this.openSubMenu()\n break\n case 'ArrowLeft':\n e.preventDefault()\n this.closeSubMenu()\n break\n default:\n // Let the parent UiList handle other keys\n super.handleKeydown(e)\n }\n }\n\n @bound\n handleSubMenuSelect(e: CustomEvent): void {\n super.notifySelect(e.detail.item, e.detail.index)\n }\n\n /**\n * Opens the sub-menu for the currently active item\n */\n protected openSubMenu(): void {\n const activeItem = this.activeListItem as UiMenuItem\n if (activeItem?.hasSubMenu) {\n activeItem.openSubMenu()\n }\n }\n\n /**\n * Closes the currently open sub-menu\n */\n closeSubMenu(): void {\n if (this.activeSubMenu) {\n this.activeSubMenu.removeEventListener('select', this.handleSubMenuSelect as EventListener)\n this.activeSubMenu.hide()\n this.activeSubMenu = null\n }\n }\n\n /**\n * Sets the active sub-menu\n */\n setActiveSubMenu(subMenu: UiSubMenu | null): void {\n this.activeSubMenu = subMenu\n subMenu?.addEventListener('select', this.handleSubMenuSelect as EventListener)\n }\n\n override notifySelect(item: UiListItem & { selected?: boolean }, index?: number): boolean {\n // Handle single selection\n this.clearSelection()\n item.selected = true\n this.hide()\n return super.notifySelect(item, index)\n }\n\n /**\n * Clears selection from all menu items\n */\n protected clearSelection(): void {\n const items = this.queryMenuItems()\n items.forEach((menuItem) => {\n menuItem.selected = false\n })\n }\n\n /**\n * Gets the currently selected menu item\n */\n get selectedItem(): UiMenuItem | null {\n const items = this.queryMenuItems()\n return items.find((item) => item.selected) || null\n }\n\n /**\n * Sets the selected menu item\n */\n setSelectedItem(item: UiMenuItem | null): void {\n this.clearSelection()\n if (item) {\n item.selected = true\n }\n }\n\n /**\n * Handles sub-menu opening\n */\n protected handleSubMenuOpen(e: CustomEvent): void {\n const subMenu = e.detail.subMenu\n this.setActiveSubMenu(subMenu)\n }\n\n /**\n * Handles slot changes to update menu items\n */\n protected handleSlotChange(): void {\n // Update the items list when slot content changes\n this.updateItems()\n }\n\n override render(): TemplateResult {\n const classes = classMap({\n 'menu-container': true,\n })\n\n return html`\n <div class=${classes}>\n <slot @slotchange=${this.handleSlotChange}></slot>\n </div>\n `\n }\n}\n"]}
|