aural-ui 2.1.10 → 2.1.11
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/components/breadcrumb/index.tsx +5 -3
- package/dist/components/otp-inputs/index.tsx +39 -4
- package/dist/components/typography/meta.ts +1 -0
- package/dist/fonts/Nunito-VariableFont_wght.ttf +0 -0
- package/dist/icons/index.ts +2 -0
- package/dist/icons/phone-icon/PhoneIcon.stories.tsx +1034 -0
- package/dist/icons/phone-icon/index.tsx +26 -0
- package/dist/icons/phone-icon/meta.ts +8 -0
- package/dist/icons/shield-icon/ShieldIcon.stories.tsx +991 -0
- package/dist/icons/shield-icon/index.tsx +21 -0
- package/dist/icons/shield-icon/meta.ts +8 -0
- package/dist/index.js +1 -1
- package/dist/styles/aural-theme.css +1 -0
- package/package.json +1 -1
|
@@ -60,7 +60,8 @@ const BreadCrumbItem = ({
|
|
|
60
60
|
separator?: "chevron" | "slash" | "arrow"
|
|
61
61
|
customSeparator?: React.ReactNode
|
|
62
62
|
}) => {
|
|
63
|
-
const handleClick = () => {
|
|
63
|
+
const handleClick = (e: React.MouseEvent<HTMLAnchorElement>) => {
|
|
64
|
+
e.preventDefault()
|
|
64
65
|
if (isClickable && onItemClick) {
|
|
65
66
|
onItemClick(title, url)
|
|
66
67
|
}
|
|
@@ -124,7 +125,8 @@ const BreadCrumbItem = ({
|
|
|
124
125
|
return (
|
|
125
126
|
<div className="flex items-center gap-1 md:gap-3">
|
|
126
127
|
{isClickable && url ? (
|
|
127
|
-
<
|
|
128
|
+
<a
|
|
129
|
+
href={url}
|
|
128
130
|
onClick={handleClick}
|
|
129
131
|
className={cn(
|
|
130
132
|
"focus-visible:ring-ring rounded-sm transition-colors duration-200 focus-visible:ring-2 focus-visible:ring-offset-2",
|
|
@@ -138,7 +140,7 @@ const BreadCrumbItem = ({
|
|
|
138
140
|
>
|
|
139
141
|
{title}
|
|
140
142
|
</Typography>
|
|
141
|
-
</
|
|
143
|
+
</a>
|
|
142
144
|
) : (
|
|
143
145
|
<Typography
|
|
144
146
|
variant={typographyVariant}
|
|
@@ -31,6 +31,8 @@ interface SingleOtpInputType {
|
|
|
31
31
|
onChange: (event: React.ChangeEvent<HTMLInputElement>) => void
|
|
32
32
|
onFocus: () => void
|
|
33
33
|
onKeyDown: (event: React.KeyboardEvent<HTMLInputElement>) => void
|
|
34
|
+
onPaste?: (event: React.ClipboardEvent<HTMLInputElement>) => void
|
|
35
|
+
|
|
34
36
|
style?: React.CSSProperties
|
|
35
37
|
value: string | undefined
|
|
36
38
|
type?: "text" | "number"
|
|
@@ -100,10 +102,6 @@ export default function OtpInputs(props: OTPInputsType) {
|
|
|
100
102
|
}
|
|
101
103
|
}
|
|
102
104
|
|
|
103
|
-
const onBlur = () => {
|
|
104
|
-
setActiveInput(-1)
|
|
105
|
-
}
|
|
106
|
-
|
|
107
105
|
const handleOnKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {
|
|
108
106
|
switch (e.key) {
|
|
109
107
|
case "Backspace":
|
|
@@ -138,6 +136,42 @@ export default function OtpInputs(props: OTPInputsType) {
|
|
|
138
136
|
}
|
|
139
137
|
}
|
|
140
138
|
|
|
139
|
+
const handleOnPaste = (e: React.ClipboardEvent<HTMLInputElement>) => {
|
|
140
|
+
e.preventDefault()
|
|
141
|
+
const pastedData = e.clipboardData.getData("text/plain")
|
|
142
|
+
|
|
143
|
+
const validChars = pastedData
|
|
144
|
+
.split("")
|
|
145
|
+
.map((char) => getRightValue(char))
|
|
146
|
+
.filter((char) => char !== "")
|
|
147
|
+
.slice(0, length)
|
|
148
|
+
|
|
149
|
+
if (validChars.length === 0) return
|
|
150
|
+
|
|
151
|
+
const updatedOTPValues = [...otpValues]
|
|
152
|
+
let currentIndex = activeInput
|
|
153
|
+
for (let i = 0; i < validChars.length && currentIndex < length; i++) {
|
|
154
|
+
updatedOTPValues[currentIndex] = validChars[i]
|
|
155
|
+
currentIndex++
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
setOTPValues(updatedOTPValues)
|
|
159
|
+
handleOtpChange(updatedOTPValues)
|
|
160
|
+
|
|
161
|
+
const nextEmptyIndex = updatedOTPValues.findIndex(
|
|
162
|
+
(val, idx) => idx >= activeInput && val === ""
|
|
163
|
+
)
|
|
164
|
+
const focusIndex =
|
|
165
|
+
nextEmptyIndex !== -1
|
|
166
|
+
? nextEmptyIndex
|
|
167
|
+
: Math.min(length - 1, activeInput + validChars.length)
|
|
168
|
+
focusInput(focusIndex)
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
const onBlur = () => {
|
|
172
|
+
setActiveInput(-1)
|
|
173
|
+
}
|
|
174
|
+
|
|
141
175
|
const messagesMap = {
|
|
142
176
|
true: messages?.success ?? "✓ Valid input",
|
|
143
177
|
false: messages?.error ?? "✗ Invalid input. Try again",
|
|
@@ -168,6 +202,7 @@ export default function OtpInputs(props: OTPInputsType) {
|
|
|
168
202
|
value={otpValues && otpValues[index]}
|
|
169
203
|
autoComplete="off"
|
|
170
204
|
onFocus={handleOnFocus(index)}
|
|
205
|
+
onPaste={handleOnPaste}
|
|
171
206
|
onChange={handleOnChange}
|
|
172
207
|
onKeyDown={handleOnKeyDown}
|
|
173
208
|
onBlur={onBlur}
|
|
Binary file
|
package/dist/icons/index.ts
CHANGED
|
@@ -71,6 +71,7 @@ export * from "./paper-plane-icon"
|
|
|
71
71
|
export * from "./pause-icon"
|
|
72
72
|
export * from "./pencil-icon"
|
|
73
73
|
export * from "./plus-icon"
|
|
74
|
+
export * from "./phone-icon"
|
|
74
75
|
export * from "./search-icon"
|
|
75
76
|
export * from "./setting-icon"
|
|
76
77
|
export * from "./share-icon"
|
|
@@ -84,6 +85,7 @@ export * from "./spinner-solid-neutral-icon"
|
|
|
84
85
|
export * from "./star-icon"
|
|
85
86
|
export * from "./store-coin-icon"
|
|
86
87
|
export * from "./suggestion-icon"
|
|
88
|
+
export * from "./shield-icon"
|
|
87
89
|
export * from "./sun-icon"
|
|
88
90
|
export * from "./text-color-icon"
|
|
89
91
|
export * from "./text-indicator-icon"
|