kahuna-base-react-components 0.2.2 → 0.2.4

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
@@ -16,6 +16,7 @@ interface KButtonProps {
16
16
  padding?: string;
17
17
  shadowDisabled?: boolean;
18
18
  hoverBackground?: string;
19
+ fontWeight?: number;
19
20
  }
20
21
  declare const KButton: React.FC<KButtonProps>;
21
22
 
@@ -30,6 +31,7 @@ interface KSpanProps {
30
31
  hoverText?: string;
31
32
  hoverTextColor?: string;
32
33
  hoverStyle?: CSSProperties;
34
+ textDecoration?: string;
33
35
  }
34
36
  declare const KSpan: React.FC<KSpanProps>;
35
37
 
@@ -72,6 +74,10 @@ interface KInputProps {
72
74
  rightIconClick?: () => void;
73
75
  accentColor?: string;
74
76
  hoverBackground?: string;
77
+ padding?: string;
78
+ gap?: string;
79
+ border?: string;
80
+ boxShadow?: string;
75
81
  }
76
82
  declare const KInput: React.FC<KInputProps>;
77
83
 
@@ -101,6 +107,9 @@ interface KDropdownProps {
101
107
  textColor?: string;
102
108
  shadowDisabled?: boolean;
103
109
  menuBackground?: string;
110
+ padding?: string;
111
+ gap?: string;
112
+ showChosenOptionIcon?: boolean;
104
113
  }
105
114
  declare const KDropdown: React.FC<KDropdownProps>;
106
115
 
@@ -114,7 +123,6 @@ interface KSliderProps {
114
123
  value?: number;
115
124
  disabled?: boolean;
116
125
  width?: string;
117
- height?: string;
118
126
  }
119
127
  declare const KSlider: React.FC<KSliderProps>;
120
128
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kahuna-base-react-components",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
4
4
  "description": "Kahuna Base React Components",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.esm.js",
package/rollup.config.js CHANGED
@@ -7,7 +7,6 @@ import terser from "@rollup/plugin-terser";
7
7
  import peerDepsExternal from "rollup-plugin-peer-deps-external";
8
8
  import postcss from "rollup-plugin-postcss";
9
9
  import image from '@rollup/plugin-image';
10
- import copy from 'rollup-plugin-copy';
11
10
 
12
11
 
13
12
  const packageJson = require("./package.json");
@@ -36,12 +35,7 @@ export default [
36
35
  terser(),
37
36
  postcss({
38
37
  extensions: [".css"]
39
- }),
40
- copy({
41
- targets: [
42
- { src: 'src/assets/fonts/*', dest: 'dist/fonts' }, // Copy fonts from src/assets/fonts/ to dist/fonts/
43
- ],
44
- }),
38
+ })
45
39
  ],
46
40
  external: ["react", "react-dom"],
47
41
  },
@@ -0,0 +1,37 @@
1
+ <svg width="28" height="28" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <g id="Progress">
3
+ <g id="Rectangle 1" filter="url(#filter0_di_252_33054)">
4
+ <rect x="6" y="6" width="16" height="16" rx="8" fill="white"/>
5
+ <rect x="6.5" y="6.5" width="15" height="15" rx="7.5" stroke="white"/>
6
+ </g>
7
+ <g id="Dot" filter="url(#filter1_d_252_33054)">
8
+ <path 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="#B5B5B5"/>
9
+ </g>
10
+ </g>
11
+ <defs>
12
+ <filter id="filter0_di_252_33054" x="0" y="0" width="28" height="28" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
13
+ <feFlood flood-opacity="0" result="BackgroundImageFix"/>
14
+ <feColorMatrix 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"/>
15
+ <feOffset/>
16
+ <feGaussianBlur stdDeviation="3"/>
17
+ <feColorMatrix 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"/>
18
+ <feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_252_33054"/>
19
+ <feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_252_33054" result="shape"/>
20
+ <feColorMatrix 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"/>
21
+ <feOffset dy="-3"/>
22
+ <feGaussianBlur stdDeviation="1.5"/>
23
+ <feComposite in2="hardAlpha" operator="arithmetic" k2="-1" k3="1"/>
24
+ <feColorMatrix 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"/>
25
+ <feBlend mode="normal" in2="shape" result="effect2_innerShadow_252_33054"/>
26
+ </filter>
27
+ <filter id="filter1_d_252_33054" x="7" y="9" width="14" height="14" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
28
+ <feFlood flood-opacity="0" result="BackgroundImageFix"/>
29
+ <feColorMatrix 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"/>
30
+ <feOffset dy="2"/>
31
+ <feGaussianBlur stdDeviation="2"/>
32
+ <feColorMatrix 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"/>
33
+ <feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_252_33054"/>
34
+ <feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_252_33054" result="shape"/>
35
+ </filter>
36
+ </defs>
37
+ </svg>
@@ -0,0 +1,3 @@
1
+ <svg width="5" height="4" viewBox="0 0 5 4" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <circle id="Ellipse 4" cx="2.59961" cy="2" r="2" fill="#B5B5B5"/>
3
+ </svg>
@@ -17,6 +17,7 @@ export interface KButtonProps {
17
17
  padding?: string
18
18
  shadowDisabled?: boolean
19
19
  hoverBackground?: string
20
+ fontWeight?: number
20
21
  }
21
22
 
22
23
  const KButton: React.FC<KButtonProps> = (props) => {
@@ -31,7 +32,8 @@ const KButton: React.FC<KButtonProps> = (props) => {
31
32
  const padding = props.padding || "12px 16px"
32
33
  const boxShadow = props.shadowDisabled ? "" : "0 0 0 1px rgba(17, 17, 17, 0.04), 0 1px 1px 0 rgba(17, 17, 17, 0.04)"
33
34
  const hoverBackground = props.hoverBackground || background
34
-
35
+ const fontWeight = props.fontWeight || 500
36
+
35
37
  return (
36
38
  <button
37
39
  onMouseEnter={() => setHover(true)}
@@ -43,7 +45,7 @@ const KButton: React.FC<KButtonProps> = (props) => {
43
45
  >
44
46
  <div className={"flex"}>
45
47
  {props.leftIcon && <img src={props.leftIcon} alt={"button-left-icon"} />}
46
- {props.text && <KSpan text={props.text} color={textColor} />}
48
+ {props.text && <KSpan text={props.text} color={textColor} fontWeight={fontWeight} />}
47
49
  {props.icon && <img src={props.icon} alt={"button-icon"} />}
48
50
  {props.rightIcon && <img src={props.rightIcon} alt={"button-right-icon"} />}
49
51
  </div>
@@ -32,6 +32,9 @@ export interface KDropdownProps {
32
32
  textColor?: string
33
33
  shadowDisabled?: boolean
34
34
  menuBackground?: string
35
+ padding?:string
36
+ gap?: string
37
+ showChosenOptionIcon?: boolean
35
38
  }
36
39
 
37
40
  const KDropdown: React.FC<KDropdownProps> = (props) => {
@@ -53,6 +56,9 @@ const KDropdown: React.FC<KDropdownProps> = (props) => {
53
56
  const textColor = props.textColor || "#111"
54
57
  const boxShadow = props.shadowDisabled ? "" : "0 0 0 1px rgba(17, 17, 17, 0.04), 0 1px 1px 0 rgba(17, 17, 17, 0.04)"
55
58
  const menuBackground = props.menuBackground || "rgb(249, 249, 249)";
59
+ const padding = props.padding || "8px"
60
+ const gap = props.gap || "4px"
61
+ const showIcon = props.showChosenOptionIcon || true
56
62
 
57
63
  const getOptionLabels = (option: KSelectOption) => {
58
64
  return (
@@ -70,8 +76,11 @@ const KDropdown: React.FC<KDropdownProps> = (props) => {
70
76
  }
71
77
 
72
78
  return (
73
- <div className={"k-dropdown-container"} style={{ background, borderRadius, width, height, boxShadow }}>
74
- {props.leftIcon && <img src={props.leftIcon} width={24} className={"ml-2"} alt={"l-icon"} />}
79
+ <div
80
+ className={"k-dropdown-container"}
81
+ style={{ background, borderRadius, width, height, boxShadow, padding, gap }}
82
+ >
83
+ {props.leftIcon && <img src={props.leftIcon} width={20} alt={"l-icon"} />}
75
84
 
76
85
  <Select
77
86
  defaultValue={props.defaultValue}
@@ -84,16 +93,20 @@ const KDropdown: React.FC<KDropdownProps> = (props) => {
84
93
  control: (baseStyles, state) => ({
85
94
  ...baseStyles,
86
95
  background: "transparent !important",
87
- border: 0,
96
+ padding: "0px !important",
88
97
  boxShadow: "none",
89
- fontSize: 16,
90
- cursor: "pointer"
98
+ fontSize: 14,
99
+ lineHeight: "20px",
100
+ cursor: "pointer",
101
+ minHeight: "20px",
102
+ border: "none"
91
103
  }),
92
104
  menu: (base) => ({
93
105
  ...base,
94
106
  borderRadius: 10,
95
107
  background: menuBackground,
96
- boxShadow: "0px 3px 3px 0px rgba(17, 17, 17, 0.03), 0px 1px 1px 0px rgba(17, 17, 17, 0.04), 0px 0px 0px 1px rgba(17, 17, 17, 0.04)",
108
+ boxShadow:
109
+ "0px 3px 3px 0px rgba(17, 17, 17, 0.03), 0px 1px 1px 0px rgba(17, 17, 17, 0.04), 0px 0px 0px 1px rgba(17, 17, 17, 0.04)",
97
110
  backdropFilter: "blur(2px)",
98
111
  paddingRight: 3,
99
112
  paddingLeft: 3
@@ -116,14 +129,29 @@ const KDropdown: React.FC<KDropdownProps> = (props) => {
116
129
  marginTop: 4,
117
130
  borderRadius: 10,
118
131
  color: "#111"
132
+ }),
133
+ valueContainer: (base) => ({
134
+ ...base,
135
+ padding: 0
136
+ }),
137
+
138
+ input: (base) => ({
139
+ ...base,
140
+ padding: 0,
141
+ margin: 0,
142
+ height: "20px"
143
+ }),
144
+ placeholder: (base) => ({
145
+ ...base,
146
+ margin: 0
119
147
  })
120
148
  }}
121
149
  components={{
122
150
  IndicatorSeparator: () => null,
123
151
  DropdownIndicator: () => null,
124
152
  SingleValue: ({ data, ...props }) => (
125
- <div className="flex ml-3" style={{ position: "absolute" }}>
126
- {data.icon && <img src={data.icon} className="mr-2" width={20} alt={"data-icon"} />}
153
+ <div className="flex" style={{ position: "absolute" }}>
154
+ {data.icon && showIcon && <img src={data.icon} className="mr-2" width={20} alt={"data-icon"} />}
127
155
  <KSpan text={data.label} color="#111" />
128
156
  </div>
129
157
  )
@@ -139,7 +167,7 @@ const KDropdown: React.FC<KDropdownProps> = (props) => {
139
167
  getOptionLabel={(option: KSelectOption) => getOptionLabels(option)}
140
168
  />
141
169
 
142
- {props.rightIcon && <img src={props.rightIcon} width={24} className={"mr-2"} alt={"r-icon"} />}
170
+ {props.rightIcon && <img src={props.rightIcon} width={20} alt={"r-icon"} />}
143
171
  </div>
144
172
  )
145
173
  }
@@ -20,6 +20,10 @@ export interface KInputProps {
20
20
  rightIconClick?: () => void
21
21
  accentColor?: string
22
22
  hoverBackground?: string
23
+ padding?: string
24
+ gap?: string
25
+ border?: string
26
+ boxShadow?: string
23
27
  }
24
28
 
25
29
  const KInput: React.FC<KInputProps> = (props) => {
@@ -37,18 +41,21 @@ const KInput: React.FC<KInputProps> = (props) => {
37
41
  const width = props.width || "100%"
38
42
  const height = props.height || 24
39
43
  const borderRadius = props.borderRadius || 10
40
- const boxShadow = props.shadowDisabled ? "" : "0 0 0 1px rgba(17, 17, 17, 0.04), 0 1px 1px 0 rgba(17, 17, 17, 0.04)"
44
+ const boxShadow = props.shadowDisabled ? "" : props.boxShadow ? props.boxShadow : "0 0 0 1px rgba(17, 17, 17, 0.04), 0 1px 1px 0 rgba(17, 17, 17, 0.04)"
41
45
  const type = props.type || "text"
42
46
  const accentColor = props.accentColor || ""
43
47
  const disabled = props.disabled || false
44
48
  const hoverBackground = props.hoverBackground || background
49
+ const padding = props.padding || "12px 12px 12px 14px"
50
+ const gap = props.gap || "8px"
51
+ const border = props.border || "none"
45
52
 
46
53
  return (
47
54
  <div
48
55
  onMouseEnter={() => setHover(true)}
49
56
  onMouseLeave={() => setHover(false)}
50
57
  className={"k-input-container"}
51
- style={{ background: hover ? hoverBackground : background, borderRadius, boxShadow }}
58
+ style={{ background: hover ? hoverBackground : background, borderRadius, boxShadow, padding, gap, border }}
52
59
  >
53
60
  {props.leftIcon && (
54
61
  <img
@@ -1,5 +1,7 @@
1
- import React from "react";
1
+ import React from "react"
2
2
  import "../../main.css"
3
+ // @ts-ignore
4
+ import StepIcon from "../../assets/slider-step.svg"
3
5
 
4
6
  export interface SliderOption {
5
7
  label: string
@@ -12,29 +14,54 @@ export interface KSliderProps {
12
14
  value?: number
13
15
  disabled?: boolean
14
16
  width?: string
15
- height?: string
16
17
  }
17
18
 
18
19
  const KSlider: React.FC<KSliderProps> = (props) => {
19
20
  const disabled = props.disabled || false
20
21
  const width = props.width || "100%"
21
- const height = props.height || "14px"
22
+ const height = "8px"
23
+
24
+ const calculateSpanWidth = ():number => {
25
+ const min = props.options[0].value
26
+ const max = props.options[props.options.length - 1].value
27
+ const spanWidth = (props.value! - min) / (max - min) * 100
28
+ if (spanWidth >= 100 ) {
29
+ return 99
30
+ }
31
+ return spanWidth
32
+ }
22
33
 
23
34
  return (
24
- <input
25
- disabled={disabled}
26
- style={{width, height}}
27
- className={"k-slider-input"}
28
- onChange={(e) => {
29
- const option = props.options.find((option) => option.value.toString() === e.target.value)
30
- if (option) return props.onChange(option)
31
- }}
32
- value={props.value}
33
- type="range"
34
- min={props.options[0].value}
35
- max={props.options[props.options.length - 1].value}
36
- />
37
- );
35
+ <div className="inline-block bg-[#E7E7E7] rounded-full relative z-0" style={{ width, height }}>
36
+ <span className="w-full flex justify-between absolute top-0 z-0 items-center px-0.5" style={{ height }}>
37
+ {props.options.map((option, index) => {
38
+ return <img key={`step-icon-${index}`} src={StepIcon} className="w-1 h-1 !z-0 " />
39
+ })}
40
+ </span>
41
+ <span
42
+ className="block z-50 absolute top-0"
43
+ style={{
44
+ height,
45
+ width: `${calculateSpanWidth()}%`,
46
+ borderRadius: "10px",
47
+ backgroundColor: "black"
48
+ }}
49
+ />
50
+ <input
51
+ disabled={disabled}
52
+ style={{ width, height }}
53
+ className={"k-slider-input absolute top-0 !z-50"}
54
+ onChange={(e) => {
55
+ const option = props.options.find((option) => option.value.toString() === e.target.value)
56
+ if (option) return props.onChange(option)
57
+ }}
58
+ value={props.value}
59
+ type="range"
60
+ min={props.options[0].value}
61
+ max={props.options[props.options.length - 1].value}
62
+ />
63
+ </div>
64
+ )
38
65
  };
39
66
 
40
67
  export default KSlider;
@@ -11,7 +11,8 @@ export interface KSpanProps {
11
11
  letterSpacing?: string
12
12
  hoverText?: string
13
13
  hoverTextColor?: string
14
- hoverStyle?: CSSProperties
14
+ hoverStyle?: CSSProperties,
15
+ textDecoration?: string
15
16
  }
16
17
 
17
18
  const KSpan: React.FC<KSpanProps> = (props) => {
package/src/main.css CHANGED
@@ -35,9 +35,7 @@
35
35
 
36
36
  .k-input-container {
37
37
  display: flex;
38
- padding: 8px;
39
38
  align-items: center;
40
- gap: 12px;
41
39
  align-self: stretch;
42
40
  }
43
41
 
@@ -46,7 +44,7 @@
46
44
  font-feature-settings: 'ss11' on, 'cv09' on, 'liga' off, 'calt' off;
47
45
  /* Paragraph/Small */
48
46
  font-family: Inter;
49
- font-size: 16px;
47
+ font-size: 14px;
50
48
  font-style: normal;
51
49
  font-weight: 400;
52
50
  line-height: 20px; /* 142.857% */
@@ -72,6 +70,7 @@
72
70
 
73
71
  .k-dropdown-container {
74
72
  display: flex;
73
+ align-items: center;
75
74
  }
76
75
 
77
76
  .k-dropdown {
@@ -90,24 +89,23 @@
90
89
  cursor: pointer;
91
90
  outline: none;
92
91
  border-radius: 16px;
93
- overflow: hidden;
92
+ background: transparent;
93
+ overflow: visible;
94
94
  }
95
95
 
96
96
  .k-slider-input::-webkit-slider-runnable-track {
97
- height: 14px;
98
- background: #E7E7E7;
97
+ height: 8px;
99
98
  border-radius: 20px;
100
99
  }
101
100
 
102
101
  .k-slider-input::-webkit-slider-thumb {
103
102
  -webkit-appearance: none;
104
103
  cursor: pointer;
105
- margin-top: -2px; /* Align the thumb vertically with the track */
106
- width: 18px; /* Width of the thumb */
107
- height: 18px; /* Height of the thumb */
104
+ margin-top: -4px; /* Align the thumb vertically with the track */
105
+ width: 16px; /* Width of the thumb */
106
+ height: 16px; /* Height of the thumb */
108
107
  border-radius: 50px;
109
- box-shadow: -407px 0 0 400px #111111, 0 0 1px 1px rgba(228, 229, 231, 1), 0 1px 3px 0 rgba(228, 229, 231, 0.40);
110
- background-color: white !important;
111
- background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12" fill="none"><g id="dots, grid, slide"><path id="Vector" fill-rule="evenodd" clip-rule="evenodd" d="M4 5C4.55228 5 5 4.55228 5 4C5 3.44772 4.55228 3 4 3C3.44772 3 3 3.44772 3 4C3 4.55228 3.44772 5 4 5ZM4 9C4.55228 9 5 8.55229 5 8C5 7.44772 4.55228 7 4 7C3.44772 7 3 7.44772 3 8C3 8.55229 3.44772 9 4 9ZM9 8C9 8.55229 8.55229 9 8 9C7.44772 9 7 8.55229 7 8C7 7.44772 7.44772 7 8 7C8.55229 7 9 7.44772 9 8ZM8 5C8.55229 5 9 4.55228 9 4C9 3.44772 8.55229 3 8 3C7.44772 3 7 3.44772 7 4C7 4.55228 7.44772 5 8 5Z" fill="%23111111"/></g></svg>');
112
- background-size: cover;
108
+ background: url('./assets/progress.svg');
109
+ background-size: auto;
110
+ background-position: center;
113
111
  }