1 line
9.7 KiB
Text
1 line
9.7 KiB
Text
|
{"version":3,"file":"tooltip.nomodule.min.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.Place
|