@codefast/ui 0.3.11-canary.1 → 0.3.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/CHANGELOG.md +36 -0
- package/README.md +34 -14
- package/dist/components/accordion.d.ts +29 -10
- package/dist/components/accordion.js +38 -37
- package/dist/components/alert-dialog.d.ts +60 -24
- package/dist/components/alert-dialog.js +69 -72
- package/dist/components/alert.d.ts +27 -15
- package/dist/components/alert.js +29 -31
- package/dist/components/aspect-ratio.d.ts +8 -4
- package/dist/components/aspect-ratio.js +7 -5
- package/dist/components/avatar.d.ts +17 -6
- package/dist/components/avatar.js +19 -17
- package/dist/components/badge.d.ts +21 -14
- package/dist/components/badge.js +19 -22
- package/dist/components/breadcrumb.d.ts +35 -12
- package/dist/components/breadcrumb.js +48 -54
- package/dist/components/button-group.d.ts +29 -14
- package/dist/components/button-group.js +27 -32
- package/dist/components/button.d.ts +35 -25
- package/dist/components/button.js +50 -48
- package/dist/components/calendar.d.ts +24 -9
- package/dist/components/calendar.js +92 -98
- package/dist/components/card.d.ts +34 -10
- package/dist/components/card.js +39 -37
- package/dist/components/carousel.d.ts +55 -24
- package/dist/components/carousel.js +113 -130
- package/dist/components/chart.d.ts +72 -36
- package/dist/components/chart.js +154 -166
- package/dist/components/checkbox-cards.d.ts +15 -8
- package/dist/components/checkbox-cards.js +22 -25
- package/dist/components/checkbox-group.d.ts +16 -8
- package/dist/components/checkbox-group.js +19 -19
- package/dist/components/checkbox.d.ts +9 -4
- package/dist/components/checkbox.js +14 -14
- package/dist/components/collapsible.d.ts +14 -6
- package/dist/components/collapsible.js +18 -16
- package/dist/components/command.d.ts +55 -23
- package/dist/components/command.js +70 -85
- package/dist/components/context-menu.d.ts +72 -22
- package/dist/components/context-menu.js +88 -109
- package/dist/components/dialog.d.ts +53 -22
- package/dist/components/dialog.js +71 -85
- package/dist/components/drawer.d.ts +60 -28
- package/dist/components/drawer.js +59 -67
- package/dist/components/dropdown-menu.d.ts +73 -22
- package/dist/components/dropdown-menu.js +95 -112
- package/dist/components/empty.d.ts +37 -15
- package/dist/components/empty.js +43 -45
- package/dist/components/field.d.ts +63 -25
- package/dist/components/field.js +88 -104
- package/dist/components/form.d.ts +37 -15
- package/dist/components/form.js +65 -70
- package/dist/components/hover-card.d.ts +21 -7
- package/dist/components/hover-card.js +24 -24
- package/dist/components/input-group.d.ts +53 -28
- package/dist/components/input-group.js +63 -77
- package/dist/components/input-number.d.ts +28 -7
- package/dist/components/input-number.js +55 -59
- package/dist/components/input-otp.d.ts +24 -10
- package/dist/components/input-otp.js +33 -37
- package/dist/components/input-password.d.ts +12 -5
- package/dist/components/input-password.js +31 -32
- package/dist/components/input-search.d.ts +18 -8
- package/dist/components/input-search.js +43 -41
- package/dist/components/input.d.ts +10 -4
- package/dist/components/input.js +9 -7
- package/dist/components/item.d.ts +69 -32
- package/dist/components/item.js +89 -92
- package/dist/components/kbd.d.ts +13 -5
- package/dist/components/kbd.js +13 -11
- package/dist/components/label.d.ts +9 -4
- package/dist/components/label.js +9 -7
- package/dist/components/menubar.d.ts +80 -23
- package/dist/components/menubar.js +97 -118
- package/dist/components/native-select.d.ts +16 -6
- package/dist/components/native-select.js +25 -26
- package/dist/components/navigation-menu.d.ts +36 -12
- package/dist/components/navigation-menu.js +60 -75
- package/dist/components/pagination.d.ts +35 -14
- package/dist/components/pagination.js +54 -69
- package/dist/components/popover.d.ts +24 -8
- package/dist/components/popover.js +28 -28
- package/dist/components/progress-circle.d.ts +106 -88
- package/dist/components/progress-circle.js +106 -138
- package/dist/components/progress.d.ts +10 -4
- package/dist/components/progress.js +14 -14
- package/dist/components/radio-cards.d.ts +10 -4
- package/dist/components/radio-cards.js +22 -23
- package/dist/components/radio-group.d.ts +13 -5
- package/dist/components/radio-group.js +18 -16
- package/dist/components/radio.d.ts +12 -5
- package/dist/components/radio.js +10 -8
- package/dist/components/resizable.d.ts +18 -7
- package/dist/components/resizable.js +22 -22
- package/dist/components/scroll-area.d.ts +33 -20
- package/dist/components/scroll-area.js +84 -88
- package/dist/components/select.d.ts +50 -16
- package/dist/components/select.js +77 -96
- package/dist/components/separator.d.ts +29 -19
- package/dist/components/separator.js +36 -34
- package/dist/components/sheet.d.ts +62 -29
- package/dist/components/sheet.js +79 -100
- package/dist/components/sidebar.d.ts +160 -66
- package/dist/components/sidebar.js +294 -336
- package/dist/components/skeleton.d.ts +9 -4
- package/dist/components/skeleton.js +8 -6
- package/dist/components/slider.d.ts +13 -4
- package/dist/components/slider.js +34 -40
- package/dist/components/sonner.d.ts +10 -7
- package/dist/components/sonner.js +16 -14
- package/dist/components/spinner.d.ts +12 -5
- package/dist/components/spinner.js +33 -35
- package/dist/components/switch.d.ts +9 -4
- package/dist/components/switch.js +13 -11
- package/dist/components/table.d.ts +37 -11
- package/dist/components/table.js +47 -45
- package/dist/components/tabs.d.ts +21 -7
- package/dist/components/tabs.js +24 -22
- package/dist/components/textarea.d.ts +9 -4
- package/dist/components/textarea.js +8 -6
- package/dist/components/toggle-group.d.ts +24 -9
- package/dist/components/toggle-group.js +41 -42
- package/dist/components/toggle.d.ts +25 -17
- package/dist/components/toggle.js +30 -28
- package/dist/components/tooltip.d.ts +24 -8
- package/dist/components/tooltip.js +29 -32
- package/dist/hooks/use-animated-value.d.ts +4 -1
- package/dist/hooks/use-animated-value.js +57 -36
- package/dist/hooks/use-copy-to-clipboard.d.ts +11 -5
- package/dist/hooks/use-copy-to-clipboard.js +39 -20
- package/dist/hooks/use-is-mobile.d.ts +4 -1
- package/dist/hooks/use-is-mobile.js +21 -1
- package/dist/hooks/use-media-query.d.ts +4 -1
- package/dist/hooks/use-media-query.js +45 -18
- package/dist/hooks/use-mutation-observer.d.ts +6 -2
- package/dist/hooks/use-mutation-observer.js +34 -16
- package/dist/hooks/use-pagination.d.ts +22 -14
- package/dist/hooks/use-pagination.js +100 -49
- package/dist/index.d.ts +69 -130
- package/dist/index.js +11 -11
- package/dist/primitives/checkbox-group.d.ts +105 -83
- package/dist/primitives/checkbox-group.js +111 -84
- package/dist/primitives/input-number.d.ts +51 -40
- package/dist/primitives/input-number.js +483 -350
- package/dist/primitives/input.d.ts +48 -42
- package/dist/primitives/input.js +65 -43
- package/dist/primitives/progress-circle.d.ts +79 -48
- package/dist/primitives/progress-circle.js +154 -105
- package/package.json +6 -7
|
@@ -1,65 +1,61 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { cn } from "@codefast/tailwind-variants";
|
|
4
|
-
import { ChevronDownIcon, ChevronUpIcon } from "lucide-react";
|
|
5
2
|
import { buttonVariants } from "./button.js";
|
|
6
3
|
import { Spinner } from "./spinner.js";
|
|
7
|
-
import { DecrementButton, Field, IncrementButton,
|
|
4
|
+
import { DecrementButton as InputNumberDecrementButton, Field as InputNumberField, IncrementButton as InputNumberIncrementButton, InputNumber as InputNumber$1 } from "../primitives/input-number.js";
|
|
5
|
+
import { cn } from "@codefast/tailwind-variants";
|
|
6
|
+
import { ChevronDownIcon, ChevronUpIcon } from "lucide-react";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
//#region src/components/input-number.tsx
|
|
8
9
|
function InputNumber({ ariaDecrementLabel, ariaIncrementLabel, className, defaultValue, disabled, formatOptions, id, loaderPosition, loading, max, min, onChange, prefix, readOnly, spinner, step, suffix, value, ...props }) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
children: /*#__PURE__*/ jsx(ChevronDownIcon, {})
|
|
59
|
-
})
|
|
60
|
-
]
|
|
61
|
-
})
|
|
62
|
-
]
|
|
63
|
-
});
|
|
10
|
+
return /* @__PURE__ */ jsxs(InputNumber$1, {
|
|
11
|
+
ariaDecrementLabel,
|
|
12
|
+
ariaIncrementLabel,
|
|
13
|
+
className: cn("group peer flex h-9 w-full grow items-center gap-3 rounded-lg border border-input px-3 pr-0 text-base transition not-has-disabled:shadow-xs focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50 hover:not-has-disabled:not-focus-within:border-ring/60 has-disabled:opacity-50 has-aria-invalid:border-destructive focus-within:has-aria-invalid:ring-destructive/20 hover:not-has-disabled:not-focus-within:has-aria-invalid:border-destructive/60 md:text-sm dark:bg-input/30 dark:focus-within:has-aria-invalid:ring-destructive/40 [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&>svg]:text-muted-foreground", className),
|
|
14
|
+
"data-slot": "input-number",
|
|
15
|
+
defaultValue,
|
|
16
|
+
disabled,
|
|
17
|
+
formatOptions,
|
|
18
|
+
id,
|
|
19
|
+
loaderPosition,
|
|
20
|
+
loading,
|
|
21
|
+
max,
|
|
22
|
+
min,
|
|
23
|
+
prefix,
|
|
24
|
+
readOnly,
|
|
25
|
+
spinner: spinner ?? /* @__PURE__ */ jsx(Spinner, {}, "spinner"),
|
|
26
|
+
step,
|
|
27
|
+
suffix,
|
|
28
|
+
value,
|
|
29
|
+
onChange,
|
|
30
|
+
children: [/* @__PURE__ */ jsx(InputNumberField, {
|
|
31
|
+
autoCapitalize: "none",
|
|
32
|
+
autoComplete: "off",
|
|
33
|
+
autoCorrect: "off",
|
|
34
|
+
className: "h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none selection:bg-primary selection:text-primary-foreground file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:aria-invalid:ring-destructive/40",
|
|
35
|
+
spellCheck: "false",
|
|
36
|
+
...props
|
|
37
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
38
|
+
className: cn("group-hover:not-group-focus-within:not-has-disabled:border-l-border-ring/60 group-hover:not-group-focus-within:not-has-disabled:divide-border-ring/60 order-last ml-auto grid h-full shrink-0 divide-y divide-input border-l border-l-input transition group-focus-within:divide-ring group-focus-within:border-l-ring group-has-aria-invalid:divide-destructive group-has-aria-invalid:border-l-destructive group-hover:group-has-aria-invalid:not-group-focus-within:not-has-disabled:divide-destructive/60 group-hover:group-has-aria-invalid:not-group-focus-within:not-has-disabled:border-l-destructive/60", "*:[button]:focus-visible:bg-ring/50 *:[button]:focus-visible:ring-0 group-has-aria-invalid:*:[button]:focus-visible:bg-destructive/20 dark:group-has-aria-invalid:*:[button]:focus-visible:bg-destructive/40"),
|
|
39
|
+
"data-slot": "input-number-buttons",
|
|
40
|
+
children: [/* @__PURE__ */ jsx(InputNumberIncrementButton, {
|
|
41
|
+
"aria-label": "Increment",
|
|
42
|
+
className: buttonVariants({
|
|
43
|
+
className: "text-muted-foreground h-auto rounded-none rounded-tr-[calc(var(--radius-lg)-1px)]",
|
|
44
|
+
variant: "ghost"
|
|
45
|
+
}),
|
|
46
|
+
"data-slot": "input-number-increment-button",
|
|
47
|
+
children: /* @__PURE__ */ jsx(ChevronUpIcon, {})
|
|
48
|
+
}), /* @__PURE__ */ jsx(InputNumberDecrementButton, {
|
|
49
|
+
"aria-label": "Decrement",
|
|
50
|
+
className: buttonVariants({
|
|
51
|
+
className: "text-muted-foreground h-auto rounded-none rounded-br-[calc(var(--radius-lg)-1px)]",
|
|
52
|
+
variant: "ghost"
|
|
53
|
+
}),
|
|
54
|
+
"data-slot": "input-number-decrement-button",
|
|
55
|
+
children: /* @__PURE__ */ jsx(ChevronDownIcon, {})
|
|
56
|
+
})]
|
|
57
|
+
})]
|
|
58
|
+
});
|
|
64
59
|
}
|
|
60
|
+
//#endregion
|
|
65
61
|
export { InputNumber };
|
|
@@ -1,15 +1,29 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { OTPInput } from "input-otp";
|
|
1
|
+
import { ComponentProps, JSX } from "react";
|
|
2
|
+
import { OTPInput, REGEXP_ONLY_CHARS, REGEXP_ONLY_DIGITS, REGEXP_ONLY_DIGITS_AND_CHARS } from "input-otp";
|
|
3
|
+
|
|
4
|
+
//#region src/components/input-otp.d.ts
|
|
3
5
|
type InputOTPProps = ComponentProps<typeof OTPInput>;
|
|
4
|
-
declare function InputOTP({
|
|
6
|
+
declare function InputOTP({
|
|
7
|
+
className,
|
|
8
|
+
containerClassName,
|
|
9
|
+
...props
|
|
10
|
+
}: InputOTPProps): JSX.Element;
|
|
5
11
|
type InputOTPGroupProps = ComponentProps<"div">;
|
|
6
|
-
declare function InputOTPGroup({
|
|
12
|
+
declare function InputOTPGroup({
|
|
13
|
+
className,
|
|
14
|
+
...props
|
|
15
|
+
}: InputOTPGroupProps): JSX.Element;
|
|
7
16
|
interface InputOTPSlotProps extends ComponentProps<"div"> {
|
|
8
|
-
|
|
17
|
+
index: number;
|
|
9
18
|
}
|
|
10
|
-
declare function InputOTPSlot({
|
|
19
|
+
declare function InputOTPSlot({
|
|
20
|
+
className,
|
|
21
|
+
index,
|
|
22
|
+
...props
|
|
23
|
+
}: InputOTPSlotProps): JSX.Element;
|
|
11
24
|
type InputOTPSeparatorProps = ComponentProps<"div">;
|
|
12
|
-
declare function InputOTPSeparator({
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
25
|
+
declare function InputOTPSeparator({
|
|
26
|
+
...props
|
|
27
|
+
}: InputOTPSeparatorProps): JSX.Element;
|
|
28
|
+
//#endregion
|
|
29
|
+
export { InputOTP, InputOTPGroup, type InputOTPGroupProps, type InputOTPProps, InputOTPSeparator, type InputOTPSeparatorProps, InputOTPSlot, type InputOTPSlotProps, REGEXP_ONLY_CHARS, REGEXP_ONLY_DIGITS, REGEXP_ONLY_DIGITS_AND_CHARS };
|
|
@@ -1,50 +1,46 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
2
|
import { cn } from "@codefast/tailwind-variants";
|
|
4
|
-
import { OTPInput, OTPInputContext, REGEXP_ONLY_CHARS, REGEXP_ONLY_DIGITS, REGEXP_ONLY_DIGITS_AND_CHARS } from "input-otp";
|
|
5
3
|
import { MinusIcon } from "lucide-react";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
5
|
import { use } from "react";
|
|
6
|
+
import { OTPInput, OTPInputContext, REGEXP_ONLY_CHARS, REGEXP_ONLY_DIGITS, REGEXP_ONLY_DIGITS_AND_CHARS } from "input-otp";
|
|
7
|
+
//#region src/components/input-otp.tsx
|
|
7
8
|
function InputOTP({ className, containerClassName, ...props }) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
return /* @__PURE__ */ jsx(OTPInput, {
|
|
10
|
+
"aria-label": "One-time password",
|
|
11
|
+
className: cn(className),
|
|
12
|
+
containerClassName: cn("flex items-center gap-2 has-disabled:opacity-50", containerClassName),
|
|
13
|
+
"data-slot": "input-otp",
|
|
14
|
+
...props
|
|
15
|
+
});
|
|
15
16
|
}
|
|
16
17
|
function InputOTPGroup({ className, ...props }) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
return /* @__PURE__ */ jsx("div", {
|
|
19
|
+
className: cn("flex items-center -space-x-px", className),
|
|
20
|
+
"data-slot": "input-otp-group",
|
|
21
|
+
role: "group",
|
|
22
|
+
...props
|
|
23
|
+
});
|
|
23
24
|
}
|
|
24
25
|
function InputOTPSlot({ className, index, ...props }) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
children: /*#__PURE__*/ jsx("div", {
|
|
37
|
-
className: "h-4 w-px animate-caret-blink bg-foreground animation-duration-1000"
|
|
38
|
-
})
|
|
39
|
-
}) : null
|
|
40
|
-
]
|
|
41
|
-
});
|
|
26
|
+
const { char, hasFakeCaret, isActive } = use(OTPInputContext).slots[index];
|
|
27
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
28
|
+
className: cn("relative flex size-9 items-center justify-center border border-input text-sm outline-hidden transition-all not-has-disabled:shadow-xs first:rounded-l-lg last:rounded-r-lg aria-invalid:border-destructive data-[active=true]:z-10 data-[active=true]:border-ring data-[active=true]:ring-3 data-[active=true]:ring-ring/50 data-[active=true]:aria-invalid:border-destructive data-[active=true]:aria-invalid:ring-destructive/20 dark:bg-input/30 dark:data-[active=true]:aria-invalid:ring-destructive/40", className),
|
|
29
|
+
"data-active": isActive,
|
|
30
|
+
"data-slot": "input-otp-slot",
|
|
31
|
+
...props,
|
|
32
|
+
children: [char, hasFakeCaret ? /* @__PURE__ */ jsx("div", {
|
|
33
|
+
className: "pointer-events-none absolute inset-0 flex items-center justify-center",
|
|
34
|
+
children: /* @__PURE__ */ jsx("div", { className: "h-4 w-px animate-caret-blink bg-foreground animation-duration-1000" })
|
|
35
|
+
}) : null]
|
|
36
|
+
});
|
|
42
37
|
}
|
|
43
38
|
function InputOTPSeparator({ ...props }) {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
39
|
+
return /* @__PURE__ */ jsx("div", {
|
|
40
|
+
"data-slot": "input-otp-separator",
|
|
41
|
+
...props,
|
|
42
|
+
children: /* @__PURE__ */ jsx(MinusIcon, {})
|
|
43
|
+
});
|
|
49
44
|
}
|
|
45
|
+
//#endregion
|
|
50
46
|
export { InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot, REGEXP_ONLY_CHARS, REGEXP_ONLY_DIGITS, REGEXP_ONLY_DIGITS_AND_CHARS };
|
|
@@ -1,6 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import { InputGroupInput } from "./input-group.js";
|
|
2
|
+
import { ComponentProps, JSX } from "react";
|
|
3
|
+
|
|
4
|
+
//#region src/components/input-password.d.ts
|
|
3
5
|
type InputPasswordProps = Omit<ComponentProps<typeof InputGroupInput>, "type">;
|
|
4
|
-
declare function InputPassword({
|
|
5
|
-
|
|
6
|
-
|
|
6
|
+
declare function InputPassword({
|
|
7
|
+
className,
|
|
8
|
+
disabled,
|
|
9
|
+
readOnly,
|
|
10
|
+
...props
|
|
11
|
+
}: InputPasswordProps): JSX.Element;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { InputPassword, type InputPasswordProps };
|
|
@@ -1,38 +1,37 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
2
|
+
import { InputGroup, InputGroupButton, InputGroupInput } from "./input-group.js";
|
|
3
3
|
import { EyeIcon, EyeOffIcon } from "lucide-react";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
5
|
import { useCallback, useState } from "react";
|
|
5
|
-
|
|
6
|
+
//#region src/components/input-password.tsx
|
|
6
7
|
function InputPassword({ className, disabled, readOnly, ...props }) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
})
|
|
35
|
-
]
|
|
36
|
-
});
|
|
8
|
+
const [type, setType] = useState("password");
|
|
9
|
+
const togglePasswordVisibility = useCallback(() => {
|
|
10
|
+
setType((previous) => previous === "password" ? "text" : "password");
|
|
11
|
+
}, []);
|
|
12
|
+
return /* @__PURE__ */ jsxs(InputGroup, {
|
|
13
|
+
className,
|
|
14
|
+
"data-disabled": disabled ? "true" : void 0,
|
|
15
|
+
"data-slot": "input-password",
|
|
16
|
+
children: [/* @__PURE__ */ jsx(InputGroupInput, {
|
|
17
|
+
autoCapitalize: "none",
|
|
18
|
+
"data-slot": "input-password-item",
|
|
19
|
+
disabled,
|
|
20
|
+
readOnly,
|
|
21
|
+
type,
|
|
22
|
+
...props
|
|
23
|
+
}), /* @__PURE__ */ jsx(InputGroupButton, {
|
|
24
|
+
"aria-label": type === "password" ? "Show password" : "Hide password",
|
|
25
|
+
className: "rounded-full focus-visible:ring-0 focus-visible:not-disabled:bg-input",
|
|
26
|
+
"data-slot": "input-password-toggle",
|
|
27
|
+
disabled,
|
|
28
|
+
size: "icon-sm",
|
|
29
|
+
type: "button",
|
|
30
|
+
variant: "ghost",
|
|
31
|
+
onClick: togglePasswordVisibility,
|
|
32
|
+
children: type === "password" ? /* @__PURE__ */ jsx(EyeOffIcon, {}) : /* @__PURE__ */ jsx(EyeIcon, {})
|
|
33
|
+
})]
|
|
34
|
+
});
|
|
37
35
|
}
|
|
36
|
+
//#endregion
|
|
38
37
|
export { InputPassword };
|
|
@@ -1,10 +1,20 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import { InputGroupInput } from "./input-group.js";
|
|
2
|
+
import { ComponentProps, JSX } from "react";
|
|
3
|
+
|
|
4
|
+
//#region src/components/input-search.d.ts
|
|
3
5
|
interface InputSearchProps extends Omit<ComponentProps<typeof InputGroupInput>, "defaultValue" | "onChange" | "type" | "value"> {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
6
|
+
defaultValue?: string;
|
|
7
|
+
onChange?: (value?: string) => void;
|
|
8
|
+
value?: string;
|
|
7
9
|
}
|
|
8
|
-
declare function InputSearch({
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
declare function InputSearch({
|
|
11
|
+
className,
|
|
12
|
+
defaultValue,
|
|
13
|
+
disabled,
|
|
14
|
+
onChange,
|
|
15
|
+
readOnly,
|
|
16
|
+
value: valueProperty,
|
|
17
|
+
...props
|
|
18
|
+
}: InputSearchProps): JSX.Element;
|
|
19
|
+
//#endregion
|
|
20
|
+
export { InputSearch, type InputSearchProps };
|
|
@@ -1,47 +1,49 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput } from "./input-group.js";
|
|
3
|
+
import { SearchIcon, XIcon } from "lucide-react";
|
|
2
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
5
|
import { useControllableState } from "@radix-ui/react-use-controllable-state";
|
|
4
|
-
|
|
5
|
-
import { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput } from "./input-group.js";
|
|
6
|
+
//#region src/components/input-search.tsx
|
|
6
7
|
function InputSearch({ className, defaultValue, disabled, onChange, readOnly, value: valueProperty, ...props }) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
8
|
+
const [value, setValue] = useControllableState({
|
|
9
|
+
defaultProp: defaultValue,
|
|
10
|
+
onChange,
|
|
11
|
+
prop: valueProperty
|
|
12
|
+
});
|
|
13
|
+
return /* @__PURE__ */ jsxs(InputGroup, {
|
|
14
|
+
className,
|
|
15
|
+
"data-disabled": disabled ? "true" : void 0,
|
|
16
|
+
"data-slot": "input-search",
|
|
17
|
+
children: [
|
|
18
|
+
/* @__PURE__ */ jsx(InputGroupAddon, {
|
|
19
|
+
align: "inline-start",
|
|
20
|
+
children: /* @__PURE__ */ jsx(SearchIcon, {})
|
|
21
|
+
}),
|
|
22
|
+
/* @__PURE__ */ jsx(InputGroupInput, {
|
|
23
|
+
"data-slot": "input-search-item",
|
|
24
|
+
disabled,
|
|
25
|
+
readOnly,
|
|
26
|
+
type: "search",
|
|
27
|
+
value: value ?? "",
|
|
28
|
+
onChange: (event) => {
|
|
29
|
+
setValue(event.target.value);
|
|
30
|
+
},
|
|
31
|
+
...props
|
|
32
|
+
}),
|
|
33
|
+
value ? /* @__PURE__ */ jsx(InputGroupButton, {
|
|
34
|
+
"aria-label": "Clear search",
|
|
35
|
+
className: "rounded-full focus-visible:ring-0 focus-visible:not-disabled:bg-input",
|
|
36
|
+
"data-slot": "input-search-clear",
|
|
37
|
+
disabled: disabled ?? readOnly,
|
|
38
|
+
size: "icon-sm",
|
|
39
|
+
variant: "ghost",
|
|
40
|
+
onClick: () => {
|
|
41
|
+
setValue("");
|
|
42
|
+
},
|
|
43
|
+
children: /* @__PURE__ */ jsx(XIcon, {})
|
|
44
|
+
}) : null
|
|
45
|
+
]
|
|
46
|
+
});
|
|
46
47
|
}
|
|
48
|
+
//#endregion
|
|
47
49
|
export { InputSearch };
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ComponentProps, JSX } from "react";
|
|
2
|
+
|
|
3
|
+
//#region src/components/input.d.ts
|
|
2
4
|
type InputProps = ComponentProps<"input">;
|
|
3
|
-
declare function Input({
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
declare function Input({
|
|
6
|
+
className,
|
|
7
|
+
type,
|
|
8
|
+
...props
|
|
9
|
+
}: InputProps): JSX.Element;
|
|
10
|
+
//#endregion
|
|
11
|
+
export { Input, type InputProps };
|
package/dist/components/input.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx } from "react/jsx-runtime";
|
|
3
2
|
import { cn } from "@codefast/tailwind-variants";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/input.tsx
|
|
4
5
|
function Input({ className, type, ...props }) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
return /* @__PURE__ */ jsx("input", {
|
|
7
|
+
className: cn("h-9 w-full min-w-0 rounded-lg border border-input bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none selection:bg-primary selection:text-primary-foreground file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm dark:bg-input/30", "focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50", "aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40", className),
|
|
8
|
+
"data-slot": "input",
|
|
9
|
+
type,
|
|
10
|
+
...props
|
|
11
|
+
});
|
|
11
12
|
}
|
|
13
|
+
//#endregion
|
|
12
14
|
export { Input };
|
|
@@ -1,45 +1,82 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import { Separator } from "./separator.js";
|
|
2
|
+
import * as _$_codefast_tailwind_variants0 from "@codefast/tailwind-variants";
|
|
3
|
+
import { VariantProps } from "@codefast/tailwind-variants";
|
|
4
|
+
import { ComponentProps, JSX } from "react";
|
|
5
|
+
|
|
6
|
+
//#region src/components/item.d.ts
|
|
7
|
+
declare const itemVariants: _$_codefast_tailwind_variants0.VariantFunctionType<{
|
|
8
|
+
size: {
|
|
9
|
+
default: string;
|
|
10
|
+
sm: string;
|
|
11
|
+
};
|
|
12
|
+
variant: {
|
|
13
|
+
default: string;
|
|
14
|
+
muted: string;
|
|
15
|
+
outline: string;
|
|
16
|
+
};
|
|
14
17
|
}, Record<string, never>>;
|
|
15
|
-
declare const itemMediaVariants:
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
declare const itemMediaVariants: _$_codefast_tailwind_variants0.VariantFunctionType<{
|
|
19
|
+
variant: {
|
|
20
|
+
default: string;
|
|
21
|
+
icon: string;
|
|
22
|
+
image: string;
|
|
23
|
+
};
|
|
21
24
|
}, Record<string, never>>;
|
|
22
25
|
type ItemGroupProps = ComponentProps<"div">;
|
|
23
|
-
declare function ItemGroup({
|
|
26
|
+
declare function ItemGroup({
|
|
27
|
+
className,
|
|
28
|
+
...props
|
|
29
|
+
}: ItemGroupProps): JSX.Element;
|
|
24
30
|
type ItemSeparatorProps = ComponentProps<typeof Separator>;
|
|
25
|
-
declare function ItemSeparator({
|
|
31
|
+
declare function ItemSeparator({
|
|
32
|
+
className,
|
|
33
|
+
...props
|
|
34
|
+
}: ItemSeparatorProps): JSX.Element;
|
|
26
35
|
type ItemProps = ComponentProps<"div"> & VariantProps<typeof itemVariants> & {
|
|
27
|
-
|
|
36
|
+
asChild?: boolean;
|
|
28
37
|
};
|
|
29
|
-
declare function Item({
|
|
38
|
+
declare function Item({
|
|
39
|
+
asChild,
|
|
40
|
+
className,
|
|
41
|
+
size,
|
|
42
|
+
variant,
|
|
43
|
+
...props
|
|
44
|
+
}: ItemProps): JSX.Element;
|
|
30
45
|
type ItemMediaProps = ComponentProps<"div"> & VariantProps<typeof itemMediaVariants>;
|
|
31
|
-
declare function ItemMedia({
|
|
46
|
+
declare function ItemMedia({
|
|
47
|
+
className,
|
|
48
|
+
variant,
|
|
49
|
+
...props
|
|
50
|
+
}: ItemMediaProps): JSX.Element;
|
|
32
51
|
type ItemContentProps = ComponentProps<"div">;
|
|
33
|
-
declare function ItemContent({
|
|
52
|
+
declare function ItemContent({
|
|
53
|
+
className,
|
|
54
|
+
...props
|
|
55
|
+
}: ItemContentProps): JSX.Element;
|
|
34
56
|
type ItemTitleProps = ComponentProps<"div">;
|
|
35
|
-
declare function ItemTitle({
|
|
57
|
+
declare function ItemTitle({
|
|
58
|
+
className,
|
|
59
|
+
...props
|
|
60
|
+
}: ItemTitleProps): JSX.Element;
|
|
36
61
|
type ItemDescriptionProps = ComponentProps<"p">;
|
|
37
|
-
declare function ItemDescription({
|
|
62
|
+
declare function ItemDescription({
|
|
63
|
+
className,
|
|
64
|
+
...props
|
|
65
|
+
}: ItemDescriptionProps): JSX.Element;
|
|
38
66
|
type ItemActionsProps = ComponentProps<"div">;
|
|
39
|
-
declare function ItemActions({
|
|
67
|
+
declare function ItemActions({
|
|
68
|
+
className,
|
|
69
|
+
...props
|
|
70
|
+
}: ItemActionsProps): JSX.Element;
|
|
40
71
|
type ItemHeaderProps = ComponentProps<"div">;
|
|
41
|
-
declare function ItemHeader({
|
|
72
|
+
declare function ItemHeader({
|
|
73
|
+
className,
|
|
74
|
+
...props
|
|
75
|
+
}: ItemHeaderProps): JSX.Element;
|
|
42
76
|
type ItemFooterProps = ComponentProps<"div">;
|
|
43
|
-
declare function ItemFooter({
|
|
44
|
-
|
|
45
|
-
|
|
77
|
+
declare function ItemFooter({
|
|
78
|
+
className,
|
|
79
|
+
...props
|
|
80
|
+
}: ItemFooterProps): JSX.Element;
|
|
81
|
+
//#endregion
|
|
82
|
+
export { Item, ItemActions, type ItemActionsProps, ItemContent, type ItemContentProps, ItemDescription, type ItemDescriptionProps, ItemFooter, type ItemFooterProps, ItemGroup, type ItemGroupProps, ItemHeader, type ItemHeaderProps, ItemMedia, type ItemMediaProps, type ItemProps, ItemSeparator, type ItemSeparatorProps, ItemTitle, type ItemTitleProps, itemMediaVariants, itemVariants };
|