kahuna-base-react-components 1.3.4 → 1.3.5

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/types.d.ts CHANGED
@@ -41,6 +41,26 @@ interface KSpanProps {
41
41
  }
42
42
  declare const KSpan: React.FC<KSpanProps>;
43
43
 
44
+ interface KTooltipProps {
45
+ children: React.ReactNode;
46
+ content: React.ReactNode;
47
+ position?: "top" | "bottom" | "left" | "right";
48
+ align?: "top" | "bottom" | "left" | "right" | "center";
49
+ backgroundColor?: string;
50
+ width?: string;
51
+ height?: string;
52
+ zIndex?: number;
53
+ border?: string;
54
+ borderRadius?: string;
55
+ boxShadow?: string;
56
+ showArrow?: boolean;
57
+ arrowColor?: string;
58
+ padding?: string;
59
+ marginTop?: string;
60
+ marginLeft?: string;
61
+ }
62
+ declare const KTooltip: React.FC<KTooltipProps>;
63
+
44
64
  interface KTitleSpanProps {
45
65
  text: string;
46
66
  fontSize?: number;
@@ -51,6 +71,7 @@ interface KTitleSpanProps {
51
71
  letterSpacing?: string;
52
72
  bold?: boolean;
53
73
  ellipsis?: boolean;
74
+ tooltipProps?: Partial<KTooltipProps>;
54
75
  }
55
76
  declare const KTitleSpan: React.FC<KTitleSpanProps>;
56
77
 
@@ -221,26 +242,6 @@ interface KSelectDateProps {
221
242
  }
222
243
  declare const KSelectDate: React.FC<KSelectDateProps>;
223
244
 
224
- interface KTooltipProps {
225
- children: React.ReactNode;
226
- content: React.ReactNode;
227
- position?: "top" | "bottom" | "left" | "right";
228
- align?: "top" | "bottom" | "left" | "right" | "center";
229
- backgroundColor?: string;
230
- width?: string;
231
- height?: string;
232
- zIndex?: number;
233
- border?: string;
234
- borderRadius?: string;
235
- boxShadow?: string;
236
- showArrow?: boolean;
237
- arrowColor?: string;
238
- padding?: string;
239
- marginTop?: string;
240
- marginLeft?: string;
241
- }
242
- declare const KTooltip: React.FC<KTooltipProps>;
243
-
244
245
  interface SliderLabelOption {
245
246
  label: string;
246
247
  value: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kahuna-base-react-components",
3
- "version": "1.3.4",
3
+ "version": "1.3.5",
4
4
  "description": "Kahuna Base React Components",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.esm.js",
@@ -24,7 +24,7 @@ const Template: StoryFn<typeof KSpanWrapper> = (args) => <KSpanWrapper {...args}
24
24
 
25
25
  export const KSpanPrimary = Template.bind({})
26
26
  KSpanPrimary.args = {
27
- text: "Login",
27
+ text: "Burada uzun metin var, overflow olabilir.",
28
28
  fontSize: 14,
29
29
  color: "#1F1F1F",
30
30
  fontWeight: 400,
@@ -1,5 +1,6 @@
1
1
  import {Meta, StoryFn} from "@storybook/react";
2
2
  import KTitleSpan, { KTitleSpanProps } from "./KTitleSpan";
3
+ import KSpan from "../KSpan";
3
4
 
4
5
  export default {
5
6
  title: "ReactComponentLibrary/KTitleSpan",
@@ -21,18 +22,27 @@ const KTitleSpanWrapper: React.FC<KTitleSpanProps> = (args) => {
21
22
  }
22
23
 
23
24
  const Template: StoryFn<typeof KTitleSpanWrapper> = (args) => <KTitleSpanWrapper {...args} />;
24
-
25
+ const myText = "Hello how are you, how is it going? "
25
26
  export const KTitleSpanPrimary = Template.bind({});
26
27
  KTitleSpanPrimary.args = {
27
- text: "Hello how?",
28
+ text: myText,
28
29
  fontSize: 48,
29
30
  color: "#111",
30
31
  lineHeight: "56px",
31
32
  fontStyle: "normal",
32
33
  letterSpacing: "-0.48px",
33
34
  bold: false,
34
- ellipsis: true
35
- };
35
+ ellipsis: true,
36
+ tooltipProps: {
37
+ width: "150px",
38
+ position: "bottom",
39
+ content: (
40
+ <div className="w-full whitespace-normal">
41
+ <KSpan text={myText} color="#111" />
42
+ </div>
43
+ )
44
+ }
45
+ }
36
46
 
37
47
  export const KTitleSpanSecondary = Template.bind({});
38
48
  KTitleSpanSecondary.args = {
@@ -2,6 +2,7 @@ import React, { useEffect, useRef, useState } from "react"
2
2
  import "../../main.css"
3
3
  import KTooltip from "../KTooltip"
4
4
  import KSpan from "../KSpan"
5
+ import { KTooltipProps } from "../KTooltip/KTooltip"
5
6
 
6
7
  export interface KTitleSpanProps {
7
8
  text: string
@@ -13,6 +14,7 @@ export interface KTitleSpanProps {
13
14
  letterSpacing?: string
14
15
  bold?: boolean
15
16
  ellipsis?: boolean
17
+ tooltipProps?: Partial<KTooltipProps>
16
18
  }
17
19
 
18
20
  const KTitleSpan: React.FC<KTitleSpanProps> = (props) => {
@@ -55,6 +57,7 @@ const KTitleSpan: React.FC<KTitleSpanProps> = (props) => {
55
57
  <KSpan text={props.text} color="#111" />
56
58
  </div>
57
59
  }
60
+ {...props.tooltipProps}
58
61
  >
59
62
  <span
60
63
  ref={textRef}
@@ -21,11 +21,7 @@ const Template: StoryFn<KTooltipProps> = (args) => (
21
21
 
22
22
  export const KTooltipPrimary = Template.bind({})
23
23
  KTooltipPrimary.args = {
24
- content: (
25
- <div className="bg-red-100 flex justify-center items-center">
26
- <div className="bg-green-300 font-extrabold ">BURADA</div>
27
- </div>
28
- ),
24
+ content: "null",
29
25
  position: "top",
30
26
  align: "right",
31
27
  zIndex: 1000,
@@ -38,7 +34,7 @@ KTooltipPrimary.args = {
38
34
  }
39
35
 
40
36
  export const KTooltipSecondary = Template.bind({})
41
- KTooltipPrimary.args = {
37
+ KTooltipSecondary.args = {
42
38
  content: (
43
39
  <div className="flex flex-col gap-2 justify-center items-start px-4 py-2">
44
40
  <div
@@ -3,7 +3,7 @@ import "../../main.css"
3
3
 
4
4
  export interface KTooltipProps {
5
5
  children: React.ReactNode
6
- content: React.ReactNode
6
+ content: React.ReactNode // if content === null the tooltip will not be visible
7
7
  position?: "top" | "bottom" | "left" | "right"
8
8
  align?: "top" | "bottom" | "left" | "right" | "center"
9
9
  backgroundColor?: string
@@ -61,7 +61,7 @@ const KTooltip: React.FC<KTooltipProps> = (props) => {
61
61
  <div className="relative box-border" onMouseEnter={showTooltip} onMouseLeave={hideTooltip}>
62
62
  {props.children}
63
63
 
64
- <div
64
+ {props.content !== null && <div
65
65
  className={`${absolutePositionClassName(position, align)} absolute ${
66
66
  isVisible ? "k-tooltip-enter" : "k-tooltip-exit"
67
67
  }`}
@@ -81,7 +81,7 @@ const KTooltip: React.FC<KTooltipProps> = (props) => {
81
81
  {props.content}
82
82
  </div>
83
83
  {showArrow && <div className={`arrow-${position}`} style={{ backgroundColor: arrowColor, zIndex: -200 }}></div>}
84
- </div>
84
+ </div>}
85
85
  </div>
86
86
  )
87
87
  }