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/types.d.ts CHANGED
@@ -18,6 +18,7 @@ interface KButtonProps {
18
18
  hoverBackground?: string;
19
19
  fontWeight?: number;
20
20
  textDecoration?: string;
21
+ gap?: string;
21
22
  }
22
23
  declare const KButton: React.FC<KButtonProps>;
23
24
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kahuna-base-react-components",
3
- "version": "0.2.18",
3
+ "version": "0.2.19",
4
4
  "description": "Kahuna Base React Components",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.esm.js",
@@ -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 || 10
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 { Meta, StoryFn } from "@storybook/react"
2
- import KSliderLabel, { SliderLabelOption, SliderLabelProps } from "./KSliderLabel"
3
- import { useState } from "react"
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 [lengthOfContract, setLengthOfContract] = useState<number>(args.value || 1)
15
- const lengthOfContractOptions: SliderLabelOption[] = [
16
- { value: 1, label: "6 months" },
17
- { value: 2, label: "1 year" },
18
- { value: 3, label: "2 years" },
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
- <div className="w-[616px]">
25
- <KSliderLabel
26
- options={lengthOfContractOptions}
27
- value={lengthOfContract}
28
- onChange={(sliderOption: SliderLabelOption) => {
29
- console.log("DENEME")
30
- setLengthOfContract(sliderOption.value)
31
- }}
32
- titleText={"Contract Duration"}
33
- valueText={lengthOfContractOptions.find((option) => option.value === lengthOfContract)?.label || ""}
34
- />
35
- </div>
36
- )
37
- }
38
-
39
- const Template: StoryFn<typeof KSliderLabelWrapper> = (args) => <KSliderLabelWrapper {...args} />
40
-
41
- export const KSliderLabelPrimary = Template.bind({})
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
- value: 1,
44
- options: [
45
- { value: 1, label: "6 months" },
46
- { value: 2, label: "1 year" },
47
- { value: 3, label: "2 years" },
48
- { value: 4, label: "3 years" },
49
- { value: 5, label: "5 years" }
50
- ],
51
- titleText: "Contract Duration",
52
- onChange: (option: SliderLabelOption) => {
53
- // Do
54
- console.log("0")
55
- },
56
- fontSize: 10
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;