@sikka/hawa 0.0.271 → 0.0.274

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 (38) hide show
  1. package/dist/styles.css +180 -9
  2. package/es/blocks/Pricing/HorizontalPricing.d.ts +47 -0
  3. package/es/blocks/Pricing/index.d.ts +1 -0
  4. package/es/elements/HawaLandingCard.d.ts +1 -0
  5. package/es/elements/HawaLoading.d.ts +8 -0
  6. package/es/elements/HawaRadio.d.ts +7 -10
  7. package/es/elements/index.d.ts +1 -1
  8. package/es/index.es.js +3 -3
  9. package/es/layout/HawaGrid.d.ts +6 -0
  10. package/es/layout/index.d.ts +1 -0
  11. package/lib/blocks/Pricing/HorizontalPricing.d.ts +47 -0
  12. package/lib/blocks/Pricing/index.d.ts +1 -0
  13. package/lib/elements/HawaLandingCard.d.ts +1 -0
  14. package/lib/elements/HawaLoading.d.ts +8 -0
  15. package/lib/elements/HawaRadio.d.ts +7 -10
  16. package/lib/elements/index.d.ts +1 -1
  17. package/lib/index.js +3 -3
  18. package/lib/layout/HawaGrid.d.ts +6 -0
  19. package/lib/layout/index.d.ts +1 -0
  20. package/package.json +2 -1
  21. package/src/blocks/Pricing/HorizontalPricing.tsx +140 -0
  22. package/src/blocks/Pricing/index.ts +1 -0
  23. package/src/elements/HawaButton.tsx +16 -21
  24. package/src/elements/HawaCodeBlock.tsx +4 -12
  25. package/src/elements/HawaLandingCard.tsx +12 -10
  26. package/src/elements/HawaLoading.tsx +83 -0
  27. package/src/elements/HawaPhoneInput.tsx +5 -1
  28. package/src/elements/HawaRadio.tsx +9 -11
  29. package/src/elements/HawaStats.tsx +3 -3
  30. package/src/elements/index.ts +1 -1
  31. package/src/layout/HawaGrid.tsx +15 -0
  32. package/src/layout/index.ts +1 -0
  33. package/src/styles.css +180 -9
  34. package/src/tailwind.css +23 -1
  35. package/tailwind.config.js +22 -9
  36. package/es/elements/HawaSpinner.d.ts +0 -6
  37. package/lib/elements/HawaSpinner.d.ts +0 -6
  38. package/src/elements/HawaSpinner.tsx +0 -42
@@ -0,0 +1,6 @@
1
+ import { FC } from "react";
2
+ type GridTypes = {
3
+ children?: any;
4
+ };
5
+ export declare const HawaGrid: FC<GridTypes>;
6
+ export {};
@@ -4,6 +4,7 @@ export * from "./HawaSiteLayout";
4
4
  export * from "./HawaAppLayout";
5
5
  export * from "./HawaAppLayoutSimplified";
6
6
  export * from "./HawaContainer";
7
+ export * from "./HawaGrid";
7
8
  export * from "./AppSidebar";
8
9
  export * from "./Footer";
9
10
  export * from "./Banner";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sikka/hawa",
3
- "version": "0.0.271",
3
+ "version": "0.0.274",
4
4
  "description": "SaaS Oriented UI Kit",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.es.js",
@@ -78,6 +78,7 @@
78
78
  "rollup-plugin-swc": "^0.2.1",
79
79
  "rollup-plugin-typescript2": "^0.34.1",
80
80
  "tailwindcss": "^3.3.3",
81
+ "tailwindcss-animate": "^1.0.6",
81
82
  "tinycolor2": "^1.4.2",
82
83
  "tslib": "^2.4.1",
83
84
  "typescript": "^4.8.4",
@@ -0,0 +1,140 @@
1
+ import React, { FC, useState } from "react"
2
+ import { HawaRadio } from "../../elements"
3
+ import clsx from "clsx"
4
+
5
+ type HorizontalPricingTypes = {
6
+ plans: [
7
+ {
8
+ direction: "rtl" | "ltr"
9
+ features: [{ included: boolean; text: string }]
10
+ price: number
11
+ texts: {
12
+ title: string
13
+ subtitle: string
14
+ buttonText: string
15
+ cycleText: string
16
+ currencyText: string
17
+ }
18
+ size: "small" | "medium" | "large"
19
+ }
20
+ ]
21
+ currencies: [
22
+ {
23
+ label: string
24
+ value: string
25
+ }
26
+ ]
27
+ billingCycles: [
28
+ {
29
+ label: string
30
+ value: string
31
+ }
32
+ ]
33
+ onPlanClicked?: (e) => void
34
+ currentCycle: {
35
+ label: string
36
+ value: string
37
+ }
38
+ currentCurrency: {
39
+ label: string
40
+ value: string
41
+ }
42
+ onCycleChange?: (e) => void
43
+ onCurrencyChange?: (e) => void
44
+ direction?: "rtl" | "ltr"
45
+ }
46
+ export const HorizontalPricing: FC<HorizontalPricingTypes> = (props) => {
47
+ const [selectedCard, setSelectedCard] = useState(null)
48
+ let data = [
49
+ { title: "basic", price: "$49", cycle: "/mo" },
50
+ { title: "business", price: "$99", cycle: "/mo" },
51
+ { title: "enterprise", price: "$149", cycle: "/mo" },
52
+ ]
53
+ return (
54
+ <div className="z-10 w-full max-w-screen-sm">
55
+ <div className="max-w-2xl ">
56
+ <div className="flex flex-row justify-between">
57
+ <HawaRadio
58
+ design="tabs"
59
+ options={props.currencies}
60
+ defaultValue={props.currentCurrency}
61
+ />
62
+ <HawaRadio
63
+ design="tabs"
64
+ options={props.billingCycles}
65
+ defaultValue={props.currentCycle}
66
+ />
67
+ </div>
68
+ {data.map((d) => (
69
+ <label htmlFor={d.title} onClick={() => setSelectedCard(d.title)}>
70
+ <input
71
+ type="radio"
72
+ name="radio"
73
+ id={d.title}
74
+ className="peer appearance-none"
75
+ />
76
+ <div
77
+ className={clsx(
78
+ selectedCard === d.title ? "peer-checked:border-blue-500" : "",
79
+ "peer flex cursor-pointer items-center justify-between rounded-xl border-2 border-transparent bg-white px-5 py-4 shadow peer-checked:[&_.active]:block peer-checked:[&_.default]:hidden"
80
+ )}
81
+ >
82
+ <div className="peer flex items-center gap-4">
83
+ <CheckIcons />
84
+ <CardText
85
+ title="Enterprise"
86
+ subtitle="For startups and new businesses"
87
+ />
88
+ </div>
89
+
90
+ <CardPrice amount={d.price} cycle={d.cycle} />
91
+ </div>
92
+ </label>
93
+ ))}
94
+ </div>
95
+ </div>
96
+ )
97
+ }
98
+
99
+ const CheckIcons = () => (
100
+ <>
101
+ <svg
102
+ fill="none"
103
+ viewBox="0 0 24 24"
104
+ stroke-width="1.5"
105
+ stroke="currentColor"
106
+ className="default h-8 w-8 text-neutral-500"
107
+ >
108
+ <path
109
+ stroke-linecap="round"
110
+ stroke-linejoin="round"
111
+ d="M9 12.75L11.25 15 15 9.75M21 12a9 9 0 11-18 0 9 9 0 0118 0z"
112
+ />
113
+ </svg>
114
+ <svg
115
+ viewBox="0 0 24 24"
116
+ fill="currentColor"
117
+ className="active hidden h-8 w-8 text-blue-500"
118
+ >
119
+ <path
120
+ fill-rule="evenodd"
121
+ clip-rule="evenodd"
122
+ d="M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12zm13.36-1.814a.75.75 0 10-1.22-.872l-3.236 4.53L9.53 12.22a.75.75 0 00-1.06 1.06l2.25 2.25a.75.75 0 001.14-.094l3.75-5.25z"
123
+ />
124
+ </svg>
125
+ </>
126
+ )
127
+ const CardText = (props) => (
128
+ <div className="peer flex flex-col items-start">
129
+ <h2 className="font-medium text-neutral-700 sm:text-xl">{props.title}</h2>
130
+ <p className="text-sm text-neutral-500">{props.subtitle} </p>
131
+ </div>
132
+ )
133
+ const CardPrice = (props) => (
134
+ <h2 className="peer text-xl font-semibold text-neutral-900 sm:text-2xl">
135
+ {props.amount}
136
+ <span className="text-base font-medium text-neutral-400">
137
+ {props.cycle}
138
+ </span>
139
+ </h2>
140
+ )
@@ -1,2 +1,3 @@
1
1
  export * from "./PricingPlans";
2
2
  export * from "./ComparingPlans";
3
+ export * from "./HorizontalPricing";
@@ -1,6 +1,6 @@
1
1
  import React, { FC, ButtonHTMLAttributes, useState } from "react"
2
2
  import clsx from "clsx"
3
- import { HawaSpinner } from "./HawaSpinner"
3
+ import { HawaLoading } from "./HawaLoading"
4
4
  import { HawaTooltip } from "./HawaTooltip"
5
5
 
6
6
  interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
@@ -102,22 +102,17 @@ export const HawaButton: FC<ButtonProps> = ({
102
102
  const [isClicked, setIsClicked] = useState(false)
103
103
  const [buttonText, setButtonText] = useState(children)
104
104
 
105
- const handleClick = () => {
106
- if (feedback) {
107
- if (!isClicked) {
108
- props.onClick
109
- setButtonText(feedback)
110
- setIsClicked(true)
111
- console.log("hawa button clicked")
112
- // Reset the button text after 2 seconds (adjust the time as needed).
113
- setTimeout(() => {
114
- setButtonText(children)
115
- setIsClicked(false)
116
- }, 2000)
117
- }
118
- } else {
119
- props.onClick(null)
120
- console.log("hawa button clicked")
105
+ const handleClick = (event) => {
106
+ if (props.onClick) {
107
+ props.onClick(event)
108
+ }
109
+ if (feedback && !isClicked) {
110
+ setButtonText(feedback)
111
+ setIsClicked(true)
112
+ setTimeout(() => {
113
+ setButtonText(children)
114
+ setIsClicked(false)
115
+ }, 2000)
121
116
  }
122
117
  }
123
118
 
@@ -165,7 +160,7 @@ export const HawaButton: FC<ButtonProps> = ({
165
160
  onClick={props.onClick}
166
161
  // onClick={handleClick}
167
162
  >
168
- {!isLoading ? children : <HawaSpinner size="button" />}
163
+ {!isLoading ? children : <HawaLoading size="button" />}
169
164
  </button>
170
165
  </HawaTooltip>
171
166
  ) : (
@@ -210,14 +205,14 @@ export const HawaButton: FC<ButtonProps> = ({
210
205
  {isClicked && feedback ? (
211
206
  <div className="w-full text-center">{buttonText}</div>
212
207
  ) : null}
213
- <div className="flex w-full flex-row items-center select-none justify-center gap-2 whitespace-nowrap">
208
+ <div className="flex w-full select-none flex-row items-center justify-center gap-2 whitespace-nowrap">
214
209
  {props.startIcon && props.startIcon}
215
210
  {children}
216
211
  {props.endIcon && props.endIcon}
217
212
  </div>
218
213
  </div>
219
214
  ) : (
220
- <HawaSpinner size="button" />
215
+ <HawaLoading design="dots-pulse" color={"bg-white"} size="button" />
221
216
  )}
222
217
  </button>
223
218
  )}
@@ -229,7 +224,7 @@ export const HawaButton: FC<ButtonProps> = ({
229
224
  : typeof badge === "string"
230
225
  ? "h-5 w-7"
231
226
  : "h-6 w-6",
232
- "absolute -right-2 select-none -top-2 inline-flex items-center justify-center rounded-full border-2 border-white bg-red-500 text-[9px] font-bold text-white dark:border-gray-900"
227
+ "absolute -right-2 -top-2 inline-flex select-none items-center justify-center rounded-full border-2 border-white bg-red-500 text-[9px] font-bold text-white dark:border-gray-900"
233
228
  )}
234
229
  >
235
230
  {typeof badge === "number" && badge > 100 ? "+99" : badge}
@@ -75,19 +75,11 @@ export const HawaCodeBlock: FC<CodeBlockTypes> = ({
75
75
  {fileName && (
76
76
  <div className="flex flex-row gap-2 rounded-t bg-gray-700 p-2 pb-0">
77
77
  <div
78
- // className={clsx(
79
- // selectedTab === i
80
- // ? "border-buttonPrimary-400 border-b-2"
81
- // : "bg-transparent"
82
- // )}
78
+ className={clsx(
79
+ "mb-1 w-full max-w-[52px] rounded-inner p-2 py-1 text-center text-[0.75rem]"
80
+ )}
83
81
  >
84
- <div
85
- className={clsx(
86
- "mb-1 w-full max-w-[52px] rounded-inner p-2 py-1 text-center text-[0.75rem] "
87
- )}
88
- >
89
- {fileName}
90
- </div>
82
+ {fileName}
91
83
  </div>
92
84
  </div>
93
85
  )}
@@ -14,9 +14,10 @@ type LandingCardTypes = {
14
14
  linkText?: string
15
15
  }
16
16
  buttonLink?: string
17
+ className?: any
17
18
  }
18
19
  export const HawaLandingCard: FC<LandingCardTypes> = ({
19
- orientation,
20
+ orientation = "horizontal",
20
21
  ...props
21
22
  }) => {
22
23
  let cardStyles = {
@@ -36,12 +37,13 @@ export const HawaLandingCard: FC<LandingCardTypes> = ({
36
37
  className={clsx(
37
38
  cardStyles[orientation],
38
39
  "flex flex-col p-10",
39
- "relative overflow-hidden"
40
+ "relative overflow-hidden",
41
+ props.className
40
42
  )}
41
43
  {...props}
42
44
  >
43
- {props.texts.titleTip && (
44
- <div className="text-sm text-red-600">{props.texts.titleTip}</div>
45
+ {props.texts?.titleTip && (
46
+ <div className="text-sm text-red-600">{props.texts?.titleTip}</div>
45
47
  )}
46
48
  {props.imageURL && (
47
49
  <img
@@ -50,15 +52,15 @@ export const HawaLandingCard: FC<LandingCardTypes> = ({
50
52
  />
51
53
  )}
52
54
 
53
- {props.texts.title && (
54
- <div className="mt-2 text-lg font-medium">{props.texts.title} </div>
55
+ {props.texts?.title && (
56
+ <div className="mt-2 text-lg font-medium">{props.texts?.title} </div>
55
57
  )}
56
- {props.texts.description && (
57
- <div className="z-10 mt-4 text-sm">{props.texts.description}</div>
58
+ {props.texts?.description && (
59
+ <div className="z-10 mt-4 text-sm">{props.texts?.description}</div>
58
60
  )}
59
- {props.texts.linkText && (
61
+ {props.texts?.linkText && (
60
62
  <div className="z-10 mt-6 text-sm underline underline-offset-8">
61
- {props.texts.linkText}
63
+ {props.texts?.linkText}
62
64
  </div>
63
65
  )}
64
66
  </div>
@@ -0,0 +1,83 @@
1
+ import React, { FC } from "react"
2
+ import clsx from "clsx"
3
+
4
+ type LoadingTypes = {
5
+ size?: "button" | "sm" | "normal" | "lg" | "xl"
6
+ design?: "spinner" | "dots-bounce" | "dots-pulse" | "pulse" | "spinner-dots"
7
+ color?: any
8
+ }
9
+
10
+ export const HawaLoading: FC<LoadingTypes> = ({
11
+ design = "spinner",
12
+ size = "sm",
13
+ color,
14
+ ...props
15
+ }) => {
16
+ let sizeStyles = {
17
+ button: "h-4 w-4",
18
+ sm: "h-6 w-6",
19
+ normal: "h-8 w-8",
20
+ lg: "h-14 w-14",
21
+ xl: "h-24 w-24",
22
+ }
23
+
24
+ let animationStyles = {
25
+ pulse: "animate-in fade-in duration-1000",
26
+ bounce: "animate-bounce",
27
+ }
28
+ switch (design.split("-")[0]) {
29
+ case "dots":
30
+ return (
31
+ <div className="flex flex-row space-x-2 ">
32
+ <div
33
+ className={clsx(
34
+ "animate-bounce rounded-full delay-100 repeat-infinite",
35
+ size === "button" ? "h-2 w-2" : sizeStyles[size],
36
+ animationStyles[design.split("-")[1]],
37
+ color ? color : "bg-buttonPrimary-500"
38
+ )}
39
+ ></div>
40
+ <div
41
+ className={clsx(
42
+ "animate-bounce rounded-full delay-200 repeat-infinite",
43
+ size === "button" ? "h-2 w-2" : sizeStyles[size],
44
+ animationStyles[design.split("-")[1]],
45
+
46
+ color ? color : "bg-buttonPrimary-500"
47
+ )}
48
+ ></div>
49
+ <div
50
+ className={clsx(
51
+ "animate-bounce rounded-full delay-300 repeat-infinite",
52
+ size === "button" ? "h-2 w-2" : sizeStyles[size],
53
+ animationStyles[design.split("-")[1]],
54
+
55
+ color ? color : "bg-buttonPrimary-500"
56
+ )}
57
+ ></div>
58
+ </div>
59
+ )
60
+
61
+ default:
62
+ return (
63
+ <div className="flex flex-row gap-x-3">
64
+ <div aria-label="Loading..." role="status">
65
+ <svg
66
+ className={clsx(sizeStyles[size], "animate-spin")}
67
+ viewBox="3 3 18 18"
68
+ >
69
+ <path
70
+ className="fill-gray-200"
71
+ d="M12 5C8.13401 5 5 8.13401 5 12C5 15.866 8.13401 19 12 19C15.866 19 19 15.866 19 12C19 8.13401 15.866 5 12 5ZM3 12C3 7.02944 7.02944 3 12 3C16.9706 3 21 7.02944 21 12C21 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12Z"
72
+ ></path>
73
+ <path
74
+ // className="fill-buttonPrimary-500 "
75
+ className={color ? color : "fill-buttonPrimary-500"}
76
+ d="M16.9497 7.05015C14.2161 4.31648 9.78392 4.31648 7.05025 7.05015C6.65973 7.44067 6.02656 7.44067 5.63604 7.05015C5.24551 6.65962 5.24551 6.02646 5.63604 5.63593C9.15076 2.12121 14.8492 2.12121 18.364 5.63593C18.7545 6.02646 18.7545 6.65962 18.364 7.05015C17.9734 7.44067 17.3403 7.44067 16.9497 7.05015Z"
77
+ ></path>
78
+ </svg>
79
+ </div>
80
+ </div>
81
+ )
82
+ }
83
+ }
@@ -60,6 +60,7 @@ export const HawaPhoneInput: FC<HawaPhoneInputTypes> = (props) => {
60
60
  },
61
61
  lineHeight: "1.25rem",
62
62
  padding: "0.37rem",
63
+ paddingLeft: 0,
63
64
  }),
64
65
  singleValue: (base) => ({
65
66
  ...base,
@@ -84,6 +85,8 @@ export const HawaPhoneInput: FC<HawaPhoneInputTypes> = (props) => {
84
85
  DropdownIndicator: () => null,
85
86
  IndicatorSeparator: () => null,
86
87
  }}
88
+ // className="bg-red-500"
89
+
87
90
  options={Countries}
88
91
  isMulti={false}
89
92
  isSearchable={true}
@@ -96,7 +99,8 @@ export const HawaPhoneInput: FC<HawaPhoneInputTypes> = (props) => {
96
99
  <input
97
100
  onChange={props.handleChange}
98
101
  type="number"
99
- className="block w-full appearance-none rounded rounded-l-none border border-l-0 border-gray-300 bg-gray-50 p-2.5 text-sm text-gray-900 focus:border-blue-500 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:placeholder-gray-400 dark:focus:border-blue-500 dark:focus:ring-blue-500"
102
+ placeholder="531045453"
103
+ className="block w-full appearance-none rounded rounded-l-none border border-l-0 border-gray-300 bg-gray-50 p-2.5 text-[0.875rem] text-gray-900 focus:border-blue-500 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:placeholder-gray-400 dark:focus:border-blue-500 dark:focus:ring-blue-500"
100
104
  />
101
105
  {props.helperText && (
102
106
  <p className="mb-1 mt-1 text-xs text-red-600 dark:text-red-500">
@@ -4,16 +4,14 @@ import clsx from "clsx"
4
4
  type RadioTypes = {
5
5
  orientation?: "vertical" | "horizontal"
6
6
  design?: "default" | "tabs" | "cards" | "bordered"
7
- options?: [
8
- {
9
- value: any
10
- label: any
11
- disabled?: any
12
- sublabel?: any
13
- beforeIcon?: any
14
- afterIcon?: any
15
- }
16
- ]
7
+ options?: {
8
+ value: any
9
+ label: any
10
+ disabled?: any
11
+ sublabel?: any
12
+ icon?: any
13
+ }[]
14
+
17
15
  onChangeTab?: any
18
16
  defaultValue?: any
19
17
  }
@@ -59,7 +57,7 @@ export const HawaRadio: FC<RadioTypes> = ({
59
57
  : inactiveTabStyle
60
58
  )}
61
59
  >
62
- {/* {opt.icon} */}
60
+ {opt.icon && opt.icon}
63
61
  {opt.label}
64
62
  </button>
65
63
  </li>
@@ -1,7 +1,7 @@
1
1
  import React, { FC } from "react"
2
2
  import clsx from "clsx"
3
- import { HawaSpinner } from "./HawaSpinner"
4
- import { BsFilesAlt } from "react-icons/bs"
3
+ import { HawaLoading } from "./HawaLoading"
4
+ // import { BsFilesAlt } from "react-icons/bs"
5
5
 
6
6
  type StatTypes = {
7
7
  label?: string
@@ -60,7 +60,7 @@ export const HawaStats: FC<StatTypes> = ({ variant = "default", ...props }) => {
60
60
  {props.icon && <div className="mb-2">{props.icon} </div>}
61
61
  <div>{props.label}</div>
62
62
  {props.isLoading ? (
63
- <HawaSpinner />
63
+ <HawaLoading />
64
64
  ) : (
65
65
  <div className="text-2xl font-bold">{props.number}</div>
66
66
  )}
@@ -23,7 +23,7 @@ export * from "./HawaCopyrights"
23
23
  export * from "./HawaStepper"
24
24
  export * from "./HawaStats"
25
25
  export * from "./HawaCodeBlock"
26
- export * from "./HawaSpinner"
26
+ export * from "./HawaLoading"
27
27
  export * from "./HawaRadio"
28
28
  export * from "./HawaDatepicker"
29
29
  export * from "./DragDropImages"
@@ -0,0 +1,15 @@
1
+ import React, { FC } from "react"
2
+ import clsx from "clsx"
3
+
4
+ type GridTypes = {
5
+ children?: any
6
+ }
7
+
8
+ export const HawaGrid: FC<GridTypes> = (props) => {
9
+ return (
10
+ // [&>*:not(:first-child)]:mt-8
11
+ <div className=" columns-1 gap-5 sm:columns-2 sm:gap-8 md:columns-3 lg:columns-4 [&>*:not(:first-child)]:mt-8">
12
+ {props.children}
13
+ </div>
14
+ )
15
+ }
@@ -4,6 +4,7 @@ export * from "./HawaSiteLayout"
4
4
  export * from "./HawaAppLayout"
5
5
  export * from "./HawaAppLayoutSimplified"
6
6
  export * from "./HawaContainer"
7
+ export * from "./HawaGrid"
7
8
  export * from "./AppSidebar"
8
9
  export * from "./Footer"
9
10
  export * from "./Banner"