@sikka/hawa 0.0.265 → 0.0.266

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.
@@ -1,14 +1,12 @@
1
1
  import React, { useEffect, useRef, useState } from "react"
2
2
  import clsx from "clsx"
3
3
  import { HiMenu } from "react-icons/hi"
4
- import { FaChevronRight } from "react-icons/fa"
5
4
  import useDiscloser from "../hooks/useDiscloser"
6
5
  import useBreakpoint from "../hooks/useBreakpoint"
7
- import { HawaButton, HawaMenu } from "../elements"
8
-
9
- // TODO: when no pagetitle, navbar gets messy
6
+ import { HawaMenu } from "../elements"
10
7
 
11
8
  type HawaAppLayoutTypes = {
9
+ /** The pages of the side drawer */
12
10
  drawerItems: {
13
11
  label: string
14
12
  icon: any
@@ -16,7 +14,9 @@ type HawaAppLayoutTypes = {
16
14
  action: () => void
17
15
  subItems?: any
18
16
  }[][]
17
+ // The direction of the layout
19
18
  direction?: "rtl" | "ltr"
19
+ // The title of the current selected page, make sure it's the same as the drawerItem slug
20
20
  currentPage: string
21
21
  pageTitle?: string
22
22
  logoSymbol?: any
@@ -29,6 +29,7 @@ type HawaAppLayoutTypes = {
29
29
  drawerSize?: "sm" | "md" | "large"
30
30
  profileMenuItems?: MenuItems[][]
31
31
  onSettingsClick?: () => void
32
+ DrawerFooterActions: any
32
33
  }
33
34
 
34
35
  type MenuItems = {
@@ -39,7 +40,13 @@ type MenuItems = {
39
40
  }
40
41
  export const HawaAppLayoutSimplified: React.FunctionComponent<
41
42
  HawaAppLayoutTypes
42
- > = ({ direction = "rtl", drawerSize = "md", onSettingsClick, ...props }) => {
43
+ > = ({
44
+ direction = "rtl",
45
+ drawerSize = "md",
46
+ onSettingsClick,
47
+ DrawerFooterActions,
48
+ ...props
49
+ }) => {
43
50
  const [openSideMenu, setOpenSideMenu] = useState(false)
44
51
  const [openSubItem, setOpenSubitem] = useState("")
45
52
  const { isOpen, onClose, onOpen } = useDiscloser(false)
@@ -92,35 +99,32 @@ export const HawaAppLayoutSimplified: React.FunctionComponent<
92
99
  >
93
100
  {/* Nav Side Of Navbar */}
94
101
  {size > 600 ? (
95
- props.pageTitle ? (
96
- // Title of the page
97
- <div
98
- className={clsx(
99
- isRTL
100
- ? [size > 600 ? "mr-14" : "mr-2", keepOpen ? "mr-40" : ""]
101
- : [size > 600 ? "ml-14" : "ml-2", keepOpen ? "ml-40" : ""]
102
- )}
103
- style={
104
- isRTL
105
- ? {
106
- marginRight: `${
107
- drawerSizeStyle[keepOpen ? "opened" : "closed"][
108
- drawerSize
109
- ]
110
- }px`,
111
- }
112
- : {
113
- marginLeft: `${
114
- drawerSizeStyle[keepOpen ? "opened" : "closed"][
115
- drawerSize
116
- ]
117
- }px`,
118
- }
119
- }
120
- >
121
- {props.pageTitle}
122
- </div>
123
- ) : null
102
+ <div
103
+ className={clsx(
104
+ isRTL
105
+ ? [size > 600 ? "mr-14" : "mr-2", keepOpen ? "mr-40" : ""]
106
+ : [size > 600 ? "ml-14" : "ml-2", keepOpen ? "ml-40" : ""]
107
+ )}
108
+ style={
109
+ isRTL
110
+ ? {
111
+ marginRight: `${
112
+ drawerSizeStyle[keepOpen ? "opened" : "closed"][
113
+ drawerSize
114
+ ]
115
+ }px`,
116
+ }
117
+ : {
118
+ marginLeft: `${
119
+ drawerSizeStyle[keepOpen ? "opened" : "closed"][
120
+ drawerSize
121
+ ]
122
+ }px`,
123
+ }
124
+ }
125
+ >
126
+ {props.pageTitle}
127
+ </div>
124
128
  ) : (
125
129
  // Mobile Drawer Menu Button
126
130
  <div
@@ -147,14 +151,11 @@ export const HawaAppLayoutSimplified: React.FunctionComponent<
147
151
  "flex gap-2",
148
152
  isRTL ? "flex-row-reverse" : "flex-row"
149
153
  )}
150
- // dir={direction}
151
154
  >
152
155
  {/* User Info */}
153
156
  {size > 600 ? (
154
157
  <div
155
- className={clsx(
156
- isRTL ? "text-left text-xs" : "text-right text-xs"
157
- )}
158
+ className={isRTL ? "text-left text-xs" : "text-right text-xs"}
158
159
  >
159
160
  <div className="font-bold">{props.username}</div>{" "}
160
161
  <div>{props.email}</div>
@@ -187,9 +188,6 @@ export const HawaAppLayoutSimplified: React.FunctionComponent<
187
188
  <div
188
189
  className={clsx(
189
190
  "fixed top-0 z-40 flex h-full flex-col justify-between overflow-x-clip transition-all",
190
- // drawerDefaultStyle,
191
- // "bg-green-400",
192
- // drawerSizeStyle[drawerSize],
193
191
  isRTL ? "right-0" : "left-0"
194
192
  )}
195
193
  style={{
@@ -298,8 +296,9 @@ export const HawaAppLayoutSimplified: React.FunctionComponent<
298
296
  )
299
297
  ? "bg-buttonPrimary-500 text-white"
300
298
  : "hover:bg-layoutPrimary-300",
301
- "m-2 my-1 flex cursor-pointer flex-row items-center justify-between overflow-x-clip rounded p-2 pl-3 transition-all ",
302
- isRTL ? "flex-row-reverse pr-3" : ""
299
+ "my-1 flex cursor-pointer flex-row items-center justify-between overflow-x-clip rounded p-2 pl-3 transition-all ",
300
+ isRTL ? "flex-row-reverse pr-3" : "",
301
+ openSideMenu ? "m-2" : "m-2"
303
302
  )}
304
303
  >
305
304
  <div className="flex flex-row" dir={direction}>
@@ -316,22 +315,20 @@ export const HawaAppLayoutSimplified: React.FunctionComponent<
316
315
  </div>
317
316
  </div>
318
317
  {dItem.subItems && (
319
- <div
320
- className={clsx(
318
+ <ArrowIcon
319
+ pointing={
321
320
  openSubItem && dItem.slug === openSubItem
322
- ? "-rotate-90"
323
- : "rotate-90"
324
- )}
325
- >
326
- {/* <FaChevronRight fontSize={11} /> */}
327
- </div>
321
+ ? "up"
322
+ : "down"
323
+ }
324
+ />
328
325
  )}
329
326
  </div>
330
327
 
331
328
  {dItem.subItems && (
332
329
  <div
333
330
  className={clsx(
334
- "m-1 flex cursor-pointer flex-col gap-0 overflow-clip whitespace-nowrap rounded bg-layoutPrimary-300 p-1 transition-all",
331
+ "m-1 mx-2 flex cursor-pointer flex-col gap-0 overflow-clip whitespace-nowrap rounded bg-layoutPrimary-300 p-1 transition-all",
335
332
  openSubItem == dItem.slug && openSideMenu
336
333
  ? ""
337
334
  : "my-0 py-0",
@@ -348,7 +345,7 @@ export const HawaAppLayoutSimplified: React.FunctionComponent<
348
345
  <div
349
346
  key={s}
350
347
  className={clsx(
351
- "flex flex-row gap-2 overflow-x-clip rounded p-2 px-2 text-xs",
348
+ "flex flex-row gap-2 overflow-x-clip rounded-inner p-2 px-2 text-xs",
352
349
  isRTL ? "text-right" : "text-left",
353
350
  props.currentPage === subIt.slug
354
351
  ? "bg-buttonPrimary-500 text-white hover:bg-buttonPrimary-500"
@@ -381,7 +378,11 @@ export const HawaAppLayoutSimplified: React.FunctionComponent<
381
378
  </div>
382
379
  {/* Drawer Footer */}
383
380
  <div
384
- className="fixed bottom-0 flex h-14 w-full items-center justify-center bg-layoutPrimary-500 transition-all"
381
+ className={clsx(
382
+ "fixed bottom-0 flex h-14 w-full items-center justify-center gap-2 bg-layoutPrimary-500 transition-all",
383
+
384
+ direction === "rtl" ? "flex-row-reverse" : "flex-row"
385
+ )}
385
386
  style={{
386
387
  width:
387
388
  size > 600
@@ -389,19 +390,14 @@ export const HawaAppLayoutSimplified: React.FunctionComponent<
389
390
  : `${openSideMenu ? 160 : 0}px`,
390
391
  }}
391
392
  >
392
- {onSettingsClick && (
393
- <div
394
- className=" cursor-pointer rounded p-2 transition-all hover:bg-layoutPrimary-700"
395
- onClick={() => onSettingsClick()}
396
- >
397
- <SettingsIcon />
398
- </div>
399
- )}
393
+ {size > 600 && DrawerFooterActions && openSideMenu ? (
394
+ <>{DrawerFooterActions}</>
395
+ ) : null}
396
+
400
397
  {/* Expand Button */}
401
- {size > 600 ? (
398
+ {size > 600 && openSideMenu ? (
402
399
  <div
403
400
  className={clsx("w-fit transition-all")}
404
- // style={isRTL ? {} : {left: }}
405
401
  style={
406
402
  isRTL
407
403
  ? {
@@ -430,7 +426,7 @@ export const HawaAppLayoutSimplified: React.FunctionComponent<
430
426
  <div
431
427
  onClick={() => setKeepOpen(!keepOpen)}
432
428
  className={
433
- "w-fit cursor-pointer rounded bg-gray-300 p-2 transition-all hover:bg-gray-400"
429
+ "w-fit cursor-pointer rounded bg-gray-300 p-1 transition-all hover:bg-gray-400"
434
430
  }
435
431
  >
436
432
  <ArrowIcon
@@ -454,7 +450,7 @@ export const HawaAppLayoutSimplified: React.FunctionComponent<
454
450
 
455
451
  {/* Children Container */}
456
452
  <div
457
- className="fixed overflow-y-auto p-2"
453
+ className="fixed overflow-y-auto"
458
454
  style={
459
455
  isRTL
460
456
  ? {
@@ -492,22 +488,42 @@ const AvatarIcon = () => (
492
488
  </svg>
493
489
  )
494
490
 
495
- const ArrowIcon = ({ pointing }) => (
496
- <svg
497
- className={clsx(
498
- "h-6 w-6 shrink-0 transition-all disabled:bg-gray-200",
499
- pointing === "right" ? "-rotate-90" : "rotate-90"
500
- )}
501
- viewBox="0 0 20 20"
502
- xmlns="http://www.w3.org/2000/svg"
503
- >
504
- <path
505
- fillRule="evenodd"
506
- d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z"
507
- clipRule="evenodd"
508
- ></path>
509
- </svg>
510
- )
491
+ const ArrowIcon = ({ pointing }) => {
492
+ let directionStyle
493
+ switch (pointing) {
494
+ case "right":
495
+ directionStyle = "-rotate-90"
496
+ break
497
+ case "left":
498
+ directionStyle = "rotate-90"
499
+ break
500
+ case "up":
501
+ directionStyle = "-rotate-180"
502
+ break
503
+ case "down":
504
+ directionStyle = "rotate-0"
505
+ break
506
+
507
+ default:
508
+ break
509
+ }
510
+ return (
511
+ <svg
512
+ className={clsx(
513
+ "h-6 w-6 shrink-0 transition-all disabled:bg-gray-200",
514
+ directionStyle
515
+ )}
516
+ viewBox="0 0 20 20"
517
+ xmlns="http://www.w3.org/2000/svg"
518
+ >
519
+ <path
520
+ fillRule="evenodd"
521
+ d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z"
522
+ clipRule="evenodd"
523
+ ></path>
524
+ </svg>
525
+ )
526
+ }
511
527
 
512
528
  const SettingsIcon = () => (
513
529
  <svg
package/src/styles.css CHANGED
@@ -403,6 +403,24 @@ video {
403
403
  var(--border-radius) - calc(var(--border-radius) / 3)
404
404
  );
405
405
  }
406
+
407
+ .inline-code {
408
+ font-size: 0.75rem;
409
+ /* color: theme("colors.slate.500"); */
410
+ /* background-color: theme("colors.stone.100"); */
411
+ border-radius: var(--border-radius);
412
+ /* padding-left: theme("spacing[1.5]");
413
+ padding-right: theme("spacing[1.5]");
414
+ padding-top: theme("spacing.1");
415
+ padding-bottom: theme("spacing.1"); */
416
+ padding: 0.25rem 0.375rem;
417
+ /* margin: theme("spacing.0") theme("spacing.1"); */
418
+
419
+ border: #d1d5db 1px solid;
420
+ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
421
+ Liberation Mono, Courier New, monospace;
422
+ }
423
+
406
424
  input[type="number"]::-webkit-inner-spin-button,
407
425
  input[type="number"]::-webkit-outer-spin-button {
408
426
  -webkit-appearance: none;
@@ -597,6 +615,9 @@ video {
597
615
  .-left-1 {
598
616
  left: -0.25rem;
599
617
  }
618
+ .-left-1\.5 {
619
+ left: -0.375rem;
620
+ }
600
621
  .-right-10 {
601
622
  right: -2.5rem;
602
623
  }
@@ -769,6 +790,9 @@ video {
769
790
  .ml-3 {
770
791
  margin-left: 0.75rem;
771
792
  }
793
+ .ml-4 {
794
+ margin-left: 1rem;
795
+ }
772
796
  .ml-40 {
773
797
  margin-left: 10rem;
774
798
  }
@@ -820,6 +844,9 @@ video {
820
844
  .mt-1 {
821
845
  margin-top: 0.25rem;
822
846
  }
847
+ .mt-1\.5 {
848
+ margin-top: 0.375rem;
849
+ }
823
850
  .mt-14 {
824
851
  margin-top: 3.5rem;
825
852
  }
@@ -1160,6 +1187,10 @@ video {
1160
1187
  --tw-translate-y: 50%;
1161
1188
  transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
1162
1189
  }
1190
+ .-rotate-180 {
1191
+ --tw-rotate: -180deg;
1192
+ transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
1193
+ }
1163
1194
  .-rotate-90 {
1164
1195
  --tw-rotate: -90deg;
1165
1196
  transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
@@ -1547,6 +1578,10 @@ video {
1547
1578
  --tw-border-opacity: 1;
1548
1579
  border-color: rgb(75 85 99 / var(--tw-border-opacity));
1549
1580
  }
1581
+ .border-gray-900 {
1582
+ --tw-border-opacity: 1;
1583
+ border-color: rgb(17 24 39 / var(--tw-border-opacity));
1584
+ }
1550
1585
  .border-green-300 {
1551
1586
  --tw-border-opacity: 1;
1552
1587
  border-color: rgb(134 239 172 / var(--tw-border-opacity));
@@ -1607,6 +1642,9 @@ video {
1607
1642
  .bg-buttonPrimary-500 {
1608
1643
  background-color: var(--button-primary-500);
1609
1644
  }
1645
+ .bg-buttonSecondary-500 {
1646
+ background-color: var(--button-secondary-500);
1647
+ }
1610
1648
  .bg-cyan-800 {
1611
1649
  --tw-bg-opacity: 1;
1612
1650
  background-color: rgb(21 94 117 / var(--tw-bg-opacity));
@@ -1659,10 +1697,6 @@ video {
1659
1697
  --tw-bg-opacity: 1;
1660
1698
  background-color: rgb(134 239 172 / var(--tw-bg-opacity));
1661
1699
  }
1662
- .bg-green-400 {
1663
- --tw-bg-opacity: 1;
1664
- background-color: rgb(74 222 128 / var(--tw-bg-opacity));
1665
- }
1666
1700
  .bg-green-500 {
1667
1701
  --tw-bg-opacity: 1;
1668
1702
  background-color: rgb(34 197 94 / var(--tw-bg-opacity));
@@ -1935,6 +1969,10 @@ video {
1935
1969
  .text-\[9px\] {
1936
1970
  font-size: 9px;
1937
1971
  }
1972
+ .text-base {
1973
+ font-size: 1rem;
1974
+ line-height: 1.5rem;
1975
+ }
1938
1976
  .text-lg {
1939
1977
  font-size: 1.125rem;
1940
1978
  line-height: 1.75rem;
@@ -1981,6 +2019,9 @@ video {
1981
2019
  .leading-4 {
1982
2020
  line-height: 1rem;
1983
2021
  }
2022
+ .leading-none {
2023
+ line-height: 1;
2024
+ }
1984
2025
  .leading-tight {
1985
2026
  line-height: 1.25;
1986
2027
  }
@@ -2322,6 +2363,10 @@ body {
2322
2363
  --tw-bg-opacity: 1;
2323
2364
  background-color: rgb(229 231 235 / var(--tw-bg-opacity));
2324
2365
  }
2366
+ .hover\:bg-gray-300:hover {
2367
+ --tw-bg-opacity: 1;
2368
+ background-color: rgb(209 213 219 / var(--tw-bg-opacity));
2369
+ }
2325
2370
  .hover\:bg-gray-400:hover {
2326
2371
  --tw-bg-opacity: 1;
2327
2372
  background-color: rgb(156 163 175 / var(--tw-bg-opacity));
@@ -2508,6 +2553,10 @@ body {
2508
2553
  --tw-bg-opacity: 1;
2509
2554
  background-color: rgb(191 219 254 / var(--tw-bg-opacity));
2510
2555
  }
2556
+ :is(.dark .dark\:bg-gray-200) {
2557
+ --tw-bg-opacity: 1;
2558
+ background-color: rgb(229 231 235 / var(--tw-bg-opacity));
2559
+ }
2511
2560
  :is(.dark .dark\:bg-gray-600) {
2512
2561
  --tw-bg-opacity: 1;
2513
2562
  background-color: rgb(75 85 99 / var(--tw-bg-opacity));
@@ -2572,6 +2621,10 @@ body {
2572
2621
  --tw-text-opacity: 1;
2573
2622
  color: rgb(107 114 128 / var(--tw-text-opacity));
2574
2623
  }
2624
+ :is(.dark .dark\:text-gray-800) {
2625
+ --tw-text-opacity: 1;
2626
+ color: rgb(31 41 55 / var(--tw-text-opacity));
2627
+ }
2575
2628
  :is(.dark .dark\:text-green-800) {
2576
2629
  --tw-text-opacity: 1;
2577
2630
  color: rgb(22 101 52 / var(--tw-text-opacity));
package/src/tailwind.css CHANGED
@@ -22,6 +22,24 @@
22
22
  var(--border-radius) - calc(var(--border-radius) / 3)
23
23
  );
24
24
  }
25
+
26
+ .inline-code {
27
+ font-size: 0.75rem;
28
+ /* color: theme("colors.slate.500"); */
29
+ /* background-color: theme("colors.stone.100"); */
30
+ border-radius: theme("borderRadius.DEFAULT");
31
+ /* padding-left: theme("spacing[1.5]");
32
+ padding-right: theme("spacing[1.5]");
33
+ padding-top: theme("spacing.1");
34
+ padding-bottom: theme("spacing.1"); */
35
+ padding: theme("spacing.1") theme("spacing[1.5]");
36
+ /* margin: theme("spacing.0") theme("spacing.1"); */
37
+
38
+ border: theme("colors.gray.300") 1px solid;
39
+ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
40
+ Liberation Mono, Courier New, monospace;
41
+ }
42
+
25
43
  input[type="number"]::-webkit-inner-spin-button,
26
44
  input[type="number"]::-webkit-outer-spin-button {
27
45
  -webkit-appearance: none;