@infineon/infineon-design-system-stencil 39.4.4--canary.2134.cd83647d2771e1e22b8c6c80a0df75f24ca168b6.0 → 39.4.4--canary.2134.bb609f61311d4fde41e8336aa402a4fd507e0769.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.
- package/dist/cjs/_commonjsHelpers-CFO10eej.js +10 -0
- package/dist/cjs/_commonjsHelpers-CFO10eej.js.map +1 -0
- package/dist/cjs/ifx-action-list-item.cjs.entry.js +2 -1
- package/dist/cjs/ifx-action-list-item.cjs.entry.js.map +1 -1
- package/dist/cjs/ifx-action-list-item.entry.cjs.js.map +1 -1
- package/dist/cjs/ifx-basic-table.cjs.entry.js +2 -1
- package/dist/cjs/ifx-basic-table.cjs.entry.js.map +1 -1
- package/dist/cjs/ifx-basic-table.entry.cjs.js.map +1 -1
- package/dist/cjs/ifx-button.cjs.entry.js +146 -0
- package/dist/cjs/ifx-button.cjs.entry.js.map +1 -0
- package/dist/cjs/ifx-button.entry.cjs.js.map +1 -0
- package/dist/cjs/ifx-checkbox.cjs.entry.js +125 -0
- package/dist/cjs/ifx-checkbox.cjs.entry.js.map +1 -0
- package/dist/cjs/ifx-checkbox.entry.cjs.js.map +1 -0
- package/dist/cjs/ifx-chip.ifx-chip-item.ifx-pagination.entry.cjs.js.map +1 -0
- package/dist/cjs/ifx-chip_3.cjs.entry.js +615 -0
- package/dist/cjs/ifx-chip_3.cjs.entry.js.map +1 -0
- package/dist/cjs/ifx-icon-button.cjs.entry.js +76 -0
- package/dist/cjs/ifx-icon-button.cjs.entry.js.map +1 -0
- package/dist/cjs/ifx-icon-button.entry.cjs.js.map +1 -0
- package/dist/cjs/ifx-icon.cjs.entry.js +127 -0
- package/dist/cjs/ifx-icon.cjs.entry.js.map +1 -0
- package/dist/cjs/ifx-icon.entry.cjs.js.map +1 -0
- package/dist/cjs/ifx-indicator.cjs.entry.js +42 -0
- package/dist/cjs/ifx-indicator.cjs.entry.js.map +1 -0
- package/dist/cjs/ifx-indicator.entry.cjs.js.map +1 -0
- package/dist/cjs/ifx-link.cjs.entry.js +2 -1
- package/dist/cjs/ifx-link.cjs.entry.js.map +1 -1
- package/dist/cjs/ifx-link.entry.cjs.js.map +1 -1
- package/dist/cjs/ifx-search-field.cjs.entry.js +2 -1
- package/dist/cjs/ifx-search-field.cjs.entry.js.map +1 -1
- package/dist/cjs/ifx-search-field.entry.cjs.js.map +1 -1
- package/dist/cjs/ifx-select.cjs.entry.js +7323 -0
- package/dist/cjs/ifx-select.cjs.entry.js.map +1 -0
- package/dist/cjs/ifx-select.entry.cjs.js.map +1 -0
- package/dist/cjs/ifx-spinner.ifx-text-field.entry.cjs.js.map +1 -1
- package/dist/cjs/ifx-spinner_2.cjs.entry.js +2 -1
- package/dist/cjs/ifx-spinner_2.cjs.entry.js.map +1 -1
- package/dist/cjs/ifx-table.cjs.entry.js +1207 -0
- package/dist/cjs/ifx-table.cjs.entry.js.map +1 -0
- package/dist/cjs/ifx-table.entry.cjs.js.map +1 -0
- package/dist/cjs/{index-DihxupoM.js → index-CVw4GUo6.js} +4 -7
- package/dist/{esm/index-Beav1bNT.js.map → cjs/index-CVw4GUo6.js.map} +1 -1
- package/dist/cjs/index-Dc5gCGlQ.js +30 -2
- package/dist/cjs/infineon-design-system-stencil.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/table-advanced-version/table.js +66 -25
- package/dist/collection/components/table-advanced-version/table.js.map +1 -1
- package/dist/components/ifx-table.js +66 -25
- package/dist/components/ifx-table.js.map +1 -1
- package/dist/esm/_commonjsHelpers-B85MJLTf.js +8 -0
- package/dist/esm/_commonjsHelpers-B85MJLTf.js.map +1 -0
- package/dist/esm/ifx-action-list-item.entry.js +2 -1
- package/dist/esm/ifx-action-list-item.entry.js.map +1 -1
- package/dist/esm/ifx-basic-table.entry.js +2 -1
- package/dist/esm/ifx-basic-table.entry.js.map +1 -1
- package/dist/esm/ifx-button.entry.js +144 -0
- package/dist/esm/ifx-button.entry.js.map +1 -0
- package/dist/esm/ifx-checkbox.entry.js +123 -0
- package/dist/esm/ifx-checkbox.entry.js.map +1 -0
- package/dist/esm/ifx-chip.ifx-chip-item.ifx-pagination.entry.js.map +1 -0
- package/dist/esm/ifx-chip_3.entry.js +611 -0
- package/dist/esm/ifx-chip_3.entry.js.map +1 -0
- package/dist/esm/ifx-icon-button.entry.js +74 -0
- package/dist/esm/ifx-icon-button.entry.js.map +1 -0
- package/dist/esm/ifx-icon.entry.js +125 -0
- package/dist/esm/ifx-icon.entry.js.map +1 -0
- package/dist/esm/ifx-indicator.entry.js +40 -0
- package/dist/esm/ifx-indicator.entry.js.map +1 -0
- package/dist/esm/ifx-link.entry.js +2 -1
- package/dist/esm/ifx-link.entry.js.map +1 -1
- package/dist/esm/ifx-search-field.entry.js +2 -1
- package/dist/esm/ifx-search-field.entry.js.map +1 -1
- package/dist/esm/ifx-select.entry.js +7321 -0
- package/dist/esm/ifx-select.entry.js.map +1 -0
- package/dist/esm/ifx-spinner.ifx-text-field.entry.js.map +1 -1
- package/dist/esm/ifx-spinner_2.entry.js +2 -1
- package/dist/esm/ifx-spinner_2.entry.js.map +1 -1
- package/dist/esm/ifx-table.entry.js +1205 -0
- package/dist/esm/ifx-table.entry.js.map +1 -0
- package/dist/esm/{index-Beav1bNT.js → index-Bt32KzDW.js} +4 -6
- package/dist/{cjs/index-DihxupoM.js.map → esm/index-Bt32KzDW.js.map} +1 -1
- package/dist/esm/index-PqnYwNKt.js +30 -2
- package/dist/esm/infineon-design-system-stencil.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/infineon-design-system-stencil/ifx-action-list-item.entry.esm.js.map +1 -1
- package/dist/infineon-design-system-stencil/ifx-basic-table.entry.esm.js.map +1 -1
- package/dist/infineon-design-system-stencil/ifx-button.entry.esm.js.map +1 -0
- package/dist/infineon-design-system-stencil/ifx-checkbox.entry.esm.js.map +1 -0
- package/dist/infineon-design-system-stencil/ifx-chip.ifx-chip-item.ifx-pagination.entry.esm.js.map +1 -0
- package/dist/infineon-design-system-stencil/ifx-icon-button.entry.esm.js.map +1 -0
- package/dist/infineon-design-system-stencil/ifx-icon.entry.esm.js.map +1 -0
- package/dist/infineon-design-system-stencil/ifx-indicator.entry.esm.js.map +1 -0
- package/dist/infineon-design-system-stencil/ifx-link.entry.esm.js.map +1 -1
- package/dist/infineon-design-system-stencil/ifx-search-field.entry.esm.js.map +1 -1
- package/dist/infineon-design-system-stencil/ifx-select.entry.esm.js.map +1 -0
- package/dist/infineon-design-system-stencil/ifx-spinner.ifx-text-field.entry.esm.js.map +1 -1
- package/dist/infineon-design-system-stencil/ifx-table.entry.esm.js.map +1 -0
- package/dist/infineon-design-system-stencil/infineon-design-system-stencil.esm.js +1 -1
- package/dist/infineon-design-system-stencil/p-169f26ae.entry.js +2 -0
- package/dist/infineon-design-system-stencil/{p-6fd710a6.entry.js.map → p-169f26ae.entry.js.map} +1 -1
- package/dist/infineon-design-system-stencil/p-2d5290c7.entry.js +2 -0
- package/dist/infineon-design-system-stencil/p-2d5290c7.entry.js.map +1 -0
- package/dist/infineon-design-system-stencil/p-39561a49.entry.js +2 -0
- package/dist/infineon-design-system-stencil/p-39561a49.entry.js.map +1 -0
- package/dist/infineon-design-system-stencil/p-3d77ef02.entry.js +2 -0
- package/dist/infineon-design-system-stencil/{p-81f0d6ad.entry.js.map → p-3d77ef02.entry.js.map} +1 -1
- package/dist/infineon-design-system-stencil/p-4da5a2a5.entry.js +2 -0
- package/dist/infineon-design-system-stencil/p-4da5a2a5.entry.js.map +1 -0
- package/dist/infineon-design-system-stencil/p-4fba0543.entry.js +2 -0
- package/dist/infineon-design-system-stencil/{p-7b705420.entry.js.map → p-4fba0543.entry.js.map} +1 -1
- package/dist/infineon-design-system-stencil/p-5e3d0ff0.entry.js +2 -0
- package/dist/infineon-design-system-stencil/p-5e3d0ff0.entry.js.map +1 -0
- package/dist/infineon-design-system-stencil/p-5fb3eb8b.entry.js +2 -0
- package/dist/infineon-design-system-stencil/p-5fb3eb8b.entry.js.map +1 -0
- package/dist/infineon-design-system-stencil/p-6e115707.entry.js +2 -0
- package/dist/infineon-design-system-stencil/{p-1b5dce92.entry.js.map → p-6e115707.entry.js.map} +1 -1
- package/dist/infineon-design-system-stencil/p-8a58c2be.entry.js +2 -0
- package/dist/infineon-design-system-stencil/p-8a58c2be.entry.js.map +1 -0
- package/dist/infineon-design-system-stencil/p-B85MJLTf.js +2 -0
- package/dist/infineon-design-system-stencil/p-B85MJLTf.js.map +1 -0
- package/dist/infineon-design-system-stencil/{p-Beav1bNT.js → p-DMLRPGid.js} +3 -3
- package/dist/infineon-design-system-stencil/{p-Beav1bNT.js.map → p-DMLRPGid.js.map} +1 -1
- package/dist/infineon-design-system-stencil/p-a85754a5.entry.js +3 -0
- package/dist/infineon-design-system-stencil/p-a85754a5.entry.js.map +1 -0
- package/dist/infineon-design-system-stencil/p-fcae5dc1.entry.js +2 -0
- package/dist/infineon-design-system-stencil/{p-646620f9.entry.js.map → p-fcae5dc1.entry.js.map} +1 -1
- package/dist/infineon-design-system-stencil/p-ff4cc197.entry.js +2 -0
- package/dist/infineon-design-system-stencil/p-ff4cc197.entry.js.map +1 -0
- package/package.json +1 -1
- package/dist/cjs/ifx-button.ifx-checkbox.ifx-chip.ifx-chip-item.ifx-icon.ifx-icon-button.ifx-indicator.ifx-pagination.ifx-select.ifx-table.entry.cjs.js.map +0 -1
- package/dist/cjs/ifx-button_10.cjs.entry.js +0 -9551
- package/dist/cjs/ifx-button_10.cjs.entry.js.map +0 -1
- package/dist/esm/ifx-button.ifx-checkbox.ifx-chip.ifx-chip-item.ifx-icon.ifx-icon-button.ifx-indicator.ifx-pagination.ifx-select.ifx-table.entry.js.map +0 -1
- package/dist/esm/ifx-button_10.entry.js +0 -9540
- package/dist/esm/ifx-button_10.entry.js.map +0 -1
- package/dist/infineon-design-system-stencil/ifx-button.ifx-checkbox.ifx-chip.ifx-chip-item.ifx-icon.ifx-icon-button.ifx-indicator.ifx-pagination.ifx-select.ifx-table.entry.esm.js.map +0 -1
- package/dist/infineon-design-system-stencil/p-1b5dce92.entry.js +0 -2
- package/dist/infineon-design-system-stencil/p-3f6242bc.entry.js +0 -3
- package/dist/infineon-design-system-stencil/p-3f6242bc.entry.js.map +0 -1
- package/dist/infineon-design-system-stencil/p-646620f9.entry.js +0 -2
- package/dist/infineon-design-system-stencil/p-6fd710a6.entry.js +0 -2
- package/dist/infineon-design-system-stencil/p-7b705420.entry.js +0 -2
- package/dist/infineon-design-system-stencil/p-81f0d6ad.entry.js +0 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ifx-action-list-item.entry.js","sources":["src/components/action-list/action-list-item.scss?tag=ifx-action-list-item&encapsulation=shadow","src/components/action-list/action-list-item.tsx"],"sourcesContent":["@use \"~@infineon/design-system-tokens/dist/tokens\";\n@use \"../../global/font.scss\";\n\n.action-list-item {\n display: flex;\n align-items: center;\n padding: tokens.$ifxSpace100 tokens.$ifxSpace200;\n background: tokens.$ifxColorBaseWhite;\n transition: background-color 0.2s ease;\n cursor: default;\n\n &--clickable {\n cursor: pointer;\n\n &:hover:not(.action-list-item--disabled) {\n background: tokens.$ifxColorEngineering100;\n }\n\n &:focus:not(.action-list-item--disabled) {\n outline: none;\n //outline: 2px solid tokens.$ifxColorOcean500;\n //outline-offset: -2px;\n background: tokens.$ifxColorEngineering100;\n }\n\n &:active:not(.action-list-item--disabled) {\n background: tokens.$ifxColorEngineering200;\n }\n }\n\n &--disabled {\n // Apply disabled color to all slotted icons\n ::slotted(ifx-icon) {\n color: tokens.$ifxColorEngineering300;\n }\n\n // Also apply to nested icons within slotted elements\n ::slotted(*) {\n ifx-icon {\n color: tokens.$ifxColorEngineering300;\n }\n }\n }\n\n &__leading {\n display: flex;\n align-items: center;\n justify-content: center;\n margin-right: tokens.$ifxSpace200;\n flex-shrink: 0;\n }\n\n &__content {\n flex: 1;\n min-width: 0; // Allows text to truncate\n }\n\n &__title {\n font-weight: tokens.$ifxFontWeightSemibold;\n font-size: tokens.$ifxFontSizeM;\n line-height: tokens.$ifxLineHeightM;\n color: tokens.$ifxColorBaseBlack;\n\n // Truncate long titles\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n\n // Disabled state\n .action-list-item--disabled & {\n color: tokens.$ifxColorEngineering300;\n }\n }\n\n &__description {\n font-size: tokens.$ifxFontSizeS;\n line-height: tokens.$ifxLineHeightS;\n color: tokens.$ifxColorEngineering500;\n margin-top: tokens.$ifxSpace25;\n\n // Disabled state\n .action-list-item--disabled & {\n color: tokens.$ifxColorEngineering300;\n }\n }\n\n &__trailing {\n display: flex;\n align-items: center;\n justify-content: center;\n margin-left: tokens.$ifxSpace200;\n flex-shrink: 0;\n gap: 16px;\n }\n}","import { Component, h, Prop, Element, Event, EventEmitter, Watch } from '@stencil/core';\nimport classNames from 'classnames';\n\nexport interface ActionListItemClickEvent {\n value?: string;\n href?: string;\n target?: string;\n component?: ActionListItem;\n}\n\n@Component({\n tag: 'ifx-action-list-item',\n styleUrl: 'action-list-item.scss',\n shadow: true,\n})\nexport class ActionListItem {\n @Element() host: HTMLElement;\n\n /**\n * The title text displayed in the item\n */\n @Prop() itemTitle: string;\n\n /**\n * The description text displayed below the title\n */\n @Prop() description?: string;\n\n /**\n * Value associated with this item\n */\n @Prop() value?: string;\n\n /**\n * URL to navigate to when item is clicked\n */\n @Prop() href?: string;\n\n /**\n * Target for the link navigation\n * @default '_self'\n */\n @Prop() target: string = '_self';\n\n /**\n * Controls whether the item is disabled\n * @default false\n */\n @Prop() disabled: boolean = false;\n\n /**\n * Aria label for accessibility support\n */\n @Prop() itemAriaLabel?: string;\n\n /**\n * Event emitted when the main item area is clicked\n */\n @Event() ifxActionListItemClick: EventEmitter<ActionListItemClickEvent>;\n\n @Watch('disabled')\n onDisabledChange() {\n // Update interactive elements when disabled state changes\n this.updateSlotElementsDisabledState();\n }\n\n private handleMainClick = (event: MouseEvent) => {\n if (this.disabled) {\n event.preventDefault();\n event.stopPropagation();\n return;\n }\n\n // Check if clicked element is inside leading or trailing areas\n const leadingElement = this.host.shadowRoot?.querySelector('.action-list-item__leading');\n const trailingElement = this.host.shadowRoot?.querySelector('.action-list-item__trailing');\n\n if (leadingElement?.contains(event.target as Node) || trailingElement?.contains(event.target as Node)) {\n return; // Don't trigger main click if clicking on leading/trailing areas\n }\n\n // Always emit main event when clicking on content area (text), regardless of interactive elements\n this.ifxActionListItemClick.emit({\n value: this.value,\n href: this.href,\n target: this.target,\n component: this,\n });\n\n // If href is provided, automatically navigate (Link mode)\n // If no href is provided, only the event is emitted (Event mode)\n if (this.href) {\n if (this.target === '_blank') {\n window.open(this.href, this.target);\n } else {\n window.location.href = this.href;\n }\n }\n };\n\n private handleLeadingClick = (event: MouseEvent) => {\n if (this.disabled) {\n event.preventDefault();\n event.stopPropagation();\n return;\n }\n\n const target = event.target as HTMLElement;\n\n // Check if the clicked element or any of its parents is an interactive component\n let currentElement = target;\n while (currentElement && currentElement !== this.host) {\n if (this.isInteractiveElement(currentElement)) {\n // Interactive element clicked - stop propagation to prevent main event\n event.stopPropagation();\n return;\n }\n currentElement = currentElement.parentElement;\n }\n\n // Non-interactive element clicked - trigger main action\n event.stopPropagation();\n this.ifxActionListItemClick.emit({\n value: this.value,\n href: this.href,\n target: this.target,\n component: this,\n });\n\n // If href is provided, automatically navigate\n if (this.href) {\n if (this.target === '_blank') {\n window.open(this.href, this.target);\n } else {\n window.location.href = this.href;\n }\n }\n };\n\n private handleTrailingClick = (event: MouseEvent) => {\n if (this.disabled) {\n event.preventDefault();\n event.stopPropagation();\n return;\n }\n\n const target = event.target as HTMLElement;\n\n // Check if the clicked element or any of its parents is an interactive component\n let currentElement = target;\n while (currentElement && currentElement !== this.host) {\n if (this.isInteractiveElement(currentElement)) {\n // Interactive element clicked - stop propagation to prevent main event\n event.stopPropagation();\n return;\n }\n currentElement = currentElement.parentElement;\n }\n\n // Non-interactive element clicked - trigger main action\n event.stopPropagation();\n this.ifxActionListItemClick.emit({\n value: this.value,\n href: this.href,\n target: this.target,\n component: this,\n });\n\n // If href is provided, automatically navigate\n if (this.href) {\n if (this.target === '_blank') {\n window.open(this.href, this.target);\n } else {\n window.location.href = this.href;\n }\n }\n };\n\n private isInteractiveElement = (element: HTMLElement): boolean => {\n // Get the tag name, handling both custom elements and standard HTML\n const tagName = element.tagName.toUpperCase();\n\n // List of Infineon components that should block main event\n const interactiveInfineonComponents = [\n 'IFX-BUTTON',\n 'IFX-CHECKBOX',\n 'IFX-SWITCH'\n ];\n\n // Check if it's an interactive Infineon component\n return interactiveInfineonComponents.includes(tagName);\n };\n\n private handleMainKeyDown = (event: KeyboardEvent) => {\n if (this.disabled) return;\n\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n\n // Always trigger main action via keyboard, regardless of interactive elements\n this.handleMainClick(event as any);\n }\n };\n\n private handleLeadingKeyDown = (event: KeyboardEvent) => {\n if (this.disabled) return;\n\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n\n const leadingSlot = this.host.shadowRoot?.querySelector('slot[name=\"leading\"]') as HTMLSlotElement;\n const assignedElements = leadingSlot?.assignedElements() || [];\n\n // Find first interactive element and activate it\n const firstInteractive = assignedElements.find(el =>\n this.isInteractiveElement(el as HTMLElement)\n ) as HTMLElement;\n\n if (firstInteractive) {\n firstInteractive.focus();\n firstInteractive.click();\n }\n }\n };\n\n private handleTrailingKeyDown = (event: KeyboardEvent) => {\n if (this.disabled) return;\n\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n\n const trailingSlot = this.host.shadowRoot?.querySelector('slot[name=\"trailing\"]') as HTMLSlotElement;\n const assignedElements = trailingSlot?.assignedElements() || [];\n\n // Find first interactive element and activate it\n const firstInteractive = assignedElements.find(el =>\n this.isInteractiveElement(el as HTMLElement)\n ) as HTMLElement;\n\n if (firstInteractive) {\n firstInteractive.focus();\n firstInteractive.click();\n }\n }\n };\n\n private hasSlotContent(slotName: string): boolean {\n const slot = this.host.querySelector(`[slot=\"${slotName}\"]`);\n return !!slot;\n }\n\n componentDidLoad() {\n // Apply disabled state to interactive elements in slots\n this.updateSlotElementsDisabledState();\n }\n\n componentDidUpdate() {\n // Apply disabled state to interactive elements in slots when disabled prop changes\n this.updateSlotElementsDisabledState();\n }\n\n private updateSlotElementsDisabledState = () => {\n // Only handle interactive components that should be disabled\n const interactiveComponents = ['ifx-checkbox', 'ifx-switch', 'ifx-button'];\n\n // Get all slotted elements\n const slots = this.host.querySelectorAll('[slot]');\n\n slots.forEach(slottedElement => {\n // Check if the slotted element itself is an interactive component\n if (interactiveComponents.includes(slottedElement.tagName.toLowerCase())) {\n this.setElementDisabledState(slottedElement as HTMLElement);\n }\n\n // Also check for nested interactive components within the slotted element\n interactiveComponents.forEach(componentTag => {\n const nestedElements = slottedElement.querySelectorAll(componentTag);\n nestedElements.forEach(nestedElement => {\n this.setElementDisabledState(nestedElement as HTMLElement);\n });\n });\n });\n };\n\n private setElementDisabledState = (element: HTMLElement) => {\n if (this.disabled) {\n element.setAttribute('disabled', 'true');\n } else {\n element.removeAttribute('disabled');\n }\n }; render() {\n const isClickable = !this.disabled && (this.href || this.value);\n const ariaLabel = this.itemAriaLabel || `${this.itemTitle}${this.description ? ` - ${this.description}` : ''}`;\n const hasLeadingContent = this.hasSlotContent('leading');\n const hasTrailingContent = this.hasSlotContent('trailing');\n\n return (\n <div\n class={classNames(\n 'action-list-item',\n this.disabled && 'action-list-item--disabled',\n isClickable && 'action-list-item--clickable'\n )}\n role=\"listitem\"\n tabIndex={isClickable ? 0 : -1}\n aria-label={ariaLabel}\n aria-disabled={this.disabled ? 'true' : undefined}\n onClick={this.handleMainClick}\n onKeyDown={this.handleMainKeyDown}\n >\n {/* Leading Item Container - only render if content exists */}\n {hasLeadingContent && (\n <div\n class=\"action-list-item__leading\"\n onClick={this.handleLeadingClick}\n onKeyDown={this.handleLeadingKeyDown}\n >\n <slot name=\"leading\"></slot>\n </div>\n )}\n\n {/* Text Container */}\n <div class=\"action-list-item__content\">\n <div class=\"action-list-item__title\">\n {this.itemTitle}\n </div>\n {this.description && (\n <div class=\"action-list-item__description\">\n {this.description}\n </div>\n )}\n </div>\n\n {/* Trailing Item Container - only render if content exists */}\n {hasTrailingContent && (\n <div\n class=\"action-list-item__trailing\"\n onClick={this.handleTrailingClick}\n onKeyDown={this.handleTrailingKeyDown}\n >\n <slot name=\"trailing\"></slot>\n </div>\n )}\n </div>\n );\n }\n}"],"names":[],"mappings":";;;AAAA,MAAM,iBAAiB,GAAG,wyCAAwyC;;MCerzC,cAAc,GAAA,MAAA;AAL3B,IAAA,WAAA,CAAA,OAAA,EAAA;;;AA4BE;;;AAGG;AACK,QAAA,IAAM,CAAA,MAAA,GAAW,OAAO;AAEhC;;;AAGG;AACK,QAAA,IAAQ,CAAA,QAAA,GAAY,KAAK;AAkBzB,QAAA,IAAA,CAAA,eAAe,GAAG,CAAC,KAAiB,KAAI;;AAC9C,YAAA,IAAI,IAAI,CAAC,QAAQ,EAAE;gBACjB,KAAK,CAAC,cAAc,EAAE;gBACtB,KAAK,CAAC,eAAe,EAAE;gBACvB;;;AAIF,YAAA,MAAM,cAAc,GAAG,CAAA,EAAA,GAAA,IAAI,CAAC,IAAI,CAAC,UAAU,MAAE,IAAA,IAAA,EAAA,KAAA,MAAA,GAAA,MAAA,GAAA,EAAA,CAAA,aAAa,CAAC,4BAA4B,CAAC;AACxF,YAAA,MAAM,eAAe,GAAG,CAAA,EAAA,GAAA,IAAI,CAAC,IAAI,CAAC,UAAU,MAAE,IAAA,IAAA,EAAA,KAAA,MAAA,GAAA,MAAA,GAAA,EAAA,CAAA,aAAa,CAAC,6BAA6B,CAAC;YAE1F,IAAI,CAAA,cAAc,KAAd,IAAA,IAAA,cAAc,KAAd,MAAA,GAAA,MAAA,GAAA,cAAc,CAAE,QAAQ,CAAC,KAAK,CAAC,MAAc,CAAC,MAAI,eAAe,KAAA,IAAA,IAAf,eAAe,KAAA,MAAA,GAAA,MA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,KAAK,EAAC,4BAA4B,EAClC,OAAO,EAAE,IAAI,CAAC,mBAAmB,EACjC,SAAS,EAAE,IAAI,CAAC,qBAAqB,EAAA,EAErC,CAAM,CAAA,MAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAA,IAAI,EAAC,UAAU,EAAA,CAAQ,CACzB,CACP,CACG;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"ifx-action-list-item.entry.js","sources":["src/components/action-list/action-list-item.scss?tag=ifx-action-list-item&encapsulation=shadow","src/components/action-list/action-list-item.tsx"],"sourcesContent":["@use \"~@infineon/design-system-tokens/dist/tokens\";\n@use \"../../global/font.scss\";\n\n.action-list-item {\n display: flex;\n align-items: center;\n padding: tokens.$ifxSpace100 tokens.$ifxSpace200;\n background: tokens.$ifxColorBaseWhite;\n transition: background-color 0.2s ease;\n cursor: default;\n\n &--clickable {\n cursor: pointer;\n\n &:hover:not(.action-list-item--disabled) {\n background: tokens.$ifxColorEngineering100;\n }\n\n &:focus:not(.action-list-item--disabled) {\n outline: none;\n //outline: 2px solid tokens.$ifxColorOcean500;\n //outline-offset: -2px;\n background: tokens.$ifxColorEngineering100;\n }\n\n &:active:not(.action-list-item--disabled) {\n background: tokens.$ifxColorEngineering200;\n }\n }\n\n &--disabled {\n // Apply disabled color to all slotted icons\n ::slotted(ifx-icon) {\n color: tokens.$ifxColorEngineering300;\n }\n\n // Also apply to nested icons within slotted elements\n ::slotted(*) {\n ifx-icon {\n color: tokens.$ifxColorEngineering300;\n }\n }\n }\n\n &__leading {\n display: flex;\n align-items: center;\n justify-content: center;\n margin-right: tokens.$ifxSpace200;\n flex-shrink: 0;\n }\n\n &__content {\n flex: 1;\n min-width: 0; // Allows text to truncate\n }\n\n &__title {\n font-weight: tokens.$ifxFontWeightSemibold;\n font-size: tokens.$ifxFontSizeM;\n line-height: tokens.$ifxLineHeightM;\n color: tokens.$ifxColorBaseBlack;\n\n // Truncate long titles\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n\n // Disabled state\n .action-list-item--disabled & {\n color: tokens.$ifxColorEngineering300;\n }\n }\n\n &__description {\n font-size: tokens.$ifxFontSizeS;\n line-height: tokens.$ifxLineHeightS;\n color: tokens.$ifxColorEngineering500;\n margin-top: tokens.$ifxSpace25;\n\n // Disabled state\n .action-list-item--disabled & {\n color: tokens.$ifxColorEngineering300;\n }\n }\n\n &__trailing {\n display: flex;\n align-items: center;\n justify-content: center;\n margin-left: tokens.$ifxSpace200;\n flex-shrink: 0;\n gap: 16px;\n }\n}","import { Component, h, Prop, Element, Event, EventEmitter, Watch } from '@stencil/core';\nimport classNames from 'classnames';\n\nexport interface ActionListItemClickEvent {\n value?: string;\n href?: string;\n target?: string;\n component?: ActionListItem;\n}\n\n@Component({\n tag: 'ifx-action-list-item',\n styleUrl: 'action-list-item.scss',\n shadow: true,\n})\nexport class ActionListItem {\n @Element() host: HTMLElement;\n\n /**\n * The title text displayed in the item\n */\n @Prop() itemTitle: string;\n\n /**\n * The description text displayed below the title\n */\n @Prop() description?: string;\n\n /**\n * Value associated with this item\n */\n @Prop() value?: string;\n\n /**\n * URL to navigate to when item is clicked\n */\n @Prop() href?: string;\n\n /**\n * Target for the link navigation\n * @default '_self'\n */\n @Prop() target: string = '_self';\n\n /**\n * Controls whether the item is disabled\n * @default false\n */\n @Prop() disabled: boolean = false;\n\n /**\n * Aria label for accessibility support\n */\n @Prop() itemAriaLabel?: string;\n\n /**\n * Event emitted when the main item area is clicked\n */\n @Event() ifxActionListItemClick: EventEmitter<ActionListItemClickEvent>;\n\n @Watch('disabled')\n onDisabledChange() {\n // Update interactive elements when disabled state changes\n this.updateSlotElementsDisabledState();\n }\n\n private handleMainClick = (event: MouseEvent) => {\n if (this.disabled) {\n event.preventDefault();\n event.stopPropagation();\n return;\n }\n\n // Check if clicked element is inside leading or trailing areas\n const leadingElement = this.host.shadowRoot?.querySelector('.action-list-item__leading');\n const trailingElement = this.host.shadowRoot?.querySelector('.action-list-item__trailing');\n\n if (leadingElement?.contains(event.target as Node) || trailingElement?.contains(event.target as Node)) {\n return; // Don't trigger main click if clicking on leading/trailing areas\n }\n\n // Always emit main event when clicking on content area (text), regardless of interactive elements\n this.ifxActionListItemClick.emit({\n value: this.value,\n href: this.href,\n target: this.target,\n component: this,\n });\n\n // If href is provided, automatically navigate (Link mode)\n // If no href is provided, only the event is emitted (Event mode)\n if (this.href) {\n if (this.target === '_blank') {\n window.open(this.href, this.target);\n } else {\n window.location.href = this.href;\n }\n }\n };\n\n private handleLeadingClick = (event: MouseEvent) => {\n if (this.disabled) {\n event.preventDefault();\n event.stopPropagation();\n return;\n }\n\n const target = event.target as HTMLElement;\n\n // Check if the clicked element or any of its parents is an interactive component\n let currentElement = target;\n while (currentElement && currentElement !== this.host) {\n if (this.isInteractiveElement(currentElement)) {\n // Interactive element clicked - stop propagation to prevent main event\n event.stopPropagation();\n return;\n }\n currentElement = currentElement.parentElement;\n }\n\n // Non-interactive element clicked - trigger main action\n event.stopPropagation();\n this.ifxActionListItemClick.emit({\n value: this.value,\n href: this.href,\n target: this.target,\n component: this,\n });\n\n // If href is provided, automatically navigate\n if (this.href) {\n if (this.target === '_blank') {\n window.open(this.href, this.target);\n } else {\n window.location.href = this.href;\n }\n }\n };\n\n private handleTrailingClick = (event: MouseEvent) => {\n if (this.disabled) {\n event.preventDefault();\n event.stopPropagation();\n return;\n }\n\n const target = event.target as HTMLElement;\n\n // Check if the clicked element or any of its parents is an interactive component\n let currentElement = target;\n while (currentElement && currentElement !== this.host) {\n if (this.isInteractiveElement(currentElement)) {\n // Interactive element clicked - stop propagation to prevent main event\n event.stopPropagation();\n return;\n }\n currentElement = currentElement.parentElement;\n }\n\n // Non-interactive element clicked - trigger main action\n event.stopPropagation();\n this.ifxActionListItemClick.emit({\n value: this.value,\n href: this.href,\n target: this.target,\n component: this,\n });\n\n // If href is provided, automatically navigate\n if (this.href) {\n if (this.target === '_blank') {\n window.open(this.href, this.target);\n } else {\n window.location.href = this.href;\n }\n }\n };\n\n private isInteractiveElement = (element: HTMLElement): boolean => {\n // Get the tag name, handling both custom elements and standard HTML\n const tagName = element.tagName.toUpperCase();\n\n // List of Infineon components that should block main event\n const interactiveInfineonComponents = [\n 'IFX-BUTTON',\n 'IFX-CHECKBOX',\n 'IFX-SWITCH'\n ];\n\n // Check if it's an interactive Infineon component\n return interactiveInfineonComponents.includes(tagName);\n };\n\n private handleMainKeyDown = (event: KeyboardEvent) => {\n if (this.disabled) return;\n\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n\n // Always trigger main action via keyboard, regardless of interactive elements\n this.handleMainClick(event as any);\n }\n };\n\n private handleLeadingKeyDown = (event: KeyboardEvent) => {\n if (this.disabled) return;\n\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n\n const leadingSlot = this.host.shadowRoot?.querySelector('slot[name=\"leading\"]') as HTMLSlotElement;\n const assignedElements = leadingSlot?.assignedElements() || [];\n\n // Find first interactive element and activate it\n const firstInteractive = assignedElements.find(el =>\n this.isInteractiveElement(el as HTMLElement)\n ) as HTMLElement;\n\n if (firstInteractive) {\n firstInteractive.focus();\n firstInteractive.click();\n }\n }\n };\n\n private handleTrailingKeyDown = (event: KeyboardEvent) => {\n if (this.disabled) return;\n\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n\n const trailingSlot = this.host.shadowRoot?.querySelector('slot[name=\"trailing\"]') as HTMLSlotElement;\n const assignedElements = trailingSlot?.assignedElements() || [];\n\n // Find first interactive element and activate it\n const firstInteractive = assignedElements.find(el =>\n this.isInteractiveElement(el as HTMLElement)\n ) as HTMLElement;\n\n if (firstInteractive) {\n firstInteractive.focus();\n firstInteractive.click();\n }\n }\n };\n\n private hasSlotContent(slotName: string): boolean {\n const slot = this.host.querySelector(`[slot=\"${slotName}\"]`);\n return !!slot;\n }\n\n componentDidLoad() {\n // Apply disabled state to interactive elements in slots\n this.updateSlotElementsDisabledState();\n }\n\n componentDidUpdate() {\n // Apply disabled state to interactive elements in slots when disabled prop changes\n this.updateSlotElementsDisabledState();\n }\n\n private updateSlotElementsDisabledState = () => {\n // Only handle interactive components that should be disabled\n const interactiveComponents = ['ifx-checkbox', 'ifx-switch', 'ifx-button'];\n\n // Get all slotted elements\n const slots = this.host.querySelectorAll('[slot]');\n\n slots.forEach(slottedElement => {\n // Check if the slotted element itself is an interactive component\n if (interactiveComponents.includes(slottedElement.tagName.toLowerCase())) {\n this.setElementDisabledState(slottedElement as HTMLElement);\n }\n\n // Also check for nested interactive components within the slotted element\n interactiveComponents.forEach(componentTag => {\n const nestedElements = slottedElement.querySelectorAll(componentTag);\n nestedElements.forEach(nestedElement => {\n this.setElementDisabledState(nestedElement as HTMLElement);\n });\n });\n });\n };\n\n private setElementDisabledState = (element: HTMLElement) => {\n if (this.disabled) {\n element.setAttribute('disabled', 'true');\n } else {\n element.removeAttribute('disabled');\n }\n }; render() {\n const isClickable = !this.disabled && (this.href || this.value);\n const ariaLabel = this.itemAriaLabel || `${this.itemTitle}${this.description ? ` - ${this.description}` : ''}`;\n const hasLeadingContent = this.hasSlotContent('leading');\n const hasTrailingContent = this.hasSlotContent('trailing');\n\n return (\n <div\n class={classNames(\n 'action-list-item',\n this.disabled && 'action-list-item--disabled',\n isClickable && 'action-list-item--clickable'\n )}\n role=\"listitem\"\n tabIndex={isClickable ? 0 : -1}\n aria-label={ariaLabel}\n aria-disabled={this.disabled ? 'true' : undefined}\n onClick={this.handleMainClick}\n onKeyDown={this.handleMainKeyDown}\n >\n {/* Leading Item Container - only render if content exists */}\n {hasLeadingContent && (\n <div\n class=\"action-list-item__leading\"\n onClick={this.handleLeadingClick}\n onKeyDown={this.handleLeadingKeyDown}\n >\n <slot name=\"leading\"></slot>\n </div>\n )}\n\n {/* Text Container */}\n <div class=\"action-list-item__content\">\n <div class=\"action-list-item__title\">\n {this.itemTitle}\n </div>\n {this.description && (\n <div class=\"action-list-item__description\">\n {this.description}\n </div>\n )}\n </div>\n\n {/* Trailing Item Container - only render if content exists */}\n {hasTrailingContent && (\n <div\n class=\"action-list-item__trailing\"\n onClick={this.handleTrailingClick}\n onKeyDown={this.handleTrailingKeyDown}\n >\n <slot name=\"trailing\"></slot>\n </div>\n )}\n </div>\n );\n }\n}"],"names":[],"mappings":";;;;AAAA,MAAM,iBAAiB,GAAG,wyCAAwyC;;MCerzC,cAAc,GAAA,MAAA;AAL3B,IAAA,WAAA,CAAA,OAAA,EAAA;;;AA4BE;;;AAGG;AACK,QAAA,IAAM,CAAA,MAAA,GAAW,OAAO;AAEhC;;;AAGG;AACK,QAAA,IAAQ,CAAA,QAAA,GAAY,KAAK;AAkBzB,QAAA,IAAA,CAAA,eAAe,GAAG,CAAC,KAAiB,KAAI;;AAC9C,YAAA,IAAI,IAAI,CAAC,QAAQ,EAAE;gBACjB,KAAK,CAAC,cAAc,EAAE;gBACtB,KAAK,CAAC,eAAe,EAAE;gBACvB;;;AAIF,YAAA,MAAM,cAAc,GAAG,CAAA,EAAA,GAAA,IAAI,CAAC,IAAI,CAAC,UAAU,MAAE,IAAA,IAAA,EAAA,KAAA,MAAA,GAAA,MAAA,GAAA,EAAA,CAAA,aAAa,CAAC,4BAA4B,CAAC;AACxF,YAAA,MAAM,eAAe,GAAG,CAAA,EAAA,GAAA,IAAI,CAAC,IAAI,CAAC,UAAU,MAAE,IAAA,IAAA,EAAA,KAAA,MAAA,GAAA,MAAA,GAAA,EAAA,CAAA,aAAa,CAAC,6BAA6B,CAAC;YAE1F,IAAI,CAAA,cAAc,KAAd,IAAA,IAAA,cAAc,KAAd,MAAA,GAAA,MAAA,GAAA,cAAc,CAAE,QAAQ,CAAC,KAAK,CAAC,MAAc,CAAC,MAAI,eAAe,KAAA,IAAA,IAAf,eAAe,KAAA,MAAA,GAAA,MAAA,GAAf,eAAe,CAAE,QAAQ,CAAC,KAAK,CAAC,MAAc,CAAC,CAAA,EAAE;AACrG,gBAAA,OAAO;;;AAIT,YAAA,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC;gBAC/B,K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0CAAA,EAAA,IAAI,EAAC,UAAU,EAAA,CAAQ,CACzB,CACP,CACG;;;;;;;;;;;"}
|
|
@@ -2,7 +2,8 @@ import { r as registerInstance, h, d as Host, a as getElement } from './index-Pq
|
|
|
2
2
|
import { d as detectFramework, t as trackComponent } from './framework-detection-DcmcuUOA.js';
|
|
3
3
|
import { i as isNestedInIfxComponent } from './dom-utils-Bw2fh5LT.js';
|
|
4
4
|
import { c as createGrid } from './main.esm-9UDg_bQZ.js';
|
|
5
|
-
import { c as classNames } from './index-
|
|
5
|
+
import { c as classNames } from './index-Bt32KzDW.js';
|
|
6
|
+
import './_commonjsHelpers-B85MJLTf.js';
|
|
6
7
|
|
|
7
8
|
class CustomNoRowsOverlay {
|
|
8
9
|
init(params) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ifx-basic-table.entry.js","sources":["src/components/table-basic-version/customNoRowsOverlay.ts","src/components/table-basic-version/customLoadingOverlay.ts","src/components/table-basic-version/table.scss?tag=ifx-basic-table","src/components/table-basic-version/table.tsx"],"sourcesContent":["import { ICellRendererComp, ICellRendererParams } from 'ag-grid-community';\n\nexport class CustomNoRowsOverlay implements ICellRendererComp {\n eGui!: HTMLElement;\n\n init(params: ICellRendererParams & { noRowsMessageFunc: () => string }) {\n this.eGui = document.createElement('div');\n this.eGui.innerHTML = `\n <div role=\"presentation\" class=\"ag-overlay-loading-center\" >\n ${params.noRowsMessageFunc()}\n </div>\n `;\n }\n\n getGui() {\n return this.eGui;\n }\n\n refresh(_params: ICellRendererParams): boolean {\n return false;\n }\n}","import { ICellRendererComp, ICellRendererParams } from 'ag-grid-community';\n\nexport class CustomLoadingOverlay implements ICellRendererComp {\n eGui!: HTMLElement;\n\n init(_params: ICellRendererParams & { loadingMessage: string }) {\n this.eGui = document.createElement('div');\n this.eGui.innerHTML = `<div class=\"ag-overlay-loading-center\" role=\"presentation\">\n<ifx-spinner></ifx-spinner>\n </div>`;\n }\n\n getGui() {\n return this.eGui;\n }\n\n refresh(_params: ICellRendererParams): boolean {\n return false;\n }\n}","@use \"~@infineon/design-system-tokens/dist/tokens\";\n@use \"../../global/font.scss\";\n\n@import \"~ag-grid-community/styles/ag-grid.css\";\n// @import \"~ag-grid-community/styles/ag-theme-alpine.css\";\n\n// :host {\n// --table-height: '200px';\n// /* Default value */\n// } ag-ltr .ag-header-cell-resize\n\n.zebra {\n & .ag-row-odd {\n background-color: tokens.$ifxColorEngineering100!important;\n }\n\n & .ag-row {\n border-bottom: none!important;\n }\n}\n\n.ag-header-viewport {\n background-color: tokens.$ifxColorEngineering200!important;\n}\n\n.table-wrapper {\n overflow-x: auto;\n width: 100%;\n}\n\n.table-wrapper .ag-root-wrapper-body {\n height: auto !important;\n min-height: 100px !important;\n min-width: 100px;\n}\n\n.ifx-ag-grid {\n display: grid;\n height: 100%;\n width: 100%;\n min-width: 100px;\n padding-bottom: tokens.$ifxSpace100;\n overflow-x: auto;\n}\n\n\n.ifx-ag-grid .ag-header-cell::after {\n outline: none !important;\n border: none !important;\n box-shadow: none !important;\n}\n\n.ifx-ag-grid .ag-header-cell:focus {\n outline: none !important;\n}\n\n.ifx-ag-grid *:not(.ag-header-cell):focus {\n outline: none;\n}\n\n.ifx-ag-grid .ag-header-cell:not(:last-child)::before {\n content: '';\n position: absolute;\n right: 0;\n top: calc(50% - 12px);\n height: 24px;\n width: 1px;\n background-color: tokens.$ifxColorEngineering300;\n}\n\n.ag-overlay-loading-center {\n border: none;\n background: none;\n border-radius: none;\n box-shadow: none;\n}\n\n\n.ag-root-wrapper {\n border: 1px solid tokens.$ifxColorEngineering200;\n}\n\n.ag-header {\n background-color: tokens.$ifxColorEngineering100;\n border-bottom: none;\n\n &.ag-header-active {\n outline: none !important;\n border-color: #0A8276 !important;\n }\n}\n\n.ag-header-cell {\n padding-left: 16px;\n padding-right: 16px;\n gap: 4px;\n}\n\n\n.ag-header-cell-focus {\n border: none !important;\n outline: none !important;\n}\n\n.ag-header-cell-text {\n font-size: 13px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n color: tokens.$ifxColorBaseBlack;\n font-family: var(--ifx-font-family); // tokens.$ifxFontFamilyBody;\n\n\n\n}\n\n.ag-row-focus {\n background-color: inherit !important;\n /* Reset the hover color to the row's original color */\n}\n\n.ag-row-hover {\n background-color: tokens.$ifxColorBaseWhite !important; //inherit !important;\n /* Reset the hover color to the row's original color */\n}\n\n\n.ag-cell-focus {\n border: none !important;\n outline: none !important;\n background-color: inherit !important;\n}\n\n\n\n.ag-row {\n background-color: tokens.$ifxColorBaseWhite;\n border-bottom: 1px solid tokens.$ifxColorEngineering200;\n font-size: 13px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n z-index: 1; //ensure the stacking order when used inside js frameworks\n}\n\n.ag-row-odd {\n background-color: tokens.$ifxColorBaseWhite;\n}\n\n.ag-cell {\n display: flex;\n padding-left: 16px;\n padding-right: 16px;\n white-space: pre-line;\n min-height: 40px; \n height: auto;\n}\n\n.ag-ltr .ag-sort-indicator-icon {\n padding-left: 0px;\n vertical-align: bottom;\n line-height: 12px;\n}\n\n.unsort-icon-custom-color {\n color: tokens.$ifxColorEngineering400;\n}\n\n// Mobile optimization for horizontal scrolling\n@media (max-width: tokens.$ifxBreakpointM) {\n .table-wrapper {\n overflow-x: auto;\n -webkit-overflow-scrolling: touch;\n }\n\n .ifx-ag-grid {\n min-width: 400px;\n }\n\n .ag-root-wrapper {\n min-width: 100%;\n }\n\n .ag-header-cell,\n .ag-cell {\n min-width: 100px;\n white-space: nowrap;\n }\n\n .table-wrapper {\n margin-bottom: tokens.$ifxSpace200;\n }\n}\n","import { Component, h, Element, Host, Prop, State } from '@stencil/core';\nimport { trackComponent } from '../../global/utils/tracking';\nimport { isNestedInIfxComponent } from '../../global/utils/dom-utils';\nimport { detectFramework } from '../../global/utils/framework-detection';\nimport { createGrid, FirstDataRenderedEvent, GridApi, GridOptions } from 'ag-grid-community';\nimport { CustomNoRowsOverlay } from './customNoRowsOverlay';\nimport { CustomLoadingOverlay } from './customLoadingOverlay';\nimport classNames from 'classnames';\n\n@Component({\n tag: 'ifx-basic-table',\n styleUrl: 'table.scss',\n shadow: false // only works with shadowdom off because we are using an external library\n})\nexport class Table {\n @State() gridOptions: GridOptions;\n @Prop() cols: any[] | string;\n @Prop() rows: any[] | string;\n @State() columnDefs: any[] = [];\n @State() rowData: any[] = [];\n @Prop() rowHeight: string = 'default';\n @Prop() tableHeight: string = 'auto';\n @Prop() variant: string = 'default'\n @State() uniqueKey: string;\n @Element() host: HTMLElement;\n \n private container: HTMLDivElement;\n private gridApi: GridApi; \n private gridInitialized = false;\n\n componentWillLoad() {\n this.uniqueKey = `unique-${Math.floor(Math.random() * 1000000)}`;\n this.setColsAndRows(); //needed?\n this.setGridOptions();\n }\n\n setGridOptions() {\n this.gridOptions = {\n rowHeight: this.rowHeight === 'default' ? 40 : 32,\n headerHeight: 40,\n defaultColDef: {\n resizable: true,\n autoHeight: true,\n },\n suppressCellFocus: false,\n enableCellTextSelection: true,\n suppressDragLeaveHidesColumns: true,\n suppressRowHoverHighlight: true,\n onFirstDataRendered: this.onFirstDataRendered,\n columnDefs: this.columnDefs,\n rowData: this.rowData,\n loadingOverlayComponent: CustomLoadingOverlay,\n noRowsOverlayComponent: CustomNoRowsOverlay,\n noRowsOverlayComponentParams: {\n noRowsMessageFunc: () =>\n 'No rows found at: ' + new Date().toLocaleTimeString(),\n },\n icons: {\n sortAscending: '<ifx-icon icon=\"arrow-triangle-up-16\"></ifx-icon>',\n sortDescending: '<ifx-icon icon=\"arrow-triangle-down-16\"></ifx-icon>',\n sortUnSort: '<a class=\"unsort-icon-custom-color\"><ifx-icon icon=\"arrow-triangle-vertikal-16\"></ifx-icon></a>',\n },\n rowDragManaged: this.columnDefs.some((col) => col.dndSource === true) ? true : false,\n animateRows: this.columnDefs.some((col) => col.dndSource === true) ? true : false,\n };\n }\n\n setColsAndRows() {\n if (typeof this.rows === 'string' && typeof this.cols === 'string') {\n try {\n if(this.cols) {\n this.columnDefs = JSON.parse(this.cols);\n }\n if(this.rows) {\n this.rowData = JSON.parse(this.rows);\n }\n } catch (err) {\n console.error('Failed to parse input:', err);\n }\n } else if ((Array.isArray(this.rows) || typeof this.rows === 'object') && (Array.isArray(this.cols) || typeof this.cols === 'object')) {\n this.columnDefs = this.cols;\n this.rowData = this.rows;\n } else {\n console.error('Unexpected value for cols and rows:', this.rows, this.cols);\n }\n }\n\n getRowData() {\n let rows: any[] = [];\n if (typeof this.rows === 'string') {\n try {\n if(this.rows) {\n rows = JSON.parse(this.rows);\n }\n } catch (err) {\n console.error('Failed to parse input:', err);\n }\n } else if (Array.isArray(this.rows) || typeof this.rows === 'object') {\n rows = this.rows;\n } else {\n console.error('Unexpected value for rows: ', this.rows);\n }\n\n return rows;\n }\n\n getColData() {\n let cols: any[] = [];\n\n if (typeof this.cols === 'string') {\n try {\n if(this.cols) { \n cols = JSON.parse(this.cols);\n }\n } catch (err) {\n console.error('Failed to parse input:', err);\n }\n } else if (Array.isArray(this.cols) || typeof this.cols === 'object') {\n cols = this.cols;\n } else {\n console.error('Unexpected value for cols: ', this.cols);\n }\n return cols;\n }\n\n onFirstDataRendered(params: FirstDataRenderedEvent) {\n params.api.sizeColumnsToFit();\n }\n\n componentWillUpdate() {\n this.setColsAndRows();\n this.gridOptions.columnDefs = this.columnDefs;\n this.gridOptions.rowData = this.rowData;\n if (this.gridApi) {\n this.gridApi.setGridOption('rowData', this.rowData);\n this.gridApi.setGridOption('columnDefs', this.columnDefs);\n }\n }\n\n async componentDidLoad() {\n if (this.container && !this.gridInitialized) {\n if(!isNestedInIfxComponent(this.host)) { \n const framework = detectFramework();\n trackComponent('ifx-basic-table', await framework)\n }\n this.gridApi = createGrid(this.container, this.gridOptions);\n if (this.gridApi) {\n this.gridApi.sizeColumnsToFit({\n defaultMinWidth: 100,\n });\n this.gridApi.setGridOption('columnDefs', this.getColData());\n this.gridApi.setGridOption('rowData', this.getRowData());\n this.gridInitialized = true; \n }\n }\n }\n\n getClassNames() {\n return classNames(\n this.tableHeight === 'auto' && 'table-wrapper ag-root-wrapper-body',\n 'table-wrapper',\n );\n }\n\n getTableStyle() {\n if (this.tableHeight !== 'auto') {\n return {\n height: this.tableHeight,\n };\n }\n return {};\n }\n\n render() {\n return (\n <Host>\n <div id=\"table-wrapper\" class={this.getClassNames()}>\n <div id={`ifxTable-${this.uniqueKey}`} class={`ifx-ag-grid ${this.variant === 'zebra' ? 'zebra' : \"\"}`} style={this.getTableStyle()} ref={(el) => (this.container = el)}></div>\n </div>\n </Host>\n );\n }\n}\n"],"names":[],"mappings":";;;;;;MAEa,mBAAmB,CAAA;AAG9B,IAAA,IAAI,CAAC,MAAiE,EAAA;QACpE,IAAI,CAAC,IAAI,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC;AACzC,QAAA,IAAI,CAAC,IAAI,CAAC,SAAS,GAAG;;iBAET,MAAM,CAAC,iBAAiB,EAAE;;SAElC;;IAGP,MAAM,GAAA;QACJ,OAAO,IAAI,CAAC,IAAI;;AAGlB,IAAA,OAAO,CAAC,OAA4B,EAAA;AAClC,QAAA,OAAO,KAAK;;AAEf;;MCnBY,oBAAoB,CAAA;AAG/B,IAAA,IAAI,CAAC,OAAyD,EAAA;QAC5D,IAAI,CAAC,IAAI,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC;AACzC,QAAA,IAAI,CAAC,IAAI,CAAC,SAAS,GAAG,CAAA;;mBAEP;;IAGjB,MAAM,GAAA;QACJ,OAAO,IAAI,CAAC,IAAI;;AAGlB,IAAA,OAAO,CAAC,OAA4B,EAAA;AAClC,QAAA,OAAO,KAAK;;AAEf;;ACnBD,MAAM,QAAQ,GAAG,ipkOAAipkO;;MCcrpkO,KAAK,GAAA,MAAA;AALlB,IAAA,WAAA,CAAA,OAAA,EAAA;;AASW,QAAA,IAAU,CAAA,UAAA,GAAU,EAAE;AACtB,QAAA,IAAO,CAAA,OAAA,GAAU,EAAE;AACpB,QAAA,IAAS,CAAA,S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AI,IAAI,CAAC,WAAW,KAAK,MAAM,EAAE;YAC/B,OAAO;gBACL,MAAM,EAAE,IAAI,CAAC,WAAW;aACzB;;AAEH,QAAA,OAAO,EAAE;;IAGX,MAAM,GAAA;QACJ,QACE,EAAC,IAAI,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAA,EACH,CAAK,CAAA,KAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAA,EAAE,EAAC,eAAe,EAAC,KAAK,EAAE,IAAI,CAAC,aAAa,EAAE,EAAA,EACjD,CAAK,CAAA,KAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAA,EAAE,EAAE,YAAY,IAAI,CAAC,SAAS,CAAE,CAAA,EAAE,KAAK,EAAE,CAAA,YAAA,EAAe,IAAI,CAAC,OAAO,KAAK,OAAO,GAAG,OAAO,GAAG,EAAE,CAAE,CAAA,EAAE,KAAK,EAAE,IAAI,CAAC,aAAa,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,MAAM,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC,EAAQ,CAAA,CAC3K,CACD;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"ifx-basic-table.entry.js","sources":["src/components/table-basic-version/customNoRowsOverlay.ts","src/components/table-basic-version/customLoadingOverlay.ts","src/components/table-basic-version/table.scss?tag=ifx-basic-table","src/components/table-basic-version/table.tsx"],"sourcesContent":["import { ICellRendererComp, ICellRendererParams } from 'ag-grid-community';\n\nexport class CustomNoRowsOverlay implements ICellRendererComp {\n eGui!: HTMLElement;\n\n init(params: ICellRendererParams & { noRowsMessageFunc: () => string }) {\n this.eGui = document.createElement('div');\n this.eGui.innerHTML = `\n <div role=\"presentation\" class=\"ag-overlay-loading-center\" >\n ${params.noRowsMessageFunc()}\n </div>\n `;\n }\n\n getGui() {\n return this.eGui;\n }\n\n refresh(_params: ICellRendererParams): boolean {\n return false;\n }\n}","import { ICellRendererComp, ICellRendererParams } from 'ag-grid-community';\n\nexport class CustomLoadingOverlay implements ICellRendererComp {\n eGui!: HTMLElement;\n\n init(_params: ICellRendererParams & { loadingMessage: string }) {\n this.eGui = document.createElement('div');\n this.eGui.innerHTML = `<div class=\"ag-overlay-loading-center\" role=\"presentation\">\n<ifx-spinner></ifx-spinner>\n </div>`;\n }\n\n getGui() {\n return this.eGui;\n }\n\n refresh(_params: ICellRendererParams): boolean {\n return false;\n }\n}","@use \"~@infineon/design-system-tokens/dist/tokens\";\n@use \"../../global/font.scss\";\n\n@import \"~ag-grid-community/styles/ag-grid.css\";\n// @import \"~ag-grid-community/styles/ag-theme-alpine.css\";\n\n// :host {\n// --table-height: '200px';\n// /* Default value */\n// } ag-ltr .ag-header-cell-resize\n\n.zebra {\n & .ag-row-odd {\n background-color: tokens.$ifxColorEngineering100!important;\n }\n\n & .ag-row {\n border-bottom: none!important;\n }\n}\n\n.ag-header-viewport {\n background-color: tokens.$ifxColorEngineering200!important;\n}\n\n.table-wrapper {\n overflow-x: auto;\n width: 100%;\n}\n\n.table-wrapper .ag-root-wrapper-body {\n height: auto !important;\n min-height: 100px !important;\n min-width: 100px;\n}\n\n.ifx-ag-grid {\n display: grid;\n height: 100%;\n width: 100%;\n min-width: 100px;\n padding-bottom: tokens.$ifxSpace100;\n overflow-x: auto;\n}\n\n\n.ifx-ag-grid .ag-header-cell::after {\n outline: none !important;\n border: none !important;\n box-shadow: none !important;\n}\n\n.ifx-ag-grid .ag-header-cell:focus {\n outline: none !important;\n}\n\n.ifx-ag-grid *:not(.ag-header-cell):focus {\n outline: none;\n}\n\n.ifx-ag-grid .ag-header-cell:not(:last-child)::before {\n content: '';\n position: absolute;\n right: 0;\n top: calc(50% - 12px);\n height: 24px;\n width: 1px;\n background-color: tokens.$ifxColorEngineering300;\n}\n\n.ag-overlay-loading-center {\n border: none;\n background: none;\n border-radius: none;\n box-shadow: none;\n}\n\n\n.ag-root-wrapper {\n border: 1px solid tokens.$ifxColorEngineering200;\n}\n\n.ag-header {\n background-color: tokens.$ifxColorEngineering100;\n border-bottom: none;\n\n &.ag-header-active {\n outline: none !important;\n border-color: #0A8276 !important;\n }\n}\n\n.ag-header-cell {\n padding-left: 16px;\n padding-right: 16px;\n gap: 4px;\n}\n\n\n.ag-header-cell-focus {\n border: none !important;\n outline: none !important;\n}\n\n.ag-header-cell-text {\n font-size: 13px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n color: tokens.$ifxColorBaseBlack;\n font-family: var(--ifx-font-family); // tokens.$ifxFontFamilyBody;\n\n\n\n}\n\n.ag-row-focus {\n background-color: inherit !important;\n /* Reset the hover color to the row's original color */\n}\n\n.ag-row-hover {\n background-color: tokens.$ifxColorBaseWhite !important; //inherit !important;\n /* Reset the hover color to the row's original color */\n}\n\n\n.ag-cell-focus {\n border: none !important;\n outline: none !important;\n background-color: inherit !important;\n}\n\n\n\n.ag-row {\n background-color: tokens.$ifxColorBaseWhite;\n border-bottom: 1px solid tokens.$ifxColorEngineering200;\n font-size: 13px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n z-index: 1; //ensure the stacking order when used inside js frameworks\n}\n\n.ag-row-odd {\n background-color: tokens.$ifxColorBaseWhite;\n}\n\n.ag-cell {\n display: flex;\n padding-left: 16px;\n padding-right: 16px;\n white-space: pre-line;\n min-height: 40px; \n height: auto;\n}\n\n.ag-ltr .ag-sort-indicator-icon {\n padding-left: 0px;\n vertical-align: bottom;\n line-height: 12px;\n}\n\n.unsort-icon-custom-color {\n color: tokens.$ifxColorEngineering400;\n}\n\n// Mobile optimization for horizontal scrolling\n@media (max-width: tokens.$ifxBreakpointM) {\n .table-wrapper {\n overflow-x: auto;\n -webkit-overflow-scrolling: touch;\n }\n\n .ifx-ag-grid {\n min-width: 400px;\n }\n\n .ag-root-wrapper {\n min-width: 100%;\n }\n\n .ag-header-cell,\n .ag-cell {\n min-width: 100px;\n white-space: nowrap;\n }\n\n .table-wrapper {\n margin-bottom: tokens.$ifxSpace200;\n }\n}\n","import { Component, h, Element, Host, Prop, State } from '@stencil/core';\nimport { trackComponent } from '../../global/utils/tracking';\nimport { isNestedInIfxComponent } from '../../global/utils/dom-utils';\nimport { detectFramework } from '../../global/utils/framework-detection';\nimport { createGrid, FirstDataRenderedEvent, GridApi, GridOptions } from 'ag-grid-community';\nimport { CustomNoRowsOverlay } from './customNoRowsOverlay';\nimport { CustomLoadingOverlay } from './customLoadingOverlay';\nimport classNames from 'classnames';\n\n@Component({\n tag: 'ifx-basic-table',\n styleUrl: 'table.scss',\n shadow: false // only works with shadowdom off because we are using an external library\n})\nexport class Table {\n @State() gridOptions: GridOptions;\n @Prop() cols: any[] | string;\n @Prop() rows: any[] | string;\n @State() columnDefs: any[] = [];\n @State() rowData: any[] = [];\n @Prop() rowHeight: string = 'default';\n @Prop() tableHeight: string = 'auto';\n @Prop() variant: string = 'default'\n @State() uniqueKey: string;\n @Element() host: HTMLElement;\n \n private container: HTMLDivElement;\n private gridApi: GridApi; \n private gridInitialized = false;\n\n componentWillLoad() {\n this.uniqueKey = `unique-${Math.floor(Math.random() * 1000000)}`;\n this.setColsAndRows(); //needed?\n this.setGridOptions();\n }\n\n setGridOptions() {\n this.gridOptions = {\n rowHeight: this.rowHeight === 'default' ? 40 : 32,\n headerHeight: 40,\n defaultColDef: {\n resizable: true,\n autoHeight: true,\n },\n suppressCellFocus: false,\n enableCellTextSelection: true,\n suppressDragLeaveHidesColumns: true,\n suppressRowHoverHighlight: true,\n onFirstDataRendered: this.onFirstDataRendered,\n columnDefs: this.columnDefs,\n rowData: this.rowData,\n loadingOverlayComponent: CustomLoadingOverlay,\n noRowsOverlayComponent: CustomNoRowsOverlay,\n noRowsOverlayComponentParams: {\n noRowsMessageFunc: () =>\n 'No rows found at: ' + new Date().toLocaleTimeString(),\n },\n icons: {\n sortAscending: '<ifx-icon icon=\"arrow-triangle-up-16\"></ifx-icon>',\n sortDescending: '<ifx-icon icon=\"arrow-triangle-down-16\"></ifx-icon>',\n sortUnSort: '<a class=\"unsort-icon-custom-color\"><ifx-icon icon=\"arrow-triangle-vertikal-16\"></ifx-icon></a>',\n },\n rowDragManaged: this.columnDefs.some((col) => col.dndSource === true) ? true : false,\n animateRows: this.columnDefs.some((col) => col.dndSource === true) ? true : false,\n };\n }\n\n setColsAndRows() {\n if (typeof this.rows === 'string' && typeof this.cols === 'string') {\n try {\n if(this.cols) {\n this.columnDefs = JSON.parse(this.cols);\n }\n if(this.rows) {\n this.rowData = JSON.parse(this.rows);\n }\n } catch (err) {\n console.error('Failed to parse input:', err);\n }\n } else if ((Array.isArray(this.rows) || typeof this.rows === 'object') && (Array.isArray(this.cols) || typeof this.cols === 'object')) {\n this.columnDefs = this.cols;\n this.rowData = this.rows;\n } else {\n console.error('Unexpected value for cols and rows:', this.rows, this.cols);\n }\n }\n\n getRowData() {\n let rows: any[] = [];\n if (typeof this.rows === 'string') {\n try {\n if(this.rows) {\n rows = JSON.parse(this.rows);\n }\n } catch (err) {\n console.error('Failed to parse input:', err);\n }\n } else if (Array.isArray(this.rows) || typeof this.rows === 'object') {\n rows = this.rows;\n } else {\n console.error('Unexpected value for rows: ', this.rows);\n }\n\n return rows;\n }\n\n getColData() {\n let cols: any[] = [];\n\n if (typeof this.cols === 'string') {\n try {\n if(this.cols) { \n cols = JSON.parse(this.cols);\n }\n } catch (err) {\n console.error('Failed to parse input:', err);\n }\n } else if (Array.isArray(this.cols) || typeof this.cols === 'object') {\n cols = this.cols;\n } else {\n console.error('Unexpected value for cols: ', this.cols);\n }\n return cols;\n }\n\n onFirstDataRendered(params: FirstDataRenderedEvent) {\n params.api.sizeColumnsToFit();\n }\n\n componentWillUpdate() {\n this.setColsAndRows();\n this.gridOptions.columnDefs = this.columnDefs;\n this.gridOptions.rowData = this.rowData;\n if (this.gridApi) {\n this.gridApi.setGridOption('rowData', this.rowData);\n this.gridApi.setGridOption('columnDefs', this.columnDefs);\n }\n }\n\n async componentDidLoad() {\n if (this.container && !this.gridInitialized) {\n if(!isNestedInIfxComponent(this.host)) { \n const framework = detectFramework();\n trackComponent('ifx-basic-table', await framework)\n }\n this.gridApi = createGrid(this.container, this.gridOptions);\n if (this.gridApi) {\n this.gridApi.sizeColumnsToFit({\n defaultMinWidth: 100,\n });\n this.gridApi.setGridOption('columnDefs', this.getColData());\n this.gridApi.setGridOption('rowData', this.getRowData());\n this.gridInitialized = true; \n }\n }\n }\n\n getClassNames() {\n return classNames(\n this.tableHeight === 'auto' && 'table-wrapper ag-root-wrapper-body',\n 'table-wrapper',\n );\n }\n\n getTableStyle() {\n if (this.tableHeight !== 'auto') {\n return {\n height: this.tableHeight,\n };\n }\n return {};\n }\n\n render() {\n return (\n <Host>\n <div id=\"table-wrapper\" class={this.getClassNames()}>\n <div id={`ifxTable-${this.uniqueKey}`} class={`ifx-ag-grid ${this.variant === 'zebra' ? 'zebra' : \"\"}`} style={this.getTableStyle()} ref={(el) => (this.container = el)}></div>\n </div>\n </Host>\n );\n }\n}\n"],"names":[],"mappings":";;;;;;;MAEa,mBAAmB,CAAA;AAG9B,IAAA,IAAI,CAAC,MAAiE,EAAA;QACpE,IAAI,CAAC,IAAI,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC;AACzC,QAAA,IAAI,CAAC,IAAI,CAAC,SAAS,GAAG;;iBAET,MAAM,CAAC,iBAAiB,EAAE;;SAElC;;IAGP,MAAM,GAAA;QACJ,OAAO,IAAI,CAAC,IAAI;;AAGlB,IAAA,OAAO,CAAC,OAA4B,EAAA;AAClC,QAAA,OAAO,KAAK;;AAEf;;MCnBY,oBAAoB,CAAA;AAG/B,IAAA,IAAI,CAAC,OAAyD,EAAA;QAC5D,IAAI,CAAC,IAAI,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC;AACzC,QAAA,IAAI,CAAC,IAAI,CAAC,SAAS,GAAG,CAAA;;mBAEP;;IAGjB,MAAM,GAAA;QACJ,OAAO,IAAI,CAAC,IAAI;;AAGlB,IAAA,OAAO,CAAC,OAA4B,EAAA;AAClC,QAAA,OAAO,KAAK;;AAEf;;ACnBD,MAAM,Q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AE,CAAC;AACxD,gBAAA,IAAI,CAAC,eAAe,GAAG,IAAI;;;;IAKjC,aAAa,GAAA;AACX,QAAA,OAAO,UAAU,CACf,IAAI,CAAC,WAAW,KAAK,MAAM,IAAI,oCAAoC,EACnE,eAAe,CAChB;;IAGH,aAAa,GAAA;AACX,QAAA,IAAI,IAAI,CAAC,WAAW,KAAK,MAAM,EAAE;YAC/B,OAAO;gBACL,MAAM,EAAE,IAAI,CAAC,WAAW;aACzB;;AAEH,QAAA,OAAO,EAAE;;IAGX,MAAM,GAAA;QACJ,QACE,EAAC,IAAI,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAA,EACH,CAAK,CAAA,KAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAA,EAAE,EAAC,eAAe,EAAC,KAAK,EAAE,IAAI,CAAC,aAAa,EAAE,EAAA,EACjD,CAAK,CAAA,KAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAA,EAAE,EAAE,YAAY,IAAI,CAAC,SAAS,CAAE,CAAA,EAAE,KAAK,EAAE,CAAA,YAAA,EAAe,IAAI,CAAC,OAAO,KAAK,OAAO,GAAG,OAAO,GAAG,EAAE,CAAE,CAAA,EAAE,KAAK,EAAE,IAAI,CAAC,aAAa,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,MAAM,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC,EAAQ,CAAA,CAC3K,CACD;;;;;;;;"}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { r as registerInstance, h, d as Host, a as getElement } from './index-PqnYwNKt.js';
|
|
2
|
+
import { d as detectFramework, t as trackComponent } from './framework-detection-DcmcuUOA.js';
|
|
3
|
+
import { i as isNestedInIfxComponent } from './dom-utils-Bw2fh5LT.js';
|
|
4
|
+
import { c as classNames } from './index-Bt32KzDW.js';
|
|
5
|
+
import './_commonjsHelpers-B85MJLTf.js';
|
|
6
|
+
|
|
7
|
+
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:#BFBBBB;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}";
|
|
8
|
+
|
|
9
|
+
const Button = class {
|
|
10
|
+
constructor(hostRef) {
|
|
11
|
+
registerInstance(this, hostRef);
|
|
12
|
+
this.variant = 'primary';
|
|
13
|
+
this.theme = 'default';
|
|
14
|
+
this.size = 'm';
|
|
15
|
+
this.disabled = false;
|
|
16
|
+
this.target = '_self';
|
|
17
|
+
this.type = "button";
|
|
18
|
+
this.fullWidth = false;
|
|
19
|
+
this.handleClick = (ev) => {
|
|
20
|
+
if (this.el.shadowRoot) {
|
|
21
|
+
const parentForm = this.el.closest('form');
|
|
22
|
+
if (parentForm) {
|
|
23
|
+
ev.preventDefault();
|
|
24
|
+
if (this.type === 'reset') {
|
|
25
|
+
// If the button type is 'reset', manually reset all custom form fields
|
|
26
|
+
this.resetClickHandler(); //this will reset all ifx-text-fields within a form
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
const fakeButton = document.createElement('button');
|
|
30
|
+
if (this.type) {
|
|
31
|
+
fakeButton.type = this.type;
|
|
32
|
+
}
|
|
33
|
+
fakeButton.style.display = 'none';
|
|
34
|
+
parentForm.appendChild(fakeButton);
|
|
35
|
+
fakeButton.click();
|
|
36
|
+
fakeButton.remove();
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
setInternalHref(newValue) {
|
|
43
|
+
this.internalHref = newValue;
|
|
44
|
+
}
|
|
45
|
+
async setFocus() {
|
|
46
|
+
this.focusableElement.focus();
|
|
47
|
+
}
|
|
48
|
+
insertNativeButton() {
|
|
49
|
+
this.nativeButton = document.createElement('button');
|
|
50
|
+
this.nativeButton.type = this.type;
|
|
51
|
+
this.nativeButton.style.display = 'none';
|
|
52
|
+
this.el.closest('form').appendChild(this.nativeButton);
|
|
53
|
+
}
|
|
54
|
+
handleFormAndInternalHref() {
|
|
55
|
+
if (this.el.closest('form')) {
|
|
56
|
+
if (this.el.href) {
|
|
57
|
+
this.el.internalHref = undefined;
|
|
58
|
+
}
|
|
59
|
+
this.insertNativeButton();
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
this.internalHref = this.href;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
handleButtonWidth() {
|
|
66
|
+
if (this.fullWidth) {
|
|
67
|
+
this.el.style.setProperty('--bw', '100%');
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
this.el.style.setProperty('--bw', 'fit-content');
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
componentWillLoad() {
|
|
74
|
+
this.handleFormAndInternalHref();
|
|
75
|
+
}
|
|
76
|
+
async componentDidLoad() {
|
|
77
|
+
if (!isNestedInIfxComponent(this.el)) {
|
|
78
|
+
const framework = detectFramework();
|
|
79
|
+
trackComponent('ifx-button', await framework);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
componentWillRender() {
|
|
83
|
+
this.handleButtonWidth();
|
|
84
|
+
}
|
|
85
|
+
resetClickHandler() {
|
|
86
|
+
const formElement = this.el.closest('form');
|
|
87
|
+
const customElements = formElement.querySelectorAll('ifx-text-field, ifx-textarea');
|
|
88
|
+
customElements.forEach(element => {
|
|
89
|
+
element.reset();
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
handleKeyDown(ev) {
|
|
93
|
+
if (ev.key === " " || ev.key === 'Enter' && !this.disabled) {
|
|
94
|
+
this.focusableElement.click();
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
handleHostClick(event) {
|
|
98
|
+
if (this.disabled === true) {
|
|
99
|
+
event.stopImmediatePropagation();
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
handleFocus(event) {
|
|
103
|
+
if (this.disabled) {
|
|
104
|
+
event.preventDefault();
|
|
105
|
+
this.focusableElement.blur();
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
render() {
|
|
109
|
+
return (h(Host, { key: 'c04892373b37cea4d0ea2e539c6fde9757ba4bcf' }, h("a", { key: 'eb107f3b40cddc93f9e642788ba25dc77e7e5169', 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: '77ed12eeef09759fe4fb776e012d052c2c1b3383' }))));
|
|
110
|
+
}
|
|
111
|
+
getVariantClass() {
|
|
112
|
+
return `${this.variant}` === "secondary"
|
|
113
|
+
? `secondary-${this.theme}`
|
|
114
|
+
: `${this.variant}` === 'tertiary'
|
|
115
|
+
? `tertiary-${this.theme}`
|
|
116
|
+
: `${this.theme}`;
|
|
117
|
+
}
|
|
118
|
+
getSizeClass() {
|
|
119
|
+
if (`${this.size}` === "xs") {
|
|
120
|
+
return "xs";
|
|
121
|
+
}
|
|
122
|
+
else if (`${this.size}` === "s") {
|
|
123
|
+
return "s";
|
|
124
|
+
}
|
|
125
|
+
else if (`${this.size}` === "l") {
|
|
126
|
+
return "l";
|
|
127
|
+
}
|
|
128
|
+
else
|
|
129
|
+
return "";
|
|
130
|
+
}
|
|
131
|
+
getClassNames() {
|
|
132
|
+
return classNames('btn', this.size && `btn-${this.getSizeClass()}`, `btn-${this.getVariantClass()}`, this.disabled ? 'disabled' : '');
|
|
133
|
+
}
|
|
134
|
+
get el() { return getElement(this); }
|
|
135
|
+
static get watchers() { return {
|
|
136
|
+
"href": ["setInternalHref"]
|
|
137
|
+
}; }
|
|
138
|
+
};
|
|
139
|
+
Button.style = buttonCss;
|
|
140
|
+
|
|
141
|
+
export { Button as ifx_button };
|
|
142
|
+
//# sourceMappingURL=ifx-button.entry.js.map
|
|
143
|
+
|
|
144
|
+
//# sourceMappingURL=ifx-button.entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ifx-button.entry.js","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.$ifxColorEngineering300;\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 { trackComponent } from '../../global/utils/tracking';\nimport { isNestedInIfxComponent } from '../../global/utils/dom-utils';\nimport { detectFramework } from '../../global/utils/framework-detection';\nimport classNames from 'classnames';\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 async componentDidLoad() { \n if(!isNestedInIfxComponent(this.el)) { \n const framework = detectFramework();\n trackComponent('ifx-button', await framework)\n }\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' : ''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C,CAAO,IAAA,EAAA,IAAI,CAAC,eAAe,EAAE,CAAA,CAAE,EAC/B,IAAI,CAAC,QAAQ,GAAG,UAAU,GAAG,EAAE,CAChC;;;;;;;;;;;"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { r as registerInstance, c as createEvent, h, a as getElement } from './index-PqnYwNKt.js';
|
|
2
|
+
import { d as detectFramework, t as trackComponent } from './framework-detection-DcmcuUOA.js';
|
|
3
|
+
import { i as isNestedInIfxComponent } from './dom-utils-Bw2fh5LT.js';
|
|
4
|
+
|
|
5
|
+
const checkboxCss = ":host{display:inline-flex;vertical-align:top}.checkbox__container{box-sizing:border-box;display:inline-flex;flex-direction:row;align-items:top;padding:0px;gap:8px;font-family:\"Source Sans 3\";vertical-align:bottom}.checkbox__container .checkbox__wrapper{box-sizing:border-box;display:flex;position:relative;justify-content:center;align-items:center;width:20px;height:20px;background-color:#FFFFFF;border:1px solid #575352;border-radius:1px;flex:none;order:0;flex-grow:0;align-self:flex-start}.checkbox__container .checkbox__wrapper.checkbox-m{height:24px;width:24px}.checkbox__container .checkbox__wrapper.error{border-color:#CD002F}.checkbox__container .checkbox__wrapper:focus-visible{border:1px solid #575352;outline:2px solid #0A8276;outline-offset:2px}.checkbox__container .checkbox__wrapper:hover{background-color:#EEEDED;border:1px solid #575352;border-radius:1px;flex:none;order:0;flex-grow:0}.checkbox__container .checkbox__wrapper.disabled{background-color:#BFBBBB;border-color:#BFBBBB;border-radius:1px;flex:none;order:0;flex-grow:0}.checkbox__container .checkbox__wrapper.checked:not(.indeterminate){background-color:#0A8276;border-radius:1px;border-color:transparent;flex:none;order:0;flex-grow:0;color:#FFFFFF}.checkbox__container .checkbox__wrapper.checked:not(.indeterminate).error{background-color:#CD002F}.checkbox__container .checkbox__wrapper.checked:not(.indeterminate):focus-visible{border:1px solid transparent;outline:2px solid #0A8276;outline-offset:2px}.checkbox__container .checkbox__wrapper.checked:not(.indeterminate):hover{background-color:#0A8276;border-radius:1px;flex:none;order:0;flex-grow:0}.checkbox__container .checkbox__wrapper.checked:not(.indeterminate).disabled{background:#BFBBBB;border-radius:1px;flex:none;order:0;flex-grow:0}.checkbox__container .checkbox__wrapper.indeterminate:before{content:\"\";display:block;width:70%;height:2px;background-color:#08665C;position:absolute;top:50%;left:50%;transform:translate(-50%, -50%)}.checkbox__container .label{font-style:normal;font-weight:400;font-size:0.875rem;line-height:1.25rem;color:#1D1D1D;overflow-wrap:break-word;word-wrap:break-word;word-break:break-all;max-width:100%}.checkbox__container .label.label-m{font-size:1rem;line-height:1.5rem}.checkbox__container .label.disabled{color:#BFBBBB}.checkbox__container .checkbox__wrapper:hover,.checkbox__container .label:hover{cursor:pointer}";
|
|
6
|
+
|
|
7
|
+
const Checkbox = class {
|
|
8
|
+
constructor(hostRef) {
|
|
9
|
+
registerInstance(this, hostRef);
|
|
10
|
+
this.ifxChange = createEvent(this, "ifxChange", 7);
|
|
11
|
+
this.ifxError = createEvent(this, "ifxError", 7);
|
|
12
|
+
if (hostRef.$hostElement$["s-ei"]) {
|
|
13
|
+
this.internals = hostRef.$hostElement$["s-ei"];
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
this.internals = hostRef.$hostElement$.attachInternals();
|
|
17
|
+
hostRef.$hostElement$["s-ei"] = this.internals;
|
|
18
|
+
}
|
|
19
|
+
this.disabled = false;
|
|
20
|
+
this.checked = false;
|
|
21
|
+
this.error = false;
|
|
22
|
+
this.size = 'm';
|
|
23
|
+
this.indeterminate = false;
|
|
24
|
+
}
|
|
25
|
+
handleCheckbox() {
|
|
26
|
+
if (!this.disabled) {
|
|
27
|
+
if (!this.inputElement.indeterminate) {
|
|
28
|
+
this.internalChecked = !this.internalChecked;
|
|
29
|
+
}
|
|
30
|
+
this.ifxChange.emit(this.internalChecked);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
async isChecked() {
|
|
34
|
+
return this.internalChecked;
|
|
35
|
+
}
|
|
36
|
+
async toggleCheckedState(newVal) {
|
|
37
|
+
this.internalChecked = newVal;
|
|
38
|
+
}
|
|
39
|
+
valueChanged(newValue, oldValue) {
|
|
40
|
+
if (newValue !== oldValue) {
|
|
41
|
+
this.internalChecked = newValue;
|
|
42
|
+
this.inputElement.checked = this.internalChecked; // update the checkbox's checked property
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
errorChanged(newValue, oldValue) {
|
|
46
|
+
if (newValue !== oldValue) {
|
|
47
|
+
this.ifxError.emit(newValue);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
indeterminateChanged(newValue, oldValue) {
|
|
51
|
+
if (newValue !== oldValue) {
|
|
52
|
+
this.internalIndeterminate = newValue;
|
|
53
|
+
this.inputElement.indeterminate = this.internalIndeterminate; // update the checkbox's indeterminate property
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
handleKeydown(event) {
|
|
57
|
+
// Keycode 32 corresponds to the Space key, 13 corresponds to the Enter key
|
|
58
|
+
if (event.keyCode === 32 || event.keyCode === 13) {
|
|
59
|
+
this.handleCheckbox();
|
|
60
|
+
event.preventDefault(); // prevent the default action when space or enter is pressed
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
componentWillLoad() {
|
|
64
|
+
this.internalChecked = this.checked;
|
|
65
|
+
this.internalIndeterminate = this.indeterminate;
|
|
66
|
+
}
|
|
67
|
+
async componentDidLoad() {
|
|
68
|
+
if (!isNestedInIfxComponent(this.el)) {
|
|
69
|
+
const framework = detectFramework();
|
|
70
|
+
trackComponent('ifx-checkbox', await framework);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
componentDidRender() {
|
|
74
|
+
this.inputElement.indeterminate = this.internalIndeterminate;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Callback for form association.
|
|
78
|
+
* Called whenever the form is reset.
|
|
79
|
+
*/
|
|
80
|
+
// formResetCallback() {
|
|
81
|
+
// this.internals.setFormValue(null);
|
|
82
|
+
// }
|
|
83
|
+
getCheckedClassName() {
|
|
84
|
+
if (this.error) {
|
|
85
|
+
if (this.internalChecked) {
|
|
86
|
+
return "checked error";
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
return "error";
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
else if (this.internalChecked) {
|
|
93
|
+
return "checked";
|
|
94
|
+
}
|
|
95
|
+
else
|
|
96
|
+
return "";
|
|
97
|
+
}
|
|
98
|
+
render() {
|
|
99
|
+
const slot = this.el.innerHTML;
|
|
100
|
+
let hasSlot = false;
|
|
101
|
+
if (slot) {
|
|
102
|
+
hasSlot = true;
|
|
103
|
+
}
|
|
104
|
+
return (h("div", { key: '6605cecca0fc9ea377620c93c411747c6103d0fc', class: "checkbox__container" }, h("input", { key: 'e28753294d821fdc066f64e99295bb6ead4be86d', type: "checkbox", hidden: true, ref: (el) => (this.inputElement = el), checked: this.internalChecked, onChange: this.handleCheckbox.bind(this), id: 'checkbox', value: `${this.value}`, disabled: this.disabled ? true : undefined }), h("div", { key: 'ff14245dcd1ff6285ec153591b52ffa3c3f06358', tabindex: "0", onClick: this.handleCheckbox.bind(this), onKeyDown: this.handleKeydown.bind(this), role: "checkbox", "aria-checked": this.indeterminate ? 'mixed' : this.internalChecked.toString(), "aria-disabled": this.disabled, "aria-labelledby": "label", class: `checkbox__wrapper
|
|
105
|
+
${this.getCheckedClassName()}
|
|
106
|
+
${this.size === "m" ? "checkbox-m" : ""}
|
|
107
|
+
${this.indeterminate ? 'indeterminate' : ""}
|
|
108
|
+
${this.disabled ? 'disabled' : ""}` }, this.internalChecked && !this.internalIndeterminate && h("ifx-icon", { key: '13e9e197e4375548b34a597c007ddf6866ad5e05', icon: "check-16", "aria-hidden": "true" })), hasSlot &&
|
|
109
|
+
h("div", { key: '8161ca9223da4df88bc82eb9d26989df68cedc19', id: "label", class: `label ${this.size === "m" ? "label-m" : ""} ${this.disabled ? 'disabled' : ""} `, onClick: this.handleCheckbox.bind(this) }, h("slot", { key: '29856bf622df0289f8803eb3c4a33f4738f50863' }))));
|
|
110
|
+
}
|
|
111
|
+
get el() { return getElement(this); }
|
|
112
|
+
static get watchers() { return {
|
|
113
|
+
"checked": ["valueChanged"],
|
|
114
|
+
"error": ["errorChanged"],
|
|
115
|
+
"indeterminate": ["indeterminateChanged"]
|
|
116
|
+
}; }
|
|
117
|
+
};
|
|
118
|
+
Checkbox.style = checkboxCss;
|
|
119
|
+
|
|
120
|
+
export { Checkbox as ifx_checkbox };
|
|
121
|
+
//# sourceMappingURL=ifx-checkbox.entry.js.map
|
|
122
|
+
|
|
123
|
+
//# sourceMappingURL=ifx-checkbox.entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ifx-checkbox.entry.js","sources":["src/components/checkbox/checkbox.scss?tag=ifx-checkbox&encapsulation=shadow","src/components/checkbox/checkbox.tsx"],"sourcesContent":["@use \"~@infineon/design-system-tokens/dist/tokens\";\n\n:host {\n display: inline-flex;\n vertical-align: top;\n}\n\n.checkbox__container {\n box-sizing: border-box;\n display: inline-flex;\n flex-direction: row;\n align-items: top;\n padding: 0px;\n gap: tokens.$ifxSpace100;\n font-family: tokens.$ifxFontFamilyBody;\n vertical-align: bottom;\n\n & .checkbox__wrapper {\n box-sizing: border-box;\n display: flex;\n position: relative; //needs to be added for the indeterminate state of the checkbox\n justify-content: center;\n align-items: center;\n width: tokens.$ifxSize250;\n height: tokens.$ifxSize250;\n background-color: tokens.$ifxColorBaseWhite;\n border: 1px solid tokens.$ifxColorEngineering500;\n border-radius: tokens.$ifxBorderRadius12;\n flex: none;\n order: 0;\n flex-grow: 0;\n align-self: flex-start;\n\n &.checkbox-m {\n height: tokens.$ifxSize300;\n width: tokens.$ifxSize300;\n }\n\n &.error {\n border-color: tokens.$ifxColorRed500;\n }\n\n &:focus-visible {\n border: 1px solid tokens.$ifxColorEngineering500;\n outline: 2px solid tokens.$ifxColorOcean500;\n outline-offset: 2px;\n }\n\n &:hover {\n background-color: tokens.$ifxColorEngineering200;\n border: 1px solid tokens.$ifxColorEngineering500;\n border-radius: tokens.$ifxBorderRadius12;\n flex: none;\n order: 0;\n flex-grow: 0;\n }\n\n &.disabled {\n background-color: tokens.$ifxColorEngineering300;;\n border-color: tokens.$ifxColorEngineering300;;\n border-radius: tokens.$ifxBorderRadius12;\n flex: none;\n order: 0;\n flex-grow: 0;\n }\n\n &.checked:not(.indeterminate) {\n background-color: tokens.$ifxColorOcean500;\n border-radius: tokens.$ifxBorderRadius12;\n border-color: tokens.$ifxColorBaseTransparent;\n flex: none;\n order: 0;\n flex-grow: 0;\n color: tokens.$ifxColorBaseWhite;\n\n &.error {\n background-color: tokens.$ifxColorRed500;\n }\n\n &:focus-visible {\n border: 1px solid transparent;\n outline: 2px solid #0A8276;\n outline-offset: 2px;\n }\n\n &:hover {\n background-color: tokens.$ifxColorOcean500;\n border-radius: tokens.$ifxBorderRadius12;\n flex: none;\n order: 0;\n flex-grow: 0;\n }\n\n &.disabled {\n background: tokens.$ifxColorEngineering300;;\n border-radius: tokens.$ifxBorderRadius12;\n flex: none;\n order: 0;\n flex-grow: 0;\n }\n }\n\n &.indeterminate {\n &:before {\n content: \"\";\n display: block;\n width: 70%; // Adjust as needed for the width of the minus sign\n height: 2px; // Adjust for thickness of the minus sign\n background-color: tokens.$ifxColorOcean600; // Color of the minus sign\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n }\n }\n\n }\n\n & .label {\n font-style: normal;\n font-weight: 400;\n font-size: tokens.$ifxFontSizeS;\n line-height: tokens.$ifxLineHeightS;\n color: tokens.$ifxColorBaseBlack;\n overflow-wrap: break-word;\n word-wrap: break-word;\n word-break: break-all;\n max-width: 100%;\n\n &.label-m {\n font-size: tokens.$ifxFontSizeM;\n line-height: tokens.$ifxLineHeightM;\n }\n\n &.disabled {\n color: tokens.$ifxColorEngineering300;\n }\n }\n\n & .checkbox__wrapper,\n & .label {\n &:hover {\n cursor: pointer;\n }\n }\n}","import { Component, h, Prop, Element, State, Event, EventEmitter, Watch, Method, AttachInternals } from '@stencil/core';\nimport { trackComponent } from '../../global/utils/tracking';\nimport { isNestedInIfxComponent } from '../../global/utils/dom-utils';\nimport { detectFramework } from '../../global/utils/framework-detection';\n\n@Component({\n tag: 'ifx-checkbox',\n styleUrl: 'checkbox.scss',\n shadow: true,\n // formAssociated: true\n})\n\nexport class Checkbox {\n private inputElement: HTMLInputElement;\n\n @Element() el;\n @Prop() disabled: boolean = false;\n @Prop() checked: boolean = false;\n @Prop() error: boolean = false;\n @Prop() size: string = 'm';\n @Prop() indeterminate: boolean = false;\n @Prop() value: string;\n @State() internalChecked: boolean;\n @State() internalIndeterminate: boolean;\n\n @AttachInternals() internals: ElementInternals;\n\n @Event({ bubbles: true, composed: true }) ifxChange: EventEmitter;\n @Event({ bubbles: true, composed: true }) ifxError: EventEmitter;\n\n handleCheckbox() {\n if (!this.disabled) {\n if (!this.inputElement.indeterminate) {\n this.internalChecked = !this.internalChecked;\n } \n if (this.internalChecked && !this.internalIndeterminate) {\n if (this.value !== undefined) {\n //this.internals.setFormValue(this.value);\n } else {\n //this.internals.setFormValue(\"on\")\n }\n } else {\n //this.internals.setFormValue(null)\n }\n this.ifxChange.emit(this.internalChecked);\n }\n }\n\n @Method()\n async isChecked(): Promise<boolean> {\n return this.internalChecked;\n }\n\n @Method()\n async toggleCheckedState(newVal: boolean) {\n this.internalChecked = newVal;\n }\n\n @Watch('checked')\n valueChanged(newValue: boolean, oldValue: boolean) {\n if (newValue !== oldValue) {\n this.internalChecked = newValue;\n this.inputElement.checked = this.internalChecked; // update the checkbox's checked property\n }\n }\n\n @Watch('error')\n errorChanged(newValue: boolean, oldValue: boolean) {\n if (newValue !== oldValue) {\n this.ifxError.emit(newValue);\n }\n }\n\n @Watch('indeterminate')\n indeterminateChanged(newValue: boolean, oldValue: boolean) {\n if (newValue !== oldValue) {\n this.internalIndeterminate = newValue;\n this.inputElement.indeterminate = this.internalIndeterminate; // update the checkbox's indeterminate property\n }\n }\n\n handleKeydown(event) {\n // Keycode 32 corresponds to the Space key, 13 corresponds to the Enter key\n if (event.keyCode === 32 || event.keyCode === 13) {\n this.handleCheckbox();\n event.preventDefault(); // prevent the default action when space or enter is pressed\n }\n }\n\n componentWillLoad() {\n this.internalChecked = this.checked;\n this.internalIndeterminate = this.indeterminate;\n }\n\n async componentDidLoad() { \n if(!isNestedInIfxComponent(this.el)) { \n const framework = detectFramework();\n trackComponent('ifx-checkbox', await framework)\n }\n }\n\n componentDidRender() {\n this.inputElement.indeterminate = this.internalIndeterminate;\n }\n\n /**\n * Callback for form association.\n * Called whenever the form is reset.\n */\n // formResetCallback() {\n // this.internals.setFormValue(null);\n // }\n\n getCheckedClassName() {\n if (this.error) {\n if (this.internalChecked) {\n return \"checked error\"\n } else {\n return \"error\"\n }\n } else if (this.internalChecked) {\n return \"checked\";\n } else return \"\"\n }\n\n render() {\n const slot = this.el.innerHTML;\n let hasSlot = false;\n if (slot) {\n hasSlot = true;\n }\n return (\n <div class=\"checkbox__container\">\n <input\n type=\"checkbox\"\n hidden\n ref={(el) => (this.inputElement = el)}\n checked={this.internalChecked}\n onChange={this.handleCheckbox.bind(this)} // Listen for changes here\n id='checkbox'\n value={`${this.value}`}\n disabled={this.disabled ? true : undefined}\n />\n <div\n tabindex=\"0\"\n onClick={this.handleCheckbox.bind(this)}\n onKeyDown={this.handleKeydown.bind(this)}\n role=\"checkbox\"\n aria-checked={this.indeterminate ? 'mixed' : this.internalChecked.toString()}\n aria-disabled={this.disabled}\n aria-labelledby=\"label\"\n class={`checkbox__wrapper \n ${this.getCheckedClassName()}\n ${this.size === \"m\" ? \"checkbox-m\" : \"\"}\n ${this.indeterminate ? 'indeterminate' : \"\"}\n ${this.disabled ? 'disabled' : \"\"}`}\n >\n {this.internalChecked && !this.internalIndeterminate && <ifx-icon icon=\"check-16\" aria-hidden=\"true\"></ifx-icon>}\n </div>\n {hasSlot &&\n <div id=\"label\" class={`label ${this.size === \"m\" ? \"label-m\" : \"\"} ${this.disab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