@brijbyte/agentic-ui 0.0.3 → 0.0.5
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/README.md +280 -53
- package/dist/accordion/accordion.d.ts +14 -0
- package/dist/accordion/accordion.d.ts.map +1 -1
- package/dist/accordion/accordion.js +5 -0
- package/dist/accordion/accordion.js.map +1 -1
- package/dist/accordion/index.d.ts +2 -2
- package/dist/accordion/index.js +2 -2
- package/dist/accordion/parts.d.ts +6 -14
- package/dist/accordion/parts.d.ts.map +1 -1
- package/dist/accordion/parts.js +7 -6
- package/dist/accordion/parts.js.map +1 -1
- package/dist/alert-dialog/alert-dialog.d.ts +11 -0
- package/dist/alert-dialog/alert-dialog.d.ts.map +1 -1
- package/dist/alert-dialog/alert-dialog.js +5 -0
- package/dist/alert-dialog/alert-dialog.js.map +1 -1
- package/dist/alert-dialog/parts.d.ts +4 -12
- package/dist/alert-dialog/parts.d.ts.map +1 -1
- package/dist/alert-dialog/parts.js +17 -19
- package/dist/alert-dialog/parts.js.map +1 -1
- package/dist/badge/badge.d.ts +6 -0
- package/dist/badge/badge.d.ts.map +1 -1
- package/dist/badge/badge.js +4 -0
- package/dist/badge/badge.js.map +1 -1
- package/dist/button/button.d.ts +12 -1
- package/dist/button/button.d.ts.map +1 -1
- package/dist/button/button.js +5 -0
- package/dist/button/button.js.map +1 -1
- package/dist/card/card.d.ts +10 -0
- package/dist/card/card.d.ts.map +1 -1
- package/dist/card/card.js +7 -0
- package/dist/card/card.js.map +1 -1
- package/dist/checkbox/checkbox.d.ts +13 -0
- package/dist/checkbox/checkbox.d.ts.map +1 -1
- package/dist/checkbox/checkbox.js +4 -0
- package/dist/checkbox/checkbox.js.map +1 -1
- package/dist/checkbox/parts.d.ts +2 -5
- package/dist/checkbox/parts.d.ts.map +1 -1
- package/dist/checkbox/parts.js +3 -2
- package/dist/checkbox/parts.js.map +1 -1
- package/dist/collapsible/collapsible.d.ts +11 -0
- package/dist/collapsible/collapsible.d.ts.map +1 -1
- package/dist/collapsible/collapsible.js +5 -0
- package/dist/collapsible/collapsible.js.map +1 -1
- package/dist/collapsible/parts.d.ts +3 -9
- package/dist/collapsible/parts.d.ts.map +1 -1
- package/dist/collapsible/parts.js +7 -6
- package/dist/collapsible/parts.js.map +1 -1
- package/dist/context-menu/context-menu.d.ts +5 -0
- package/dist/context-menu/context-menu.d.ts.map +1 -1
- package/dist/context-menu/context-menu.js +4 -0
- package/dist/context-menu/context-menu.js.map +1 -1
- package/dist/context-menu/parts.d.ts +6 -18
- package/dist/context-menu/parts.d.ts.map +1 -1
- package/dist/context-menu/parts.js +16 -16
- package/dist/context-menu/parts.js.map +1 -1
- package/dist/dialog/dialog.d.ts +13 -1
- package/dist/dialog/dialog.d.ts.map +1 -1
- package/dist/dialog/dialog.js +6 -0
- package/dist/dialog/dialog.js.map +1 -1
- package/dist/dialog/parts.d.ts +6 -18
- package/dist/dialog/parts.d.ts.map +1 -1
- package/dist/dialog/parts.js +8 -9
- package/dist/dialog/parts.js.map +1 -1
- package/dist/drawer/drawer.d.ts +11 -0
- package/dist/drawer/drawer.d.ts.map +1 -1
- package/dist/drawer/drawer.js +5 -0
- package/dist/drawer/drawer.js.map +1 -1
- package/dist/drawer/parts.d.ts +7 -19
- package/dist/drawer/parts.d.ts.map +1 -1
- package/dist/drawer/parts.js +14 -13
- package/dist/drawer/parts.js.map +1 -1
- package/dist/index.css +1580 -1150
- package/dist/index.d.ts +20 -11
- package/dist/index.js +15 -2
- package/dist/input/input.d.ts +8 -0
- package/dist/input/input.d.ts.map +1 -1
- package/dist/input/input.js +5 -0
- package/dist/input/input.js.map +1 -1
- package/dist/menu/menu.css +3 -8
- package/dist/menu/menu.d.ts +11 -4
- package/dist/menu/menu.d.ts.map +1 -1
- package/dist/menu/menu.js +10 -24
- package/dist/menu/menu.js.map +1 -1
- package/dist/menu/menu.module.js +1 -1
- package/dist/menu/menu.module.js.map +1 -1
- package/dist/menu/parts.d.ts +6 -18
- package/dist/menu/parts.d.ts.map +1 -1
- package/dist/menu/parts.js +7 -6
- package/dist/menu/parts.js.map +1 -1
- package/dist/meter/circular-meter.d.ts +48 -0
- package/dist/meter/circular-meter.d.ts.map +1 -0
- package/dist/meter/circular-meter.js +86 -0
- package/dist/meter/circular-meter.js.map +1 -0
- package/dist/meter/index.d.ts +4 -0
- package/dist/meter/index.js +5 -0
- package/dist/meter/meter.css +152 -0
- package/dist/meter/meter.d.ts +58 -0
- package/dist/meter/meter.d.ts.map +1 -0
- package/dist/meter/meter.js +50 -0
- package/dist/meter/meter.js.map +1 -0
- package/dist/meter/meter.module.css.d.ts +2 -0
- package/dist/meter/meter.module.js +27 -0
- package/dist/meter/meter.module.js.map +1 -0
- package/dist/meter/meterState.js +18 -0
- package/dist/meter/meterState.js.map +1 -0
- package/dist/meter/parts.d.ts +25 -0
- package/dist/meter/parts.d.ts.map +1 -0
- package/dist/meter/parts.js +57 -0
- package/dist/meter/parts.js.map +1 -0
- package/dist/number-field/number-field.d.ts +16 -0
- package/dist/number-field/number-field.d.ts.map +1 -1
- package/dist/number-field/number-field.js +4 -0
- package/dist/number-field/number-field.js.map +1 -1
- package/dist/number-field/parts.d.ts +6 -18
- package/dist/number-field/parts.d.ts.map +1 -1
- package/dist/number-field/parts.js +7 -6
- package/dist/number-field/parts.js.map +1 -1
- package/dist/popover/index.d.ts +3 -0
- package/dist/popover/index.js +4 -0
- package/dist/popover/parts.d.ts +29 -0
- package/dist/popover/parts.d.ts.map +1 -0
- package/dist/popover/parts.js +93 -0
- package/dist/popover/parts.js.map +1 -0
- package/dist/popover/popover.css +173 -0
- package/dist/popover/popover.d.ts +49 -0
- package/dist/popover/popover.d.ts.map +1 -0
- package/dist/popover/popover.js +68 -0
- package/dist/popover/popover.js.map +1 -0
- package/dist/popover/popover.module.css.d.ts +2 -0
- package/dist/popover/popover.module.js +16 -0
- package/dist/popover/popover.module.js.map +1 -0
- package/dist/progress/parts.d.ts +2 -4
- package/dist/progress/parts.d.ts.map +1 -1
- package/dist/progress/parts.js +3 -6
- package/dist/progress/parts.js.map +1 -1
- package/dist/progress/progress.d.ts +11 -0
- package/dist/progress/progress.d.ts.map +1 -1
- package/dist/progress/progress.js +5 -0
- package/dist/progress/progress.js.map +1 -1
- package/dist/radio/index.d.ts +3 -0
- package/dist/radio/index.js +4 -0
- package/dist/radio/parts.d.ts +14 -0
- package/dist/radio/parts.d.ts.map +1 -0
- package/dist/radio/parts.js +43 -0
- package/dist/radio/parts.js.map +1 -0
- package/dist/radio/radio.css +84 -0
- package/dist/radio/radio.d.ts +31 -0
- package/dist/radio/radio.d.ts.map +1 -0
- package/dist/radio/radio.js +33 -0
- package/dist/radio/radio.js.map +1 -0
- package/dist/radio/radio.module.css.d.ts +2 -0
- package/dist/radio/radio.module.js +11 -0
- package/dist/radio/radio.module.js.map +1 -0
- package/dist/radio-group/index.d.ts +3 -0
- package/dist/radio-group/index.js +4 -0
- package/dist/radio-group/parts.d.ts +11 -0
- package/dist/radio-group/parts.d.ts.map +1 -0
- package/dist/radio-group/parts.js +32 -0
- package/dist/radio-group/parts.js.map +1 -0
- package/dist/radio-group/radio-group.css +17 -0
- package/dist/radio-group/radio-group.d.ts +37 -0
- package/dist/radio-group/radio-group.d.ts.map +1 -0
- package/dist/radio-group/radio-group.js +28 -0
- package/dist/radio-group/radio-group.js.map +1 -0
- package/dist/radio-group/radio-group.module.css.d.ts +2 -0
- package/dist/radio-group/radio-group.module.js +9 -0
- package/dist/radio-group/radio-group.module.js.map +1 -0
- package/dist/reset-scoped.css +112 -0
- package/dist/select/parts.d.ts +11 -32
- package/dist/select/parts.d.ts.map +1 -1
- package/dist/select/parts.js +10 -9
- package/dist/select/parts.js.map +1 -1
- package/dist/select/select.d.ts +14 -1
- package/dist/select/select.d.ts.map +1 -1
- package/dist/select/select.js +4 -0
- package/dist/select/select.js.map +1 -1
- package/dist/separator/separator.d.ts +4 -0
- package/dist/separator/separator.d.ts.map +1 -1
- package/dist/separator/separator.js +4 -0
- package/dist/separator/separator.js.map +1 -1
- package/dist/shared/PopupArrow.js +22 -0
- package/dist/shared/PopupArrow.js.map +1 -0
- package/dist/slider/parts.d.ts +6 -18
- package/dist/slider/parts.d.ts.map +1 -1
- package/dist/slider/parts.js +7 -6
- package/dist/slider/parts.js.map +1 -1
- package/dist/slider/slider.d.ts +18 -0
- package/dist/slider/slider.d.ts.map +1 -1
- package/dist/slider/slider.js +6 -0
- package/dist/slider/slider.js.map +1 -1
- package/dist/switch/parts.d.ts +2 -6
- package/dist/switch/parts.d.ts.map +1 -1
- package/dist/switch/parts.js +3 -2
- package/dist/switch/parts.js.map +1 -1
- package/dist/switch/switch.css +11 -2
- package/dist/switch/switch.d.ts +12 -0
- package/dist/switch/switch.d.ts.map +1 -1
- package/dist/switch/switch.js +4 -0
- package/dist/switch/switch.js.map +1 -1
- package/dist/switch/switch.module.js.map +1 -1
- package/dist/tabs/parts.d.ts +3 -9
- package/dist/tabs/parts.d.ts.map +1 -1
- package/dist/tabs/parts.js +4 -3
- package/dist/tabs/parts.js.map +1 -1
- package/dist/tabs/tabs.d.ts +8 -1
- package/dist/tabs/tabs.d.ts.map +1 -1
- package/dist/tabs/tabs.js +4 -0
- package/dist/tabs/tabs.js.map +1 -1
- package/dist/toast/parts.d.ts +5 -15
- package/dist/toast/parts.d.ts.map +1 -1
- package/dist/toast/parts.js +6 -5
- package/dist/toast/parts.js.map +1 -1
- package/dist/toast/toast.d.ts +11 -0
- package/dist/toast/toast.d.ts.map +1 -1
- package/dist/toast/toast.js +8 -0
- package/dist/toast/toast.js.map +1 -1
- package/dist/tooltip/parts.d.ts +3 -9
- package/dist/tooltip/parts.d.ts.map +1 -1
- package/dist/tooltip/parts.js +4 -3
- package/dist/tooltip/parts.js.map +1 -1
- package/dist/tooltip/tooltip.d.ts +9 -0
- package/dist/tooltip/tooltip.d.ts.map +1 -1
- package/dist/tooltip/tooltip.js +4 -0
- package/dist/tooltip/tooltip.js.map +1 -1
- package/dist/utils/resolveClassName.js +25 -0
- package/dist/utils/resolveClassName.js.map +1 -0
- package/package.json +25 -4
- package/src/accordion/accordion.tsx +14 -0
- package/src/accordion/index.ts +1 -1
- package/src/accordion/parts.tsx +10 -17
- package/src/alert-dialog/alert-dialog.tsx +11 -0
- package/src/alert-dialog/parts.tsx +23 -31
- package/src/badge/badge.tsx +6 -0
- package/src/button/button.tsx +12 -1
- package/src/card/card.tsx +10 -0
- package/src/checkbox/checkbox.tsx +13 -0
- package/src/checkbox/parts.tsx +5 -7
- package/src/collapsible/collapsible.tsx +11 -0
- package/src/collapsible/parts.tsx +10 -15
- package/src/context-menu/context-menu.tsx +5 -0
- package/src/context-menu/parts.tsx +34 -34
- package/src/dialog/dialog.tsx +13 -1
- package/src/dialog/parts.tsx +14 -27
- package/src/drawer/drawer.tsx +11 -0
- package/src/drawer/parts.tsx +30 -38
- package/src/index.ts +4 -0
- package/src/input/input.tsx +8 -0
- package/src/menu/menu.module.css +3 -10
- package/src/menu/menu.tsx +13 -26
- package/src/menu/parts.tsx +13 -24
- package/src/meter/circular-meter.tsx +114 -0
- package/src/meter/index.ts +9 -0
- package/src/meter/meter.module.css +162 -0
- package/src/meter/meter.tsx +86 -0
- package/src/meter/meterState.ts +29 -0
- package/src/meter/parts.tsx +73 -0
- package/src/number-field/number-field.tsx +16 -0
- package/src/number-field/parts.tsx +33 -24
- package/src/popover/index.ts +14 -0
- package/src/popover/parts.tsx +105 -0
- package/src/popover/popover.module.css +189 -0
- package/src/popover/popover.tsx +80 -0
- package/src/progress/parts.tsx +13 -6
- package/src/progress/progress.tsx +11 -0
- package/src/radio/index.ts +6 -0
- package/src/radio/parts.tsx +42 -0
- package/src/radio/radio.module.css +96 -0
- package/src/radio/radio.tsx +37 -0
- package/src/radio-group/index.ts +5 -0
- package/src/radio-group/parts.tsx +31 -0
- package/src/radio-group/radio-group.module.css +17 -0
- package/src/radio-group/radio-group.tsx +63 -0
- package/src/select/parts.tsx +34 -41
- package/src/select/select.tsx +14 -1
- package/src/separator/separator.tsx +4 -0
- package/src/shared/PopupArrow.tsx +41 -0
- package/src/slider/parts.tsx +13 -24
- package/src/slider/slider.tsx +18 -0
- package/src/styles/reset-scoped.css +112 -0
- package/src/switch/parts.tsx +5 -8
- package/src/switch/switch.module.css +11 -2
- package/src/switch/switch.tsx +12 -0
- package/src/tabs/parts.tsx +7 -12
- package/src/tabs/tabs.tsx +8 -1
- package/src/toast/parts.tsx +11 -20
- package/src/toast/toast.tsx +11 -0
- package/src/tooltip/parts.tsx +7 -12
- package/src/tooltip/tooltip.tsx +9 -0
- package/src/utils/resolveClassName.ts +24 -0
package/src/checkbox/parts.tsx
CHANGED
|
@@ -18,15 +18,13 @@ import { forwardRef } from "react";
|
|
|
18
18
|
import type { ComponentRef, ComponentPropsWithoutRef, ReactNode } from "react";
|
|
19
19
|
import { Checkbox as BaseCheckbox } from "@base-ui/react/checkbox";
|
|
20
20
|
import styles from "./checkbox.module.css";
|
|
21
|
+
import { resolveClassName, cx } from "../utils/resolveClassName";
|
|
21
22
|
|
|
22
23
|
type BaseRootProps = ComponentPropsWithoutRef<typeof BaseCheckbox.Root>;
|
|
23
24
|
type BaseIndicatorProps = ComponentPropsWithoutRef<typeof BaseCheckbox.Indicator>;
|
|
24
25
|
|
|
25
|
-
export interface CheckboxRootProps extends
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
export interface CheckboxIndicatorProps extends Omit<BaseIndicatorProps, "className"> {
|
|
29
|
-
className?: string;
|
|
26
|
+
export interface CheckboxRootProps extends BaseRootProps {}
|
|
27
|
+
export interface CheckboxIndicatorProps extends BaseIndicatorProps {
|
|
30
28
|
/** Custom icon rendered inside the indicator. Defaults to an SVG checkmark. */
|
|
31
29
|
children?: ReactNode;
|
|
32
30
|
}
|
|
@@ -35,7 +33,7 @@ export const CheckboxRoot = forwardRef<ComponentRef<typeof BaseCheckbox.Root>, C
|
|
|
35
33
|
{ className, ...props },
|
|
36
34
|
ref,
|
|
37
35
|
) {
|
|
38
|
-
return <BaseCheckbox.Root ref={ref} className={
|
|
36
|
+
return <BaseCheckbox.Root ref={ref} className={(state) => cx(styles.indicator, resolveClassName(className, state))} {...props} />;
|
|
39
37
|
});
|
|
40
38
|
|
|
41
39
|
export const CheckboxIndicator = forwardRef<ComponentRef<typeof BaseCheckbox.Indicator>, CheckboxIndicatorProps>(function CheckboxIndicator(
|
|
@@ -43,7 +41,7 @@ export const CheckboxIndicator = forwardRef<ComponentRef<typeof BaseCheckbox.Ind
|
|
|
43
41
|
ref,
|
|
44
42
|
) {
|
|
45
43
|
return (
|
|
46
|
-
<BaseCheckbox.Indicator ref={ref} className={
|
|
44
|
+
<BaseCheckbox.Indicator ref={ref} className={(state) => cx(styles.icon, resolveClassName(className, state))} {...props}>
|
|
47
45
|
{children ?? (
|
|
48
46
|
<svg viewBox="0 0 10 10" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
49
47
|
<path d="M1.5 5L3.5 7.5L8.5 2.5" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" />
|
|
@@ -3,11 +3,17 @@ import { Collapsible as BaseCollapsible } from "@base-ui/react/collapsible";
|
|
|
3
3
|
import styles from "./collapsible.module.css";
|
|
4
4
|
|
|
5
5
|
export interface CollapsibleProps {
|
|
6
|
+
/** Content rendered inside the toggle button. */
|
|
6
7
|
trigger: ReactNode;
|
|
8
|
+
/** Content revealed when expanded. */
|
|
7
9
|
children: ReactNode;
|
|
10
|
+
/** Whether the panel is initially open (uncontrolled). */
|
|
8
11
|
defaultOpen?: boolean;
|
|
12
|
+
/** Controlled open state. */
|
|
9
13
|
open?: boolean;
|
|
14
|
+
/** Called when the panel opens or closes. */
|
|
10
15
|
onOpenChange?: (open: boolean) => void;
|
|
16
|
+
/** Prevent the panel from being toggled. */
|
|
11
17
|
disabled?: boolean;
|
|
12
18
|
className?: string;
|
|
13
19
|
}
|
|
@@ -20,6 +26,11 @@ function ChevronIcon() {
|
|
|
20
26
|
);
|
|
21
27
|
}
|
|
22
28
|
|
|
29
|
+
/**
|
|
30
|
+
* A single panel toggled by a button. Unlike Accordion it stands alone —
|
|
31
|
+
* ideal for inline FAQ entries, code blocks, or side panels.
|
|
32
|
+
* Animates via `--collapsible-panel-height`.
|
|
33
|
+
*/
|
|
23
34
|
export function Collapsible({ trigger, children, className, onOpenChange, ...props }: CollapsibleProps) {
|
|
24
35
|
return (
|
|
25
36
|
<BaseCollapsible.Root className={`${styles.root} ${className ?? ""}`} onOpenChange={onOpenChange as never} {...props}>
|
|
@@ -4,43 +4,38 @@
|
|
|
4
4
|
* @example
|
|
5
5
|
* ```tsx
|
|
6
6
|
* import { Collapsible } from '@base-ui/react/collapsible';
|
|
7
|
-
* import { CollapsibleTrigger, CollapsiblePanel } from '@brijbyte/agentic-ui/collapsible';
|
|
7
|
+
* import { CollapsibleRoot, CollapsibleTrigger, CollapsiblePanel } from '@brijbyte/agentic-ui/collapsible';
|
|
8
8
|
*
|
|
9
|
-
* <
|
|
9
|
+
* <CollapsibleRoot>
|
|
10
10
|
* <CollapsibleTrigger>Toggle</CollapsibleTrigger>
|
|
11
11
|
* <CollapsiblePanel>Content</CollapsiblePanel>
|
|
12
|
-
* </
|
|
12
|
+
* </CollapsibleRoot>
|
|
13
13
|
* ```
|
|
14
14
|
*/
|
|
15
15
|
import { forwardRef } from "react";
|
|
16
16
|
import type { ComponentRef, ComponentPropsWithoutRef } from "react";
|
|
17
17
|
import { Collapsible as BaseCollapsible } from "@base-ui/react/collapsible";
|
|
18
18
|
import styles from "./collapsible.module.css";
|
|
19
|
+
import { resolveClassName, cx } from "../utils/resolveClassName";
|
|
19
20
|
|
|
20
21
|
type BaseRootProps = ComponentPropsWithoutRef<typeof BaseCollapsible.Root>;
|
|
21
22
|
type BaseTriggerProps = ComponentPropsWithoutRef<typeof BaseCollapsible.Trigger>;
|
|
22
23
|
type BasePanelProps = ComponentPropsWithoutRef<typeof BaseCollapsible.Panel>;
|
|
23
24
|
|
|
24
|
-
export interface CollapsibleRootProps extends
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
export interface CollapsibleTriggerProps extends Omit<BaseTriggerProps, "className"> {
|
|
28
|
-
className?: string;
|
|
29
|
-
}
|
|
30
|
-
export interface CollapsiblePanelProps extends Omit<BasePanelProps, "className"> {
|
|
31
|
-
className?: string;
|
|
32
|
-
}
|
|
25
|
+
export interface CollapsibleRootProps extends BaseRootProps {}
|
|
26
|
+
export interface CollapsibleTriggerProps extends BaseTriggerProps {}
|
|
27
|
+
export interface CollapsiblePanelProps extends BasePanelProps {}
|
|
33
28
|
|
|
34
29
|
export const CollapsibleRoot = forwardRef<ComponentRef<typeof BaseCollapsible.Root>, CollapsibleRootProps>(function CollapsibleRoot(
|
|
35
30
|
{ className, ...props },
|
|
36
31
|
ref,
|
|
37
32
|
) {
|
|
38
|
-
return <BaseCollapsible.Root ref={ref} className={
|
|
33
|
+
return <BaseCollapsible.Root ref={ref} className={(state) => cx(styles.root, resolveClassName(className, state))} {...props} />;
|
|
39
34
|
});
|
|
40
35
|
|
|
41
36
|
export const CollapsibleTrigger = forwardRef<ComponentRef<typeof BaseCollapsible.Trigger>, CollapsibleTriggerProps>(
|
|
42
37
|
function CollapsibleTrigger({ className, ...props }, ref) {
|
|
43
|
-
return <BaseCollapsible.Trigger ref={ref} className={
|
|
38
|
+
return <BaseCollapsible.Trigger ref={ref} className={(state) => cx(styles.trigger, resolveClassName(className, state))} {...props} />;
|
|
44
39
|
},
|
|
45
40
|
);
|
|
46
41
|
|
|
@@ -48,5 +43,5 @@ export const CollapsiblePanel = forwardRef<ComponentRef<typeof BaseCollapsible.P
|
|
|
48
43
|
{ className, ...props },
|
|
49
44
|
ref,
|
|
50
45
|
) {
|
|
51
|
-
return <BaseCollapsible.Panel ref={ref} className={
|
|
46
|
+
return <BaseCollapsible.Panel ref={ref} className={(state) => cx(styles.panel, resolveClassName(className, state))} {...props} />;
|
|
52
47
|
});
|
|
@@ -26,6 +26,7 @@ export type ContextMenuEntry = ContextMenuItemDef | ContextMenuSeparatorDef | Co
|
|
|
26
26
|
export interface ContextMenuProps {
|
|
27
27
|
/** The element that can be right-clicked / long-pressed to open the menu. */
|
|
28
28
|
children: ReactElement;
|
|
29
|
+
/** Array of menu entries: items, separators, and groups. */
|
|
29
30
|
items: ContextMenuEntry[];
|
|
30
31
|
className?: string;
|
|
31
32
|
}
|
|
@@ -40,6 +41,10 @@ function RenderItem({ item, i }: { item: ContextMenuItemDef; i: number }) {
|
|
|
40
41
|
);
|
|
41
42
|
}
|
|
42
43
|
|
|
44
|
+
/**
|
|
45
|
+
* A menu that appears at the pointer on right-click or long press. Supports
|
|
46
|
+
* items, separators, groups, keyboard shortcuts, and disabled states.
|
|
47
|
+
*/
|
|
43
48
|
export function ContextMenu({ children, items, className }: ContextMenuProps) {
|
|
44
49
|
return (
|
|
45
50
|
<BaseContextMenu.Root>
|
|
@@ -3,28 +3,28 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @example
|
|
5
5
|
* ```tsx
|
|
6
|
-
* import { ContextMenu
|
|
6
|
+
* import { ContextMenu } from '@base-ui/react/context-menu';
|
|
7
7
|
* import { ContextMenuPopup, ContextMenuItem, ContextMenuSeparator } from '@brijbyte/agentic-ui/context-menu';
|
|
8
8
|
*
|
|
9
|
-
* <
|
|
10
|
-
* <
|
|
11
|
-
* <
|
|
12
|
-
* <
|
|
9
|
+
* <ContextMenu.Root>
|
|
10
|
+
* <ContextMenu.Trigger render={<div>Right click me</div>} />
|
|
11
|
+
* <ContextMenu.Portal>
|
|
12
|
+
* <ContextMenu.Positioner>
|
|
13
13
|
* <ContextMenuPopup>
|
|
14
|
-
* <ContextMenuItem>
|
|
15
|
-
* <ContextMenuItem>Copy</ContextMenuItem>
|
|
14
|
+
* <ContextMenuItem>Action</ContextMenuItem>
|
|
16
15
|
* <ContextMenuSeparator />
|
|
17
|
-
* <ContextMenuItem>
|
|
16
|
+
* <ContextMenuItem>Another</ContextMenuItem>
|
|
18
17
|
* </ContextMenuPopup>
|
|
19
|
-
* </
|
|
20
|
-
* </
|
|
21
|
-
* </
|
|
18
|
+
* </ContextMenu.Positioner>
|
|
19
|
+
* </ContextMenu.Portal>
|
|
20
|
+
* </ContextMenu.Root>
|
|
22
21
|
* ```
|
|
23
22
|
*/
|
|
24
23
|
import { forwardRef } from "react";
|
|
25
24
|
import type { ComponentRef, ComponentPropsWithoutRef } from "react";
|
|
26
25
|
import { ContextMenu as BaseContextMenu } from "@base-ui/react/context-menu";
|
|
27
26
|
import styles from "./context-menu.module.css";
|
|
27
|
+
import { resolveClassName, cx } from "../utils/resolveClassName";
|
|
28
28
|
|
|
29
29
|
type BasePopupProps = ComponentPropsWithoutRef<typeof BaseContextMenu.Popup>;
|
|
30
30
|
type BaseItemProps = ComponentPropsWithoutRef<typeof BaseContextMenu.Item>;
|
|
@@ -33,42 +33,32 @@ type BaseGroupProps = ComponentPropsWithoutRef<typeof BaseContextMenu.Group>;
|
|
|
33
33
|
type BaseGroupLabelProps = ComponentPropsWithoutRef<typeof BaseContextMenu.GroupLabel>;
|
|
34
34
|
type BaseSubmenuTriggerProps = ComponentPropsWithoutRef<typeof BaseContextMenu.SubmenuTrigger>;
|
|
35
35
|
|
|
36
|
-
export interface ContextMenuPopupProps extends
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
export interface
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
export interface ContextMenuSeparatorProps extends Omit<BaseSeparatorProps, "className"> {
|
|
43
|
-
className?: string;
|
|
44
|
-
}
|
|
45
|
-
export interface ContextMenuGroupProps extends Omit<BaseGroupProps, "className"> {
|
|
46
|
-
className?: string;
|
|
47
|
-
}
|
|
48
|
-
export interface ContextMenuGroupLabelProps extends Omit<BaseGroupLabelProps, "className"> {
|
|
49
|
-
className?: string;
|
|
50
|
-
}
|
|
51
|
-
export interface ContextMenuSubmenuTriggerProps extends Omit<BaseSubmenuTriggerProps, "className"> {
|
|
52
|
-
className?: string;
|
|
53
|
-
}
|
|
36
|
+
export interface ContextMenuPopupProps extends BasePopupProps {}
|
|
37
|
+
export interface ContextMenuItemProps extends BaseItemProps {}
|
|
38
|
+
export interface ContextMenuSeparatorProps extends BaseSeparatorProps {}
|
|
39
|
+
export interface ContextMenuGroupProps extends BaseGroupProps {}
|
|
40
|
+
export interface ContextMenuGroupLabelProps extends BaseGroupLabelProps {}
|
|
41
|
+
export interface ContextMenuSubmenuTriggerProps extends BaseSubmenuTriggerProps {}
|
|
54
42
|
|
|
55
43
|
export const ContextMenuPopup = forwardRef<ComponentRef<typeof BaseContextMenu.Popup>, ContextMenuPopupProps>(function ContextMenuPopup(
|
|
56
44
|
{ className, ...props },
|
|
57
45
|
ref,
|
|
58
46
|
) {
|
|
59
|
-
return <BaseContextMenu.Popup ref={ref} className={
|
|
47
|
+
return <BaseContextMenu.Popup ref={ref} className={(state) => cx(styles.popup, resolveClassName(className, state))} {...props} />;
|
|
60
48
|
});
|
|
61
49
|
|
|
62
50
|
export const ContextMenuItem = forwardRef<ComponentRef<typeof BaseContextMenu.Item>, ContextMenuItemProps>(function ContextMenuItem(
|
|
63
51
|
{ className, ...props },
|
|
64
52
|
ref,
|
|
65
53
|
) {
|
|
66
|
-
return <BaseContextMenu.Item ref={ref} className={
|
|
54
|
+
return <BaseContextMenu.Item ref={ref} className={(state) => cx(styles.item, resolveClassName(className, state))} {...props} />;
|
|
67
55
|
});
|
|
68
56
|
|
|
69
57
|
export const ContextMenuSeparator = forwardRef<ComponentRef<typeof BaseContextMenu.Separator>, ContextMenuSeparatorProps>(
|
|
70
58
|
function ContextMenuSeparator({ className, ...props }, ref) {
|
|
71
|
-
return
|
|
59
|
+
return (
|
|
60
|
+
<BaseContextMenu.Separator ref={ref} className={(state) => cx(styles.separator, resolveClassName(className, state))} {...props} />
|
|
61
|
+
);
|
|
72
62
|
},
|
|
73
63
|
);
|
|
74
64
|
|
|
@@ -81,14 +71,24 @@ export const ContextMenuGroup = forwardRef<ComponentRef<typeof BaseContextMenu.G
|
|
|
81
71
|
|
|
82
72
|
export const ContextMenuGroupLabel = forwardRef<ComponentRef<typeof BaseContextMenu.GroupLabel>, ContextMenuGroupLabelProps>(
|
|
83
73
|
function ContextMenuGroupLabel({ className, ...props }, ref) {
|
|
84
|
-
return
|
|
74
|
+
return (
|
|
75
|
+
<BaseContextMenu.GroupLabel
|
|
76
|
+
ref={ref}
|
|
77
|
+
className={(state) => cx(styles["group-label"], resolveClassName(className, state))}
|
|
78
|
+
{...props}
|
|
79
|
+
/>
|
|
80
|
+
);
|
|
85
81
|
},
|
|
86
82
|
);
|
|
87
83
|
|
|
88
84
|
export const ContextMenuSubmenuTrigger = forwardRef<ComponentRef<typeof BaseContextMenu.SubmenuTrigger>, ContextMenuSubmenuTriggerProps>(
|
|
89
85
|
function ContextMenuSubmenuTrigger({ className, children, ...props }, ref) {
|
|
90
86
|
return (
|
|
91
|
-
<BaseContextMenu.SubmenuTrigger
|
|
87
|
+
<BaseContextMenu.SubmenuTrigger
|
|
88
|
+
ref={ref}
|
|
89
|
+
className={(state) => cx(styles["submenu-trigger"], resolveClassName(className, state))}
|
|
90
|
+
{...props}
|
|
91
|
+
>
|
|
92
92
|
<span style={{ flex: 1 }}>{children}</span>
|
|
93
93
|
<svg width="10" height="10" viewBox="0 0 10 10" fill="none" className={styles["submenu-icon"]}>
|
|
94
94
|
<path d="M3.5 9L7.5 5L3.5 1" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" />
|
package/src/dialog/dialog.tsx
CHANGED
|
@@ -3,12 +3,17 @@ import { Dialog as BaseDialog } from "@base-ui/react/dialog";
|
|
|
3
3
|
import styles from "./dialog.module.css";
|
|
4
4
|
|
|
5
5
|
export interface DialogProps {
|
|
6
|
+
/** Controlled open state. */
|
|
6
7
|
open?: boolean;
|
|
8
|
+
/** Whether the dialog is initially open (uncontrolled). */
|
|
7
9
|
defaultOpen?: boolean;
|
|
8
|
-
/** `eventDetails` is the base-ui event details object. */
|
|
10
|
+
/** Called when the dialog opens or closes. `eventDetails` is the base-ui event details object. */
|
|
9
11
|
onOpenChange?: (open: boolean, eventDetails: unknown) => void;
|
|
12
|
+
/** Element that opens the dialog when clicked. */
|
|
10
13
|
trigger?: ReactElement;
|
|
14
|
+
/** Heading rendered at the top of the dialog. */
|
|
11
15
|
title?: ReactNode;
|
|
16
|
+
/** Supplementary text below the title. */
|
|
12
17
|
description?: ReactNode;
|
|
13
18
|
children?: ReactNode;
|
|
14
19
|
/** Buttons aligned to the right (cancel, confirm). */
|
|
@@ -20,6 +25,7 @@ export interface DialogProps {
|
|
|
20
25
|
*/
|
|
21
26
|
footerStart?: ReactNode;
|
|
22
27
|
className?: string;
|
|
28
|
+
/** Whether the dialog can be closed by clicking the backdrop or pressing Escape. @default true */
|
|
23
29
|
dismissible?: boolean;
|
|
24
30
|
}
|
|
25
31
|
|
|
@@ -31,6 +37,12 @@ function XIcon() {
|
|
|
31
37
|
);
|
|
32
38
|
}
|
|
33
39
|
|
|
40
|
+
/**
|
|
41
|
+
* Modal overlay dialog with title, description, body, and footer slots.
|
|
42
|
+
* Wraps `@base-ui/react` Dialog with a pre-styled backdrop, popup, and
|
|
43
|
+
* close button. Use `footerStart` for a macOS-style left-aligned
|
|
44
|
+
* destructive action.
|
|
45
|
+
*/
|
|
34
46
|
export function Dialog({
|
|
35
47
|
trigger,
|
|
36
48
|
title,
|
package/src/dialog/parts.tsx
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Styled primitives for Dialog
|
|
3
|
-
* Dialog part and pre-applies the agentic-ui CSS class. All base-ui props are
|
|
4
|
-
* forwarded so you can compose these with a raw `Dialog.Root` / `Dialog.Trigger`.
|
|
2
|
+
* Styled primitives for Dialog.
|
|
5
3
|
*
|
|
6
4
|
* @example
|
|
7
5
|
* ```tsx
|
|
@@ -26,6 +24,7 @@ import { forwardRef } from "react";
|
|
|
26
24
|
import type { ComponentRef, ComponentPropsWithoutRef } from "react";
|
|
27
25
|
import { Dialog as BaseDialog } from "@base-ui/react/dialog";
|
|
28
26
|
import styles from "./dialog.module.css";
|
|
27
|
+
import { resolveClassName, cx } from "../utils/resolveClassName";
|
|
29
28
|
|
|
30
29
|
type BaseBackdropProps = ComponentPropsWithoutRef<typeof BaseDialog.Backdrop>;
|
|
31
30
|
type BaseViewportProps = ComponentPropsWithoutRef<typeof BaseDialog.Viewport>;
|
|
@@ -34,63 +33,51 @@ type BaseTitleProps = ComponentPropsWithoutRef<typeof BaseDialog.Title>;
|
|
|
34
33
|
type BaseDescriptionProps = ComponentPropsWithoutRef<typeof BaseDialog.Description>;
|
|
35
34
|
type BaseCloseProps = ComponentPropsWithoutRef<typeof BaseDialog.Close>;
|
|
36
35
|
|
|
37
|
-
export interface DialogBackdropProps extends
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
export interface
|
|
41
|
-
|
|
42
|
-
}
|
|
43
|
-
export interface DialogPopupProps extends Omit<BasePopupProps, "className"> {
|
|
44
|
-
className?: string;
|
|
45
|
-
}
|
|
46
|
-
export interface DialogTitleProps extends Omit<BaseTitleProps, "className"> {
|
|
47
|
-
className?: string;
|
|
48
|
-
}
|
|
49
|
-
export interface DialogDescriptionProps extends Omit<BaseDescriptionProps, "className"> {
|
|
50
|
-
className?: string;
|
|
51
|
-
}
|
|
52
|
-
export interface DialogCloseProps extends Omit<BaseCloseProps, "className"> {
|
|
53
|
-
className?: string;
|
|
54
|
-
}
|
|
36
|
+
export interface DialogBackdropProps extends BaseBackdropProps {}
|
|
37
|
+
export interface DialogViewportProps extends BaseViewportProps {}
|
|
38
|
+
export interface DialogPopupProps extends BasePopupProps {}
|
|
39
|
+
export interface DialogTitleProps extends BaseTitleProps {}
|
|
40
|
+
export interface DialogDescriptionProps extends BaseDescriptionProps {}
|
|
41
|
+
export interface DialogCloseProps extends BaseCloseProps {}
|
|
55
42
|
|
|
56
43
|
export const DialogBackdrop = forwardRef<ComponentRef<typeof BaseDialog.Backdrop>, DialogBackdropProps>(function DialogBackdrop(
|
|
57
44
|
{ className, ...props },
|
|
58
45
|
ref,
|
|
59
46
|
) {
|
|
60
|
-
return <BaseDialog.Backdrop ref={ref} className={
|
|
47
|
+
return <BaseDialog.Backdrop ref={ref} className={(state) => cx(styles.backdrop, resolveClassName(className, state))} {...props} />;
|
|
61
48
|
});
|
|
62
49
|
|
|
63
50
|
export const DialogViewport = forwardRef<ComponentRef<typeof BaseDialog.Viewport>, DialogViewportProps>(function DialogViewport(
|
|
64
51
|
{ className, ...props },
|
|
65
52
|
ref,
|
|
66
53
|
) {
|
|
67
|
-
return <BaseDialog.Viewport ref={ref} className={
|
|
54
|
+
return <BaseDialog.Viewport ref={ref} className={(state) => cx(styles.viewport ?? "", resolveClassName(className, state))} {...props} />;
|
|
68
55
|
});
|
|
69
56
|
|
|
70
57
|
export const DialogPopup = forwardRef<ComponentRef<typeof BaseDialog.Popup>, DialogPopupProps>(function DialogPopup(
|
|
71
58
|
{ className, ...props },
|
|
72
59
|
ref,
|
|
73
60
|
) {
|
|
74
|
-
return <BaseDialog.Popup ref={ref} className={
|
|
61
|
+
return <BaseDialog.Popup ref={ref} className={(state) => cx(styles.popup, resolveClassName(className, state))} {...props} />;
|
|
75
62
|
});
|
|
76
63
|
|
|
77
64
|
export const DialogTitle = forwardRef<ComponentRef<typeof BaseDialog.Title>, DialogTitleProps>(function DialogTitle(
|
|
78
65
|
{ className, ...props },
|
|
79
66
|
ref,
|
|
80
67
|
) {
|
|
81
|
-
return <BaseDialog.Title ref={ref} className={
|
|
68
|
+
return <BaseDialog.Title ref={ref} className={(state) => cx(styles.title, resolveClassName(className, state))} {...props} />;
|
|
82
69
|
});
|
|
83
70
|
|
|
84
71
|
export const DialogDescription = forwardRef<ComponentRef<typeof BaseDialog.Description>, DialogDescriptionProps>(function DialogDescription(
|
|
85
72
|
{ className, ...props },
|
|
86
73
|
ref,
|
|
87
74
|
) {
|
|
88
|
-
return <BaseDialog.Description ref={ref} className={
|
|
75
|
+
return <BaseDialog.Description ref={ref} className={(state) => cx(styles.description, resolveClassName(className, state))} {...props} />;
|
|
89
76
|
});
|
|
90
77
|
|
|
91
78
|
export const DialogClose = forwardRef<ComponentRef<typeof BaseDialog.Close>, DialogCloseProps>(function DialogClose(
|
|
92
79
|
{ className, ...props },
|
|
93
80
|
ref,
|
|
94
81
|
) {
|
|
95
|
-
return <BaseDialog.Close ref={ref} className={
|
|
82
|
+
return <BaseDialog.Close ref={ref} className={(state) => cx(styles.close, resolveClassName(className, state))} {...props} />;
|
|
96
83
|
});
|
package/src/drawer/drawer.tsx
CHANGED
|
@@ -9,17 +9,23 @@ export interface DrawerProps {
|
|
|
9
9
|
trigger?: ReactElement;
|
|
10
10
|
/** Which edge the drawer slides in from. @default "right" */
|
|
11
11
|
side?: DrawerSide;
|
|
12
|
+
/** Heading rendered at the top of the drawer. */
|
|
12
13
|
title?: ReactNode;
|
|
14
|
+
/** Supplementary text below the title. */
|
|
13
15
|
description?: ReactNode;
|
|
14
16
|
children?: ReactNode;
|
|
17
|
+
/** Content rendered at the bottom of the drawer. */
|
|
15
18
|
footer?: ReactNode;
|
|
16
19
|
/** Show a drag handle bar (useful for bottom/top drawers). @default true for bottom/top */
|
|
17
20
|
handleBar?: boolean;
|
|
18
21
|
/** Show a close button in the top-right corner. @default true */
|
|
19
22
|
dismissible?: boolean;
|
|
20
23
|
|
|
24
|
+
/** Controlled open state. */
|
|
21
25
|
open?: boolean;
|
|
26
|
+
/** Whether the drawer is initially open (uncontrolled). */
|
|
22
27
|
defaultOpen?: boolean;
|
|
28
|
+
/** Called when the drawer opens or closes. */
|
|
23
29
|
onOpenChange?: (open: boolean) => void;
|
|
24
30
|
}
|
|
25
31
|
|
|
@@ -47,6 +53,11 @@ const POPUP_CLASS: Record<DrawerSide, string> = {
|
|
|
47
53
|
top: styles["popup-top"] as string,
|
|
48
54
|
};
|
|
49
55
|
|
|
56
|
+
/**
|
|
57
|
+
* A panel that slides in from any edge of the screen with swipe-to-dismiss
|
|
58
|
+
* gestures. Supports left, right, top, and bottom orientations with an
|
|
59
|
+
* optional drag handle bar.
|
|
60
|
+
*/
|
|
50
61
|
export function Drawer({
|
|
51
62
|
trigger,
|
|
52
63
|
side = "right",
|
package/src/drawer/parts.tsx
CHANGED
|
@@ -31,8 +31,7 @@ import type { ComponentPropsWithoutRef } from "react";
|
|
|
31
31
|
import { Drawer as BaseDrawer } from "@base-ui/react/drawer";
|
|
32
32
|
import type { DrawerSide } from "./drawer";
|
|
33
33
|
import styles from "./drawer.module.css";
|
|
34
|
-
|
|
35
|
-
// ─── Base prop types ───────────────────────────────────────────────────────
|
|
34
|
+
import { resolveClassName, cx } from "../utils/resolveClassName";
|
|
36
35
|
|
|
37
36
|
type BaseBackdropProps = ComponentPropsWithoutRef<typeof BaseDrawer.Backdrop>;
|
|
38
37
|
type BaseViewportProps = ComponentPropsWithoutRef<typeof BaseDrawer.Viewport>;
|
|
@@ -42,73 +41,66 @@ type BaseTitleProps = ComponentPropsWithoutRef<typeof BaseDrawer.Title>;
|
|
|
42
41
|
type BaseDescriptionProps = ComponentPropsWithoutRef<typeof BaseDrawer.Description>;
|
|
43
42
|
type BaseCloseProps = ComponentPropsWithoutRef<typeof BaseDrawer.Close>;
|
|
44
43
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
export interface DrawerBackdropProps extends Omit<BaseBackdropProps, "className"> {
|
|
48
|
-
className?: string;
|
|
49
|
-
}
|
|
50
|
-
export interface DrawerViewportProps extends Omit<BaseViewportProps, "className"> {
|
|
51
|
-
className?: string;
|
|
44
|
+
export interface DrawerBackdropProps extends BaseBackdropProps {}
|
|
45
|
+
export interface DrawerViewportProps extends BaseViewportProps {
|
|
52
46
|
side?: DrawerSide;
|
|
53
47
|
}
|
|
54
|
-
export interface DrawerPopupProps extends
|
|
55
|
-
className?: string;
|
|
48
|
+
export interface DrawerPopupProps extends BasePopupProps {
|
|
56
49
|
side?: DrawerSide;
|
|
57
50
|
}
|
|
58
|
-
export interface DrawerContentProps extends
|
|
59
|
-
|
|
60
|
-
}
|
|
61
|
-
export interface
|
|
62
|
-
className?: string;
|
|
63
|
-
}
|
|
64
|
-
export interface DrawerDescriptionProps extends Omit<BaseDescriptionProps, "className"> {
|
|
65
|
-
className?: string;
|
|
66
|
-
}
|
|
67
|
-
export interface DrawerCloseProps extends Omit<BaseCloseProps, "className"> {
|
|
68
|
-
className?: string;
|
|
69
|
-
}
|
|
51
|
+
export interface DrawerContentProps extends BaseContentProps {}
|
|
52
|
+
export interface DrawerTitleProps extends BaseTitleProps {}
|
|
53
|
+
export interface DrawerDescriptionProps extends BaseDescriptionProps {}
|
|
54
|
+
export interface DrawerCloseProps extends BaseCloseProps {}
|
|
70
55
|
|
|
71
|
-
|
|
56
|
+
const POPUP_CLASS: Record<DrawerSide, string> = {
|
|
57
|
+
right: styles["popup-right"] as string,
|
|
58
|
+
left: styles["popup-left"] as string,
|
|
59
|
+
bottom: styles["popup-bottom"] as string,
|
|
60
|
+
top: styles["popup-top"] as string,
|
|
61
|
+
};
|
|
72
62
|
|
|
73
63
|
export const DrawerBackdrop = forwardRef<HTMLDivElement, DrawerBackdropProps>(function DrawerBackdrop({ className, ...props }, ref) {
|
|
74
|
-
return <BaseDrawer.Backdrop ref={ref} className={
|
|
64
|
+
return <BaseDrawer.Backdrop ref={ref} className={(state) => cx(styles.backdrop, resolveClassName(className, state))} {...props} />;
|
|
75
65
|
});
|
|
76
66
|
|
|
77
67
|
export const DrawerViewport = forwardRef<HTMLDivElement, DrawerViewportProps>(function DrawerViewport(
|
|
78
68
|
{ className, side = "right", ...props },
|
|
79
69
|
ref,
|
|
80
70
|
) {
|
|
81
|
-
return
|
|
71
|
+
return (
|
|
72
|
+
<BaseDrawer.Viewport
|
|
73
|
+
ref={ref}
|
|
74
|
+
className={(state) => cx(styles.viewport, resolveClassName(className, state))}
|
|
75
|
+
data-side={side}
|
|
76
|
+
{...props}
|
|
77
|
+
/>
|
|
78
|
+
);
|
|
82
79
|
});
|
|
83
80
|
|
|
84
|
-
const POPUP_CLASS: Record<DrawerSide, string> = {
|
|
85
|
-
right: styles["popup-right"] as string,
|
|
86
|
-
left: styles["popup-left"] as string,
|
|
87
|
-
bottom: styles["popup-bottom"] as string,
|
|
88
|
-
top: styles["popup-top"] as string,
|
|
89
|
-
};
|
|
90
|
-
|
|
91
81
|
export const DrawerPopup = forwardRef<HTMLDivElement, DrawerPopupProps>(function DrawerPopup({ className, side = "right", ...props }, ref) {
|
|
92
|
-
return
|
|
82
|
+
return (
|
|
83
|
+
<BaseDrawer.Popup ref={ref} className={(state) => cx(styles.popup, POPUP_CLASS[side], resolveClassName(className, state))} {...props} />
|
|
84
|
+
);
|
|
93
85
|
});
|
|
94
86
|
|
|
95
87
|
export const DrawerContent = forwardRef<HTMLDivElement, DrawerContentProps>(function DrawerContent({ className, ...props }, ref) {
|
|
96
|
-
return <BaseDrawer.Content ref={ref} className={
|
|
88
|
+
return <BaseDrawer.Content ref={ref} className={(state) => cx(styles.content, resolveClassName(className, state))} {...props} />;
|
|
97
89
|
});
|
|
98
90
|
|
|
99
91
|
export const DrawerTitle = forwardRef<HTMLHeadingElement, DrawerTitleProps>(function DrawerTitle({ className, ...props }, ref) {
|
|
100
|
-
return <BaseDrawer.Title ref={ref} className={
|
|
92
|
+
return <BaseDrawer.Title ref={ref} className={(state) => cx(styles.title, resolveClassName(className, state))} {...props} />;
|
|
101
93
|
});
|
|
102
94
|
|
|
103
95
|
export const DrawerDescription = forwardRef<HTMLParagraphElement, DrawerDescriptionProps>(function DrawerDescription(
|
|
104
96
|
{ className, ...props },
|
|
105
97
|
ref,
|
|
106
98
|
) {
|
|
107
|
-
return <BaseDrawer.Description ref={ref} className={
|
|
99
|
+
return <BaseDrawer.Description ref={ref} className={(state) => cx(styles.description, resolveClassName(className, state))} {...props} />;
|
|
108
100
|
});
|
|
109
101
|
|
|
110
102
|
export const DrawerClose = forwardRef<HTMLButtonElement, DrawerCloseProps>(function DrawerClose({ className, ...props }, ref) {
|
|
111
|
-
return <BaseDrawer.Close ref={ref} className={
|
|
103
|
+
return <BaseDrawer.Close ref={ref} className={(state) => cx(styles.close, resolveClassName(className, state))} {...props} />;
|
|
112
104
|
});
|
|
113
105
|
|
|
114
106
|
/** A decorative drag handle bar. Place at the top of a bottom drawer or bottom of a top drawer. */
|
package/src/index.ts
CHANGED
|
@@ -14,8 +14,12 @@ export * from "./dialog";
|
|
|
14
14
|
export * from "./drawer";
|
|
15
15
|
export * from "./input";
|
|
16
16
|
export * from "./menu";
|
|
17
|
+
export * from "./meter";
|
|
17
18
|
export * from "./number-field";
|
|
19
|
+
export * from "./popover";
|
|
18
20
|
export * from "./progress";
|
|
21
|
+
export * from "./radio";
|
|
22
|
+
export * from "./radio-group";
|
|
19
23
|
export * from "./select";
|
|
20
24
|
export * from "./separator";
|
|
21
25
|
export * from "./slider";
|
package/src/input/input.tsx
CHANGED
|
@@ -9,11 +9,19 @@ export type InputSize = "sm" | "md" | "lg";
|
|
|
9
9
|
export interface InputProps extends Omit<ComponentPropsWithoutRef<"input">, "size"> {
|
|
10
10
|
/** Visual size. Maps to height + font-size design tokens. Default: `"md"`. */
|
|
11
11
|
size?: InputSize;
|
|
12
|
+
/** Icon or element rendered before the input text. */
|
|
12
13
|
leftAdornment?: ReactNode;
|
|
14
|
+
/** Icon or element rendered after the input text. */
|
|
13
15
|
rightAdornment?: ReactNode;
|
|
16
|
+
/** Applies error styling and sets `aria-invalid`. */
|
|
14
17
|
invalid?: boolean;
|
|
15
18
|
}
|
|
16
19
|
|
|
20
|
+
/**
|
|
21
|
+
* Text input with optional left and right adornment slots. Extends the
|
|
22
|
+
* native `<input>` API — replaces the numeric `size` attribute with a
|
|
23
|
+
* token-based size prop.
|
|
24
|
+
*/
|
|
17
25
|
export const Input = forwardRef<HTMLInputElement, InputProps>(function Input(
|
|
18
26
|
{ size = "md", leftAdornment, rightAdornment, invalid, className, ...props },
|
|
19
27
|
ref,
|
package/src/menu/menu.module.css
CHANGED
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
font-family: var(--font-mono);
|
|
15
15
|
font-size: var(--font-size-sm);
|
|
16
16
|
min-width: 200px;
|
|
17
|
-
transform-origin: var(--transform-origin);
|
|
18
17
|
outline: none;
|
|
18
|
+
transition: opacity 150ms var(--easing-ease-out);
|
|
19
19
|
}
|
|
20
20
|
@supports (backdrop-filter: blur(12px)) {
|
|
21
21
|
.popup {
|
|
@@ -25,17 +25,10 @@
|
|
|
25
25
|
}
|
|
26
26
|
.popup[data-starting-style] {
|
|
27
27
|
opacity: 0;
|
|
28
|
-
transform: scale(0.95);
|
|
29
|
-
transition:
|
|
30
|
-
opacity 150ms var(--easing-ease-out),
|
|
31
|
-
transform 150ms var(--easing-ease-out);
|
|
32
28
|
}
|
|
33
29
|
.popup[data-ending-style] {
|
|
34
30
|
opacity: 0;
|
|
35
|
-
|
|
36
|
-
transition:
|
|
37
|
-
opacity 75ms var(--easing-ease-in),
|
|
38
|
-
transform 75ms var(--easing-ease-in);
|
|
31
|
+
transition: opacity 75ms var(--easing-ease-in);
|
|
39
32
|
}
|
|
40
33
|
/* ─── Item ───────────────────────────────────────────────────────── */
|
|
41
34
|
.item {
|
|
@@ -136,7 +129,7 @@
|
|
|
136
129
|
.arrow-fill {
|
|
137
130
|
fill: var(--color-overlay);
|
|
138
131
|
}
|
|
139
|
-
.arrow-
|
|
132
|
+
.arrow-seam {
|
|
140
133
|
fill: var(--color-line);
|
|
141
134
|
}
|
|
142
135
|
}
|