@sikka/hawa 0.0.102 → 0.0.103

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.102",
3
+ "version": "0.0.103",
4
4
  "description": "UI Kit",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.es.js",
@@ -7,7 +7,9 @@ type TCheckBoxTypes = {
7
7
  onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void
8
8
  }
9
9
 
10
- export const HawaCheckbox: React.FunctionComponent<TCheckBoxTypes> = (props) => {
10
+ export const HawaCheckbox: React.FunctionComponent<TCheckBoxTypes> = (
11
+ props
12
+ ) => {
11
13
  return (
12
14
  <div
13
15
  className={
@@ -20,13 +22,13 @@ export const HawaCheckbox: React.FunctionComponent<TCheckBoxTypes> = (props) =>
20
22
  type="checkbox"
21
23
  value=""
22
24
  onChange={(e) => props.onChange(e)}
23
- className="h-5 w-4 rounded border-gray-300 bg-gray-100 text-blue-600 focus:ring-2 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:ring-offset-gray-800 dark:focus:ring-blue-600"
25
+ className="mt-0.5 rounded border-gray-300 bg-gray-100 text-blue-600 focus:ring-2 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:ring-offset-gray-800 dark:focus:ring-blue-600"
24
26
  {...props}
25
27
  />
26
28
  {(props.label || props.helperText) && (
27
- <div className="items-stat flex flex-col">
29
+ <div className=" flex flex-col">
28
30
  {props.label && (
29
- <label className="ml-2 text-sm font-medium text-gray-900 dark:text-gray-300">
31
+ <label className="mx-2 text-sm font-medium text-gray-900 dark:text-gray-300">
30
32
  {props.label}
31
33
  </label>
32
34
  )}
@@ -1,33 +1,36 @@
1
- import React from "react"
1
+ import React, { useState } from "react"
2
2
 
3
3
  type RadioTypes = {
4
- options: any
4
+ options?: any
5
+ onChangeTab?: any
6
+ defaultValue?: any
5
7
  }
6
8
  export const HawaRadio: React.FunctionComponent<RadioTypes> = (props) => {
9
+ const [selectedOption, setSelectedOption] = useState(props.defaultValue)
10
+ let activeTabStyle =
11
+ "inline-block py-2 px-4 text-white bg-blue-600 rounded-lg active"
12
+ let inactiveTabStyle =
13
+ "inline-block py-2 px-4 rounded-lg hover:text-gray-900 hover:bg-gray-100 dark:hover:bg-gray-800 dark:hover:text-white"
14
+
7
15
  return (
8
16
  <div>
9
- <ul className="w-full items-center rounded-lg border border-gray-200 bg-white text-sm font-medium text-gray-900 dark:border-gray-600 dark:bg-gray-700 dark:text-white sm:flex">
10
- {props.options.map((option: any) => {
11
- return (
12
- <li className="w-full border-b border-gray-200 dark:border-gray-600 sm:border-b-0 sm:border-r">
13
- <div className="flex items-center pl-3">
14
- <input
15
- id="horizontal-list-radio-license"
16
- type="radio"
17
- value=""
18
- name="list-radio"
19
- className="h-4 w-4 border-gray-300 bg-gray-100 text-blue-600 focus:ring-2 focus:ring-blue-500 dark:border-gray-500 dark:bg-gray-600 dark:ring-offset-gray-700 dark:focus:ring-blue-600"
20
- />
21
- <label
22
- htmlFor="horizontal-list-radio-license"
23
- className="ml-2 w-full py-3 text-sm font-medium text-gray-900 dark:text-gray-300"
24
- >
25
- {option.label}
26
- </label>
27
- </div>
28
- </li>
29
- )
30
- })}
17
+ <ul className="flex w-fit flex-wrap rounded-lg bg-gray-100 text-center text-sm font-medium text-gray-500 dark:text-gray-400">
18
+ {props.options?.map((opt: any) => (
19
+ <li>
20
+ <button
21
+ aria-current="page"
22
+ onClick={() => {
23
+ setSelectedOption(opt.value)
24
+ props.onChangeTab(opt.value)
25
+ }}
26
+ className={
27
+ selectedOption === opt.value ? activeTabStyle : inactiveTabStyle
28
+ }
29
+ >
30
+ {opt.label}
31
+ </button>
32
+ </li>
33
+ ))}
31
34
  </ul>
32
35
  </div>
33
36
  )
@@ -4,13 +4,11 @@ import { HawaTextField } from "./HawaTextField"
4
4
  import { HawaSwitch } from "./HawaSwitch"
5
5
  import { HawaColorPicker } from "./HawaColorPicker"
6
6
  import { HawaRange } from "./HawaRange"
7
- import { HawaCheckbox } from "./HawaCheckbox"
8
- import { HawaTabs } from "./HawaTabs"
9
7
  import { HawaRadio } from "./HawaRadio"
10
8
 
11
9
  type SettingsRowTypes = {
12
10
  settingsLabel: any
13
- settingsType: "checkbox" | "text" | "radio" | "boolean" | "color" | "range"
11
+ settingsType: "text" | "radio" | "boolean" | "color" | "range"
14
12
  radioProps: {
15
13
  defaultValue: any
16
14
  onChangeTab: any
@@ -34,14 +32,13 @@ export const HawaSettingsRow: React.FunctionComponent<SettingsRowTypes> = ({
34
32
  radioProps,
35
33
  }) => {
36
34
  return (
37
- <div className="my-2 flex max-h-fit flex-row items-center justify-between rounded-xl bg-white px-4 py-2 pr-2 align-middle">
35
+ <div className="my-0.5 flex max-h-fit flex-row items-center justify-between rounded-xl bg-white px-4 py-2 pr-2 align-middle">
38
36
  <HawaTypography>{settingsLabel}</HawaTypography>
39
- {settingsType === "checkbox" && <HawaCheckbox centered />}
40
37
  {settingsType === "text" && <HawaTextField margin="none" width="small" />}
41
38
  {settingsType === "boolean" && <HawaSwitch />}
42
39
  {settingsType === "range" && <HawaRange {...rangeProps} />}
43
40
  {settingsType === "color" && <HawaColorPicker {...colorProps} />}
44
- {settingsType === "radio" && <HawaTabs {...radioProps} />}
41
+ {settingsType === "radio" && <HawaRadio {...radioProps} />}
45
42
  </div>
46
43
  )
47
44
  }
@@ -1,3 +1,4 @@
1
+ import clsx from "clsx"
1
2
  import React, { useState } from "react"
2
3
 
3
4
  type TabsTypes = {
@@ -8,13 +9,18 @@ type TabsTypes = {
8
9
  export const HawaTabs: React.FunctionComponent<TabsTypes> = (props) => {
9
10
  const [selectedOption, setSelectedOption] = useState(props.defaultValue)
10
11
  let activeTabStyle =
11
- "inline-block py-2 px-4 text-white bg-blue-600 rounded-lg active"
12
+ "inline-block py-2 px-4 text-white bg-primary-500 rounded-lg rounded-br-none rounded-bl-none active"
12
13
  let inactiveTabStyle =
13
- "inline-block py-2 px-4 rounded-lg hover:text-gray-900 hover:bg-gray-100 dark:hover:bg-gray-800 dark:hover:text-white"
14
+ "inline-block py-2 px-4 rounded-lg rounded-br-none rounded-bl-none hover:text-gray-900 hover:bg-gray-100 dark:hover:bg-gray-800 dark:hover:text-white"
14
15
 
15
16
  return (
16
17
  <div>
17
- <ul className="flex w-fit flex-wrap rounded-lg bg-gray-100 text-center text-sm font-medium text-gray-500 dark:text-gray-400">
18
+ <ul
19
+ className={clsx(
20
+ "flex w-fit flex-wrap rounded-lg rounded-br-none rounded-bl-none border-b-primary-500 bg-gray-100 text-center text-sm font-medium text-gray-500 dark:text-gray-400",
21
+ selectedOption ? "border-b-2" : "border-b-0"
22
+ )}
23
+ >
18
24
  {props.options?.map((opt: any) => (
19
25
  <li>
20
26
  <button
@@ -23,9 +29,12 @@ export const HawaTabs: React.FunctionComponent<TabsTypes> = (props) => {
23
29
  setSelectedOption(opt.value)
24
30
  props.onChangeTab(opt.value)
25
31
  }}
26
- className={
27
- selectedOption === opt.value ? activeTabStyle : inactiveTabStyle
28
- }
32
+ className={clsx(
33
+ selectedOption === opt.value
34
+ ? activeTabStyle
35
+ : inactiveTabStyle,
36
+ "transition-all"
37
+ )}
29
38
  >
30
39
  {opt.label}
31
40
  </button>
package/src/styles.css CHANGED
@@ -587,6 +587,14 @@ video {
587
587
  margin-top: 1.75rem;
588
588
  margin-bottom: 1.75rem;
589
589
  }
590
+ .my-0\.5 {
591
+ margin-top: 0.125rem;
592
+ margin-bottom: 0.125rem;
593
+ }
594
+ .my-0 {
595
+ margin-top: 0px;
596
+ margin-bottom: 0px;
597
+ }
590
598
  .ml-auto {
591
599
  margin-left: auto;
592
600
  }
@@ -599,8 +607,11 @@ video {
599
607
  .mb-4 {
600
608
  margin-bottom: 1rem;
601
609
  }
602
- .ml-2 {
603
- margin-left: 0.5rem;
610
+ .mt-0\.5 {
611
+ margin-top: 0.125rem;
612
+ }
613
+ .mt-0 {
614
+ margin-top: 0px;
604
615
  }
605
616
  .mt-1 {
606
617
  margin-top: 0.25rem;
@@ -626,6 +637,9 @@ video {
626
637
  .ml-1 {
627
638
  margin-left: 0.25rem;
628
639
  }
640
+ .ml-2 {
641
+ margin-left: 0.5rem;
642
+ }
629
643
  .mt-2 {
630
644
  margin-top: 0.5rem;
631
645
  }
@@ -687,9 +701,6 @@ video {
687
701
  .h-11 {
688
702
  height: 2.75rem;
689
703
  }
690
- .h-4 {
691
- height: 1rem;
692
- }
693
704
  .h-2 {
694
705
  height: 0.5rem;
695
706
  }
@@ -740,9 +751,6 @@ video {
740
751
  .w-1\/2 {
741
752
  width: 50%;
742
753
  }
743
- .w-4 {
744
- width: 1rem;
745
- }
746
754
  .w-24 {
747
755
  width: 6rem;
748
756
  }
@@ -1036,6 +1044,9 @@ video {
1036
1044
  .rounded-br-lg {
1037
1045
  border-bottom-right-radius: 0.5rem;
1038
1046
  }
1047
+ .rounded-br-none {
1048
+ border-bottom-right-radius: 0px;
1049
+ }
1039
1050
  .border {
1040
1051
  border-width: 1px;
1041
1052
  }
@@ -1108,6 +1119,10 @@ video {
1108
1119
  --tw-border-opacity: 1;
1109
1120
  border-top-color: rgb(255 255 255 / var(--tw-border-opacity));
1110
1121
  }
1122
+ .border-b-primary-500 {
1123
+ --tw-border-opacity: 1;
1124
+ border-bottom-color: rgb(61 147 249 / var(--tw-border-opacity));
1125
+ }
1111
1126
  .bg-gray-900 {
1112
1127
  --tw-bg-opacity: 1;
1113
1128
  background-color: rgb(17 24 39 / var(--tw-bg-opacity));
@@ -1280,9 +1295,6 @@ video {
1280
1295
  .pr-3 {
1281
1296
  padding-right: 0.75rem;
1282
1297
  }
1283
- .pl-3 {
1284
- padding-left: 0.75rem;
1285
- }
1286
1298
  .pt-0 {
1287
1299
  padding-top: 0px;
1288
1300
  }
@@ -1708,10 +1720,6 @@ body {
1708
1720
  --tw-border-opacity: 1;
1709
1721
  border-color: rgb(59 130 246 / var(--tw-border-opacity));
1710
1722
  }
1711
- .dark .dark\:border-gray-500 {
1712
- --tw-border-opacity: 1;
1713
- border-color: rgb(107 114 128 / var(--tw-border-opacity));
1714
- }
1715
1723
  .dark .dark\:bg-gray-800 {
1716
1724
  --tw-bg-opacity: 1;
1717
1725
  background-color: rgb(31 41 55 / var(--tw-bg-opacity));
@@ -1807,9 +1815,6 @@ body {
1807
1815
  .dark .dark\:ring-offset-gray-800 {
1808
1816
  --tw-ring-offset-color: #1f2937;
1809
1817
  }
1810
- .dark .dark\:ring-offset-gray-700 {
1811
- --tw-ring-offset-color: #374151;
1812
- }
1813
1818
  .dark .dark\:hover\:bg-gray-600:hover {
1814
1819
  --tw-bg-opacity: 1;
1815
1820
  background-color: rgb(75 85 99 / var(--tw-bg-opacity));
@@ -1880,18 +1885,6 @@ body {
1880
1885
  }
1881
1886
  @media (min-width: 640px) {
1882
1887
 
1883
- .sm\:flex {
1884
- display: flex;
1885
- }
1886
-
1887
- .sm\:border-b-0 {
1888
- border-bottom-width: 0px;
1889
- }
1890
-
1891
- .sm\:border-r {
1892
- border-right-width: 1px;
1893
- }
1894
-
1895
1888
  .sm\:p-8 {
1896
1889
  padding: 2rem;
1897
1890
  }