kahuna-base-react-components 0.2.18 → 0.2.19
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.d.ts +1 -0
- 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 +1 -0
- package/package.json +1 -1
- package/src/components/KButton/KButton.tsx +3 -2
- package/src/components/KLogo/KLogo.tsx +1 -1
- package/src/components/KSliderLabel/KSliderLabel.stories.tsx +51 -47
- package/src/components/KSliderLabel/KSliderLabel.tsx +5 -2
- package/src/main.css +1 -2
package/dist/types.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -19,6 +19,7 @@ export interface KButtonProps {
|
|
|
19
19
|
hoverBackground?: string
|
|
20
20
|
fontWeight?: number
|
|
21
21
|
textDecoration?: string
|
|
22
|
+
gap?: string
|
|
22
23
|
}
|
|
23
24
|
|
|
24
25
|
const KButton: React.FC<KButtonProps> = (props) => {
|
|
@@ -35,7 +36,7 @@ const KButton: React.FC<KButtonProps> = (props) => {
|
|
|
35
36
|
const hoverBackground = props.hoverBackground || background
|
|
36
37
|
const fontWeight = props.fontWeight || 500
|
|
37
38
|
const textDecoration = props.textDecoration || "none"
|
|
38
|
-
|
|
39
|
+
const gap = props.gap || "0px"
|
|
39
40
|
return (
|
|
40
41
|
<button
|
|
41
42
|
onMouseEnter={() => setHover(true)}
|
|
@@ -45,7 +46,7 @@ const KButton: React.FC<KButtonProps> = (props) => {
|
|
|
45
46
|
onClick={props.onClick}
|
|
46
47
|
style={{ background: hover ? hoverBackground : background, borderRadius, width, height, padding, boxShadow }}
|
|
47
48
|
>
|
|
48
|
-
<div className={"flex"}>
|
|
49
|
+
<div className={"flex items-center"} style={{gap}}>
|
|
49
50
|
{props.leftIcon && <img src={props.leftIcon} alt={"button-left-icon"} />}
|
|
50
51
|
{props.text && (
|
|
51
52
|
<KSpan text={props.text} color={textColor} fontWeight={fontWeight} textDecoration={textDecoration} />
|
|
@@ -35,7 +35,7 @@ export interface KLogoProps {
|
|
|
35
35
|
const KLogo: React.FC<KLogoProps> = (props) => {
|
|
36
36
|
const width = props.width || 88
|
|
37
37
|
const height = props.height || 88
|
|
38
|
-
const borderRadius = props.borderRadius
|
|
38
|
+
const borderRadius = props.borderRadius !== undefined ? props.borderRadius : 10
|
|
39
39
|
const logoColor = props.logoColor || "black"
|
|
40
40
|
|
|
41
41
|
const logoIcon = logoColor === "black" ? Logo : logoColor === "white" ? LogoWhite : LogoGray
|
|
@@ -1,57 +1,61 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
1
|
+
import React, { useEffect, useState } from "react";
|
|
2
|
+
import { Meta, StoryFn } from "@storybook/react";
|
|
3
|
+
import KSliderLabel, { SliderLabelProps, SliderLabelOption } from "./KSliderLabel";
|
|
4
4
|
|
|
5
5
|
export default {
|
|
6
6
|
title: "ReactComponentLibrary/KSliderLabel",
|
|
7
7
|
component: KSliderLabel,
|
|
8
8
|
parameters: {
|
|
9
|
-
layout: "centered"
|
|
10
|
-
}
|
|
11
|
-
} as Meta<typeof KSliderLabel
|
|
9
|
+
layout: "centered",
|
|
10
|
+
},
|
|
11
|
+
} as Meta<typeof KSliderLabel>;
|
|
12
12
|
|
|
13
13
|
const KSliderLabelWrapper: React.FC<SliderLabelProps> = (args) => {
|
|
14
|
-
const [
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
{ value: 4, label: "3 years" },
|
|
20
|
-
{ value: 5, label: "5 years" }
|
|
21
|
-
]
|
|
14
|
+
const [selectedValue, setSelectedValue] = useState<number | undefined>(0);
|
|
15
|
+
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
console.log("selectedValue: ", selectedValue);
|
|
18
|
+
}, [selectedValue]);
|
|
22
19
|
|
|
23
20
|
return (
|
|
24
|
-
<
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
21
|
+
<KSliderLabel
|
|
22
|
+
{...args}
|
|
23
|
+
value={selectedValue}
|
|
24
|
+
onChange={(option) => {
|
|
25
|
+
console.log("option: ", option);
|
|
26
|
+
setSelectedValue(option.value);
|
|
27
|
+
console.log("Value updated to: ", option.value);
|
|
28
|
+
}}
|
|
29
|
+
/>
|
|
30
|
+
);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const Template: StoryFn<typeof KSliderLabelWrapper> = (args) => <KSliderLabelWrapper {...args} />;
|
|
34
|
+
|
|
35
|
+
const options: SliderLabelOption[] = [
|
|
36
|
+
{ label: "Low", value: 0 },
|
|
37
|
+
{ label: "Medium", value: 1 },
|
|
38
|
+
{ label: "Medium", value: 3 },
|
|
39
|
+
{ label: "Medium", value: 4 },
|
|
40
|
+
{ label: "Medium", value: 5 },
|
|
41
|
+
];
|
|
42
|
+
|
|
43
|
+
export const KSliderLabelPrimary = Template.bind({});
|
|
42
44
|
KSliderLabelPrimary.args = {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
45
|
+
options,
|
|
46
|
+
disabled: false,
|
|
47
|
+
width: "440px",
|
|
48
|
+
titleText: "Slider Title",
|
|
49
|
+
valueText: "50",
|
|
50
|
+
fontSize: 14,
|
|
51
|
+
color: "#000",
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export const KSliderLabelHoverText = Template.bind({});
|
|
55
|
+
KSliderLabelHoverText.args = {
|
|
56
|
+
options,
|
|
57
|
+
titleText: "Hover to see me!",
|
|
58
|
+
valueText: "50",
|
|
59
|
+
fontSize: 14,
|
|
60
|
+
color: "#000",
|
|
61
|
+
};
|
|
@@ -67,7 +67,8 @@ const KSliderLabel: React.FC<SliderLabelProps> = (props) => {
|
|
|
67
67
|
ref={titleTextRef}
|
|
68
68
|
className="relative pl-4"
|
|
69
69
|
style={{
|
|
70
|
-
top: titleFits ? "40px" : "0px"
|
|
70
|
+
top: titleFits ? "40px" : "0px",
|
|
71
|
+
transitionDuration: "0.3s"
|
|
71
72
|
}}
|
|
72
73
|
>
|
|
73
74
|
<KSpan
|
|
@@ -83,7 +84,9 @@ const KSliderLabel: React.FC<SliderLabelProps> = (props) => {
|
|
|
83
84
|
ref={valueTextRef}
|
|
84
85
|
className="relative pr-4"
|
|
85
86
|
style={{
|
|
86
|
-
top: valueFits ? "40px" : "0px"
|
|
87
|
+
top: valueFits ? "40px" : "0px",
|
|
88
|
+
transitionDuration: "0.3s"
|
|
89
|
+
|
|
87
90
|
}}
|
|
88
91
|
>
|
|
89
92
|
<KSpan
|
package/src/main.css
CHANGED
|
@@ -224,7 +224,6 @@
|
|
|
224
224
|
}
|
|
225
225
|
|
|
226
226
|
.k-slider-label-input::-webkit-slider-thumb {
|
|
227
|
-
-webkit-appearance: none;
|
|
228
227
|
margin-top: -4px;
|
|
229
228
|
/* Align the thumb vertically with the track */
|
|
230
229
|
/* Width of the thumb */
|
|
@@ -234,8 +233,8 @@
|
|
|
234
233
|
margin-top: 16px ;
|
|
235
234
|
background-position: center;
|
|
236
235
|
position: relative;
|
|
237
|
-
opacity: 0;
|
|
238
236
|
cursor: grab;
|
|
237
|
+
opacity: 0;
|
|
239
238
|
}
|
|
240
239
|
.k-slider-label-input::-webkit-slider-thumb:active {
|
|
241
240
|
cursor: grabbing;
|