@codefast/ui 0.3.13-canary.3 → 0.3.13
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 +44 -0
- package/dist/components/accordion.d.mts +37 -0
- package/dist/components/accordion.mjs +53 -0
- package/dist/components/alert-dialog.d.mts +74 -0
- package/dist/components/alert-dialog.mjs +92 -0
- package/dist/components/alert.d.mts +30 -0
- package/dist/components/alert.mjs +49 -0
- package/dist/components/aspect-ratio.d.mts +10 -0
- package/dist/components/aspect-ratio.mjs +12 -0
- package/dist/components/avatar.d.mts +21 -0
- package/dist/components/avatar.mjs +28 -0
- package/dist/components/badge.d.mts +24 -0
- package/dist/components/badge.mjs +56 -0
- package/dist/components/breadcrumb.d.mts +44 -0
- package/dist/components/breadcrumb.mjs +67 -0
- package/dist/components/button-group.d.mts +34 -0
- package/dist/components/button-group.mjs +53 -0
- package/dist/components/button.d.mts +38 -0
- package/dist/components/button.mjs +99 -0
- package/dist/components/calendar.d.mts +27 -0
- package/dist/components/calendar.mjs +114 -0
- package/dist/components/card.d.mts +41 -0
- package/dist/components/card.mjs +55 -0
- package/dist/components/carousel.d.mts +68 -0
- package/dist/components/carousel.mjs +135 -0
- package/dist/components/chart.d.mts +93 -0
- package/dist/components/chart.mjs +189 -0
- package/dist/components/checkbox-cards.d.mts +17 -0
- package/dist/components/checkbox-cards.mjs +30 -0
- package/dist/components/checkbox-group.d.mts +16 -0
- package/dist/components/checkbox-group.mjs +27 -0
- package/dist/components/checkbox.d.mts +11 -0
- package/dist/components/checkbox.mjs +20 -0
- package/dist/components/collapsible.d.mts +18 -0
- package/dist/components/collapsible.mjs +24 -0
- package/dist/components/command.d.mts +57 -0
- package/dist/components/command.mjs +92 -0
- package/dist/components/context-menu.d.mts +91 -0
- package/dist/components/context-menu.mjs +122 -0
- package/dist/components/dialog.d.mts +65 -0
- package/dist/components/dialog.mjs +93 -0
- package/dist/components/drawer.d.mts +65 -0
- package/dist/components/drawer.mjs +78 -0
- package/dist/components/dropdown-menu.d.mts +92 -0
- package/dist/components/dropdown-menu.mjs +129 -0
- package/dist/components/empty.d.mts +44 -0
- package/dist/components/empty.mjs +64 -0
- package/dist/components/field.d.mts +79 -0
- package/dist/components/field.mjs +132 -0
- package/dist/components/form.d.mts +48 -0
- package/dist/components/form.mjs +92 -0
- package/dist/components/hover-card.d.mts +26 -0
- package/dist/components/hover-card.mjs +35 -0
- package/dist/components/input-group.d.mts +61 -0
- package/dist/components/input-group.mjs +142 -0
- package/dist/components/input-number.d.mts +28 -0
- package/dist/components/input-number.mjs +61 -0
- package/dist/components/input-otp.d.mts +29 -0
- package/dist/components/input-otp.mjs +48 -0
- package/dist/components/input-password.d.mts +13 -0
- package/dist/components/input-password.mjs +38 -0
- package/dist/components/input-search.d.mts +20 -0
- package/dist/components/input-search.mjs +50 -0
- package/dist/components/input.d.mts +11 -0
- package/dist/components/input.mjs +14 -0
- package/dist/components/item.d.mts +82 -0
- package/dist/components/item.mjs +137 -0
- package/dist/components/kbd.d.mts +15 -0
- package/dist/components/kbd.mjs +19 -0
- package/dist/components/label.d.mts +11 -0
- package/dist/components/label.mjs +14 -0
- package/dist/components/menubar.d.mts +100 -0
- package/dist/components/menubar.mjs +133 -0
- package/dist/components/native-select.d.mts +19 -0
- package/dist/components/native-select.mjs +34 -0
- package/dist/components/navigation-menu.d.mts +44 -0
- package/dist/components/navigation-menu.mjs +79 -0
- package/dist/components/pagination.d.mts +46 -0
- package/dist/components/pagination.mjs +71 -0
- package/dist/components/popover.d.mts +30 -0
- package/dist/components/popover.mjs +41 -0
- package/dist/components/progress-circle.d.mts +124 -0
- package/dist/components/progress-circle.mjs +120 -0
- package/dist/components/progress.d.mts +12 -0
- package/dist/components/progress.mjs +19 -0
- package/dist/components/{radio-cards.d.ts → radio-cards.d.mts} +10 -5
- package/dist/components/radio-cards.mjs +29 -0
- package/dist/components/radio-group.d.mts +16 -0
- package/dist/components/radio-group.mjs +25 -0
- package/dist/components/radio.d.mts +14 -0
- package/dist/components/radio.mjs +16 -0
- package/dist/components/resizable.d.mts +23 -0
- package/dist/components/resizable.mjs +32 -0
- package/dist/components/scroll-area.d.mts +40 -0
- package/dist/components/scroll-area.mjs +101 -0
- package/dist/components/select.d.mts +62 -0
- package/dist/components/select.mjs +101 -0
- package/dist/components/separator.d.mts +32 -0
- package/dist/components/separator.mjs +45 -0
- package/dist/components/sheet.d.mts +75 -0
- package/dist/components/sheet.mjs +134 -0
- package/dist/components/sidebar.d.mts +195 -0
- package/dist/components/sidebar.mjs +375 -0
- package/dist/components/skeleton.d.mts +10 -0
- package/dist/components/skeleton.mjs +12 -0
- package/dist/components/slider.d.mts +15 -0
- package/dist/components/slider.mjs +40 -0
- package/dist/components/sonner.d.mts +10 -0
- package/dist/components/sonner.mjs +21 -0
- package/dist/components/spinner.d.mts +14 -0
- package/dist/components/spinner.mjs +40 -0
- package/dist/components/switch.d.mts +11 -0
- package/dist/components/switch.mjs +18 -0
- package/dist/components/table.d.mts +45 -0
- package/dist/components/table.mjs +65 -0
- package/dist/components/tabs.d.mts +26 -0
- package/dist/components/tabs.mjs +35 -0
- package/dist/components/textarea.d.mts +10 -0
- package/dist/components/textarea.mjs +12 -0
- package/dist/components/toggle-group.d.mts +30 -0
- package/dist/components/toggle-group.mjs +53 -0
- package/dist/components/toggle.d.mts +28 -0
- package/dist/components/toggle.mjs +53 -0
- package/dist/components/tooltip.d.mts +30 -0
- package/dist/components/tooltip.mjs +42 -0
- package/dist/hooks/{use-animated-value.d.ts → use-animated-value.d.mts} +4 -2
- package/dist/hooks/use-animated-value.mjs +62 -0
- package/dist/hooks/{use-copy-to-clipboard.d.ts → use-copy-to-clipboard.d.mts} +11 -6
- package/dist/hooks/use-copy-to-clipboard.mjs +43 -0
- package/dist/hooks/{use-is-mobile.d.ts → use-is-mobile.d.mts} +4 -2
- package/dist/hooks/use-is-mobile.mjs +26 -0
- package/dist/hooks/{use-media-query.d.ts → use-media-query.d.mts} +4 -2
- package/dist/hooks/use-media-query.mjs +50 -0
- package/dist/hooks/{use-mutation-observer.d.ts → use-mutation-observer.d.mts} +6 -3
- package/dist/hooks/use-mutation-observer.mjs +41 -0
- package/dist/hooks/use-pagination.d.mts +44 -0
- package/dist/hooks/use-pagination.mjs +107 -0
- package/dist/index.d.mts +69 -0
- package/dist/index.mjs +69 -0
- package/dist/lib/utils.d.mts +13 -0
- package/dist/lib/utils.mjs +10 -0
- package/dist/node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/clsx.d.mts +6 -0
- package/dist/primitives/checkbox-group.d.mts +144 -0
- package/dist/primitives/checkbox-group.mjs +126 -0
- package/dist/primitives/input-number.d.mts +73 -0
- package/dist/primitives/input-number.mjs +514 -0
- package/dist/primitives/input.d.mts +72 -0
- package/dist/primitives/input.mjs +75 -0
- package/dist/primitives/progress-circle.d.mts +146 -0
- package/dist/primitives/progress-circle.mjs +178 -0
- package/package.json +164 -170
- package/dist/components/accordion.d.ts +0 -19
- package/dist/components/accordion.d.ts.map +0 -1
- package/dist/components/accordion.js +0 -26
- package/dist/components/alert-dialog.d.ts +0 -39
- package/dist/components/alert-dialog.d.ts.map +0 -1
- package/dist/components/alert-dialog.js +0 -39
- package/dist/components/alert.d.ts +0 -19
- package/dist/components/alert.d.ts.map +0 -1
- package/dist/components/alert.js +0 -41
- package/dist/components/aspect-ratio.d.ts +0 -7
- package/dist/components/aspect-ratio.d.ts.map +0 -1
- package/dist/components/aspect-ratio.js +0 -10
- package/dist/components/avatar.d.ts +0 -11
- package/dist/components/avatar.d.ts.map +0 -1
- package/dist/components/avatar.js +0 -17
- package/dist/components/badge.d.ts +0 -18
- package/dist/components/badge.d.ts.map +0 -1
- package/dist/components/badge.js +0 -59
- package/dist/components/breadcrumb.d.ts +0 -22
- package/dist/components/breadcrumb.d.ts.map +0 -1
- package/dist/components/breadcrumb.js +0 -31
- package/dist/components/button-group.d.ts +0 -20
- package/dist/components/button-group.d.ts.map +0 -1
- package/dist/components/button-group.js +0 -48
- package/dist/components/button.d.ts +0 -29
- package/dist/components/button.d.ts.map +0 -1
- package/dist/components/button.js +0 -92
- package/dist/components/calendar.d.ts +0 -13
- package/dist/components/calendar.d.ts.map +0 -1
- package/dist/components/calendar.js +0 -104
- package/dist/components/card.d.ts +0 -18
- package/dist/components/card.d.ts.map +0 -1
- package/dist/components/card.js +0 -27
- package/dist/components/carousel.d.ts +0 -38
- package/dist/components/carousel.d.ts.map +0 -1
- package/dist/components/carousel.js +0 -103
- package/dist/components/chart.d.ts +0 -58
- package/dist/components/chart.d.ts.map +0 -1
- package/dist/components/chart.js +0 -198
- package/dist/components/checkbox-cards.d.ts +0 -11
- package/dist/components/checkbox-cards.d.ts.map +0 -1
- package/dist/components/checkbox-cards.js +0 -16
- package/dist/components/checkbox-group.d.ts +0 -9
- package/dist/components/checkbox-group.d.ts.map +0 -1
- package/dist/components/checkbox-group.js +0 -15
- package/dist/components/checkbox.d.ts +0 -7
- package/dist/components/checkbox.d.ts.map +0 -1
- package/dist/components/checkbox.js +0 -12
- package/dist/components/collapsible.d.ts +0 -11
- package/dist/components/collapsible.d.ts.map +0 -1
- package/dist/components/collapsible.js +0 -16
- package/dist/components/command.d.ts +0 -26
- package/dist/components/command.d.ts.map +0 -1
- package/dist/components/command.js +0 -41
- package/dist/components/context-menu.d.ts +0 -42
- package/dist/components/context-menu.d.ts.map +0 -1
- package/dist/components/context-menu.js +0 -54
- package/dist/components/dialog.d.ts +0 -35
- package/dist/components/dialog.d.ts.map +0 -1
- package/dist/components/dialog.js +0 -41
- package/dist/components/drawer.d.ts +0 -34
- package/dist/components/drawer.d.ts.map +0 -1
- package/dist/components/drawer.js +0 -36
- package/dist/components/dropdown-menu.d.ts +0 -42
- package/dist/components/dropdown-menu.d.ts.map +0 -1
- package/dist/components/dropdown-menu.js +0 -54
- package/dist/components/empty.d.ts +0 -23
- package/dist/components/empty.d.ts.map +0 -1
- package/dist/components/empty.js +0 -47
- package/dist/components/field.d.ts +0 -42
- package/dist/components/field.d.ts.map +0 -1
- package/dist/components/field.js +0 -85
- package/dist/components/form.d.ts +0 -27
- package/dist/components/form.d.ts.map +0 -1
- package/dist/components/form.js +0 -76
- package/dist/components/hover-card.d.ts +0 -13
- package/dist/components/hover-card.d.ts.map +0 -1
- package/dist/components/hover-card.js +0 -20
- package/dist/components/input-group.d.ts +0 -37
- package/dist/components/input-group.d.ts.map +0 -1
- package/dist/components/input-group.js +0 -127
- package/dist/components/input-number.d.ts +0 -8
- package/dist/components/input-number.d.ts.map +0 -1
- package/dist/components/input-number.js +0 -20
- package/dist/components/input-otp.d.ts +0 -16
- package/dist/components/input-otp.d.ts.map +0 -1
- package/dist/components/input-otp.js +0 -25
- package/dist/components/input-password.d.ts +0 -7
- package/dist/components/input-password.d.ts.map +0 -1
- package/dist/components/input-password.js +0 -17
- package/dist/components/input-search.d.ts +0 -11
- package/dist/components/input-search.d.ts.map +0 -1
- package/dist/components/input-search.js +0 -22
- package/dist/components/input.d.ts +0 -6
- package/dist/components/input.d.ts.map +0 -1
- package/dist/components/input.js +0 -10
- package/dist/components/item.d.ts +0 -46
- package/dist/components/item.d.ts.map +0 -1
- package/dist/components/item.js +0 -94
- package/dist/components/kbd.d.ts +0 -8
- package/dist/components/kbd.d.ts.map +0 -1
- package/dist/components/kbd.js +0 -12
- package/dist/components/label.d.ts +0 -7
- package/dist/components/label.d.ts.map +0 -1
- package/dist/components/label.js +0 -11
- package/dist/components/menubar.d.ts +0 -44
- package/dist/components/menubar.d.ts.map +0 -1
- package/dist/components/menubar.js +0 -57
- package/dist/components/native-select.d.ts +0 -10
- package/dist/components/native-select.d.ts.map +0 -1
- package/dist/components/native-select.js +0 -16
- package/dist/components/navigation-menu.d.ts +0 -21
- package/dist/components/navigation-menu.d.ts.map +0 -1
- package/dist/components/navigation-menu.js +0 -43
- package/dist/components/pagination.d.ts +0 -26
- package/dist/components/pagination.d.ts.map +0 -1
- package/dist/components/pagination.js +0 -29
- package/dist/components/popover.d.ts +0 -15
- package/dist/components/popover.d.ts.map +0 -1
- package/dist/components/popover.js +0 -23
- package/dist/components/progress-circle.d.ts +0 -107
- package/dist/components/progress-circle.d.ts.map +0 -1
- package/dist/components/progress-circle.js +0 -83
- package/dist/components/progress.d.ts +0 -7
- package/dist/components/progress.d.ts.map +0 -1
- package/dist/components/progress.js +0 -13
- package/dist/components/radio-cards.d.ts.map +0 -1
- package/dist/components/radio-cards.js +0 -15
- package/dist/components/radio-group.d.ts +0 -9
- package/dist/components/radio-group.d.ts.map +0 -1
- package/dist/components/radio-group.js +0 -14
- package/dist/components/radio.d.ts +0 -8
- package/dist/components/radio.d.ts.map +0 -1
- package/dist/components/radio.js +0 -11
- package/dist/components/resizable.d.ts +0 -13
- package/dist/components/resizable.d.ts.map +0 -1
- package/dist/components/resizable.js +0 -18
- package/dist/components/scroll-area.d.ts +0 -28
- package/dist/components/scroll-area.d.ts.map +0 -1
- package/dist/components/scroll-area.js +0 -77
- package/dist/components/select.d.ts +0 -29
- package/dist/components/select.d.ts.map +0 -1
- package/dist/components/select.js +0 -49
- package/dist/components/separator.d.ts +0 -23
- package/dist/components/separator.d.ts.map +0 -1
- package/dist/components/separator.js +0 -36
- package/dist/components/sheet.d.ts +0 -43
- package/dist/components/sheet.d.ts.map +0 -1
- package/dist/components/sheet.js +0 -90
- package/dist/components/sidebar.d.ts +0 -102
- package/dist/components/sidebar.d.ts.map +0 -1
- package/dist/components/sidebar.js +0 -241
- package/dist/components/skeleton.d.ts +0 -6
- package/dist/components/skeleton.d.ts.map +0 -1
- package/dist/components/skeleton.js +0 -9
- package/dist/components/slider.d.ts +0 -7
- package/dist/components/slider.d.ts.map +0 -1
- package/dist/components/slider.js +0 -18
- package/dist/components/sonner.d.ts +0 -8
- package/dist/components/sonner.d.ts.map +0 -1
- package/dist/components/sonner.js +0 -18
- package/dist/components/spinner.d.ts +0 -8
- package/dist/components/spinner.d.ts.map +0 -1
- package/dist/components/spinner.js +0 -27
- package/dist/components/switch.d.ts +0 -7
- package/dist/components/switch.d.ts.map +0 -1
- package/dist/components/switch.js +0 -11
- package/dist/components/table.d.ts +0 -20
- package/dist/components/table.d.ts.map +0 -1
- package/dist/components/table.js +0 -30
- package/dist/components/tabs.d.ts +0 -13
- package/dist/components/tabs.d.ts.map +0 -1
- package/dist/components/tabs.js +0 -20
- package/dist/components/textarea.d.ts +0 -6
- package/dist/components/textarea.d.ts.map +0 -1
- package/dist/components/textarea.js +0 -9
- package/dist/components/toggle-group.d.ts +0 -16
- package/dist/components/toggle-group.d.ts.map +0 -1
- package/dist/components/toggle-group.js +0 -35
- package/dist/components/toggle.d.ts +0 -21
- package/dist/components/toggle.d.ts.map +0 -1
- package/dist/components/toggle.js +0 -49
- package/dist/components/tooltip.d.ts +0 -15
- package/dist/components/tooltip.d.ts.map +0 -1
- package/dist/components/tooltip.js +0 -23
- package/dist/hooks/use-animated-value.d.ts.map +0 -1
- package/dist/hooks/use-animated-value.js +0 -71
- package/dist/hooks/use-copy-to-clipboard.d.ts.map +0 -1
- package/dist/hooks/use-copy-to-clipboard.js +0 -46
- package/dist/hooks/use-is-mobile.d.ts.map +0 -1
- package/dist/hooks/use-is-mobile.js +0 -23
- package/dist/hooks/use-media-query.d.ts.map +0 -1
- package/dist/hooks/use-media-query.js +0 -53
- package/dist/hooks/use-mutation-observer.d.ts.map +0 -1
- package/dist/hooks/use-mutation-observer.js +0 -40
- package/dist/hooks/use-pagination.d.ts +0 -37
- package/dist/hooks/use-pagination.d.ts.map +0 -1
- package/dist/hooks/use-pagination.js +0 -107
- package/dist/index.d.ts +0 -131
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -68
- package/dist/lib/utils.d.ts +0 -10
- package/dist/lib/utils.d.ts.map +0 -1
- package/dist/lib/utils.js +0 -10
- package/dist/primitives/checkbox-group.d.ts +0 -123
- package/dist/primitives/checkbox-group.d.ts.map +0 -1
- package/dist/primitives/checkbox-group.js +0 -112
- package/dist/primitives/input-number.d.ts +0 -63
- package/dist/primitives/input-number.d.ts.map +0 -1
- package/dist/primitives/input-number.js +0 -458
- package/dist/primitives/input.d.ts +0 -67
- package/dist/primitives/input.d.ts.map +0 -1
- package/dist/primitives/input.js +0 -76
- package/dist/primitives/progress-circle.d.ts +0 -116
- package/dist/primitives/progress-circle.d.ts.map +0 -1
- package/dist/primitives/progress-circle.js +0 -163
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { ComponentProps, JSX } from "react";
|
|
2
|
+
import * as _$_radix_ui_react_context0 from "@radix-ui/react-context";
|
|
3
|
+
import { Scope } from "@radix-ui/react-context";
|
|
4
|
+
import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
|
|
5
|
+
import * as RovingFocusGroup from "@radix-ui/react-roving-focus";
|
|
6
|
+
|
|
7
|
+
//#region src/primitives/checkbox-group.d.ts
|
|
8
|
+
/**
|
|
9
|
+
* Type for components that can be scoped within the CheckboxGroup context
|
|
10
|
+
*/
|
|
11
|
+
type ScopedProps<P> = P & {
|
|
12
|
+
/**
|
|
13
|
+
* Optional scope for the CheckboxGroup component
|
|
14
|
+
*/
|
|
15
|
+
__scopeCheckboxGroup?: Scope;
|
|
16
|
+
};
|
|
17
|
+
declare const createCheckboxGroupScope: _$_radix_ui_react_context0.CreateScope;
|
|
18
|
+
/**
|
|
19
|
+
* Context values shared between CheckboxGroup components
|
|
20
|
+
*/
|
|
21
|
+
interface CheckboxGroupContextValue {
|
|
22
|
+
/**
|
|
23
|
+
* Whether all checkbox items are disabled
|
|
24
|
+
*/
|
|
25
|
+
disabled: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Function called when a checkbox item is checked
|
|
28
|
+
* @param value - The value of the checked item
|
|
29
|
+
*/
|
|
30
|
+
onItemCheck: (value: string) => void;
|
|
31
|
+
/**
|
|
32
|
+
* Function called when a checkbox item is unchecked
|
|
33
|
+
* @param value - The value of the unchecked item
|
|
34
|
+
*/
|
|
35
|
+
onItemUncheck: (value: string) => void;
|
|
36
|
+
/**
|
|
37
|
+
* Whether checkbox selection is required
|
|
38
|
+
*/
|
|
39
|
+
required: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Optional name attribute for the checkbox group form field
|
|
42
|
+
*/
|
|
43
|
+
name?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Array of currently selected checkbox values
|
|
46
|
+
*/
|
|
47
|
+
value?: string[];
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Base props for the CheckboxGroup component
|
|
51
|
+
*/
|
|
52
|
+
interface CheckboxGroupBaseProps {
|
|
53
|
+
/**
|
|
54
|
+
* Default values for the checkbox group when uncontrolled
|
|
55
|
+
*/
|
|
56
|
+
defaultValue?: string[];
|
|
57
|
+
/**
|
|
58
|
+
* Direction for roving focus navigation
|
|
59
|
+
*/
|
|
60
|
+
dir?: RovingFocusGroup.RovingFocusGroupProps["dir"];
|
|
61
|
+
/**
|
|
62
|
+
* Whether the entire checkbox group is disabled
|
|
63
|
+
*/
|
|
64
|
+
disabled?: boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Whether focus should loop to the start/end when reaching the boundaries
|
|
67
|
+
*/
|
|
68
|
+
loop?: RovingFocusGroup.RovingFocusGroupProps["loop"];
|
|
69
|
+
/**
|
|
70
|
+
* Name attribute for the checkbox group form field
|
|
71
|
+
*/
|
|
72
|
+
name?: CheckboxGroupContextValue["name"];
|
|
73
|
+
/**
|
|
74
|
+
* Callback fired when the selected values change
|
|
75
|
+
* @param value - The new array of selected values
|
|
76
|
+
*/
|
|
77
|
+
onValueChange?: (value?: string[]) => void;
|
|
78
|
+
/**
|
|
79
|
+
* Orientation of the checkbox group (horizontal or vertical)
|
|
80
|
+
*/
|
|
81
|
+
orientation?: RovingFocusGroup.RovingFocusGroupProps["orientation"];
|
|
82
|
+
/**
|
|
83
|
+
* Whether at least one checkbox must be selected
|
|
84
|
+
*/
|
|
85
|
+
required?: boolean;
|
|
86
|
+
/**
|
|
87
|
+
* Controlled values for the checkbox group
|
|
88
|
+
*/
|
|
89
|
+
value?: CheckboxGroupContextValue["value"];
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Props for the CheckboxGroup component
|
|
93
|
+
*/
|
|
94
|
+
type CheckboxGroupProps = CheckboxGroupBaseProps & ComponentProps<"div">;
|
|
95
|
+
/**
|
|
96
|
+
* CheckboxGroup component that manages a group of checkboxes with roving focus
|
|
97
|
+
*/
|
|
98
|
+
declare function CheckboxGroup({
|
|
99
|
+
__scopeCheckboxGroup,
|
|
100
|
+
defaultValue,
|
|
101
|
+
dir,
|
|
102
|
+
disabled,
|
|
103
|
+
loop,
|
|
104
|
+
name,
|
|
105
|
+
onValueChange,
|
|
106
|
+
orientation,
|
|
107
|
+
required,
|
|
108
|
+
value: valueProperty,
|
|
109
|
+
...props
|
|
110
|
+
}: ScopedProps<CheckboxGroupProps>): JSX.Element;
|
|
111
|
+
/**
|
|
112
|
+
* Props for the CheckboxGroupItem component
|
|
113
|
+
*/
|
|
114
|
+
interface CheckboxGroupItemProps extends Omit<ComponentProps<typeof CheckboxPrimitive.Root>, "checked" | "defaultChecked" | "name" | "onCheckedChange"> {
|
|
115
|
+
/**
|
|
116
|
+
* Value of the checkbox item, used to identify the item within the group
|
|
117
|
+
*/
|
|
118
|
+
value: string;
|
|
119
|
+
/**
|
|
120
|
+
* Whether this specific checkbox item is disabled
|
|
121
|
+
*/
|
|
122
|
+
disabled?: boolean;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Individual checkbox item within a CheckboxGroup
|
|
126
|
+
*/
|
|
127
|
+
declare function CheckboxGroupItem({
|
|
128
|
+
__scopeCheckboxGroup,
|
|
129
|
+
disabled,
|
|
130
|
+
...props
|
|
131
|
+
}: ScopedProps<CheckboxGroupItemProps>): JSX.Element;
|
|
132
|
+
/**
|
|
133
|
+
* Props for the CheckboxGroupIndicator component
|
|
134
|
+
*/
|
|
135
|
+
type CheckboxGroupIndicatorProps = ComponentProps<typeof CheckboxPrimitive.Indicator>;
|
|
136
|
+
/**
|
|
137
|
+
* Visual indicator component for a CheckboxGroupItem
|
|
138
|
+
*/
|
|
139
|
+
declare function CheckboxGroupIndicator({
|
|
140
|
+
__scopeCheckboxGroup,
|
|
141
|
+
...props
|
|
142
|
+
}: ScopedProps<CheckboxGroupIndicatorProps>): JSX.Element;
|
|
143
|
+
//#endregion
|
|
144
|
+
export { CheckboxGroup, CheckboxGroup as Root, CheckboxGroupIndicator, CheckboxGroupIndicator as Indicator, type CheckboxGroupIndicatorProps, CheckboxGroupItem, CheckboxGroupItem as Item, type CheckboxGroupItemProps, type CheckboxGroupProps, createCheckboxGroupScope };
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback } from "react";
|
|
3
|
+
import { createContextScope } from "@radix-ui/react-context";
|
|
4
|
+
import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
|
|
5
|
+
import { createCheckboxScope } from "@radix-ui/react-checkbox";
|
|
6
|
+
import { useDirection } from "@radix-ui/react-direction";
|
|
7
|
+
import * as RovingFocusGroup from "@radix-ui/react-roving-focus";
|
|
8
|
+
import { createRovingFocusGroupScope } from "@radix-ui/react-roving-focus";
|
|
9
|
+
import { useControllableState } from "@radix-ui/react-use-controllable-state";
|
|
10
|
+
//#region src/primitives/checkbox-group.tsx
|
|
11
|
+
const CHECKBOX_GROUP_NAME = "CheckboxGroup";
|
|
12
|
+
const [createCheckboxGroupContext, createCheckboxGroupScope] = createContextScope(CHECKBOX_GROUP_NAME, [createRovingFocusGroupScope, createCheckboxScope]);
|
|
13
|
+
const useRovingFocusGroupScope = createRovingFocusGroupScope();
|
|
14
|
+
const useCheckboxScope = createCheckboxScope();
|
|
15
|
+
const [CheckboxGroupContextProvider, useCheckboxGroupContext] = createCheckboxGroupContext(CHECKBOX_GROUP_NAME);
|
|
16
|
+
/**
|
|
17
|
+
* CheckboxGroup component that manages a group of checkboxes with roving focus
|
|
18
|
+
*/
|
|
19
|
+
function CheckboxGroup({ __scopeCheckboxGroup, defaultValue, dir, disabled = false, loop = true, name, onValueChange, orientation, required = false, value: valueProperty, ...props }) {
|
|
20
|
+
/**
|
|
21
|
+
* Scope for the RovingFocusGroup component
|
|
22
|
+
*/
|
|
23
|
+
const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeCheckboxGroup);
|
|
24
|
+
/**
|
|
25
|
+
* Direction for layout and navigation
|
|
26
|
+
*/
|
|
27
|
+
const direction = useDirection(dir);
|
|
28
|
+
/**
|
|
29
|
+
* State for managing selected checkbox values
|
|
30
|
+
*/
|
|
31
|
+
const [value = [], setValue] = useControllableState({
|
|
32
|
+
defaultProp: defaultValue,
|
|
33
|
+
onChange: onValueChange,
|
|
34
|
+
prop: valueProperty
|
|
35
|
+
});
|
|
36
|
+
return /* @__PURE__ */ jsx(CheckboxGroupContextProvider, {
|
|
37
|
+
disabled,
|
|
38
|
+
name,
|
|
39
|
+
required,
|
|
40
|
+
scope: __scopeCheckboxGroup,
|
|
41
|
+
value,
|
|
42
|
+
onItemCheck: useCallback((itemValue) => {
|
|
43
|
+
setValue((previousValue) => [...previousValue ?? [], itemValue]);
|
|
44
|
+
}, [setValue]),
|
|
45
|
+
onItemUncheck: useCallback((itemValue) => {
|
|
46
|
+
setValue((previousValue) => {
|
|
47
|
+
const currentValue = previousValue ?? [];
|
|
48
|
+
if (required && currentValue.length === 1 && currentValue[0] === itemValue) return currentValue;
|
|
49
|
+
return currentValue.filter((inputValue) => inputValue !== itemValue);
|
|
50
|
+
});
|
|
51
|
+
}, [setValue, required]),
|
|
52
|
+
children: /* @__PURE__ */ jsx(RovingFocusGroup.Root, {
|
|
53
|
+
asChild: true,
|
|
54
|
+
...rovingFocusGroupScope,
|
|
55
|
+
dir: direction,
|
|
56
|
+
loop,
|
|
57
|
+
orientation,
|
|
58
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
59
|
+
"data-disabled": disabled ? "" : void 0,
|
|
60
|
+
dir: direction,
|
|
61
|
+
role: "group",
|
|
62
|
+
...props
|
|
63
|
+
})
|
|
64
|
+
})
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
const ITEM_NAME = "CheckboxGroupItem";
|
|
68
|
+
/**
|
|
69
|
+
* Individual checkbox item within a CheckboxGroup
|
|
70
|
+
*/
|
|
71
|
+
function CheckboxGroupItem({ __scopeCheckboxGroup, disabled, ...props }) {
|
|
72
|
+
/**
|
|
73
|
+
* Context values from the parent CheckboxGroup
|
|
74
|
+
*/
|
|
75
|
+
const context = useCheckboxGroupContext(ITEM_NAME, __scopeCheckboxGroup);
|
|
76
|
+
/**
|
|
77
|
+
* Combined disabled state from both context and props
|
|
78
|
+
*/
|
|
79
|
+
const isDisabled = context.disabled || disabled;
|
|
80
|
+
/**
|
|
81
|
+
* Scope for the RovingFocusGroup component
|
|
82
|
+
*/
|
|
83
|
+
const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeCheckboxGroup);
|
|
84
|
+
/**
|
|
85
|
+
* Scope for the Checkbox component
|
|
86
|
+
*/
|
|
87
|
+
const checkboxScope = useCheckboxScope(__scopeCheckboxGroup);
|
|
88
|
+
/**
|
|
89
|
+
* Whether this checkbox is currently checked
|
|
90
|
+
*/
|
|
91
|
+
const checked = context.value?.includes(props.value);
|
|
92
|
+
return /* @__PURE__ */ jsx(RovingFocusGroup.Item, {
|
|
93
|
+
asChild: true,
|
|
94
|
+
...rovingFocusGroupScope,
|
|
95
|
+
active: checked,
|
|
96
|
+
focusable: !isDisabled,
|
|
97
|
+
children: /* @__PURE__ */ jsx(CheckboxPrimitive.Root, {
|
|
98
|
+
"aria-label": props.value,
|
|
99
|
+
checked,
|
|
100
|
+
disabled: isDisabled,
|
|
101
|
+
name: context.name,
|
|
102
|
+
required: context.required,
|
|
103
|
+
...checkboxScope,
|
|
104
|
+
...props,
|
|
105
|
+
onCheckedChange: (checkedState) => {
|
|
106
|
+
if (checkedState) context.onItemCheck(props.value);
|
|
107
|
+
else context.onItemUncheck(props.value);
|
|
108
|
+
}
|
|
109
|
+
})
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Visual indicator component for a CheckboxGroupItem
|
|
114
|
+
*/
|
|
115
|
+
function CheckboxGroupIndicator({ __scopeCheckboxGroup, ...props }) {
|
|
116
|
+
/**
|
|
117
|
+
* Scope for the Checkbox component
|
|
118
|
+
*/
|
|
119
|
+
const checkboxScope = useCheckboxScope(__scopeCheckboxGroup);
|
|
120
|
+
return /* @__PURE__ */ jsx(CheckboxPrimitive.Indicator, {
|
|
121
|
+
...checkboxScope,
|
|
122
|
+
...props
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
//#endregion
|
|
126
|
+
export { CheckboxGroup, CheckboxGroup as Root, CheckboxGroupIndicator, CheckboxGroupIndicator as Indicator, CheckboxGroupItem, CheckboxGroupItem as Item, createCheckboxGroupScope };
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { Field as InputField, Input } from "./input.mjs";
|
|
2
|
+
import { ComponentProps, JSX } from "react";
|
|
3
|
+
import * as _$_radix_ui_react_context0 from "@radix-ui/react-context";
|
|
4
|
+
import { Scope } from "@radix-ui/react-context";
|
|
5
|
+
|
|
6
|
+
//#region src/primitives/input-number.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* Props that include an optional scope for the InputNumber component.
|
|
9
|
+
*/
|
|
10
|
+
type ScopedProps<P> = P & {
|
|
11
|
+
/** Optional scope for the InputNumber component context */__scopeInputNumber?: Scope;
|
|
12
|
+
};
|
|
13
|
+
declare const createInputNumberScope: _$_radix_ui_react_context0.CreateScope;
|
|
14
|
+
/**
|
|
15
|
+
* Props for the main InputNumber component.
|
|
16
|
+
*/
|
|
17
|
+
interface InputNumberProps extends ComponentProps<typeof Input> {
|
|
18
|
+
/** Accessible label for the decrement button */
|
|
19
|
+
ariaDecrementLabel?: string;
|
|
20
|
+
/** Accessible label for the increment button */
|
|
21
|
+
ariaIncrementLabel?: string;
|
|
22
|
+
/** Initial value when uncontrolled */
|
|
23
|
+
defaultValue?: number;
|
|
24
|
+
/** Options for number formatting */
|
|
25
|
+
formatOptions?: Intl.NumberFormatOptions;
|
|
26
|
+
/** Unique identifier for the input */
|
|
27
|
+
id?: string;
|
|
28
|
+
/** Locale used for number formatting */
|
|
29
|
+
locale?: string;
|
|
30
|
+
/** Maximum allowed value */
|
|
31
|
+
max?: number;
|
|
32
|
+
/** Minimum allowed value */
|
|
33
|
+
min?: number;
|
|
34
|
+
/** Handler called when the value changes */
|
|
35
|
+
onChange?: (value?: number) => void;
|
|
36
|
+
/** Step value for increments/decrements */
|
|
37
|
+
step?: number;
|
|
38
|
+
/** Current value when controlled */
|
|
39
|
+
value?: number;
|
|
40
|
+
}
|
|
41
|
+
declare function InputNumber(numberInputProps: ScopedProps<InputNumberProps>): JSX.Element;
|
|
42
|
+
/**
|
|
43
|
+
* Defines the props for the `InputNumberField` component.
|
|
44
|
+
*/
|
|
45
|
+
type InputNumberFieldProps = Omit<ComponentProps<typeof InputField>, "defaultValue" | "disabled" | "id" | "max" | "min" | "onChange" | "prefix" | "readOnly" | "step" | "value">;
|
|
46
|
+
declare function InputNumberField({
|
|
47
|
+
__scopeInputNumber,
|
|
48
|
+
onBlur,
|
|
49
|
+
onKeyDown,
|
|
50
|
+
...props
|
|
51
|
+
}: ScopedProps<InputNumberFieldProps>): JSX.Element;
|
|
52
|
+
/**
|
|
53
|
+
* Props for the NumberStepperButton component.
|
|
54
|
+
*/
|
|
55
|
+
interface NumberStepperButtonProps extends ComponentProps<"button"> {
|
|
56
|
+
/**
|
|
57
|
+
* The operation to perform when the button is pressed.
|
|
58
|
+
* - `'increment'`: Increases the value.
|
|
59
|
+
* - `'decrement'`: Decreases the value.
|
|
60
|
+
*/
|
|
61
|
+
operation: "decrement" | "increment";
|
|
62
|
+
}
|
|
63
|
+
declare function NumberStepperButton({
|
|
64
|
+
__scopeInputNumber,
|
|
65
|
+
operation,
|
|
66
|
+
...props
|
|
67
|
+
}: ScopedProps<NumberStepperButtonProps>): JSX.Element;
|
|
68
|
+
type InputNumberIncrementButtonProps = Omit<ComponentProps<typeof NumberStepperButton>, "operation">;
|
|
69
|
+
declare function InputNumberIncrementButton(props: InputNumberIncrementButtonProps): JSX.Element;
|
|
70
|
+
type InputNumberDecrementButtonProps = Omit<ComponentProps<typeof NumberStepperButton>, "operation">;
|
|
71
|
+
declare function InputNumberDecrementButton(props: InputNumberDecrementButtonProps): JSX.Element;
|
|
72
|
+
//#endregion
|
|
73
|
+
export { InputNumberDecrementButton as DecrementButton, InputNumberDecrementButton, InputNumberField as Field, InputNumberField, InputNumberIncrementButton as IncrementButton, InputNumberIncrementButton, InputNumber, InputNumber as Root, type InputNumberDecrementButtonProps, type InputNumberFieldProps, type InputNumberIncrementButtonProps, type InputNumberProps, createInputNumberScope };
|