@ukic/web-components 2.35.0 → 2.35.2
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/README.md +1 -0
- package/dist/cjs/core.cjs.js +1 -1
- package/dist/cjs/ic-badge.cjs.entry.js +23 -0
- package/dist/cjs/ic-badge.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-button_3.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-navigation-button.cjs.entry.js +2 -2
- package/dist/cjs/ic-navigation-button.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-navigation-item.cjs.entry.js +1 -1
- package/dist/cjs/ic-navigation-item.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-toast.cjs.entry.js +2 -2
- package/dist/cjs/ic-toast.cjs.entry.js.map +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/components/ic-accordion/ic-accordion.stories.js +635 -0
- package/dist/collection/components/ic-alert/ic-alert.stories.js +257 -0
- package/dist/collection/components/ic-back-to-top/ic-back-to-top.stories.js +162 -0
- package/dist/collection/components/ic-badge/ic-badge.js +39 -1
- package/dist/collection/components/ic-badge/ic-badge.js.map +1 -1
- package/dist/collection/components/ic-badge/ic-badge.stories.js +1082 -0
- package/dist/collection/components/ic-badge/test/basic/ic-badge.spec.js +194 -0
- package/dist/collection/components/ic-badge/test/basic/ic-badge.spec.js.map +1 -1
- package/dist/collection/components/ic-breadcrumb-group/ic-breadcrumb-group.stories.js +502 -0
- package/dist/collection/components/ic-button/ic-button.stories.js +2218 -0
- package/dist/collection/components/ic-card/ic-card.stories.js +1034 -0
- package/dist/collection/components/ic-checkbox-group/ic-checkbox-group.stories.js +687 -0
- package/dist/collection/components/ic-chip/ic-chip.stories.js +670 -0
- package/dist/collection/components/ic-classification-banner/ic-classification-banner.stories.js +131 -0
- package/dist/collection/components/ic-data-entity/ic-data-entity.stories.js +487 -0
- package/dist/collection/components/ic-dialog/ic-dialog.stories.js +1256 -0
- package/dist/collection/components/ic-empty-state/ic-empty-state.stories.js +397 -0
- package/dist/collection/components/ic-footer/ic-footer.stories.js +383 -0
- package/dist/collection/components/ic-hero/ic-hero.stories.js +489 -0
- package/dist/collection/components/ic-link/ic-link.stories.js +114 -0
- package/dist/collection/components/ic-loading-indicator/ic-loading-indicator.stories.js +416 -0
- package/dist/collection/components/ic-navigation-button/ic-navigation-button.css +4 -0
- package/dist/collection/components/ic-navigation-button/ic-navigation-button.js +1 -1
- package/dist/collection/components/ic-navigation-button/ic-navigation-button.js.map +1 -1
- package/dist/collection/components/ic-navigation-item/ic-navigation-item.css +7 -35
- package/dist/collection/components/ic-page-header/ic-page-header.stories.js +557 -0
- package/dist/collection/components/ic-pagination/ic-pagination.stories.js +125 -0
- package/dist/collection/components/ic-popover-menu/ic-popover-menu.stories.js +486 -0
- package/dist/collection/components/ic-radio-group/ic-radio-group.stories.js +450 -0
- package/dist/collection/components/ic-search-bar/ic-search-bar.stories.js +591 -0
- package/dist/collection/components/ic-section-container/ic-section-container.stories.js +62 -0
- package/dist/collection/components/ic-select/ic-select-searchable.stories.js +953 -0
- package/dist/collection/components/ic-select/ic-select-single.stories.js +780 -0
- package/dist/collection/components/ic-side-navigation/ic-side-navigation.stories.js +2526 -0
- package/dist/collection/components/ic-skeleton/ic-skeleton.stories.js +141 -0
- package/dist/collection/components/ic-status-tag/ic-status-tag.stories.js +161 -0
- package/dist/collection/components/ic-stepper/ic-stepper.stories.js +327 -0
- package/dist/collection/components/ic-switch/ic-switch.stories.js +171 -0
- package/dist/collection/components/ic-tab-context/ic-tabs.stories.js +388 -0
- package/dist/collection/components/ic-text-field/ic-text-field.stories.js +1083 -0
- package/dist/collection/components/ic-theme/ic-theme.stories.js +171 -0
- package/dist/collection/components/ic-toast/ic-toast.js +2 -2
- package/dist/collection/components/ic-toast/ic-toast.js.map +1 -1
- package/dist/collection/components/ic-toast/ic-toast.stories.js +413 -0
- package/dist/collection/components/ic-toast/test/basic/ic-toast.spec.js +3 -3
- package/dist/collection/components/ic-toast/test/basic/ic-toast.spec.js.map +1 -1
- package/dist/collection/components/ic-toggle-button/ic-toggle-button.stories.js +537 -0
- package/dist/collection/components/ic-toggle-button-group/ic-toggle-button-group.stories.js +610 -0
- package/dist/collection/components/ic-tooltip/ic-tooltip.js +2 -5
- package/dist/collection/components/ic-tooltip/ic-tooltip.js.map +1 -1
- package/dist/collection/components/ic-tooltip/ic-tooltip.stories.js +356 -0
- package/dist/collection/components/ic-top-navigation/ic-top-navigation.stories.js +1083 -0
- package/dist/collection/components/ic-typography/ic-typography.stories.js +437 -0
- package/dist/collection/patterns/top-nav-content-footer.stories.js +109 -0
- package/dist/collection/patterns/z-index.stories.js +474 -0
- package/dist/components/ic-badge.js +25 -2
- package/dist/components/ic-badge.js.map +1 -1
- package/dist/components/ic-navigation-button.js +2 -2
- package/dist/components/ic-navigation-button.js.map +1 -1
- package/dist/components/ic-navigation-item.js +1 -1
- package/dist/components/ic-navigation-item.js.map +1 -1
- package/dist/components/ic-toast.js +2 -2
- package/dist/components/ic-toast.js.map +1 -1
- package/dist/components/ic-tooltip2.js.map +1 -1
- package/dist/core/core.esm.js +1 -1
- package/dist/core/core.esm.js.map +1 -1
- package/dist/core/p-3e8023ff.entry.js +2 -0
- package/dist/core/p-3e8023ff.entry.js.map +1 -0
- package/dist/core/p-ba06cc95.entry.js.map +1 -1
- package/dist/core/{p-7e8a4abd.entry.js → p-bfaa257c.entry.js} +2 -2
- package/dist/core/{p-7e8a4abd.entry.js.map → p-bfaa257c.entry.js.map} +1 -1
- package/dist/core/p-c05474f3.entry.js +2 -0
- package/dist/core/p-c05474f3.entry.js.map +1 -0
- package/dist/core/{p-5d3c6ea1.entry.js → p-d0299926.entry.js} +2 -2
- package/dist/core/p-d0299926.entry.js.map +1 -0
- package/dist/esm/core.js +1 -1
- package/dist/esm/ic-badge.entry.js +23 -0
- package/dist/esm/ic-badge.entry.js.map +1 -1
- package/dist/esm/ic-button_3.entry.js.map +1 -1
- package/dist/esm/ic-navigation-button.entry.js +2 -2
- package/dist/esm/ic-navigation-button.entry.js.map +1 -1
- package/dist/esm/ic-navigation-item.entry.js +1 -1
- package/dist/esm/ic-navigation-item.entry.js.map +1 -1
- package/dist/esm/ic-toast.entry.js +2 -2
- package/dist/esm/ic-toast.entry.js.map +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/types/components/ic-badge/ic-badge.d.ts +5 -0
- package/dist/types/components/ic-tooltip/ic-tooltip.d.ts +1 -1
- package/dist/types/components.d.ts +7 -0
- package/hydrate/index.js +30 -7
- package/package.json +17 -12
- package/vscode-data.json +4 -0
- package/dist/core/p-405d89bb.entry.js +0 -2
- package/dist/core/p-405d89bb.entry.js.map +0 -1
- package/dist/core/p-5d3c6ea1.entry.js.map +0 -1
- package/dist/core/p-dfb3e76e.entry.js +0 -2
- package/dist/core/p-dfb3e76e.entry.js.map +0 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ic-tooltip.js","sourceRoot":"","sources":["../../../src/components/ic-tooltip/ic-tooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,OAAO,EACP,IAAI,EACJ,IAAI,EACJ,CAAC,EACD,MAAM,EACN,KAAK,GACN,MAAM,eAAe,CAAC;AACvB,OAAO,EAAqB,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEjE,OAAO,EAAE,gCAAgC,EAAE,MAAM,qBAAqB,CAAC;AAOvE,MAAM,OAAO,OAAO;;QAEV,sBAAiB,GAAG,CAAC,YAAY,CAAC,CAAC;QACnC,mBAAc,GAAG,KAAK,CAAC;QAEvB,sBAAiB,GAAG,CAAC,UAAU,CAAC,CAAC;QACjC,kBAAa,GAAY,KAAK,CAAC;QAC/B,mBAAc,GAAG,KAAK,CAAC;QAEvB,aAAQ,GAAY,KAAK,CAAC;QAC1B,eAAU,GAAG;YACnB,CAAC,IAAI,CAAC,YAAY,IAAI,YAAY;YAClC,CAAC,IAAI,C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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {\n Component,\n Element,\n Host,\n Prop,\n h,\n Method,\n State,\n} from \"@stencil/core\";\nimport { Instance, Options, createPopper } from \"@popperjs/core\";\nimport { IcTooltipPlacements } from \"./ic-tooltip.types\";\nimport { onComponentRequiredPropUndefined } from \"../../utils/helpers\";\n\n@Component({\n tag: \"ic-tooltip\",\n styleUrl: \"ic-tooltip.css\",\n shadow: true,\n})\nexport class Tooltip {\n private arrow: HTMLDivElement;\n private delayedHideEvents = [\"mouseleave\"];\n private dialogOverflow = false;\n private icDialogEl: HTMLIcDialogElement;\n private instantHideEvents = [\"focusout\"];\n private mouseOverTool: boolean = false;\n private persistTooltip = false;\n private popperInstance: Instance;\n private onDialog: boolean = false;\n private showEvents = [\n !this.disableHover && \"mouseenter\",\n !this.disableHover && \"focusin\",\n !this.disableClick && \"click\",\n ];\n private toolTip: HTMLDivElement;\n\n @Element() el: HTMLIcTooltipElement;\n\n /**\n * @internal If `true`, the tooltip will not be displayed on click, it will require hover or using the display method.\n */\n @Prop() disableClick?: boolean = false;\n\n /**\n * If `true`, the tooltip will not be displayed on hover, it will require a click.\n */\n @Prop() disableHover?: boolean = false;\n\n /**\n * The number of lines to display before truncating the text.\n */\n @Prop() maxLines?: number;\n\n /**\n * The position of the tooltip in relation to the parent element.\n */\n @Prop({ mutable: true }) placement?: IcTooltipPlacements = \"bottom\";\n\n /**\n * @internal Sets the tooltip to aria-hidden, when used as part of components that are already announced.\n */\n @Prop() silent?: boolean = false;\n\n /**\n * The ID of the element the tooltip is describing - for when aria-labelledby or aria-describedby is used.\n */\n @Prop({ reflect: true }) target?: string;\n\n /**\n * The text to display on the tooltip.\n */\n @Prop() label!: string;\n\n @State() popperProps: Partial<Options> = {};\n\n /**\n * @internal This method allows props to be added to the PopperJS createPopper instance outside of tooltip\n * @param props object - createPopper props set externally\n */\n @Method()\n async setExternalPopperProps<T extends Partial<Options>>(props: T) {\n this.popperProps = props;\n }\n\n disconnectedCallback(): void {\n this.manageEventListeners(\"remove\");\n if (this.popperInstance !== undefined) {\n this.popperInstance.destroy();\n }\n }\n\n componentDidLoad(): void {\n this.manageEventListeners(\"add\");\n\n this.icDialogEl = this.el.closest(\"ic-dialog\");\n this.dialogOverflow =\n this.icDialogEl?.getAttribute(\"data-overflow\") === \"true\";\n\n this.onDialog = this.icDialogEl !== null;\n\n onComponentRequiredPropUndefined(\n [{ prop: this.label, propName: \"label\" }],\n \"Tooltip\"\n );\n }\n\n componentDidRender(): void {\n const typographyEl = this.el.shadowRoot.querySelector(\n \".ic-tooltip-container > ic-typography\"\n );\n this.maxLines > 0 &&\n typographyEl.setAttribute(\n \"style\",\n `--truncation-max-lines: ${this.maxLines}`\n );\n }\n /**\n * Method to programmatically show/hide the tooltip without needing to interact with an anchor element\n * @param show Whether to show or hide the tooltip\n * @param persistTooltip Whether the tooltip should stay on the screen when actions are performed that would previously dismiss the tooltip, such as on hover\n */\n @Method()\n async displayTooltip(show: boolean, persistTooltip?: boolean): Promise<void> {\n this.persistTooltip = persistTooltip;\n show ? this.show() : this.hide();\n }\n\n /**\n * @internal Method to return if tooltip is currently visible.\n */\n @Method()\n async isTooltipVisible(): Promise<boolean> {\n return Promise.resolve(this.toolTip.hasAttribute(\"data-show\"));\n }\n\n private getTooltipTranslate = (dialogEl: DOMRect) => {\n const child = this.el.children[0].getBoundingClientRect();\n let tooltipX;\n let tooltipY;\n switch (this.placement) {\n case \"bottom\":\n tooltipX = child.left - dialogEl.left - 0.5 * child.width;\n tooltipY = child.bottom - dialogEl.top;\n break;\n case \"bottom-start\":\n tooltipX = child.left - dialogEl.left;\n tooltipY = child.bottom - dialogEl.top;\n break;\n case \"bottom-end\":\n tooltipX = child.right - dialogEl.right;\n tooltipY = child.bottom - dialogEl.top;\n break;\n case \"top\":\n tooltipX = child.left - dialogEl.left - 0.5 * child.width;\n tooltipY = child.top - dialogEl.bottom;\n break;\n case \"top-start\":\n tooltipX = child.left - dialogEl.left;\n tooltipY = child.top - dialogEl.bottom;\n break;\n case \"top-end\":\n tooltipX = child.right - dialogEl.right;\n tooltipY = child.top - dialogEl.bottom;\n break;\n case \"left\":\n case \"left-start\":\n tooltipX = child.right - dialogEl.right - child.width;\n tooltipY = child.bottom - dialogEl.top - child.height;\n break;\n case \"left-end\":\n tooltipX = child.right - dialogEl.right - child.width;\n tooltipY = child.top - dialogEl.bottom + child.height;\n break;\n case \"right\":\n case \"right-start\":\n tooltipX = child.left - dialogEl.left + child.width;\n tooltipY = child.bottom - dialogEl.top - child.height;\n break;\n case \"right-end\":\n tooltipX = child.left - dialogEl.left + child.width;\n tooltipY = child.top - dialogEl.bottom + child.height;\n break;\n }\n if (this.dialogOverflow && tooltipX < 0) {\n if (this.placement.includes(\"top\") || this.placement.includes(\"bottom\")) {\n this.toolTip.style.setProperty(\n \"--tooltip-arrow-translate\",\n `${tooltipX}px`\n );\n tooltipX = child.left - dialogEl.left;\n }\n if (this.placement.includes(\"left\")) {\n this.placement = \"right\";\n tooltipX = child.left - dialogEl.left + child.width;\n }\n }\n\n this.toolTip.style.setProperty(\"--tooltip-translate-x\", `${tooltipX}px`);\n this.toolTip.style.setProperty(\"--tooltip-translate-y\", `${tooltipY}px`);\n };\n\n private show = () => {\n if (this.label) {\n this.toolTip.setAttribute(\"data-show\", \"\");\n\n if (this.onDialog) {\n this.el.classList.add(\"on-dialog\");\n const dialogEl = this.icDialogEl.shadowRoot\n .querySelector(\"dialog\")\n .getBoundingClientRect();\n\n this.getTooltipTranslate(dialogEl);\n }\n\n this.popperInstance = createPopper(this.el, this.toolTip, {\n placement: this.placement,\n modifiers: [\n {\n name: \"offset\",\n options: {\n offset: [0, 10],\n },\n },\n {\n name: \"arrow\",\n options: {\n element: this.arrow,\n },\n },\n {\n name: \"eventListeners\",\n options: { scroll: false, resize: false },\n },\n ],\n ...this.popperProps,\n });\n } else {\n console.warn(`Tooltip can't display without prop 'label' set`);\n }\n };\n\n private hide = () => {\n this.toolTip.removeAttribute(\"data-show\");\n this.persistTooltip = false;\n if (this.popperInstance !== undefined) {\n this.popperInstance.destroy();\n }\n };\n\n private checkCloseTooltip = () => {\n setTimeout(() => {\n if (!this.mouseOverTool && !this.persistTooltip) {\n this.hide();\n }\n }, 100);\n };\n\n private mouseEnterTooltip = () => {\n this.mouseOverTool = true;\n };\n\n private mouseLeaveTooltip = () => {\n this.mouseOverTool = false;\n this.checkCloseTooltip();\n };\n\n private handleKeyDown = (event: KeyboardEvent) => {\n if (event.key === \"Escape\" && !this.persistTooltip) {\n this.hide();\n }\n };\n\n private manageEventListeners = (action: \"add\" | \"remove\") => {\n const method =\n action === \"add\" ? \"addEventListener\" : \"removeEventListener\";\n\n this.showEvents.forEach((event) => {\n this.el[method](event, this.show);\n if (this.toolTip !== undefined) {\n this.toolTip[method](event, this.mouseEnterTooltip);\n }\n });\n\n if (!this.persistTooltip) {\n this.instantHideEvents.forEach((event) => {\n this.el[method](event, this.hide);\n });\n }\n\n this.delayedHideEvents.forEach((event) => {\n this.el[method](event, this.checkCloseTooltip);\n if (this.toolTip !== undefined) {\n this.toolTip[method](event, this.mouseLeaveTooltip);\n }\n });\n\n document[method](\"keydown\", this.handleKeyDown);\n };\n\n render() {\n const { label, maxLines, silent } = this;\n return (\n <Host class={{ \"ic-tooltip\": true }}>\n <div\n ref={(el) => (this.toolTip = el as HTMLDivElement)}\n role=\"tooltip\"\n class=\"ic-tooltip-container\"\n aria-hidden={`${silent}`}\n >\n <ic-typography maxLines={maxLines} variant=\"caption\">\n {label}\n </ic-typography>\n <div\n ref={(el) => (this.arrow = el as HTMLDivElement)}\n class=\"ic-tooltip-arrow\"\n ></div>\n </div>\n <slot></slot>\n </Host>\n );\n }\n}\n"]}
|
1
|
+
{"version":3,"file":"ic-tooltip.js","sourceRoot":"","sources":["../../../src/components/ic-tooltip/ic-tooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,OAAO,EACP,IAAI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ACf,GAAG,MAAM,EAAE;gBAExB,qBAAe,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAC,SAAS,IACjD,KAAK,CACQ;gBAChB,WACE,GAAG,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK,GAAG,EAAoB,CAAC,EAChD,KAAK,EAAC,kBAAkB,GACnB,CACH;YACN,eAAa,CACR,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {\n Component,\n Element,\n Host,\n Prop,\n h,\n Method,\n State,\n} from \"@stencil/core\";\nimport { Instance, Options, createPopper } from \"@popperjs/core\";\nimport { IcTooltipPlacements } from \"./ic-tooltip.types\";\nimport { onComponentRequiredPropUndefined } from \"../../utils/helpers\";\n\n@Component({\n tag: \"ic-tooltip\",\n styleUrl: \"ic-tooltip.css\",\n shadow: true,\n})\nexport class Tooltip {\n private arrow: HTMLDivElement;\n private delayedHideEvents = [\"mouseleave\"];\n private dialogOverflow = false;\n private icDialogEl: HTMLIcDialogElement;\n private instantHideEvents = [\"focusout\"];\n private mouseOverTool: boolean = false;\n private persistTooltip = false;\n private popperInstance: Instance;\n private onDialog: boolean = false;\n private showEvents = [\n !this.disableHover && \"mouseenter\",\n !this.disableHover && \"focusin\",\n !this.disableClick && \"click\",\n ];\n private toolTip: HTMLDivElement;\n\n @Element() el: HTMLIcTooltipElement;\n\n /**\n * If `true`, the tooltip will not be displayed on click, it will require hover or using the display method.\n */\n @Prop() disableClick?: boolean = false;\n\n /**\n * If `true`, the tooltip will not be displayed on hover, it will require a click.\n */\n @Prop() disableHover?: boolean = false;\n\n /**\n * The number of lines to display before truncating the text.\n */\n @Prop() maxLines?: number;\n\n /**\n * The position of the tooltip in relation to the parent element.\n */\n @Prop({ mutable: true }) placement?: IcTooltipPlacements = \"bottom\";\n\n /**\n * @internal Sets the tooltip to aria-hidden, when used as part of components that are already announced.\n */\n @Prop() silent?: boolean = false;\n\n /**\n * The ID of the element the tooltip is describing - for when aria-labelledby or aria-describedby is used.\n */\n @Prop({ reflect: true }) target?: string;\n\n /**\n * The text to display on the tooltip.\n */\n @Prop() label!: string;\n\n @State() popperProps: Partial<Options> = {};\n\n /**\n * @internal This method allows props to be added to the PopperJS createPopper instance outside of tooltip\n * @param props object - createPopper props set externally\n */\n @Method()\n async setExternalPopperProps<T extends Partial<Options>>(props: T) {\n this.popperProps = props;\n }\n\n disconnectedCallback(): void {\n this.manageEventListeners(\"remove\");\n if (this.popperInstance !== undefined) {\n this.popperInstance.destroy();\n }\n }\n\n componentDidLoad(): void {\n this.manageEventListeners(\"add\");\n\n this.icDialogEl = this.el.closest(\"ic-dialog\");\n this.dialogOverflow =\n this.icDialogEl?.getAttribute(\"data-overflow\") === \"true\";\n\n this.onDialog = this.icDialogEl !== null;\n\n onComponentRequiredPropUndefined(\n [{ prop: this.label, propName: \"label\" }],\n \"Tooltip\"\n );\n }\n\n componentDidRender(): void {\n const typographyEl = this.el.shadowRoot.querySelector(\n \".ic-tooltip-container > ic-typography\"\n );\n this.maxLines > 0 &&\n typographyEl.setAttribute(\n \"style\",\n `--truncation-max-lines: ${this.maxLines}`\n );\n }\n /**\n * Method to programmatically show/hide the tooltip without needing to interact with an anchor element\n * @param show Whether to show or hide the tooltip\n * @param persistTooltip Whether the tooltip should stay on the screen when actions are performed that would previously dismiss the tooltip, such as on hover\n */\n @Method()\n async displayTooltip(show: boolean, persistTooltip?: boolean): Promise<void> {\n this.persistTooltip = persistTooltip;\n show ? this.show() : this.hide();\n }\n\n /**\n * @internal Method to return if tooltip is currently visible.\n */\n @Method()\n async isTooltipVisible(): Promise<boolean> {\n return Promise.resolve(this.toolTip.hasAttribute(\"data-show\"));\n }\n\n private getTooltipTranslate = (dialogEl: DOMRect) => {\n const child = this.el.children[0].getBoundingClientRect();\n let tooltipX;\n let tooltipY;\n switch (this.placement) {\n case \"bottom\":\n tooltipX = child.left - dialogEl.left - 0.5 * child.width;\n tooltipY = child.bottom - dialogEl.top;\n break;\n case \"bottom-start\":\n tooltipX = child.left - dialogEl.left;\n tooltipY = child.bottom - dialogEl.top;\n break;\n case \"bottom-end\":\n tooltipX = child.right - dialogEl.right;\n tooltipY = child.bottom - dialogEl.top;\n break;\n case \"top\":\n tooltipX = child.left - dialogEl.left - 0.5 * child.width;\n tooltipY = child.top - dialogEl.bottom;\n break;\n case \"top-start\":\n tooltipX = child.left - dialogEl.left;\n tooltipY = child.top - dialogEl.bottom;\n break;\n case \"top-end\":\n tooltipX = child.right - dialogEl.right;\n tooltipY = child.top - dialogEl.bottom;\n break;\n case \"left\":\n case \"left-start\":\n tooltipX = child.right - dialogEl.right - child.width;\n tooltipY = child.bottom - dialogEl.top - child.height;\n break;\n case \"left-end\":\n tooltipX = child.right - dialogEl.right - child.width;\n tooltipY = child.top - dialogEl.bottom + child.height;\n break;\n case \"right\":\n case \"right-start\":\n tooltipX = child.left - dialogEl.left + child.width;\n tooltipY = child.bottom - dialogEl.top - child.height;\n break;\n case \"right-end\":\n tooltipX = child.left - dialogEl.left + child.width;\n tooltipY = child.top - dialogEl.bottom + child.height;\n break;\n }\n if (this.dialogOverflow && tooltipX < 0) {\n if (this.placement.includes(\"top\") || this.placement.includes(\"bottom\")) {\n this.toolTip.style.setProperty(\n \"--tooltip-arrow-translate\",\n `${tooltipX}px`\n );\n tooltipX = child.left - dialogEl.left;\n }\n if (this.placement.includes(\"left\")) {\n this.placement = \"right\";\n tooltipX = child.left - dialogEl.left + child.width;\n }\n }\n\n this.toolTip.style.setProperty(\"--tooltip-translate-x\", `${tooltipX}px`);\n this.toolTip.style.setProperty(\"--tooltip-translate-y\", `${tooltipY}px`);\n };\n\n private show = () => {\n if (this.label) {\n this.toolTip.setAttribute(\"data-show\", \"\");\n\n if (this.onDialog) {\n this.el.classList.add(\"on-dialog\");\n const dialogEl = this.icDialogEl.shadowRoot\n .querySelector(\"dialog\")\n .getBoundingClientRect();\n\n this.getTooltipTranslate(dialogEl);\n }\n\n this.popperInstance = createPopper(this.el, this.toolTip, {\n placement: this.placement,\n modifiers: [\n {\n name: \"offset\",\n options: {\n offset: [0, 10],\n },\n },\n {\n name: \"arrow\",\n options: {\n element: this.arrow,\n },\n },\n {\n name: \"eventListeners\",\n options: { scroll: false, resize: false },\n },\n ],\n ...this.popperProps,\n });\n } else {\n console.warn(`Tooltip can't display without prop 'label' set`);\n }\n };\n\n private hide = () => {\n this.toolTip.removeAttribute(\"data-show\");\n this.persistTooltip = false;\n if (this.popperInstance !== undefined) {\n this.popperInstance.destroy();\n }\n };\n\n private checkCloseTooltip = () => {\n setTimeout(() => {\n if (!this.mouseOverTool && !this.persistTooltip) {\n this.hide();\n }\n }, 100);\n };\n\n private mouseEnterTooltip = () => {\n this.mouseOverTool = true;\n };\n\n private mouseLeaveTooltip = () => {\n this.mouseOverTool = false;\n this.checkCloseTooltip();\n };\n\n private handleKeyDown = (event: KeyboardEvent) => {\n if (event.key === \"Escape\" && !this.persistTooltip) {\n this.hide();\n }\n };\n\n private manageEventListeners = (action: \"add\" | \"remove\") => {\n const method =\n action === \"add\" ? \"addEventListener\" : \"removeEventListener\";\n\n this.showEvents.forEach((event) => {\n this.el[method](event, this.show);\n if (this.toolTip !== undefined) {\n this.toolTip[method](event, this.mouseEnterTooltip);\n }\n });\n\n if (!this.persistTooltip) {\n this.instantHideEvents.forEach((event) => {\n this.el[method](event, this.hide);\n });\n }\n\n this.delayedHideEvents.forEach((event) => {\n this.el[method](event, this.checkCloseTooltip);\n if (this.toolTip !== undefined) {\n this.toolTip[method](event, this.mouseLeaveTooltip);\n }\n });\n\n document[method](\"keydown\", this.handleKeyDown);\n };\n\n render() {\n const { label, maxLines, silent } = this;\n return (\n <Host class={{ \"ic-tooltip\": true }}>\n <div\n ref={(el) => (this.toolTip = el as HTMLDivElement)}\n role=\"tooltip\"\n class=\"ic-tooltip-container\"\n aria-hidden={`${silent}`}\n >\n <ic-typography maxLines={maxLines} variant=\"caption\">\n {label}\n </ic-typography>\n <div\n ref={(el) => (this.arrow = el as HTMLDivElement)}\n class=\"ic-tooltip-arrow\"\n ></div>\n </div>\n <slot></slot>\n </Host>\n );\n }\n}\n"]}
|
@@ -0,0 +1,356 @@
|
|
1
|
+
import { html } from "lit-html";
|
2
|
+
|
3
|
+
const defaultArgs = {
|
4
|
+
disableHover: false,
|
5
|
+
maxLines: 3,
|
6
|
+
placement: "bottom",
|
7
|
+
label: "This is a description of the button",
|
8
|
+
};
|
9
|
+
|
10
|
+
export default {
|
11
|
+
title: "Web Components/Tooltip",
|
12
|
+
component: "ic-tooltip",
|
13
|
+
};
|
14
|
+
|
15
|
+
export const Default = {
|
16
|
+
render: (args) =>
|
17
|
+
html`<ic-tooltip
|
18
|
+
label="This is a description of the button"
|
19
|
+
target="test-button-default"
|
20
|
+
id="ic-tooltip-test-button-default"
|
21
|
+
><button
|
22
|
+
id="test-button-default"
|
23
|
+
aria-describedby="ic-tooltip-test-button-default"
|
24
|
+
>
|
25
|
+
Default
|
26
|
+
</button></ic-tooltip
|
27
|
+
>`,
|
28
|
+
|
29
|
+
name: "Default",
|
30
|
+
height: "100px",
|
31
|
+
};
|
32
|
+
|
33
|
+
export const UsingExternalMethod = {
|
34
|
+
render: (args) =>
|
35
|
+
html`<script>
|
36
|
+
let display = true;
|
37
|
+
document
|
38
|
+
.querySelector("#clickMe")
|
39
|
+
.addEventListener("click", handleDisplay);
|
40
|
+
const tooltip = document.querySelector("ic-tooltip");
|
41
|
+
function handleDisplay() {
|
42
|
+
tooltip.displayTooltip(display, display);
|
43
|
+
display = !display;
|
44
|
+
}
|
45
|
+
</script>
|
46
|
+
<button id="clickMe">Show tooltip</button>
|
47
|
+
<ic-tooltip
|
48
|
+
label="This is a description of the button"
|
49
|
+
target="test-button-default"
|
50
|
+
id="ic-tooltip-test-button-default"
|
51
|
+
><button
|
52
|
+
id="test-button-default"
|
53
|
+
aria-describedby="ic-tooltip-test-button-default"
|
54
|
+
>
|
55
|
+
Default
|
56
|
+
</button></ic-tooltip
|
57
|
+
>`,
|
58
|
+
|
59
|
+
name: "Using external method",
|
60
|
+
height: "100px",
|
61
|
+
};
|
62
|
+
|
63
|
+
export const DisabledHover = {
|
64
|
+
render: (args) =>
|
65
|
+
html`<ic-tooltip
|
66
|
+
label="This shows 'Code' has been copied"
|
67
|
+
target="test-button-disable-hover"
|
68
|
+
id="ic-tooltip-test-button-disable-hover"
|
69
|
+
disable-hover="true"
|
70
|
+
><button
|
71
|
+
id="test-button-disable-hover"
|
72
|
+
aria-labelledby="ic-tooltip-test-button-disable-hover"
|
73
|
+
onclick="navigator.clipboard.writeText('Code')"
|
74
|
+
>
|
75
|
+
Show tooltip
|
76
|
+
</button></ic-tooltip
|
77
|
+
>`,
|
78
|
+
|
79
|
+
name: "Disabled Hover",
|
80
|
+
height: "100px",
|
81
|
+
};
|
82
|
+
|
83
|
+
export const TopPlacements = {
|
84
|
+
render: (args) =>
|
85
|
+
html` <div style="margin: 40px">
|
86
|
+
<ic-tooltip
|
87
|
+
placement="top-start"
|
88
|
+
label="This is a description of the button"
|
89
|
+
id="ic-tooltip-test-button-top-start"
|
90
|
+
target="test-button-top-start"
|
91
|
+
>
|
92
|
+
<button
|
93
|
+
id="test-button-top-start"
|
94
|
+
aria-describedby="ic-tooltip-test-button-top-start"
|
95
|
+
>
|
96
|
+
Top start
|
97
|
+
</button>
|
98
|
+
</ic-tooltip>
|
99
|
+
<ic-tooltip
|
100
|
+
placement="top"
|
101
|
+
label="This is a description of the button"
|
102
|
+
id="ic-tooltip-test-button-top"
|
103
|
+
target="test-button-top"
|
104
|
+
>
|
105
|
+
<button
|
106
|
+
id="test-button-top"
|
107
|
+
aria-describedby="ic-tooltip-test-button-top"
|
108
|
+
>
|
109
|
+
Top
|
110
|
+
</button>
|
111
|
+
</ic-tooltip>
|
112
|
+
<ic-tooltip
|
113
|
+
placement="top-end"
|
114
|
+
label="This is a description of the button"
|
115
|
+
id="ic-tooltip-test-button-top-end"
|
116
|
+
target="test-button-top-end"
|
117
|
+
>
|
118
|
+
<button
|
119
|
+
id="test-button-top-end"
|
120
|
+
aria-describedby="ic-tooltip-test-button-top-end"
|
121
|
+
>
|
122
|
+
Top end
|
123
|
+
</button></ic-tooltip
|
124
|
+
>
|
125
|
+
</div>`,
|
126
|
+
|
127
|
+
name: "Top placements",
|
128
|
+
};
|
129
|
+
|
130
|
+
export const BottomPlacements = {
|
131
|
+
render: (args) =>
|
132
|
+
html` <div style="margin: 40px">
|
133
|
+
<ic-tooltip
|
134
|
+
placement="bottom-start"
|
135
|
+
label="This is a description of the button"
|
136
|
+
id="ic-tooltip-test-button-bottom-start"
|
137
|
+
target="test-button-bottom-start"
|
138
|
+
>
|
139
|
+
<button
|
140
|
+
id="test-button-bottom-start"
|
141
|
+
aria-describedby="ic-tooltip-test-button-bottom-start"
|
142
|
+
>
|
143
|
+
Bottom start
|
144
|
+
</button>
|
145
|
+
</ic-tooltip>
|
146
|
+
<ic-tooltip
|
147
|
+
placement="bottom"
|
148
|
+
label="This is a description of the button"
|
149
|
+
id="ic-tooltip-test-button-bottom"
|
150
|
+
target="test-button-bottom"
|
151
|
+
>
|
152
|
+
<button
|
153
|
+
id="test-button-bottom"
|
154
|
+
aria-describedby="ic-tooltip-test-button-bottom"
|
155
|
+
>
|
156
|
+
Bottom
|
157
|
+
</button>
|
158
|
+
</ic-tooltip>
|
159
|
+
<ic-tooltip
|
160
|
+
placement="bottom-end"
|
161
|
+
label="This is a description of the button"
|
162
|
+
id="ic-tooltip-test-button-bottom-end"
|
163
|
+
target="test-button-bottom-end"
|
164
|
+
>
|
165
|
+
<button
|
166
|
+
id="test-button-bottom-end"
|
167
|
+
aria-describedby="ic-tooltip-test-button-bottom-end"
|
168
|
+
>
|
169
|
+
Bottom end
|
170
|
+
</button></ic-tooltip
|
171
|
+
>
|
172
|
+
</div>`,
|
173
|
+
|
174
|
+
name: "Bottom placements",
|
175
|
+
};
|
176
|
+
|
177
|
+
export const RightPlacements = {
|
178
|
+
render: (args) =>
|
179
|
+
html` <div style="margin: 40px">
|
180
|
+
<ic-tooltip
|
181
|
+
placement="right-start"
|
182
|
+
label="This is a description of the button"
|
183
|
+
id="ic-tooltip-test-button-right-start"
|
184
|
+
target="test-button-right-start"
|
185
|
+
>
|
186
|
+
<button
|
187
|
+
id="test-button-right-start"
|
188
|
+
aria-describedby="ic-tooltip-test-button-right-start"
|
189
|
+
>
|
190
|
+
Right start
|
191
|
+
</button>
|
192
|
+
</ic-tooltip>
|
193
|
+
<ic-tooltip
|
194
|
+
placement="right"
|
195
|
+
label="This is a description of the button"
|
196
|
+
id="ic-tooltip-test-button-right"
|
197
|
+
target="test-button-right"
|
198
|
+
>
|
199
|
+
<button
|
200
|
+
id="test-button-right"
|
201
|
+
aria-describedby="ic-tooltip-test-button-right"
|
202
|
+
>
|
203
|
+
Right
|
204
|
+
</button>
|
205
|
+
</ic-tooltip>
|
206
|
+
<ic-tooltip
|
207
|
+
placement="right-end"
|
208
|
+
label="This is a description of the button"
|
209
|
+
id="ic-tooltip-test-button-right-end"
|
210
|
+
target="test-button-right-end"
|
211
|
+
>
|
212
|
+
<button
|
213
|
+
id="test-button-right-end"
|
214
|
+
aria-describedby="ic-tooltip-test-button-right-end"
|
215
|
+
>
|
216
|
+
Right end
|
217
|
+
</button></ic-tooltip
|
218
|
+
>
|
219
|
+
</div>`,
|
220
|
+
|
221
|
+
name: "Right placements",
|
222
|
+
};
|
223
|
+
|
224
|
+
export const LeftPlacements = {
|
225
|
+
render: (args) =>
|
226
|
+
html` <div style="margin-left: 400px">
|
227
|
+
<ic-tooltip
|
228
|
+
placement="left-start"
|
229
|
+
label="This is a description of the button"
|
230
|
+
id="ic-tooltip-test-button-left-start"
|
231
|
+
target="test-button-left-start"
|
232
|
+
>
|
233
|
+
<button
|
234
|
+
id="test-button-left-start"
|
235
|
+
aria-describedby="ic-tooltip-test-button-left-start"
|
236
|
+
>
|
237
|
+
Left start
|
238
|
+
</button>
|
239
|
+
</ic-tooltip>
|
240
|
+
<ic-tooltip
|
241
|
+
placement="left"
|
242
|
+
label="This is a description of the button"
|
243
|
+
id="ic-tooltip-test-button-left"
|
244
|
+
target="test-button-left"
|
245
|
+
>
|
246
|
+
<button
|
247
|
+
id="test-button-left"
|
248
|
+
aria-describedby="ic-tooltip-test-button-left"
|
249
|
+
>
|
250
|
+
Left
|
251
|
+
</button>
|
252
|
+
</ic-tooltip>
|
253
|
+
<ic-tooltip
|
254
|
+
placement="left-end"
|
255
|
+
label="This is a description of the button"
|
256
|
+
id="ic-tooltip-test-button-left-end"
|
257
|
+
target="test-button-left-end"
|
258
|
+
>
|
259
|
+
<button
|
260
|
+
id="test-button-left-end"
|
261
|
+
aria-describedby="ic-tooltip-test-button-left-end"
|
262
|
+
>
|
263
|
+
Left end
|
264
|
+
</button></ic-tooltip
|
265
|
+
>
|
266
|
+
</div>`,
|
267
|
+
|
268
|
+
name: "Left placements",
|
269
|
+
};
|
270
|
+
|
271
|
+
export const Truncation = {
|
272
|
+
render: (args) =>
|
273
|
+
html`<ic-tooltip
|
274
|
+
label="This is a body of text that is truncated to three lines within a tooltip. It has been truncated based on the max-lines property. The number of lines in the text is clamped to the number passed through the max-lines property."
|
275
|
+
target="test-button-truncation"
|
276
|
+
max-lines="3"
|
277
|
+
id="ic-tooltip-test-button-truncation"
|
278
|
+
><button
|
279
|
+
id="test-button-truncation"
|
280
|
+
aria-describedby="ic-tooltip-test-button-truncation"
|
281
|
+
>
|
282
|
+
Default
|
283
|
+
</button></ic-tooltip
|
284
|
+
>`,
|
285
|
+
|
286
|
+
name: "Truncation",
|
287
|
+
height: "100px",
|
288
|
+
};
|
289
|
+
|
290
|
+
export const DarkBackground = {
|
291
|
+
render: (args) =>
|
292
|
+
html`<div style="height: 100px;background-color:#333333;">
|
293
|
+
<ic-tooltip
|
294
|
+
label="This is a description of the button"
|
295
|
+
id="ic-tooltip-test-button-dark"
|
296
|
+
target="test-button-dark"
|
297
|
+
>
|
298
|
+
<button
|
299
|
+
id="test-button-dark"
|
300
|
+
aria-describedby="ic-tooltip-test-button-dark"
|
301
|
+
>
|
302
|
+
Default
|
303
|
+
</button>
|
304
|
+
</ic-tooltip>
|
305
|
+
</div>`,
|
306
|
+
|
307
|
+
name: "Dark background",
|
308
|
+
};
|
309
|
+
|
310
|
+
export const Playground = {
|
311
|
+
render: (args) =>
|
312
|
+
html`<div style="margin: 250px">
|
313
|
+
<ic-tooltip
|
314
|
+
label=${args.label}
|
315
|
+
placement=${args.placement}
|
316
|
+
max-lines=${args.maxLines}
|
317
|
+
disable-hover=${args.disableHover}
|
318
|
+
id="ic-tooltip-test-button-default"
|
319
|
+
target="button-id"
|
320
|
+
>
|
321
|
+
<button
|
322
|
+
id="button-id"
|
323
|
+
aria-describedby="ic-tooltip-test-button-default"
|
324
|
+
>
|
325
|
+
Button 1
|
326
|
+
</button>
|
327
|
+
</ic-tooltip>
|
328
|
+
</div> `,
|
329
|
+
|
330
|
+
args: defaultArgs,
|
331
|
+
|
332
|
+
argTypes: {
|
333
|
+
placement: {
|
334
|
+
options: [
|
335
|
+
"bottom",
|
336
|
+
"top-start",
|
337
|
+
"top",
|
338
|
+
"top-end",
|
339
|
+
"right-start",
|
340
|
+
"right",
|
341
|
+
"right-end",
|
342
|
+
"bottom-end",
|
343
|
+
"bottom-start",
|
344
|
+
"left-end",
|
345
|
+
"left",
|
346
|
+
"left-start",
|
347
|
+
],
|
348
|
+
|
349
|
+
control: {
|
350
|
+
type: "select",
|
351
|
+
},
|
352
|
+
},
|
353
|
+
},
|
354
|
+
|
355
|
+
name: "Playground",
|
356
|
+
};
|