@sikka/hawa 0.0.215 → 0.0.217

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.215",
3
+ "version": "0.0.217",
4
4
  "description": "SaaS Oriented UI Kit",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.es.js",
@@ -23,7 +23,7 @@ const Control: React.FunctionComponent<ControlTypes> = ({
23
23
  }) => {
24
24
  let sizeStyles = {
25
25
  small: "h-7 text-xs",
26
- normal: "h-10 text-sm",
26
+ normal: "h-[2.33rem] text-sm",
27
27
  large: "",
28
28
  }
29
29
  return (
@@ -109,6 +109,7 @@ type SelectTypes = {
109
109
  value?: any
110
110
  children?: any
111
111
  getOptionLabel?: any
112
+ disabled?: boolean
112
113
  }
113
114
  export const HawaSelect: React.FunctionComponent<SelectTypes> = (props) => {
114
115
  return (
@@ -120,6 +121,7 @@ export const HawaSelect: React.FunctionComponent<SelectTypes> = (props) => {
120
121
  )}
121
122
  {!props.isCreatable && (
122
123
  <Select
124
+ isDisabled={props.disabled}
123
125
  options={props.options}
124
126
  isClearable={props.isClearable}
125
127
  isMulti={props.isMulti}
@@ -8,6 +8,7 @@ import { HawaRadio } from "./HawaRadio"
8
8
  type SettingsRowTypes = {
9
9
  settingsLabel: string
10
10
  settingsType: "text" | "radio" | "boolean" | "color" | "range"
11
+ settingsDescription?: string
11
12
  radioProps: {
12
13
  defaultValue: any
13
14
  onChangeTab: any
@@ -26,6 +27,7 @@ type SettingsRowTypes = {
26
27
  export const HawaSettingsRow: React.FunctionComponent<SettingsRowTypes> = ({
27
28
  settingsLabel,
28
29
  settingsType,
30
+ settingsDescription,
29
31
  colorProps,
30
32
  rangeProps,
31
33
  radioProps,
@@ -34,7 +36,9 @@ export const HawaSettingsRow: React.FunctionComponent<SettingsRowTypes> = ({
34
36
  <div className="my-0.5 flex h-20 max-h-fit flex-row items-center justify-between rounded bg-white p-6 align-middle">
35
37
  <div>
36
38
  <div>{settingsLabel}</div>
37
- <div className="text-sm">Text here like a description</div>
39
+ {settingsDescription && (
40
+ <div className="text-sm">{settingsDescription}</div>
41
+ )}{" "}
38
42
  </div>
39
43
  {settingsType === "text" && <HawaTextField margin="none" width="small" />}
40
44
  {settingsType === "boolean" && <HawaSwitch size="large" />}
@@ -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
  )
package/src/styles.css CHANGED
@@ -872,6 +872,9 @@ video {
872
872
  .h-\[1px\] {
873
873
  height: 1px;
874
874
  }
875
+ .h-\[2\.33rem\] {
876
+ height: 2.33rem;
877
+ }
875
878
  .h-\[calc\(100\%-3\.5rem\)\] {
876
879
  height: calc(100% - 3.5rem);
877
880
  }
@@ -1079,6 +1082,9 @@ video {
1079
1082
  .grid-cols-2 {
1080
1083
  grid-template-columns: repeat(2, minmax(0, 1fr));
1081
1084
  }
1085
+ .grid-cols-3 {
1086
+ grid-template-columns: repeat(3, minmax(0, 1fr));
1087
+ }
1082
1088
  .grid-cols-4 {
1083
1089
  grid-template-columns: repeat(4, minmax(0, 1fr));
1084
1090
  }