kahuna-base-react-components 1.0.7 → 1.1.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/.prettierrc +8 -0
- package/README.md +23 -0
- package/dist/components/KButton/KButton.d.ts +17 -3
- package/dist/components/KCodeInput/KCodeInput.d.ts +36 -0
- package/dist/components/KCodeInput/index.d.ts +1 -0
- package/dist/components/KDropdown/KDropdown.d.ts +38 -0
- package/dist/components/KDropdown/index.d.ts +1 -0
- package/dist/components/KDropdownToggle/KDropdownToggle.d.ts +35 -0
- package/dist/components/KDropdownToggle/index.d.ts +1 -0
- package/dist/components/KInput/KInput.d.ts +32 -0
- package/dist/components/KInput/index.d.ts +1 -0
- package/dist/components/KLogo/KLogo.d.ts +18 -0
- package/dist/components/KLogo/index.d.ts +1 -0
- package/dist/components/KSelectDate/KSelectDate.d.ts +9 -0
- package/dist/components/KSelectDate/index.d.ts +1 -0
- package/dist/components/KSlider/KSlider.d.ts +15 -0
- package/dist/components/KSlider/index.d.ts +1 -0
- package/dist/components/KSliderLabel/KSliderLabel.d.ts +19 -0
- package/dist/components/KSliderLabel/index.d.ts +1 -0
- package/dist/components/KSpan/KSpan.d.ts +14 -4
- package/dist/components/KTextArea/KTextArea.d.ts +32 -0
- package/dist/components/KTextArea/index.d.ts +1 -0
- package/dist/components/KTitleSpan/KTitleSpan.d.ts +14 -0
- package/dist/components/KTitleSpan/index.d.ts +1 -0
- package/dist/components/KTooltip/KTooltip.d.ts +19 -0
- package/dist/components/KTooltip/index.d.ts +1 -0
- package/dist/fonts/AeonikPro-Bold/AeonikPro-Bold.otf +0 -0
- package/dist/fonts/AeonikPro-Bold/CoType EULA Desktop.pdf +1388 -3
- package/dist/fonts/Inter/Inter-VariableFont_slnt,wght.ttf +0 -0
- package/dist/fonts/Inter/OFL.txt +93 -0
- package/dist/fonts/Inter/README.txt +72 -0
- package/dist/fonts/Inter/static/Inter-Black.ttf +0 -0
- package/dist/fonts/Inter/static/Inter-Bold.ttf +0 -0
- package/dist/fonts/Inter/static/Inter-ExtraBold.ttf +0 -0
- package/dist/fonts/Inter/static/Inter-ExtraLight.ttf +0 -0
- package/dist/fonts/Inter/static/Inter-Light.ttf +0 -0
- package/dist/fonts/Inter/static/Inter-Medium.ttf +0 -0
- package/dist/fonts/Inter/static/Inter-Regular.ttf +0 -0
- package/dist/fonts/Inter/static/Inter-SemiBold.ttf +0 -0
- package/dist/fonts/Inter/static/Inter-Thin.ttf +0 -0
- package/dist/index.d.ts +11 -1
- package/dist/index.esm.js +9 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +9 -1
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +241 -8
- package/package.json +14 -3
- package/postcss.config.js +6 -0
- package/removeUseClient.js +22 -0
- package/rollup.config.js +9 -3
- package/src/assets/calendar-hovered.svg +3 -0
- package/src/assets/calendar.svg +3 -0
- package/src/assets/check.svg +3 -0
- package/src/assets/chevron-left.svg +7 -0
- package/src/assets/chevron-right.svg +7 -0
- package/src/assets/fonts/AeonikPro/AeonikPro-Bold.otf +0 -0
- package/src/assets/fonts/AeonikPro/AeonikPro-Medium.otf +0 -0
- package/src/assets/fonts/AeonikPro/CoType EULA Desktop.pdf +1388 -3
- package/src/assets/fonts/Inter/Inter-VariableFont_slnt,wght.ttf +0 -0
- package/src/assets/fonts/Inter/OFL.txt +93 -0
- package/src/assets/fonts/Inter/README.txt +72 -0
- package/src/assets/fonts/Inter/static/Inter-Black.ttf +0 -0
- package/src/assets/fonts/Inter/static/Inter-Bold.ttf +0 -0
- package/src/assets/fonts/Inter/static/Inter-ExtraBold.ttf +0 -0
- package/src/assets/fonts/Inter/static/Inter-ExtraLight.ttf +0 -0
- package/src/assets/fonts/Inter/static/Inter-Light.ttf +0 -0
- package/src/assets/fonts/Inter/static/Inter-Medium.ttf +0 -0
- package/src/assets/fonts/Inter/static/Inter-Regular.ttf +0 -0
- package/src/assets/fonts/Inter/static/Inter-SemiBold.ttf +0 -0
- package/src/assets/fonts/Inter/static/Inter-Thin.ttf +0 -0
- package/src/assets/kahuna-text.svg +3 -0
- package/src/assets/logo-gray.svg +10 -0
- package/src/assets/logo-small-hovered.svg +4 -0
- package/src/assets/logo-small.svg +11 -0
- package/src/assets/logo.svg +11 -0
- package/src/assets/progress.svg +37 -0
- package/src/assets/separator.svg +3 -0
- package/src/assets/slider-dots.svg +7 -0
- package/src/assets/slider-step.svg +3 -0
- package/src/assets/slider-thumb.svg +3 -0
- package/src/assets/tracks.svg +5 -0
- package/src/assets/union.svg +3 -0
- package/src/assets/vector.svg +3 -0
- package/src/components/KButton/KButton.stories.tsx +69 -12
- package/src/components/KButton/KButton.tsx +51 -14
- package/src/components/KCodeInput/KCodeInput.stories.tsx +84 -0
- package/src/components/KCodeInput/KCodeInput.tsx +260 -0
- package/src/components/KCodeInput/index.ts +1 -0
- package/src/components/KDropdown/KDropdown.stories.tsx +90 -0
- package/src/components/KDropdown/KDropdown.tsx +201 -0
- package/src/components/KDropdown/index.ts +1 -0
- package/src/components/KInput/KInput.stories.tsx +84 -0
- package/src/components/KInput/KInput.tsx +128 -0
- package/src/components/KInput/index.ts +1 -0
- package/src/components/KLogo/KLogo.stories.tsx +24 -0
- package/src/components/KLogo/KLogo.tsx +79 -0
- package/src/components/KLogo/index.ts +1 -0
- package/src/components/KSelectDate/CalendarCustom.css +235 -0
- package/src/components/KSelectDate/KSelectDate.stories.tsx +54 -0
- package/src/components/KSelectDate/KSelectDate.tsx +314 -0
- package/src/components/KSelectDate/index.ts +1 -0
- package/src/components/KSlider/KSlider.stories.tsx +19 -0
- package/src/components/KSlider/KSlider.tsx +67 -0
- package/src/components/KSlider/index.ts +1 -0
- package/src/components/KSliderLabel/KSliderLabel.stories.tsx +61 -0
- package/src/components/KSliderLabel/KSliderLabel.tsx +137 -0
- package/src/components/KSliderLabel/index.ts +1 -0
- package/src/components/KSpan/KSpan.stories.tsx +31 -11
- package/src/components/KSpan/KSpan.tsx +65 -9
- package/src/components/KTextArea/KTextArea.stories.tsx +65 -0
- package/src/components/KTextArea/KTextArea.tsx +130 -0
- package/src/components/KTextArea/index.ts +1 -0
- package/src/components/KTitleSpan/KTitleSpan.stories.tsx +23 -0
- package/src/components/KTitleSpan/KTitleSpan.tsx +33 -0
- package/src/components/KTitleSpan/index.ts +1 -0
- 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 +12 -1
- package/src/main.css +251 -0
- package/tailwind.config.js +9 -0
- package/dist/components/KButton/KButton.stories.d.ts +0 -4
- package/dist/components/KSpan/KSpan.stories.d.ts +0 -3
- package/src/stories/Button.stories.ts +0 -50
- package/src/stories/Button.tsx +0 -48
- package/src/stories/Configure.mdx +0 -364
- package/src/stories/Header.stories.ts +0 -27
- package/src/stories/Header.tsx +0 -56
- package/src/stories/Page.stories.ts +0 -32
- package/src/stories/Page.tsx +0 -73
- package/src/stories/assets/accessibility.png +0 -0
- package/src/stories/assets/accessibility.svg +0 -5
- package/src/stories/assets/addon-library.png +0 -0
- package/src/stories/assets/assets.png +0 -0
- package/src/stories/assets/avif-test-image.avif +0 -0
- package/src/stories/assets/context.png +0 -0
- package/src/stories/assets/discord.svg +0 -15
- package/src/stories/assets/docs.png +0 -0
- package/src/stories/assets/figma-plugin.png +0 -0
- package/src/stories/assets/github.svg +0 -3
- package/src/stories/assets/share.png +0 -0
- package/src/stories/assets/styling.png +0 -0
- package/src/stories/assets/testing.png +0 -0
- package/src/stories/assets/theming.png +0 -0
- package/src/stories/assets/tutorials.svg +0 -12
- package/src/stories/assets/youtube.svg +0 -4
- package/src/stories/button.css +0 -30
- package/src/stories/header.css +0 -32
- package/src/stories/page.css +0 -69
|
@@ -1,15 +1,71 @@
|
|
|
1
|
-
import React from "react"
|
|
1
|
+
import React, { CSSProperties, useState } from "react"
|
|
2
|
+
import "../../main.css"
|
|
2
3
|
|
|
3
4
|
export interface KSpanProps {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
text: string
|
|
6
|
+
fontSize?: number
|
|
7
|
+
color?: string
|
|
8
|
+
fontWeight?: number
|
|
9
|
+
lineHeight?: string
|
|
10
|
+
fontStyle?: string
|
|
11
|
+
letterSpacing?: string
|
|
12
|
+
hoverText?: string
|
|
13
|
+
hoverTextColor?: string
|
|
14
|
+
hoverStyle?: CSSProperties,
|
|
15
|
+
textDecoration?: string,
|
|
16
|
+
ellipsis?: boolean
|
|
7
17
|
}
|
|
8
18
|
|
|
9
19
|
const KSpan: React.FC<KSpanProps> = (props) => {
|
|
10
|
-
|
|
11
|
-
<span>{props.text}</span>
|
|
12
|
-
);
|
|
13
|
-
};
|
|
20
|
+
const [onHover, setOnHover] = useState(false)
|
|
14
21
|
|
|
15
|
-
|
|
22
|
+
const fontSize = props.fontSize || 14
|
|
23
|
+
const color = props.color || "#737373"
|
|
24
|
+
const fontWeight = props.fontWeight || 400
|
|
25
|
+
const lineHeight = props.lineHeight || "20px"
|
|
26
|
+
const fontStyle = props.fontStyle || "normal"
|
|
27
|
+
const letterSpacing = props.letterSpacing || "-0.084px"
|
|
28
|
+
const hoverTextColor = props.hoverTextColor || "#737373"
|
|
29
|
+
const hoverStyle = props.hoverStyle || {}
|
|
30
|
+
const textDecoration = props.textDecoration || "none"
|
|
31
|
+
const ellipsis = props.ellipsis || false
|
|
32
|
+
|
|
33
|
+
const ellipsisStyle = {overflow:"hidden", textOverflow:"ellipsis", whiteSpace:"nowrap"}
|
|
34
|
+
|
|
35
|
+
const renderBaseSpan = () => {
|
|
36
|
+
const baseSpanStyle = { fontSize, color, fontWeight, lineHeight, fontStyle, letterSpacing, textDecoration, ...(ellipsis && ellipsisStyle) }
|
|
37
|
+
return (
|
|
38
|
+
<span
|
|
39
|
+
className={"k-span"}
|
|
40
|
+
onMouseEnter={() => setOnHover(true)}
|
|
41
|
+
onMouseLeave={() => setOnHover(false)}
|
|
42
|
+
style={onHover ? { ...baseSpanStyle, ...hoverStyle } : { ...baseSpanStyle }}
|
|
43
|
+
>
|
|
44
|
+
{props.text}
|
|
45
|
+
</span>
|
|
46
|
+
)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return props.hoverText ? (
|
|
50
|
+
<div className="grid justify-items-center">
|
|
51
|
+
{renderBaseSpan()}
|
|
52
|
+
{onHover && (
|
|
53
|
+
<span
|
|
54
|
+
className={"k-span"}
|
|
55
|
+
style={{
|
|
56
|
+
fontSize: fontSize - 2,
|
|
57
|
+
color: hoverTextColor,
|
|
58
|
+
fontWeight,
|
|
59
|
+
lineHeight,
|
|
60
|
+
fontStyle,
|
|
61
|
+
letterSpacing
|
|
62
|
+
}}
|
|
63
|
+
>
|
|
64
|
+
{props.hoverText}
|
|
65
|
+
</span>
|
|
66
|
+
)}
|
|
67
|
+
</div>
|
|
68
|
+
) : renderBaseSpan()
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export default KSpan
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { Meta, StoryFn } from "@storybook/react"
|
|
2
|
+
import KTextArea from "./KTextArea"
|
|
3
|
+
// @ts-ignore
|
|
4
|
+
import TracksIcon from "../../assets/tracks.svg"
|
|
5
|
+
import { KeyboardEvent } from "react"
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
title: "ReactComponentLibrary/KTextArea",
|
|
9
|
+
component: KTextArea,
|
|
10
|
+
parameters: {
|
|
11
|
+
layout: "centered"
|
|
12
|
+
}
|
|
13
|
+
} as Meta<typeof KTextArea>
|
|
14
|
+
|
|
15
|
+
const Template: StoryFn<typeof KTextArea> = (args) => <KTextArea {...args} />
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
export const KTextAreaPrimary = Template.bind({})
|
|
19
|
+
KTextAreaPrimary.args = {
|
|
20
|
+
onChange: (value: string) => {
|
|
21
|
+
console.log("value:", value)
|
|
22
|
+
},
|
|
23
|
+
onKeyDown: (event: KeyboardEvent) => {
|
|
24
|
+
if (event.key === "Enter") {
|
|
25
|
+
console.log("Enter is clicked and our value is:", event.currentTarget)
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
rows: 4,
|
|
29
|
+
placeholder: "Placeholder...",
|
|
30
|
+
hoverBackground: "white"
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export const KTextAreaLeftIcon = Template.bind({})
|
|
34
|
+
KTextAreaLeftIcon.args = {
|
|
35
|
+
onChange: (value: string) => {},
|
|
36
|
+
placeholder: "Placeholder...",
|
|
37
|
+
leftIcon: TracksIcon,
|
|
38
|
+
leftIconClick: () => {
|
|
39
|
+
alert("left icon clicked")
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export const KTextAreaRightIcon = Template.bind({})
|
|
44
|
+
KTextAreaRightIcon.args = {
|
|
45
|
+
onChange: (value: string) => {},
|
|
46
|
+
placeholder: "Placeholder...",
|
|
47
|
+
rightIcon: TracksIcon,
|
|
48
|
+
rightIconClick: () => {
|
|
49
|
+
alert("right icon clicked")
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export const KTextAreaLeftRightIcon = Template.bind({})
|
|
54
|
+
KTextAreaLeftRightIcon.args = {
|
|
55
|
+
onChange: (value: string) => {},
|
|
56
|
+
placeholder: "Placeholder...",
|
|
57
|
+
leftIcon: TracksIcon,
|
|
58
|
+
rightIcon: TracksIcon,
|
|
59
|
+
leftIconClick: () => {
|
|
60
|
+
alert("left icon clicked")
|
|
61
|
+
},
|
|
62
|
+
rightIconClick: () => {
|
|
63
|
+
alert("right icon clicked")
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import React, { useEffect, useState, KeyboardEvent } from "react"
|
|
2
|
+
import "../../main.css"
|
|
3
|
+
|
|
4
|
+
export interface KTextAreaProps {
|
|
5
|
+
value: string
|
|
6
|
+
onChange: (value: string) => void
|
|
7
|
+
rows?: number
|
|
8
|
+
onBlur?: (value: string) => void
|
|
9
|
+
onKeyDown?: (event: KeyboardEvent) => void
|
|
10
|
+
width?: number
|
|
11
|
+
height?: number
|
|
12
|
+
leftIcon?: string
|
|
13
|
+
rightIcon?: string
|
|
14
|
+
background?: string
|
|
15
|
+
activeBackground?: string
|
|
16
|
+
borderRadius?: number
|
|
17
|
+
disabled?: boolean
|
|
18
|
+
placeholder?: string
|
|
19
|
+
shadowDisabled?: boolean
|
|
20
|
+
leftIconClick?: () => void
|
|
21
|
+
rightIconClick?: () => void
|
|
22
|
+
accentColor?: string
|
|
23
|
+
hoverBackground?: string
|
|
24
|
+
padding?: string
|
|
25
|
+
gap?: string
|
|
26
|
+
border?: string
|
|
27
|
+
boxShadow?: string
|
|
28
|
+
fontSize?: string
|
|
29
|
+
iconSize?: string
|
|
30
|
+
checked?: boolean
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const KTextArea: React.FC<KTextAreaProps> = (props) => {
|
|
34
|
+
const [background, setBackground] = useState("#F5F5F5")
|
|
35
|
+
const [hover, setHover] = useState(false)
|
|
36
|
+
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
const emptyBackground = props.background || "#F5F5F5"
|
|
39
|
+
const activeBackground = props.activeBackground || "#FFF"
|
|
40
|
+
|
|
41
|
+
const background = props.value ? activeBackground : emptyBackground
|
|
42
|
+
setBackground(background)
|
|
43
|
+
}, [props.value])
|
|
44
|
+
|
|
45
|
+
const width = props.width || "100%"
|
|
46
|
+
const height = props.height || 60
|
|
47
|
+
const borderRadius = props.borderRadius || 10
|
|
48
|
+
const boxShadow = props.shadowDisabled
|
|
49
|
+
? ""
|
|
50
|
+
: props.boxShadow
|
|
51
|
+
? props.boxShadow
|
|
52
|
+
: "0 0 0 1px rgba(17, 17, 17, 0.04), 0 1px 1px 0 rgba(17, 17, 17, 0.04)"
|
|
53
|
+
const accentColor = props.accentColor || ""
|
|
54
|
+
const disabled = props.disabled || false
|
|
55
|
+
const hoverBackground = props.hoverBackground || background
|
|
56
|
+
const padding = props.padding || "8px"
|
|
57
|
+
const gap = props.gap || "12px"
|
|
58
|
+
const border = props.border || "none"
|
|
59
|
+
const fontSize = props.fontSize || "14px"
|
|
60
|
+
const iconSize = props.iconSize || "20px"
|
|
61
|
+
const rows = props.rows || 2
|
|
62
|
+
|
|
63
|
+
return (
|
|
64
|
+
<div
|
|
65
|
+
onMouseEnter={() => setHover(true)}
|
|
66
|
+
onMouseLeave={() => setHover(false)}
|
|
67
|
+
className={"k-input-container"}
|
|
68
|
+
style={{ background: hover ? hoverBackground : background, borderRadius, boxShadow, padding, gap, border }}
|
|
69
|
+
>
|
|
70
|
+
{props.leftIcon && (
|
|
71
|
+
<img
|
|
72
|
+
src={props.leftIcon}
|
|
73
|
+
style={{
|
|
74
|
+
width: iconSize,
|
|
75
|
+
height: iconSize
|
|
76
|
+
}}
|
|
77
|
+
alt={"l-icon"}
|
|
78
|
+
className={props.leftIconClick && "cursor-pointer"}
|
|
79
|
+
onClick={() => {
|
|
80
|
+
if (props.leftIconClick) props.leftIconClick()
|
|
81
|
+
}}
|
|
82
|
+
/>
|
|
83
|
+
)}
|
|
84
|
+
|
|
85
|
+
<textarea
|
|
86
|
+
className={"k-input"}
|
|
87
|
+
style={{
|
|
88
|
+
background: hover ? hoverBackground : background,
|
|
89
|
+
width,
|
|
90
|
+
height,
|
|
91
|
+
accentColor,
|
|
92
|
+
fontSize
|
|
93
|
+
}}
|
|
94
|
+
rows={rows}
|
|
95
|
+
value={props.value}
|
|
96
|
+
placeholder={props.placeholder || ""}
|
|
97
|
+
disabled={disabled}
|
|
98
|
+
onBlur={(event) => {
|
|
99
|
+
console.log("onBulur", event.target.value)
|
|
100
|
+
if (props.onBlur) props.onBlur(event.target.value)
|
|
101
|
+
}}
|
|
102
|
+
onChange={(event) => {
|
|
103
|
+
console.log("OnChange", event.target.value)
|
|
104
|
+
props.onChange(event.target.value)
|
|
105
|
+
}}
|
|
106
|
+
onKeyDown={(event) => {
|
|
107
|
+
console.log("OnKeyDown", event)
|
|
108
|
+
if (props.onKeyDown) props.onKeyDown(event)
|
|
109
|
+
}}
|
|
110
|
+
/>
|
|
111
|
+
|
|
112
|
+
{props.rightIcon && (
|
|
113
|
+
<img
|
|
114
|
+
src={props.rightIcon}
|
|
115
|
+
style={{
|
|
116
|
+
width: iconSize,
|
|
117
|
+
height: iconSize
|
|
118
|
+
}}
|
|
119
|
+
alt={"r-icon"}
|
|
120
|
+
className={props.rightIconClick && "cursor-pointer"}
|
|
121
|
+
onClick={() => {
|
|
122
|
+
if (props.rightIconClick) props.rightIconClick()
|
|
123
|
+
}}
|
|
124
|
+
/>
|
|
125
|
+
)}
|
|
126
|
+
</div>
|
|
127
|
+
)
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export default KTextArea
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {default} from './KTextArea';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import {Meta, StoryFn} from "@storybook/react";
|
|
2
|
+
import KTitleSpan from "./KTitleSpan";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: "ReactComponentLibrary/KTitleSpan",
|
|
6
|
+
component: KTitleSpan,
|
|
7
|
+
parameters: {
|
|
8
|
+
layout: 'centered',
|
|
9
|
+
},
|
|
10
|
+
} as Meta<typeof KTitleSpan>;
|
|
11
|
+
|
|
12
|
+
const Template: StoryFn<typeof KTitleSpan> = (args) => <KTitleSpan {...args} />;
|
|
13
|
+
|
|
14
|
+
export const KTitleSpanPrimary = Template.bind({});
|
|
15
|
+
KTitleSpanPrimary.args = {
|
|
16
|
+
text: "Hello World",
|
|
17
|
+
fontSize: 48,
|
|
18
|
+
color: "#111",
|
|
19
|
+
lineHeight: "56px",
|
|
20
|
+
fontStyle: "normal",
|
|
21
|
+
letterSpacing: "-0.48px",
|
|
22
|
+
bold: false
|
|
23
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import "../../main.css"
|
|
3
|
+
|
|
4
|
+
export interface KTitleSpanProps {
|
|
5
|
+
text: string
|
|
6
|
+
fontSize?: number
|
|
7
|
+
color?: string
|
|
8
|
+
fontWeight?: number
|
|
9
|
+
lineHeight?: string
|
|
10
|
+
fontStyle?: string
|
|
11
|
+
letterSpacing?: string,
|
|
12
|
+
bold?: boolean
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const KTitleSpan: React.FC<KTitleSpanProps> = (props) => {
|
|
16
|
+
const fontSize = props.fontSize || 48
|
|
17
|
+
const color = props.color || "#111111"
|
|
18
|
+
const lineHeight = props.lineHeight || "56px"
|
|
19
|
+
const fontStyle = props.fontStyle || "normal"
|
|
20
|
+
const letterSpacing = props.letterSpacing || "-0.48px"
|
|
21
|
+
const bold = props.bold || false
|
|
22
|
+
const titleClassName = bold ? "k-title-span-bold" : "k-title-span"
|
|
23
|
+
const fontWeight = props.fontWeight ? props.fontWeight : (bold ? 700 : 500)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<span className={`${titleClassName} flex items-center`} style={{fontSize, color, fontWeight, lineHeight, fontStyle, letterSpacing}}>
|
|
28
|
+
{props.text}
|
|
29
|
+
</span>
|
|
30
|
+
);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export default KTitleSpan;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {default} from './KTitleSpan';
|
|
@@ -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
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
import KButton from "./components/KButton"
|
|
2
2
|
import KSpan from "./components/KSpan"
|
|
3
|
+
import KTitleSpan from "./components/KTitleSpan"
|
|
4
|
+
import KLogo from "./components/KLogo"
|
|
5
|
+
import KInput from "./components/KInput"
|
|
6
|
+
import KTextArea from "./components/KTextArea"
|
|
7
|
+
import KDropdown from "./components/KDropdown"
|
|
8
|
+
import KSlider from "./components/KSlider"
|
|
9
|
+
import KSelectDate from "./components/KSelectDate"
|
|
10
|
+
import KTooltip from "./components/KTooltip"
|
|
11
|
+
import KSliderLabel from "./components/KSliderLabel"
|
|
12
|
+
import KCodeInput from "./components/KCodeInput"
|
|
13
|
+
|
|
3
14
|
|
|
4
15
|
export {
|
|
5
|
-
KButton, KSpan
|
|
16
|
+
KButton, KSpan, KLogo, KTitleSpan, KInput, KTextArea, KDropdown, KSlider, KSelectDate, KTooltip, KSliderLabel, KCodeInput
|
|
6
17
|
}
|