canny-ui-react 6.6.0 → 6.7.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/README.md CHANGED
@@ -55,7 +55,7 @@ export function SignInCard() {
55
55
 
56
56
  ## Highlights
57
57
 
58
- - **Buttons** — 7 variants × 5 colors × 3 sizes × 3 shapes, click-position ripple powered by `motion`, attached/spaced groups, FAB with spring entrance, Radix-powered toggles and segmented controls
58
+ - **Buttons** — 7 variants × 5 colors × 3 sizes × 3 shapes, click-position ripple powered by `motion`, `asChild` to render a router `<Link>` / `<a>` as a button, attached/spaced groups, FAB with spring entrance, Radix-powered toggles and segmented controls
59
59
  - **Inputs** — prefix/suffix slots, clear button, password toggle, validation states wired through `<Field>`
60
60
  - **Select / MultiSelect** — Radix Select + cmdk combobox with chip tokens, groups, descriptions, `maxItems` cap
61
61
  - **Layout primitives** — `<Box>`, `<Stack>`, `<Row>`, `<Grid>`, `<Container>` map props to utility classes, polymorphic `as`
@@ -37,6 +37,18 @@ interface AutocompleteBase {
37
37
  disabled?: boolean;
38
38
  /** Show a clear button when something is selected. */
39
39
  clearable?: boolean;
40
+ /**
41
+ * Controlled open state of the dropdown. Pair with `onOpenChange`; leave
42
+ * unset to let the component manage it.
43
+ */
44
+ open?: boolean;
45
+ /** Uncontrolled initial open state. Default: `false`. */
46
+ defaultOpen?: boolean;
47
+ /**
48
+ * Fires when the dropdown asks to open or close (trigger click, Esc, outside
49
+ * click, or a pick in single mode) — e.g. to load options on first open.
50
+ */
51
+ onOpenChange?: (open: boolean) => void;
40
52
  /** Field-threading: id forwarded to the trigger. */
41
53
  id?: string;
42
54
  /** Field-threading: forwarded ARIA. */
@@ -24,6 +24,22 @@ export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
24
24
  iconPosition?: ButtonIconPosition;
25
25
  /** Disable the MUI-style click ripple. Default: `false`. */
26
26
  disableRipple?: boolean;
27
+ /**
28
+ * Render the single child element instead of a `<button>` — typically a
29
+ * router `<Link>` or an `<a href>` — so a button that navigates keeps link
30
+ * behaviour (middle-click, "open in new tab", link semantics). The child gets
31
+ * the button's classes, icon, spinner and ripple, and its own content goes
32
+ * in the button's content slot. `disabled` / `loading` set `aria-disabled`,
33
+ * drop it from the tab order and cancel the click (links have no `disabled`
34
+ * attribute). The child must accept a ref and spread its props onto the DOM
35
+ * element. Default: `false`.
36
+ *
37
+ * @example
38
+ * <Button asChild variant="outline" icon={<Pencil size={14} />}>
39
+ * <Link href={`/workflows/${id}/edit`}>Edit</Link>
40
+ * </Button>
41
+ */
42
+ asChild?: boolean;
27
43
  /**
28
44
  * One-off CSS, same as `Box`'s `sx`: each value may be a scalar or a
29
45
  * responsive breakpoint map (`{ base, sm, md, lg, xl }`). Scalar-only sx
@@ -1,13 +1,23 @@
1
- import type { ReactNode } from 'react';
1
+ import type { ReactElement, ReactNode } from 'react';
2
2
  import type { ButtonProps } from './Button.types';
3
3
  export interface IconButtonProps extends Omit<ButtonProps, 'children' | 'icon' | 'iconPosition'> {
4
4
  /** Icon element. Required. */
5
5
  icon: ReactNode;
6
6
  /** Accessible label. Required — icon-only buttons must have one. */
7
7
  'aria-label': string;
8
+ /**
9
+ * With `asChild`: the element to render as, e.g. `<Link href="/edit" />`.
10
+ * The icon is placed inside it.
11
+ */
12
+ children?: ReactElement;
8
13
  }
9
14
  /**
10
15
  * Convenience over `<Button shape="circle" icon={...} aria-label="…" />`.
11
16
  * Enforces `aria-label` at the type level for icon-only accessibility.
17
+ *
18
+ * @example
19
+ * <IconButton icon={<Pencil size={16} />} aria-label="Edit" asChild>
20
+ * <Link href={`/workflows/${id}/edit`} />
21
+ * </IconButton>
12
22
  */
13
23
  export declare const IconButton: import("react").ForwardRefExoticComponent<IconButtonProps & import("react").RefAttributes<HTMLButtonElement>>;