@qualcomm-ui/core 1.0.4 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- "use strict";var u=Object.defineProperty;var S=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var F=Object.prototype.hasOwnProperty;var b=(e,t)=>{for(var i in t)u(e,i,{get:t[i],enumerable:!0})},v=(e,t,i,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of h(t))!F.call(e,r)&&r!==i&&u(e,r,{get:()=>t[r],enumerable:!(n=S(t,r))||n.enumerable});return e};var T=e=>v(u({},"__esModule",{value:!0}),e);var A={};b(A,{createDialogApi:()=>I,dialogMachine:()=>L,dialogProps:()=>k,splitDialogProps:()=>x});module.exports=T(A);var D=require("@qualcomm-ui/utils/attributes");var s={backdrop:e=>e.ids.get("backdrop"),closeTrigger:e=>e.ids.get("closeTrigger"),content:e=>e.ids.get("content"),description:e=>e.ids.get("description"),label:e=>e.ids.get("label"),positioner:e=>e.ids.get("positioner"),trigger:e=>e.ids.get("trigger")},a={backdrop:e=>e.getById(s.backdrop(e)),closeTrigger:e=>e.getById(s.closeTrigger(e)),content:e=>e.getById(s.content(e)),description:e=>e.getById(s.description(e)),label:e=>e.getById(s.label(e)),positioner:e=>e.getById(s.positioner(e)),trigger:e=>e.getById(s.trigger(e))};var l={"data-scope":"dialog"};function I(e,t){let{prop:i,scope:n,send:r,state:g}=e,m=i("aria-label"),c=g.matches("open");return{open:c,setOpen(o){g.matches("open")!==o&&r({type:o?"OPEN":"CLOSE"})},getBackdropBindings(o){return n.ids.register("backdrop",o),t.element({...l,"data-part":"backdrop","data-state":g.get(),dir:i("dir"),hidden:!c,id:o.id})},getBodyBindings(){return t.element({...l,"data-part":"body"})},getCloseTriggerBindings(o){return n.ids.register("closeTrigger",o),t.button({...l,"data-part":"close-trigger",dir:i("dir"),id:o.id,onClick(d){d.defaultPrevented||r({type:"CLOSE"})},type:"button"})},getContentBindings(o){n.ids.register("content",o);let d=s.label(n);return t.element({...l,"aria-describedby":s.description(n)||void 0,"aria-label":m||void 0,"aria-labelledby":m||!d?void 0:d,"aria-modal":i("modal"),"data-part":"content","data-state":g.get(),dir:i("dir"),hidden:!c,id:o.id,role:i("role"),tabIndex:-1})},getDescriptionBindings(o){return n.ids.register("description",o),t.element({...l,"data-part":"description",dir:i("dir"),id:o.id})},getFooterBindings(){return t.element({...l,"data-part":"footer",dir:i("dir")})},getHeadingBindings(o){return n.ids.register("label",o),t.element({...l,"data-part":"heading",dir:i("dir"),id:o.id})},getPositionerBindings(o){return n.ids.register("positioner",o),t.element({...l,"data-part":"positioner",dir:i("dir"),id:o.id,style:{pointerEvents:c?void 0:"none"}})},getTriggerBindings(o){return n.ids.register("trigger",o),t.button({...l,"aria-controls":s.content(n),"aria-expanded":(0,D.booleanAriaAttr)(c),"aria-haspopup":"dialog","data-part":"trigger","data-state":g.get(),dir:i("dir"),id:o.id,onClick(d){d.defaultPrevented||r({type:"TOGGLE"})},type:"button"})}}}var O=require("@qualcomm-ui/dom/aria-hidden"),f=require("@qualcomm-ui/dom/dismissable"),E=require("@qualcomm-ui/dom/focus-trap"),y=require("@qualcomm-ui/dom/query"),B=require("@qualcomm-ui/dom/remove-scroll"),C=require("@qualcomm-ui/utils/guard"),P=require("@qualcomm-ui/utils/machine");var L=(0,P.createMachine)({actions:{invokeOnClose:({prop:e})=>{e("onOpenChange")?.(!1)},invokeOnOpen:({prop:e})=>{e("onOpenChange")?.(!0)},syncZIndex:({scope:e})=>{(0,y.raf)(()=>{let t=a.content(e);if(!t)return;let i=getComputedStyle?.(t);[a.positioner(e),a.backdrop(e)].forEach(r=>{r?.style.setProperty("--z-index",i.zIndex)})})},toggleVisibility:({prop:e,send:t})=>{t({type:e("open")?"CONTROLLED.OPEN":"CONTROLLED.CLOSE"})}},effects:{hideContentBelow({prop:e,scope:t}){return e("modal")?(0,O.ariaHidden)(()=>[a.content(t)],{defer:!0}):void 0},preventScroll({prop:e,scope:t}){if(e("preventScroll"))return(0,B.preventBodyScroll)(t.getDoc())},trackDismissableElement({prop:e,scope:t,send:i}){return(0,f.trackDismissableElement)(()=>a.content(t),{defer:!0,exclude:()=>[a.trigger(t)],onDismiss(){i({src:"interact-outside",type:"CLOSE"})},onEscapeKeyDown(r){e("onEscapeKeyDown")?.(r),e("closeOnEscape")||r.preventDefault()},onFocusOutside:e("onFocusOutside"),onInteractOutside(r){e("onInteractOutside")?.(r),e("closeOnInteractOutside")||r.preventDefault()},onPointerDownOutside:e("onPointerDownOutside"),onRequestDismiss:e("onRequestDismiss"),persistentElements:e("persistentElements"),pointerBlocking:e("modal")})},trapFocus:({prop:e,scope:t})=>!e("trapFocus")||!e("modal")?void 0:(0,E.trapFocus)(()=>a.content(t),{initialFocus:e("initialFocusEl"),preventScroll:!0,returnFocusOnDeactivate:e("restoreFocus"),setReturnFocus:n=>e("finalFocusEl")?.()??n})},guards:{isOpenControlled:({prop:e})=>(0,C.isDefined)(e("open"))},ids:({bindableId:e})=>({backdrop:e(),closeTrigger:e(),content:e(),description:e(),label:e(),positioner:e(),trigger:e()}),initialState({prop:e}){return e("open")||e("defaultOpen")?"open":"closed"},props:({props:e,scope:t})=>{let i=e.role==="alertdialog";return{closeOnEscape:!0,closeOnInteractOutside:!i,dir:"ltr",initialFocusEl:i?()=>a.closeTrigger(t):void 0,modal:!0,preventScroll:!0,restoreFocus:!0,role:"dialog",trapFocus:!0,...e}},states:{closed:{on:{"CONTROLLED.OPEN":{target:"open"},OPEN:[{actions:["invokeOnOpen"],guard:"isOpenControlled"},{actions:["invokeOnOpen"],target:"open"}],TOGGLE:[{actions:["invokeOnOpen"],guard:"isOpenControlled"},{actions:["invokeOnOpen"],target:"open"}]}},open:{effects:["trackDismissableElement","trapFocus","preventScroll","hideContentBelow"],entry:["syncZIndex"],on:{CLOSE:[{actions:["invokeOnClose"],guard:"isOpenControlled"},{actions:["invokeOnClose"],target:"closed"}],"CONTROLLED.CLOSE":{target:"closed"},TOGGLE:[{actions:["invokeOnClose"],guard:"isOpenControlled"},{actions:["invokeOnClose"],target:"closed"}]}}},watch({actions:e,prop:t,track:i}){i([()=>t("open")],()=>{e.toggleVisibility()})}});var p=require("@qualcomm-ui/utils/object"),k=(0,p.createProps)()("aria-label","closeOnEscape","closeOnInteractOutside","defaultOpen","dir","finalFocusEl","getRootNode","initialFocusEl","modal","onEscapeKeyDown","onFocusOutside","onInteractOutside","onOpenChange","onPointerDownOutside","onRequestDismiss","open","persistentElements","preventScroll","restoreFocus","role","trapFocus"),x=(0,p.createSplitProps)(k);
1
+ "use strict";var m=Object.defineProperty;var S=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var F=Object.prototype.hasOwnProperty;var b=(e,t)=>{for(var i in t)m(e,i,{get:t[i],enumerable:!0})},v=(e,t,i,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of h(t))!F.call(e,r)&&r!==i&&m(e,r,{get:()=>t[r],enumerable:!(n=S(t,r))||n.enumerable});return e};var T=e=>v(m({},"__esModule",{value:!0}),e);var A={};b(A,{createDialogApi:()=>I,dialogMachine:()=>L,dialogProps:()=>k,splitDialogProps:()=>x});module.exports=T(A);var p=require("@qualcomm-ui/utils/attributes");var s={backdrop:e=>e.ids.get("backdrop"),closeTrigger:e=>e.ids.get("closeTrigger"),content:e=>e.ids.get("content"),description:e=>e.ids.get("description"),label:e=>e.ids.get("label"),positioner:e=>e.ids.get("positioner"),trigger:e=>e.ids.get("trigger")},a={backdrop:e=>e.getById(s.backdrop(e)),closeTrigger:e=>e.getById(s.closeTrigger(e)),content:e=>e.getById(s.content(e)),description:e=>e.getById(s.description(e)),label:e=>e.getById(s.label(e)),positioner:e=>e.getById(s.positioner(e)),trigger:e=>e.getById(s.trigger(e))};var l={"data-scope":"dialog"};function I(e,t){let{prop:i,scope:n,send:r,state:g}=e,D=i("aria-label"),c=g.matches("open");return{open:c,setOpen(o){g.matches("open")!==o&&r({type:o?"OPEN":"CLOSE"})},getBackdropBindings(o){return n.ids.register("backdrop",o),t.element({...l,"data-part":"backdrop","data-state":g.get(),dir:i("dir"),hidden:!c,id:o.id})},getBodyBindings(){return t.element({...l,"data-part":"body"})},getCloseTriggerBindings(o){return n.ids.register("closeTrigger",o),t.button({...l,"data-part":"close-trigger",dir:i("dir"),id:o.id,onClick(d){d.defaultPrevented||r({type:"CLOSE"})},type:"button"})},getContentBindings(o){n.ids.register("content",o);let d=s.label(n);return t.element({...l,"aria-describedby":(0,p.ariaAttr)(s.description(n)),"aria-label":D||void 0,"aria-labelledby":D||!d?void 0:d,"aria-modal":i("modal"),"data-part":"content","data-state":g.get(),dir:i("dir"),hidden:!c,id:o.id,role:i("role"),tabIndex:-1})},getDescriptionBindings(o){return n.ids.register("description",o),t.element({...l,"data-part":"description",dir:i("dir"),id:o.id})},getFooterBindings(){return t.element({...l,"data-part":"footer",dir:i("dir")})},getHeadingBindings(o){return n.ids.register("label",o),t.element({...l,"data-part":"heading",dir:i("dir"),id:o.id})},getPositionerBindings(o){return n.ids.register("positioner",o),t.element({...l,"data-part":"positioner",dir:i("dir"),id:o.id,style:{pointerEvents:c?void 0:"none"}})},getTriggerBindings(o){return n.ids.register("trigger",o),t.button({...l,"aria-controls":s.content(n),"aria-expanded":(0,p.booleanAriaAttr)(c),"aria-haspopup":"dialog","data-part":"trigger","data-state":g.get(),dir:i("dir"),id:o.id,onClick(d){d.defaultPrevented||r({type:"TOGGLE"})},type:"button"})}}}var O=require("@qualcomm-ui/dom/aria-hidden"),f=require("@qualcomm-ui/dom/dismissable"),E=require("@qualcomm-ui/dom/focus-trap"),y=require("@qualcomm-ui/dom/query"),B=require("@qualcomm-ui/dom/remove-scroll"),C=require("@qualcomm-ui/utils/guard"),P=require("@qualcomm-ui/utils/machine");var L=(0,P.createMachine)({actions:{invokeOnClose:({prop:e})=>{e("onOpenChange")?.(!1)},invokeOnOpen:({prop:e})=>{e("onOpenChange")?.(!0)},syncZIndex:({scope:e})=>{(0,y.raf)(()=>{let t=a.content(e);if(!t)return;let i=getComputedStyle?.(t);[a.positioner(e),a.backdrop(e)].forEach(r=>{r?.style.setProperty("--z-index",i.zIndex)})})},toggleVisibility:({prop:e,send:t})=>{t({type:e("open")?"CONTROLLED.OPEN":"CONTROLLED.CLOSE"})}},effects:{hideContentBelow({prop:e,scope:t}){return e("modal")?(0,O.ariaHidden)(()=>[a.content(t)],{defer:!0}):void 0},preventScroll({prop:e,scope:t}){if(e("preventScroll"))return(0,B.preventBodyScroll)(t.getDoc())},trackDismissableElement({prop:e,scope:t,send:i}){return(0,f.trackDismissableElement)(()=>a.content(t),{defer:!0,exclude:()=>[a.trigger(t)],onDismiss(){i({src:"interact-outside",type:"CLOSE"})},onEscapeKeyDown(r){e("onEscapeKeyDown")?.(r),e("closeOnEscape")||r.preventDefault()},onFocusOutside:e("onFocusOutside"),onInteractOutside(r){e("onInteractOutside")?.(r),e("closeOnInteractOutside")||r.preventDefault()},onPointerDownOutside:e("onPointerDownOutside"),onRequestDismiss:e("onRequestDismiss"),persistentElements:e("persistentElements"),pointerBlocking:e("modal")})},trapFocus:({prop:e,scope:t})=>!e("trapFocus")||!e("modal")?void 0:(0,E.trapFocus)(()=>a.content(t),{initialFocus:e("initialFocusEl"),preventScroll:!0,returnFocusOnDeactivate:e("restoreFocus"),setReturnFocus:n=>e("finalFocusEl")?.()??n})},guards:{isOpenControlled:({prop:e})=>(0,C.isDefined)(e("open"))},ids:({bindableId:e})=>({backdrop:e(),closeTrigger:e(),content:e(),description:e(),label:e(),positioner:e(),trigger:e()}),initialState({prop:e}){return e("open")||e("defaultOpen")?"open":"closed"},props:({props:e,scope:t})=>{let i=e.role==="alertdialog";return{closeOnEscape:!0,closeOnInteractOutside:!i,dir:"ltr",initialFocusEl:i?()=>a.closeTrigger(t):void 0,modal:!0,preventScroll:!0,restoreFocus:!0,role:"dialog",trapFocus:!0,...e}},states:{closed:{on:{"CONTROLLED.OPEN":{target:"open"},OPEN:[{actions:["invokeOnOpen"],guard:"isOpenControlled"},{actions:["invokeOnOpen"],target:"open"}],TOGGLE:[{actions:["invokeOnOpen"],guard:"isOpenControlled"},{actions:["invokeOnOpen"],target:"open"}]}},open:{effects:["trackDismissableElement","trapFocus","preventScroll","hideContentBelow"],entry:["syncZIndex"],on:{CLOSE:[{actions:["invokeOnClose"],guard:"isOpenControlled"},{actions:["invokeOnClose"],target:"closed"}],"CONTROLLED.CLOSE":{target:"closed"},TOGGLE:[{actions:["invokeOnClose"],guard:"isOpenControlled"},{actions:["invokeOnClose"],target:"closed"}]}}},watch({actions:e,prop:t,track:i}){i([()=>t("open")],()=>{e.toggleVisibility()})}});var u=require("@qualcomm-ui/utils/object"),k=(0,u.createProps)()("aria-label","closeOnEscape","closeOnInteractOutside","defaultOpen","dir","finalFocusEl","getRootNode","initialFocusEl","modal","onEscapeKeyDown","onFocusOutside","onInteractOutside","onOpenChange","onPointerDownOutside","onRequestDismiss","open","persistentElements","preventScroll","restoreFocus","role","trapFocus"),x=(0,u.createSplitProps)(k);
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/dialog/index.ts", "../../src/dialog/dialog.api.ts", "../../src/dialog/internal/dialog.dom.ts", "../../src/dialog/dialog.machine.ts", "../../src/dialog/dialog.props.ts"],
4
- "sourcesContent": ["export * from \"./dialog.api\"\nexport * from \"./dialog.machine\"\nexport * from \"./dialog.props\"\nexport type * from \"./dialog.types\"\n", "// Modified from https://github.com/chakra-ui/zag\n// MIT License\n// Changes from Qualcomm Technologies, Inc. are provided under the following license:\n// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport {booleanAriaAttr} from \"@qualcomm-ui/utils/attributes\"\nimport type {Machine, PropNormalizer} from \"@qualcomm-ui/utils/machine\"\n\nimport type {\n DialogApi,\n DialogBackdropBindings,\n DialogBodyBindings,\n DialogCloseTriggerBindings,\n DialogContentBindings,\n DialogDescriptionBindings,\n DialogFooterBindings,\n DialogHeadingBindings,\n DialogPositionerBindings,\n DialogSchema,\n DialogTriggerBindings,\n} from \"./dialog.types\"\nimport {domIds} from \"./internal\"\n\nconst commonBindings: {\"data-scope\": \"dialog\"} = {\n \"data-scope\": \"dialog\",\n}\n\nexport function createDialogApi(\n machine: Machine<DialogSchema>,\n normalize: PropNormalizer,\n): DialogApi {\n const {prop, scope, send, state} = machine\n\n const ariaLabel = prop(\"aria-label\")\n const open = state.matches(\"open\")\n\n return {\n open,\n setOpen(nextOpen) {\n const open = state.matches(\"open\")\n if (open === nextOpen) {\n return\n }\n send({type: nextOpen ? \"OPEN\" : \"CLOSE\"})\n },\n\n // group: bindings\n getBackdropBindings(props): DialogBackdropBindings {\n scope.ids.register(\"backdrop\", props)\n return normalize.element({\n ...commonBindings,\n \"data-part\": \"backdrop\",\n \"data-state\": state.get(),\n dir: prop(\"dir\"),\n hidden: !open,\n id: props.id,\n })\n },\n getBodyBindings(): DialogBodyBindings {\n return normalize.element({\n ...commonBindings,\n \"data-part\": \"body\",\n })\n },\n getCloseTriggerBindings(props): DialogCloseTriggerBindings {\n scope.ids.register(\"closeTrigger\", props)\n return normalize.button({\n ...commonBindings,\n \"data-part\": \"close-trigger\",\n dir: prop(\"dir\"),\n id: props.id,\n onClick(event) {\n if (event.defaultPrevented) {\n return\n }\n send({type: \"CLOSE\"})\n },\n type: \"button\",\n })\n },\n getContentBindings(props): DialogContentBindings {\n scope.ids.register(\"content\", props)\n const labelId = domIds.label(scope)\n return normalize.element({\n ...commonBindings,\n \"aria-describedby\": domIds.description(scope) || undefined,\n \"aria-label\": ariaLabel || undefined,\n \"aria-labelledby\": ariaLabel || !labelId ? undefined : labelId,\n \"aria-modal\": prop(\"modal\"),\n \"data-part\": \"content\",\n \"data-state\": state.get(),\n dir: prop(\"dir\"),\n hidden: !open,\n id: props.id,\n role: prop(\"role\"),\n tabIndex: -1,\n })\n },\n getDescriptionBindings(props): DialogDescriptionBindings {\n scope.ids.register(\"description\", props)\n return normalize.element({\n ...commonBindings,\n \"data-part\": \"description\",\n dir: prop(\"dir\"),\n id: props.id,\n })\n },\n getFooterBindings(): DialogFooterBindings {\n return normalize.element({\n ...commonBindings,\n \"data-part\": \"footer\",\n dir: prop(\"dir\"),\n })\n },\n getHeadingBindings(props): DialogHeadingBindings {\n scope.ids.register(\"label\", props)\n return normalize.element({\n ...commonBindings,\n \"data-part\": \"heading\",\n dir: prop(\"dir\"),\n id: props.id,\n })\n },\n getPositionerBindings(props): DialogPositionerBindings {\n scope.ids.register(\"positioner\", props)\n return normalize.element({\n ...commonBindings,\n \"data-part\": \"positioner\",\n dir: prop(\"dir\"),\n id: props.id,\n style: {\n pointerEvents: open ? undefined : \"none\",\n },\n })\n },\n getTriggerBindings(props): DialogTriggerBindings {\n scope.ids.register(\"trigger\", props)\n return normalize.button({\n ...commonBindings,\n \"aria-controls\": domIds.content(scope),\n \"aria-expanded\": booleanAriaAttr(open),\n \"aria-haspopup\": \"dialog\",\n \"data-part\": \"trigger\",\n \"data-state\": state.get(),\n dir: prop(\"dir\"),\n id: props.id,\n onClick(event) {\n if (event.defaultPrevented) {\n return\n }\n send({type: \"TOGGLE\"})\n },\n type: \"button\",\n })\n },\n }\n}\n", "// Modified from https://github.com/chakra-ui/zag\n// MIT License\n// Changes from Qualcomm Technologies, Inc. are provided under the following license:\n// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport type {ScopeDomElements, ScopeDomIds} from \"@qualcomm-ui/utils/machine\"\n\nimport type {DialogElementIds, DialogScope} from \"../dialog.types\"\n\nexport const domIds: ScopeDomIds<DialogElementIds, DialogScope> = {\n backdrop: (scope) => scope.ids.get(\"backdrop\"),\n closeTrigger: (scope) => scope.ids.get(\"closeTrigger\"),\n content: (scope) => scope.ids.get(\"content\"),\n description: (scope) => scope.ids.get(\"description\"),\n label: (scope) => scope.ids.get(\"label\"),\n positioner: (scope) => scope.ids.get(\"positioner\"),\n trigger: (scope) => scope.ids.get(\"trigger\"),\n}\n\nexport const domEls: ScopeDomElements<DialogElementIds, DialogScope> = {\n backdrop: (scope) => scope.getById(domIds.backdrop(scope)),\n closeTrigger: (scope) => scope.getById(domIds.closeTrigger(scope)),\n content: (scope) => scope.getById(domIds.content(scope)),\n description: (scope) => scope.getById(domIds.description(scope)),\n label: (scope) => scope.getById(domIds.label(scope)),\n positioner: (scope) => scope.getById(domIds.positioner(scope)),\n trigger: (scope) => scope.getById(domIds.trigger(scope)),\n}\n", "// Modified from https://github.com/chakra-ui/zag\n// MIT License\n// Changes from Qualcomm Technologies, Inc. are provided under the following license:\n// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport {ariaHidden} from \"@qualcomm-ui/dom/aria-hidden\"\nimport {trackDismissableElement} from \"@qualcomm-ui/dom/dismissable\"\nimport {trapFocus} from \"@qualcomm-ui/dom/focus-trap\"\nimport {raf} from \"@qualcomm-ui/dom/query\"\nimport {preventBodyScroll} from \"@qualcomm-ui/dom/remove-scroll\"\nimport {isDefined} from \"@qualcomm-ui/utils/guard\"\nimport {createMachine, type MachineConfig} from \"@qualcomm-ui/utils/machine\"\n\nimport type {DialogApiProps, DialogSchema} from \"./dialog.types\"\nimport {domEls} from \"./internal\"\n\nexport const dialogMachine: MachineConfig<DialogSchema> =\n createMachine<DialogSchema>({\n actions: {\n invokeOnClose: ({prop}) => {\n prop(\"onOpenChange\")?.(false)\n },\n invokeOnOpen: ({prop}) => {\n prop(\"onOpenChange\")?.(true)\n },\n syncZIndex: ({scope}) => {\n raf(() => {\n const contentEl = domEls.content(scope)\n if (!contentEl) {\n return\n }\n\n const styles = getComputedStyle?.(contentEl)\n const elems = [domEls.positioner(scope), domEls.backdrop(scope)]\n elems.forEach((node) => {\n node?.style.setProperty(\"--z-index\", styles.zIndex)\n })\n })\n },\n toggleVisibility: ({prop, send}) => {\n send({type: prop(\"open\") ? \"CONTROLLED.OPEN\" : \"CONTROLLED.CLOSE\"})\n },\n },\n\n effects: {\n hideContentBelow({prop, scope}) {\n if (!prop(\"modal\")) {\n return\n }\n const getElements = () => [domEls.content(scope)]\n return ariaHidden(getElements, {defer: true})\n },\n\n preventScroll({prop, scope}) {\n if (!prop(\"preventScroll\")) {\n return\n }\n return preventBodyScroll(scope.getDoc())\n },\n\n trackDismissableElement({prop, scope, send}) {\n const getContentEl = () => domEls.content(scope)\n return trackDismissableElement(getContentEl, {\n defer: true,\n exclude: () => [domEls.trigger(scope)],\n onDismiss() {\n send({src: \"interact-outside\", type: \"CLOSE\"})\n },\n onEscapeKeyDown(event) {\n prop(\"onEscapeKeyDown\")?.(event)\n if (!prop(\"closeOnEscape\")) {\n event.preventDefault()\n }\n },\n onFocusOutside: prop(\"onFocusOutside\"),\n onInteractOutside(event) {\n prop(\"onInteractOutside\")?.(event)\n if (!prop(\"closeOnInteractOutside\")) {\n event.preventDefault()\n }\n },\n onPointerDownOutside: prop(\"onPointerDownOutside\"),\n onRequestDismiss: prop(\"onRequestDismiss\"),\n persistentElements: prop(\"persistentElements\"),\n pointerBlocking: prop(\"modal\"),\n })\n },\n\n trapFocus: ({prop, scope}) => {\n if (!prop(\"trapFocus\") || !prop(\"modal\")) {\n return\n }\n const contentEl = () => domEls.content(scope)\n return trapFocus(contentEl, {\n initialFocus: prop(\"initialFocusEl\"),\n preventScroll: true,\n returnFocusOnDeactivate: prop(\"restoreFocus\"),\n setReturnFocus: (el) => prop(\"finalFocusEl\")?.() ?? el,\n })\n },\n },\n\n guards: {\n isOpenControlled: ({prop}) => isDefined(prop(\"open\")),\n },\n\n ids: ({bindableId}) => ({\n backdrop: bindableId<string>(),\n closeTrigger: bindableId<string>(),\n content: bindableId<string>(),\n description: bindableId<string>(),\n label: bindableId<string>(),\n positioner: bindableId<string>(),\n trigger: bindableId<string>(),\n }),\n\n initialState({prop}) {\n const open = prop(\"open\") || prop(\"defaultOpen\")\n return open ? \"open\" : \"closed\"\n },\n\n props: ({props, scope}) => {\n const alertDialog = props.role === \"alertdialog\"\n const initialFocusEl: DialogApiProps[\"initialFocusEl\"] = alertDialog\n ? () => domEls.closeTrigger(scope)\n : undefined\n return {\n closeOnEscape: true,\n closeOnInteractOutside: !alertDialog,\n dir: \"ltr\",\n initialFocusEl: initialFocusEl!,\n modal: true,\n preventScroll: true,\n restoreFocus: true,\n role: \"dialog\",\n trapFocus: true,\n ...props,\n }\n },\n\n states: {\n closed: {\n on: {\n \"CONTROLLED.OPEN\": {\n target: \"open\",\n },\n OPEN: [\n {\n actions: [\"invokeOnOpen\"],\n guard: \"isOpenControlled\",\n },\n {\n actions: [\"invokeOnOpen\"],\n target: \"open\",\n },\n ],\n TOGGLE: [\n {\n actions: [\"invokeOnOpen\"],\n guard: \"isOpenControlled\",\n },\n {\n actions: [\"invokeOnOpen\"],\n target: \"open\",\n },\n ],\n },\n },\n open: {\n effects: [\n \"trackDismissableElement\",\n \"trapFocus\",\n \"preventScroll\",\n \"hideContentBelow\",\n ],\n entry: [\"syncZIndex\"],\n on: {\n CLOSE: [\n {\n actions: [\"invokeOnClose\"],\n guard: \"isOpenControlled\",\n },\n {\n actions: [\"invokeOnClose\"],\n target: \"closed\",\n },\n ],\n \"CONTROLLED.CLOSE\": {\n target: \"closed\",\n },\n TOGGLE: [\n {\n actions: [\"invokeOnClose\"],\n guard: \"isOpenControlled\",\n },\n {\n actions: [\"invokeOnClose\"],\n target: \"closed\",\n },\n ],\n },\n },\n },\n\n watch({actions, prop, track}) {\n track([() => prop(\"open\")], () => {\n actions.toggleVisibility()\n })\n },\n })\n", "// Modified from https://github.com/chakra-ui/zag\n// MIT License\n// Changes from Qualcomm Technologies, Inc. are provided under the following license:\n// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport {createProps, createSplitProps} from \"@qualcomm-ui/utils/object\"\n\nimport type {DialogApiProps} from \"./dialog.types\"\n\nexport const dialogProps: (keyof DialogApiProps)[] =\n createProps<DialogApiProps>()(\n \"aria-label\",\n \"closeOnEscape\",\n \"closeOnInteractOutside\",\n \"defaultOpen\",\n \"dir\",\n \"finalFocusEl\",\n \"getRootNode\",\n \"initialFocusEl\",\n \"modal\",\n \"onEscapeKeyDown\",\n \"onFocusOutside\",\n \"onInteractOutside\",\n \"onOpenChange\",\n \"onPointerDownOutside\",\n \"onRequestDismiss\",\n \"open\",\n \"persistentElements\",\n \"preventScroll\",\n \"restoreFocus\",\n \"role\",\n \"trapFocus\",\n )\n\nexport const splitDialogProps: <Props extends DialogApiProps>(\n props: Props,\n) => [DialogApiProps, Omit<Props, keyof DialogApiProps>] =\n createSplitProps<DialogApiProps>(dialogProps)\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,qBAAAE,EAAA,kBAAAC,EAAA,gBAAAC,EAAA,qBAAAC,IAAA,eAAAC,EAAAN,GCMA,IAAAO,EAA8B,yCCIvB,IAAMC,EAAqD,CAChE,SAAWC,GAAUA,EAAM,IAAI,IAAI,UAAU,EAC7C,aAAeA,GAAUA,EAAM,IAAI,IAAI,cAAc,EACrD,QAAUA,GAAUA,EAAM,IAAI,IAAI,SAAS,EAC3C,YAAcA,GAAUA,EAAM,IAAI,IAAI,aAAa,EACnD,MAAQA,GAAUA,EAAM,IAAI,IAAI,OAAO,EACvC,WAAaA,GAAUA,EAAM,IAAI,IAAI,YAAY,EACjD,QAAUA,GAAUA,EAAM,IAAI,IAAI,SAAS,CAC7C,EAEaC,EAA0D,CACrE,SAAWD,GAAUA,EAAM,QAAQD,EAAO,SAASC,CAAK,CAAC,EACzD,aAAeA,GAAUA,EAAM,QAAQD,EAAO,aAAaC,CAAK,CAAC,EACjE,QAAUA,GAAUA,EAAM,QAAQD,EAAO,QAAQC,CAAK,CAAC,EACvD,YAAcA,GAAUA,EAAM,QAAQD,EAAO,YAAYC,CAA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iCD,CAAW",
4
+ "sourcesContent": ["export * from \"./dialog.api\"\nexport * from \"./dialog.machine\"\nexport * from \"./dialog.props\"\nexport type * from \"./dialog.types\"\n", "// Modified from https://github.com/chakra-ui/zag\n// MIT License\n// Changes from Qualcomm Technologies, Inc. are provided under the following license:\n// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport {ariaAttr, booleanAriaAttr} from \"@qualcomm-ui/utils/attributes\"\nimport type {Machine, PropNormalizer} from \"@qualcomm-ui/utils/machine\"\n\nimport type {\n DialogApi,\n DialogBackdropBindings,\n DialogBodyBindings,\n DialogCloseTriggerBindings,\n DialogContentBindings,\n DialogDescriptionBindings,\n DialogFooterBindings,\n DialogHeadingBindings,\n DialogPositionerBindings,\n DialogSchema,\n DialogTriggerBindings,\n} from \"./dialog.types\"\nimport {domIds} from \"./internal\"\n\nconst commonBindings: {\"data-scope\": \"dialog\"} = {\n \"data-scope\": \"dialog\",\n}\n\nexport function createDialogApi(\n machine: Machine<DialogSchema>,\n normalize: PropNormalizer,\n): DialogApi {\n const {prop, scope, send, state} = machine\n\n const ariaLabel = prop(\"aria-label\")\n const open = state.matches(\"open\")\n\n return {\n open,\n setOpen(nextOpen) {\n const open = state.matches(\"open\")\n if (open === nextOpen) {\n return\n }\n send({type: nextOpen ? \"OPEN\" : \"CLOSE\"})\n },\n\n // group: bindings\n getBackdropBindings(props): DialogBackdropBindings {\n scope.ids.register(\"backdrop\", props)\n return normalize.element({\n ...commonBindings,\n \"data-part\": \"backdrop\",\n \"data-state\": state.get(),\n dir: prop(\"dir\"),\n hidden: !open,\n id: props.id,\n })\n },\n getBodyBindings(): DialogBodyBindings {\n return normalize.element({\n ...commonBindings,\n \"data-part\": \"body\",\n })\n },\n getCloseTriggerBindings(props): DialogCloseTriggerBindings {\n scope.ids.register(\"closeTrigger\", props)\n return normalize.button({\n ...commonBindings,\n \"data-part\": \"close-trigger\",\n dir: prop(\"dir\"),\n id: props.id,\n onClick(event) {\n if (event.defaultPrevented) {\n return\n }\n send({type: \"CLOSE\"})\n },\n type: \"button\",\n })\n },\n getContentBindings(props): DialogContentBindings {\n scope.ids.register(\"content\", props)\n const labelId = domIds.label(scope)\n return normalize.element({\n ...commonBindings,\n \"aria-describedby\": ariaAttr(domIds.description(scope)),\n \"aria-label\": ariaLabel || undefined,\n \"aria-labelledby\": ariaLabel || !labelId ? undefined : labelId,\n \"aria-modal\": prop(\"modal\"),\n \"data-part\": \"content\",\n \"data-state\": state.get(),\n dir: prop(\"dir\"),\n hidden: !open,\n id: props.id,\n role: prop(\"role\"),\n tabIndex: -1,\n })\n },\n getDescriptionBindings(props): DialogDescriptionBindings {\n scope.ids.register(\"description\", props)\n return normalize.element({\n ...commonBindings,\n \"data-part\": \"description\",\n dir: prop(\"dir\"),\n id: props.id,\n })\n },\n getFooterBindings(): DialogFooterBindings {\n return normalize.element({\n ...commonBindings,\n \"data-part\": \"footer\",\n dir: prop(\"dir\"),\n })\n },\n getHeadingBindings(props): DialogHeadingBindings {\n scope.ids.register(\"label\", props)\n return normalize.element({\n ...commonBindings,\n \"data-part\": \"heading\",\n dir: prop(\"dir\"),\n id: props.id,\n })\n },\n getPositionerBindings(props): DialogPositionerBindings {\n scope.ids.register(\"positioner\", props)\n return normalize.element({\n ...commonBindings,\n \"data-part\": \"positioner\",\n dir: prop(\"dir\"),\n id: props.id,\n style: {\n pointerEvents: open ? undefined : \"none\",\n },\n })\n },\n getTriggerBindings(props): DialogTriggerBindings {\n scope.ids.register(\"trigger\", props)\n return normalize.button({\n ...commonBindings,\n \"aria-controls\": domIds.content(scope),\n \"aria-expanded\": booleanAriaAttr(open),\n \"aria-haspopup\": \"dialog\",\n \"data-part\": \"trigger\",\n \"data-state\": state.get(),\n dir: prop(\"dir\"),\n id: props.id,\n onClick(event) {\n if (event.defaultPrevented) {\n return\n }\n send({type: \"TOGGLE\"})\n },\n type: \"button\",\n })\n },\n }\n}\n", "// Modified from https://github.com/chakra-ui/zag\n// MIT License\n// Changes from Qualcomm Technologies, Inc. are provided under the following license:\n// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport type {ScopeDomElements, ScopeDomIds} from \"@qualcomm-ui/utils/machine\"\n\nimport type {DialogElementIds, DialogScope} from \"../dialog.types\"\n\nexport const domIds: ScopeDomIds<DialogElementIds, DialogScope> = {\n backdrop: (scope) => scope.ids.get(\"backdrop\"),\n closeTrigger: (scope) => scope.ids.get(\"closeTrigger\"),\n content: (scope) => scope.ids.get(\"content\"),\n description: (scope) => scope.ids.get(\"description\"),\n label: (scope) => scope.ids.get(\"label\"),\n positioner: (scope) => scope.ids.get(\"positioner\"),\n trigger: (scope) => scope.ids.get(\"trigger\"),\n}\n\nexport const domEls: ScopeDomElements<DialogElementIds, DialogScope> = {\n backdrop: (scope) => scope.getById(domIds.backdrop(scope)),\n closeTrigger: (scope) => scope.getById(domIds.closeTrigger(scope)),\n content: (scope) => scope.getById(domIds.content(scope)),\n description: (scope) => scope.getById(domIds.description(scope)),\n label: (scope) => scope.getById(domIds.label(scope)),\n positioner: (scope) => scope.getById(domIds.positioner(scope)),\n trigger: (scope) => scope.getById(domIds.trigger(scope)),\n}\n", "// Modified from https://github.com/chakra-ui/zag\n// MIT License\n// Changes from Qualcomm Technologies, Inc. are provided under the following license:\n// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport {ariaHidden} from \"@qualcomm-ui/dom/aria-hidden\"\nimport {trackDismissableElement} from \"@qualcomm-ui/dom/dismissable\"\nimport {trapFocus} from \"@qualcomm-ui/dom/focus-trap\"\nimport {raf} from \"@qualcomm-ui/dom/query\"\nimport {preventBodyScroll} from \"@qualcomm-ui/dom/remove-scroll\"\nimport {isDefined} from \"@qualcomm-ui/utils/guard\"\nimport {createMachine, type MachineConfig} from \"@qualcomm-ui/utils/machine\"\n\nimport type {DialogApiProps, DialogSchema} from \"./dialog.types\"\nimport {domEls} from \"./internal\"\n\nexport const dialogMachine: MachineConfig<DialogSchema> =\n createMachine<DialogSchema>({\n actions: {\n invokeOnClose: ({prop}) => {\n prop(\"onOpenChange\")?.(false)\n },\n invokeOnOpen: ({prop}) => {\n prop(\"onOpenChange\")?.(true)\n },\n syncZIndex: ({scope}) => {\n raf(() => {\n const contentEl = domEls.content(scope)\n if (!contentEl) {\n return\n }\n\n const styles = getComputedStyle?.(contentEl)\n const elems = [domEls.positioner(scope), domEls.backdrop(scope)]\n elems.forEach((node) => {\n node?.style.setProperty(\"--z-index\", styles.zIndex)\n })\n })\n },\n toggleVisibility: ({prop, send}) => {\n send({type: prop(\"open\") ? \"CONTROLLED.OPEN\" : \"CONTROLLED.CLOSE\"})\n },\n },\n\n effects: {\n hideContentBelow({prop, scope}) {\n if (!prop(\"modal\")) {\n return\n }\n const getElements = () => [domEls.content(scope)]\n return ariaHidden(getElements, {defer: true})\n },\n\n preventScroll({prop, scope}) {\n if (!prop(\"preventScroll\")) {\n return\n }\n return preventBodyScroll(scope.getDoc())\n },\n\n trackDismissableElement({prop, scope, send}) {\n const getContentEl = () => domEls.content(scope)\n return trackDismissableElement(getContentEl, {\n defer: true,\n exclude: () => [domEls.trigger(scope)],\n onDismiss() {\n send({src: \"interact-outside\", type: \"CLOSE\"})\n },\n onEscapeKeyDown(event) {\n prop(\"onEscapeKeyDown\")?.(event)\n if (!prop(\"closeOnEscape\")) {\n event.preventDefault()\n }\n },\n onFocusOutside: prop(\"onFocusOutside\"),\n onInteractOutside(event) {\n prop(\"onInteractOutside\")?.(event)\n if (!prop(\"closeOnInteractOutside\")) {\n event.preventDefault()\n }\n },\n onPointerDownOutside: prop(\"onPointerDownOutside\"),\n onRequestDismiss: prop(\"onRequestDismiss\"),\n persistentElements: prop(\"persistentElements\"),\n pointerBlocking: prop(\"modal\"),\n })\n },\n\n trapFocus: ({prop, scope}) => {\n if (!prop(\"trapFocus\") || !prop(\"modal\")) {\n return\n }\n const contentEl = () => domEls.content(scope)\n return trapFocus(contentEl, {\n initialFocus: prop(\"initialFocusEl\"),\n preventScroll: true,\n returnFocusOnDeactivate: prop(\"restoreFocus\"),\n setReturnFocus: (el) => prop(\"finalFocusEl\")?.() ?? el,\n })\n },\n },\n\n guards: {\n isOpenControlled: ({prop}) => isDefined(prop(\"open\")),\n },\n\n ids: ({bindableId}) => ({\n backdrop: bindableId<string>(),\n closeTrigger: bindableId<string>(),\n content: bindableId<string>(),\n description: bindableId<string>(),\n label: bindableId<string>(),\n positioner: bindableId<string>(),\n trigger: bindableId<string>(),\n }),\n\n initialState({prop}) {\n const open = prop(\"open\") || prop(\"defaultOpen\")\n return open ? \"open\" : \"closed\"\n },\n\n props: ({props, scope}) => {\n const alertDialog = props.role === \"alertdialog\"\n const initialFocusEl: DialogApiProps[\"initialFocusEl\"] = alertDialog\n ? () => domEls.closeTrigger(scope)\n : undefined\n return {\n closeOnEscape: true,\n closeOnInteractOutside: !alertDialog,\n dir: \"ltr\",\n initialFocusEl: initialFocusEl!,\n modal: true,\n preventScroll: true,\n restoreFocus: true,\n role: \"dialog\",\n trapFocus: true,\n ...props,\n }\n },\n\n states: {\n closed: {\n on: {\n \"CONTROLLED.OPEN\": {\n target: \"open\",\n },\n OPEN: [\n {\n actions: [\"invokeOnOpen\"],\n guard: \"isOpenControlled\",\n },\n {\n actions: [\"invokeOnOpen\"],\n target: \"open\",\n },\n ],\n TOGGLE: [\n {\n actions: [\"invokeOnOpen\"],\n guard: \"isOpenControlled\",\n },\n {\n actions: [\"invokeOnOpen\"],\n target: \"open\",\n },\n ],\n },\n },\n open: {\n effects: [\n \"trackDismissableElement\",\n \"trapFocus\",\n \"preventScroll\",\n \"hideContentBelow\",\n ],\n entry: [\"syncZIndex\"],\n on: {\n CLOSE: [\n {\n actions: [\"invokeOnClose\"],\n guard: \"isOpenControlled\",\n },\n {\n actions: [\"invokeOnClose\"],\n target: \"closed\",\n },\n ],\n \"CONTROLLED.CLOSE\": {\n target: \"closed\",\n },\n TOGGLE: [\n {\n actions: [\"invokeOnClose\"],\n guard: \"isOpenControlled\",\n },\n {\n actions: [\"invokeOnClose\"],\n target: \"closed\",\n },\n ],\n },\n },\n },\n\n watch({actions, prop, track}) {\n track([() => prop(\"open\")], () => {\n actions.toggleVisibility()\n })\n },\n })\n", "// Modified from https://github.com/chakra-ui/zag\n// MIT License\n// Changes from Qualcomm Technologies, Inc. are provided under the following license:\n// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport {createProps, createSplitProps} from \"@qualcomm-ui/utils/object\"\n\nimport type {DialogApiProps} from \"./dialog.types\"\n\nexport const dialogProps: (keyof DialogApiProps)[] =\n createProps<DialogApiProps>()(\n \"aria-label\",\n \"closeOnEscape\",\n \"closeOnInteractOutside\",\n \"defaultOpen\",\n \"dir\",\n \"finalFocusEl\",\n \"getRootNode\",\n \"initialFocusEl\",\n \"modal\",\n \"onEscapeKeyDown\",\n \"onFocusOutside\",\n \"onInteractOutside\",\n \"onOpenChange\",\n \"onPointerDownOutside\",\n \"onRequestDismiss\",\n \"open\",\n \"persistentElements\",\n \"preventScroll\",\n \"restoreFocus\",\n \"role\",\n \"trapFocus\",\n )\n\nexport const splitDialogProps: <Props extends DialogApiProps>(\n props: Props,\n) => [DialogApiProps, Omit<Props, keyof DialogApiProps>] =\n createSplitProps<DialogApiProps>(dialogProps)\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,qBAAAE,EAAA,kBAAAC,EAAA,gBAAAC,EAAA,qBAAAC,IAAA,eAAAC,EAAAN,GCMA,IAAAO,EAAwC,yCCIjC,IAAMC,EAAqD,CAChE,SAAWC,GAAUA,EAAM,IAAI,IAAI,UAAU,EAC7C,aAAeA,GAAUA,EAAM,IAAI,IAAI,cAAc,EACrD,QAAUA,GAAUA,EAAM,IAAI,IAAI,SAAS,EAC3C,YA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,EACA,CACE,QAAS,CAAC,eAAe,EACzB,OAAQ,QACV,CACF,CACF,CACF,CACF,EAEA,MAAM,CAAC,QAAAE,EAAS,KAAAZ,EAAM,MAAAa,CAAK,EAAG,CAC5BA,EAAM,CAAC,IAAMb,EAAK,MAAM,CAAC,EAAG,IAAM,CAChCY,EAAQ,iBAAiB,CAC3B,CAAC,CACH,CACF,CAAC,EC5MH,IAAAE,EAA4C,qCAI/BC,KACX,eAA4B,EAC1B,aACA,gBACA,yBACA,cACA,MACA,eACA,cACA,iBACA,QACA,kBACA,iBACA,oBACA,eACA,uBACA,mBACA,OACA,qBACA,gBACA,eACA,OACA,WACF,EAEWC,KAGX,oBAAiCD,CAAW",
6
6
  "names": ["dialog_exports", "__export", "createDialogApi", "dialogMachine", "dialogProps", "splitDialogProps", "__toCommonJS", "import_attributes", "domIds", "scope", "domEls", "commonBindings", "createDialogApi", "machine", "normalize", "prop", "scope", "send", "state", "ariaLabel", "open", "nextOpen", "props", "event", "labelId", "domIds", "import_aria_hidden", "import_dismissable", "import_focus_trap", "import_query", "import_remove_scroll", "import_guard", "import_machine", "dialogMachine", "prop", "scope", "contentEl", "domEls", "styles", "node", "send", "event", "el", "bindableId", "props", "alertDialog", "actions", "track", "import_object", "dialogProps", "splitDialogProps"]
7
7
  }
@@ -1,2 +1,2 @@
1
- import{booleanAriaAttr as u}from"@qualcomm-ui/utils/attributes";var s={backdrop:e=>e.ids.get("backdrop"),closeTrigger:e=>e.ids.get("closeTrigger"),content:e=>e.ids.get("content"),description:e=>e.ids.get("description"),label:e=>e.ids.get("label"),positioner:e=>e.ids.get("positioner"),trigger:e=>e.ids.get("trigger")},a={backdrop:e=>e.getById(s.backdrop(e)),closeTrigger:e=>e.getById(s.closeTrigger(e)),content:e=>e.getById(s.content(e)),description:e=>e.getById(s.description(e)),label:e=>e.getById(s.label(e)),positioner:e=>e.getById(s.positioner(e)),trigger:e=>e.getById(s.trigger(e))};var l={"data-scope":"dialog"};function b(e,t){let{prop:o,scope:n,send:r,state:g}=e,p=o("aria-label"),c=g.matches("open");return{open:c,setOpen(i){g.matches("open")!==i&&r({type:i?"OPEN":"CLOSE"})},getBackdropBindings(i){return n.ids.register("backdrop",i),t.element({...l,"data-part":"backdrop","data-state":g.get(),dir:o("dir"),hidden:!c,id:i.id})},getBodyBindings(){return t.element({...l,"data-part":"body"})},getCloseTriggerBindings(i){return n.ids.register("closeTrigger",i),t.button({...l,"data-part":"close-trigger",dir:o("dir"),id:i.id,onClick(d){d.defaultPrevented||r({type:"CLOSE"})},type:"button"})},getContentBindings(i){n.ids.register("content",i);let d=s.label(n);return t.element({...l,"aria-describedby":s.description(n)||void 0,"aria-label":p||void 0,"aria-labelledby":p||!d?void 0:d,"aria-modal":o("modal"),"data-part":"content","data-state":g.get(),dir:o("dir"),hidden:!c,id:i.id,role:o("role"),tabIndex:-1})},getDescriptionBindings(i){return n.ids.register("description",i),t.element({...l,"data-part":"description",dir:o("dir"),id:i.id})},getFooterBindings(){return t.element({...l,"data-part":"footer",dir:o("dir")})},getHeadingBindings(i){return n.ids.register("label",i),t.element({...l,"data-part":"heading",dir:o("dir"),id:i.id})},getPositionerBindings(i){return n.ids.register("positioner",i),t.element({...l,"data-part":"positioner",dir:o("dir"),id:i.id,style:{pointerEvents:c?void 0:"none"}})},getTriggerBindings(i){return n.ids.register("trigger",i),t.button({...l,"aria-controls":s.content(n),"aria-expanded":u(c),"aria-haspopup":"dialog","data-part":"trigger","data-state":g.get(),dir:o("dir"),id:i.id,onClick(d){d.defaultPrevented||r({type:"TOGGLE"})},type:"button"})}}}import{ariaHidden as m}from"@qualcomm-ui/dom/aria-hidden";import{trackDismissableElement as D}from"@qualcomm-ui/dom/dismissable";import{trapFocus as O}from"@qualcomm-ui/dom/focus-trap";import{raf as f}from"@qualcomm-ui/dom/query";import{preventBodyScroll as E}from"@qualcomm-ui/dom/remove-scroll";import{isDefined as y}from"@qualcomm-ui/utils/guard";import{createMachine as B}from"@qualcomm-ui/utils/machine";var G=B({actions:{invokeOnClose:({prop:e})=>{e("onOpenChange")?.(!1)},invokeOnOpen:({prop:e})=>{e("onOpenChange")?.(!0)},syncZIndex:({scope:e})=>{f(()=>{let t=a.content(e);if(!t)return;let o=getComputedStyle?.(t);[a.positioner(e),a.backdrop(e)].forEach(r=>{r?.style.setProperty("--z-index",o.zIndex)})})},toggleVisibility:({prop:e,send:t})=>{t({type:e("open")?"CONTROLLED.OPEN":"CONTROLLED.CLOSE"})}},effects:{hideContentBelow({prop:e,scope:t}){return e("modal")?m(()=>[a.content(t)],{defer:!0}):void 0},preventScroll({prop:e,scope:t}){if(e("preventScroll"))return E(t.getDoc())},trackDismissableElement({prop:e,scope:t,send:o}){return D(()=>a.content(t),{defer:!0,exclude:()=>[a.trigger(t)],onDismiss(){o({src:"interact-outside",type:"CLOSE"})},onEscapeKeyDown(r){e("onEscapeKeyDown")?.(r),e("closeOnEscape")||r.preventDefault()},onFocusOutside:e("onFocusOutside"),onInteractOutside(r){e("onInteractOutside")?.(r),e("closeOnInteractOutside")||r.preventDefault()},onPointerDownOutside:e("onPointerDownOutside"),onRequestDismiss:e("onRequestDismiss"),persistentElements:e("persistentElements"),pointerBlocking:e("modal")})},trapFocus:({prop:e,scope:t})=>!e("trapFocus")||!e("modal")?void 0:O(()=>a.content(t),{initialFocus:e("initialFocusEl"),preventScroll:!0,returnFocusOnDeactivate:e("restoreFocus"),setReturnFocus:n=>e("finalFocusEl")?.()??n})},guards:{isOpenControlled:({prop:e})=>y(e("open"))},ids:({bindableId:e})=>({backdrop:e(),closeTrigger:e(),content:e(),description:e(),label:e(),positioner:e(),trigger:e()}),initialState({prop:e}){return e("open")||e("defaultOpen")?"open":"closed"},props:({props:e,scope:t})=>{let o=e.role==="alertdialog";return{closeOnEscape:!0,closeOnInteractOutside:!o,dir:"ltr",initialFocusEl:o?()=>a.closeTrigger(t):void 0,modal:!0,preventScroll:!0,restoreFocus:!0,role:"dialog",trapFocus:!0,...e}},states:{closed:{on:{"CONTROLLED.OPEN":{target:"open"},OPEN:[{actions:["invokeOnOpen"],guard:"isOpenControlled"},{actions:["invokeOnOpen"],target:"open"}],TOGGLE:[{actions:["invokeOnOpen"],guard:"isOpenControlled"},{actions:["invokeOnOpen"],target:"open"}]}},open:{effects:["trackDismissableElement","trapFocus","preventScroll","hideContentBelow"],entry:["syncZIndex"],on:{CLOSE:[{actions:["invokeOnClose"],guard:"isOpenControlled"},{actions:["invokeOnClose"],target:"closed"}],"CONTROLLED.CLOSE":{target:"closed"},TOGGLE:[{actions:["invokeOnClose"],guard:"isOpenControlled"},{actions:["invokeOnClose"],target:"closed"}]}}},watch({actions:e,prop:t,track:o}){o([()=>t("open")],()=>{e.toggleVisibility()})}});import{createProps as C,createSplitProps as P}from"@qualcomm-ui/utils/object";var k=C()("aria-label","closeOnEscape","closeOnInteractOutside","defaultOpen","dir","finalFocusEl","getRootNode","initialFocusEl","modal","onEscapeKeyDown","onFocusOutside","onInteractOutside","onOpenChange","onPointerDownOutside","onRequestDismiss","open","persistentElements","preventScroll","restoreFocus","role","trapFocus"),H=P(k);export{b as createDialogApi,G as dialogMachine,k as dialogProps,H as splitDialogProps};
1
+ import{ariaAttr as u,booleanAriaAttr as m}from"@qualcomm-ui/utils/attributes";var s={backdrop:e=>e.ids.get("backdrop"),closeTrigger:e=>e.ids.get("closeTrigger"),content:e=>e.ids.get("content"),description:e=>e.ids.get("description"),label:e=>e.ids.get("label"),positioner:e=>e.ids.get("positioner"),trigger:e=>e.ids.get("trigger")},a={backdrop:e=>e.getById(s.backdrop(e)),closeTrigger:e=>e.getById(s.closeTrigger(e)),content:e=>e.getById(s.content(e)),description:e=>e.getById(s.description(e)),label:e=>e.getById(s.label(e)),positioner:e=>e.getById(s.positioner(e)),trigger:e=>e.getById(s.trigger(e))};var l={"data-scope":"dialog"};function v(e,t){let{prop:o,scope:n,send:r,state:g}=e,p=o("aria-label"),c=g.matches("open");return{open:c,setOpen(i){g.matches("open")!==i&&r({type:i?"OPEN":"CLOSE"})},getBackdropBindings(i){return n.ids.register("backdrop",i),t.element({...l,"data-part":"backdrop","data-state":g.get(),dir:o("dir"),hidden:!c,id:i.id})},getBodyBindings(){return t.element({...l,"data-part":"body"})},getCloseTriggerBindings(i){return n.ids.register("closeTrigger",i),t.button({...l,"data-part":"close-trigger",dir:o("dir"),id:i.id,onClick(d){d.defaultPrevented||r({type:"CLOSE"})},type:"button"})},getContentBindings(i){n.ids.register("content",i);let d=s.label(n);return t.element({...l,"aria-describedby":u(s.description(n)),"aria-label":p||void 0,"aria-labelledby":p||!d?void 0:d,"aria-modal":o("modal"),"data-part":"content","data-state":g.get(),dir:o("dir"),hidden:!c,id:i.id,role:o("role"),tabIndex:-1})},getDescriptionBindings(i){return n.ids.register("description",i),t.element({...l,"data-part":"description",dir:o("dir"),id:i.id})},getFooterBindings(){return t.element({...l,"data-part":"footer",dir:o("dir")})},getHeadingBindings(i){return n.ids.register("label",i),t.element({...l,"data-part":"heading",dir:o("dir"),id:i.id})},getPositionerBindings(i){return n.ids.register("positioner",i),t.element({...l,"data-part":"positioner",dir:o("dir"),id:i.id,style:{pointerEvents:c?void 0:"none"}})},getTriggerBindings(i){return n.ids.register("trigger",i),t.button({...l,"aria-controls":s.content(n),"aria-expanded":m(c),"aria-haspopup":"dialog","data-part":"trigger","data-state":g.get(),dir:o("dir"),id:i.id,onClick(d){d.defaultPrevented||r({type:"TOGGLE"})},type:"button"})}}}import{ariaHidden as D}from"@qualcomm-ui/dom/aria-hidden";import{trackDismissableElement as O}from"@qualcomm-ui/dom/dismissable";import{trapFocus as f}from"@qualcomm-ui/dom/focus-trap";import{raf as E}from"@qualcomm-ui/dom/query";import{preventBodyScroll as y}from"@qualcomm-ui/dom/remove-scroll";import{isDefined as B}from"@qualcomm-ui/utils/guard";import{createMachine as C}from"@qualcomm-ui/utils/machine";var M=C({actions:{invokeOnClose:({prop:e})=>{e("onOpenChange")?.(!1)},invokeOnOpen:({prop:e})=>{e("onOpenChange")?.(!0)},syncZIndex:({scope:e})=>{E(()=>{let t=a.content(e);if(!t)return;let o=getComputedStyle?.(t);[a.positioner(e),a.backdrop(e)].forEach(r=>{r?.style.setProperty("--z-index",o.zIndex)})})},toggleVisibility:({prop:e,send:t})=>{t({type:e("open")?"CONTROLLED.OPEN":"CONTROLLED.CLOSE"})}},effects:{hideContentBelow({prop:e,scope:t}){return e("modal")?D(()=>[a.content(t)],{defer:!0}):void 0},preventScroll({prop:e,scope:t}){if(e("preventScroll"))return y(t.getDoc())},trackDismissableElement({prop:e,scope:t,send:o}){return O(()=>a.content(t),{defer:!0,exclude:()=>[a.trigger(t)],onDismiss(){o({src:"interact-outside",type:"CLOSE"})},onEscapeKeyDown(r){e("onEscapeKeyDown")?.(r),e("closeOnEscape")||r.preventDefault()},onFocusOutside:e("onFocusOutside"),onInteractOutside(r){e("onInteractOutside")?.(r),e("closeOnInteractOutside")||r.preventDefault()},onPointerDownOutside:e("onPointerDownOutside"),onRequestDismiss:e("onRequestDismiss"),persistentElements:e("persistentElements"),pointerBlocking:e("modal")})},trapFocus:({prop:e,scope:t})=>!e("trapFocus")||!e("modal")?void 0:f(()=>a.content(t),{initialFocus:e("initialFocusEl"),preventScroll:!0,returnFocusOnDeactivate:e("restoreFocus"),setReturnFocus:n=>e("finalFocusEl")?.()??n})},guards:{isOpenControlled:({prop:e})=>B(e("open"))},ids:({bindableId:e})=>({backdrop:e(),closeTrigger:e(),content:e(),description:e(),label:e(),positioner:e(),trigger:e()}),initialState({prop:e}){return e("open")||e("defaultOpen")?"open":"closed"},props:({props:e,scope:t})=>{let o=e.role==="alertdialog";return{closeOnEscape:!0,closeOnInteractOutside:!o,dir:"ltr",initialFocusEl:o?()=>a.closeTrigger(t):void 0,modal:!0,preventScroll:!0,restoreFocus:!0,role:"dialog",trapFocus:!0,...e}},states:{closed:{on:{"CONTROLLED.OPEN":{target:"open"},OPEN:[{actions:["invokeOnOpen"],guard:"isOpenControlled"},{actions:["invokeOnOpen"],target:"open"}],TOGGLE:[{actions:["invokeOnOpen"],guard:"isOpenControlled"},{actions:["invokeOnOpen"],target:"open"}]}},open:{effects:["trackDismissableElement","trapFocus","preventScroll","hideContentBelow"],entry:["syncZIndex"],on:{CLOSE:[{actions:["invokeOnClose"],guard:"isOpenControlled"},{actions:["invokeOnClose"],target:"closed"}],"CONTROLLED.CLOSE":{target:"closed"},TOGGLE:[{actions:["invokeOnClose"],guard:"isOpenControlled"},{actions:["invokeOnClose"],target:"closed"}]}}},watch({actions:e,prop:t,track:o}){o([()=>t("open")],()=>{e.toggleVisibility()})}});import{createProps as P,createSplitProps as k}from"@qualcomm-ui/utils/object";var S=P()("aria-label","closeOnEscape","closeOnInteractOutside","defaultOpen","dir","finalFocusEl","getRootNode","initialFocusEl","modal","onEscapeKeyDown","onFocusOutside","onInteractOutside","onOpenChange","onPointerDownOutside","onRequestDismiss","open","persistentElements","preventScroll","restoreFocus","role","trapFocus"),K=k(S);export{v as createDialogApi,M as dialogMachine,S as dialogProps,K as splitDialogProps};
2
2
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/dialog/dialog.api.ts", "../../src/dialog/internal/dialog.dom.ts", "../../src/dialog/dialog.machine.ts", "../../src/dialog/dialog.props.ts"],
4
- "sourcesContent": ["// Modified from https://github.com/chakra-ui/zag\n// MIT License\n// Changes from Qualcomm Technologies, Inc. are provided under the following license:\n// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport {booleanAriaAttr} from \"@qualcomm-ui/utils/attributes\"\nimport type {Machine, PropNormalizer} from \"@qualcomm-ui/utils/machine\"\n\nimport type {\n DialogApi,\n DialogBackdropBindings,\n DialogBodyBindings,\n DialogCloseTriggerBindings,\n DialogContentBindings,\n DialogDescriptionBindings,\n DialogFooterBindings,\n DialogHeadingBindings,\n DialogPositionerBindings,\n DialogSchema,\n DialogTriggerBindings,\n} from \"./dialog.types\"\nimport {domIds} from \"./internal\"\n\nconst commonBindings: {\"data-scope\": \"dialog\"} = {\n \"data-scope\": \"dialog\",\n}\n\nexport function createDialogApi(\n machine: Machine<DialogSchema>,\n normalize: PropNormalizer,\n): DialogApi {\n const {prop, scope, send, state} = machine\n\n const ariaLabel = prop(\"aria-label\")\n const open = state.matches(\"open\")\n\n return {\n open,\n setOpen(nextOpen) {\n const open = state.matches(\"open\")\n if (open === nextOpen) {\n return\n }\n send({type: nextOpen ? \"OPEN\" : \"CLOSE\"})\n },\n\n // group: bindings\n getBackdropBindings(props): DialogBackdropBindings {\n scope.ids.register(\"backdrop\", props)\n return normalize.element({\n ...commonBindings,\n \"data-part\": \"backdrop\",\n \"data-state\": state.get(),\n dir: prop(\"dir\"),\n hidden: !open,\n id: props.id,\n })\n },\n getBodyBindings(): DialogBodyBindings {\n return normalize.element({\n ...commonBindings,\n \"data-part\": \"body\",\n })\n },\n getCloseTriggerBindings(props): DialogCloseTriggerBindings {\n scope.ids.register(\"closeTrigger\", props)\n return normalize.button({\n ...commonBindings,\n \"data-part\": \"close-trigger\",\n dir: prop(\"dir\"),\n id: props.id,\n onClick(event) {\n if (event.defaultPrevented) {\n return\n }\n send({type: \"CLOSE\"})\n },\n type: \"button\",\n })\n },\n getContentBindings(props): DialogContentBindings {\n scope.ids.register(\"content\", props)\n const labelId = domIds.label(scope)\n return normalize.element({\n ...commonBindings,\n \"aria-describedby\": domIds.description(scope) || undefined,\n \"aria-label\": ariaLabel || undefined,\n \"aria-labelledby\": ariaLabel || !labelId ? undefined : labelId,\n \"aria-modal\": prop(\"modal\"),\n \"data-part\": \"content\",\n \"data-state\": state.get(),\n dir: prop(\"dir\"),\n hidden: !open,\n id: props.id,\n role: prop(\"role\"),\n tabIndex: -1,\n })\n },\n getDescriptionBindings(props): DialogDescriptionBindings {\n scope.ids.register(\"description\", props)\n return normalize.element({\n ...commonBindings,\n \"data-part\": \"description\",\n dir: prop(\"dir\"),\n id: props.id,\n })\n },\n getFooterBindings(): DialogFooterBindings {\n return normalize.element({\n ...commonBindings,\n \"data-part\": \"footer\",\n dir: prop(\"dir\"),\n })\n },\n getHeadingBindings(props): DialogHeadingBindings {\n scope.ids.register(\"label\", props)\n return normalize.element({\n ...commonBindings,\n \"data-part\": \"heading\",\n dir: prop(\"dir\"),\n id: props.id,\n })\n },\n getPositionerBindings(props): DialogPositionerBindings {\n scope.ids.register(\"positioner\", props)\n return normalize.element({\n ...commonBindings,\n \"data-part\": \"positioner\",\n dir: prop(\"dir\"),\n id: props.id,\n style: {\n pointerEvents: open ? undefined : \"none\",\n },\n })\n },\n getTriggerBindings(props): DialogTriggerBindings {\n scope.ids.register(\"trigger\", props)\n return normalize.button({\n ...commonBindings,\n \"aria-controls\": domIds.content(scope),\n \"aria-expanded\": booleanAriaAttr(open),\n \"aria-haspopup\": \"dialog\",\n \"data-part\": \"trigger\",\n \"data-state\": state.get(),\n dir: prop(\"dir\"),\n id: props.id,\n onClick(event) {\n if (event.defaultPrevented) {\n return\n }\n send({type: \"TOGGLE\"})\n },\n type: \"button\",\n })\n },\n }\n}\n", "// Modified from https://github.com/chakra-ui/zag\n// MIT License\n// Changes from Qualcomm Technologies, Inc. are provided under the following license:\n// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport type {ScopeDomElements, ScopeDomIds} from \"@qualcomm-ui/utils/machine\"\n\nimport type {DialogElementIds, DialogScope} from \"../dialog.types\"\n\nexport const domIds: ScopeDomIds<DialogElementIds, DialogScope> = {\n backdrop: (scope) => scope.ids.get(\"backdrop\"),\n closeTrigger: (scope) => scope.ids.get(\"closeTrigger\"),\n content: (scope) => scope.ids.get(\"content\"),\n description: (scope) => scope.ids.get(\"description\"),\n label: (scope) => scope.ids.get(\"label\"),\n positioner: (scope) => scope.ids.get(\"positioner\"),\n trigger: (scope) => scope.ids.get(\"trigger\"),\n}\n\nexport const domEls: ScopeDomElements<DialogElementIds, DialogScope> = {\n backdrop: (scope) => scope.getById(domIds.backdrop(scope)),\n closeTrigger: (scope) => scope.getById(domIds.closeTrigger(scope)),\n content: (scope) => scope.getById(domIds.content(scope)),\n description: (scope) => scope.getById(domIds.description(scope)),\n label: (scope) => scope.getById(domIds.label(scope)),\n positioner: (scope) => scope.getById(domIds.positioner(scope)),\n trigger: (scope) => scope.getById(domIds.trigger(scope)),\n}\n", "// Modified from https://github.com/chakra-ui/zag\n// MIT License\n// Changes from Qualcomm Technologies, Inc. are provided under the following license:\n// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport {ariaHidden} from \"@qualcomm-ui/dom/aria-hidden\"\nimport {trackDismissableElement} from \"@qualcomm-ui/dom/dismissable\"\nimport {trapFocus} from \"@qualcomm-ui/dom/focus-trap\"\nimport {raf} from \"@qualcomm-ui/dom/query\"\nimport {preventBodyScroll} from \"@qualcomm-ui/dom/remove-scroll\"\nimport {isDefined} from \"@qualcomm-ui/utils/guard\"\nimport {createMachine, type MachineConfig} from \"@qualcomm-ui/utils/machine\"\n\nimport type {DialogApiProps, DialogSchema} from \"./dialog.types\"\nimport {domEls} from \"./internal\"\n\nexport const dialogMachine: MachineConfig<DialogSchema> =\n createMachine<DialogSchema>({\n actions: {\n invokeOnClose: ({prop}) => {\n prop(\"onOpenChange\")?.(false)\n },\n invokeOnOpen: ({prop}) => {\n prop(\"onOpenChange\")?.(true)\n },\n syncZIndex: ({scope}) => {\n raf(() => {\n const contentEl = domEls.content(scope)\n if (!contentEl) {\n return\n }\n\n const styles = getComputedStyle?.(contentEl)\n const elems = [domEls.positioner(scope), domEls.backdrop(scope)]\n elems.forEach((node) => {\n node?.style.setProperty(\"--z-index\", styles.zIndex)\n })\n })\n },\n toggleVisibility: ({prop, send}) => {\n send({type: prop(\"open\") ? \"CONTROLLED.OPEN\" : \"CONTROLLED.CLOSE\"})\n },\n },\n\n effects: {\n hideContentBelow({prop, scope}) {\n if (!prop(\"modal\")) {\n return\n }\n const getElements = () => [domEls.content(scope)]\n return ariaHidden(getElements, {defer: true})\n },\n\n preventScroll({prop, scope}) {\n if (!prop(\"preventScroll\")) {\n return\n }\n return preventBodyScroll(scope.getDoc())\n },\n\n trackDismissableElement({prop, scope, send}) {\n const getContentEl = () => domEls.content(scope)\n return trackDismissableElement(getContentEl, {\n defer: true,\n exclude: () => [domEls.trigger(scope)],\n onDismiss() {\n send({src: \"interact-outside\", type: \"CLOSE\"})\n },\n onEscapeKeyDown(event) {\n prop(\"onEscapeKeyDown\")?.(event)\n if (!prop(\"closeOnEscape\")) {\n event.preventDefault()\n }\n },\n onFocusOutside: prop(\"onFocusOutside\"),\n onInteractOutside(event) {\n prop(\"onInteractOutside\")?.(event)\n if (!prop(\"closeOnInteractOutside\")) {\n event.preventDefault()\n }\n },\n onPointerDownOutside: prop(\"onPointerDownOutside\"),\n onRequestDismiss: prop(\"onRequestDismiss\"),\n persistentElements: prop(\"persistentElements\"),\n pointerBlocking: prop(\"modal\"),\n })\n },\n\n trapFocus: ({prop, scope}) => {\n if (!prop(\"trapFocus\") || !prop(\"modal\")) {\n return\n }\n const contentEl = () => domEls.content(scope)\n return trapFocus(contentEl, {\n initialFocus: prop(\"initialFocusEl\"),\n preventScroll: true,\n returnFocusOnDeactivate: prop(\"restoreFocus\"),\n setReturnFocus: (el) => prop(\"finalFocusEl\")?.() ?? el,\n })\n },\n },\n\n guards: {\n isOpenControlled: ({prop}) => isDefined(prop(\"open\")),\n },\n\n ids: ({bindableId}) => ({\n backdrop: bindableId<string>(),\n closeTrigger: bindableId<string>(),\n content: bindableId<string>(),\n description: bindableId<string>(),\n label: bindableId<string>(),\n positioner: bindableId<string>(),\n trigger: bindableId<string>(),\n }),\n\n initialState({prop}) {\n const open = prop(\"open\") || prop(\"defaultOpen\")\n return open ? \"open\" : \"closed\"\n },\n\n props: ({props, scope}) => {\n const alertDialog = props.role === \"alertdialog\"\n const initialFocusEl: DialogApiProps[\"initialFocusEl\"] = alertDialog\n ? () => domEls.closeTrigger(scope)\n : undefined\n return {\n closeOnEscape: true,\n closeOnInteractOutside: !alertDialog,\n dir: \"ltr\",\n initialFocusEl: initialFocusEl!,\n modal: true,\n preventScroll: true,\n restoreFocus: true,\n role: \"dialog\",\n trapFocus: true,\n ...props,\n }\n },\n\n states: {\n closed: {\n on: {\n \"CONTROLLED.OPEN\": {\n target: \"open\",\n },\n OPEN: [\n {\n actions: [\"invokeOnOpen\"],\n guard: \"isOpenControlled\",\n },\n {\n actions: [\"invokeOnOpen\"],\n target: \"open\",\n },\n ],\n TOGGLE: [\n {\n actions: [\"invokeOnOpen\"],\n guard: \"isOpenControlled\",\n },\n {\n actions: [\"invokeOnOpen\"],\n target: \"open\",\n },\n ],\n },\n },\n open: {\n effects: [\n \"trackDismissableElement\",\n \"trapFocus\",\n \"preventScroll\",\n \"hideContentBelow\",\n ],\n entry: [\"syncZIndex\"],\n on: {\n CLOSE: [\n {\n actions: [\"invokeOnClose\"],\n guard: \"isOpenControlled\",\n },\n {\n actions: [\"invokeOnClose\"],\n target: \"closed\",\n },\n ],\n \"CONTROLLED.CLOSE\": {\n target: \"closed\",\n },\n TOGGLE: [\n {\n actions: [\"invokeOnClose\"],\n guard: \"isOpenControlled\",\n },\n {\n actions: [\"invokeOnClose\"],\n target: \"closed\",\n },\n ],\n },\n },\n },\n\n watch({actions, prop, track}) {\n track([() => prop(\"open\")], () => {\n actions.toggleVisibility()\n })\n },\n })\n", "// Modified from https://github.com/chakra-ui/zag\n// MIT License\n// Changes from Qualcomm Technologies, Inc. are provided under the following license:\n// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport {createProps, createSplitProps} from \"@qualcomm-ui/utils/object\"\n\nimport type {DialogApiProps} from \"./dialog.types\"\n\nexport const dialogProps: (keyof DialogApiProps)[] =\n createProps<DialogApiProps>()(\n \"aria-label\",\n \"closeOnEscape\",\n \"closeOnInteractOutside\",\n \"defaultOpen\",\n \"dir\",\n \"finalFocusEl\",\n \"getRootNode\",\n \"initialFocusEl\",\n \"modal\",\n \"onEscapeKeyDown\",\n \"onFocusOutside\",\n \"onInteractOutside\",\n \"onOpenChange\",\n \"onPointerDownOutside\",\n \"onRequestDismiss\",\n \"open\",\n \"persistentElements\",\n \"preventScroll\",\n \"restoreFocus\",\n \"role\",\n \"trapFocus\",\n )\n\nexport const splitDialogProps: <Props extends DialogApiProps>(\n props: Props,\n) => [DialogApiProps, Omit<Props, keyof DialogApiProps>] =\n createSplitProps<DialogApiProps>(dialogProps)\n"],
5
- "mappings": "AAMA,OAAQ,mBAAAA,MAAsB,gCCIvB,IAAMC,EAAqD,CAChE,SAAWC,GAAUA,EAAM,IAAI,IAAI,UAAU,EAC7C,aAAeA,GAAUA,EAAM,IAAI,IAAI,cAAc,EACrD,QAAUA,GAAUA,EAAM,IAAI,IAAI,SAAS,EAC3C,YAAcA,GAAUA,EAAM,IAAI,IAAI,aAAa,EACnD,MAAQA,GAAUA,EAAM,IAAI,IAAI,OAAO,EACvC,WAAaA,GAAUA,EAAM,IAAI,IAAI,YAAY,EACjD,QAAUA,GAAUA,EAAM,IAAI,IAAI,SAAS,CAC7C,EAEaC,EAA0D,CACrE,SAAWD,GAAUA,EAAM,QAAQD,EAAO,SAASC,CAAK,CAAC,EACzD,aAAeA,GAAUA,EAAM,QAAQD,EAAO,aAAaC,CAAK,CAAC,EACjE,QAAUA,GAAUA,EAAM,QAAQD,EAAO,QAAQC,CAAK,CAAC,EACvD,YAAcA,GAAUA,EAAM,QAAQD,EAAO,YAAYC,CAAK,CAAC,EAC/D,MAAQA,GAAUA,EAAM,QAAQD,EAAO,MAAMC,CAAK,CAAC,EACnD,WAAaA,GAAUA,EAAM,QAAQD,EAAO,WAAWC,CAAK,CAAC,EAC7D,QAAUA,GAAUA,EAAM,QAAQD,EAAO,QAAQC,CAAK,CAAC,CACzD,EDJA,IAAME,EAA2C,CAC/C,aAAc,QAChB,EAEO,SAAS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AAK,EAC/B,OAMF,MAAO,GACP,cAAe,GACf,aAAc,GACd,KAAM,SACN,UAAW,GACX,GAAGe,CACL,CACF,EAEA,OAAQ,CACN,OAAQ,CACN,GAAI,CACF,kBAAmB,CACjB,OAAQ,MACV,EACA,KAAM,CACJ,CACE,QAAS,CAAC,cAAc,EACxB,MAAO,kBACT,EACA,CACE,QAAS,CAAC,cAAc,EACxB,OAAQ,MACV,CACF,EACA,OAAQ,CACN,CACE,QAAS,CAAC,cAAc,EACxB,MAAO,kBACT,EACA,CACE,QAAS,CAAC,cAAc,EACxB,OAAQ,MACV,CACF,CACF,CACF,EACA,KAAM,CACJ,QAAS,CACP,0BACA,YACA,gBACA,kBACF,EACA,MAAO,CAAC,YAAY,EACpB,GAAI,CACF,MAAO,CACL,CACE,QAAS,CAAC,eAAe,EACzB,MAAO,kBACT,EACA,CACE,QAAS,CAAC,eAAe,EACzB,OAAQ,QACV,CACF,EACA,mBAAoB,CAClB,OAAQ,QACV,EACA,OAAQ,CACN,CACE,QAAS,CAAC,eAAe,EACzB,MAAO,kBACT,EACA,CACE,QAAS,CAAC,eAAe,EACzB,OAAQ,QACV,CACF,CACF,CACF,CACF,EAEA,MAAM,CAAC,QAAAE,EAAS,KAAAlB,EAAM,MAAAmB,CAAK,EAAG,CAC5BA,EAAM,CAAC,IAAMnB,EAAK,MAAM,CAAC,EAAG,IAAM,CAChCkB,EAAQ,iBAAiB,CAC3B,CAAC,CACH,CACF,CAAC,EC5MH,OAAQ,eAAAE,EAAa,oBAAAC,MAAuB,4BAIrC,IAAMC,EACXF,EAA4B,EAC1B,aACA,gBACA,yBACA,cACA,MACA,eACA,cACA,iBACA,QACA,kBACA,iBACA,oBACA,eACA,uBACA,mBACA,OACA,qBACA,gBACA,eACA,OACA,WACF,EAEWG,EAGXF,EAAiCC,CAAW",
6
- "names": ["booleanAriaAttr", "domIds", "scope", "domEls", "commonBindings", "createDialogApi", "machine", "normalize", "prop", "scope", "send", "state", "ariaLabel", "open", "nextOpen", "props", "event", "labelId", "domIds", "booleanAriaAttr", "ariaHidden", "trackDismissableElement", "trapFocus", "raf", "preventBodyScroll", "isDefined", "createMachine", "dialogMachine", "createMachine", "prop", "scope", "raf", "contentEl", "domEls", "styles", "node", "send", "ariaHidden", "preventBodyScroll", "trackDismissableElement", "event", "trapFocus", "el", "isDefined", "bindableId", "props", "alertDialog", "actions", "track", "createProps", "createSplitProps", "dialogProps", "splitDialogProps"]
4
+ "sourcesContent": ["// Modified from https://github.com/chakra-ui/zag\n// MIT License\n// Changes from Qualcomm Technologies, Inc. are provided under the following license:\n// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport {ariaAttr, booleanAriaAttr} from \"@qualcomm-ui/utils/attributes\"\nimport type {Machine, PropNormalizer} from \"@qualcomm-ui/utils/machine\"\n\nimport type {\n DialogApi,\n DialogBackdropBindings,\n DialogBodyBindings,\n DialogCloseTriggerBindings,\n DialogContentBindings,\n DialogDescriptionBindings,\n DialogFooterBindings,\n DialogHeadingBindings,\n DialogPositionerBindings,\n DialogSchema,\n DialogTriggerBindings,\n} from \"./dialog.types\"\nimport {domIds} from \"./internal\"\n\nconst commonBindings: {\"data-scope\": \"dialog\"} = {\n \"data-scope\": \"dialog\",\n}\n\nexport function createDialogApi(\n machine: Machine<DialogSchema>,\n normalize: PropNormalizer,\n): DialogApi {\n const {prop, scope, send, state} = machine\n\n const ariaLabel = prop(\"aria-label\")\n const open = state.matches(\"open\")\n\n return {\n open,\n setOpen(nextOpen) {\n const open = state.matches(\"open\")\n if (open === nextOpen) {\n return\n }\n send({type: nextOpen ? \"OPEN\" : \"CLOSE\"})\n },\n\n // group: bindings\n getBackdropBindings(props): DialogBackdropBindings {\n scope.ids.register(\"backdrop\", props)\n return normalize.element({\n ...commonBindings,\n \"data-part\": \"backdrop\",\n \"data-state\": state.get(),\n dir: prop(\"dir\"),\n hidden: !open,\n id: props.id,\n })\n },\n getBodyBindings(): DialogBodyBindings {\n return normalize.element({\n ...commonBindings,\n \"data-part\": \"body\",\n })\n },\n getCloseTriggerBindings(props): DialogCloseTriggerBindings {\n scope.ids.register(\"closeTrigger\", props)\n return normalize.button({\n ...commonBindings,\n \"data-part\": \"close-trigger\",\n dir: prop(\"dir\"),\n id: props.id,\n onClick(event) {\n if (event.defaultPrevented) {\n return\n }\n send({type: \"CLOSE\"})\n },\n type: \"button\",\n })\n },\n getContentBindings(props): DialogContentBindings {\n scope.ids.register(\"content\", props)\n const labelId = domIds.label(scope)\n return normalize.element({\n ...commonBindings,\n \"aria-describedby\": ariaAttr(domIds.description(scope)),\n \"aria-label\": ariaLabel || undefined,\n \"aria-labelledby\": ariaLabel || !labelId ? undefined : labelId,\n \"aria-modal\": prop(\"modal\"),\n \"data-part\": \"content\",\n \"data-state\": state.get(),\n dir: prop(\"dir\"),\n hidden: !open,\n id: props.id,\n role: prop(\"role\"),\n tabIndex: -1,\n })\n },\n getDescriptionBindings(props): DialogDescriptionBindings {\n scope.ids.register(\"description\", props)\n return normalize.element({\n ...commonBindings,\n \"data-part\": \"description\",\n dir: prop(\"dir\"),\n id: props.id,\n })\n },\n getFooterBindings(): DialogFooterBindings {\n return normalize.element({\n ...commonBindings,\n \"data-part\": \"footer\",\n dir: prop(\"dir\"),\n })\n },\n getHeadingBindings(props): DialogHeadingBindings {\n scope.ids.register(\"label\", props)\n return normalize.element({\n ...commonBindings,\n \"data-part\": \"heading\",\n dir: prop(\"dir\"),\n id: props.id,\n })\n },\n getPositionerBindings(props): DialogPositionerBindings {\n scope.ids.register(\"positioner\", props)\n return normalize.element({\n ...commonBindings,\n \"data-part\": \"positioner\",\n dir: prop(\"dir\"),\n id: props.id,\n style: {\n pointerEvents: open ? undefined : \"none\",\n },\n })\n },\n getTriggerBindings(props): DialogTriggerBindings {\n scope.ids.register(\"trigger\", props)\n return normalize.button({\n ...commonBindings,\n \"aria-controls\": domIds.content(scope),\n \"aria-expanded\": booleanAriaAttr(open),\n \"aria-haspopup\": \"dialog\",\n \"data-part\": \"trigger\",\n \"data-state\": state.get(),\n dir: prop(\"dir\"),\n id: props.id,\n onClick(event) {\n if (event.defaultPrevented) {\n return\n }\n send({type: \"TOGGLE\"})\n },\n type: \"button\",\n })\n },\n }\n}\n", "// Modified from https://github.com/chakra-ui/zag\n// MIT License\n// Changes from Qualcomm Technologies, Inc. are provided under the following license:\n// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport type {ScopeDomElements, ScopeDomIds} from \"@qualcomm-ui/utils/machine\"\n\nimport type {DialogElementIds, DialogScope} from \"../dialog.types\"\n\nexport const domIds: ScopeDomIds<DialogElementIds, DialogScope> = {\n backdrop: (scope) => scope.ids.get(\"backdrop\"),\n closeTrigger: (scope) => scope.ids.get(\"closeTrigger\"),\n content: (scope) => scope.ids.get(\"content\"),\n description: (scope) => scope.ids.get(\"description\"),\n label: (scope) => scope.ids.get(\"label\"),\n positioner: (scope) => scope.ids.get(\"positioner\"),\n trigger: (scope) => scope.ids.get(\"trigger\"),\n}\n\nexport const domEls: ScopeDomElements<DialogElementIds, DialogScope> = {\n backdrop: (scope) => scope.getById(domIds.backdrop(scope)),\n closeTrigger: (scope) => scope.getById(domIds.closeTrigger(scope)),\n content: (scope) => scope.getById(domIds.content(scope)),\n description: (scope) => scope.getById(domIds.description(scope)),\n label: (scope) => scope.getById(domIds.label(scope)),\n positioner: (scope) => scope.getById(domIds.positioner(scope)),\n trigger: (scope) => scope.getById(domIds.trigger(scope)),\n}\n", "// Modified from https://github.com/chakra-ui/zag\n// MIT License\n// Changes from Qualcomm Technologies, Inc. are provided under the following license:\n// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport {ariaHidden} from \"@qualcomm-ui/dom/aria-hidden\"\nimport {trackDismissableElement} from \"@qualcomm-ui/dom/dismissable\"\nimport {trapFocus} from \"@qualcomm-ui/dom/focus-trap\"\nimport {raf} from \"@qualcomm-ui/dom/query\"\nimport {preventBodyScroll} from \"@qualcomm-ui/dom/remove-scroll\"\nimport {isDefined} from \"@qualcomm-ui/utils/guard\"\nimport {createMachine, type MachineConfig} from \"@qualcomm-ui/utils/machine\"\n\nimport type {DialogApiProps, DialogSchema} from \"./dialog.types\"\nimport {domEls} from \"./internal\"\n\nexport const dialogMachine: MachineConfig<DialogSchema> =\n createMachine<DialogSchema>({\n actions: {\n invokeOnClose: ({prop}) => {\n prop(\"onOpenChange\")?.(false)\n },\n invokeOnOpen: ({prop}) => {\n prop(\"onOpenChange\")?.(true)\n },\n syncZIndex: ({scope}) => {\n raf(() => {\n const contentEl = domEls.content(scope)\n if (!contentEl) {\n return\n }\n\n const styles = getComputedStyle?.(contentEl)\n const elems = [domEls.positioner(scope), domEls.backdrop(scope)]\n elems.forEach((node) => {\n node?.style.setProperty(\"--z-index\", styles.zIndex)\n })\n })\n },\n toggleVisibility: ({prop, send}) => {\n send({type: prop(\"open\") ? \"CONTROLLED.OPEN\" : \"CONTROLLED.CLOSE\"})\n },\n },\n\n effects: {\n hideContentBelow({prop, scope}) {\n if (!prop(\"modal\")) {\n return\n }\n const getElements = () => [domEls.content(scope)]\n return ariaHidden(getElements, {defer: true})\n },\n\n preventScroll({prop, scope}) {\n if (!prop(\"preventScroll\")) {\n return\n }\n return preventBodyScroll(scope.getDoc())\n },\n\n trackDismissableElement({prop, scope, send}) {\n const getContentEl = () => domEls.content(scope)\n return trackDismissableElement(getContentEl, {\n defer: true,\n exclude: () => [domEls.trigger(scope)],\n onDismiss() {\n send({src: \"interact-outside\", type: \"CLOSE\"})\n },\n onEscapeKeyDown(event) {\n prop(\"onEscapeKeyDown\")?.(event)\n if (!prop(\"closeOnEscape\")) {\n event.preventDefault()\n }\n },\n onFocusOutside: prop(\"onFocusOutside\"),\n onInteractOutside(event) {\n prop(\"onInteractOutside\")?.(event)\n if (!prop(\"closeOnInteractOutside\")) {\n event.preventDefault()\n }\n },\n onPointerDownOutside: prop(\"onPointerDownOutside\"),\n onRequestDismiss: prop(\"onRequestDismiss\"),\n persistentElements: prop(\"persistentElements\"),\n pointerBlocking: prop(\"modal\"),\n })\n },\n\n trapFocus: ({prop, scope}) => {\n if (!prop(\"trapFocus\") || !prop(\"modal\")) {\n return\n }\n const contentEl = () => domEls.content(scope)\n return trapFocus(contentEl, {\n initialFocus: prop(\"initialFocusEl\"),\n preventScroll: true,\n returnFocusOnDeactivate: prop(\"restoreFocus\"),\n setReturnFocus: (el) => prop(\"finalFocusEl\")?.() ?? el,\n })\n },\n },\n\n guards: {\n isOpenControlled: ({prop}) => isDefined(prop(\"open\")),\n },\n\n ids: ({bindableId}) => ({\n backdrop: bindableId<string>(),\n closeTrigger: bindableId<string>(),\n content: bindableId<string>(),\n description: bindableId<string>(),\n label: bindableId<string>(),\n positioner: bindableId<string>(),\n trigger: bindableId<string>(),\n }),\n\n initialState({prop}) {\n const open = prop(\"open\") || prop(\"defaultOpen\")\n return open ? \"open\" : \"closed\"\n },\n\n props: ({props, scope}) => {\n const alertDialog = props.role === \"alertdialog\"\n const initialFocusEl: DialogApiProps[\"initialFocusEl\"] = alertDialog\n ? () => domEls.closeTrigger(scope)\n : undefined\n return {\n closeOnEscape: true,\n closeOnInteractOutside: !alertDialog,\n dir: \"ltr\",\n initialFocusEl: initialFocusEl!,\n modal: true,\n preventScroll: true,\n restoreFocus: true,\n role: \"dialog\",\n trapFocus: true,\n ...props,\n }\n },\n\n states: {\n closed: {\n on: {\n \"CONTROLLED.OPEN\": {\n target: \"open\",\n },\n OPEN: [\n {\n actions: [\"invokeOnOpen\"],\n guard: \"isOpenControlled\",\n },\n {\n actions: [\"invokeOnOpen\"],\n target: \"open\",\n },\n ],\n TOGGLE: [\n {\n actions: [\"invokeOnOpen\"],\n guard: \"isOpenControlled\",\n },\n {\n actions: [\"invokeOnOpen\"],\n target: \"open\",\n },\n ],\n },\n },\n open: {\n effects: [\n \"trackDismissableElement\",\n \"trapFocus\",\n \"preventScroll\",\n \"hideContentBelow\",\n ],\n entry: [\"syncZIndex\"],\n on: {\n CLOSE: [\n {\n actions: [\"invokeOnClose\"],\n guard: \"isOpenControlled\",\n },\n {\n actions: [\"invokeOnClose\"],\n target: \"closed\",\n },\n ],\n \"CONTROLLED.CLOSE\": {\n target: \"closed\",\n },\n TOGGLE: [\n {\n actions: [\"invokeOnClose\"],\n guard: \"isOpenControlled\",\n },\n {\n actions: [\"invokeOnClose\"],\n target: \"closed\",\n },\n ],\n },\n },\n },\n\n watch({actions, prop, track}) {\n track([() => prop(\"open\")], () => {\n actions.toggleVisibility()\n })\n },\n })\n", "// Modified from https://github.com/chakra-ui/zag\n// MIT License\n// Changes from Qualcomm Technologies, Inc. are provided under the following license:\n// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport {createProps, createSplitProps} from \"@qualcomm-ui/utils/object\"\n\nimport type {DialogApiProps} from \"./dialog.types\"\n\nexport const dialogProps: (keyof DialogApiProps)[] =\n createProps<DialogApiProps>()(\n \"aria-label\",\n \"closeOnEscape\",\n \"closeOnInteractOutside\",\n \"defaultOpen\",\n \"dir\",\n \"finalFocusEl\",\n \"getRootNode\",\n \"initialFocusEl\",\n \"modal\",\n \"onEscapeKeyDown\",\n \"onFocusOutside\",\n \"onInteractOutside\",\n \"onOpenChange\",\n \"onPointerDownOutside\",\n \"onRequestDismiss\",\n \"open\",\n \"persistentElements\",\n \"preventScroll\",\n \"restoreFocus\",\n \"role\",\n \"trapFocus\",\n )\n\nexport const splitDialogProps: <Props extends DialogApiProps>(\n props: Props,\n) => [DialogApiProps, Omit<Props, keyof DialogApiProps>] =\n createSplitProps<DialogApiProps>(dialogProps)\n"],
5
+ "mappings": "AAMA,OAAQ,YAAAA,EAAU,mBAAAC,MAAsB,gCCIjC,IAAMC,EAAqD,CAChE,SAAWC,GAAUA,EAAM,IAAI,IAAI,UAAU,EAC7C,a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AO,CACL,CACE,QAAS,CAAC,eAAe,EACzB,MAAO,kBACT,EACA,CACE,QAAS,CAAC,eAAe,EACzB,OAAQ,QACV,CACF,EACA,mBAAoB,CAClB,OAAQ,QACV,EACA,OAAQ,CACN,CACE,QAAS,CAAC,eAAe,EACzB,MAAO,kBACT,EACA,CACE,QAAS,CAAC,eAAe,EACzB,OAAQ,QACV,CACF,CACF,CACF,CACF,EAEA,MAAM,CAAC,QAAAE,EAAS,KAAAlB,EAAM,MAAAmB,CAAK,EAAG,CAC5BA,EAAM,CAAC,IAAMnB,EAAK,MAAM,CAAC,EAAG,IAAM,CAChCkB,EAAQ,iBAAiB,CAC3B,CAAC,CACH,CACF,CAAC,EC5MH,OAAQ,eAAAE,EAAa,oBAAAC,MAAuB,4BAIrC,IAAMC,EACXF,EAA4B,EAC1B,aACA,gBACA,yBACA,cACA,MACA,eACA,cACA,iBACA,QACA,kBACA,iBACA,oBACA,eACA,uBACA,mBACA,OACA,qBACA,gBACA,eACA,OACA,WACF,EAEWG,EAGXF,EAAiCC,CAAW",
6
+ "names": ["ariaAttr", "booleanAriaAttr", "domIds", "scope", "domEls", "commonBindings", "createDialogApi", "machine", "normalize", "prop", "scope", "send", "state", "ariaLabel", "open", "nextOpen", "props", "event", "labelId", "domIds", "ariaAttr", "booleanAriaAttr", "ariaHidden", "trackDismissableElement", "trapFocus", "raf", "preventBodyScroll", "isDefined", "createMachine", "dialogMachine", "createMachine", "prop", "scope", "raf", "contentEl", "domEls", "styles", "node", "send", "ariaHidden", "preventBodyScroll", "trackDismissableElement", "event", "trapFocus", "el", "isDefined", "bindableId", "props", "alertDialog", "actions", "track", "createProps", "createSplitProps", "dialogProps", "splitDialogProps"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var p=Object.defineProperty;var I=Object.getOwnPropertyDescriptor;var N=Object.getOwnPropertyNames;var h=Object.prototype.hasOwnProperty;var u=(i,n)=>{for(var e in n)p(i,e,{get:n[e],enumerable:!0})},B=(i,n,e,o)=>{if(n&&typeof n=="object"||typeof n=="function")for(let s of N(n))!h.call(i,s)&&s!==e&&p(i,s,{get:()=>n[s],enumerable:!(o=I(n,s))||o.enumerable});return i};var P=i=>B(p({},"__esModule",{value:!0}),i);var D={};u(D,{createInlineNotificationApi:()=>y,inlineNotificationMachine:()=>S,inlineNotificationProps:()=>g,splitInlineNotificationProps:()=>A});module.exports=P(D);var d={closeTrigger:i=>i.ids.get("closeTrigger"),description:i=>i.ids.get("description"),heading:i=>i.ids.get("heading"),root:i=>i.ids.get("root")};function y(i,n){let{prop:e,scope:o,send:s,state:f}=i,c=f.matches("visible"),r={"data-scope":"inline-notification",dir:e("dir")};return{visible:c,getActionBindings(){return n.element({...r,"data-part":"action"})},getCloseTriggerBindings(t){return o.ids.register("closeTrigger",t),n.button({...r,"aria-label":"Dismiss notification","data-part":"close-trigger",id:t.id,onClick:m=>{m.defaultPrevented||s({type:"DISMISS"})},type:"button"})},getDescriptionBindings(t){return o.ids.register("description",t),n.element({...r,"data-part":"description",id:t.id})},getIconBindings(){return n.element({...r,"data-part":"status-icon"})},getLabelBindings(t){return o.ids.register("heading",t),n.element({...r,"data-part":"heading",id:t.id})},getRootBindings(t){return o.ids.register("root",t),n.element({...r,"aria-describedby":d.description(o),"aria-labelledby":d.heading(o),"aria-live":e("role")==="status"?"polite":"assertive","data-part":"root","data-state":c?"visible":"dismissed",hidden:!c,role:e("role")})}}}var l=require("@qualcomm-ui/utils/machine"),S=(0,l.createMachine)({actions:{invokeOnDismiss({prop:i}){i("onDismiss")?.()}},ids:({bindableId:i})=>({closeTrigger:i(),description:i(),heading:i(),root:i()}),initialState:()=>"visible",props({props:i}){return{dir:"ltr",role:"status",...i}},states:{dismissed:{},visible:{on:{DISMISS:{actions:["invokeOnDismiss"],target:"dismissed"}}}}});var a=require("@qualcomm-ui/utils/object"),g=(0,a.createProps)()("dir","getRootNode","onDismiss","role"),A=(0,a.createSplitProps)(g);
1
+ "use strict";var p=Object.defineProperty;var N=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var B=(i,n)=>{for(var e in n)p(i,e,{get:n[e],enumerable:!0})},P=(i,n,e,o)=>{if(n&&typeof n=="object"||typeof n=="function")for(let s of h(n))!u.call(i,s)&&s!==e&&p(i,s,{get:()=>n[s],enumerable:!(o=N(n,s))||o.enumerable});return i};var y=i=>P(p({},"__esModule",{value:!0}),i);var v={};B(v,{createInlineNotificationApi:()=>S,inlineNotificationMachine:()=>A,inlineNotificationProps:()=>f,splitInlineNotificationProps:()=>D});module.exports=y(v);var l=require("@qualcomm-ui/utils/attributes");var d={closeTrigger:i=>i.ids.get("closeTrigger"),description:i=>i.ids.get("description"),heading:i=>i.ids.get("heading"),root:i=>i.ids.get("root")};function S(i,n){let{prop:e,scope:o,send:s,state:m}=i,c=m.matches("visible"),r={"data-scope":"inline-notification",dir:e("dir")};return{visible:c,getActionBindings(){return n.element({...r,"data-part":"action"})},getCloseTriggerBindings(t){return o.ids.register("closeTrigger",t),n.button({...r,"aria-label":"Dismiss notification","data-part":"close-trigger",id:t.id,onClick:I=>{I.defaultPrevented||s({type:"DISMISS"})},type:"button"})},getDescriptionBindings(t){return o.ids.register("description",t),n.element({...r,"data-part":"description",id:t.id})},getIconBindings(){return n.element({...r,"data-part":"status-icon"})},getLabelBindings(t){return o.ids.register("heading",t),n.element({...r,"data-part":"heading",id:t.id})},getRootBindings(t){return o.ids.register("root",t),n.element({...r,"aria-describedby":(0,l.ariaAttr)(d.description(o)),"aria-labelledby":(0,l.ariaAttr)(d.heading(o)),"aria-live":e("role")==="status"?"polite":"assertive","data-part":"root","data-state":c?"visible":"dismissed",hidden:!c,role:e("role")})}}}var g=require("@qualcomm-ui/utils/machine"),A=(0,g.createMachine)({actions:{invokeOnDismiss({prop:i}){i("onDismiss")?.()}},ids:({bindableId:i})=>({closeTrigger:i(),description:i(),heading:i(),root:i()}),initialState:()=>"visible",props({props:i}){return{dir:"ltr",role:"status",...i}},states:{dismissed:{},visible:{on:{DISMISS:{actions:["invokeOnDismiss"],target:"dismissed"}}}}});var a=require("@qualcomm-ui/utils/object"),f=(0,a.createProps)()("dir","getRootNode","onDismiss","role"),D=(0,a.createSplitProps)(f);
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../src/inline-notification/index.ts", "../../src/inline-notification/internal/inline-notification.dom.ts", "../../src/inline-notification/inline-notification.api.ts", "../../src/inline-notification/inline-notification.machine.ts", "../../src/inline-notification/inline-notification.props.ts"],
4
- "sourcesContent": ["export * from \"./inline-notification.api\"\nexport * from \"./inline-notification.machine\"\nexport * from \"./inline-notification.props\"\nexport type * from \"./inline-notification.types\"\n", "// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport type {ScopeDomIds} from \"@qualcomm-ui/utils/machine\"\n\nimport type {\n InlineNotificationElementIds,\n InlineNotificationScope,\n} from \"../inline-notification.types\"\n\nexport const domIds: ScopeDomIds<\n InlineNotificationElementIds,\n InlineNotificationScope\n> = {\n closeTrigger: (scope) => scope.ids.get(\"closeTrigger\"),\n description: (scope) => scope.ids.get(\"description\"),\n heading: (scope) => scope.ids.get(\"heading\"),\n root: (scope) => scope.ids.get(\"root\"),\n}\n", "// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport type {\n IdRegistrationProps,\n Machine,\n PropNormalizer,\n} from \"@qualcomm-ui/utils/machine\"\n\nimport type {\n InlineNotificationActionBindings,\n InlineNotificationApi,\n InlineNotificationCloseTriggerBindings,\n InlineNotificationCommonBindings,\n InlineNotificationDescriptionBindings,\n InlineNotificationIconBindings,\n InlineNotificationLabelBindings,\n InlineNotificationRootBindings,\n InlineNotificationSchema,\n} from \"./inline-notification.types\"\nimport {domIds} from \"./internal\"\n\nexport function createInlineNotificationApi(\n machine: Machine<InlineNotificationSchema>,\n normalize: PropNormalizer,\n): InlineNotificationApi {\n const {prop, scope, send, state} = machine\n\n const visible = state.matches(\"visible\")\n\n const commonBindings: InlineNotificationCommonBindings = {\n \"data-scope\": \"inline-notification\",\n dir: prop(\"dir\"),\n }\n\n return {\n visible,\n\n // group: bindings\n getActionBindings(): InlineNotificationActionBindings {\n return normalize.element({\n ...commonBindings,\n \"data-part\": \"action\",\n })\n },\n getCloseTriggerBindings(\n props: IdRegistrationProps,\n ): InlineNotificationCloseTriggerBindings {\n scope.ids.register(\"closeTrigger\", props)\n return normalize.button({\n ...commonBindings,\n \"aria-label\": \"Dismiss notification\",\n \"data-part\": \"close-trigger\",\n id: props.id,\n onClick: (event) => {\n if (!event.defaultPrevented) {\n send({type: \"DISMISS\"})\n }\n },\n type: \"button\",\n })\n },\n getDescriptionBindings(\n props: IdRegistrationProps,\n ): InlineNotificationDescriptionBindings {\n scope.ids.register(\"description\", props)\n return normalize.element({\n ...commonBindings,\n \"data-part\": \"description\",\n id: props.id,\n })\n },\n getIconBindings(): InlineNotificationIconBindings {\n return normalize.element({\n ...commonBindings,\n \"data-part\": \"status-icon\",\n })\n },\n getLabelBindings(\n props: IdRegistrationProps,\n ): InlineNotificationLabelBindings {\n scope.ids.register(\"heading\", props)\n return normalize.element({\n ...commonBindings,\n \"data-part\": \"heading\",\n id: props.id,\n })\n },\n getRootBindings(props): InlineNotificationRootBindings {\n scope.ids.register(\"root\", props)\n return normalize.element({\n ...commonBindings,\n \"aria-describedby\": domIds.description(scope),\n \"aria-labelledby\": domIds.heading(scope),\n \"aria-live\": prop(\"role\") === \"status\" ? \"polite\" : \"assertive\",\n \"data-part\": \"root\",\n \"data-state\": visible ? \"visible\" : \"dismissed\",\n hidden: !visible,\n role: prop(\"role\"),\n })\n },\n }\n}\n", "// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport {createMachine, type MachineConfig} from \"@qualcomm-ui/utils/machine\"\n\nimport type {InlineNotificationSchema} from \"./inline-notification.types\"\n\nexport const inlineNotificationMachine: MachineConfig<InlineNotificationSchema> =\n createMachine<InlineNotificationSchema>({\n actions: {\n invokeOnDismiss({prop}) {\n prop(\"onDismiss\")?.()\n },\n },\n ids: ({bindableId}) => ({\n closeTrigger: bindableId(),\n description: bindableId(),\n heading: bindableId(),\n root: bindableId(),\n }),\n initialState: () => \"visible\",\n props({props}) {\n return {\n dir: \"ltr\",\n role: \"status\",\n ...props,\n }\n },\n states: {\n dismissed: {},\n visible: {\n on: {\n DISMISS: {\n actions: [\"invokeOnDismiss\"],\n target: \"dismissed\",\n },\n },\n },\n },\n })\n", "// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport {createProps, createSplitProps} from \"@qualcomm-ui/utils/object\"\n\nimport type {InlineNotificationApiProps} from \"./inline-notification.types\"\n\nexport const inlineNotificationProps: (keyof InlineNotificationApiProps)[] =\n createProps<InlineNotificationApiProps>()(\n \"dir\",\n \"getRootNode\",\n \"onDismiss\",\n \"role\",\n )\n\nexport const splitInlineNotificationProps: <\n Props extends InlineNotificationApiProps,\n>(\n props: Props,\n) => [\n InlineNotificationApiProps,\n Omit<Props, keyof InlineNotificationApiProps>,\n] = createSplitProps<InlineNotificationApiProps>(inlineNotificationProps)\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,iCAAAE,EAAA,8BAAAC,EAAA,4BAAAC,EAAA,iCAAAC,IAAA,eAAAC,EAAAN,GCUO,IAAMO,EAGT,CACF,aAAeC,GAAUA,EAAM,IAAI,IAAI,cAAc,EACrD,YAAcA,GAAUA,EAAM,IAAI,IAAI,aAAa,EACnD,QAAUA,GAAUA,EAAM,IAAI,IAAI,SAAS,EAC3C,KAAOA,GAAUA,EAAM,IAAI,IAAI,MAAM,CACvC,ECIO,SAASC,EACdC,EACAC,EACuB,CACvB,GAAM,CAAC,K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AAS,CACP,gBAAgB,CAAC,KAAAC,CAAI,EAAG,CACtBA,EAAK,WAAW,IAAI,CACtB,CACF,EACA,IAAK,CAAC,CAAC,WAAAC,CAAU,KAAO,CACtB,aAAcA,EAAW,EACzB,YAAaA,EAAW,EACxB,QAASA,EAAW,EACpB,KAAMA,EAAW,CACnB,GACA,aAAc,IAAM,UACpB,MAAM,CAAC,MAAAC,CAAK,EAAG,CACb,MAAO,CACL,IAAK,MACL,KAAM,SACN,GAAGA,CACL,CACF,EACA,OAAQ,CACN,UAAW,CAAC,EACZ,QAAS,CACP,GAAI,CACF,QAAS,CACP,QAAS,CAAC,iBAAiB,EAC3B,OAAQ,WACV,CACF,CACF,CACF,CACF,CAAC,ECpCH,IAAAC,EAA4C,qCAI/BC,KACX,eAAwC,EACtC,MACA,cACA,YACA,MACF,EAEWC,KAOT,oBAA6CD,CAAuB",
6
- "names": ["inline_notification_exports", "__export", "createInlineNotificationApi", "inlineNotificationMachine", "inlineNotificationProps", "splitInlineNotificationProps", "__toCommonJS", "domIds", "scope", "createInlineNotificationApi", "machine", "normalize", "prop", "scope", "send", "state", "visible", "commonBindings", "props", "event", "domIds", "import_machine", "inlineNotificationMachine", "prop", "bindableId", "props", "import_object", "inlineNotificationProps", "splitInlineNotificationProps"]
3
+ "sources": ["../../src/inline-notification/index.ts", "../../src/inline-notification/inline-notification.api.ts", "../../src/inline-notification/internal/inline-notification.dom.ts", "../../src/inline-notification/inline-notification.machine.ts", "../../src/inline-notification/inline-notification.props.ts"],
4
+ "sourcesContent": ["export * from \"./inline-notification.api\"\nexport * from \"./inline-notification.machine\"\nexport * from \"./inline-notification.props\"\nexport type * from \"./inline-notification.types\"\n", "// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport {ariaAttr} from \"@qualcomm-ui/utils/attributes\"\nimport type {\n IdRegistrationProps,\n Machine,\n PropNormalizer,\n} from \"@qualcomm-ui/utils/machine\"\n\nimport type {\n InlineNotificationActionBindings,\n InlineNotificationApi,\n InlineNotificationCloseTriggerBindings,\n InlineNotificationCommonBindings,\n InlineNotificationDescriptionBindings,\n InlineNotificationIconBindings,\n InlineNotificationLabelBindings,\n InlineNotificationRootBindings,\n InlineNotificationSchema,\n} from \"./inline-notification.types\"\nimport {domIds} from \"./internal\"\n\nexport function createInlineNotificationApi(\n machine: Machine<InlineNotificationSchema>,\n normalize: PropNormalizer,\n): InlineNotificationApi {\n const {prop, scope, send, state} = machine\n\n const visible = state.matches(\"visible\")\n\n const commonBindings: InlineNotificationCommonBindings = {\n \"data-scope\": \"inline-notification\",\n dir: prop(\"dir\"),\n }\n\n return {\n visible,\n\n // group: bindings\n getActionBindings(): InlineNotificationActionBindings {\n return normalize.element({\n ...commonBindings,\n \"data-part\": \"action\",\n })\n },\n getCloseTriggerBindings(\n props: IdRegistrationProps,\n ): InlineNotificationCloseTriggerBindings {\n scope.ids.register(\"closeTrigger\", props)\n return normalize.button({\n ...commonBindings,\n \"aria-label\": \"Dismiss notification\",\n \"data-part\": \"close-trigger\",\n id: props.id,\n onClick: (event) => {\n if (!event.defaultPrevented) {\n send({type: \"DISMISS\"})\n }\n },\n type: \"button\",\n })\n },\n getDescriptionBindings(\n props: IdRegistrationProps,\n ): InlineNotificationDescriptionBindings {\n scope.ids.register(\"description\", props)\n return normalize.element({\n ...commonBindings,\n \"data-part\": \"description\",\n id: props.id,\n })\n },\n getIconBindings(): InlineNotificationIconBindings {\n return normalize.element({\n ...commonBindings,\n \"data-part\": \"status-icon\",\n })\n },\n getLabelBindings(\n props: IdRegistrationProps,\n ): InlineNotificationLabelBindings {\n scope.ids.register(\"heading\", props)\n return normalize.element({\n ...commonBindings,\n \"data-part\": \"heading\",\n id: props.id,\n })\n },\n getRootBindings(props): InlineNotificationRootBindings {\n scope.ids.register(\"root\", props)\n return normalize.element({\n ...commonBindings,\n \"aria-describedby\": ariaAttr(domIds.description(scope)),\n \"aria-labelledby\": ariaAttr(domIds.heading(scope)),\n \"aria-live\": prop(\"role\") === \"status\" ? \"polite\" : \"assertive\",\n \"data-part\": \"root\",\n \"data-state\": visible ? \"visible\" : \"dismissed\",\n hidden: !visible,\n role: prop(\"role\"),\n })\n },\n }\n}\n", "// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport type {ScopeDomIds} from \"@qualcomm-ui/utils/machine\"\n\nimport type {\n InlineNotificationElementIds,\n InlineNotificationScope,\n} from \"../inline-notification.types\"\n\nexport const domIds: ScopeDomIds<\n InlineNotificationElementIds,\n InlineNotificationScope\n> = {\n closeTrigger: (scope) => scope.ids.get(\"closeTrigger\"),\n description: (scope) => scope.ids.get(\"description\"),\n heading: (scope) => scope.ids.get(\"heading\"),\n root: (scope) => scope.ids.get(\"root\"),\n}\n", "// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport {createMachine, type MachineConfig} from \"@qualcomm-ui/utils/machine\"\n\nimport type {InlineNotificationSchema} from \"./inline-notification.types\"\n\nexport const inlineNotificationMachine: MachineConfig<InlineNotificationSchema> =\n createMachine<InlineNotificationSchema>({\n actions: {\n invokeOnDismiss({prop}) {\n prop(\"onDismiss\")?.()\n },\n },\n ids: ({bindableId}) => ({\n closeTrigger: bindableId(),\n description: bindableId(),\n heading: bindableId(),\n root: bindableId(),\n }),\n initialState: () => \"visible\",\n props({props}) {\n return {\n dir: \"ltr\",\n role: \"status\",\n ...props,\n }\n },\n states: {\n dismissed: {},\n visible: {\n on: {\n DISMISS: {\n actions: [\"invokeOnDismiss\"],\n target: \"dismissed\",\n },\n },\n },\n },\n })\n", "// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport {createProps, createSplitProps} from \"@qualcomm-ui/utils/object\"\n\nimport type {InlineNotificationApiProps} from \"./inline-notification.types\"\n\nexport const inlineNotificationProps: (keyof InlineNotificationApiProps)[] =\n createProps<InlineNotificationApiProps>()(\n \"dir\",\n \"getRootNode\",\n \"onDismiss\",\n \"role\",\n )\n\nexport const splitInlineNotificationProps: <\n Props extends InlineNotificationApiProps,\n>(\n props: Props,\n) => [\n InlineNotificationApiProps,\n Omit<Props, keyof InlineNotificationApiProps>,\n] = createSplitProps<InlineNotificationApiProps>(inlineNotificationProps)\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,iCAAAE,EAAA,8BAAAC,EAAA,4BAAAC,EAAA,iCAAAC,IAAA,eAAAC,EAAAN,GCGA,IAAAO,EAAuB,yCCOhB,IAAMC,EAGT,CACF,aAAeC,GAAUA,EAAM,IAAI,IAAI,cAAc,EACrD,YAAcA,GAAUA,EAAM,IAAI,IAAI,aAAa,EACnD,QAAUA,GAAUA,EAAM,IAAI,IAAI,SAAS,EAC3C,KAAOA,GAAUA,EAAM,IAAI,IAAI,MAAM,CACvC,EDKO,SAASC,EACdC,EACAC,EACuB,CACvB,GAAM,CAAC,KAAAC,EAAM,MAAAC,EAAO,KAAAC,EAAM,MAAAC,CAAK,EAAIL,EAE7BM,EAAUD,EAAM,QAAQ,SAAS,EAEjCE,EAAmD,CACvD,aAAc,sBACd,IAAKL,EAAK,KAAK,CACjB,EAEA,MAAO,CACL,QAAAI,EAGA,mBAAsD,CACpD,OAAOL,EAAU,QAAQ,CACvB,GAAGM,EACH,YAAa,QACf,CAAC,CACH,EACA,wBACEC,EACwC,CACxC,OAAAL,EAAM,IAAI,SAAS,eAAgBK,CAAK,EACjCP,EAAU,OAAO,CACtB,GAAGM,EACH,aAAc,uBACd,YAAa,gBACb,GAAIC,EAAM,GACV,QAAUC,GAAU,CACbA,EAAM,kBACTL,EAAK,CAAC,KAAM,SAAS,CAAC,CAE1B,EACA,KAAM,QACR,CAAC,CACH,EACA,uBACEI,EACuC,CACvC,OAAAL,EAAM,IAAI,SAAS,cAAeK,CAAK,EAChCP,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+ "names": ["inline_notification_exports", "__export", "createInlineNotificationApi", "inlineNotificationMachine", "inlineNotificationProps", "splitInlineNotificationProps", "__toCommonJS", "import_attributes", "domIds", "scope", "createInlineNotificationApi", "machine", "normalize", "prop", "scope", "send", "state", "visible", "commonBindings", "props", "event", "domIds", "import_machine", "inlineNotificationMachine", "prop", "bindableId", "props", "import_object", "inlineNotificationProps", "splitInlineNotificationProps"]
7
7
  }
@@ -1,2 +1,2 @@
1
- var a={closeTrigger:i=>i.ids.get("closeTrigger"),description:i=>i.ids.get("description"),heading:i=>i.ids.get("heading"),root:i=>i.ids.get("root")};function h(i,t){let{prop:s,scope:o,send:c,state:p}=i,r=p.matches("visible"),e={"data-scope":"inline-notification",dir:s("dir")};return{visible:r,getActionBindings(){return t.element({...e,"data-part":"action"})},getCloseTriggerBindings(n){return o.ids.register("closeTrigger",n),t.button({...e,"aria-label":"Dismiss notification","data-part":"close-trigger",id:n.id,onClick:d=>{d.defaultPrevented||c({type:"DISMISS"})},type:"button"})},getDescriptionBindings(n){return o.ids.register("description",n),t.element({...e,"data-part":"description",id:n.id})},getIconBindings(){return t.element({...e,"data-part":"status-icon"})},getLabelBindings(n){return o.ids.register("heading",n),t.element({...e,"data-part":"heading",id:n.id})},getRootBindings(n){return o.ids.register("root",n),t.element({...e,"aria-describedby":a.description(o),"aria-labelledby":a.heading(o),"aria-live":s("role")==="status"?"polite":"assertive","data-part":"root","data-state":r?"visible":"dismissed",hidden:!r,role:s("role")})}}}import{createMachine as l}from"@qualcomm-ui/utils/machine";var P=l({actions:{invokeOnDismiss({prop:i}){i("onDismiss")?.()}},ids:({bindableId:i})=>({closeTrigger:i(),description:i(),heading:i(),root:i()}),initialState:()=>"visible",props({props:i}){return{dir:"ltr",role:"status",...i}},states:{dismissed:{},visible:{on:{DISMISS:{actions:["invokeOnDismiss"],target:"dismissed"}}}}});import{createProps as g,createSplitProps as f}from"@qualcomm-ui/utils/object";var m=g()("dir","getRootNode","onDismiss","role"),A=f(m);export{h as createInlineNotificationApi,P as inlineNotificationMachine,m as inlineNotificationProps,A as splitInlineNotificationProps};
1
+ import{ariaAttr as c}from"@qualcomm-ui/utils/attributes";var a={closeTrigger:i=>i.ids.get("closeTrigger"),description:i=>i.ids.get("description"),heading:i=>i.ids.get("heading"),root:i=>i.ids.get("root")};function B(i,t){let{prop:s,scope:o,send:p,state:d}=i,r=d.matches("visible"),e={"data-scope":"inline-notification",dir:s("dir")};return{visible:r,getActionBindings(){return t.element({...e,"data-part":"action"})},getCloseTriggerBindings(n){return o.ids.register("closeTrigger",n),t.button({...e,"aria-label":"Dismiss notification","data-part":"close-trigger",id:n.id,onClick:l=>{l.defaultPrevented||p({type:"DISMISS"})},type:"button"})},getDescriptionBindings(n){return o.ids.register("description",n),t.element({...e,"data-part":"description",id:n.id})},getIconBindings(){return t.element({...e,"data-part":"status-icon"})},getLabelBindings(n){return o.ids.register("heading",n),t.element({...e,"data-part":"heading",id:n.id})},getRootBindings(n){return o.ids.register("root",n),t.element({...e,"aria-describedby":c(a.description(o)),"aria-labelledby":c(a.heading(o)),"aria-live":s("role")==="status"?"polite":"assertive","data-part":"root","data-state":r?"visible":"dismissed",hidden:!r,role:s("role")})}}}import{createMachine as g}from"@qualcomm-ui/utils/machine";var S=g({actions:{invokeOnDismiss({prop:i}){i("onDismiss")?.()}},ids:({bindableId:i})=>({closeTrigger:i(),description:i(),heading:i(),root:i()}),initialState:()=>"visible",props({props:i}){return{dir:"ltr",role:"status",...i}},states:{dismissed:{},visible:{on:{DISMISS:{actions:["invokeOnDismiss"],target:"dismissed"}}}}});import{createProps as f,createSplitProps as m}from"@qualcomm-ui/utils/object";var I=f()("dir","getRootNode","onDismiss","role"),v=m(I);export{B as createInlineNotificationApi,S as inlineNotificationMachine,I as inlineNotificationProps,v as splitInlineNotificationProps};
2
2
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../src/inline-notification/internal/inline-notification.dom.ts", "../../src/inline-notification/inline-notification.api.ts", "../../src/inline-notification/inline-notification.machine.ts", "../../src/inline-notification/inline-notification.props.ts"],
4
- "sourcesContent": ["// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport type {ScopeDomIds} from \"@qualcomm-ui/utils/machine\"\n\nimport type {\n InlineNotificationElementIds,\n InlineNotificationScope,\n} from \"../inline-notification.types\"\n\nexport const domIds: ScopeDomIds<\n InlineNotificationElementIds,\n InlineNotificationScope\n> = {\n closeTrigger: (scope) => scope.ids.get(\"closeTrigger\"),\n description: (scope) => scope.ids.get(\"description\"),\n heading: (scope) => scope.ids.get(\"heading\"),\n root: (scope) => scope.ids.get(\"root\"),\n}\n", "// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport type {\n IdRegistrationProps,\n Machine,\n PropNormalizer,\n} from \"@qualcomm-ui/utils/machine\"\n\nimport type {\n InlineNotificationActionBindings,\n InlineNotificationApi,\n InlineNotificationCloseTriggerBindings,\n InlineNotificationCommonBindings,\n InlineNotificationDescriptionBindings,\n InlineNotificationIconBindings,\n InlineNotificationLabelBindings,\n InlineNotificationRootBindings,\n InlineNotificationSchema,\n} from \"./inline-notification.types\"\nimport {domIds} from \"./internal\"\n\nexport function createInlineNotificationApi(\n machine: Machine<InlineNotificationSchema>,\n normalize: PropNormalizer,\n): InlineNotificationApi {\n const {prop, scope, send, state} = machine\n\n const visible = state.matches(\"visible\")\n\n const commonBindings: InlineNotificationCommonBindings = {\n \"data-scope\": \"inline-notification\",\n dir: prop(\"dir\"),\n }\n\n return {\n visible,\n\n // group: bindings\n getActionBindings(): InlineNotificationActionBindings {\n return normalize.element({\n ...commonBindings,\n \"data-part\": \"action\",\n })\n },\n getCloseTriggerBindings(\n props: IdRegistrationProps,\n ): InlineNotificationCloseTriggerBindings {\n scope.ids.register(\"closeTrigger\", props)\n return normalize.button({\n ...commonBindings,\n \"aria-label\": \"Dismiss notification\",\n \"data-part\": \"close-trigger\",\n id: props.id,\n onClick: (event) => {\n if (!event.defaultPrevented) {\n send({type: \"DISMISS\"})\n }\n },\n type: \"button\",\n })\n },\n getDescriptionBindings(\n props: IdRegistrationProps,\n ): InlineNotificationDescriptionBindings {\n scope.ids.register(\"description\", props)\n return normalize.element({\n ...commonBindings,\n \"data-part\": \"description\",\n id: props.id,\n })\n },\n getIconBindings(): InlineNotificationIconBindings {\n return normalize.element({\n ...commonBindings,\n \"data-part\": \"status-icon\",\n })\n },\n getLabelBindings(\n props: IdRegistrationProps,\n ): InlineNotificationLabelBindings {\n scope.ids.register(\"heading\", props)\n return normalize.element({\n ...commonBindings,\n \"data-part\": \"heading\",\n id: props.id,\n })\n },\n getRootBindings(props): InlineNotificationRootBindings {\n scope.ids.register(\"root\", props)\n return normalize.element({\n ...commonBindings,\n \"aria-describedby\": domIds.description(scope),\n \"aria-labelledby\": domIds.heading(scope),\n \"aria-live\": prop(\"role\") === \"status\" ? \"polite\" : \"assertive\",\n \"data-part\": \"root\",\n \"data-state\": visible ? \"visible\" : \"dismissed\",\n hidden: !visible,\n role: prop(\"role\"),\n })\n },\n }\n}\n", "// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport {createMachine, type MachineConfig} from \"@qualcomm-ui/utils/machine\"\n\nimport type {InlineNotificationSchema} from \"./inline-notification.types\"\n\nexport const inlineNotificationMachine: MachineConfig<InlineNotificationSchema> =\n createMachine<InlineNotificationSchema>({\n actions: {\n invokeOnDismiss({prop}) {\n prop(\"onDismiss\")?.()\n },\n },\n ids: ({bindableId}) => ({\n closeTrigger: bindableId(),\n description: bindableId(),\n heading: bindableId(),\n root: bindableId(),\n }),\n initialState: () => \"visible\",\n props({props}) {\n return {\n dir: \"ltr\",\n role: \"status\",\n ...props,\n }\n },\n states: {\n dismissed: {},\n visible: {\n on: {\n DISMISS: {\n actions: [\"invokeOnDismiss\"],\n target: \"dismissed\",\n },\n },\n },\n },\n })\n", "// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport {createProps, createSplitProps} from \"@qualcomm-ui/utils/object\"\n\nimport type {InlineNotificationApiProps} from \"./inline-notification.types\"\n\nexport const inlineNotificationProps: (keyof InlineNotificationApiProps)[] =\n createProps<InlineNotificationApiProps>()(\n \"dir\",\n \"getRootNode\",\n \"onDismiss\",\n \"role\",\n )\n\nexport const splitInlineNotificationProps: <\n Props extends InlineNotificationApiProps,\n>(\n props: Props,\n) => [\n InlineNotificationApiProps,\n Omit<Props, keyof InlineNotificationApiProps>,\n] = createSplitProps<InlineNotificationApiProps>(inlineNotificationProps)\n"],
5
- "mappings": "AAUO,IAAMA,EAGT,CACF,aAAeC,GAAUA,EAAM,IAAI,IAAI,cAAc,EACrD,YAAcA,GAAUA,EAAM,IAAI,IAAI,aAAa,EACnD,QAAUA,GAAUA,EAAM,IAAI,IAAI,SAAS,EAC3C,KAAOA,GAAUA,EAAM,IAAI,IAAI,MAAM,CACvC,ECIO,SAASC,EACdC,EACAC,EACuB,CACvB,GAAM,CAAC,KAAAC,EAAM,MAAAC,EAAO,KAAAC,EAAM,MAAAC,CAAK,EAAIL,EAE7BM,EAAUD,EAAM,QAAQ,SAAS,EAEjCE,EAAmD,CACvD,aAAc,sBACd,IAAKL,EAAK,KAAK,CACjB,EAEA,MAAO,CACL,QAAAI,EAGA,mBAAsD,CACpD,OAAOL,EAAU,QAAQ,CACvB,GAAGM,EACH,YAAa,QACf,CAAC,CACH,EACA,wBACEC,EACwC,CACxC,OAAAL,EAAM,IAAI,SAAS,eAAgBK,CAAK,EACjCP,EAAU,OAAO,CACtB,GAAGM,EACH,aAAc,uBACd,YAAa,gBACb,GAAIC,EAAM,GACV,QAAUC,GAAU,CACbA,EAAM,kBACTL,EAAK,CAAC,KAAM,SAAS,CAAC,CAE1B,EACA,KAA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C,EAAa,oBAAAC,MAAuB,4BAIrC,IAAMC,EACXF,EAAwC,EACtC,MACA,cACA,YACA,MACF,EAEWG,EAOTF,EAA6CC,CAAuB",
6
- "names": ["domIds", "scope", "createInlineNotificationApi", "machine", "normalize", "prop", "scope", "send", "state", "visible", "commonBindings", "props", "event", "domIds", "createMachine", "inlineNotificationMachine", "prop", "bindableId", "props", "createProps", "createSplitProps", "inlineNotificationProps", "splitInlineNotificationProps"]
3
+ "sources": ["../../src/inline-notification/inline-notification.api.ts", "../../src/inline-notification/internal/inline-notification.dom.ts", "../../src/inline-notification/inline-notification.machine.ts", "../../src/inline-notification/inline-notification.props.ts"],
4
+ "sourcesContent": ["// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport {ariaAttr} from \"@qualcomm-ui/utils/attributes\"\nimport type {\n IdRegistrationProps,\n Machine,\n PropNormalizer,\n} from \"@qualcomm-ui/utils/machine\"\n\nimport type {\n InlineNotificationActionBindings,\n InlineNotificationApi,\n InlineNotificationCloseTriggerBindings,\n InlineNotificationCommonBindings,\n InlineNotificationDescriptionBindings,\n InlineNotificationIconBindings,\n InlineNotificationLabelBindings,\n InlineNotificationRootBindings,\n InlineNotificationSchema,\n} from \"./inline-notification.types\"\nimport {domIds} from \"./internal\"\n\nexport function createInlineNotificationApi(\n machine: Machine<InlineNotificationSchema>,\n normalize: PropNormalizer,\n): InlineNotificationApi {\n const {prop, scope, send, state} = machine\n\n const visible = state.matches(\"visible\")\n\n const commonBindings: InlineNotificationCommonBindings = {\n \"data-scope\": \"inline-notification\",\n dir: prop(\"dir\"),\n }\n\n return {\n visible,\n\n // group: bindings\n getActionBindings(): InlineNotificationActionBindings {\n return normalize.element({\n ...commonBindings,\n \"data-part\": \"action\",\n })\n },\n getCloseTriggerBindings(\n props: IdRegistrationProps,\n ): InlineNotificationCloseTriggerBindings {\n scope.ids.register(\"closeTrigger\", props)\n return normalize.button({\n ...commonBindings,\n \"aria-label\": \"Dismiss notification\",\n \"data-part\": \"close-trigger\",\n id: props.id,\n onClick: (event) => {\n if (!event.defaultPrevented) {\n send({type: \"DISMISS\"})\n }\n },\n type: \"button\",\n })\n },\n getDescriptionBindings(\n props: IdRegistrationProps,\n ): InlineNotificationDescriptionBindings {\n scope.ids.register(\"description\", props)\n return normalize.element({\n ...commonBindings,\n \"data-part\": \"description\",\n id: props.id,\n })\n },\n getIconBindings(): InlineNotificationIconBindings {\n return normalize.element({\n ...commonBindings,\n \"data-part\": \"status-icon\",\n })\n },\n getLabelBindings(\n props: IdRegistrationProps,\n ): InlineNotificationLabelBindings {\n scope.ids.register(\"heading\", props)\n return normalize.element({\n ...commonBindings,\n \"data-part\": \"heading\",\n id: props.id,\n })\n },\n getRootBindings(props): InlineNotificationRootBindings {\n scope.ids.register(\"root\", props)\n return normalize.element({\n ...commonBindings,\n \"aria-describedby\": ariaAttr(domIds.description(scope)),\n \"aria-labelledby\": ariaAttr(domIds.heading(scope)),\n \"aria-live\": prop(\"role\") === \"status\" ? \"polite\" : \"assertive\",\n \"data-part\": \"root\",\n \"data-state\": visible ? \"visible\" : \"dismissed\",\n hidden: !visible,\n role: prop(\"role\"),\n })\n },\n }\n}\n", "// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport type {ScopeDomIds} from \"@qualcomm-ui/utils/machine\"\n\nimport type {\n InlineNotificationElementIds,\n InlineNotificationScope,\n} from \"../inline-notification.types\"\n\nexport const domIds: ScopeDomIds<\n InlineNotificationElementIds,\n InlineNotificationScope\n> = {\n closeTrigger: (scope) => scope.ids.get(\"closeTrigger\"),\n description: (scope) => scope.ids.get(\"description\"),\n heading: (scope) => scope.ids.get(\"heading\"),\n root: (scope) => scope.ids.get(\"root\"),\n}\n", "// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport {createMachine, type MachineConfig} from \"@qualcomm-ui/utils/machine\"\n\nimport type {InlineNotificationSchema} from \"./inline-notification.types\"\n\nexport const inlineNotificationMachine: MachineConfig<InlineNotificationSchema> =\n createMachine<InlineNotificationSchema>({\n actions: {\n invokeOnDismiss({prop}) {\n prop(\"onDismiss\")?.()\n },\n },\n ids: ({bindableId}) => ({\n closeTrigger: bindableId(),\n description: bindableId(),\n heading: bindableId(),\n root: bindableId(),\n }),\n initialState: () => \"visible\",\n props({props}) {\n return {\n dir: \"ltr\",\n role: \"status\",\n ...props,\n }\n },\n states: {\n dismissed: {},\n visible: {\n on: {\n DISMISS: {\n actions: [\"invokeOnDismiss\"],\n target: \"dismissed\",\n },\n },\n },\n },\n })\n", "// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport {createProps, createSplitProps} from \"@qualcomm-ui/utils/object\"\n\nimport type {InlineNotificationApiProps} from \"./inline-notification.types\"\n\nexport const inlineNotificationProps: (keyof InlineNotificationApiProps)[] =\n createProps<InlineNotificationApiProps>()(\n \"dir\",\n \"getRootNode\",\n \"onDismiss\",\n \"role\",\n )\n\nexport const splitInlineNotificationProps: <\n Props extends InlineNotificationApiProps,\n>(\n props: Props,\n) => [\n InlineNotificationApiProps,\n Omit<Props, keyof InlineNotificationApiProps>,\n] = createSplitProps<InlineNotificationApiProps>(inlineNotificationProps)\n"],
5
+ "mappings": "AAGA,OAAQ,YAAAA,MAAe,gCCOhB,IAAMC,EAGT,CACF,aAAeC,GAAUA,EAAM,IAAI,IAAI,cAAc,EACrD,YAAcA,GAAUA,EAAM,IAAI,IAAI,aAAa,EACnD,QAAUA,GAAUA,EAAM,IAAI,IAAI,SAAS,EAC3C,KAAOA,GAAUA,EAAM,IAAI,IAAI,MAAM,CACvC,EDKO,SAASC,EACdC,EACAC,EACuB,CACvB,GAAM,CAAC,KAAAC,EAAM,MAAAC,EAAO,KAAAC,EAAM,MAAAC,CAAK,EAAIL,EA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,KAAAE,CAAI,EAAG,CACtBA,EAAK,WAAW,IAAI,CACtB,CACF,EACA,IAAK,CAAC,CAAC,WAAAC,CAAU,KAAO,CACtB,aAAcA,EAAW,EACzB,YAAaA,EAAW,EACxB,QAASA,EAAW,EACpB,KAAMA,EAAW,CACnB,GACA,aAAc,IAAM,UACpB,MAAM,CAAC,MAAAC,CAAK,EAAG,CACb,MAAO,CACL,IAAK,MACL,KAAM,SACN,GAAGA,CACL,CACF,EACA,OAAQ,CACN,UAAW,CAAC,EACZ,QAAS,CACP,GAAI,CACF,QAAS,CACP,QAAS,CAAC,iBAAiB,EAC3B,OAAQ,WACV,CACF,CACF,CACF,CACF,CAAC,ECpCH,OAAQ,eAAAC,EAAa,oBAAAC,MAAuB,4BAIrC,IAAMC,EACXF,EAAwC,EACtC,MACA,cACA,YACA,MACF,EAEWG,EAOTF,EAA6CC,CAAuB",
6
+ "names": ["ariaAttr", "domIds", "scope", "createInlineNotificationApi", "machine", "normalize", "prop", "scope", "send", "state", "visible", "commonBindings", "props", "event", "ariaAttr", "domIds", "createMachine", "inlineNotificationMachine", "prop", "bindableId", "props", "createProps", "createSplitProps", "inlineNotificationProps", "splitInlineNotificationProps"]
7
7
  }
@@ -1 +1 @@
1
- {"version":3,"file":"inline-notification.api.d.ts","sourceRoot":"","sources":["../../src/inline-notification/inline-notification.api.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAEV,OAAO,EACP,cAAc,EACf,MAAM,4BAA4B,CAAA;AAEnC,OAAO,KAAK,EAEV,qBAAqB,EAOrB,wBAAwB,EACzB,MAAM,6BAA6B,CAAA;AAGpC,wBAAgB,2BAA2B,CACzC,OAAO,EAAE,OAAO,CAAC,wBAAwB,CAAC,EAC1C,SAAS,EAAE,cAAc,GACxB,qBAAqB,CA6EvB"}
1
+ {"version":3,"file":"inline-notification.api.d.ts","sourceRoot":"","sources":["../../src/inline-notification/inline-notification.api.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAEV,OAAO,EACP,cAAc,EACf,MAAM,4BAA4B,CAAA;AAEnC,OAAO,KAAK,EAEV,qBAAqB,EAOrB,wBAAwB,EACzB,MAAM,6BAA6B,CAAA;AAGpC,wBAAgB,2BAA2B,CACzC,OAAO,EAAE,OAAO,CAAC,wBAAwB,CAAC,EAC1C,SAAS,EAAE,cAAc,GACxB,qBAAqB,CA6EvB"}
@@ -1,2 +1,2 @@
1
- "use strict";var P=Object.defineProperty;var V=Object.getOwnPropertyDescriptor;var E=Object.getOwnPropertyNames;var h=Object.prototype.hasOwnProperty;var B=(t,e)=>{for(var u in e)P(t,u,{get:e[u],enumerable:!0})},C=(t,e,u,p)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of E(e))!h.call(t,i)&&i!==u&&P(t,i,{get:()=>e[i],enumerable:!(p=V(e,i))||p.enumerable});return t};var x=t=>C(P({},"__esModule",{value:!0}),t);var U={};B(U,{createPasswordInputApi:()=>A,passwordInputMachine:()=>F,splitPasswordInputProps:()=>R});module.exports=x(U);var T=require("@qualcomm-ui/dom/focus-visible"),r=require("@qualcomm-ui/utils/attributes");var a={errorText:t=>t.ids.get("errorText"),hint:t=>t.ids.get("hint"),input:t=>t.ids.get("input"),label:t=>t.ids.get("label"),visibilityTrigger:t=>t.ids.get("visibilityTrigger")},y={errorText:t=>t.getById(a.errorText(t)),hint:t=>t.getById(a.hint(t)),input:t=>t.getById(a.input(t)),label:t=>t.getById(a.label(t)),visibilityTrigger:t=>t.getById(a.visibilityTrigger(t))};var l={"data-scope":"password-input"};function A(t,e){let{computed:u,context:p,prop:i,scope:o,send:d}=t,n=u("disabled"),b=p.get("focused"),g=i("invalid"),c=i("readOnly"),w=!(c||n),I=p.get("visible");return{disabled:n,focusInput(){d({type:"INPUT.FOCUS"})},invalid:g,required:i("required"),setValue(s){d({type:"VALUE.SET",value:s})},setVisible(s){d({type:"VISIBILITY.SET",visible:s})},toggleVisible(){d({type:"VISIBILITY.SET",visible:!I})},value:p.get("value"),visible:I,getClearTriggerBindings(){return e.button({...l,"aria-label":"Clear input","data-disabled":(0,r.booleanDataAttr)(n),"data-part":"clear-trigger",dir:i("dir"),disabled:n,onClick:s=>{!w||s.defaultPrevented||d({type:"VALUE.SET",value:""})}})},getErrorIndicatorBindings(){return e.element({...l,"aria-label":"Error","data-part":"error-indicator",dir:i("dir"),hidden:!i("invalid")})},getErrorTextBindings(s){return o.ids.register("errorText",s),e.element({...l,"aria-live":"polite","data-part":"error-text",dir:i("dir"),hidden:!g,id:a.errorText(o)})},getHintBindings(s){return o.ids.register("hint",s),e.element({...l,"data-disabled":(0,r.booleanDataAttr)(n),"data-part":"hint",dir:i("dir"),id:a.hint(o)})},getInputBindings(s){return o.ids.register("input",s),e.input({...l,"aria-describedby":a.hint(o),"aria-invalid":(0,r.booleanAriaAttr)(g),"aria-labelledby":(0,r.mergeAriaIds)(a.label(o),g?a.errorText(o):void 0),autoComplete:i("autoComplete"),autoCorrect:"off","data-empty":(0,r.booleanDataAttr)(!p.get("value")),"data-focus":(0,r.booleanDataAttr)(b),"data-invalid":(0,r.booleanDataAttr)(g),"data-part":"input","data-readonly":(0,r.booleanDataAttr)(c),"data-state":I?"visible":"hidden",dir:i("dir"),disabled:n,form:i("form"),id:a.input(o),name:i("name"),onBlur:()=>{d({focused:!1,focusVisible:!1,type:"FOCUSED.SET"})},onChange:f=>{d({type:"VALUE.SET",value:f.target.value})},onFocus:()=>{let f=(0,T.isFocusVisible)();d({focused:!0,focusVisible:f,type:"FOCUSED.SET"})},readOnly:c,required:i("required"),spellCheck:"false",type:I?"text":"password",value:p.get("value")})},getInputGroupBindings(){return e.element({...l,"data-disabled":(0,r.booleanDataAttr)(n),"data-focus":(0,r.booleanDataAttr)(b),"data-invalid":(0,r.booleanDataAttr)(g),"data-part":"input-group","data-readonly":(0,r.booleanDataAttr)(c),dir:i("dir"),onClick:s=>{s.defaultPrevented||n||d({type:"INPUT.FOCUS"})}})},getLabelBindings(s){return o.ids.register("label",s),e.label({...l,"data-disabled":(0,r.booleanDataAttr)(n),"data-focus":(0,r.booleanDataAttr)(b),"data-invalid":(0,r.booleanDataAttr)(g),"data-part":"label",dir:i("dir"),htmlFor:a.input(o),id:a.label(o)})},getRootBindings(){return e.element({...l,"data-disabled":(0,r.booleanDataAttr)(n),"data-focus":(0,r.booleanDataAttr)(b),"data-invalid":(0,r.booleanDataAttr)(g),"data-part":"root",dir:i("dir")})},getVisibilityTriggerBindings(s){return o.ids.register("visibilityTrigger",s),e.button({...l,"aria-controls":a.input(o),"aria-expanded":(0,r.booleanAriaAttr)(I),"aria-label":i("translations")?.visibilityTrigger?.(I)||"Toggle visibility","data-disabled":(0,r.booleanDataAttr)(n),"data-part":"visibility-trigger","data-readonly":(0,r.booleanDataAttr)(c),"data-state":I?"visible":"hidden",dir:i("dir"),disabled:n,id:a.visibilityTrigger(o),onPointerDown(f){f.defaultPrevented||!w||d({type:"TRIGGER.CLICK"})},tabIndex:-1,type:"button"})}}}var v=require("@qualcomm-ui/dom/query"),S=require("@qualcomm-ui/utils/machine");var F=(0,S.createMachine)({actions:{focusInputEl({computed:t,scope:e}){t("disabled")||y.input(e)?.focus()},setFocused({context:t,event:e}){e.type==="FOCUSED.SET"&&(t.set("focused",e.focused),t.set("focusVisible",e.focusVisible))},setValue:({context:t,event:e})=>{e.type==="VALUE.SET"&&t.set("value",e.value)},setVisibility({context:t,event:e}){e.type==="VISIBILITY.SET"&&t.set("visible",e.visible)},toggleVisibility({context:t}){t.set("visible",e=>!e)}},computed:{disabled:({context:t,prop:e})=>e("disabled")||t.get("fieldsetDisabled")},context:({bindable:t,prop:e})=>({fieldsetDisabled:t(()=>({defaultValue:!1})),focused:t(()=>({defaultValue:!1,onChange:e("onFocusChange")})),focusVisible:t(()=>({defaultValue:!1})),ssr:t(()=>({defaultValue:!0})),value:t(()=>({defaultValue:e("defaultValue"),onChange:e("onValueChange"),value:e("value")})),visible:t(()=>({defaultValue:e("defaultVisible"),onChange:e("onVisibleChange"),value:e("visible")}))}),effects:{syncSsr({context:t}){t.set("ssr",!1)},trackFormControlState({context:t,scope:e}){return(0,v.trackFormControl)(y.input(e),{onFieldsetDisabledChange:u=>{t.set("fieldsetDisabled",u)},onFormReset:()=>{t.set("value",t.initial("value")||"")}})}},ids:({bindableId:t,ids:e})=>({errorText:t(e?.errorText),hint:t(e?.hint),input:t(e?.input),label:t(e?.label),visibilityTrigger:t(e?.visibilityTrigger)}),initialState:()=>"idle",onInit:{effects:["syncSsr"]},props({props:t}){return{autoComplete:"current-password",defaultValue:"",defaultVisible:!1,dir:"ltr",translations:{visibilityTrigger:e=>e?"Hide password":"Show password"},...t}},states:{idle:{on:{"FOCUSED.SET":{actions:["setFocused"]},"INPUT.FOCUS":{actions:["focusInputEl"]},"TRIGGER.CLICK":{actions:["toggleVisibility","focusInputEl"]},"VALUE.SET":{actions:["setValue"]},"VISIBILITY.SET":{actions:["setVisibility"]}}}}});var m=require("@qualcomm-ui/utils/object"),L=(0,m.createProps)()("autoComplete","defaultValue","defaultVisible","dir","disabled","getRootNode","form","ids","invalid","name","onFocusChange","onValueChange","onVisibleChange","readOnly","required","translations","value","visible"),R=(0,m.createSplitProps)(L);
1
+ "use strict";var P=Object.defineProperty;var V=Object.getOwnPropertyDescriptor;var E=Object.getOwnPropertyNames;var h=Object.prototype.hasOwnProperty;var B=(t,e)=>{for(var u in e)P(t,u,{get:e[u],enumerable:!0})},C=(t,e,u,p)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of E(e))!h.call(t,r)&&r!==u&&P(t,r,{get:()=>e[r],enumerable:!(p=V(e,r))||p.enumerable});return t};var x=t=>C(P({},"__esModule",{value:!0}),t);var U={};B(U,{createPasswordInputApi:()=>A,passwordInputMachine:()=>F,splitPasswordInputProps:()=>R});module.exports=x(U);var T=require("@qualcomm-ui/dom/focus-visible"),i=require("@qualcomm-ui/utils/attributes");var a={errorText:t=>t.ids.get("errorText"),hint:t=>t.ids.get("hint"),input:t=>t.ids.get("input"),label:t=>t.ids.get("label"),visibilityTrigger:t=>t.ids.get("visibilityTrigger")},y={errorText:t=>t.getById(a.errorText(t)),hint:t=>t.getById(a.hint(t)),input:t=>t.getById(a.input(t)),label:t=>t.getById(a.label(t)),visibilityTrigger:t=>t.getById(a.visibilityTrigger(t))};var l={"data-scope":"password-input"};function A(t,e){let{computed:u,context:p,prop:r,scope:o,send:d}=t,n=u("disabled"),b=p.get("focused"),g=r("invalid"),c=r("readOnly"),w=!(c||n),I=p.get("visible");return{disabled:n,focusInput(){d({type:"INPUT.FOCUS"})},invalid:g,required:r("required"),setValue(s){d({type:"VALUE.SET",value:s})},setVisible(s){d({type:"VISIBILITY.SET",visible:s})},toggleVisible(){d({type:"VISIBILITY.SET",visible:!I})},value:p.get("value"),visible:I,getClearTriggerBindings(){return e.button({...l,"aria-label":"Clear input","data-disabled":(0,i.booleanDataAttr)(n),"data-part":"clear-trigger",dir:r("dir"),disabled:n,onClick:s=>{!w||s.defaultPrevented||d({type:"VALUE.SET",value:""})}})},getErrorIndicatorBindings(){return e.element({...l,"aria-label":"Error","data-part":"error-indicator",dir:r("dir"),hidden:!r("invalid")})},getErrorTextBindings(s){return o.ids.register("errorText",s),e.element({...l,"aria-live":"polite","data-part":"error-text",dir:r("dir"),hidden:!g,id:a.errorText(o)})},getHintBindings(s){return o.ids.register("hint",s),e.element({...l,"data-disabled":(0,i.booleanDataAttr)(n),"data-part":"hint",dir:r("dir"),id:a.hint(o)})},getInputBindings(s){return o.ids.register("input",s),e.input({...l,"aria-describedby":(0,i.ariaAttr)(a.hint(o)),"aria-invalid":(0,i.booleanAriaAttr)(g),"aria-labelledby":(0,i.mergeAriaIds)(a.label(o),g?a.errorText(o):void 0),autoComplete:r("autoComplete"),autoCorrect:"off","data-empty":(0,i.booleanDataAttr)(!p.get("value")),"data-focus":(0,i.booleanDataAttr)(b),"data-invalid":(0,i.booleanDataAttr)(g),"data-part":"input","data-readonly":(0,i.booleanDataAttr)(c),"data-state":I?"visible":"hidden",dir:r("dir"),disabled:n,form:r("form"),id:a.input(o),name:r("name"),onBlur:()=>{d({focused:!1,focusVisible:!1,type:"FOCUSED.SET"})},onChange:f=>{d({type:"VALUE.SET",value:f.target.value})},onFocus:()=>{let f=(0,T.isFocusVisible)();d({focused:!0,focusVisible:f,type:"FOCUSED.SET"})},readOnly:c,required:r("required"),spellCheck:"false",type:I?"text":"password",value:p.get("value")})},getInputGroupBindings(){return e.element({...l,"data-disabled":(0,i.booleanDataAttr)(n),"data-focus":(0,i.booleanDataAttr)(b),"data-invalid":(0,i.booleanDataAttr)(g),"data-part":"input-group","data-readonly":(0,i.booleanDataAttr)(c),dir:r("dir"),onClick:s=>{s.defaultPrevented||n||d({type:"INPUT.FOCUS"})}})},getLabelBindings(s){return o.ids.register("label",s),e.label({...l,"data-disabled":(0,i.booleanDataAttr)(n),"data-focus":(0,i.booleanDataAttr)(b),"data-invalid":(0,i.booleanDataAttr)(g),"data-part":"label",dir:r("dir"),htmlFor:a.input(o),id:a.label(o)})},getRootBindings(){return e.element({...l,"data-disabled":(0,i.booleanDataAttr)(n),"data-focus":(0,i.booleanDataAttr)(b),"data-invalid":(0,i.booleanDataAttr)(g),"data-part":"root",dir:r("dir")})},getVisibilityTriggerBindings(s){return o.ids.register("visibilityTrigger",s),e.button({...l,"aria-controls":a.input(o),"aria-expanded":(0,i.booleanAriaAttr)(I),"aria-label":r("translations")?.visibilityTrigger?.(I)||"Toggle visibility","data-disabled":(0,i.booleanDataAttr)(n),"data-part":"visibility-trigger","data-readonly":(0,i.booleanDataAttr)(c),"data-state":I?"visible":"hidden",dir:r("dir"),disabled:n,id:a.visibilityTrigger(o),onPointerDown(f){f.defaultPrevented||!w||d({type:"TRIGGER.CLICK"})},tabIndex:-1,type:"button"})}}}var v=require("@qualcomm-ui/dom/query"),S=require("@qualcomm-ui/utils/machine");var F=(0,S.createMachine)({actions:{focusInputEl({computed:t,scope:e}){t("disabled")||y.input(e)?.focus()},setFocused({context:t,event:e}){e.type==="FOCUSED.SET"&&(t.set("focused",e.focused),t.set("focusVisible",e.focusVisible))},setValue:({context:t,event:e})=>{e.type==="VALUE.SET"&&t.set("value",e.value)},setVisibility({context:t,event:e}){e.type==="VISIBILITY.SET"&&t.set("visible",e.visible)},toggleVisibility({context:t}){t.set("visible",e=>!e)}},computed:{disabled:({context:t,prop:e})=>e("disabled")||t.get("fieldsetDisabled")},context:({bindable:t,prop:e})=>({fieldsetDisabled:t(()=>({defaultValue:!1})),focused:t(()=>({defaultValue:!1,onChange:e("onFocusChange")})),focusVisible:t(()=>({defaultValue:!1})),ssr:t(()=>({defaultValue:!0})),value:t(()=>({defaultValue:e("defaultValue"),onChange:e("onValueChange"),value:e("value")})),visible:t(()=>({defaultValue:e("defaultVisible"),onChange:e("onVisibleChange"),value:e("visible")}))}),effects:{syncSsr({context:t}){t.set("ssr",!1)},trackFormControlState({context:t,scope:e}){return(0,v.trackFormControl)(y.input(e),{onFieldsetDisabledChange:u=>{t.set("fieldsetDisabled",u)},onFormReset:()=>{t.set("value",t.initial("value")||"")}})}},ids:({bindableId:t,ids:e})=>({errorText:t(e?.errorText),hint:t(e?.hint),input:t(e?.input),label:t(e?.label),visibilityTrigger:t(e?.visibilityTrigger)}),initialState:()=>"idle",onInit:{effects:["syncSsr"]},props({props:t}){return{autoComplete:"current-password",defaultValue:"",defaultVisible:!1,dir:"ltr",translations:{visibilityTrigger:e=>e?"Hide password":"Show password"},...t}},states:{idle:{on:{"FOCUSED.SET":{actions:["setFocused"]},"INPUT.FOCUS":{actions:["focusInputEl"]},"TRIGGER.CLICK":{actions:["toggleVisibility","focusInputEl"]},"VALUE.SET":{actions:["setValue"]},"VISIBILITY.SET":{actions:["setVisibility"]}}}}});var m=require("@qualcomm-ui/utils/object"),L=(0,m.createProps)()("autoComplete","defaultValue","defaultVisible","dir","disabled","getRootNode","form","ids","invalid","name","onFocusChange","onValueChange","onVisibleChange","readOnly","required","translations","value","visible"),R=(0,m.createSplitProps)(L);
2
2
  //# sourceMappingURL=index.cjs.map