1 line
No EOL
5.9 KiB
Text
1 line
No EOL
5.9 KiB
Text
{"version":3,"file":"segmented.nomodule.min.js","sources":["../../../.config/config.js","../../../src/core/api.js","../../../src/component/segmented/script/segmented/segmented-selector.js","../../../src/component/segmented/script/segmented/segmented-emission.js","../../../src/component/segmented/script/segmented/segmented.js","../../../src/component/segmented/script/segmented/segmented-element.js","../../../src/component/segmented/index.js","../../../src/component/segmented/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 SegmentedSelector = {\n SEGMENTED: api.internals.ns.selector('segmented'),\n SEGMENTED_ELEMENTS: api.internals.ns.selector('segmented__elements'),\n SEGMENTED_ELEMENT: api.internals.ns.selector('segmented__element input'),\n SEGMENTED_LEGEND: api.internals.ns.selector('segmented__legend')\n};\n","import api from '../../api.js';\n\nconst SegmentedEmission = {\n ADDED: api.internals.ns.emission('segmented', 'added'),\n REMOVED: api.internals.ns.emission('segmented', 'removed')\n};\n\nexport { SegmentedEmission };\n","import api from '../../api.js';\nimport { SegmentedSelector } from './segmented-selector.js';\nimport { SegmentedEmission } from './segmented-emission.js';\n\nclass Segmented extends api.core.Instance {\n static get instanceClassName () {\n return 'Segmented';\n }\n\n init () {\n this.elements = this.node.querySelector(SegmentedSelector.SEGMENTED_ELEMENTS);\n this.legend = this.node.querySelector(SegmentedSelector.SEGMENTED_LEGEND);\n this.addAscent(SegmentedEmission.ADDED, this.resize.bind(this));\n this.addAscent(SegmentedEmission.REMOVED, this.resize.bind(this));\n this._isLegendInline = this.legend && this.legend.classList.contains(`${api.prefix}-segmented__legend--inline`);\n this.isResizing = true;\n }\n\n resize () {\n const SEGMENTED_VERTICAL = `${api.prefix}-segmented--vertical`;\n const LEGEND_INLINE = `${api.prefix}-segmented__legend--inline`;\n const gapOffset = 16;\n\n this.removeClass(SEGMENTED_VERTICAL);\n\n if (this._isLegendInline) {\n this.legend.classList.add(LEGEND_INLINE);\n\n if (this.node.offsetWidth > this.node.parentNode.offsetWidth || (this.elements.scrollWidth + this.legend.offsetWidth + gapOffset) > this.node.parentNode.offsetWidth) {\n this.legend.classList.remove(LEGEND_INLINE);\n }\n }\n\n if (this.elements.offsetWidth > this.node.parentNode.offsetWidth || this.elements.scrollWidth > this.node.parentNode.offsetWidth) {\n this.addClass(SEGMENTED_VERTICAL);\n } else {\n this.removeClass(SEGMENTED_VERTICAL);\n }\n }\n}\n\nexport { Segmented };\n","import api from '../../api.js';\nimport { SegmentedEmission } from './segmented-emission.js';\n\nclass SegmentedElement extends api.core.Instance {\n static get instanceClassName () {\n return 'SegmentedElement';\n }\n\n init () {\n this.ascend(SegmentedEmission.ADDED);\n }\n\n dispose () {\n this.ascend(SegmentedEmission.REMOVED);\n }\n}\n\nexport { SegmentedElement };\n","import api from './api.js';\nimport { Segmented } from './script/segmented/segmented.js';\nimport { SegmentedElement } from './script/segmented/segmented-element.js';\nimport { SegmentedSelector } from './script/segmented/segmented-selector.js';\nimport { SegmentedEmission } from './script/segmented/segmented-emission.js';\n\napi.segmented = {\n SegmentedSelector: SegmentedSelector,\n SegmentedEmission: SegmentedEmission,\n SegmentedElement: SegmentedElement,\n Segmented: Segmented\n};\n\nexport default api;\n","import api from './index.js';\n\napi.internals.register(api.segmented.SegmentedSelector.SEGMENTED, api.segmented.Segmented);\napi.internals.register(api.segmented.SegmentedSelector.SEGMENTED_ELEMENT, api.segmented.SegmentedElement);\n\nexport default api;\n"],"names":["const","api","window","SegmentedSelector","SEGMENTED","internals","ns","selector","SEGMENTED_ELEMENTS","SEGMENTED_ELEMENT","SEGMENTED_LEGEND","SegmentedEmission","ADDED","emission","REMOVED","Segmented","staticAccessors","instanceClassName","init","this","elements","node","querySelector","legend","addAscent","resize","bind","_isLegendInline","classList","contains","isResizing","SEGMENTED_VERTICAL","LEGEND_INLINE","removeClass","add","offsetWidth","parentNode","scrollWidth","remove","addClass","core","Instance","SegmentedElement","ascend","dispose","segmented","register"],"mappings":";yBAAAA,ICCMC,EAAMC,OAAuB,KCCtBC,EAAoB,CAC/BC,UAAWH,EAAII,UAAUC,GAAGC,SAAS,aACrCC,mBAAoBP,EAAII,UAAUC,GAAGC,SAAS,uBAC9CE,kBAAmBR,EAAII,UAAUC,GAAGC,SAAS,4BAC7CG,iBAAkBT,EAAII,UAAUC,GAAGC,SAAS,sBCJxCI,EAAoB,CACxBC,MAAOX,EAAII,UAAUC,GAAGO,SAAS,YAAa,SAC9CC,QAASb,EAAII,UAAUC,GAAGO,SAAS,YAAa,YCA5CE,6LACJC,EAAWC,iCACT,MAAO,yBAGTC,gBACEC,KAAKC,SAAWD,KAAKE,KAAKC,cAAcnB,EAAkBK,oBAC1DW,KAAKI,OAASJ,KAAKE,KAAKC,cAAcnB,EAAkBO,kBACxDS,KAAKK,UAAUb,EAAkBC,MAAOO,KAAKM,OAAOC,KAAKP,OACzDA,KAAKK,UAAUb,EAAkBG,QAASK,KAAKM,OAAOC,KAAKP,OAC3DA,KAAKQ,gBAAkBR,KAAKI,QAAUJ,KAAKI,OAAOK,UAAUC,SAAY5B,uCACxEkB,KAAKW,YAAa,eAGpBL,kBACEzB,IAAM+B,EAAwB9B,gCACxB+B,EAAmB/B,sCAGzBkB,KAAKc,YAAYF,GAEbZ,KAAKQ,kBACPR,KAAKI,OAAOK,UAAUM,IAAIF,IAEtBb,KAAKE,KAAKc,YAAchB,KAAKE,KAAKe,WAAWD,aAAgBhB,KAAKC,SAASiB,YAAclB,KAAKI,OAAOY,YAPzF,GAOoHhB,KAAKE,KAAKe,WAAWD,cACvJhB,KAAKI,OAAOK,UAAUU,OAAON,IAI7Bb,KAAKC,SAASe,YAAchB,KAAKE,KAAKe,WAAWD,aAAehB,KAAKC,SAASiB,YAAclB,KAAKE,KAAKe,WAAWD,YACnHhB,KAAKoB,SAASR,GAEdZ,KAAKc,YAAYF,oC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