@sikka/hawa 0.0.214 → 0.0.216

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sikka/hawa",
3
- "version": "0.0.214",
3
+ "version": "0.0.216",
4
4
  "description": "SaaS Oriented UI Kit",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.es.js",
@@ -87,8 +87,9 @@ export const HawaAlert: React.FunctionComponent<AlertTypes> = ({
87
87
  <span>{" " + props.text}</span>
88
88
  {props.actions && (
89
89
  <div className="mt-2 flex flex-row gap-2">
90
- {props.actions.map((act) => (
90
+ {props.actions.map((act, index) => (
91
91
  <HawaButton
92
+ key={index}
92
93
  variant={act.variant}
93
94
  onClick={act.onClick()}
94
95
  margins="none"
@@ -175,13 +175,17 @@ export const HawaMenu: React.FunctionComponent<TMenuTypes> = ({
175
175
  key={o}
176
176
  className="bg-layout-1200 flex flex-col gap-1 p-1 text-gray-700 dark:text-gray-200"
177
177
  >
178
- {group?.map((item) => {
178
+ {group?.map((item, indx) => {
179
179
  return item.element ? (
180
- <li className="cursor-pointer items-center rounded hover:bg-gray-200 rtl:flex-row-reverse dark:hover:bg-gray-600 dark:hover:text-white">
180
+ <li
181
+ key={indx}
182
+ className="cursor-pointer items-center rounded hover:bg-gray-200 rtl:flex-row-reverse dark:hover:bg-gray-600 dark:hover:text-white"
183
+ >
181
184
  {item.element}
182
185
  </li>
183
186
  ) : (
184
187
  <li
188
+ key={indx}
185
189
  onClick={() => item?.action(actionedItem)}
186
190
  className={clsx(
187
191
  item.isButton
@@ -40,9 +40,10 @@ export const HawaPanelTabs: React.FunctionComponent<PanelTabsTypes> = (
40
40
  </ul>
41
41
  </div>
42
42
  <div id="myTabContent">
43
- {props.options.map((option: any) => {
43
+ {props.options.map((option: any, indx) => {
44
44
  return (
45
45
  <div
46
+ key={indx}
46
47
  className="rounded bg-gray-50 p-4 dark:bg-gray-800"
47
48
  id={option.value}
48
49
  role="tabpanel"
@@ -90,8 +90,9 @@ export const HawaSnackbar: FC<THawaSnackBar> = ({
90
90
  <div className="text-sm font-normal">{description}</div>
91
91
  {actions && (
92
92
  <div className="mt-2 flex flex-row gap-2">
93
- {actions.map((act) => (
93
+ {actions.map((act, i) => (
94
94
  <HawaButton
95
+ key={i}
95
96
  variant={act.variant}
96
97
  onClick={act.onClick()}
97
98
  margins="none"
@@ -29,7 +29,10 @@ export const HawaStepper: React.FunctionComponent<THawaTimeline> = ({
29
29
  >
30
30
  {props.steps.map((step: any, i: number) => {
31
31
  return (
32
- <div className="my-2 flex w-auto flex-row flex-wrap justify-start ">
32
+ <div
33
+ key={i}
34
+ className="my-2 flex w-auto flex-row flex-wrap justify-start "
35
+ >
33
36
  <div
34
37
  className={
35
38
  orientation === "vertical"
@@ -127,9 +127,9 @@ export const HawaTabs: React.FunctionComponent<TabsTypes> = ({
127
127
  </ul>
128
128
 
129
129
  <div className="flex-1 transition-all">
130
- {props.options.map((tab) => (
130
+ {props.options.map((tab, i) => (
131
131
  <div
132
- key={tab.value}
132
+ key={i}
133
133
  className={clsx(selectedOption === tab.value ? "" : "hidden")}
134
134
  >
135
135
  {tab.content}
@@ -20,11 +20,13 @@ type TextFieldTypes = {
20
20
  onChange?: any
21
21
  ref?: any
22
22
  icon?: any
23
+ preview?: boolean
23
24
  }
24
25
 
25
26
  export const HawaTextField: React.FunctionComponent<TextFieldTypes> = ({
26
27
  margin = "normal",
27
28
  width = "full",
29
+ preview = false,
28
30
  ...props
29
31
  }) => {
30
32
  let marginStyles = {
@@ -33,14 +35,16 @@ export const HawaTextField: React.FunctionComponent<TextFieldTypes> = ({
33
35
  large: "mb-5",
34
36
  }
35
37
  let widthStyles = {
36
- small: "",
37
- normal: "",
38
+ small: "w-full max-w-xs",
39
+ normal: "w-1/2",
38
40
  full: "w-full",
39
41
  }
40
42
 
41
43
  let defaultStyle = "flex h-fit max-h-fit flex-col justify-center"
42
44
  let defaultInputStyle =
43
45
  "block w-full rounded border border-gray-300 bg-gray-50 p-2 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"
46
+ let previewInputStyle =
47
+ "block w-full rounded border border-gray-300 p-2 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"
44
48
  // "mb-0 block w-full rounded border border-gray-300 bg-gray-50 p-2 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",
45
49
 
46
50
  return (
@@ -55,37 +59,72 @@ export const HawaTextField: React.FunctionComponent<TextFieldTypes> = ({
55
59
  {props.label}
56
60
  </label>
57
61
  )}
58
- {props.multiline ? (
59
- <textarea
60
- id="message"
61
- rows={4}
62
- className={defaultInputStyle}
63
- onChange={props.onChange}
64
- type={props.type}
65
- aria-label={props.label}
66
- placeholder={props.placeholder}
67
- defaultValue={props.defaultValue}
68
- value={props.value}
69
- {...props}
70
- />
62
+ {preview ? (
63
+ <>
64
+ {props.multiline ? (
65
+ <textarea
66
+ id="message"
67
+ rows={4}
68
+ className={defaultInputStyle}
69
+ onChange={props.onChange}
70
+ type={props.type}
71
+ aria-label={props.label}
72
+ placeholder={props.placeholder}
73
+ defaultValue={props.defaultValue}
74
+ value={props.value}
75
+ {...props}
76
+ />
77
+ ) : (
78
+ <div className="relative">
79
+ {props.icon && (
80
+ <div className="absolute top-1/2 left-3 -translate-y-1/2">
81
+ {props.icon}
82
+ </div>
83
+ )}
84
+ <div
85
+ // {...props}
86
+ className={clsx(previewInputStyle, props.icon ? "pl-10" : "")}
87
+ >
88
+ {props.value}
89
+ </div>
90
+ </div>
91
+ )}
92
+ </>
71
93
  ) : (
72
- <div className="relative">
73
- {props.icon && (
74
- <div className="absolute top-1/2 left-3 -translate-y-1/2">
75
- {props.icon}
94
+ <>
95
+ {props.multiline ? (
96
+ <textarea
97
+ id="message"
98
+ rows={4}
99
+ className={defaultInputStyle}
100
+ onChange={props.onChange}
101
+ type={props.type}
102
+ aria-label={props.label}
103
+ placeholder={props.placeholder}
104
+ defaultValue={props.defaultValue}
105
+ value={props.value}
106
+ {...props}
107
+ />
108
+ ) : (
109
+ <div className="relative">
110
+ {props.icon && (
111
+ <div className="absolute top-1/2 left-3 -translate-y-1/2">
112
+ {props.icon}
113
+ </div>
114
+ )}
115
+ <input
116
+ {...props}
117
+ className={clsx(defaultInputStyle, props.icon ? "pl-10" : "")}
118
+ />
76
119
  </div>
77
120
  )}
78
- <input
79
- {...props}
80
- className={clsx(defaultInputStyle, props.icon ? "pl-10" : "")}
81
- />
82
- </div>
83
- )}
84
121
 
85
- {props.helperText && (
86
- <p className="mb-0 mt-1 text-xs text-red-600 dark:text-red-500">
87
- {props.helperText}
88
- </p>
122
+ {props.helperText && (
123
+ <p className="mb-0 mt-1 text-xs text-red-600 dark:text-red-500">
124
+ {props.helperText}
125
+ </p>
126
+ )}
127
+ </>
89
128
  )}
90
129
  </div>
91
130
  )
@@ -101,8 +101,8 @@ export const InvoiceAccordion: React.FunctionComponent<
101
101
  )}
102
102
  >
103
103
  <div className="border-b pb-2">{props.invoiceDescription}</div>
104
- {props.products?.map((product) => (
105
- <div className="flex flex-row border-b pb-4">
104
+ {props.products?.map((product, i) => (
105
+ <div key={i} className="flex flex-row border-b pb-4">
106
106
  <div className="w-full">
107
107
  <InvoiceItemProp start label={texts.plan} text={product.plan} />
108
108
  </div>
@@ -24,11 +24,12 @@ export const SubsectionList: React.FunctionComponent<SubsectionListTypes> = ({
24
24
  const [selectedSection, setSelectedSection] = useState(null)
25
25
  return (
26
26
  <div className="w-full max-w-2xs rounded bg-layoutPrimary-500 p-4 ">
27
- {subsections.map((ss) => (
28
- <div className="my-0">
27
+ {subsections.map((ss, i) => (
28
+ <div key={i} className="my-0">
29
29
  {ss.title && <div className="my-4 font-bold">{ss.title}</div>}
30
- {ss.sections.map((s) => (
30
+ {ss.sections.map((s, i) => (
31
31
  <SubsectionItem
32
+ key={i}
32
33
  onItemClick={() => setSelectedSection(s.value)}
33
34
  selected={selectedSection}
34
35
  value={s.value}
@@ -21,8 +21,9 @@ export const AppSidebar: React.FC<Props> = ({ isOpen, onClose, items }) => {
21
21
  Close
22
22
  </button>
23
23
  <nav>
24
- {items.map((item) => (
24
+ {items.map((item, i) => (
25
25
  <a
26
+ key={i}
26
27
  href="#"
27
28
  onClick={item.onClick}
28
29
  className="block p-4 font-bold text-white hover:bg-gray-700 hover:text-gray-400"
@@ -333,9 +333,9 @@ export const HawaAppLayout: React.FunctionComponent<HawaAppLayoutTypes> = ({
333
333
  </div>
334
334
  {/* Drawer Items */}
335
335
  <div className="mt-14 mb-8">
336
- {props.drawerItems?.map((dSection, j) => (
336
+ {props.drawerItems?.map((dSection, dIndex) => (
337
337
  <div
338
- key={j}
338
+ key={dIndex}
339
339
  className={clsx("flex flex-col items-stretch justify-center")}
340
340
  >
341
341
  {dSection?.map((dItem, i) => {
@@ -435,7 +435,7 @@ export const HawaAppLayout: React.FunctionComponent<HawaAppLayoutTypes> = ({
435
435
  </div>
436
436
  )
437
437
  })}
438
- {j !== props.drawerItems.length - 1 && (
438
+ {dIndex !== props.drawerItems.length - 1 && (
439
439
  <div className="my-2 h-[1px] w-10/12 self-center bg-buttonPrimary-500 text-center "></div>
440
440
  )}
441
441
  </div>
@@ -24,8 +24,9 @@ export const HawaBottomAppBar: React.FunctionComponent<BottomAppBarTypes> = (
24
24
  className="flex w-full flex-row items-center justify-evenly rounded bg-gray-200"
25
25
  // variant="outlined"
26
26
  >
27
- {props.appBarContent.map((singleContent: any) => (
27
+ {props.appBarContent.map((singleContent: any, i) => (
28
28
  <div
29
+ key={i}
29
30
  className="m-1 flex h-full w-full flex-col items-center justify-center rounded p-2 transition-all hover:cursor-pointer hover:bg-buttonPrimary-700 hover:text-white"
30
31
  onClick={singleContent.action}
31
32
  >
@@ -102,8 +102,11 @@ export const HawaSiteLayout: React.FunctionComponent<HawaSiteLayoutTypes> = ({
102
102
  >
103
103
  {size > 600 ? (
104
104
  <div className="flex flex-row gap-2 ">
105
- {props.navItems?.map(({ label }) => (
106
- <div className="rounded bg-none p-2 transition-all hover:bg-gray-100">
105
+ {props.navItems?.map(({ label }, i) => (
106
+ <div
107
+ key={i}
108
+ className="rounded bg-none p-2 transition-all hover:bg-gray-100"
109
+ >
107
110
  {label}
108
111
  </div>
109
112
  ))}