@sikka/hawa 0.1.27 → 0.1.29
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/dist/styles.css +25 -3
- package/es/elements/Input.d.ts +1 -0
- package/es/elements/Separator.d.ts +4 -0
- package/es/elements/Textarea.d.ts +1 -0
- package/es/elements/index.d.ts +2 -0
- package/es/index.es.js +3 -3
- package/lib/elements/Input.d.ts +1 -0
- package/lib/elements/Separator.d.ts +4 -0
- package/lib/elements/Textarea.d.ts +1 -0
- package/lib/elements/index.d.ts +2 -0
- package/lib/index.js +3 -3
- package/package.json +2 -1
- package/src/elements/HawaTextField.tsx +26 -84
- package/src/elements/Input.tsx +8 -3
- package/src/elements/Separator.tsx +29 -0
- package/src/elements/Tabs.tsx +1 -1
- package/src/elements/Textarea.tsx +16 -10
- package/src/elements/index.ts +2 -0
- package/src/styles.css +25 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sikka/hawa",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.29",
|
|
4
4
|
"description": "SaaS Oriented UI Kit",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.es.js",
|
|
@@ -109,6 +109,7 @@
|
|
|
109
109
|
"@radix-ui/react-dropdown-menu": "^2.0.5",
|
|
110
110
|
"@radix-ui/react-label": "^2.0.2",
|
|
111
111
|
"@radix-ui/react-popover": "^1.0.6",
|
|
112
|
+
"@radix-ui/react-separator": "^1.0.3",
|
|
112
113
|
"@radix-ui/react-tabs": "^1.0.4",
|
|
113
114
|
"@radix-ui/react-tooltip": "^1.0.6",
|
|
114
115
|
"class-variance-authority": "^0.7.0",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { FC, PropsWithRef } from "react"
|
|
2
|
-
import clsx from "clsx"
|
|
3
2
|
import { Label } from "./Label"
|
|
3
|
+
import { cn } from "../util"
|
|
4
4
|
|
|
5
5
|
// TODO: make icon based on direction
|
|
6
6
|
// TODO: Preferebly use context to pass direction rtl | ltr
|
|
@@ -51,98 +51,40 @@ export const HawaTextField: FC<TextFieldTypes> = ({
|
|
|
51
51
|
full: "w-full",
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
let defaultStyle = "flex max-h-fit flex-col justify-center gap-
|
|
54
|
+
let defaultStyle = "flex max-h-fit flex-col justify-center gap-1"
|
|
55
55
|
let defaultInputStyle =
|
|
56
|
-
"block w-full rounded border bg-background p-2 text-sm text-black dark:text-white focus:border-blue-500 focus:ring-blue-500"
|
|
56
|
+
"block w-full rounded border transition-all bg-background p-2 text-sm text-black dark:text-white focus:border-blue-500 focus:ring-blue-500"
|
|
57
57
|
let previewInputStyle =
|
|
58
58
|
"block w-full rounded 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"
|
|
59
59
|
// "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",
|
|
60
60
|
|
|
61
61
|
return (
|
|
62
|
-
<div
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
// >
|
|
70
|
-
// {props.label}
|
|
71
|
-
// </label>
|
|
72
|
-
<Label>{props.label}</Label>
|
|
73
|
-
)}
|
|
74
|
-
{preview ? (
|
|
75
|
-
<>
|
|
76
|
-
{props.multiline ? (
|
|
77
|
-
<textarea
|
|
78
|
-
id="message"
|
|
79
|
-
rows={4}
|
|
80
|
-
className={defaultInputStyle}
|
|
81
|
-
onChange={props.onChange}
|
|
82
|
-
type={props.type}
|
|
83
|
-
aria-label={props.label}
|
|
84
|
-
placeholder={props.placeholder}
|
|
85
|
-
defaultValue={props.defaultValue}
|
|
86
|
-
value={props.value}
|
|
87
|
-
{...props}
|
|
88
|
-
/>
|
|
89
|
-
) : (
|
|
90
|
-
<div className="relative">
|
|
91
|
-
{props.icon && (
|
|
92
|
-
<div className="absolute left-3 top-1/2 -translate-y-1/2">
|
|
93
|
-
{props.icon}
|
|
94
|
-
</div>
|
|
95
|
-
)}
|
|
96
|
-
<input
|
|
97
|
-
{...props}
|
|
98
|
-
disabled={preview}
|
|
99
|
-
className={clsx(previewInputStyle, props.icon ? "pl-10" : "")}
|
|
100
|
-
/>
|
|
101
|
-
{/* <div
|
|
102
|
-
// {...props}
|
|
103
|
-
className={clsx(previewInputStyle, props.icon ? "pl-10" : "")}
|
|
104
|
-
>
|
|
105
|
-
{props.value}
|
|
106
|
-
</div> */}
|
|
107
|
-
</div>
|
|
108
|
-
)}
|
|
109
|
-
</>
|
|
110
|
-
) : (
|
|
111
|
-
<>
|
|
112
|
-
{props.multiline ? (
|
|
113
|
-
<textarea
|
|
114
|
-
id="message"
|
|
115
|
-
rows={4}
|
|
116
|
-
className={defaultInputStyle}
|
|
117
|
-
onChange={props.onChange}
|
|
118
|
-
type={props.type}
|
|
119
|
-
aria-label={props.label}
|
|
120
|
-
placeholder={props.placeholder}
|
|
121
|
-
defaultValue={props.defaultValue}
|
|
122
|
-
value={props.value}
|
|
123
|
-
{...props}
|
|
124
|
-
/>
|
|
125
|
-
) : (
|
|
126
|
-
<div className="relative">
|
|
127
|
-
{props.icon && (
|
|
128
|
-
<div className="absolute left-3 top-1/2 -translate-y-1/2">
|
|
129
|
-
{props.icon}
|
|
130
|
-
</div>
|
|
131
|
-
)}
|
|
132
|
-
<input
|
|
133
|
-
{...props}
|
|
134
|
-
className={clsx(defaultInputStyle, props.icon ? "pl-10" : "")}
|
|
135
|
-
/>
|
|
62
|
+
<div className={cn(defaultStyle, marginStyles[margin], widthStyles[width])}>
|
|
63
|
+
{props.label && <Label>{props.label}</Label>}
|
|
64
|
+
<>
|
|
65
|
+
<div className="relative">
|
|
66
|
+
{props.icon && (
|
|
67
|
+
<div className="absolute left-3 top-1/2 -translate-y-1/2">
|
|
68
|
+
{props.icon}
|
|
136
69
|
</div>
|
|
137
70
|
)}
|
|
71
|
+
<input
|
|
72
|
+
{...props}
|
|
73
|
+
className={cn(
|
|
74
|
+
defaultInputStyle,
|
|
75
|
+
props.icon && "pl-10",
|
|
76
|
+
preview && "border-transparent px-0"
|
|
77
|
+
)}
|
|
78
|
+
disabled={preview}
|
|
79
|
+
/>
|
|
80
|
+
</div>
|
|
138
81
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
)}
|
|
82
|
+
{props.helpertext ? (
|
|
83
|
+
<p className="mb-0 mt-1 text-xs text-red-600 dark:text-red-500">
|
|
84
|
+
{props.helpertext}
|
|
85
|
+
</p>
|
|
86
|
+
) : null}
|
|
87
|
+
</>
|
|
146
88
|
</div>
|
|
147
89
|
)
|
|
148
90
|
}
|
package/src/elements/Input.tsx
CHANGED
|
@@ -3,17 +3,22 @@ import * as React from "react"
|
|
|
3
3
|
import { cn } from "../util"
|
|
4
4
|
|
|
5
5
|
export interface InputProps
|
|
6
|
-
extends React.InputHTMLAttributes<HTMLInputElement> {
|
|
6
|
+
extends React.InputHTMLAttributes<HTMLInputElement> {
|
|
7
|
+
preview?: boolean
|
|
8
|
+
}
|
|
7
9
|
|
|
8
10
|
const Input = React.forwardRef<HTMLInputElement, InputProps>(
|
|
9
|
-
({ className, type, ...props }, ref) => {
|
|
11
|
+
({ className, preview, type, ...props }, ref) => {
|
|
10
12
|
return (
|
|
11
13
|
<input
|
|
12
14
|
type={type}
|
|
13
15
|
className={cn(
|
|
14
16
|
"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
|
|
15
|
-
className
|
|
17
|
+
className,
|
|
18
|
+
preview &&
|
|
19
|
+
" disabled:cursor-default disabled:opacity-100 border-opacity-25 "
|
|
16
20
|
)}
|
|
21
|
+
disabled={preview}
|
|
17
22
|
ref={ref}
|
|
18
23
|
{...props}
|
|
19
24
|
/>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import * as SeparatorPrimitive from "@radix-ui/react-separator"
|
|
3
|
+
|
|
4
|
+
import { cn } from "../util"
|
|
5
|
+
|
|
6
|
+
const Separator = React.forwardRef<
|
|
7
|
+
React.ElementRef<typeof SeparatorPrimitive.Root>,
|
|
8
|
+
React.ComponentPropsWithoutRef<typeof SeparatorPrimitive.Root>
|
|
9
|
+
>(
|
|
10
|
+
(
|
|
11
|
+
{ className, orientation = "horizontal", decorative = true, ...props },
|
|
12
|
+
ref
|
|
13
|
+
) => (
|
|
14
|
+
<SeparatorPrimitive.Root
|
|
15
|
+
ref={ref}
|
|
16
|
+
decorative={decorative}
|
|
17
|
+
orientation={orientation}
|
|
18
|
+
className={cn(
|
|
19
|
+
"shrink-0 bg-border",
|
|
20
|
+
orientation === "horizontal" ? "h-[1px] w-full" : "h-full w-[1px]",
|
|
21
|
+
className
|
|
22
|
+
)}
|
|
23
|
+
{...props}
|
|
24
|
+
/>
|
|
25
|
+
)
|
|
26
|
+
)
|
|
27
|
+
Separator.displayName = SeparatorPrimitive.Root.displayName
|
|
28
|
+
|
|
29
|
+
export { Separator }
|
package/src/elements/Tabs.tsx
CHANGED
|
@@ -52,7 +52,7 @@ const TabsList = React.forwardRef<
|
|
|
52
52
|
<TabsPrimitive.List
|
|
53
53
|
ref={ref}
|
|
54
54
|
className={cn(
|
|
55
|
-
"flex w-fit flex-wrap items-center justify-start gap-1
|
|
55
|
+
"flex w-fit flex-wrap items-center justify-start gap-1 rounded border bg-muted p-1 text-muted-foreground ",
|
|
56
56
|
orientation === "horizontal" ? "flex-col" : "flex-row",
|
|
57
57
|
className
|
|
58
58
|
)}
|
|
@@ -1,21 +1,27 @@
|
|
|
1
1
|
import * as React from "react"
|
|
2
2
|
|
|
3
3
|
import { cn } from "../util"
|
|
4
|
+
import { Label } from "./Label"
|
|
4
5
|
|
|
5
6
|
export interface TextareaProps
|
|
6
|
-
extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {
|
|
7
|
+
extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {
|
|
8
|
+
label?: string
|
|
9
|
+
}
|
|
7
10
|
|
|
8
11
|
const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(
|
|
9
|
-
({ className, ...props }, ref) => {
|
|
12
|
+
({ className, label, ...props }, ref) => {
|
|
10
13
|
return (
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
className
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
<>
|
|
15
|
+
{label && <Label htmlFor={props.id}>{label}</Label>}
|
|
16
|
+
<textarea
|
|
17
|
+
className={cn(
|
|
18
|
+
"flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
|
|
19
|
+
className
|
|
20
|
+
)}
|
|
21
|
+
ref={ref}
|
|
22
|
+
{...props}
|
|
23
|
+
/>
|
|
24
|
+
</>
|
|
19
25
|
)
|
|
20
26
|
}
|
|
21
27
|
)
|
package/src/elements/index.ts
CHANGED
package/src/styles.css
CHANGED
|
@@ -887,6 +887,9 @@ video {
|
|
|
887
887
|
.mb-5 {
|
|
888
888
|
margin-bottom: 1.25rem;
|
|
889
889
|
}
|
|
890
|
+
.mb-6 {
|
|
891
|
+
margin-bottom: 1.5rem;
|
|
892
|
+
}
|
|
890
893
|
.ml-0 {
|
|
891
894
|
margin-left: 0px;
|
|
892
895
|
}
|
|
@@ -959,6 +962,9 @@ video {
|
|
|
959
962
|
.mt-1\.5 {
|
|
960
963
|
margin-top: 0.375rem;
|
|
961
964
|
}
|
|
965
|
+
.mt-10 {
|
|
966
|
+
margin-top: 2.5rem;
|
|
967
|
+
}
|
|
962
968
|
.mt-14 {
|
|
963
969
|
margin-top: 3.5rem;
|
|
964
970
|
}
|
|
@@ -1235,6 +1241,9 @@ video {
|
|
|
1235
1241
|
.w-\[190px\] {
|
|
1236
1242
|
width: 190px;
|
|
1237
1243
|
}
|
|
1244
|
+
.w-\[1px\] {
|
|
1245
|
+
width: 1px;
|
|
1246
|
+
}
|
|
1238
1247
|
.w-\[25px\] {
|
|
1239
1248
|
width: 25px;
|
|
1240
1249
|
}
|
|
@@ -1548,9 +1557,6 @@ video {
|
|
|
1548
1557
|
.gap-8 {
|
|
1549
1558
|
gap: 2rem;
|
|
1550
1559
|
}
|
|
1551
|
-
.gap-9 {
|
|
1552
|
-
gap: 2.25rem;
|
|
1553
|
-
}
|
|
1554
1560
|
.gap-\[2px\] {
|
|
1555
1561
|
gap: 2px;
|
|
1556
1562
|
}
|
|
@@ -1859,6 +1865,9 @@ video {
|
|
|
1859
1865
|
.border-b-primary {
|
|
1860
1866
|
border-bottom-color: hsl(var(--primary));
|
|
1861
1867
|
}
|
|
1868
|
+
.border-opacity-25 {
|
|
1869
|
+
--tw-border-opacity: 0.25;
|
|
1870
|
+
}
|
|
1862
1871
|
.bg-background {
|
|
1863
1872
|
background-color: hsl(var(--background));
|
|
1864
1873
|
}
|
|
@@ -1890,6 +1899,9 @@ video {
|
|
|
1890
1899
|
--tw-bg-opacity: 1;
|
|
1891
1900
|
background-color: rgb(59 130 246 / var(--tw-bg-opacity));
|
|
1892
1901
|
}
|
|
1902
|
+
.bg-border {
|
|
1903
|
+
background-color: hsl(var(--border));
|
|
1904
|
+
}
|
|
1893
1905
|
.bg-buttonPrimary-500 {
|
|
1894
1906
|
background-color: hsl(var(--button-primary-500));
|
|
1895
1907
|
}
|
|
@@ -2111,6 +2123,10 @@ video {
|
|
|
2111
2123
|
.p-\[5px\] {
|
|
2112
2124
|
padding: 5px;
|
|
2113
2125
|
}
|
|
2126
|
+
.px-0 {
|
|
2127
|
+
padding-left: 0px;
|
|
2128
|
+
padding-right: 0px;
|
|
2129
|
+
}
|
|
2114
2130
|
.px-1 {
|
|
2115
2131
|
padding-left: 0.25rem;
|
|
2116
2132
|
padding-right: 0.25rem;
|
|
@@ -3149,6 +3165,9 @@ body {
|
|
|
3149
3165
|
.disabled\:pointer-events-none:disabled {
|
|
3150
3166
|
pointer-events: none;
|
|
3151
3167
|
}
|
|
3168
|
+
.disabled\:cursor-default:disabled {
|
|
3169
|
+
cursor: default;
|
|
3170
|
+
}
|
|
3152
3171
|
.disabled\:cursor-not-allowed:disabled {
|
|
3153
3172
|
cursor: not-allowed;
|
|
3154
3173
|
}
|
|
@@ -3156,6 +3175,9 @@ body {
|
|
|
3156
3175
|
--tw-bg-opacity: 1;
|
|
3157
3176
|
background-color: rgb(229 231 235 / var(--tw-bg-opacity));
|
|
3158
3177
|
}
|
|
3178
|
+
.disabled\:opacity-100:disabled {
|
|
3179
|
+
opacity: 1;
|
|
3180
|
+
}
|
|
3159
3181
|
.disabled\:opacity-50:disabled {
|
|
3160
3182
|
opacity: 0.5;
|
|
3161
3183
|
}
|