@sikka/hawa 0.47.0-next → 0.48.0-next

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.
@@ -64,6 +64,7 @@ type RegisterFormTextsTypes = ThirdPartyAuthTextsTypes & {
64
64
  fullName?: BaseInputType;
65
65
  email?: TextInputType;
66
66
  username?: UsernameInputType;
67
+ phone?: TextInputType;
67
68
  password?: PasswordInputType;
68
69
  confirm?: ConfirmInputType;
69
70
  userReference?: BaseInputType;
@@ -64,6 +64,7 @@ type RegisterFormTextsTypes = ThirdPartyAuthTextsTypes & {
64
64
  fullName?: BaseInputType;
65
65
  email?: TextInputType;
66
66
  username?: UsernameInputType;
67
+ phone?: TextInputType;
67
68
  password?: PasswordInputType;
68
69
  confirm?: ConfirmInputType;
69
70
  userReference?: BaseInputType;
@@ -85,6 +85,7 @@ type RegisterFormTextsTypes = ThirdPartyAuthTextsTypes & {
85
85
  fullName?: BaseInputType;
86
86
  email?: TextInputType;
87
87
  username?: UsernameInputType;
88
+ phone?: TextInputType;
88
89
  password?: PasswordInputType;
89
90
  confirm?: ConfirmInputType;
90
91
  userReference?: BaseInputType;
@@ -85,6 +85,7 @@ type RegisterFormTextsTypes = ThirdPartyAuthTextsTypes & {
85
85
  fullName?: BaseInputType;
86
86
  email?: TextInputType;
87
87
  username?: UsernameInputType;
88
+ phone?: TextInputType;
88
89
  password?: PasswordInputType;
89
90
  confirm?: ConfirmInputType;
90
91
  userReference?: BaseInputType;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sikka/hawa",
3
- "version": "0.47.0-next",
3
+ "version": "0.48.0-next",
4
4
  "description": "Modern UI Kit made with Tailwind",
5
5
  "author": {
6
6
  "name": "Sikka Software",
@@ -1,183 +0,0 @@
1
- "use client";
2
- import {
3
- HelperText,
4
- Label,
5
- Skeleton,
6
- cn
7
- } from "./chunk-IFWYR5W2.mjs";
8
-
9
- // elements/input/Input.tsx
10
- import React, { forwardRef, useState } from "react";
11
- var Input = forwardRef(
12
- ({
13
- margin = "none",
14
- width = "full",
15
- preview = false,
16
- forceHideHelperText = false,
17
- labelProps,
18
- placeholder,
19
- showCount,
20
- inputProps,
21
- countPosition = "bottom",
22
- ...props
23
- }, ref) => {
24
- var _a;
25
- const [value, setValue] = useState(props.value || "");
26
- let marginStyles = {
27
- none: "hawa-mb-0",
28
- normal: "hawa-mb-3",
29
- large: "hawa-mb-5"
30
- };
31
- let widthStyles = {
32
- small: "hawa-w-full hawa-max-w-2xs",
33
- normal: "hawa-w-1/2",
34
- full: "hawa-w-full",
35
- auto: ""
36
- };
37
- let defaultStyle = "hawa-flex hawa-max-h-fit hawa-h-fit hawa-relative hawa-flex-col hawa-justify-center hawa-gap-0";
38
- let defaultInputStyle = "hawa-block hawa-w-full hawa-rounded hawa-border hawa-transition-all hawa-bg-background hawa-p-3 hawa-text-sm placeholder:hawa-text-muted-foreground";
39
- const handleChange = (e) => {
40
- let newValue = e.target.value;
41
- setValue(newValue);
42
- if (props.prefixText) {
43
- if (newValue.length < props.prefixText.length) {
44
- newValue = props.prefixText;
45
- } else {
46
- const isSubstring = props.prefixText.startsWith(newValue);
47
- if (!isSubstring && !newValue.startsWith(props.prefixText)) {
48
- newValue = `${props.prefixText}${newValue}`;
49
- }
50
- }
51
- }
52
- if (props.onChange) {
53
- if (props.type === "number" && props.maxLength) {
54
- let v = newValue.replace(/[^0-9]/g, "").slice(0, props.maxLength);
55
- const newEvent = { ...e, target: { ...e.target, value: v } };
56
- setValue(v);
57
- props.onChange(newEvent);
58
- } else {
59
- const newEvent = { ...e, target: { ...e.target, value: newValue } };
60
- setValue(newValue);
61
- props.onChange(newEvent);
62
- }
63
- }
64
- };
65
- const handleKeyDown = (e) => {
66
- if (props.type === "number" && ["e", "E", "+", "-", "."].includes(e.key)) {
67
- e.preventDefault();
68
- }
69
- props.onKeyDown && props.onKeyDown(e);
70
- };
71
- return /* @__PURE__ */ React.createElement(
72
- "div",
73
- {
74
- className: cn(
75
- defaultStyle,
76
- marginStyles[margin],
77
- widthStyles[width],
78
- props.containerClassName,
79
- "hawa-w-full hawa-gap-2"
80
- )
81
- },
82
- props.label && /* @__PURE__ */ React.createElement(Label, { ...labelProps }, props.label),
83
- /* @__PURE__ */ React.createElement("div", { className: "hawa-flex hawa-flex-row hawa-w-full hawa-items-center" }, props.outsidePrefix && /* @__PURE__ */ React.createElement("span", { className: cn("hawa-me-2 hawa-opacity-90", !forceHideHelperText && "hawa-mb-2") }, props.outsidePrefix), props.isLoading ? /* @__PURE__ */ React.createElement("div", { className: "hawa-pb-2 hawa-w-full" }, /* @__PURE__ */ React.createElement(Skeleton, { as: "input" })) : props.isLoadingError ? /* @__PURE__ */ React.createElement("div", { className: "hawa-pb-2 hawa-w-full" }, /* @__PURE__ */ React.createElement(
84
- Skeleton,
85
- {
86
- animation: "none",
87
- className: "hawa-h-[40px] hawa-w-full !hawa-bg-destructive/[0.3]",
88
- content: /* @__PURE__ */ React.createElement("div", { className: "hawa-flex hawa-flex-row hawa-gap-2" }, /* @__PURE__ */ React.createElement(
89
- "svg",
90
- {
91
- xmlns: "http://www.w3.org/2000/svg",
92
- width: "20",
93
- height: "20",
94
- viewBox: "0 0 24 24",
95
- fill: "none",
96
- stroke: "currentColor",
97
- strokeWidth: "2",
98
- strokeLinecap: "round",
99
- strokeLinejoin: "round",
100
- className: "hawa-text-destructive"
101
- },
102
- /* @__PURE__ */ React.createElement("path", { d: "m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3" }),
103
- /* @__PURE__ */ React.createElement("path", { d: "M12 9v4" }),
104
- /* @__PURE__ */ React.createElement("path", { d: "M12 17h.01" })
105
- ), /* @__PURE__ */ React.createElement("span", null, /* @__PURE__ */ React.createElement("span", { className: "hawa-text-destructive" }, props.loadingErrorMesssage || "Error loading data")))
106
- }
107
- )) : /* @__PURE__ */ React.createElement(React.Fragment, null, !props.hideSeparator && /* @__PURE__ */ React.createElement(
108
- "div",
109
- {
110
- className: cn(
111
- "hawa-absolute hawa-top-[22px] hawa-h-[0.8px] hawa-w-full hawa-bg-gray-200 hawa-transition-all dark:hawa-bg-gray-800",
112
- preview ? "hawa-opacity-100" : "hawa-opacity-0"
113
- )
114
- }
115
- ), /* @__PURE__ */ React.createElement("div", { className: "hawa-flex hawa-flex-col hawa-w-full hawa-gap-2" }, /* @__PURE__ */ React.createElement("div", { className: "hawa-relative" }, props.startIcon && /* @__PURE__ */ React.createElement("div", { className: "hawa-absolute hawa-start-3 hawa-top-1/2 hawa--translate-y-1/2" }, props.startIcon), props.endIcon && /* @__PURE__ */ React.createElement(
116
- "div",
117
- {
118
- className: cn(
119
- "hawa-absolute hawa-end-3 hawa-top-1/2 hawa--translate-y-1/2",
120
- (_a = props.endIconProps) == null ? void 0 : _a.className
121
- )
122
- },
123
- props.endIcon
124
- ), /* @__PURE__ */ React.createElement(
125
- "input",
126
- {
127
- required: true,
128
- dir: props.dir,
129
- type: props.type,
130
- value: props.value || value,
131
- onChange: handleChange,
132
- onKeyDown: handleKeyDown,
133
- autoComplete: props.autoComplete,
134
- defaultValue: props.defaultValue,
135
- placeholder,
136
- disabled: props.disabled || preview,
137
- style: { height: 40 },
138
- maxLength: props.maxLength,
139
- ...inputProps,
140
- className: cn(
141
- defaultInputStyle,
142
- "focus-visible:hawa-outline-none focus-visible:hawa-ring-2 focus-visible:hawa-ring-ring focus-visible:hawa-ring-offset-0 dark:hawa-text-white",
143
- {
144
- "hawa-pe-9": props.endIcon,
145
- "hawa-ps-9": props.startIcon,
146
- "hawa-pe-[60px]": countPosition === "center"
147
- },
148
- preview && "hawa-border-transparent hawa-bg-transparent hawa-px-0",
149
- inputProps == null ? void 0 : inputProps.className
150
- )
151
- }
152
- )), !forceHideHelperText && /* @__PURE__ */ React.createElement(HelperText, { helperText: props.helperText }), !props.disabled && forceHideHelperText && /* @__PURE__ */ React.createElement(
153
- "div",
154
- {
155
- className: cn(
156
- "hawa-absolute hawa-end-0 hawa-top-[47px] hawa-z-20 hawa-translate-y-1/2 hawa-rounded hawa-bg-background hawa-text-start hawa-text-xs hawa-text-helper-color hawa-drop-shadow-md hawa-transition-all",
157
- props.helperText ? "hawa-border hawa-p-1" : "hawa-border-none hawa-p-0"
158
- )
159
- },
160
- props.helperText
161
- ), showCount && /* @__PURE__ */ React.createElement(
162
- "div",
163
- {
164
- className: cn(
165
- "hawa-absolute hawa-translate-y-1/2 hawa-text-start hawa-text-xs hawa-transition-all",
166
- {
167
- "hawa-end-0 hawa-top-[62px]": countPosition === "bottom",
168
- "hawa-bottom-[62px] hawa-end-0": countPosition === "top",
169
- "hawa-end-2": countPosition === "center"
170
- }
171
- )
172
- },
173
- props.value ? String(props.value).length : 0,
174
- "/",
175
- props.maxLength
176
- ))))
177
- );
178
- }
179
- );
180
-
181
- export {
182
- Input
183
- };