TP_JO2024/home/dist/component/tooltip/tooltip.nomodule.js.map
2024-03-27 17:19:37 +01:00

1 line
No EOL
12 KiB
Text

{"version":3,"file":"tooltip.nomodule.js","sources":["../../../.config/config.js","../../../src/core/api.js","../../../src/component/tooltip/script/tooltip/tooltip-selector.js","../../../src/component/tooltip/script/tooltip/tooltip-referent.js","../../../src/core/script/api/utilities/namespace.js","../../../src/component/tooltip/script/tooltip/tooltip-event.js","../../../src/component/tooltip/script/tooltip/tooltip.js","../../../src/component/tooltip/index.js","../../../src/component/tooltip/main.js"],"sourcesContent":["const config = {\r\n prefix: 'fr',\r\n namespace: 'dsfr',\r\n organisation: '@gouvfr',\r\n version: '1.11.2'\r\n};\r\n\r\nexport default config;\r\n","import config from './config.js';\nconst api = window[config.namespace];\nexport default api;\n","import api from '../../api.js';\n\nexport const TooltipSelector = {\n TOOLTIP: api.internals.ns.selector('tooltip'),\n SHOWN: api.internals.ns.selector('tooltip--shown'),\n BUTTON: api.internals.ns.selector('btn--tooltip')\n};\n","import api from '../../api.js';\nimport { TooltipSelector } from './tooltip-selector';\n\nconst TooltipReferentState = {\n FOCUS: 1 << 0,\n HOVER: 1 << 1\n};\n\nclass TooltipReferent extends api.core.PlacementReferent {\n constructor () {\n super();\n this._state = 0;\n }\n\n static get instanceClassName () {\n return 'TooltipReferent';\n }\n\n init () {\n super.init();\n this.listen('focusin', this.focusIn.bind(this));\n this.listen('focusout', this.focusOut.bind(this));\n if (!this.matches(TooltipSelector.BUTTON)) {\n const mouseover = this.mouseover.bind(this);\n this.listen('mouseover', mouseover);\n this.placement.listen('mouseover', mouseover);\n const mouseout = this.mouseout.bind(this);\n this.listen('mouseout', mouseout);\n this.placement.listen('mouseout', mouseout);\n }\n this.addEmission(api.core.RootEmission.KEYDOWN, this._keydown.bind(this));\n this.listen('click', this._click.bind(this));\n this.addEmission(api.core.RootEmission.CLICK, this._clickOut.bind(this));\n }\n\n _click () {\n this.focus();\n }\n\n _clickOut (target) {\n if (!this.node.contains(target)) this.blur();\n }\n\n _keydown (keyCode) {\n switch (keyCode) {\n case api.core.KeyCodes.ESCAPE:\n this.blur();\n this.close();\n break;\n }\n }\n\n close () {\n this.state = 0;\n }\n\n get state () {\n return this._state;\n }\n\n set state (value) {\n if (this._state === value) return;\n this.isShown = value > 0;\n this._state = value;\n }\n\n focusIn () {\n this.state |= TooltipReferentState.FOCUS;\n }\n\n focusOut () {\n this.state &= ~TooltipReferentState.FOCUS;\n }\n\n mouseover () {\n this.state |= TooltipReferentState.HOVER;\n }\n\n mouseout () {\n this.state &= ~TooltipReferentState.HOVER;\n }\n}\n\nexport { TooltipReferent };\n","import config from '../../../config.js';\n\nconst ns = name => `${config.prefix}-${name}`;\n\nns.selector = (name, notation) => {\n if (notation === undefined) notation = '.';\n return `${notation}${ns(name)}`;\n};\n\nns.attr = (name) => `data-${ns(name)}`;\n\nns.attr.selector = (name, value) => {\n let result = ns.attr(name);\n if (value !== undefined) result += `=\"${value}\"`;\n return `[${result}]`;\n};\n\nns.event = (type) => `${config.namespace}.${type}`;\n\nns.emission = (domain, type) => `emission:${domain}.${type}`;\n\nexport default ns;\n","import ns from '../../../../core/script/api/utilities/namespace.js';\n\nconst TooltipEvent = {\n SHOW: ns.event('show'),\n HIDE: ns.event('hide')\n};\n\nexport { TooltipEvent };\n","import api from '../../api.js';\nimport { TooltipReferent } from './tooltip-referent';\nimport { TooltipSelector } from './tooltip-selector';\nimport { TooltipEvent } from './tooltip-event.js';\n\nconst TooltipState = {\n HIDDEN: 'hidden',\n SHOWN: 'shown',\n HIDING: 'hiding'\n};\n\nclass Tooltip extends api.core.Placement {\n constructor () {\n super(api.core.PlacementMode.AUTO, [api.core.PlacementPosition.TOP, api.core.PlacementPosition.BOTTOM], [api.core.PlacementAlign.CENTER, api.core.PlacementAlign.START, api.core.PlacementAlign.END]);\n this.modifier = '';\n this._state = TooltipState.HIDDEN;\n }\n\n static get instanceClassName () {\n return 'Tooltip';\n }\n\n init () {\n super.init();\n this.register(`[aria-describedby=\"${this.id}\"]`, TooltipReferent);\n this.listen('transitionend', this.transitionEnd.bind(this));\n }\n\n transitionEnd () {\n if (this._state === TooltipState.HIDING) {\n this._state = TooltipState.HIDDEN;\n this.isShown = false;\n }\n }\n\n get isShown () {\n return super.isShown;\n }\n\n set isShown (value) {\n if (!this.isEnabled) return;\n switch (true) {\n case value:\n this._state = TooltipState.SHOWN;\n this.addClass(TooltipSelector.SHOWN);\n this.dispatch(TooltipEvent.SHOW);\n super.isShown = true;\n break;\n\n case this.isShown && !value && this._state === TooltipState.SHOWN:\n this._state = TooltipState.HIDING;\n this.removeClass(TooltipSelector.SHOWN);\n break;\n\n case this.isShown && !value && this._state === TooltipState.HIDDEN:\n this.dispatch(TooltipEvent.HIDE);\n super.isShown = false;\n break;\n }\n }\n\n render () {\n super.render();\n let x = this.referentRect.center - this.rect.center;\n const limit = this.rect.width * 0.5 - 8;\n if (x < -limit) x = -limit;\n if (x > limit) x = limit;\n this.setProperty('--arrow-x', `${x.toFixed(2)}px`);\n }\n}\n\nexport { Tooltip };\n","import api from './api.js';\nimport { Tooltip } from './script/tooltip/tooltip.js';\nimport { TooltipSelector } from './script/tooltip/tooltip-selector.js';\nimport { TooltipEvent } from './script/tooltip/tooltip-event';\n\napi.tooltip = {\n Tooltip: Tooltip,\n TooltipSelector: TooltipSelector,\n TooltipEvent: TooltipEvent\n};\n\nexport default api;\n","import api from './index.js';\n\napi.internals.register(api.tooltip.TooltipSelector.TOOLTIP, api.tooltip.Tooltip);\n\nexport default api;\n"],"names":["const","super","let"],"mappings":";;;;;EAAAA,IAAM,MAAM,GAAG;EACf,EAAE,MAAM,EAAE,IAAI;EACd,EAAE,SAAS,EAAE,MAAM;EACnB,EAAE,YAAY,EAAE,SAAS;EACzB,EAAE,OAAO,EAAE,QAAQ;EACnB,CAAC;;ECJDA,IAAM,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC;;ECC7BA,IAAM,eAAe,GAAG;EAC/B,EAAE,OAAO,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