kahuna-base-react-components 0.1.8

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.
Files changed (57) hide show
  1. package/.storybook/main.ts +19 -0
  2. package/.storybook/preview.ts +15 -0
  3. package/README.md +23 -0
  4. package/babel.config.js +7 -0
  5. package/dist/components/KButton/KButton.d.ts +19 -0
  6. package/dist/components/KButton/index.d.ts +1 -0
  7. package/dist/components/KDropdown/KDropdown.d.ts +30 -0
  8. package/dist/components/KDropdown/index.d.ts +1 -0
  9. package/dist/components/KInput/KInput.d.ts +21 -0
  10. package/dist/components/KInput/index.d.ts +1 -0
  11. package/dist/components/KLogo/KLogo.d.ts +11 -0
  12. package/dist/components/KLogo/index.d.ts +1 -0
  13. package/dist/components/KSlider/KSlider.d.ts +16 -0
  14. package/dist/components/KSlider/index.d.ts +1 -0
  15. package/dist/components/KSpan/KSpan.d.ts +13 -0
  16. package/dist/components/KSpan/index.d.ts +1 -0
  17. package/dist/components/KTitleSpan/KTitleSpan.d.ts +13 -0
  18. package/dist/components/KTitleSpan/index.d.ts +1 -0
  19. package/dist/index.d.ts +8 -0
  20. package/dist/index.esm.js +10 -0
  21. package/dist/index.esm.js.map +1 -0
  22. package/dist/index.js +10 -0
  23. package/dist/index.js.map +1 -0
  24. package/dist/types.d.ts +112 -0
  25. package/package.json +68 -0
  26. package/postcss.config.js +6 -0
  27. package/rollup.config.js +48 -0
  28. package/src/assets/chevron-left.svg +7 -0
  29. package/src/assets/chevron-right.svg +7 -0
  30. package/src/assets/logo.svg +14 -0
  31. package/src/assets/slider-dots.svg +7 -0
  32. package/src/assets/tracks.svg +5 -0
  33. package/src/components/KButton/KButton.stories.tsx +78 -0
  34. package/src/components/KButton/KButton.tsx +44 -0
  35. package/src/components/KButton/index.ts +1 -0
  36. package/src/components/KDropdown/KDropdown.stories.tsx +62 -0
  37. package/src/components/KDropdown/KDropdown.tsx +93 -0
  38. package/src/components/KDropdown/index.ts +1 -0
  39. package/src/components/KInput/KInput.stories.tsx +54 -0
  40. package/src/components/KInput/KInput.tsx +67 -0
  41. package/src/components/KInput/index.ts +1 -0
  42. package/src/components/KLogo/KLogo.stories.tsx +36 -0
  43. package/src/components/KLogo/KLogo.tsx +31 -0
  44. package/src/components/KLogo/index.ts +1 -0
  45. package/src/components/KSlider/KSlider.stories.tsx +18 -0
  46. package/src/components/KSlider/KSlider.tsx +40 -0
  47. package/src/components/KSlider/index.ts +1 -0
  48. package/src/components/KSpan/KSpan.stories.tsx +23 -0
  49. package/src/components/KSpan/KSpan.tsx +29 -0
  50. package/src/components/KSpan/index.ts +1 -0
  51. package/src/components/KTitleSpan/KTitleSpan.stories.tsx +23 -0
  52. package/src/components/KTitleSpan/KTitleSpan.tsx +29 -0
  53. package/src/components/KTitleSpan/index.ts +1 -0
  54. package/src/index.ts +11 -0
  55. package/src/main.css +93 -0
  56. package/tailwind.config.js +9 -0
  57. package/tsconfig.json +25 -0
@@ -0,0 +1,67 @@
1
+ import React, {useEffect, useState} from "react";
2
+ import "../../main.css"
3
+
4
+ export interface KInputProps {
5
+ value: string
6
+ onChange: (value: string) => void
7
+ width?: number
8
+ height?: number
9
+ leftIcon?: string
10
+ rightIcon?: string
11
+ background?: string
12
+ activeBackground?: string
13
+ borderRadius?: number
14
+ placeholder?: string
15
+ shadowDisabled?: boolean
16
+ type?: string
17
+ leftIconClick?: () => void
18
+ rightIconClick?: () => void
19
+ accentColor?: string
20
+ }
21
+
22
+ const KInput: React.FC<KInputProps> = (props) => {
23
+ const [background, setBackground] = useState("#F5F5F5")
24
+
25
+ useEffect(() => {
26
+ const emptyBackground = props.background || "#F5F5F5"
27
+ const activeBackground = props.activeBackground || "#FFF"
28
+
29
+ const background = props.value ? activeBackground : emptyBackground
30
+ setBackground(background)
31
+ }, [props.value])
32
+
33
+ const width = props.width || "100%"
34
+ const height = props.height || 24
35
+ const borderRadius = props.borderRadius || 10
36
+ const boxShadow = props.shadowDisabled ? "" : "0 0 0 1px rgba(17, 17, 17, 0.04), 0 1px 1px 0 rgba(17, 17, 17, 0.04)"
37
+ const type = props.type || "text"
38
+ const accentColor = props.accentColor || ""
39
+
40
+ return (
41
+ <div className={"k-input-container"} style={{background, borderRadius, boxShadow}}>
42
+ {props.leftIcon && (
43
+ <img src={props.leftIcon} alt={"l-icon"} className={props.leftIconClick && "cursor-pointer"} onClick={() => {
44
+ if (props.leftIconClick) props.leftIconClick()
45
+ }}/>
46
+ )}
47
+
48
+ <input
49
+ type={type}
50
+ className={"k-input"}
51
+ style={{background, width, height, accentColor}}
52
+ value={props.value}
53
+ placeholder={props.placeholder || ""}
54
+ onChange={(event) => {
55
+ props.onChange(event.target.value)
56
+ }}/>
57
+
58
+ {props.rightIcon && (
59
+ <img src={props.rightIcon} alt={"r-icon"} className={props.rightIconClick && "cursor-pointer"} onClick={() => {
60
+ if (props.rightIconClick) props.rightIconClick()
61
+ }}/>
62
+ )}
63
+ </div>
64
+ );
65
+ };
66
+
67
+ export default KInput;
@@ -0,0 +1 @@
1
+ export {default} from './KInput';
@@ -0,0 +1,36 @@
1
+ import {Meta, StoryFn} from "@storybook/react";
2
+ import KLogo from "./KLogo";
3
+
4
+ export default {
5
+ title: "ReactComponentLibrary/KLogo",
6
+ component: KLogo,
7
+ parameters: {
8
+ layout: 'centered',
9
+ },
10
+ } as Meta<typeof KLogo>;
11
+
12
+ const Template: StoryFn<typeof KLogo> = (args) => <KLogo {...args} />;
13
+
14
+ export const KLogoPrimary = Template.bind({});
15
+ KLogoPrimary.args = {
16
+ width: 88,
17
+ height: 88,
18
+ borderRadius: 10,
19
+ };
20
+
21
+ export const KLogoPrimaryText = Template.bind({});
22
+ KLogoPrimaryText.args = {
23
+ width: 88,
24
+ height: 88,
25
+ borderRadius: 10,
26
+ primaryText: "Kahuna"
27
+ };
28
+
29
+ export const KLogoAllText = Template.bind({});
30
+ KLogoAllText.args = {
31
+ width: 88,
32
+ height: 88,
33
+ borderRadius: 10,
34
+ primaryText: "Kahuna",
35
+ secondaryText: "for artists"
36
+ };
@@ -0,0 +1,31 @@
1
+ import React from "react";
2
+ import "../../main.css"
3
+ // @ts-ignore
4
+ import Logo from "../../assets/logo.svg"
5
+ import KTitleSpan from "../KTitleSpan";
6
+ import KSpan from "../KSpan";
7
+
8
+ export interface KLogoProps {
9
+ width?: number
10
+ height?: number
11
+ borderRadius?: number
12
+ primaryText?: string
13
+ secondaryText?: string
14
+ }
15
+
16
+ const KLogo: React.FC<KLogoProps> = (props) => {
17
+ const width = props.width || 88
18
+ const height = props.height || 88
19
+ const borderRadius = props.borderRadius || 10
20
+ return (
21
+ <div className={"flex items-center"}>
22
+ <img src={Logo} alt={"kahuna-logo"} style={{borderRadius, width, height}}/>
23
+ {props.primaryText && <div className={"ml-2 mr-2"}><KTitleSpan fontSize={20} text={props.primaryText}/></div>}
24
+ {props.secondaryText && <div className={"pl-2"} style={{borderLeft: "1px solid #E7E7E7"}}>
25
+ <KSpan fontSize={14} text={props.secondaryText}/>
26
+ </div>}
27
+ </div>
28
+ );
29
+ };
30
+
31
+ export default KLogo;
@@ -0,0 +1 @@
1
+ export {default} from './KLogo';
@@ -0,0 +1,18 @@
1
+ import {Meta, StoryFn} from "@storybook/react";
2
+ import KSlider, {SliderOption} from "./KSlider";
3
+
4
+ export default {
5
+ title: "ReactComponentLibrary/KSlider",
6
+ component: KSlider,
7
+ } as Meta<typeof KSlider>;
8
+
9
+ const Template: StoryFn<typeof KSlider> = (args) => <KSlider {...args} />;
10
+
11
+ export const KSliderPrimary = Template.bind({});
12
+ KSliderPrimary.args = {
13
+ options: [{label: "0%", value: 0}, {label: "25%", value: 1}, {label: "50%", value: 2}, {label: "75%", value: 3}],
14
+ onChange: (option: SliderOption) => {
15
+ // Do Nothing
16
+ },
17
+ width: "200px"
18
+ };
@@ -0,0 +1,40 @@
1
+ import React from "react";
2
+ import "../../main.css"
3
+
4
+ export interface SliderOption {
5
+ label: string
6
+ value: number
7
+ }
8
+
9
+ export interface KSliderProps {
10
+ options: SliderOption[]
11
+ onChange: (option: SliderOption) => void
12
+ value?: number
13
+ disabled?: boolean
14
+ width?: string
15
+ height?: string
16
+ }
17
+
18
+ const KSlider: React.FC<KSliderProps> = (props) => {
19
+ const disabled = props.disabled || false
20
+ const width = props.width || "100%"
21
+ const height = props.height || "14px"
22
+
23
+ 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
+ );
38
+ };
39
+
40
+ export default KSlider;
@@ -0,0 +1 @@
1
+ export {default} from './KSlider';
@@ -0,0 +1,23 @@
1
+ import {Meta, StoryFn} from "@storybook/react";
2
+ import KSpan from "./KSpan";
3
+
4
+ export default {
5
+ title: "ReactComponentLibrary/KSpan",
6
+ component: KSpan,
7
+ parameters: {
8
+ layout: 'centered',
9
+ },
10
+ } as Meta<typeof KSpan>;
11
+
12
+ const Template: StoryFn<typeof KSpan> = (args) => <KSpan {...args} />;
13
+
14
+ export const KSpanPrimary = Template.bind({});
15
+ KSpanPrimary.args = {
16
+ text: "Hello World",
17
+ fontSize: 14,
18
+ color: "#737373",
19
+ fontWeight: 400,
20
+ lineHeight: "20px",
21
+ fontStyle: "normal",
22
+ letterSpacing: "-0.084px"
23
+ };
@@ -0,0 +1,29 @@
1
+ import React from "react";
2
+ import "../../main.css"
3
+
4
+ export interface KSpanProps {
5
+ text: string
6
+ fontSize?: number
7
+ color?: string
8
+ fontWeight?: number
9
+ lineHeight?: string
10
+ fontStyle?: string
11
+ letterSpacing?: string
12
+ }
13
+
14
+ const KSpan: React.FC<KSpanProps> = (props) => {
15
+ const fontSize = props.fontSize || 14
16
+ const color = props.color || "#737373"
17
+ const fontWeight = props.fontWeight || 400
18
+ const lineHeight = props.lineHeight || "20px"
19
+ const fontStyle = props.fontStyle || "normal"
20
+ const letterSpacing = props.letterSpacing || "-0.084px"
21
+
22
+ return (
23
+ <span className={"k-span"} style={{fontSize, color, fontWeight, lineHeight, fontStyle, letterSpacing}}>
24
+ {props.text}
25
+ </span>
26
+ );
27
+ };
28
+
29
+ export default KSpan;
@@ -0,0 +1 @@
1
+ export {default} from './KSpan';
@@ -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
+ fontWeight: 700,
20
+ lineHeight: "56px",
21
+ fontStyle: "normal",
22
+ letterSpacing: "-0.48px"
23
+ };
@@ -0,0 +1,29 @@
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
+ }
13
+
14
+ const KTitleSpan: React.FC<KTitleSpanProps> = (props) => {
15
+ const fontSize = props.fontSize || 48
16
+ const color = props.color || "#111111"
17
+ const fontWeight = props.fontWeight || 700
18
+ const lineHeight = props.lineHeight || "56px"
19
+ const fontStyle = props.fontStyle || "normal"
20
+ const letterSpacing = props.letterSpacing || "-0.48px"
21
+
22
+ return (
23
+ <span className={"k-title-span"} style={{fontSize, color, fontWeight, lineHeight, fontStyle, letterSpacing}}>
24
+ {props.text}
25
+ </span>
26
+ );
27
+ };
28
+
29
+ export default KTitleSpan;
@@ -0,0 +1 @@
1
+ export {default} from './KTitleSpan';
package/src/index.ts ADDED
@@ -0,0 +1,11 @@
1
+ import KButton from "./components/KButton"
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 KDropdown from "./components/KDropdown"
7
+ import KSlider from "./components/KSlider"
8
+
9
+ export {
10
+ KButton, KSpan, KLogo, KTitleSpan, KInput, KDropdown, KSlider
11
+ }
package/src/main.css ADDED
@@ -0,0 +1,93 @@
1
+ @tailwind base;
2
+ @tailwind components;
3
+ @tailwind utilities;
4
+
5
+
6
+ .k-title-span {
7
+ font-feature-settings: 'ss11' on, 'cv09' on, 'liga' off, 'calt' off;
8
+ font-family: "Aeonik Pro";
9
+ }
10
+
11
+ .k-span {
12
+ font-feature-settings: 'ss11' on, 'cv09' on, 'liga' off, 'calt' off;
13
+ font-family: "Inter";
14
+ }
15
+
16
+ .k-input-container {
17
+ display: flex;
18
+ padding: 8px;
19
+ align-items: center;
20
+ gap: 12px;
21
+ align-self: stretch;
22
+ }
23
+
24
+ .k-input {
25
+ color: #111;
26
+ font-feature-settings: 'ss11' on, 'cv09' on, 'liga' off, 'calt' off;
27
+ /* Paragraph/Small */
28
+ font-family: Inter;
29
+ font-size: 16px;
30
+ font-style: normal;
31
+ font-weight: 400;
32
+ line-height: 20px; /* 142.857% */
33
+ letter-spacing: -0.084px;
34
+ }
35
+
36
+ .k-input::placeholder {
37
+ color: #737373;
38
+ }
39
+
40
+ .k-input:focus {
41
+ outline: none !important;
42
+ }
43
+
44
+ .k-button {
45
+ display: flex;
46
+ justify-content: center;
47
+ align-items: center;
48
+ gap: 4px;
49
+ align-self: stretch;
50
+ }
51
+
52
+
53
+ .k-dropdown-container {
54
+ display: flex;
55
+ }
56
+
57
+ .k-dropdown {
58
+ width: 100%;
59
+ font-family: Inter;
60
+ }
61
+
62
+ .k-dropdown:focus {
63
+ outline: none !important;
64
+ }
65
+
66
+ .k-slider-input {
67
+ -webkit-appearance: none;
68
+ appearance: none;
69
+ width: 100%;
70
+ cursor: pointer;
71
+ outline: none;
72
+ border-radius: 16px;
73
+ overflow: hidden;
74
+ }
75
+
76
+ .k-slider-input::-webkit-slider-runnable-track {
77
+ height: 14px;
78
+ background: #E7E7E7;
79
+ border-radius: 20px;
80
+ }
81
+
82
+ .k-slider-input::-webkit-slider-thumb {
83
+ -webkit-appearance: none;
84
+ cursor: pointer;
85
+ margin-top: -2px; /* Align the thumb vertically with the track */
86
+ width: 18px; /* Width of the thumb */
87
+ height: 18px; /* Height of the thumb */
88
+ border-radius: 50px;
89
+ 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);
90
+ background-color: white !important;
91
+ 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>');
92
+ background-size: cover;
93
+ }
@@ -0,0 +1,9 @@
1
+ /** @type {import('tailwindcss').Config} */
2
+ module.exports = {
3
+ content: ["./src/**/*.{js,jsx,ts,tsx}"],
4
+ theme: {
5
+ extend: {},
6
+ },
7
+ plugins: [],
8
+ }
9
+
package/tsconfig.json ADDED
@@ -0,0 +1,25 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "es5",
4
+ "lib": ["dom", "dom.iterable", "esnext"],
5
+ "declaration": true,
6
+ "declarationDir": "dist",
7
+ "allowJs": true,
8
+ "skipLibCheck": true,
9
+ "esModuleInterop": true,
10
+ "allowSyntheticDefaultImports": true,
11
+ "strict": true,
12
+ "forceConsistentCasingInFileNames": true,
13
+ "noFallthroughCasesInSwitch": true,
14
+ "module": "esnext",
15
+ "moduleResolution": "node",
16
+ "resolveJsonModule": true,
17
+ "isolatedModules": true,
18
+ "noEmit": true,
19
+ "jsx": "react-jsx"
20
+ },
21
+ "include": ["src"],
22
+ "exclude": [
23
+ "src/stories"
24
+ ]
25
+ }