{"version":3,"file":"segmented.module.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":[],"mappings":";;AAAA,MAAM,MAAM,GAAG;AACf,EAAE,MAAM,EAAE,IAAI;AACd,EAAE,SAAS,EAAE,MAAM;AACnB,EAAE,YAAY,EAAE,SAAS;AACzB,EAAE,OAAO,EAAE,QAAQ;AACnB,CAAC;;ACJD,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC;;ACC7B,MAAM,iBAAiB,GAAG;AACjC,EAAE,SAAS,EAAE,GAAG,CA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