kahuna-base-react-components 0.2.12 → 0.2.13
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/components/KButton/KButton.stories.d.ts +8 -0
- package/dist/components/KDropdown/KDropdown.stories.d.ts +7 -0
- package/dist/components/KInput/KInput.stories.d.ts +8 -0
- package/dist/components/KLogo/KLogo.stories.d.ts +5 -0
- package/dist/components/KSelectDate/KSelectDate.stories.d.ts +5 -0
- package/dist/components/KSlider/KSlider.stories.d.ts +3 -0
- package/dist/components/KSpan/KSpan.stories.d.ts +4 -0
- package/dist/components/KTitleSpan/KTitleSpan.stories.d.ts +3 -0
- package/dist/components/KTooltip/KTooltip.d.ts +19 -0
- package/dist/components/KTooltip/KTooltip.stories.d.ts +5 -0
- package/dist/components/KTooltip/index.d.ts +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.esm.js +2 -2
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +18 -1
- package/package.json +1 -1
- package/src/components/KTooltip/KTooltip.stories.tsx +94 -0
- package/src/components/KTooltip/KTooltip.tsx +67 -0
- package/src/components/KTooltip/index.ts +1 -0
- package/src/index.ts +2 -1
- package/src/main.css +94 -4
package/dist/types.d.ts
CHANGED
|
@@ -141,4 +141,21 @@ interface KSelectDateProps {
|
|
|
141
141
|
}
|
|
142
142
|
declare const KSelectDate: React.FC<KSelectDateProps>;
|
|
143
143
|
|
|
144
|
-
|
|
144
|
+
interface KTooltipProps {
|
|
145
|
+
children: React.ReactNode;
|
|
146
|
+
content: React.ReactNode;
|
|
147
|
+
position?: string;
|
|
148
|
+
backgroundColor?: string;
|
|
149
|
+
width?: string;
|
|
150
|
+
height?: string;
|
|
151
|
+
zIndex?: number;
|
|
152
|
+
border?: string;
|
|
153
|
+
borderRadius?: string;
|
|
154
|
+
boxShadow?: string;
|
|
155
|
+
showArrow?: boolean;
|
|
156
|
+
arrowColor?: string;
|
|
157
|
+
padding?: string;
|
|
158
|
+
}
|
|
159
|
+
declare const KTooltip: React.FC<KTooltipProps>;
|
|
160
|
+
|
|
161
|
+
export { KButton, KDropdown, KInput, KLogo, KSelectDate, KSlider, KSpan, KTitleSpan, KTooltip };
|
package/package.json
CHANGED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { Meta, StoryFn } from "@storybook/react"
|
|
2
|
+
import KTooltip, { KTooltipProps } from "./KTooltip"
|
|
3
|
+
import KSpan from "../KSpan"
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: "ReactComponentLibrary/KTooltip",
|
|
7
|
+
component: KTooltip,
|
|
8
|
+
parameters: {
|
|
9
|
+
layout: "centered"
|
|
10
|
+
}
|
|
11
|
+
} as Meta<typeof KTooltip>
|
|
12
|
+
|
|
13
|
+
const Template: StoryFn<KTooltipProps> = (args) => (
|
|
14
|
+
<KTooltip {...args}>
|
|
15
|
+
<div className="bg-red-200 w-[200px] aspect-square rounded-full flex items-center justify-center">
|
|
16
|
+
Tooltip Children
|
|
17
|
+
</div>{" "}
|
|
18
|
+
{/* Here we place the children directly */}
|
|
19
|
+
</KTooltip>
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
export const KTooltipPrimary = Template.bind({})
|
|
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
|
+
),
|
|
29
|
+
position: "top",
|
|
30
|
+
zIndex: 1000,
|
|
31
|
+
arrowColor: "green",
|
|
32
|
+
showArrow: true,
|
|
33
|
+
padding: "10px",
|
|
34
|
+
border: "1px solid red"
|
|
35
|
+
//boxShadow: "3px 3px 10px #000",
|
|
36
|
+
//borderRadius: "100px",
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export const KTooltipSecondary = Template.bind({})
|
|
40
|
+
KTooltipPrimary.args = {
|
|
41
|
+
content: (
|
|
42
|
+
<div className="flex flex-col gap-2 justify-center items-start px-4 py-2">
|
|
43
|
+
<div
|
|
44
|
+
className="flex flex-row gap-1 whitespace-nowrap items-center"
|
|
45
|
+
style={{
|
|
46
|
+
opacity: true ? "1" : "0.3"
|
|
47
|
+
}}
|
|
48
|
+
>
|
|
49
|
+
<span className="bg-[#21A494] px-0.5 py-1 flex items-center justify-center w-9 rounded-[3px]">
|
|
50
|
+
<KSpan text="16-Bit" fontSize={10} lineHeight="10px" fontWeight={600} color="#FFF" />
|
|
51
|
+
</span>
|
|
52
|
+
{true ? (
|
|
53
|
+
<KSpan text="Added" fontSize={12} lineHeight="12px" color="#1F1F1F" fontWeight={600} />
|
|
54
|
+
) : (
|
|
55
|
+
<KSpan text="No File" fontSize={12} lineHeight="12px" color="#1F1F1F" fontWeight={600}></KSpan>
|
|
56
|
+
)}
|
|
57
|
+
</div>
|
|
58
|
+
<div
|
|
59
|
+
className="flex flex-row gap-1 whitespace-nowrap items-center"
|
|
60
|
+
style={{
|
|
61
|
+
opacity: true ? "1" : "0.3"
|
|
62
|
+
}}
|
|
63
|
+
>
|
|
64
|
+
<span className="bg-[#BBCC13] px-0.5 py-1 flex items-center justify-center w-9 rounded-[3px]">
|
|
65
|
+
<KSpan text="24-Bit" fontSize={10} lineHeight="10px" fontWeight={600} color="#FFF" />
|
|
66
|
+
</span>
|
|
67
|
+
{true ? (
|
|
68
|
+
<KSpan text="Added" fontSize={12} lineHeight="12px" color="#1F1F1F" fontWeight={600} />
|
|
69
|
+
) : (
|
|
70
|
+
<KSpan text="No File" fontSize={12} lineHeight="12px" color="#1F1F1F" fontWeight={600}></KSpan>
|
|
71
|
+
)}
|
|
72
|
+
</div>
|
|
73
|
+
<div
|
|
74
|
+
className="flex flex-row gap-1 whitespace-nowrap items-center"
|
|
75
|
+
style={{
|
|
76
|
+
opacity: true ? "1" : "0.3"
|
|
77
|
+
}}
|
|
78
|
+
>
|
|
79
|
+
<span className="bg-[#30272C] px-0.5 py-1 flex items-center justify-center w-9 rounded-[3px]">
|
|
80
|
+
<KSpan text="Dolby" fontSize={10} lineHeight="10px" fontWeight={600} color="#FFF" />
|
|
81
|
+
</span>
|
|
82
|
+
{true ? (
|
|
83
|
+
<KSpan text="Added" fontSize={12} lineHeight="12px" color="#1F1F1F" fontWeight={600}></KSpan>
|
|
84
|
+
) : (
|
|
85
|
+
<KSpan text="No File" fontSize={12} lineHeight="12px" color="#1F1F1F" fontWeight={600}></KSpan>
|
|
86
|
+
)}
|
|
87
|
+
</div>
|
|
88
|
+
</div>
|
|
89
|
+
),
|
|
90
|
+
arrowColor: "red",
|
|
91
|
+
padding: "0px"
|
|
92
|
+
//boxShadow: "3px 3px 10px #000",
|
|
93
|
+
//borderRadius: "100px",
|
|
94
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import React, { useState } from "react"
|
|
2
|
+
import "../../main.css"
|
|
3
|
+
|
|
4
|
+
export interface KTooltipProps {
|
|
5
|
+
children: React.ReactNode
|
|
6
|
+
content: React.ReactNode
|
|
7
|
+
position?: string
|
|
8
|
+
backgroundColor?: string
|
|
9
|
+
width?: string
|
|
10
|
+
height?: string
|
|
11
|
+
zIndex?: number
|
|
12
|
+
border?: string
|
|
13
|
+
borderRadius?: string
|
|
14
|
+
boxShadow?: string
|
|
15
|
+
showArrow?: boolean
|
|
16
|
+
arrowColor?: string
|
|
17
|
+
padding?: string
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const KTooltip: React.FC<KTooltipProps> = (props) => {
|
|
21
|
+
const [isVisible, setIsVisible] = useState(false)
|
|
22
|
+
|
|
23
|
+
const showTooltip = () => setIsVisible(true)
|
|
24
|
+
const hideTooltip = () => setIsVisible(false)
|
|
25
|
+
|
|
26
|
+
const position = props.position || "top"
|
|
27
|
+
const width = props.width || "auto"
|
|
28
|
+
const height = props.height || "auto"
|
|
29
|
+
const background = props.backgroundColor || "#FFF"
|
|
30
|
+
const zIndex = props.zIndex || 999999
|
|
31
|
+
const boxShadow = props.boxShadow || "none"
|
|
32
|
+
const border = props.border || "1px solid #E5E7EB"
|
|
33
|
+
const borderRadius = props.borderRadius || "5px"
|
|
34
|
+
const arrowColor =
|
|
35
|
+
props.arrowColor !== undefined
|
|
36
|
+
? props.arrowColor
|
|
37
|
+
: props.backgroundColor !== undefined
|
|
38
|
+
? props.backgroundColor
|
|
39
|
+
: "#F7F7F7"
|
|
40
|
+
const showArrow = props.showArrow || false
|
|
41
|
+
const padding = props.padding || "5px"
|
|
42
|
+
|
|
43
|
+
const baseStyles = { width, height, background, zIndex, border, borderRadius, boxShadow }
|
|
44
|
+
return (
|
|
45
|
+
<div className="relative box-border" onMouseEnter={showTooltip} onMouseLeave={hideTooltip}>
|
|
46
|
+
{props.children}
|
|
47
|
+
|
|
48
|
+
<div
|
|
49
|
+
className={`k-tooltip-${position} absolute ${isVisible ? "k-tooltip-enter" : "k-tooltip-exit"}`}
|
|
50
|
+
style={baseStyles}
|
|
51
|
+
>
|
|
52
|
+
<div
|
|
53
|
+
style={{
|
|
54
|
+
padding: padding,
|
|
55
|
+
borderRadius,
|
|
56
|
+
background
|
|
57
|
+
}}
|
|
58
|
+
>
|
|
59
|
+
{props.content}
|
|
60
|
+
</div>
|
|
61
|
+
{showArrow && <div className={`arrow-${position}`} style={{ backgroundColor: arrowColor, zIndex: -200 }}></div>}
|
|
62
|
+
</div>
|
|
63
|
+
</div>
|
|
64
|
+
)
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export default KTooltip
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {default} from './KTooltip'
|
package/src/index.ts
CHANGED
|
@@ -6,7 +6,8 @@ import KInput from "./components/KInput"
|
|
|
6
6
|
import KDropdown from "./components/KDropdown"
|
|
7
7
|
import KSlider from "./components/KSlider"
|
|
8
8
|
import KSelectDate from "./components/KSelectDate"
|
|
9
|
+
import KTooltip from "./components/KTooltip"
|
|
9
10
|
|
|
10
11
|
export {
|
|
11
|
-
KButton, KSpan, KLogo, KTitleSpan, KInput, KDropdown, KSlider, KSelectDate
|
|
12
|
+
KButton, KSpan, KLogo, KTitleSpan, KInput, KDropdown, KSlider, KSelectDate, KTooltip
|
|
12
13
|
}
|
package/src/main.css
CHANGED
|
@@ -46,7 +46,8 @@
|
|
|
46
46
|
font-family: Inter;
|
|
47
47
|
font-style: normal;
|
|
48
48
|
font-weight: 400;
|
|
49
|
-
line-height: 20px;
|
|
49
|
+
line-height: 20px;
|
|
50
|
+
/* 142.857% */
|
|
50
51
|
letter-spacing: -0.084px;
|
|
51
52
|
}
|
|
52
53
|
|
|
@@ -100,11 +101,100 @@
|
|
|
100
101
|
.k-slider-input::-webkit-slider-thumb {
|
|
101
102
|
-webkit-appearance: none;
|
|
102
103
|
cursor: pointer;
|
|
103
|
-
margin-top: -4px;
|
|
104
|
-
|
|
105
|
-
|
|
104
|
+
margin-top: -4px;
|
|
105
|
+
/* Align the thumb vertically with the track */
|
|
106
|
+
width: 16px;
|
|
107
|
+
/* Width of the thumb */
|
|
108
|
+
height: 16px;
|
|
109
|
+
/* Height of the thumb */
|
|
106
110
|
border-radius: 50px;
|
|
107
111
|
background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28' viewBox='0 0 28 28' fill='none'%3E%3Cg filter='url(%23filter0_di_252_33228)'%3E%3Crect x='6' y='6' width='16' height='16' rx='8' fill='white'/%3E%3Crect x='6.5' y='6.5' width='15' height='15' rx='7.5' stroke='white'/%3E%3C/g%3E%3Cg filter='url(%23filter1_d_252_33228)'%3E%3Cpath d='M11 14C11 12.3431 12.3431 11 14 11C15.6569 11 17 12.3431 17 14C17 15.6569 15.6569 17 14 17C12.3431 17 11 15.6569 11 14Z' fill='%23B5B5B5'/%3E%3C/g%3E%3Cdefs%3E%3Cfilter id='filter0_di_252_33228' x='0' y='0' width='28' height='28' filterUnits='userSpaceOnUse' color-interpolation-filters='sRGB'%3E%3CfeFlood flood-opacity='0' result='BackgroundImageFix'/%3E%3CfeColorMatrix in='SourceAlpha' type='matrix' values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0' result='hardAlpha'/%3E%3CfeOffset/%3E%3CfeGaussianBlur stdDeviation='3'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 0.105882 0 0 0 0 0.109804 0 0 0 0 0.113725 0 0 0 0.06 0'/%3E%3CfeBlend mode='normal' in2='BackgroundImageFix' result='effect1_dropShadow_252_33228'/%3E%3CfeBlend mode='normal' in='SourceGraphic' in2='effect1_dropShadow_252_33228' result='shape'/%3E%3CfeColorMatrix in='SourceAlpha' type='matrix' values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0' result='hardAlpha'/%3E%3CfeOffset dy='-3'/%3E%3CfeGaussianBlur stdDeviation='1.5'/%3E%3CfeComposite in2='hardAlpha' operator='arithmetic' k2='-1' k3='1'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 0.894118 0 0 0 0 0.898039 0 0 0 0 0.905882 0 0 0 1 0'/%3E%3CfeBlend mode='normal' in2='shape' result='effect2_innerShadow_252_33228'/%3E%3C/filter%3E%3Cfilter id='filter1_d_252_33228' x='7' y='9' width='14' height='14' filterUnits='userSpaceOnUse' color-interpolation-filters='sRGB'%3E%3CfeFlood flood-opacity='0' result='BackgroundImageFix'/%3E%3CfeColorMatrix in='SourceAlpha' type='matrix' values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0' result='hardAlpha'/%3E%3CfeOffset dy='2'/%3E%3CfeGaussianBlur stdDeviation='2'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 0.105882 0 0 0 0 0.109804 0 0 0 0 0.113725 0 0 0 0.04 0'/%3E%3CfeBlend mode='normal' in2='BackgroundImageFix' result='effect1_dropShadow_252_33228'/%3E%3CfeBlend mode='normal' in='SourceGraphic' in2='effect1_dropShadow_252_33228' result='shape'/%3E%3C/filter%3E%3C/defs%3E%3C/svg%3E") center / cover;
|
|
108
112
|
background-size: auto;
|
|
109
113
|
background-position: center;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.k-tooltip-top {
|
|
117
|
+
bottom: 100%;
|
|
118
|
+
left: 50%;
|
|
119
|
+
transform: translateX(-50%);
|
|
120
|
+
margin-bottom: 10px;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.k-tooltip-right {
|
|
124
|
+
top: 50%;
|
|
125
|
+
left: 100%;
|
|
126
|
+
transform: translateY(-50%);
|
|
127
|
+
margin-left: 10px;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.k-tooltip-bottom {
|
|
131
|
+
top: 100%;
|
|
132
|
+
left: 50%;
|
|
133
|
+
transform: translateX(-50%);
|
|
134
|
+
margin-top: 10px;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.k-tooltip-left {
|
|
138
|
+
top: 50%;
|
|
139
|
+
right: 100%;
|
|
140
|
+
transform: translateY(-50%);
|
|
141
|
+
margin-right: 10px;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.k-tooltip-enter {
|
|
145
|
+
opacity: 1;
|
|
146
|
+
visibility: visible;
|
|
147
|
+
pointer-events: auto;
|
|
148
|
+
transition: opacity 0.5s ease-in-out, visibility 0.5s ease-in-out;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.k-tooltip-exit {
|
|
152
|
+
opacity: 0;
|
|
153
|
+
pointer-events: none;
|
|
154
|
+
visibility: hidden;
|
|
155
|
+
transition: opacity 0.5s ease-in-out, visibility 0.5s ease-in-out;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.arrow-left {
|
|
159
|
+
position: absolute;
|
|
160
|
+
width: 10px;
|
|
161
|
+
height: 10px;
|
|
162
|
+
top: 50%;
|
|
163
|
+
left: calc(100% - 5px);
|
|
164
|
+
transform-origin: center;
|
|
165
|
+
transform: translateY(-50%) rotateZ(45deg);
|
|
166
|
+
z-index: -100;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
.arrow-right {
|
|
170
|
+
position: absolute;
|
|
171
|
+
width: 10px;
|
|
172
|
+
height: 10px;
|
|
173
|
+
top: 50%;
|
|
174
|
+
right: calc(100% - 5px);
|
|
175
|
+
transform-origin: center;
|
|
176
|
+
transform: translateY(-50%) rotateZ(45deg);
|
|
177
|
+
z-index: -100;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
.arrow-top {
|
|
181
|
+
position: absolute;
|
|
182
|
+
width: 10px;
|
|
183
|
+
height: 10px;
|
|
184
|
+
top: calc(100% - 5px);
|
|
185
|
+
left: 50%;
|
|
186
|
+
transform-origin: center;
|
|
187
|
+
transform: translateX(-50%) rotateZ(45deg);
|
|
188
|
+
z-index: -100;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
.arrow-bottom {
|
|
192
|
+
position: absolute;
|
|
193
|
+
width: 10px;
|
|
194
|
+
height: 10px;
|
|
195
|
+
bottom: calc(100% - 5px);
|
|
196
|
+
left: 50%;
|
|
197
|
+
transform-origin: center;
|
|
198
|
+
transform: translateX(-50%) rotateZ(45deg);
|
|
199
|
+
z-index: -100;
|
|
110
200
|
}
|