@customafk/lunas-ui 0.0.2 → 0.0.3-a
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/Atoms/AspectRatio/index.js +2 -0
- package/dist/Atoms/Avatar/index.js +3 -3
- package/dist/Atoms/Badge/index.js +2 -0
- package/dist/Atoms/Breadcrumb/index.js +7 -23
- package/dist/Atoms/Button/index.d.ts +2 -2
- package/dist/Atoms/Button/index.js +2 -0
- package/dist/Atoms/Card/index.js +2 -0
- package/dist/Atoms/Checkbox/index.d.ts +6 -0
- package/dist/Atoms/Checkbox/index.js +276 -0
- package/dist/Atoms/Command/index.d.ts +7 -7
- package/dist/Atoms/Command/index.js +39 -50
- package/dist/Atoms/Dialog/index.js +16 -31
- package/dist/Atoms/DropdownMenu/index.js +2 -0
- package/dist/Atoms/Form/index.js +32 -21
- package/dist/Atoms/Input/index.d.ts +5 -1
- package/dist/Atoms/Input/index.js +45 -543
- package/dist/Atoms/Label/index.js +2 -0
- package/dist/Atoms/MenuItem/index.d.ts +14 -0
- package/dist/Atoms/MenuItem/index.js +287 -0
- package/dist/Atoms/Money/index.js +2 -0
- package/dist/Atoms/Navbar/index.js +2 -0
- package/dist/Atoms/NavigationMenu/index.js +2 -0
- package/dist/Atoms/NumberInput/index.d.ts +7 -0
- package/dist/Atoms/NumberInput/index.js +321 -0
- package/dist/Atoms/Popover/index.d.ts +8 -0
- package/dist/Atoms/Popover/index.js +286 -0
- package/dist/Atoms/Progress/index.js +2 -0
- package/dist/Atoms/QuantityBtn/index.js +2 -0
- package/dist/Atoms/RadioGroup/index.d.ts +7 -0
- package/dist/Atoms/RadioGroup/index.js +285 -0
- package/dist/Atoms/ScrollBar/index.js +4 -2
- package/dist/Atoms/Select/index.js +2 -0
- package/dist/Atoms/Sheet/index.d.ts +29 -0
- package/dist/Atoms/Sheet/index.js +422 -0
- package/dist/Atoms/Slider/index.d.ts +6 -0
- package/dist/Atoms/Slider/index.js +286 -0
- package/dist/Atoms/SmallQuantityBtn/index.d.ts +9 -0
- package/dist/Atoms/SmallQuantityBtn/index.js +110 -0
- package/dist/Atoms/Switch/index.d.ts +6 -0
- package/dist/Atoms/Switch/index.js +293 -0
- package/dist/Atoms/Tabs/index.d.ts +9 -0
- package/dist/Atoms/Tabs/index.js +304 -0
- package/dist/Atoms/Textarea/index.d.ts +5 -0
- package/dist/Atoms/Textarea/index.js +283 -0
- package/dist/Atoms/Tooltip/index.d.ts +10 -0
- package/dist/Atoms/Tooltip/index.js +289 -0
- package/dist/Atoms/UserAvatar/index.d.ts +2 -2
- package/dist/Atoms/UserAvatar/index.js +24 -28
- package/dist/Atoms/XButton/index.d.ts +10 -0
- package/dist/Atoms/XButton/index.js +309 -0
- package/dist/Authentication/SignIn/index.d.ts +1 -1
- package/dist/Authentication/SignIn/index.js +129 -74
- package/dist/Authentication/SignUp/index.d.ts +5 -5
- package/dist/Authentication/SignUp/index.js +181 -110
- package/dist/Authentication/ThankYou/index.js +13 -4
- package/dist/Ecommerce/Categories/index.d.ts +33 -0
- package/dist/Ecommerce/Categories/index.js +1426 -0
- package/dist/Icons/index.d.ts +5 -3
- package/dist/Icons/index.js +126 -97
- package/dist/Molecules/AuthenForm/index.js +30 -21
- package/dist/Molecules/Search/index.js +46 -57
- package/dist/Molecules/UserDropdown/index.js +42 -33
- package/dist/Organisms/Header/index.d.ts +25 -3
- package/dist/Organisms/Header/index.js +585 -324
- package/dist/hooks/index.d.ts +1 -54
- package/dist/hooks/index.js +3 -127
- package/dist/{types-BgHhiNa-.d.ts → types-BlE003QY.d.ts} +1 -1
- package/package.json +85 -41
package/dist/Atoms/Form/index.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
1
3
|
// packages/Atoms/Form/index.tsx
|
|
2
4
|
import * as React2 from "react";
|
|
3
5
|
import {
|
|
4
|
-
Controller
|
|
5
|
-
FormProvider
|
|
6
|
-
useFormContext
|
|
6
|
+
Controller,
|
|
7
|
+
FormProvider,
|
|
8
|
+
useFormContext
|
|
7
9
|
} from "react-hook-form";
|
|
8
10
|
|
|
9
11
|
// packages/Atoms/Label/index.tsx
|
|
@@ -266,17 +268,17 @@ Label.displayName = LabelPrimitive.Root.displayName;
|
|
|
266
268
|
// packages/Atoms/Form/index.tsx
|
|
267
269
|
import { Slot } from "@radix-ui/react-slot";
|
|
268
270
|
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
269
|
-
var Form =
|
|
271
|
+
var Form = FormProvider;
|
|
270
272
|
var FormFieldContext = React2.createContext({});
|
|
271
273
|
var FormField = ({
|
|
272
274
|
...props
|
|
273
275
|
}) => {
|
|
274
|
-
return /* @__PURE__ */ jsx2(FormFieldContext.Provider, { value: { name: props.name }, children: /* @__PURE__ */ jsx2(
|
|
276
|
+
return /* @__PURE__ */ jsx2(FormFieldContext.Provider, { value: { name: props.name }, children: /* @__PURE__ */ jsx2(Controller, { ...props }) });
|
|
275
277
|
};
|
|
276
278
|
var useFormField = () => {
|
|
277
279
|
const fieldContext = React2.useContext(FormFieldContext);
|
|
278
280
|
const itemContext = React2.useContext(FormItemContext);
|
|
279
|
-
const { getFieldState, formState } =
|
|
281
|
+
const { getFieldState, formState } = useFormContext();
|
|
280
282
|
const fieldState = getFieldState(fieldContext.name, formState);
|
|
281
283
|
if (!fieldContext) {
|
|
282
284
|
throw new Error("useFormField should be used within <FormField>");
|
|
@@ -293,55 +295,64 @@ var useFormField = () => {
|
|
|
293
295
|
};
|
|
294
296
|
var FormItemContext = React2.createContext({});
|
|
295
297
|
var FormItem = React2.forwardRef(
|
|
296
|
-
({ className, ...props },
|
|
298
|
+
({ className, ...props }, ref) => {
|
|
297
299
|
const id = React2.useId();
|
|
298
|
-
return /* @__PURE__ */ jsx2(FormItemContext.Provider, { value: { id }, children: /* @__PURE__ */ jsx2("div", { ref
|
|
300
|
+
return /* @__PURE__ */ jsx2(FormItemContext.Provider, { value: { id }, children: /* @__PURE__ */ jsx2("div", { ref, className: cn("space-y-2", className), ...props }) });
|
|
299
301
|
}
|
|
300
302
|
);
|
|
301
303
|
FormItem.displayName = "FormItem";
|
|
302
|
-
var FormLabel = React2.forwardRef(({ className, ...props },
|
|
304
|
+
var FormLabel = React2.forwardRef(({ className, ...props }, ref) => {
|
|
303
305
|
const { error, formItemId } = useFormField();
|
|
304
306
|
return /* @__PURE__ */ jsx2(
|
|
305
307
|
Label,
|
|
306
308
|
{
|
|
307
|
-
ref
|
|
308
|
-
className: cn(error && "text-destructive", className),
|
|
309
|
+
ref,
|
|
310
|
+
className: cn(error && "text-ui-destructive-500", className),
|
|
309
311
|
htmlFor: formItemId,
|
|
310
312
|
...props
|
|
311
313
|
}
|
|
312
314
|
);
|
|
313
315
|
});
|
|
314
316
|
FormLabel.displayName = "FormLabel";
|
|
315
|
-
var FormControl = React2.forwardRef(({ ...props },
|
|
316
|
-
const { formItemId } = useFormField();
|
|
317
|
-
return /* @__PURE__ */ jsx2(
|
|
317
|
+
var FormControl = React2.forwardRef(({ ...props }, ref) => {
|
|
318
|
+
const { error, formItemId, formDescriptionId, formMessageId } = useFormField();
|
|
319
|
+
return /* @__PURE__ */ jsx2(
|
|
320
|
+
Slot,
|
|
321
|
+
{
|
|
322
|
+
ref,
|
|
323
|
+
id: formItemId,
|
|
324
|
+
"aria-describedby": !error ? `${formDescriptionId}` : `${formDescriptionId} ${formMessageId}`,
|
|
325
|
+
"aria-invalid": !!error,
|
|
326
|
+
...props
|
|
327
|
+
}
|
|
328
|
+
);
|
|
318
329
|
});
|
|
319
330
|
FormControl.displayName = "FormControl";
|
|
320
|
-
var FormDescription = React2.forwardRef(({ className, ...props },
|
|
331
|
+
var FormDescription = React2.forwardRef(({ className, ...props }, ref) => {
|
|
321
332
|
const { formDescriptionId } = useFormField();
|
|
322
333
|
return /* @__PURE__ */ jsx2(
|
|
323
334
|
"p",
|
|
324
335
|
{
|
|
325
|
-
ref
|
|
336
|
+
ref,
|
|
326
337
|
id: formDescriptionId,
|
|
327
|
-
className: cn("text-
|
|
338
|
+
className: cn("text-sm text-ui-text-500", className),
|
|
328
339
|
...props
|
|
329
340
|
}
|
|
330
341
|
);
|
|
331
342
|
});
|
|
332
343
|
FormDescription.displayName = "FormDescription";
|
|
333
|
-
var FormMessage = React2.forwardRef(({ className, children, ...props },
|
|
344
|
+
var FormMessage = React2.forwardRef(({ className, children, ...props }, ref) => {
|
|
334
345
|
const { error, formMessageId } = useFormField();
|
|
335
346
|
const body = error ? String(error?.message) : children;
|
|
336
347
|
if (!body) {
|
|
337
|
-
return
|
|
348
|
+
return null;
|
|
338
349
|
}
|
|
339
350
|
return /* @__PURE__ */ jsx2(
|
|
340
351
|
"p",
|
|
341
352
|
{
|
|
342
|
-
ref
|
|
353
|
+
ref,
|
|
343
354
|
id: formMessageId,
|
|
344
|
-
className: cn("text-
|
|
355
|
+
className: cn("text-sm font-medium text-ui-destructive-500", className),
|
|
345
356
|
...props,
|
|
346
357
|
children: body
|
|
347
358
|
}
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { HTMLAttributes, ReactNode, ChangeEvent } from 'react';
|
|
3
3
|
|
|
4
|
-
interface IInputProps extends HTMLAttributes<
|
|
4
|
+
interface IInputProps extends HTMLAttributes<HTMLInputElement> {
|
|
5
5
|
icon?: ReactNode;
|
|
6
6
|
placeholder?: string;
|
|
7
7
|
isErrored?: boolean;
|
|
8
|
+
inputClassName?: string;
|
|
9
|
+
value?: string | number | readonly string[];
|
|
8
10
|
onChange?: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
11
|
+
onBlur?: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
12
|
+
onFocus?: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
9
13
|
}
|
|
10
14
|
declare const Input: React.MemoExoticComponent<React.ForwardRefExoticComponent<IInputProps & React.RefAttributes<HTMLDivElement>>>;
|
|
11
15
|
|