@infineon/infineon-design-system-stencil 35.3.0--canary.1921.e5a0855012d7c07d80effbc06e6a380d4a6e43d9.0 → 35.3.0--canary.1921.fedfabbd84b997ca6a665946264f8e5a0caa1ac7.0

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.
Files changed (44) hide show
  1. package/dist/cjs/{ifx-select.cjs.entry.js → ifx-accordion_5.cjs.entry.js} +337 -1
  2. package/dist/cjs/ifx-accordion_5.cjs.entry.js.map +1 -0
  3. package/dist/cjs/index-7f4df11a.js +4 -16
  4. package/dist/cjs/infineon-design-system-stencil.cjs.js +1 -1
  5. package/dist/cjs/loader.cjs.js +1 -1
  6. package/dist/collection/components/accordion/accordionItem.css +1 -2
  7. package/dist/collection/components/accordion/accordionItem.js +5 -8
  8. package/dist/collection/components/accordion/accordionItem.js.map +1 -1
  9. package/dist/components/ifx-accordion-item.js +1 -1
  10. package/dist/components/ifx-faq.js +1 -1
  11. package/dist/components/{p-7df26dbf.js → p-33b13938.js} +7 -10
  12. package/dist/components/p-33b13938.js.map +1 -0
  13. package/dist/esm/{ifx-select.entry.js → ifx-accordion_5.entry.js} +335 -3
  14. package/dist/esm/ifx-accordion_5.entry.js.map +1 -0
  15. package/dist/esm/index-6c9eba32.js +4 -16
  16. package/dist/esm/infineon-design-system-stencil.js +1 -1
  17. package/dist/esm/loader.js +1 -1
  18. package/dist/infineon-design-system-stencil/infineon-design-system-stencil.esm.js +1 -1
  19. package/dist/infineon-design-system-stencil/infineon-design-system-stencil.esm.js.map +1 -1
  20. package/dist/infineon-design-system-stencil/{p-e44ff006.entry.js → p-d253f99f.entry.js} +3 -3
  21. package/dist/infineon-design-system-stencil/p-d253f99f.entry.js.map +1 -0
  22. package/package.json +1 -1
  23. package/dist/cjs/ifx-accordion_2.cjs.entry.js +0 -130
  24. package/dist/cjs/ifx-accordion_2.cjs.entry.js.map +0 -1
  25. package/dist/cjs/ifx-button.cjs.entry.js +0 -139
  26. package/dist/cjs/ifx-button.cjs.entry.js.map +0 -1
  27. package/dist/cjs/ifx-icon.cjs.entry.js +0 -94
  28. package/dist/cjs/ifx-icon.cjs.entry.js.map +0 -1
  29. package/dist/cjs/ifx-select.cjs.entry.js.map +0 -1
  30. package/dist/components/p-7df26dbf.js.map +0 -1
  31. package/dist/esm/ifx-accordion_2.entry.js +0 -125
  32. package/dist/esm/ifx-accordion_2.entry.js.map +0 -1
  33. package/dist/esm/ifx-button.entry.js +0 -135
  34. package/dist/esm/ifx-button.entry.js.map +0 -1
  35. package/dist/esm/ifx-icon.entry.js +0 -90
  36. package/dist/esm/ifx-icon.entry.js.map +0 -1
  37. package/dist/esm/ifx-select.entry.js.map +0 -1
  38. package/dist/infineon-design-system-stencil/p-3d23deba.entry.js +0 -2
  39. package/dist/infineon-design-system-stencil/p-3d23deba.entry.js.map +0 -1
  40. package/dist/infineon-design-system-stencil/p-693b4fde.entry.js +0 -2
  41. package/dist/infineon-design-system-stencil/p-693b4fde.entry.js.map +0 -1
  42. package/dist/infineon-design-system-stencil/p-e44ff006.entry.js.map +0 -1
  43. package/dist/infineon-design-system-stencil/p-edd379d7.entry.js +0 -2
  44. package/dist/infineon-design-system-stencil/p-edd379d7.entry.js.map +0 -1
@@ -1 +0,0 @@
1
- {"file":"p-7df26dbf.js","mappings":";;;AAAA,MAAM,gBAAgB,GAAG,ijCAAijC,CAAC;AAC3kC,+BAAe,gBAAgB;;MCOlB,gBAAgB;IAL7B;;;;;;QAUK,SAAI,GAAY,KAAK,CAAC;QACjB,cAAS,GAAG,CAAC,CAAC;QACb,iBAAY,GAAY,KAAK,CAAC;KAiHxC;IA1GC,iBAAiB;QACf,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC;KAC/B;IAED,gBAAgB;QACd,IAAI,CAAC,iBAAiB,EAAE,CAAA;KACzB;IAED,kBAAkB;QAChB,IAAI,CAAC,iBAAiB,EAAE,CAAA;KACzB;IAKD,WAAW,CAAC,QAA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MAAM,IAAI,CAAC,OAAO,GAAG,EAAiB,CAAC,IAC3M,4EAAkB,MAAM,EAAC,IAAI,EAAC,SAAS,gBAAa,MAAM,CAAC,IAAI,CAAC,SAAS,CAAW,EAAE,KAAK,EAAC,gBAAgB,IAC1G,iEAAU,IAAI,EAAC,iBAAiB,GAAE,CAC7B,EACP,6DAAM,EAAE,EAAC,mBAAmB,EAAC,KAAK,EAAC,mBAAmB,IAAE,IAAI,CAAC,OAAO,CAAQ,CACxE,EACN,4DAAK,EAAE,EAAC,mBAAmB,EAAC,KAAK,EAAC,mBAAmB,EAAC,GAAG,EAAE,CAAC,EAAE,MAAM,IAAI,CAAC,SAAS,GAAG,EAAiB,CAAC,EAAE,IAAI,EAAC,QAAQ,qBAAiB,mBAAmB,IACxJ,4DAAK,KAAK,EAAC,eAAe,IACxB,6DAAM,YAAY,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC,GAAI,CACnD,CACF,CACF,EACN;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/accordion/accordionItem.scss?tag=ifx-accordion-item&encapsulation=shadow","src/components/accordion/accordionItem.tsx"],"sourcesContent":["// ifxAccordionItem.scss\n@use \"~@infineon/design-system-tokens/dist/tokens\";\n@use \"../../global/font.scss\";\n\n\n.accordion-item {\n border-radius: 3px;\n //overflow: hidden;\n transition: all 0.3s;\n font-family: var(--ifx-font-family) // tokens.$ifxFontFamilyBody;\n\n}\n\n.accordion-title:focus {\n outline: none;\n}\n\n// workaround to add corner radius to outline\n.accordion-title:focus::after {\n content: '';\n display: block;\n position: absolute;\n top: -4px;\n bottom: -4px;\n left: -4px;\n right: -4px;\n border-radius: 5px;\n border: 2px solid tokens.$ifxColorOcean500;\n box-sizing: border-box;\n}\n\n.accordion-title:hover {\n border: 1px solid tokens.$ifxColorEngineering200;\n color: tokens.$ifxColorOcean600;\n}\n\n.accordion-title {\n display: flex;\n align-items: center;\n position: relative;\n padding: tokens.$ifxSpace150 tokens.$ifxSpace200;\n gap: tokens.$ifxSpace150;\n color: tokens.$ifxColorOcean500;\n background-color: tokens.$ifxColorBaseWhite;\n border: 1px solid tokens.$ifxColorEngineering200;\n cursor: pointer;\n margin: 4px;\n}\n\n.accordion-caption {\n font-weight: tokens.$ifxFontWeightSemibold;\n font-size: tokens.$ifxFontSizeL;\n}\n\n.accordion-content {\n height: 0;\n transition: height 0.3s ease-in-out;\n line-height: 24px;\n font-size: tokens.$ifxFontSizeM;\n font-weight: 400;\n}\n\n.inner-content {\n background-color: tokens.$ifxColorBaseWhite;\n padding: tokens.$ifxSpace300;\n // white-space: pre-wrap;\n /* wraps text at spaces and within words */\n word-wrap: break-word;\n /* breaks text within a word if necessary */\n overflow-wrap: anywhere;\n align-self: stretch;\n\n /* breaks text at arbitrary points when needed */\n}\n\n.accordion-icon {\n font-weight: bold;\n display: flex;\n transition: transform 0.3s;\n\n &:hover {\n color: tokens.$ifxColorOcean600;\n\n }\n}\n\n\n\n.accordion-item.open .accordion-icon {\n transform: rotate(-180deg);\n}","//ifxAccordionItem\nimport { Component, Prop, h, State, Event, EventEmitter, Watch, Listen, Element } from '@stencil/core';\n\n@Component({\n tag: 'ifx-accordion-item',\n styleUrl: 'accordionItem.scss',\n shadow: true,\n})\nexport class IfxAccordionItem {\n @Element() el;\n @Prop() caption: string;\n @Prop({\n mutable: true,\n }) open: boolean = false;\n @Prop() AriaLevel = 3;\n @State() internalOpen: boolean = false;\n @Event() ifxOpen: EventEmitter;\n @Event() ifxClose: EventEmitter;\n private contentEl!: HTMLElement;\n private titleEl!: HTMLElement;\n\n\n componentWillLoad() {\n this.internalOpen = this.open;\n }\n\n componentDidLoad() {\n this.openAccordionItem()\n }\n\n componentDidUpdate() {\n this.openAccordionItem()\n }\n\n\n\n @Watch('open')\n openChanged(newValue: boolean) {\n this.internalOpen = newValue;\n this.openAccordionItem();\n }\n\n toggleOpen() {\n this.internalOpen = !this.internalOpen;\n this.open = this.internalOpen;\n\n if (this.internalOpen) {\n this.ifxOpen.emit({ isOpen: this.internalOpen });\n } else {\n this.ifxClose.emit({ isClosed: !this.internalOpen });\n }\n this.openAccordionItem();\n }\n\n openAccordionItem() {\n if (this.internalOpen) {\n this.contentEl.style.height = `${this.contentEl.scrollHeight}px`;\n this.contentEl.style.overflow = 'hidden';\n this.contentEl.addEventListener('transitionend', () => {\n this.contentEl.style.overflow = 'visible';\n }, { once: true });\n } else {\n this.contentEl.style.height = '0';\n this.contentEl.style.overflow = 'hidden';\n }\n }\n\n handleSlotChange(e) {\n const slotElement = e.target;\n const nodes = slotElement.assignedNodes();\n \n if(nodes.length > 0) {\n nodes.forEach(node => {\n const observer = new MutationObserver((mutationsList, _) => {\n for(let mutation of mutationsList) {\n if (mutation.type === 'childList') {\n if (this.internalOpen) {\n this.openAccordionItem();\n }\n }\n }\n });\n observer.observe(node, { attributes: true, childList: true, subtree: true });\n });\n }\n\n if (this.internalOpen) {\n this.openAccordionItem();\n }\n }\n\n \n\n @Listen('keydown')\n handleKeydown(ev: KeyboardEvent) {\n const path = ev.composedPath();\n\n if(!path.includes(this.titleEl)) { \n return;\n }\n\n switch (ev.key) {\n case 'Enter': // fallthrough\n case ' ': // space\n ev.preventDefault();\n this.toggleOpen();\n break;\n }\n }\n\n\n render() {\n return (\n <div class={`accordion-item ${this.internalOpen ? 'open' : ''}`}>\n <div role=\"button\" aria-expanded={this.internalOpen} aria-controls=\"accordion-content\" class=\"accordion-title\" onClick={() => this.toggleOpen()} tabindex='0' ref={(el) => (this.titleEl = el as HTMLElement)}>\n <span aria-hidden=\"true\" role=\"heading\" aria-level={String(this.AriaLevel) as string} class=\"accordion-icon\">\n <ifx-icon icon=\"chevron-down-16\"/>\n </span>\n <span id=\"accordion-caption\" class=\"accordion-caption\">{this.caption}</span>\n </div>\n <div id=\"accordion-content\" class=\"accordion-content\" ref={(el) => (this.contentEl = el as HTMLElement)} role=\"region\" aria-labelledby=\"accordion-caption\">\n <div class=\"inner-content\">\n <slot onSlotchange={(e) => this.handleSlotChange(e)} />\n </div>\n </div>\n </div>\n );\n }\n}"],"version":3}
@@ -1,125 +0,0 @@
1
- import { r as registerInstance, h, g as getElement, c as createEvent } from './index-6c9eba32.js';
2
-
3
- const accordionCss = ":root{--ifx-font-family:\"Source Sans 3\", \"Arial, sans-serif\"}:host{display:block}.accordion-wrapper{display:flex;flex-direction:column;gap:8px;font-family:var(--ifx-font-family)}";
4
- const IfxAccordionStyle0 = accordionCss;
5
-
6
- const Accordion = class {
7
- constructor(hostRef) {
8
- registerInstance(this, hostRef);
9
- this.autoCollapse = false;
10
- }
11
- async onItemOpen(event) {
12
- if (this.autoCollapse) {
13
- const items = Array.from(this.el.querySelectorAll('ifx-accordion-item'));
14
- for (const item of items) {
15
- const itemElement = item;
16
- if (itemElement !== event.target && (await itemElement.open)) {
17
- itemElement.open = false;
18
- }
19
- }
20
- }
21
- }
22
- render() {
23
- return (h("div", { key: '663e6aac2f3002d3898856b854dbfd96d9519a68', class: "accordion-wrapper" }, h("slot", { key: '0f54044bc1e0d2860ccd3096ee2711eb0a1cb927' })));
24
- }
25
- static get delegatesFocus() { return true; }
26
- get el() { return getElement(this); }
27
- };
28
- Accordion.style = IfxAccordionStyle0;
29
-
30
- const accordionItemCss = ":root{--ifx-font-family:\"Source Sans 3\", \"Arial, sans-serif\"}.accordion-item{border-radius:3px;transition:all 0.3s;font-family:var(--ifx-font-family)}.accordion-title:focus{outline:none}.accordion-title:focus::after{content:\"\";display:block;position:absolute;top:-4px;bottom:-4px;left:-4px;right:-4px;border-radius:5px;border:2px solid #0A8276;box-sizing:border-box}.accordion-title:hover{border:1px solid #EEEDED;color:#08665C}.accordion-title{display:flex;align-items:center;position:relative;padding:12px 16px;gap:12px;color:#0A8276;background-color:#FFFFFF;border:1px solid #EEEDED;cursor:pointer;margin:4px}.accordion-caption{font-weight:600;font-size:1.125rem}.accordion-content{height:0;transition:height 0.3s ease-in-out;line-height:24px;font-size:1rem;font-weight:400}.inner-content{background-color:#FFFFFF;padding:24px;word-wrap:break-word;overflow-wrap:anywhere;align-self:stretch;}.accordion-icon{font-weight:bold;display:flex;transition:transform 0.3s}.accordion-icon:hover{color:#08665C}.accordion-item.open .accordion-icon{transform:rotate(-180deg)}";
31
- const IfxAccordionItemStyle0 = accordionItemCss;
32
-
33
- const IfxAccordionItem = class {
34
- constructor(hostRef) {
35
- registerInstance(this, hostRef);
36
- this.ifxOpen = createEvent(this, "ifxOpen", 7);
37
- this.ifxClose = createEvent(this, "ifxClose", 7);
38
- this.open = false;
39
- this.AriaLevel = 3;
40
- this.internalOpen = false;
41
- }
42
- componentWillLoad() {
43
- this.internalOpen = this.open;
44
- }
45
- componentDidLoad() {
46
- this.openAccordionItem();
47
- }
48
- componentDidUpdate() {
49
- this.openAccordionItem();
50
- }
51
- openChanged(newValue) {
52
- this.internalOpen = newValue;
53
- this.openAccordionItem();
54
- }
55
- toggleOpen() {
56
- this.internalOpen = !this.internalOpen;
57
- this.open = this.internalOpen;
58
- if (this.internalOpen) {
59
- this.ifxOpen.emit({ isOpen: this.internalOpen });
60
- }
61
- else {
62
- this.ifxClose.emit({ isClosed: !this.internalOpen });
63
- }
64
- this.openAccordionItem();
65
- }
66
- openAccordionItem() {
67
- if (this.internalOpen) {
68
- this.contentEl.style.height = `${this.contentEl.scrollHeight}px`;
69
- this.contentEl.style.overflow = 'hidden';
70
- this.contentEl.addEventListener('transitionend', () => {
71
- this.contentEl.style.overflow = 'visible';
72
- }, { once: true });
73
- }
74
- else {
75
- this.contentEl.style.height = '0';
76
- this.contentEl.style.overflow = 'hidden';
77
- }
78
- }
79
- handleSlotChange(e) {
80
- const slotElement = e.target;
81
- const nodes = slotElement.assignedNodes();
82
- if (nodes.length > 0) {
83
- nodes.forEach(node => {
84
- const observer = new MutationObserver((mutationsList, _) => {
85
- for (let mutation of mutationsList) {
86
- if (mutation.type === 'childList') {
87
- if (this.internalOpen) {
88
- this.openAccordionItem();
89
- }
90
- }
91
- }
92
- });
93
- observer.observe(node, { attributes: true, childList: true, subtree: true });
94
- });
95
- }
96
- if (this.internalOpen) {
97
- this.openAccordionItem();
98
- }
99
- }
100
- handleKeydown(ev) {
101
- const path = ev.composedPath();
102
- if (!path.includes(this.titleEl)) {
103
- return;
104
- }
105
- switch (ev.key) {
106
- case 'Enter': // fallthrough
107
- case ' ': // space
108
- ev.preventDefault();
109
- this.toggleOpen();
110
- break;
111
- }
112
- }
113
- render() {
114
- return (h("div", { key: '69613ca6c0f8f924e4789d91a98d409c8029b57a', class: `accordion-item ${this.internalOpen ? 'open' : ''}` }, h("div", { key: '0bb26905f229dd5b4e5f2aaed93dae957fc5e82d', role: "button", "aria-expanded": this.internalOpen, "aria-controls": "accordion-content", class: "accordion-title", onClick: () => this.toggleOpen(), tabindex: '0', ref: (el) => (this.titleEl = el) }, h("span", { key: '569dfc34c0eb6559207e28477d1da2cc681e07ab', "aria-hidden": "true", role: "heading", "aria-level": String(this.AriaLevel), class: "accordion-icon" }, h("ifx-icon", { key: 'cc337ffc523ecb8b5cb486506daa409368821c5f', icon: "chevron-down-16" })), h("span", { key: '4bdb8433a77c0670262a797b9c1ed2dba996e40c', id: "accordion-caption", class: "accordion-caption" }, this.caption)), h("div", { key: 'e7108cbaa92d4426e1a4f9bd7304297bf0f4b407', id: "accordion-content", class: "accordion-content", ref: (el) => (this.contentEl = el), role: "region", "aria-labelledby": "accordion-caption" }, h("div", { key: '4780c7d7a46de589fb1f21f3af177594be310397', class: "inner-content" }, h("slot", { key: 'd2e576977c607b21d325d99363fa84ec5da92e24', onSlotchange: (e) => this.handleSlotChange(e) })))));
115
- }
116
- get el() { return getElement(this); }
117
- static get watchers() { return {
118
- "open": ["openChanged"]
119
- }; }
120
- };
121
- IfxAccordionItem.style = IfxAccordionItemStyle0;
122
-
123
- export { Accordion as ifx_accordion, IfxAccordionItem as ifx_accordion_item };
124
-
125
- //# sourceMappingURL=ifx-accordion_2.entry.js.map
@@ -1 +0,0 @@
1
- {"file":"if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AAI,EAAC,iBAAiB,GAAE,CAC7B,EACP,6DAAM,EAAE,EAAC,mBAAmB,EAAC,KAAK,EAAC,mBAAmB,IAAE,IAAI,CAAC,OAAO,CAAQ,CACxE,EACN,4DAAK,EAAE,EAAC,mBAAmB,EAAC,KAAK,EAAC,mBAAmB,EAAC,GAAG,EAAE,CAAC,EAAE,MAAM,IAAI,CAAC,SAAS,GAAG,EAAiB,CAAC,EAAE,IAAI,EAAC,QAAQ,qBAAiB,mBAAmB,IACxJ,4DAAK,KAAK,EAAC,eAAe,IACxB,6DAAM,YAAY,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC,GAAI,CACnD,CACF,CACF,EACN;KACH;;;;;;;;;;","names":[],"sources":["src/components/accordion/accordion.scss?tag=ifx-accordion&encapsulation=shadow","src/components/accordion/accordion.tsx","src/components/accordion/accordionItem.scss?tag=ifx-accordion-item&encapsulation=shadow","src/components/accordion/accordionItem.tsx"],"sourcesContent":["// ifxAccordion.scss\n@use \"~@infineon/design-system-tokens/dist/tokens\";\n@use \"../../global/font.scss\";\n\n:host {\n display: block;\n}\n\n.accordion-wrapper {\n display: flex;\n flex-direction: column;\n gap: tokens.$ifxSpace100;\n font-family: var(--ifx-font-family) // tokens.$ifxFontFamilyBody;\n}","//ifxAccordion.tsx\nimport { Component, h, Listen, Element, Prop } from '@stencil/core';\n\n@Component({\n tag: 'ifx-accordion',\n styleUrl: 'accordion.scss',\n shadow: { delegatesFocus: true },\n})\nexport class Accordion {\n @Element() el: HTMLElement;\n @Prop() autoCollapse: boolean = false;\n\n\n @Listen('ifxOpen')\n async onItemOpen(event: CustomEvent) {\n if (this.autoCollapse) {\n const items = Array.from(this.el.querySelectorAll('ifx-accordion-item'));\n for (const item of items) {\n const itemElement = item as HTMLIfxAccordionItemElement;\n if (itemElement !== event.target && (await itemElement.open)) {\n itemElement.open = false;\n }\n }\n }\n }\n\n render() {\n return (\n <div class=\"accordion-wrapper\">\n <slot />\n </div>\n );\n }\n}\n","// ifxAccordionItem.scss\n@use \"~@infineon/design-system-tokens/dist/tokens\";\n@use \"../../global/font.scss\";\n\n\n.accordion-item {\n border-radius: 3px;\n //overflow: hidden;\n transition: all 0.3s;\n font-family: var(--ifx-font-family) // tokens.$ifxFontFamilyBody;\n\n}\n\n.accordion-title:focus {\n outline: none;\n}\n\n// workaround to add corner radius to outline\n.accordion-title:focus::after {\n content: '';\n display: block;\n position: absolute;\n top: -4px;\n bottom: -4px;\n left: -4px;\n right: -4px;\n border-radius: 5px;\n border: 2px solid tokens.$ifxColorOcean500;\n box-sizing: border-box;\n}\n\n.accordion-title:hover {\n border: 1px solid tokens.$ifxColorEngineering200;\n color: tokens.$ifxColorOcean600;\n}\n\n.accordion-title {\n display: flex;\n align-items: center;\n position: relative;\n padding: tokens.$ifxSpace150 tokens.$ifxSpace200;\n gap: tokens.$ifxSpace150;\n color: tokens.$ifxColorOcean500;\n background-color: tokens.$ifxColorBaseWhite;\n border: 1px solid tokens.$ifxColorEngineering200;\n cursor: pointer;\n margin: 4px;\n}\n\n.accordion-caption {\n font-weight: tokens.$ifxFontWeightSemibold;\n font-size: tokens.$ifxFontSizeL;\n}\n\n.accordion-content {\n height: 0;\n transition: height 0.3s ease-in-out;\n line-height: 24px;\n font-size: tokens.$ifxFontSizeM;\n font-weight: 400;\n}\n\n.inner-content {\n background-color: tokens.$ifxColorBaseWhite;\n padding: tokens.$ifxSpace300;\n // white-space: pre-wrap;\n /* wraps text at spaces and within words */\n word-wrap: break-word;\n /* breaks text within a word if necessary */\n overflow-wrap: anywhere;\n align-self: stretch;\n\n /* breaks text at arbitrary points when needed */\n}\n\n.accordion-icon {\n font-weight: bold;\n display: flex;\n transition: transform 0.3s;\n\n &:hover {\n color: tokens.$ifxColorOcean600;\n\n }\n}\n\n\n\n.accordion-item.open .accordion-icon {\n transform: rotate(-180deg);\n}","//ifxAccordionItem\nimport { Component, Prop, h, State, Event, EventEmitter, Watch, Listen, Element } from '@stencil/core';\n\n@Component({\n tag: 'ifx-accordion-item',\n styleUrl: 'accordionItem.scss',\n shadow: true,\n})\nexport class IfxAccordionItem {\n @Element() el;\n @Prop() caption: string;\n @Prop({\n mutable: true,\n }) open: boolean = false;\n @Prop() AriaLevel = 3;\n @State() internalOpen: boolean = false;\n @Event() ifxOpen: EventEmitter;\n @Event() ifxClose: EventEmitter;\n private contentEl!: HTMLElement;\n private titleEl!: HTMLElement;\n\n\n componentWillLoad() {\n this.internalOpen = this.open;\n }\n\n componentDidLoad() {\n this.openAccordionItem()\n }\n\n componentDidUpdate() {\n this.openAccordionItem()\n }\n\n\n\n @Watch('open')\n openChanged(newValue: boolean) {\n this.internalOpen = newValue;\n this.openAccordionItem();\n }\n\n toggleOpen() {\n this.internalOpen = !this.internalOpen;\n this.open = this.internalOpen;\n\n if (this.internalOpen) {\n this.ifxOpen.emit({ isOpen: this.internalOpen });\n } else {\n this.ifxClose.emit({ isClosed: !this.internalOpen });\n }\n this.openAccordionItem();\n }\n\n openAccordionItem() {\n if (this.internalOpen) {\n this.contentEl.style.height = `${this.contentEl.scrollHeight}px`;\n this.contentEl.style.overflow = 'hidden';\n this.contentEl.addEventListener('transitionend', () => {\n this.contentEl.style.overflow = 'visible';\n }, { once: true });\n } else {\n this.contentEl.style.height = '0';\n this.contentEl.style.overflow = 'hidden';\n }\n }\n\n handleSlotChange(e) {\n const slotElement = e.target;\n const nodes = slotElement.assignedNodes();\n \n if(nodes.length > 0) {\n nodes.forEach(node => {\n const observer = new MutationObserver((mutationsList, _) => {\n for(let mutation of mutationsList) {\n if (mutation.type === 'childList') {\n if (this.internalOpen) {\n this.openAccordionItem();\n }\n }\n }\n });\n observer.observe(node, { attributes: true, childList: true, subtree: true });\n });\n }\n\n if (this.internalOpen) {\n this.openAccordionItem();\n }\n }\n\n \n\n @Listen('keydown')\n handleKeydown(ev: KeyboardEvent) {\n const path = ev.composedPath();\n\n if(!path.includes(this.titleEl)) { \n return;\n }\n\n switch (ev.key) {\n case 'Enter': // fallthrough\n case ' ': // space\n ev.preventDefault();\n this.toggleOpen();\n break;\n }\n }\n\n\n render() {\n return (\n <div class={`accordion-item ${this.internalOpen ? 'open' : ''}`}>\n <div role=\"button\" aria-expanded={this.internalOpen} aria-controls=\"accordion-content\" class=\"accordion-title\" onClick={() => this.toggleOpen()} tabindex='0' ref={(el) => (this.titleEl = el as HTMLElement)}>\n <span aria-hidden=\"true\" role=\"heading\" aria-level={String(this.AriaLevel) as string} class=\"accordion-icon\">\n <ifx-icon icon=\"chevron-down-16\"/>\n </span>\n <span id=\"accordion-caption\" class=\"accordion-caption\">{this.caption}</span>\n </div>\n <div id=\"accordion-content\" class=\"accordion-content\" ref={(el) => (this.contentEl = el as HTMLElement)} role=\"region\" aria-labelledby=\"accordion-caption\">\n <div class=\"inner-content\">\n <slot onSlotchange={(e) => this.handleSlotChange(e)} />\n </div>\n </div>\n </div>\n );\n }\n}"],"version":3}
@@ -1,135 +0,0 @@
1
- import { r as registerInstance, h, a as Host, g as getElement } from './index-6c9eba32.js';
2
- import { c as classNames } from './index-72ac5051.js';
3
-
4
- const buttonCss = ":root{--ifx-font-family:\"Source Sans 3\", \"Arial, sans-serif\"}:host{vertical-align:bottom;display:inline-flex;width:var(--bw, fit-content)}.btn{box-sizing:border-box;display:inline-flex;align-items:center;justify-content:center;height:40px;padding:0px 16px;gap:8px;color:#FFFFFF;font-weight:600;border-radius:1px;line-height:1.5rem;font-family:var(--ifx-font-family);font-style:normal;text-decoration:none;user-select:none;font-size:1rem;transition:color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;width:var(--bw, fit-content)}.btn:not(.disabled){cursor:pointer}.btn.disabled{pointer-events:none}.btn-default{color:#FFFFFF;background-color:#0A8276}.btn-default:disabled,.btn-default.disabled{background-color:#BFBBBB;color:#FFFFFF;pointer-events:none}.btn-secondary-default{background-color:#FFFFFF;color:#0A8276;border:1px solid #0A8276}.btn-secondary-default:disabled,.btn-secondary-default.disabled{background-color:#FFFFFF;border:1px solid #BFBBBB;color:#BFBBBB;pointer-events:none}.btn-tertiary-default{background-color:transparent;color:#0A8276}.btn-tertiary-default:disabled,.btn-tertiary-default.disabled{color:#BFBBBB;pointer-events:none}.btn-danger{color:#FFFFFF;background-color:#CD002F;border-color:#CD002F}.btn-danger:disabled,.btn-danger.disabled{background-color:#BFBBBB;color:#FFFFFF;pointer-events:none}.btn-secondary-danger{background-color:#FFFFFF;color:#CD002F;border:1px solid #CD002F}.btn-secondary-danger:disabled,.btn-secondary-danger.disabled{background-color:#FFFFFF;border:1px solid #BFBBBB;color:#BFBBBB;pointer-events:none}.btn-tertiary-danger{background-color:transparent;color:#CD002F}.btn-tertiary-danger:disabled,.btn-tertiary-danger.disabled{background-color:#FFFFFF;color:#BFBBBB;pointer-events:none}.btn-inverse{color:#0A8276;background-color:#FFFFFF}.btn-inverse:disabled,.btn-inverse.disabled{opacity:1;background-color:#FFFFFF;color:#0A8276;pointer-events:none}.btn-secondary-inverse{color:#FFFFFF;border:1px solid #FFFFFF}.btn-secondary-inverse:disabled,.btn-secondary-inverse.disabled{border:1px solid #FFFFFF;color:#FFFFFF;pointer-events:none}.btn-tertiary-inverse{color:#FFFFFF}.btn-tertiary-inverse:disabled,.btn-tertiary-inverse.disabled{color:#FFFFFF;opacity:1;pointer-events:none}.btn ifx-icon:empty{display:none}.btn.btn-xs{font-size:0.875rem;height:32px;line-height:1rem}.btn.btn-s{font-size:0.875rem;height:36px;line-height:1.25rem}.btn.btn-l{font-size:1.25rem;height:48px;line-height:1.75rem}.btn.btn-default:not(:disabled,.disabled):focus:not(:active,.active){outline:none;box-shadow:0 0 0 2px #FFFFFF, 0 0 0 4px #0A8276}.btn.btn-default:not(:disabled,.disabled):hover{background-color:#08665C}.btn.btn-default:not(:disabled,.disabled):active,.btn.btn-default:not(:disabled,.disabled).active{background-color:#06534B}.btn.btn-secondary-default:not(:disabled,.disabled):focus:not(:active,.active){outline:none;box-shadow:0 0 0 2px #FFFFFF, 0 0 0 4px #0A8276}.btn.btn-secondary-default:not(:disabled,.disabled):hover{color:#FFFFFF;background-color:#08665C}.btn.btn-secondary-default:not(:disabled,.disabled):active,.btn.btn-secondary-default:not(:disabled,.disabled).active{background-color:#06534B}.btn.btn-secondary:not(:disabled,.disabled):hover{background-color:#9C216E}.btn.btn-secondary:not(:disabled,.disabled):active,.btn.btn-secondary:not(:disabled,.disabled).active{background-color:#9C216E}.btn.btn-danger:not(:disabled,.disabled):focus:not(:active,.active){outline:none;box-shadow:0 0 0 2px #FFFFFF, 0 0 0 4px #0A8276}.btn.btn-danger:not(:disabled,.disabled):hover{background-color:#A2001E}.btn.btn-danger:not(:disabled,.disabled):active,.btn.btn-danger:not(:disabled,.disabled).active{background-color:#900021}.btn.btn-secondary-danger:not(:disabled,.disabled):focus:not(:active,.active){outline:none;box-shadow:0 0 0 2px #FFFFFF, 0 0 0 4px #0A8276}.btn.btn-secondary-danger:not(:disabled,.disabled):hover{color:#FFFFFF;background-color:#A2001E}.btn.btn-secondary-danger:not(:disabled,.disabled):active,.btn.btn-secondary-danger:not(:disabled,.disabled).active{background-color:#900021}.btn.btn-inverse:not(:disabled,.disabled):focus:not(:active,.active){outline:none;box-shadow:0 0 0 2px #0A8276, 0 0 0 4px #FFFFFF}.btn.btn-inverse:not(:disabled,.disabled):hover{background-color:#EEEDED}.btn.btn-inverse:not(:disabled,.disabled):active,.btn.btn-inverse:not(:disabled,.disabled).active{background-color:#BFBBBB}.btn.btn-secondary-inverse:not(:disabled,.disabled):focus:not(:active,.active){outline:none;box-shadow:0 0 0 2px #0A8276, 0 0 0 4px #FFFFFF}.btn.btn-secondary-inverse:not(:disabled,.disabled):hover{color:#0A8276;background-color:#EEEDED}.btn.btn-secondary-inverse:not(:disabled,.disabled):active,.btn.btn-secondary-inverse:not(:disabled,.disabled).active{color:#0A8276;background-color:#BFBBBB}.btn.btn-tertiary-default:not(:disabled,.disabled):focus:not(:active,.active){outline:none;box-shadow:0 0 0 2px #FFFFFF, 0 0 0 4px #08665C}.btn.btn-tertiary-default:not(:disabled,.disabled):hover{color:#08665C}.btn.btn-tertiary-default:not(:disabled,.disabled):active,.btn.btn-tertiary-default:not(:disabled,.disabled).active{color:#06534B}.btn.btn-tertiary-danger:not(:disabled,.disabled):focus:not(:active,.active){outline:none;box-shadow:0 0 0 2px #FFFFFF, 0 0 0 4px #A2001E}.btn.btn-tertiary-danger:not(:disabled,.disabled):hover{color:#A2001E}.btn.btn-tertiary-danger:not(:disabled,.disabled):active,.btn.btn-tertiary-danger:not(:disabled,.disabled).active{color:#900021}.btn.btn-tertiary-inverse:not(:disabled,.disabled):focus:not(:active,.active){outline:none;box-shadow:0 0 0 2px #0A8276, 0 0 0 4px #FFFFFF}.btn.btn-tertiary-inverse:not(:disabled,.disabled):hover{color:#EEEDED}.btn.btn-tertiary-inverse:not(:disabled,.disabled):active,.btn.btn-tertiary-inverse:not(:disabled,.disabled).active{color:#BFBBBB}";
5
- const IfxButtonStyle0 = buttonCss;
6
-
7
- const Button = class {
8
- constructor(hostRef) {
9
- registerInstance(this, hostRef);
10
- this.variant = 'primary';
11
- this.theme = 'default';
12
- this.size = 'm';
13
- this.disabled = false;
14
- this.target = '_self';
15
- this.type = "button";
16
- this.fullWidth = false;
17
- this.handleClick = (ev) => {
18
- if (this.el.shadowRoot) {
19
- const parentForm = this.el.closest('form');
20
- if (parentForm) {
21
- ev.preventDefault();
22
- if (this.type === 'reset') {
23
- // If the button type is 'reset', manually reset all custom form fields
24
- this.resetClickHandler(); //this will reset all ifx-text-fields within a form
25
- }
26
- else {
27
- const fakeButton = document.createElement('button');
28
- if (this.type) {
29
- fakeButton.type = this.type;
30
- }
31
- fakeButton.style.display = 'none';
32
- parentForm.appendChild(fakeButton);
33
- fakeButton.click();
34
- fakeButton.remove();
35
- }
36
- }
37
- }
38
- };
39
- }
40
- setInternalHref(newValue) {
41
- this.internalHref = newValue;
42
- }
43
- async setFocus() {
44
- this.focusableElement.focus();
45
- }
46
- insertNativeButton() {
47
- this.nativeButton = document.createElement('button');
48
- this.nativeButton.type = this.type;
49
- this.nativeButton.style.display = 'none';
50
- this.el.closest('form').appendChild(this.nativeButton);
51
- }
52
- handleFormAndInternalHref() {
53
- if (this.el.closest('form')) {
54
- if (this.el.href) {
55
- this.el.internalHref = undefined;
56
- }
57
- this.insertNativeButton();
58
- }
59
- else {
60
- this.internalHref = this.href;
61
- }
62
- }
63
- handleButtonWidth() {
64
- if (this.fullWidth) {
65
- this.el.style.setProperty('--bw', '100%');
66
- }
67
- else {
68
- this.el.style.setProperty('--bw', 'fit-content');
69
- }
70
- }
71
- componentWillLoad() {
72
- this.handleFormAndInternalHref();
73
- }
74
- componentWillRender() {
75
- this.handleButtonWidth();
76
- }
77
- resetClickHandler() {
78
- const formElement = this.el.closest('form');
79
- const customElements = formElement.querySelectorAll('ifx-text-field, ifx-textarea');
80
- customElements.forEach(element => {
81
- element.reset();
82
- });
83
- }
84
- handleKeyDown(ev) {
85
- if (ev.key === " " || ev.key === 'Enter' && !this.disabled) {
86
- this.focusableElement.click();
87
- }
88
- }
89
- handleHostClick(event) {
90
- if (this.disabled === true) {
91
- event.stopImmediatePropagation();
92
- }
93
- }
94
- handleFocus(event) {
95
- if (this.disabled) {
96
- event.preventDefault();
97
- this.focusableElement.blur();
98
- }
99
- }
100
- render() {
101
- return (h(Host, { key: 'a220864c79a3eee88b277dd2277487581c7de8b0' }, h("a", { key: '4fd4cbd07205a0f538cf4d977a1b88d23d64be36', role: this.href ? 'link' : 'button', tabIndex: this.disabled ? -1 : 0, ref: (el) => (this.focusableElement = el), class: this.getClassNames(), href: !this.disabled ? this.internalHref : undefined, target: this.target, onClick: this.handleClick, rel: this.target === '_blank' ? 'noopener noreferrer' : undefined, onFocus: (event) => this.handleFocus(event), "aria-disabled": this.disabled ? 'true' : null, "aria-describedby": this.theme === 'danger' ? 'Dangerous action' : undefined, "aria-label": this.ariaLabel || undefined }, h("slot", { key: 'f64f20c4b3d1af19c6276713aef4e230d7aaf0e3' }))));
102
- }
103
- getVariantClass() {
104
- return `${this.variant}` === "secondary"
105
- ? `secondary-${this.theme}`
106
- : `${this.variant}` === 'tertiary'
107
- ? `tertiary-${this.theme}`
108
- : `${this.theme}`;
109
- }
110
- getSizeClass() {
111
- if (`${this.size}` === "xs") {
112
- return "xs";
113
- }
114
- else if (`${this.size}` === "s") {
115
- return "s";
116
- }
117
- else if (`${this.size}` === "l") {
118
- return "l";
119
- }
120
- else
121
- return "";
122
- }
123
- getClassNames() {
124
- return classNames('btn', this.size && `btn-${this.getSizeClass()}`, `btn-${this.getVariantClass()}`, this.disabled ? 'disabled' : '');
125
- }
126
- get el() { return getElement(this); }
127
- static get watchers() { return {
128
- "href": ["setInternalHref"]
129
- }; }
130
- };
131
- Button.style = IfxButtonStyle0;
132
-
133
- export { Button as ifx_button };
134
-
135
- //# sourceMappingURL=ifx-button.entry.js.map
@@ -1 +0,0 @@
1
- {"file":"ifx-button.entry.js","mappings":";;;AAAA,MAAM,SAAS,GAAG,uuLAAuuL,CAAC;AAC1vL,wBAAe,SAAS;;MCQX,MAAM;IALnB;;QAMU,YAAO,GAAyC,SAAS,CAAC;QAC1D,UAAK,GAAqC,SAAS,CAAC;QACpD,SAAI,GAAW,GAAG,CAAC;QACnB,aAAQ,GAAY,KAAK,CAAC;QAG1B,WAAM,GAAW,OAAO,CAAC;QACzB,SAAI,GAAkC,QAAQ,CAAC;QAC/C,cAAS,GAAY,KAAK,CAAC;QAqDnC,gBAAW,GAAG,CAAC,EAAS;YACtB,IAAI,IAAI,CAAC,EAAE,CAAC,UAAU,EAAE;gBACtB,MAAM,UAAU,GAAG,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;gBAC3C,IAAI,UAAU,EAAE;oBACd,EAAE,CAAC,cAAc,EAAE,CAAC;oBAEpB,IAAI,IAAI,CAAC,IAAI,KAAK,OAAO,EAAE;;wBAEzB,IAAI,CAAC,iBAAiB,EAAE,CAAC;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I,CAAC,YAAY,EAAE,EAAE,EACzC,OAAO,IAAI,CAAC,eAAe,EAAE,EAAE,EAC/B,IAAI,CAAC,QAAQ,GAAG,UAAU,GAAG,EAAE,CAChC,CAAC;KACH;;;;;;;;;;","names":[],"sources":["src/components/button/button.scss?tag=ifx-button&encapsulation=shadow","src/components/button/button.tsx"],"sourcesContent":["@use \"~@infineon/design-system-tokens/dist/tokens\";\n@use \"../../global/font.scss\";\n\n:host {\n vertical-align: bottom;\n display: inline-flex;\n width: var(--bw, fit-content);\n}\n\n.btn {\n box-sizing: border-box;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n height: tokens.$ifxSize500;\n padding: 0px tokens.$ifxSpace200;\n gap: tokens.$ifxSpace100;\n color: tokens.$ifxColorBaseWhite;\n font-weight: tokens.$ifxFontWeightSemibold;\n border-radius: tokens.$ifxBorderRadius12;\n line-height: tokens.$ifxLineHeightM;\n font-family: var(--ifx-font-family); // tokens.$ifxFontFamilyBody;\n\n\n font-style: normal;\n text-decoration: none;\n user-select: none;\n font-size: tokens.$ifxFontSizeM;\n transition: color .15s ease-in-out, background-color .15s ease-in-out, border-color .15s ease-in-out, box-shadow .15s ease-in-out;\n width: var(--bw, fit-content);\n}\n\n.btn:not(.disabled) {\n cursor: pointer;\n}\n\n.btn.disabled {\n pointer-events: none;\n}\n\n.btn-default {\n //default variant=primary; default color=default\n color: tokens.$ifxColorBaseWhite;\n background-color: tokens.$ifxColorOcean500;\n\n &:disabled,\n &.disabled {\n background-color: tokens.$ifxColorEngineering300;\n color: tokens.$ifxColorBaseWhite;\n pointer-events: none;\n\n }\n}\n\n.btn-secondary-default {\n background-color: tokens.$ifxColorBaseWhite;\n color: tokens.$ifxColorOcean500;\n border: 1px solid tokens.$ifxColorOcean500;\n\n &:disabled,\n &.disabled {\n background-color: tokens.$ifxColorBaseWhite;\n border: 1px solid tokens.$ifxColorEngineering300;\n color: tokens.$ifxColorEngineering300;\n pointer-events: none;\n\n }\n}\n\n.btn-tertiary-default {\n background-color: tokens.$ifxColorBaseTransparent;\n color: tokens.$ifxColorOcean500;\n\n &:disabled,\n &.disabled {\n color: tokens.$ifxColorEngineering300;\n pointer-events: none;\n\n }\n}\n\n\n.btn-danger {\n color: tokens.$ifxColorBaseWhite;\n background-color: tokens.$ifxColorRed500;\n border-color: tokens.$ifxColorRed500;\n\n &:disabled,\n &.disabled {\n background-color: tokens.$ifxColorEngineering300;\n color: tokens.$ifxColorBaseWhite;\n pointer-events: none;\n\n }\n}\n\n.btn-secondary-danger {\n background-color: tokens.$ifxColorBaseWhite;\n color: tokens.$ifxColorRed500;\n border: 1px solid tokens.$ifxColorRed500;\n\n &:disabled,\n &.disabled {\n background-color: tokens.$ifxColorBaseWhite;\n border: 1px solid tokens.$ifxColorEngineering300;\n color: tokens.$ifxColorEngineering300;\n pointer-events: none;\n\n }\n}\n\n.btn-tertiary-danger {\n //combination tertiary + danger not in design\n background-color: tokens.$ifxColorBaseTransparent;\n color: tokens.$ifxColorRed500;\n\n &:disabled,\n &.disabled {\n background-color: tokens.$ifxColorBaseWhite;\n color: tokens.$ifxColorEngineering300;\n pointer-events: none;\n\n }\n}\n\n.btn-inverse {\n color: tokens.$ifxColorOcean500;\n background-color: tokens.$ifxColorBaseWhite;\n\n &:disabled,\n &.disabled {\n opacity: tokens.$ifxOpacity100;\n background-color: tokens.$ifxColorBaseWhite;\n color: tokens.$ifxColorOcean500;\n pointer-events: none;\n }\n}\n\n.btn-secondary-inverse {\n color: tokens.$ifxColorBaseWhite;\n border: 1px solid tokens.$ifxColorBaseWhite;\n\n &:disabled,\n &.disabled {\n border: 1px solid tokens.$ifxColorBaseWhite;\n color: tokens.$ifxColorBaseWhite;\n pointer-events: none;\n\n }\n}\n\n\n.btn-tertiary-inverse {\n color: tokens.$ifxColorBaseWhite;\n\n &:disabled,\n &.disabled {\n color: tokens.$ifxColorBaseWhite;\n opacity: tokens.$ifxOpacity100;\n pointer-events: none;\n\n }\n}\n\n.btn {\n & ifx-icon:empty {\n display: none;\n }\n\n &.btn-xs {\n font-size: tokens.$ifxFontSizeS;\n height: tokens.$ifxSize400;\n line-height: tokens.$ifxLineHeightXs;\n }\n\n &.btn-s {\n font-size: tokens.$ifxFontSizeS;\n height: tokens.$ifxSize450;\n line-height: tokens.$ifxLineHeightS;\n }\n\n // &.btn-m { //default\n // font-size: tokens.$ifxFontSizeM;\n // height: tokens.$ifxSize400;\n // line-height: tokens.$ifxLineHeightM;\n // }\n\n\n &.btn-l {\n font-size: tokens.$ifxFontSizeXl;\n height: tokens.$ifxSize600;\n line-height: tokens.$ifxLineHeightXl;\n }\n\n\n\n &.btn-default:not(:disabled, .disabled) {\n &:focus:not(:active, .active) {\n outline: none;\n box-shadow: 0 0 0 2px tokens.$ifxColorBaseWhite, 0 0 0 4px tokens.$ifxColorOcean500;\n }\n\n &:hover {\n background-color: tokens.$ifxColorOcean600;\n }\n\n &:active,\n &.active {\n background-color: tokens.$ifxColorOcean700;\n }\n }\n\n &.btn-secondary-default:not(:disabled, .disabled) {\n &:focus:not(:active, .active) {\n outline: none;\n box-shadow: 0 0 0 2px tokens.$ifxColorBaseWhite, 0 0 0 4px tokens.$ifxColorOcean500;\n }\n\n &:hover {\n color: tokens.$ifxColorBaseWhite;\n background-color: tokens.$ifxColorOcean600;\n }\n\n &:active,\n &.active {\n background-color: tokens.$ifxColorOcean700;\n }\n }\n\n &.btn-secondary:not(:disabled, .disabled) {\n\n &:hover {\n background-color: tokens.$ifxColorBerry500;\n }\n\n &:active,\n &.active {\n background-color: tokens.$ifxColorBerry500;\n }\n }\n\n\n\n &.btn-danger:not(:disabled, .disabled) {\n &:focus:not(:active, .active) {\n outline: none;\n box-shadow: 0 0 0 2px tokens.$ifxColorBaseWhite, 0 0 0 4px tokens.$ifxColorOcean500;\n }\n\n &:hover {\n background-color: tokens.$ifxColorRed600;\n }\n\n &:active,\n &.active {\n background-color: tokens.$ifxColorRed700;\n }\n }\n\n &.btn-secondary-danger:not(:disabled, .disabled) {\n\n &:focus:not(:active, .active) {\n outline: none;\n box-shadow: 0 0 0 2px tokens.$ifxColorBaseWhite, 0 0 0 4px tokens.$ifxColorOcean500;\n }\n\n &:hover {\n color: tokens.$ifxColorBaseWhite;\n background-color: tokens.$ifxColorRed600;\n }\n\n &:active,\n &.active {\n background-color: tokens.$ifxColorRed700;\n }\n }\n\n\n &.btn-inverse:not(:disabled, .disabled) {\n &:focus:not(:active, .active) {\n outline: none;\n box-shadow: 0 0 0 2px tokens.$ifxColorOcean500, 0 0 0 4px tokens.$ifxColorBaseWhite;\n }\n\n &:hover {\n background-color: tokens.$ifxColorEngineering200;\n }\n\n &:active,\n &.active {\n background-color: tokens.$ifxColorEngineering300;\n }\n }\n\n &.btn-secondary-inverse:not(:disabled, .disabled) {\n &:focus:not(:active, .active) {\n outline: none;\n box-shadow: 0 0 0 2px tokens.$ifxColorOcean500, 0 0 0 4px tokens.$ifxColorBaseWhite;\n }\n\n &:hover {\n color: tokens.$ifxColorOcean500;\n background-color: tokens.$ifxColorEngineering200;\n }\n\n &:active,\n &.active {\n color: tokens.$ifxColorOcean500;\n background-color: tokens.$ifxColorEngineering300;\n }\n }\n\n\n\n &.btn-tertiary-default:not(:disabled, .disabled) {\n &:focus:not(:active, .active) {\n outline: none;\n box-shadow: 0 0 0 2px tokens.$ifxColorBaseWhite, 0 0 0 4px tokens.$ifxColorOcean600;\n }\n\n &:hover {\n color: tokens.$ifxColorOcean600;\n }\n\n &:active,\n &.active {\n color: tokens.$ifxColorOcean700;\n }\n\n\n }\n\n\n\n\n\n &.btn-tertiary-danger:not(:disabled, .disabled) {\n &:focus:not(:active, .active) {\n outline: none;\n box-shadow: 0 0 0 2px tokens.$ifxColorBaseWhite, 0 0 0 4px tokens.$ifxColorRed600;\n }\n\n &:hover {\n color: tokens.$ifxColorRed600;\n }\n\n &:active,\n &.active {\n color: tokens.$ifxColorRed700;\n }\n\n }\n\n\n &.btn-tertiary-inverse:not(:disabled, .disabled) {\n &:focus:not(:active, .active) {\n outline: none;\n box-shadow: 0 0 0 2px tokens.$ifxColorOcean500, 0 0 0 4px tokens.$ifxColorBaseWhite;\n }\n\n &:hover {\n color: tokens.$ifxColorEngineering200;\n\n }\n\n &:active,\n &.active {\n color: tokens.$ifxColorEngineering300;\n }\n }\n}","import { Component, Prop, h, Host, Method, Element, Listen, State, Watch } from '@stencil/core';\nimport classNames from 'classnames';\n \n\n@Component({\n tag: 'ifx-button',\n styleUrl: 'button.scss',\n shadow: true,\n})\nexport class Button {\n @Prop() variant: 'primary' | 'secondary' | 'tertiary' = 'primary';\n @Prop() theme: 'default' | 'danger' | 'inverse' = 'default';\n @Prop() size: string = 'm';\n @Prop() disabled: boolean = false;\n @State() internalHref: string;\n @Prop() href: string;\n @Prop() target: string = '_self';\n @Prop() type: \"button\" | \"submit\" | \"reset\" = \"button\";\n @Prop() fullWidth: boolean = false;\n @Prop() ariaLabel: string | null;\n @Element() el;\n\n private focusableElement: HTMLElement;\n private nativeButton: HTMLButtonElement | HTMLInputElement;\n\n @Watch('href')\n setInternalHref(newValue: string) {\n this.internalHref = newValue;\n }\n\n @Method()\n async setFocus() {\n this.focusableElement.focus();\n }\n\n insertNativeButton() {\n this.nativeButton = document.createElement('button');\n this.nativeButton.type = this.type;\n this.nativeButton.style.display = 'none';\n this.el.closest('form').appendChild(this.nativeButton);\n }\n\n handleFormAndInternalHref() {\n if (this.el.closest('form')) {\n if (this.el.href) {\n this.el.internalHref = undefined;\n }\n this.insertNativeButton()\n } else {\n this.internalHref = this.href;\n }\n }\n\n handleButtonWidth() {\n if (this.fullWidth) {\n this.el.style.setProperty('--bw', '100%');\n } else {\n this.el.style.setProperty('--bw', 'fit-content');\n }\n }\n\n componentWillLoad() {\n this.handleFormAndInternalHref()\n }\n\n componentWillRender() {\n this.handleButtonWidth()\n }\n\n\n\n handleClick = (ev: Event) => {\n if (this.el.shadowRoot) {\n const parentForm = this.el.closest('form');\n if (parentForm) {\n ev.preventDefault();\n\n if (this.type === 'reset') {\n // If the button type is 'reset', manually reset all custom form fields\n this.resetClickHandler(); //this will reset all ifx-text-fields within a form\n } else {\n const fakeButton = document.createElement('button');\n if (this.type) {\n fakeButton.type = this.type;\n }\n fakeButton.style.display = 'none';\n parentForm.appendChild(fakeButton);\n fakeButton.click();\n fakeButton.remove();\n }\n }\n }\n }\n\n resetClickHandler() {\n const formElement = this.el.closest('form');\n const customElements = formElement.querySelectorAll('ifx-text-field, ifx-textarea');\n customElements.forEach(element => {\n element.reset();\n });\n }\n\n @Listen('keydown')\n handleKeyDown(ev: KeyboardEvent) {\n if ( ev.key === \" \" || ev.key === 'Enter' && !this.disabled) {\n this.focusableElement.click();\n }\n }\n\n @Listen('click', { capture: true })\n handleHostClick(event: Event) {\n if (this.disabled === true) {\n event.stopImmediatePropagation();\n }\n }\n\n handleFocus(event: FocusEvent) {\n if (this.disabled) {\n event.preventDefault();\n this.focusableElement.blur();\n }\n }\n\n render() {\n return (\n <Host>\n <a\n role={this.href ? 'link' : 'button'}\n tabIndex={this.disabled ? -1 : 0}\n ref={(el) => (this.focusableElement = el)}\n class={this.getClassNames()}\n href={!this.disabled ? this.internalHref : undefined}\n target={this.target}\n onClick={this.handleClick}\n rel={this.target === '_blank' ? 'noopener noreferrer' : undefined}\n onFocus={(event) => this.handleFocus(event)}\n aria-disabled={this.disabled ? 'true' : null}\n aria-describedby={this.theme === 'danger' ? 'Dangerous action' : undefined}\n aria-label={this.ariaLabel || undefined}\n >\n <slot></slot>\n </a>\n </Host>\n );\n }\n\n\n getVariantClass() {\n return `${this.variant}` === \"secondary\"\n ? `secondary-${this.theme}`\n : `${this.variant}` === 'tertiary'\n ? `tertiary-${this.theme}`\n : `${this.theme}`;\n }\n\n getSizeClass() {\n if (`${this.size}` === \"xs\") {\n return \"xs\"\n }\n else if (`${this.size}` === \"s\") {\n return \"s\"\n }\n else if (`${this.size}` === \"l\") {\n return \"l\"\n }\n else return \"\";\n }\n\n getClassNames() {\n return classNames(\n 'btn',\n this.size && `btn-${this.getSizeClass()}`,\n `btn-${this.getVariantClass()}`,\n this.disabled ? 'disabled' : ''\n );\n }\n}"],"version":3}
@@ -1,90 +0,0 @@
1
- import { r as registerInstance, c as createEvent, h, a as Host } from './index-6c9eba32.js';
2
- import { g as getIcon } from './icons-845f859e.js';
3
-
4
- const infineonIconStencilCss = "ifx-icon{display:inline-flex;justify-content:center}ifx-icon:empty{display:none}";
5
- const IfxIconStyle0 = infineonIconStencilCss;
6
-
7
- const InfineonIconStencil = class {
8
- constructor(hostRef) {
9
- registerInstance(this, hostRef);
10
- this.consoleError = createEvent(this, "consoleError", 7);
11
- this.icon = "";
12
- }
13
- updateIcon(newIcon) {
14
- this.internalIcon = newIcon;
15
- this.setIcon();
16
- }
17
- convertStringToHtml(htmlString) {
18
- const div = document.createElement('div');
19
- div.innerHTML = htmlString;
20
- return div.firstChild;
21
- }
22
- convertHtmlToObject(htmlElement) {
23
- let pathToObject = Array
24
- .from(htmlElement.attributes, ({ name, value }) => ({ name, value }))
25
- .reduce((acc, current) => {
26
- acc[current.name] = current.value;
27
- return acc;
28
- }, {});
29
- return pathToObject;
30
- }
31
- convertPathsToVnode(htmlPath) {
32
- let svgPaths = [];
33
- const parentPath = this.convertHtmlToObject(htmlPath);
34
- const parentPathToVnode = h("path", parentPath);
35
- svgPaths.push(parentPathToVnode);
36
- if (htmlPath.firstChild) {
37
- const paths = htmlPath.querySelectorAll('path');
38
- const pathLength = htmlPath.querySelectorAll('path').length;
39
- for (let i = 0; i < pathLength; i++) {
40
- let pathToObject = this.convertHtmlToObject(paths[i]);
41
- let objToVnode = h("path", pathToObject);
42
- svgPaths.push(objToVnode);
43
- }
44
- }
45
- return svgPaths;
46
- }
47
- getSVG(svgPath) {
48
- const htmlPath = this.convertStringToHtml(this.ifxIcon);
49
- const width = htmlPath.getAttribute('width');
50
- const height = htmlPath.getAttribute('height');
51
- const fill = htmlPath.getAttribute('fill');
52
- const viewBox = htmlPath.getAttribute('viewBox');
53
- return h("svg", { class: "inline-svg", width: width, height: height, xmlns: "http://www.w3.org/2000/svg", fill: fill, viewBox: viewBox }, ...svgPath);
54
- }
55
- constructIcon() {
56
- if (this.ifxIcon) {
57
- const htmlPath = this.convertStringToHtml(this.ifxIcon);
58
- const svgPath = this.convertPathsToVnode(htmlPath);
59
- const SVG = this.getSVG(svgPath);
60
- return SVG;
61
- }
62
- else if (this.icon !== "") {
63
- console.error('Icon not found!');
64
- this.consoleError.emit(true);
65
- return;
66
- }
67
- else {
68
- return;
69
- }
70
- }
71
- setIcon() {
72
- const removeHyphen = (str) => str.toLowerCase().replace(/[^a-zA-Z0-9]+(.)/g, (_m, chr) => chr);
73
- this.ifxIcon = getIcon(removeHyphen(this.internalIcon));
74
- }
75
- componentWillLoad() {
76
- this.internalIcon = this.icon;
77
- this.setIcon();
78
- }
79
- render() {
80
- return (h(Host, { key: '7f6ff1ecf4d36c72ce33b220b21e9f140e87f430' }, this.constructIcon()));
81
- }
82
- static get watchers() { return {
83
- "icon": ["updateIcon"]
84
- }; }
85
- };
86
- InfineonIconStencil.style = IfxIconStyle0;
87
-
88
- export { InfineonIconStencil as ifx_icon };
89
-
90
- //# sourceMappingURL=ifx-icon.entry.js.map
@@ -1 +0,0 @@
1
- {"file":"ifx-icon.entry.js","mappings":";;;AAAA,MAAM,sBAAsB,GAAG,kFAAkF,CAAC;AAClH,sBAAe,sBAAsB;;MCSxB,mBAAmB;IALhC;;;QAM2B,SAAI,GAAW,EAAE,CAAA;KAuF3C;IAjFG,UAAU,CAAC,OAAe;QACxB,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC;QAC5B,IAAI,CAAC,OAAO,EAAE,CAAA;KACf;IAEH,mBAAmB,CAAC,UAAU;QAC5B,MAAM,GAAG,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAA;QACzC,GAAG,CAAC,SAAS,GAAG,UAAU,CAAA;QAC1B,OAAO,GAAG,CAAC,UAAU,CAAA;KACtB;IAED,mBAAmB,CAAC,WAAW;QAC7B,IAAI,YAAY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YAAY,GAAG,IAAI,CAAC,IAAI,CAAC;QAC9B,IAAI,CAAC,OAAO,EAAE,CAAA;KACf;IAED,MAAM;QACJ,QACE,EAAC,IAAI,uDACJ,IAAI,CAAC,aAAa,EAAE,CACd,EACP;KACH;;;;;;;;;","names":[],"sources":["src/components/icon/infineonIconStencil.scss?tag=ifx-icon","src/components/icon/infineonIconStencil.tsx"],"sourcesContent":["ifx-icon {\n display: inline-flex;\n justify-content: center;\n\n &:empty {\n display: none;\n }\n}","import { Component, Prop, h, Host, Event, EventEmitter, Watch, State } from '@stencil/core';\nimport { getIcon } from '@infineon/infineon-icons'\n \n\n\n@Component({\n tag: 'ifx-icon',\n styleUrl: './infineonIconStencil.scss'\n})\n\nexport class InfineonIconStencil {\n @Prop({ mutable: true }) icon: string = \"\"\n @Prop({ mutable: true }) ifxIcon: any;\n @State() internalIcon: string;\n @Event() consoleError: EventEmitter<boolean>;\n\n @Watch('icon')\n updateIcon(newIcon: string) { \n this.internalIcon = newIcon;\n this.setIcon()\n }\n\n convertStringToHtml(htmlString) { \n const div = document.createElement('div')\n div.innerHTML = htmlString\n return div.firstChild\n }\n\n convertHtmlToObject(htmlElement) { \n let pathToObject = Array\n .from(htmlElement.attributes, ({ name, value }) => ({ name, value }))\n .reduce((acc, current) => {\n acc[current.name] = current.value\n return acc\n }, {})\n\n return pathToObject\n }\n\n convertPathsToVnode(htmlPath) { \n let svgPaths = []\n const parentPath = this.convertHtmlToObject(htmlPath);\n const parentPathToVnode = h(\"path\", parentPath);\n svgPaths.push(parentPathToVnode)\n if(htmlPath.firstChild) { \n const paths = htmlPath.querySelectorAll('path');\n const pathLength = htmlPath.querySelectorAll('path').length;\n for(let i = 0; i < pathLength; i++) { \n let pathToObject = this.convertHtmlToObject(paths[i])\n let objToVnode = h(\"path\", pathToObject)\n svgPaths.push(objToVnode)\n } \n }\n return svgPaths\n }\n\n getSVG(svgPath) {\n const htmlPath = this.convertStringToHtml(this.ifxIcon) as SVGElement;\n const width = htmlPath.getAttribute('width');\n const height = htmlPath.getAttribute('height');\n const fill = htmlPath.getAttribute('fill');\n const viewBox = htmlPath.getAttribute('viewBox');\n \n return <svg class=\"inline-svg\" width={width} height={height} xmlns=\"http://www.w3.org/2000/svg\" fill={fill} viewBox={viewBox}>{...svgPath}</svg>\n }\n\n constructIcon() {\n if(this.ifxIcon) {\n const htmlPath = this.convertStringToHtml(this.ifxIcon)\n const svgPath = this.convertPathsToVnode(htmlPath)\n const SVG = this.getSVG(svgPath)\n return SVG;\n } else if(this.icon !== \"\") {\n console.error('Icon not found!')\n this.consoleError.emit(true)\n return;\n } else { \n return;\n }\n }\n\n setIcon() { \n const removeHyphen = (str) => str.toLowerCase().replace(/[^a-zA-Z0-9]+(.)/g, (_m, chr) => chr);\n this.ifxIcon = getIcon(removeHyphen(this.internalIcon));\n }\n\n componentWillLoad() {\n this.internalIcon = this.icon;\n this.setIcon()\n }\n\n render() {\n return (\n <Host>\n {this.constructIcon()}\n </Host>\n );\n }\n}"],"version":3}