@codefast/ui 0.3.11 → 0.3.12-canary.0
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 +15 -0
- package/README.md +4 -0
- package/dist/components/accordion.d.ts +11 -29
- package/dist/components/accordion.d.ts.map +1 -0
- package/dist/components/accordion.js +10 -37
- package/dist/components/alert-dialog.d.ts +25 -60
- package/dist/components/alert-dialog.d.ts.map +1 -0
- package/dist/components/alert-dialog.js +16 -69
- package/dist/components/alert.d.ts +16 -27
- package/dist/components/alert.d.ts.map +1 -0
- package/dist/components/alert.js +22 -30
- package/dist/components/aspect-ratio.d.ts +5 -8
- package/dist/components/aspect-ratio.d.ts.map +1 -0
- package/dist/components/aspect-ratio.js +5 -7
- package/dist/components/avatar.d.ts +7 -17
- package/dist/components/avatar.d.ts.map +1 -0
- package/dist/components/avatar.js +7 -18
- package/dist/components/badge.d.ts +15 -21
- package/dist/components/badge.d.ts.map +1 -0
- package/dist/components/badge.js +23 -20
- package/dist/components/breadcrumb.d.ts +13 -35
- package/dist/components/breadcrumb.d.ts.map +1 -0
- package/dist/components/breadcrumb.js +13 -49
- package/dist/components/button-group.d.ts +15 -29
- package/dist/components/button-group.d.ts.map +1 -0
- package/dist/components/button-group.js +22 -27
- package/dist/components/button.d.ts +26 -35
- package/dist/components/button.d.ts.map +1 -0
- package/dist/components/button.js +43 -51
- package/dist/components/calendar.d.ts +10 -24
- package/dist/components/calendar.d.ts.map +1 -0
- package/dist/components/calendar.js +75 -92
- package/dist/components/card.d.ts +11 -34
- package/dist/components/card.d.ts.map +1 -0
- package/dist/components/card.js +11 -39
- package/dist/components/carousel.d.ts +25 -55
- package/dist/components/carousel.d.ts.map +1 -0
- package/dist/components/carousel.js +82 -114
- package/dist/components/chart.d.ts +37 -72
- package/dist/components/chart.d.ts.map +1 -0
- package/dist/components/chart.js +161 -150
- package/dist/components/checkbox-cards.d.ts +9 -15
- package/dist/components/checkbox-cards.d.ts.map +1 -0
- package/dist/components/checkbox-cards.js +8 -22
- package/dist/components/checkbox-group.d.ts +9 -16
- package/dist/components/checkbox-group.d.ts.map +1 -0
- package/dist/components/checkbox-group.js +7 -19
- package/dist/components/checkbox.d.ts +5 -9
- package/dist/components/checkbox.d.ts.map +1 -0
- package/dist/components/checkbox.js +6 -14
- package/dist/components/collapsible.d.ts +7 -14
- package/dist/components/collapsible.d.ts.map +1 -0
- package/dist/components/collapsible.js +7 -15
- package/dist/components/command.d.ts +24 -55
- package/dist/components/command.d.ts.map +1 -0
- package/dist/components/command.js +18 -69
- package/dist/components/context-menu.d.ts +23 -72
- package/dist/components/context-menu.d.ts.map +1 -0
- package/dist/components/context-menu.js +21 -89
- package/dist/components/dialog.d.ts +23 -53
- package/dist/components/dialog.d.ts.map +1 -0
- package/dist/components/dialog.js +20 -72
- package/dist/components/drawer.d.ts +29 -60
- package/dist/components/drawer.d.ts.map +1 -0
- package/dist/components/drawer.js +16 -58
- package/dist/components/dropdown-menu.d.ts +23 -73
- package/dist/components/dropdown-menu.d.ts.map +1 -0
- package/dist/components/dropdown-menu.js +21 -96
- package/dist/components/empty.d.ts +16 -37
- package/dist/components/empty.d.ts.map +1 -0
- package/dist/components/empty.js +24 -44
- package/dist/components/field.d.ts +26 -63
- package/dist/components/field.d.ts.map +1 -0
- package/dist/components/field.js +46 -89
- package/dist/components/form.d.ts +16 -37
- package/dist/components/form.d.ts.map +1 -0
- package/dist/components/form.js +50 -66
- package/dist/components/hover-card.d.ts +8 -21
- package/dist/components/hover-card.d.ts.map +1 -0
- package/dist/components/hover-card.js +8 -23
- package/dist/components/input-group.d.ts +29 -53
- package/dist/components/input-group.d.ts.map +1 -0
- package/dist/components/input-group.js +59 -66
- package/dist/components/input-number.d.ts +8 -28
- package/dist/components/input-number.d.ts.map +1 -0
- package/dist/components/input-number.js +14 -55
- package/dist/components/input-otp.d.ts +11 -24
- package/dist/components/input-otp.d.ts.map +1 -0
- package/dist/components/input-otp.js +13 -34
- package/dist/components/input-password.d.ts +6 -12
- package/dist/components/input-password.d.ts.map +1 -0
- package/dist/components/input-password.js +10 -31
- package/dist/components/input-search.d.ts +9 -18
- package/dist/components/input-search.d.ts.map +1 -0
- package/dist/components/input-search.js +16 -44
- package/dist/components/input.d.ts +5 -10
- package/dist/components/input.d.ts.map +1 -0
- package/dist/components/input.js +5 -9
- package/dist/components/item.d.ts +33 -69
- package/dist/components/item.d.ts.map +1 -0
- package/dist/components/item.js +47 -90
- package/dist/components/kbd.d.ts +6 -13
- package/dist/components/kbd.d.ts.map +1 -0
- package/dist/components/kbd.js +6 -13
- package/dist/components/label.d.ts +5 -9
- package/dist/components/label.d.ts.map +1 -0
- package/dist/components/label.js +5 -8
- package/dist/components/menubar.d.ts +24 -80
- package/dist/components/menubar.d.ts.map +1 -0
- package/dist/components/menubar.js +23 -99
- package/dist/components/native-select.d.ts +7 -16
- package/dist/components/native-select.d.ts.map +1 -0
- package/dist/components/native-select.js +7 -25
- package/dist/components/navigation-menu.d.ts +13 -36
- package/dist/components/navigation-menu.d.ts.map +1 -0
- package/dist/components/navigation-menu.js +25 -61
- package/dist/components/pagination.d.ts +15 -35
- package/dist/components/pagination.d.ts.map +1 -0
- package/dist/components/pagination.js +13 -55
- package/dist/components/popover.d.ts +9 -24
- package/dist/components/popover.d.ts.map +1 -0
- package/dist/components/popover.js +9 -27
- package/dist/components/progress-circle.d.ts +89 -106
- package/dist/components/progress-circle.d.ts.map +1 -0
- package/dist/components/progress-circle.js +70 -103
- package/dist/components/progress.d.ts +5 -10
- package/dist/components/progress.d.ts.map +1 -0
- package/dist/components/progress.js +7 -13
- package/dist/components/radio-cards.d.ts +5 -10
- package/dist/components/radio-cards.d.ts.map +1 -0
- package/dist/components/radio-cards.js +7 -21
- package/dist/components/radio-group.d.ts +6 -13
- package/dist/components/radio-group.d.ts.map +1 -0
- package/dist/components/radio-group.js +6 -17
- package/dist/components/radio.d.ts +6 -12
- package/dist/components/radio.d.ts.map +1 -0
- package/dist/components/radio.js +5 -10
- package/dist/components/resizable.d.ts +8 -18
- package/dist/components/resizable.d.ts.map +1 -0
- package/dist/components/resizable.js +7 -21
- package/dist/components/scroll-area.d.ts +21 -33
- package/dist/components/scroll-area.d.ts.map +1 -0
- package/dist/components/scroll-area.js +64 -84
- package/dist/components/select.d.ts +17 -50
- package/dist/components/select.d.ts.map +1 -0
- package/dist/components/select.js +26 -78
- package/dist/components/separator.d.ts +20 -29
- package/dist/components/separator.d.ts.map +1 -0
- package/dist/components/separator.js +27 -36
- package/dist/components/sheet.d.ts +30 -62
- package/dist/components/sheet.d.ts.map +1 -0
- package/dist/components/sheet.js +36 -80
- package/dist/components/sidebar.d.ts +67 -160
- package/dist/components/sidebar.d.ts.map +1 -0
- package/dist/components/sidebar.js +166 -301
- package/dist/components/skeleton.d.ts +5 -9
- package/dist/components/skeleton.d.ts.map +1 -0
- package/dist/components/skeleton.js +5 -8
- package/dist/components/slider.d.ts +5 -13
- package/dist/components/slider.d.ts.map +1 -0
- package/dist/components/slider.js +12 -34
- package/dist/components/sonner.d.ts +8 -10
- package/dist/components/sonner.d.ts.map +1 -0
- package/dist/components/sonner.js +13 -16
- package/dist/components/spinner.d.ts +6 -12
- package/dist/components/spinner.d.ts.map +1 -0
- package/dist/components/spinner.js +20 -33
- package/dist/components/switch.d.ts +5 -9
- package/dist/components/switch.d.ts.map +1 -0
- package/dist/components/switch.js +5 -12
- package/dist/components/table.d.ts +12 -37
- package/dist/components/table.d.ts.map +1 -0
- package/dist/components/table.js +12 -47
- package/dist/components/tabs.d.ts +8 -21
- package/dist/components/tabs.d.ts.map +1 -0
- package/dist/components/tabs.js +8 -23
- package/dist/components/textarea.d.ts +5 -9
- package/dist/components/textarea.d.ts.map +1 -0
- package/dist/components/textarea.js +5 -8
- package/dist/components/toggle-group.d.ts +10 -24
- package/dist/components/toggle-group.d.ts.map +1 -0
- package/dist/components/toggle-group.js +20 -38
- package/dist/components/toggle.d.ts +18 -25
- package/dist/components/toggle.d.ts.map +1 -0
- package/dist/components/toggle.js +24 -29
- package/dist/components/tooltip.d.ts +9 -24
- package/dist/components/tooltip.d.ts.map +1 -0
- package/dist/components/tooltip.js +9 -28
- package/dist/hooks/use-animated-value.d.ts +2 -4
- package/dist/hooks/use-animated-value.d.ts.map +1 -0
- package/dist/hooks/use-animated-value.js +67 -58
- package/dist/hooks/use-copy-to-clipboard.d.ts +6 -11
- package/dist/hooks/use-copy-to-clipboard.d.ts.map +1 -0
- package/dist/hooks/use-copy-to-clipboard.js +42 -39
- package/dist/hooks/use-is-mobile.d.ts +2 -4
- package/dist/hooks/use-is-mobile.d.ts.map +1 -0
- package/dist/hooks/use-is-mobile.js +20 -23
- package/dist/hooks/use-media-query.d.ts +2 -4
- package/dist/hooks/use-media-query.d.ts.map +1 -0
- package/dist/hooks/use-media-query.js +49 -46
- package/dist/hooks/use-mutation-observer.d.ts +3 -6
- package/dist/hooks/use-mutation-observer.d.ts.map +1 -0
- package/dist/hooks/use-mutation-observer.js +33 -34
- package/dist/hooks/use-pagination.d.ts +15 -22
- package/dist/hooks/use-pagination.d.ts.map +1 -0
- package/dist/hooks/use-pagination.js +99 -99
- package/dist/index.d.ts +131 -69
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +68 -69
- package/dist/primitives/checkbox-group.d.ts +84 -105
- package/dist/primitives/checkbox-group.d.ts.map +1 -0
- package/dist/primitives/checkbox-group.js +91 -105
- package/dist/primitives/input-number.d.ts +41 -51
- package/dist/primitives/input-number.d.ts.map +1 -0
- package/dist/primitives/input-number.js +417 -473
- package/dist/primitives/input.d.ts +43 -48
- package/dist/primitives/input.d.ts.map +1 -0
- package/dist/primitives/input.js +67 -66
- package/dist/primitives/progress-circle.d.ts +49 -79
- package/dist/primitives/progress-circle.d.ts.map +1 -0
- package/dist/primitives/progress-circle.js +134 -149
- package/package.json +17 -10
- package/{dist → src}/css/preset.css +1 -1
- /package/{dist → src}/css/amber.css +0 -0
- /package/{dist → src}/css/blue.css +0 -0
- /package/{dist → src}/css/cyan.css +0 -0
- /package/{dist → src}/css/emerald.css +0 -0
- /package/{dist → src}/css/fuchsia.css +0 -0
- /package/{dist → src}/css/gray.css +0 -0
- /package/{dist → src}/css/green.css +0 -0
- /package/{dist → src}/css/indigo.css +0 -0
- /package/{dist → src}/css/lime.css +0 -0
- /package/{dist → src}/css/neutral.css +0 -0
- /package/{dist → src}/css/orange.css +0 -0
- /package/{dist → src}/css/pink.css +0 -0
- /package/{dist → src}/css/purple.css +0 -0
- /package/{dist → src}/css/red.css +0 -0
- /package/{dist → src}/css/rose.css +0 -0
- /package/{dist → src}/css/sky.css +0 -0
- /package/{dist → src}/css/slate.css +0 -0
- /package/{dist → src}/css/stone.css +0 -0
- /package/{dist → src}/css/style.css +0 -0
- /package/{dist → src}/css/teal.css +0 -0
- /package/{dist → src}/css/violet.css +0 -0
- /package/{dist → src}/css/yellow.css +0 -0
- /package/{dist → src}/css/zinc.css +0 -0
|
@@ -1,59 +1,56 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import { Scope } from "@radix-ui/react-context";
|
|
4
|
-
|
|
5
|
-
//#region src/primitives/input.d.ts
|
|
1
|
+
import type { Scope } from "@radix-ui/react-context";
|
|
2
|
+
import type { ComponentProps, JSX, PropsWithChildren, ReactNode } from "react";
|
|
6
3
|
/**
|
|
7
4
|
* Type for adding scope to component props
|
|
8
5
|
*/
|
|
9
6
|
type ScopedProps<P> = P & {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Scope for the Input component context
|
|
9
|
+
*/
|
|
10
|
+
__scopeInput?: Scope;
|
|
14
11
|
};
|
|
15
|
-
declare const createInputScope:
|
|
12
|
+
declare const createInputScope: import("@radix-ui/react-context").CreateScope;
|
|
16
13
|
/**
|
|
17
14
|
* Props for styling and appearance of the Input component
|
|
18
15
|
*/
|
|
19
16
|
interface InputVisualProps {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
17
|
+
/**
|
|
18
|
+
* CSS class name for the input container
|
|
19
|
+
*/
|
|
20
|
+
className?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Element to display before the input
|
|
23
|
+
*/
|
|
24
|
+
prefix?: ReactNode;
|
|
25
|
+
/**
|
|
26
|
+
* Custom spinner element for loading state
|
|
27
|
+
*/
|
|
28
|
+
spinner?: ReactNode;
|
|
29
|
+
/**
|
|
30
|
+
* Element to display after the input
|
|
31
|
+
*/
|
|
32
|
+
suffix?: ReactNode;
|
|
36
33
|
}
|
|
37
34
|
/**
|
|
38
35
|
* Props for the behavior and state of the Input component
|
|
39
36
|
*/
|
|
40
37
|
interface InputBehaviorProps {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
38
|
+
/**
|
|
39
|
+
* Whether the input is disabled
|
|
40
|
+
*/
|
|
41
|
+
disabled?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Position of the loading spinner - either before or after the input
|
|
44
|
+
*/
|
|
45
|
+
loaderPosition?: "prefix" | "suffix";
|
|
46
|
+
/**
|
|
47
|
+
* Whether the input is in the loading state
|
|
48
|
+
*/
|
|
49
|
+
loading?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Whether the input is in read-only mode
|
|
52
|
+
*/
|
|
53
|
+
readOnly?: boolean;
|
|
57
54
|
}
|
|
58
55
|
/**
|
|
59
56
|
* Combined props for the Input component
|
|
@@ -64,9 +61,7 @@ declare function Input(inputProps: ScopedProps<InputProps>): JSX.Element;
|
|
|
64
61
|
* Props for the InputField component
|
|
65
62
|
*/
|
|
66
63
|
type InputFieldProps = ComponentProps<"input">;
|
|
67
|
-
declare function InputField({
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
//#endregion
|
|
72
|
-
export { InputField as Field, InputField, Input, Input as Root, type InputFieldProps, type InputProps, createInputScope };
|
|
64
|
+
declare function InputField({ __scopeInput, ...props }: ScopedProps<InputFieldProps>): JSX.Element;
|
|
65
|
+
export { createInputScope, InputField as Field, Input, InputField, Input as Root };
|
|
66
|
+
export type { InputFieldProps, InputProps };
|
|
67
|
+
//# sourceMappingURL=input.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../src/primitives/input.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,KAAK,EACV,cAAc,EACd,GAAG,EAEH,iBAAiB,EACjB,SAAS,EAEV,MAAM,OAAO,CAAC;AAYf;;GAEG;AACH,KAAK,WAAW,CAAC,CAAC,IAAI,CAAC,GAAG;IACxB;;OAEG;IACH,YAAY,CAAC,EAAE,KAAK,CAAC;CACtB,CAAC;AAEF,QAAA,MAA2B,gBAAgB,+CAAkC,CAAC;AAwB9E;;GAEG;AACH,UAAU,gBAAgB;IACxB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,MAAM,CAAC,EAAE,SAAS,CAAC;IAEnB;;OAEG;IACH,OAAO,CAAC,EAAE,SAAS,CAAC;IAEpB;;OAEG;IACH,MAAM,CAAC,EAAE,SAAS,CAAC;CACpB;AAED;;GAEG;AACH,UAAU,kBAAkB;IAC1B;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;OAEG;IACH,cAAc,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAErC;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;GAEG;AACH,KAAK,UAAU,GAAG,iBAAiB,CAAC,kBAAkB,GAAG,gBAAgB,CAAC,CAAC;AAE3E,iBAAS,KAAK,CAAC,UAAU,EAAE,WAAW,CAAC,UAAU,CAAC,GAAG,GAAG,CAAC,OAAO,CAwF/D;AAQD;;GAEG;AACH,KAAK,eAAe,GAAG,cAAc,CAAC,OAAO,CAAC,CAAC;AAE/C,iBAAS,UAAU,CAAC,EAAE,YAAY,EAAE,GAAG,KAAK,EAAE,EAAE,WAAW,CAAC,eAAe,CAAC,GAAG,GAAG,CAAC,OAAO,CAczF;AAMD,OAAO,EAAE,gBAAgB,EAAE,UAAU,IAAI,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,IAAI,IAAI,EAAE,CAAC;AAEnF,YAAY,EAAE,eAAe,EAAE,UAAU,EAAE,CAAC"}
|
package/dist/primitives/input.js
CHANGED
|
@@ -1,75 +1,76 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useRef } from "react";
|
|
3
|
-
import { createContextScope } from "@radix-ui/react-context";
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
4
2
|
import { useComposedRefs } from "@radix-ui/react-compose-refs";
|
|
5
|
-
|
|
3
|
+
import { createContextScope } from "@radix-ui/react-context";
|
|
4
|
+
import { useRef } from "react";
|
|
5
|
+
/* -----------------------------------------------------------------------------
|
|
6
|
+
* Component: Input
|
|
7
|
+
* -------------------------------------------------------------------------- */
|
|
6
8
|
const INPUT_NAME = "Input";
|
|
7
9
|
const [createInputContext, createInputScope] = createContextScope(INPUT_NAME);
|
|
8
10
|
const [InputContextProvider, useInputContext] = createInputContext(INPUT_NAME);
|
|
9
11
|
function Input(inputProps) {
|
|
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
|
-
loading && loaderPosition === "suffix" ? spinner : suffix
|
|
56
|
-
]
|
|
57
|
-
})
|
|
58
|
-
});
|
|
12
|
+
const { __scopeInput, children, disabled, loaderPosition = "prefix", loading, prefix, readOnly, spinner, suffix, ...props } = inputProps;
|
|
13
|
+
/**
|
|
14
|
+
* Reference to the input element
|
|
15
|
+
*/
|
|
16
|
+
const inputRef = useRef(null);
|
|
17
|
+
/**
|
|
18
|
+
* Handles pointer down events on the input container
|
|
19
|
+
* Focuses the input element when clicking on the container
|
|
20
|
+
*
|
|
21
|
+
* @param event - The pointer event object
|
|
22
|
+
*/
|
|
23
|
+
const handlePointerDown = (event) => {
|
|
24
|
+
const target = event.target;
|
|
25
|
+
// Skip handling when clicking directly on input, links, buttons, or other interactive elements
|
|
26
|
+
// This prevents interference with native input/link/button behavior
|
|
27
|
+
if (target.tagName.toLowerCase() === "input" || target.closest("input, a, button")) {
|
|
28
|
+
event.stopPropagation();
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
const inputElement = inputRef.current;
|
|
32
|
+
if (!inputElement) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
// Key solution: If input already has focus, only prevent default behavior
|
|
36
|
+
// This prevents the focus from being lost when clicking on the container padding
|
|
37
|
+
// and eliminates the flickering effect
|
|
38
|
+
if (document.activeElement === inputElement) {
|
|
39
|
+
event.preventDefault();
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
// Only attempt to focus the input if it's not already focused
|
|
43
|
+
requestAnimationFrame(() => {
|
|
44
|
+
// Special handling for file inputs - trigger the file selection dialog
|
|
45
|
+
if (inputElement.type === "file") {
|
|
46
|
+
inputElement.click();
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
// Only focus the input if it doesn't already have focus
|
|
50
|
+
// This avoids unnecessary re-focusing which can cause UI flickers
|
|
51
|
+
if (document.activeElement !== inputElement) {
|
|
52
|
+
inputElement.focus();
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
return (_jsx(InputContextProvider, { disabled: disabled, inputRef: inputRef, readOnly: readOnly, scope: __scopeInput, children: _jsxs("div", { "data-disabled": disabled, "data-readonly": readOnly, role: "presentation", onPointerDown: handlePointerDown, ...props, children: [loading && loaderPosition === "prefix" ? spinner : prefix, children, loading && loaderPosition === "suffix" ? spinner : suffix] }) }));
|
|
59
57
|
}
|
|
58
|
+
/* -----------------------------------------------------------------------------
|
|
59
|
+
* Component: InputField
|
|
60
|
+
* -------------------------------------------------------------------------- */
|
|
60
61
|
const INPUT_FIELD_NAME = "InputField";
|
|
61
62
|
function InputField({ __scopeInput, ...props }) {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
...props
|
|
72
|
-
});
|
|
63
|
+
/**
|
|
64
|
+
* Context values from parent Input component
|
|
65
|
+
*/
|
|
66
|
+
const { disabled, inputRef, readOnly } = useInputContext(INPUT_FIELD_NAME, __scopeInput);
|
|
67
|
+
/**
|
|
68
|
+
* Combined ref that syncs with the parent's inputRef
|
|
69
|
+
*/
|
|
70
|
+
const composedInputRef = useComposedRefs(inputRef);
|
|
71
|
+
return (_jsx("input", { ref: composedInputRef, disabled: disabled, readOnly: readOnly, type: "text", ...props }));
|
|
73
72
|
}
|
|
74
|
-
|
|
75
|
-
|
|
73
|
+
/* -----------------------------------------------------------------------------
|
|
74
|
+
* Exports
|
|
75
|
+
* -------------------------------------------------------------------------- */
|
|
76
|
+
export { createInputScope, InputField as Field, Input, InputField, Input as Root };
|
|
@@ -1,50 +1,47 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import { Scope } from "@radix-ui/react-context";
|
|
4
|
-
|
|
5
|
-
//#region src/primitives/progress-circle.d.ts
|
|
1
|
+
import type { Scope } from "@radix-ui/react-context";
|
|
2
|
+
import type { ComponentProps, ReactNode } from "react";
|
|
6
3
|
type ScopedProps<P> = P & {
|
|
7
|
-
|
|
4
|
+
__scopeProgressCircle?: Scope;
|
|
8
5
|
};
|
|
9
6
|
/**
|
|
10
7
|
* Defines color thresholds based on progress values
|
|
11
8
|
*/
|
|
12
9
|
interface Threshold {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Background color to be applied
|
|
12
|
+
*/
|
|
13
|
+
background: string;
|
|
14
|
+
/**
|
|
15
|
+
* Foreground color to be applied
|
|
16
|
+
*/
|
|
17
|
+
color: string;
|
|
18
|
+
/**
|
|
19
|
+
* The value at which this threshold becomes active
|
|
20
|
+
*/
|
|
21
|
+
value: number;
|
|
25
22
|
}
|
|
26
|
-
declare const createProgressCircleScope:
|
|
23
|
+
declare const createProgressCircleScope: import("@radix-ui/react-context").CreateScope;
|
|
27
24
|
interface ProgressCircleProviderProps {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
25
|
+
/** React children to be rendered inside the progress circle */
|
|
26
|
+
children: ReactNode;
|
|
27
|
+
/** Custom function to format the numeric value for display */
|
|
28
|
+
formatValue?: (value: number) => string;
|
|
29
|
+
/** Unique identifier for the progress circle component */
|
|
30
|
+
id?: string;
|
|
31
|
+
/** Maximum value of the progress (defaults to 100) */
|
|
32
|
+
max?: number;
|
|
33
|
+
/** Minimum value of the progress (defaults to 0) */
|
|
34
|
+
min?: number;
|
|
35
|
+
/** Size of the progress circle in pixels */
|
|
36
|
+
size?: number;
|
|
37
|
+
/** Starting angle of the progress circle in degrees (0 = top) */
|
|
38
|
+
startAngle?: number;
|
|
39
|
+
/** Width of the progress circle's stroke in pixels */
|
|
40
|
+
strokeWidth?: number;
|
|
41
|
+
/** Array of threshold configurations for different value ranges */
|
|
42
|
+
thresholds?: Threshold[];
|
|
43
|
+
/** Current progress value (null for indeterminate state) */
|
|
44
|
+
value?: null | number;
|
|
48
45
|
}
|
|
49
46
|
/**
|
|
50
47
|
* Provides context for the ProgressCircle component
|
|
@@ -73,74 +70,47 @@ interface ProgressCircleProviderProps {
|
|
|
73
70
|
* </ProgressCircleProvider>
|
|
74
71
|
* ```
|
|
75
72
|
*/
|
|
76
|
-
declare function ProgressCircleProvider({
|
|
77
|
-
__scopeProgressCircle,
|
|
78
|
-
children,
|
|
79
|
-
formatValue,
|
|
80
|
-
id: propertyId,
|
|
81
|
-
max,
|
|
82
|
-
min,
|
|
83
|
-
size,
|
|
84
|
-
startAngle,
|
|
85
|
-
strokeWidth,
|
|
86
|
-
thresholds,
|
|
87
|
-
value
|
|
88
|
-
}: ScopedProps<ProgressCircleProviderProps>): ReactNode;
|
|
73
|
+
declare function ProgressCircleProvider({ __scopeProgressCircle, children, formatValue, id: propertyId, max, min, size, startAngle, strokeWidth, thresholds, value, }: ScopedProps<ProgressCircleProviderProps>): ReactNode;
|
|
89
74
|
type ProgressCircleProps = ComponentProps<"div">;
|
|
90
75
|
/**
|
|
91
76
|
* Root component for the progress circle
|
|
92
77
|
*
|
|
93
78
|
* Serves as a wrapper for other progress circle components.
|
|
94
79
|
*/
|
|
95
|
-
declare function ProgressCircle({
|
|
96
|
-
__scopeProgressCircle,
|
|
97
|
-
...props
|
|
98
|
-
}: ScopedProps<ProgressCircleProps>): ReactNode;
|
|
80
|
+
declare function ProgressCircle({ __scopeProgressCircle, ...props }: ScopedProps<ProgressCircleProps>): ReactNode;
|
|
99
81
|
type ProgressCircleSVGProps = ComponentProps<"svg">;
|
|
100
82
|
/**
|
|
101
83
|
* SVG container for the progress circle
|
|
102
84
|
*
|
|
103
85
|
* Renders the SVG with accessibility attributes and supports indeterminate state.
|
|
104
86
|
*/
|
|
105
|
-
declare function ProgressCircleSVG({
|
|
106
|
-
__scopeProgressCircle,
|
|
107
|
-
...props
|
|
108
|
-
}: ScopedProps<ProgressCircleSVGProps>): ReactNode;
|
|
87
|
+
declare function ProgressCircleSVG({ __scopeProgressCircle, ...props }: ScopedProps<ProgressCircleSVGProps>): ReactNode;
|
|
109
88
|
type ProgressCircleTrackProps = ComponentProps<"circle">;
|
|
110
89
|
/**
|
|
111
90
|
* Background circle for the progress indicator
|
|
112
91
|
*
|
|
113
92
|
* Renders the static track of the progress circle.
|
|
114
93
|
*/
|
|
115
|
-
declare function ProgressCircleTrack({
|
|
116
|
-
__scopeProgressCircle,
|
|
117
|
-
...props
|
|
118
|
-
}: ScopedProps<ProgressCircleTrackProps>): ReactNode;
|
|
94
|
+
declare function ProgressCircleTrack({ __scopeProgressCircle, ...props }: ScopedProps<ProgressCircleTrackProps>): ReactNode;
|
|
119
95
|
type ProgressCircleIndicatorProps = ComponentProps<"circle">;
|
|
120
96
|
/**
|
|
121
97
|
* Foreground circle showing progress
|
|
122
98
|
*
|
|
123
99
|
* Renders the dynamic progress indicator with stroke dash properties.
|
|
124
100
|
*/
|
|
125
|
-
declare function ProgressCircleIndicator({
|
|
126
|
-
__scopeProgressCircle,
|
|
127
|
-
...props
|
|
128
|
-
}: ScopedProps<ProgressCircleIndicatorProps>): ReactNode;
|
|
101
|
+
declare function ProgressCircleIndicator({ __scopeProgressCircle, ...props }: ScopedProps<ProgressCircleIndicatorProps>): ReactNode;
|
|
129
102
|
interface ProgressCircleValueProps extends Omit<ComponentProps<"div">, "children"> {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
103
|
+
children?: ((context: {
|
|
104
|
+
value: number | undefined;
|
|
105
|
+
valueText: string;
|
|
106
|
+
}) => ReactNode) | ReactNode;
|
|
134
107
|
}
|
|
135
108
|
/**
|
|
136
109
|
* Displays the current progress value
|
|
137
110
|
*
|
|
138
111
|
* Supports custom content or default value text rendering.
|
|
139
112
|
*/
|
|
140
|
-
declare function ProgressCircleValue({
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
}: ScopedProps<ProgressCircleValueProps>): ReactNode;
|
|
145
|
-
//#endregion
|
|
146
|
-
export { ProgressCircleIndicator as Indicator, ProgressCircleIndicator, ProgressCircle, ProgressCircle as Root, type ProgressCircleIndicatorProps, type ProgressCircleProps, ProgressCircleProvider, ProgressCircleProvider as Provider, type ProgressCircleProviderProps, ProgressCircleSVG, ProgressCircleSVG as SVG, type ProgressCircleSVGProps, ProgressCircleTrack, ProgressCircleTrack as Track, type ProgressCircleTrackProps, ProgressCircleValue, ProgressCircleValue as Value, type ProgressCircleValueProps, createProgressCircleScope };
|
|
113
|
+
declare function ProgressCircleValue({ __scopeProgressCircle, children, ...props }: ScopedProps<ProgressCircleValueProps>): ReactNode;
|
|
114
|
+
export { createProgressCircleScope, ProgressCircleIndicator as Indicator, ProgressCircle, ProgressCircleIndicator, ProgressCircleProvider, ProgressCircleSVG, ProgressCircleTrack, ProgressCircleValue, ProgressCircleProvider as Provider, ProgressCircle as Root, ProgressCircleSVG as SVG, ProgressCircleTrack as Track, ProgressCircleValue as Value, };
|
|
115
|
+
export type { ProgressCircleIndicatorProps, ProgressCircleProps, ProgressCircleProviderProps, ProgressCircleSVGProps, ProgressCircleTrackProps, ProgressCircleValueProps, };
|
|
116
|
+
//# sourceMappingURL=progress-circle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"progress-circle.d.ts","sourceRoot":"","sources":["../../src/primitives/progress-circle.tsx"],"names":[],"mappings":"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"}
|