diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 2d7107e048..9f722a8393 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -54,6 +54,7 @@ /src/components/KSelect @adamdehaven @jillztom @portikM /src/components/KTable @adamdehaven @jillztom @portikM /src/components/KTextArea @adamdehaven @jillztom @portikM +/src/components/KTooltip @adamdehaven @jillztom @portikM /src/components/KTreeList @adamdehaven @jillztom @portikM /src/components/KTruncate @adamdehaven @jillztom @portikM diff --git a/docs/components/tooltip.md b/docs/components/tooltip.md index 72bccab51b..3de37ad7fa 100644 --- a/docs/components/tooltip.md +++ b/docs/components/tooltip.md @@ -36,8 +36,8 @@ KTooltip won't be triggered if the element you pass through `default` slot has ` + + ```html @@ -74,7 +83,7 @@ Here are the different options: -
+
bottom @@ -89,6 +98,13 @@ Here are the different options:
+ + ```html Sample Button @@ -129,7 +145,7 @@ You can set the maximum width of a Tooltip with the `maxWidth` property. `maxWid  ✌🏻 @@ -137,7 +153,7 @@ You can set the maximum width of a Tooltip with the `maxWidth` property. `maxWid  ✌🏻 ``` @@ -164,15 +180,15 @@ Example: ``` diff --git a/src/components/KTooltip/KTooltip.vue b/src/components/KTooltip/KTooltip.vue index 2b20681b9b..353cfc2411 100644 --- a/src/components/KTooltip/KTooltip.vue +++ b/src/components/KTooltip/KTooltip.vue @@ -33,8 +33,8 @@ import { PopPlacementsArray, PopPlacements } from '@/types' const props = defineProps({ /** - * Text to show in tooltip - */ + * Text to show in tooltip + */ label: { type: String, required: false, @@ -42,8 +42,8 @@ const props = defineProps({ }, /** - * Define which side the tooltip displays - */ + * Define which side the tooltip displays + */ placement: { type: String as PropType, default: 'bottom', @@ -52,22 +52,22 @@ const props = defineProps({ }, }, /** - * A flag to use fixed positioning of the popover to avoid content being clipped by parental boundaries. - */ + * A flag to use fixed positioning of the popover to avoid content being clipped by parental boundaries. + */ positionFixed: { type: Boolean, default: false, }, /** - * Set the max-width of the ktooltip - */ + * Set the max-width of the ktooltip + */ maxWidth: { type: String, default: 'auto', }, /** - * Test mode - for testing only, strips out generated ids - */ + * Test mode - for testing only, strips out generated ids + */ testMode: { type: Boolean, default: false, @@ -79,16 +79,16 @@ const computedClass = computed((): string => { let result = '' switch (props.placement) { case 'top': - result = 'mb-2' + result = 'k-tooltip-top' break case 'right': - result = 'ml-2' + result = 'k-tooltip-right' break case 'bottom': - result = 'mt-2' + result = 'k-tooltip-bottom' break case 'left': - result = 'mr-2' + result = 'k-tooltip-left' break } @@ -101,13 +101,29 @@ const computedClass = computed((): string => { @import '@/styles/functions'; .k-tooltip.k-popover { - --KPopColor: var(--KTooltipColor, var(--white, color(white))); - --KPopBackground: var(--KTooltipBackground, var(--black-400, color(black-400))); - --KPopBodySize: var(--type-sm); - --KPopPaddingX: var(--spacing-xs); - --KPopPaddingY: var(--spacing-xs); + --KPopColor: var(--KTooltipColor, var(--white, var(--kui-color-text-inverse, #{$kui-color-text-inverse}))); + --KPopBackground: var(--KTooltipBackground, var(--black-400, var(--kui-color-background-neutral-stronger, #{$kui-color-background-neutral-stronger}))); + --KPopBodySize: var(--type-sm, var(--kui-font-size-30, #{$kui-font-size-30})); + --KPopPaddingX: var(--spacing-xs, var(--kui-space-40, #{$kui-space-40})); + --KPopPaddingY: var(--spacing-xs, var(--kui-space-40, #{$kui-space-40})); --KPopBorder: none; pointer-events: none; z-index: 9999; } + +.k-tooltip-top { + margin-bottom: var(--kui-space-10, $kui-space-10) !important; +} + +.k-tooltip-right { + margin-left: var(--kui-space-10, $kui-space-10) !important; +} + +.k-tooltip-bottom { + margin-top: var(--kui-space-10, $kui-space-10) !important; +} + +.k-tooltip-left { + margin-right: var(--kui-space-10, $kui-space-10) !important; +}