@ctrl-ui/react 0.8.0 → 0.8.2

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.
Files changed (62) hide show
  1. package/README.md +1 -0
  2. package/dist/blocks/coding-agent.js +3 -1
  3. package/dist/blocks/file-explorer.js +3 -1
  4. package/dist/blocks/settings.js +3 -1
  5. package/dist/control-props.d.ts +2 -1
  6. package/dist/email/email.d.ts +28 -0
  7. package/dist/email/email.js +79 -0
  8. package/dist/email/length.d.ts +4 -0
  9. package/dist/email/length.js +34 -0
  10. package/dist/email/templates.d.ts +51 -0
  11. package/dist/email/templates.js +228 -0
  12. package/dist/email/theme.d.ts +35 -0
  13. package/dist/email/theme.js +113 -0
  14. package/dist/extensions/create-track-highlight.d.ts +0 -2
  15. package/dist/extensions/create-track-highlight.js +49 -8
  16. package/dist/extensions/supports-anchor-transitions.d.ts +4 -0
  17. package/dist/extensions/supports-anchor-transitions.js +31 -0
  18. package/dist/extensions/track-highlight.d.ts +0 -6
  19. package/dist/extensions/track-highlight.js +25 -9
  20. package/dist/knob-contracts/button-knobs.d.ts +1 -1
  21. package/dist/knob-contracts/button-knobs.js +4 -1
  22. package/dist/knob-contracts/progressive-blur-knobs.d.ts +5 -0
  23. package/dist/knob-contracts/progressive-blur-knobs.js +9 -0
  24. package/dist/scripts/contrast-eval.d.ts +46 -0
  25. package/dist/scripts/contrast-eval.js +327 -0
  26. package/dist/skin.config.js +9 -1
  27. package/dist/skin.d.ts +11 -9
  28. package/dist/skin.js +0 -1
  29. package/dist/styles/index.css +3 -1
  30. package/dist/styles/recipes/button-group.css +46 -0
  31. package/dist/styles/recipes/button.css +53 -5
  32. package/dist/styles/recipes/progressive-blur.css +145 -0
  33. package/dist/styles/recipes/scroll-area.css +140 -5
  34. package/dist/styles/recipes/sidebar-menu.css +156 -0
  35. package/dist/styles/recipes/sidebar.css +25 -69
  36. package/dist/styles/recipes/table-of-contents.css +1 -1
  37. package/dist/styles/recipes/track-highlight.css +126 -2
  38. package/dist/styles/recipes/tree.css +4 -0
  39. package/dist/ui/button-group.d.ts +3 -1
  40. package/dist/ui/button-group.js +21 -18
  41. package/dist/ui/button.d.ts +3 -1
  42. package/dist/ui/button.js +13 -4
  43. package/dist/ui/checkbox-group.d.ts +5 -3
  44. package/dist/ui/checkbox-group.js +23 -6
  45. package/dist/ui/combobox.d.ts +2 -0
  46. package/dist/ui/dropdown-menu.d.ts +28 -21
  47. package/dist/ui/dropdown-menu.js +112 -13
  48. package/dist/ui/progressive-blur.d.ts +12 -0
  49. package/dist/ui/progressive-blur.js +47 -0
  50. package/dist/ui/scroll-area.d.ts +4 -1
  51. package/dist/ui/scroll-area.js +27 -4
  52. package/dist/ui/sidebar-menu.d.ts +49 -0
  53. package/dist/ui/sidebar-menu.js +160 -0
  54. package/dist/ui/sidebar-provider.d.ts +28 -0
  55. package/dist/ui/sidebar-provider.js +80 -0
  56. package/dist/ui/sidebar.d.ts +4 -61
  57. package/dist/ui/sidebar.js +23 -202
  58. package/dist/ui/table-of-contents.js +3 -11
  59. package/dist/ui/toggle.d.ts +3 -2
  60. package/dist/ui/toggle.js +22 -10
  61. package/dist/ui/tree.js +13 -19
  62. package/package.json +5 -1
@@ -1,16 +1,33 @@
1
1
  "use client";
2
2
  import { cn } from "../lib/cn.js";
3
- import { jsx } from "react/jsx-runtime";
3
+ import { skinIndicator } from "../skin.js";
4
+ import { TrackHighlight } from "../extensions/track-highlight.js";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
4
6
  import { CheckboxGroup as CheckboxGroup$1 } from "@base-ui/react/checkbox-group";
5
7
  //#region src/ui/checkbox-group.tsx
6
- function CheckboxGroup({ className, orientation = "vertical", ...props }) {
7
- return /* @__PURE__ */ jsx(CheckboxGroup$1, {
8
+ function CheckboxGroup({ className, orientation = "vertical", indicator, children, ...props }) {
9
+ const resolvedIndicator = indicator ?? skinIndicator("checkbox-group") ?? "none";
10
+ return /* @__PURE__ */ jsxs(CheckboxGroup$1, {
8
11
  "data-control-ui": "checkbox-group",
12
+ "data-control-family": "checkbox-group",
9
13
  "data-slot": "root",
10
14
  "data-orientation": orientation,
11
- className: cn("flex flex-col gap-2.5 data-[orientation=horizontal]:flex-row data-[orientation=horizontal]:gap-4", className),
12
- ...props
15
+ "data-track": resolvedIndicator,
16
+ className: cn("flex flex-col gap-2.5 data-[orientation=horizontal]:flex-row data-[orientation=horizontal]:gap-4 data-[track=hover]:relative data-[track=hover]:isolate data-[track=hover]:gap-0", className),
17
+ ...props,
18
+ children: [children, resolvedIndicator === "hover" ? /* @__PURE__ */ jsx(TrackHighlight, {}) : null]
19
+ });
20
+ }
21
+ function CheckboxGroupItem({ className, htmlFor, children, ...props }) {
22
+ return /* @__PURE__ */ jsx("label", {
23
+ htmlFor,
24
+ "data-control-ui": "checkbox-group",
25
+ "data-slot": "item",
26
+ "data-track-item": "",
27
+ className: cn("flex cursor-pointer items-start gap-2.5 rounded-(--radius-control) p-2 text-body has-[[data-disabled]]:cursor-not-allowed", className),
28
+ ...props,
29
+ children
13
30
  });
14
31
  }
15
32
  //#endregion
16
- export { CheckboxGroup };
33
+ export { CheckboxGroup, CheckboxGroupItem };
@@ -3,6 +3,7 @@ import { ControlSize } from "../control-variants.js";
3
3
  import { PopupKnobStyle } from "../knob-contracts/popup-knobs.js";
4
4
  import { FieldKnobStyle } from "../knob-contracts/field-knobs.js";
5
5
  import { CSSProperties, ComponentProps, ReactNode } from "react";
6
+ import { Combobox as Combobox$1 } from "@base-ui/react/combobox";
6
7
  //#region src/ui/combobox.d.ts
7
8
  type ComboboxProps<Value = string> = {
8
9
  children?: ReactNode;
@@ -23,6 +24,7 @@ type ComboboxProps<Value = string> = {
23
24
  autoHighlight?: boolean;
24
25
  itemToStringLabel?: (itemValue: Value) => string;
25
26
  isItemEqualToValue?: (itemValue: Value, value: Value) => boolean;
27
+ filter?: Combobox$1.Root.Props<Value>["filter"];
26
28
  };
27
29
  type ComboboxInputProps = Omit<Omit<ComponentProps<"input">, "size">, "style"> & {
28
30
  style?: CSSProperties & FieldKnobStyle;
@@ -1,46 +1,53 @@
1
- import { OpenChangeEventDetails } from "../control-props.js";
2
1
  import { ControlSize } from "../control-variants.js";
3
2
  import { ButtonKnobStyle } from "../knob-contracts/button-knobs.js";
4
3
  import { PopupKnobStyle } from "../knob-contracts/popup-knobs.js";
5
- import { CSSProperties, ComponentProps, MouseEvent, ReactNode } from "react";
4
+ import { CSSProperties, ComponentProps } from "react";
6
5
  import { Menu } from "@base-ui/react/menu";
7
6
  //#region src/ui/dropdown-menu.d.ts
8
- type DropdownMenuProps = {
9
- children?: ReactNode;
10
- open?: boolean;
11
- defaultOpen?: boolean;
12
- onOpenChange?: (open: boolean, eventDetails: OpenChangeEventDetails) => void;
7
+ type DropdownMenuStyledProps<PrimitiveProps> = Omit<PrimitiveProps, "className" | "style"> & {
8
+ className?: string;
9
+ style?: CSSProperties & PopupKnobStyle;
13
10
  };
11
+ type DropdownMenuProps = Menu.Root.Props;
14
12
  declare const dropdownMenuTriggerVariants: readonly ["surface", "ghost"];
15
13
  type DropdownMenuTriggerVariant = (typeof dropdownMenuTriggerVariants)[number];
16
- type DropdownMenuTriggerProps = Omit<ComponentProps<"button">, "style"> & {
14
+ type DropdownMenuTriggerProps = Omit<ComponentProps<"button">, "style"> & Pick<ComponentProps<typeof Menu.Trigger>, "nativeButton" | "render"> & {
17
15
  style?: CSSProperties & ButtonKnobStyle;
18
16
  } & {
19
17
  size?: ControlSize;
20
18
  iconOnly?: boolean;
21
19
  variant?: DropdownMenuTriggerVariant;
22
20
  };
23
- type DropdownMenuContentProps = Omit<ComponentProps<"div">, "style"> & {
24
- style?: CSSProperties & PopupKnobStyle;
25
- };
26
- type DropdownMenuItemProps = Omit<Omit<ComponentProps<"div">, "onClick">, "style"> & {
27
- style?: CSSProperties & PopupKnobStyle;
28
- } & {
29
- disabled?: boolean;
30
- onClick?: (event: MouseEvent) => void;
31
- };
21
+ type DropdownMenuContentProps = DropdownMenuStyledProps<Menu.Popup.Props> & Pick<Menu.Positioner.Props, "side" | "sideOffset" | "align" | "alignOffset" | "collisionBoundary" | "collisionPadding" | "collisionAvoidance">;
22
+ type DropdownMenuItemProps = DropdownMenuStyledProps<Menu.Item.Props>;
23
+ type DropdownMenuGroupProps = DropdownMenuStyledProps<Menu.Group.Props>;
24
+ type DropdownMenuCheckboxItemProps = DropdownMenuStyledProps<Menu.CheckboxItem.Props>;
25
+ type DropdownMenuRadioGroupProps = DropdownMenuStyledProps<Menu.RadioGroup.Props>;
26
+ type DropdownMenuRadioItemProps = DropdownMenuStyledProps<Menu.RadioItem.Props>;
27
+ type DropdownMenuSubProps = Menu.SubmenuRoot.Props;
28
+ type DropdownMenuSubTriggerProps = DropdownMenuStyledProps<Menu.SubmenuTrigger.Props>;
29
+ type DropdownMenuSubContentProps = DropdownMenuContentProps;
30
+ type DropdownMenuShortcutProps = DropdownMenuStyledProps<ComponentProps<"span">>;
32
31
  type DropdownMenuSeparatorProps = Omit<ComponentProps<"div">, "style"> & {
33
32
  style?: CSSProperties & PopupKnobStyle;
34
33
  };
35
34
  type DropdownMenuLabelProps = Omit<ComponentProps<"div">, "style"> & {
36
35
  style?: CSSProperties & PopupKnobStyle;
37
36
  };
38
- type RefinedDropdownMenuTriggerProps = DropdownMenuTriggerProps & Pick<ComponentProps<typeof Menu.Trigger>, "nativeButton" | "render">;
39
37
  declare function DropdownMenu({ children, ...props }: DropdownMenuProps): import("react").JSX.Element;
40
- declare function DropdownMenuTrigger({ size, iconOnly, variant, className, children, disabled, ...props }: RefinedDropdownMenuTriggerProps): import("react").JSX.Element;
41
- declare function DropdownMenuContent({ className, children, ...props }: DropdownMenuContentProps): import("react").JSX.Element;
38
+ declare function DropdownMenuTrigger({ size, iconOnly, variant, className, children, disabled, ...props }: DropdownMenuTriggerProps): import("react").JSX.Element;
39
+ declare function DropdownMenuContent({ className, children, side, sideOffset, align, alignOffset, collisionBoundary, collisionPadding, collisionAvoidance, ...props }: DropdownMenuContentProps): import("react").JSX.Element;
42
40
  declare function DropdownMenuItem({ className, ...props }: DropdownMenuItemProps): import("react").JSX.Element;
43
41
  declare function DropdownMenuSeparator({ className, ...props }: DropdownMenuSeparatorProps): import("react").JSX.Element;
44
42
  declare function DropdownMenuLabel({ className, ...props }: DropdownMenuLabelProps): import("react").JSX.Element;
43
+ declare function DropdownMenuPortal(props: Menu.Portal.Props): import("react").JSX.Element;
44
+ declare function DropdownMenuGroup(props: DropdownMenuGroupProps): import("react").JSX.Element;
45
+ declare function DropdownMenuCheckboxItem({ className, children, ...props }: DropdownMenuCheckboxItemProps): import("react").JSX.Element;
46
+ declare function DropdownMenuRadioGroup(props: DropdownMenuRadioGroupProps): import("react").JSX.Element;
47
+ declare function DropdownMenuRadioItem({ className, children, ...props }: DropdownMenuRadioItemProps): import("react").JSX.Element;
48
+ declare function DropdownMenuSub(props: DropdownMenuSubProps): import("react").JSX.Element;
49
+ declare function DropdownMenuSubTrigger({ className, children, ...props }: DropdownMenuSubTriggerProps): import("react").JSX.Element;
50
+ declare function DropdownMenuSubContent(props: DropdownMenuSubContentProps): import("react").JSX.Element;
51
+ declare function DropdownMenuShortcut(props: DropdownMenuShortcutProps): import("react").JSX.Element;
45
52
  //#endregion
46
- export { DropdownMenu, DropdownMenuContent, DropdownMenuContentProps, DropdownMenuItem, DropdownMenuItemProps, DropdownMenuLabel, DropdownMenuLabelProps, DropdownMenuProps, DropdownMenuSeparator, DropdownMenuSeparatorProps, DropdownMenuTrigger, DropdownMenuTriggerProps, DropdownMenuTriggerVariant, dropdownMenuTriggerVariants };
53
+ export { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuCheckboxItemProps, DropdownMenuContent, DropdownMenuContentProps, DropdownMenuGroup, DropdownMenuGroupProps, DropdownMenuItem, DropdownMenuItemProps, DropdownMenuLabel, DropdownMenuLabelProps, DropdownMenuPortal, DropdownMenuProps, DropdownMenuRadioGroup, DropdownMenuRadioGroupProps, DropdownMenuRadioItem, DropdownMenuRadioItemProps, DropdownMenuSeparator, DropdownMenuSeparatorProps, DropdownMenuShortcut, DropdownMenuShortcutProps, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubContentProps, DropdownMenuSubProps, DropdownMenuSubTrigger, DropdownMenuSubTriggerProps, DropdownMenuTrigger, DropdownMenuTriggerProps, DropdownMenuTriggerVariant, dropdownMenuTriggerVariants };
@@ -2,7 +2,7 @@
2
2
  import { cn } from "../lib/cn.js";
3
3
  import { skinEffects, skinId } from "../skin.js";
4
4
  import { popupItemStructureClasses } from "../surface-variants.js";
5
- import { jsx } from "react/jsx-runtime";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
6
  import { Menu } from "@base-ui/react/menu";
7
7
  //#region src/ui/dropdown-menu.tsx
8
8
  const dropdownMenuTriggerVariants = ["surface", "ghost"];
@@ -26,22 +26,20 @@ function DropdownMenuTrigger({ size = "sm", iconOnly = false, variant = "surface
26
26
  className: cn("relative isolate inline-flex shrink-0 items-center justify-center overflow-visible", className),
27
27
  disabled,
28
28
  ...props,
29
- children: /* @__PURE__ */ jsx("span", {
30
- "data-control-ui": "button",
31
- "data-control-family": "button",
32
- "data-slot": "content",
33
- className: "relative z-[1] inline-flex items-center justify-center gap-[inherit]",
34
- children
35
- })
29
+ children
36
30
  });
37
31
  }
38
- function DropdownMenuContent({ className, children, ...props }) {
32
+ function DropdownMenuContent({ className, children, side = "bottom", sideOffset = 6, align = "start", alignOffset, collisionBoundary, collisionPadding, collisionAvoidance, ...props }) {
39
33
  return /* @__PURE__ */ jsx(Menu.Portal, { children: /* @__PURE__ */ jsx(Menu.Positioner, {
40
34
  "data-skin": skinId(),
41
35
  "data-effects": skinEffects(),
42
- side: "bottom",
43
- align: "start",
44
- sideOffset: 6,
36
+ side,
37
+ align,
38
+ sideOffset,
39
+ alignOffset,
40
+ collisionBoundary,
41
+ collisionPadding,
42
+ collisionAvoidance,
45
43
  className: "z-[80]",
46
44
  children: /* @__PURE__ */ jsx(Menu.Popup, {
47
45
  "data-control-ui": "dropdown-menu",
@@ -85,5 +83,106 @@ function DropdownMenuLabel({ className, ...props }) {
85
83
  ...props
86
84
  });
87
85
  }
86
+ function DropdownMenuPortal(props) {
87
+ return /* @__PURE__ */ jsx(Menu.Portal, { ...props });
88
+ }
89
+ function DropdownMenuGroup(props) {
90
+ return /* @__PURE__ */ jsx(Menu.Group, {
91
+ "data-control-ui": "dropdown-menu",
92
+ "data-control-family": "popup",
93
+ "data-slot": "group",
94
+ ...props
95
+ });
96
+ }
97
+ function DropdownMenuCheckboxItem({ className, children, ...props }) {
98
+ return /* @__PURE__ */ jsxs(Menu.CheckboxItem, {
99
+ "data-control-ui": "dropdown-menu",
100
+ "data-control-family": "popup",
101
+ "data-popup-part": "item",
102
+ "data-slot": "checkbox-item",
103
+ className: cn("relative", popupItemStructureClasses, className),
104
+ ...props,
105
+ children: [/* @__PURE__ */ jsx(Menu.CheckboxItemIndicator, {
106
+ className: "pointer-events-none absolute start-2 flex size-4 items-center justify-center",
107
+ children: /* @__PURE__ */ jsx(DropdownMenuCheck, {})
108
+ }), children]
109
+ });
110
+ }
111
+ function DropdownMenuRadioGroup(props) {
112
+ return /* @__PURE__ */ jsx(Menu.RadioGroup, {
113
+ "data-control-ui": "dropdown-menu",
114
+ "data-control-family": "popup",
115
+ "data-slot": "radio-group",
116
+ ...props
117
+ });
118
+ }
119
+ function DropdownMenuRadioItem({ className, children, ...props }) {
120
+ return /* @__PURE__ */ jsxs(Menu.RadioItem, {
121
+ "data-control-ui": "dropdown-menu",
122
+ "data-control-family": "popup",
123
+ "data-popup-part": "item",
124
+ "data-slot": "radio-item",
125
+ className: cn("relative", popupItemStructureClasses, className),
126
+ ...props,
127
+ children: [/* @__PURE__ */ jsx(Menu.RadioItemIndicator, {
128
+ className: "pointer-events-none absolute start-2 flex size-4 items-center justify-center",
129
+ children: /* @__PURE__ */ jsx(DropdownMenuCheck, {})
130
+ }), children]
131
+ });
132
+ }
133
+ function DropdownMenuCheck() {
134
+ return /* @__PURE__ */ jsx("svg", {
135
+ viewBox: "0 0 12 12",
136
+ className: "size-3",
137
+ "aria-hidden": "true",
138
+ fill: "none",
139
+ children: /* @__PURE__ */ jsx("path", {
140
+ d: "M2.5 6.5 5 9l4.5-5",
141
+ stroke: "currentColor",
142
+ strokeWidth: "1.6",
143
+ strokeLinecap: "round",
144
+ strokeLinejoin: "round"
145
+ })
146
+ });
147
+ }
148
+ function DropdownMenuSub(props) {
149
+ return /* @__PURE__ */ jsx(Menu.SubmenuRoot, { ...props });
150
+ }
151
+ function DropdownMenuSubTrigger({ className, children, ...props }) {
152
+ return /* @__PURE__ */ jsxs(Menu.SubmenuTrigger, {
153
+ "data-control-ui": "dropdown-menu",
154
+ "data-control-family": "popup",
155
+ "data-popup-part": "item",
156
+ "data-slot": "sub-trigger",
157
+ className: cn(popupItemStructureClasses, className),
158
+ ...props,
159
+ children: [children, /* @__PURE__ */ jsx("span", {
160
+ "data-control-ui": "dropdown-menu",
161
+ "data-control-family": "popup",
162
+ "data-slot": "sub-trigger-indicator",
163
+ "aria-hidden": "true",
164
+ children: "›"
165
+ })]
166
+ });
167
+ }
168
+ function DropdownMenuSubContent(props) {
169
+ return /* @__PURE__ */ jsx(DropdownMenuContent, {
170
+ "data-control-ui": "dropdown-menu",
171
+ "data-slot": "sub-content",
172
+ side: "right",
173
+ sideOffset: 0,
174
+ alignOffset: -3,
175
+ ...props
176
+ });
177
+ }
178
+ function DropdownMenuShortcut(props) {
179
+ return /* @__PURE__ */ jsx("span", {
180
+ "data-control-ui": "dropdown-menu",
181
+ "data-control-family": "popup",
182
+ "data-popup-part": "shortcut",
183
+ "data-slot": "shortcut",
184
+ ...props
185
+ });
186
+ }
88
187
  //#endregion
89
- export { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger, dropdownMenuTriggerVariants };
188
+ export { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, dropdownMenuTriggerVariants };
@@ -0,0 +1,12 @@
1
+ import { ProgressiveBlurKnobStyle } from "../knob-contracts/progressive-blur-knobs.js";
2
+ import { CSSProperties, ComponentProps } from "react";
3
+ //#region src/ui/progressive-blur.d.ts
4
+ type ProgressiveBlurSide = "top" | "bottom" | "inline-start" | "inline-end";
5
+ type ProgressiveBlurProps = Omit<ComponentProps<"div">, "children" | "dangerouslySetInnerHTML" | "style" | "tabIndex"> & {
6
+ side?: ProgressiveBlurSide;
7
+ visible?: boolean;
8
+ style?: CSSProperties & ProgressiveBlurKnobStyle;
9
+ };
10
+ declare function ProgressiveBlur({ side, visible, ...props }: ProgressiveBlurProps): import("react").JSX.Element;
11
+ //#endregion
12
+ export { ProgressiveBlur, ProgressiveBlurProps, ProgressiveBlurSide };
@@ -0,0 +1,47 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ //#region src/ui/progressive-blur.tsx
3
+ function ProgressiveBlur({ side = "bottom", visible = true, ...props }) {
4
+ return /* @__PURE__ */ jsxs("div", {
5
+ ...props,
6
+ "data-control-ui": "progressive-blur",
7
+ "data-control-family": "progressive-blur",
8
+ "data-slot": "root",
9
+ "data-side": side,
10
+ "data-visible": visible || void 0,
11
+ "aria-hidden": "true",
12
+ children: [
13
+ /* @__PURE__ */ jsx("span", {
14
+ "data-control-ui": "progressive-blur",
15
+ "data-control-family": "progressive-blur",
16
+ "data-slot": "layer"
17
+ }),
18
+ /* @__PURE__ */ jsx("span", {
19
+ "data-control-ui": "progressive-blur",
20
+ "data-control-family": "progressive-blur",
21
+ "data-slot": "layer"
22
+ }),
23
+ /* @__PURE__ */ jsx("span", {
24
+ "data-control-ui": "progressive-blur",
25
+ "data-control-family": "progressive-blur",
26
+ "data-slot": "layer"
27
+ }),
28
+ /* @__PURE__ */ jsx("span", {
29
+ "data-control-ui": "progressive-blur",
30
+ "data-control-family": "progressive-blur",
31
+ "data-slot": "layer"
32
+ }),
33
+ /* @__PURE__ */ jsx("span", {
34
+ "data-control-ui": "progressive-blur",
35
+ "data-control-family": "progressive-blur",
36
+ "data-slot": "layer"
37
+ }),
38
+ /* @__PURE__ */ jsx("span", {
39
+ "data-control-ui": "progressive-blur",
40
+ "data-control-family": "progressive-blur",
41
+ "data-slot": "layer"
42
+ })
43
+ ]
44
+ });
45
+ }
46
+ //#endregion
47
+ export { ProgressiveBlur };
@@ -1,4 +1,5 @@
1
1
  import { ScrollAreaKnobStyle } from "../knob-contracts/scroll-area-knobs.js";
2
+ import { ProgressiveBlurProps } from "./progressive-blur.js";
2
3
  import { CSSProperties, ComponentProps, Ref } from "react";
3
4
  //#region src/ui/scroll-area.d.ts
4
5
  declare const scrollAreaScrollbarVisibilities: readonly ["scroll", "hover", "always"];
@@ -17,9 +18,11 @@ type ScrollAreaProps = Omit<ComponentProps<"div">, "style"> & {
17
18
  viewportRef?: Ref<HTMLDivElement>;
18
19
  maxHeight?: string;
19
20
  mask?: boolean;
21
+ blur?: boolean;
22
+ blurProps?: Pick<ProgressiveBlurProps, "style">;
20
23
  lockAxis?: ScrollAreaLockAxis;
21
24
  scrollbarVisibility?: ScrollAreaScrollbarVisibility;
22
25
  };
23
- declare function ScrollArea({ className, viewportClassName, viewportProps, viewportRef, maxHeight, mask, lockAxis, scrollbarVisibility, children, style, ...props }: ScrollAreaProps): import("react").JSX.Element;
26
+ declare function ScrollArea({ className, viewportClassName, viewportProps, viewportRef, maxHeight, mask, blur, blurProps, lockAxis, scrollbarVisibility, children, style, ...props }: ScrollAreaProps): import("react").JSX.Element;
24
27
  //#endregion
25
28
  export { ScrollArea, ScrollAreaLockAxis, ScrollAreaProps, ScrollAreaScrollbarVisibility, ScrollAreaViewportProps, scrollAreaScrollbarVisibilities };
@@ -1,5 +1,6 @@
1
1
  "use client";
2
2
  import { cn } from "../lib/cn.js";
3
+ import { ProgressiveBlur } from "./progressive-blur.js";
3
4
  import { jsx, jsxs } from "react/jsx-runtime";
4
5
  import { ScrollArea as ScrollArea$1 } from "@base-ui/react/scroll-area";
5
6
  //#region src/ui/scroll-area.tsx
@@ -8,8 +9,6 @@ const scrollAreaScrollbarVisibilities = [
8
9
  "hover",
9
10
  "always"
10
11
  ];
11
- const maskXOverflowClasses = cn("data-[overflow-x-start]:mask-l-from-[calc(100%_-_var(--scroll-fade-size))]", "data-[overflow-x-end]:mask-r-from-[calc(100%_-_var(--scroll-fade-size))]");
12
- const maskYOverflowClasses = cn("data-[overflow-y-start]:mask-t-from-[calc(100%_-_var(--scroll-fade-size))]", "data-[overflow-y-end]:mask-b-from-[calc(100%_-_var(--scroll-fade-size))]");
13
12
  function Scrollbar({ orientation, visibility, thumbStyle }) {
14
13
  return /* @__PURE__ */ jsx(ScrollArea$1.Scrollbar, {
15
14
  orientation,
@@ -35,7 +34,7 @@ function viewportStyle(maxHeight, lockX, lockY) {
35
34
  ...lockY ? { overflowY: "hidden" } : {}
36
35
  };
37
36
  }
38
- function ScrollArea({ className, viewportClassName, viewportProps, viewportRef, maxHeight, mask = true, lockAxis, scrollbarVisibility = "scroll", children, style, ...props }) {
37
+ function ScrollArea({ className, viewportClassName, viewportProps, viewportRef, maxHeight, mask = true, blur = false, blurProps, lockAxis, scrollbarVisibility = "scroll", children, style, ...props }) {
39
38
  const lockX = lockAxis === "x" || lockAxis === "both";
40
39
  const lockY = lockAxis === "y" || lockAxis === "both";
41
40
  const resolvedViewportStyle = viewportStyle(maxHeight, lockX, lockY);
@@ -51,6 +50,9 @@ function ScrollArea({ className, viewportClassName, viewportProps, viewportRef,
51
50
  "data-control-ui": "scroll-area",
52
51
  "data-control-family": "scroll-area",
53
52
  "data-slot": "root",
53
+ "data-mask": mask || void 0,
54
+ "data-blur": blur || void 0,
55
+ "data-lock-axis": lockAxis,
54
56
  className: cn("relative overflow-hidden", className),
55
57
  style,
56
58
  children: [
@@ -59,8 +61,9 @@ function ScrollArea({ className, viewportClassName, viewportProps, viewportRef,
59
61
  "data-control-family": "scroll-area",
60
62
  "data-slot": "viewport",
61
63
  ...resolvedViewportProps,
64
+ "data-scroll-area-viewport": "",
62
65
  ref: viewportRef,
63
- className: cn("h-full w-full", mask && !lockX && maskXOverflowClasses, mask && !lockY && maskYOverflowClasses, viewportClassName),
66
+ className: cn("h-full w-full", viewportClassName),
64
67
  style: mergedViewportStyle,
65
68
  children: /* @__PURE__ */ jsx(ScrollArea$1.Content, {
66
69
  "data-control-ui": "scroll-area",
@@ -70,6 +73,26 @@ function ScrollArea({ className, viewportClassName, viewportProps, viewportRef,
70
73
  children
71
74
  })
72
75
  }),
76
+ blur && !lockY && /* @__PURE__ */ jsx(ProgressiveBlur, {
77
+ ...blurProps,
78
+ side: "top",
79
+ visible: false
80
+ }),
81
+ blur && !lockY && /* @__PURE__ */ jsx(ProgressiveBlur, {
82
+ ...blurProps,
83
+ side: "bottom",
84
+ visible: false
85
+ }),
86
+ blur && !lockX && /* @__PURE__ */ jsx(ProgressiveBlur, {
87
+ ...blurProps,
88
+ side: "inline-start",
89
+ visible: false
90
+ }),
91
+ blur && !lockX && /* @__PURE__ */ jsx(ProgressiveBlur, {
92
+ ...blurProps,
93
+ side: "inline-end",
94
+ visible: false
95
+ }),
73
96
  !lockY && /* @__PURE__ */ jsx(Scrollbar, {
74
97
  orientation: "vertical",
75
98
  visibility: scrollbarVisibility,
@@ -0,0 +1,49 @@
1
+ import { HoverIndicator, RenderProp, SelectionIndicator } from "../control-props.js";
2
+ import { SidebarKnobStyle } from "../knob-contracts/sidebar-knobs.js";
3
+ import { CSSProperties, ComponentProps, ReactNode } from "react";
4
+ //#region src/ui/sidebar-menu.d.ts
5
+ declare const sidebarMenuButtonVariants: readonly ["default", "outline"];
6
+ type SidebarMenuButtonVariant = (typeof sidebarMenuButtonVariants)[number];
7
+ declare const sidebarMenuButtonSizes: readonly ["default", "sm", "lg"];
8
+ type SidebarMenuButtonSize = (typeof sidebarMenuButtonSizes)[number];
9
+ type SidebarGroupLabelProps = Omit<ComponentProps<"div">, "style"> & {
10
+ style?: CSSProperties & SidebarKnobStyle;
11
+ } & {
12
+ render?: RenderProp<ComponentProps<"div">>;
13
+ };
14
+ type SidebarGroupContentProps = Omit<ComponentProps<"div">, "style"> & {
15
+ style?: CSSProperties & SidebarKnobStyle;
16
+ };
17
+ type SidebarMenuActionProps = Omit<ComponentProps<"button">, "style"> & {
18
+ render?: RenderProp<ComponentProps<"button">>;
19
+ showOnHover?: boolean;
20
+ style?: CSSProperties & SidebarKnobStyle;
21
+ };
22
+ declare function SidebarGroupContent({ className, ...props }: SidebarGroupContentProps): import("react").JSX.Element;
23
+ declare function SidebarMenuAction({ className, render, showOnHover, children, ...props }: SidebarMenuActionProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
24
+ type SidebarMenuButtonProps = Omit<ComponentProps<"button">, "style"> & {
25
+ style?: CSSProperties & SidebarKnobStyle;
26
+ } & {
27
+ render?: RenderProp<ComponentProps<"button">>;
28
+ isActive?: boolean;
29
+ tooltip?: ReactNode;
30
+ variant?: SidebarMenuButtonVariant;
31
+ size?: SidebarMenuButtonSize;
32
+ };
33
+ declare function SidebarGroup({ className, ...props }: ComponentProps<"div"> & {
34
+ style?: CSSProperties & SidebarKnobStyle;
35
+ }): import("react").JSX.Element;
36
+ declare function SidebarGroupLabel({ className, render, children, ...props }: SidebarGroupLabelProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
37
+ type SidebarSelectionIndicator = SelectionIndicator | HoverIndicator;
38
+ declare function SidebarMenu({ className, indicator, style, children, ...props }: ComponentProps<"ul"> & {
39
+ indicator?: SidebarSelectionIndicator;
40
+ } & {
41
+ style?: CSSProperties & SidebarKnobStyle;
42
+ }): import("react").JSX.Element;
43
+ declare function SidebarMenuItem({ className, ...props }: ComponentProps<"li"> & {
44
+ style?: CSSProperties & SidebarKnobStyle;
45
+ }): import("react").JSX.Element;
46
+ declare function SidebarMenuButton({ render, isActive, variant, size, tooltip, className, children, ...props }: SidebarMenuButtonProps): import("react").JSX.Element;
47
+ declare function SidebarMenuSub({ className, ...props }: ComponentProps<typeof SidebarMenu>): import("react").JSX.Element;
48
+ //#endregion
49
+ export { SidebarGroup, SidebarGroupContent, SidebarGroupContentProps, SidebarGroupLabel, SidebarGroupLabelProps, SidebarMenu, SidebarMenuAction, SidebarMenuActionProps, SidebarMenuButton, SidebarMenuButtonProps, SidebarMenuButtonSize, SidebarMenuButtonVariant, SidebarMenuItem, SidebarMenuSub, SidebarSelectionIndicator, sidebarMenuButtonSizes, sidebarMenuButtonVariants };
@@ -0,0 +1,160 @@
1
+ "use client";
2
+ import { cn } from "../lib/cn.js";
3
+ import { skinIndicator } from "../skin.js";
4
+ import { Tooltip, TooltipContent, TooltipTrigger } from "./tooltip.js";
5
+ import { useSidebar } from "./sidebar-provider.js";
6
+ import { TrackHighlight } from "../extensions/track-highlight.js";
7
+ import { createContext, useContext } from "react";
8
+ import { useRender } from "@base-ui/react/use-render";
9
+ import { jsx, jsxs } from "react/jsx-runtime";
10
+ import { cva } from "class-variance-authority";
11
+ //#region src/ui/sidebar-menu.tsx
12
+ const sidebarMenuButtonVariants = ["default", "outline"];
13
+ const sidebarMenuButtonSizes = [
14
+ "default",
15
+ "sm",
16
+ "lg"
17
+ ];
18
+ function SidebarGroupContent({ className, ...props }) {
19
+ return /* @__PURE__ */ jsx("div", {
20
+ "data-control-ui": "sidebar",
21
+ "data-control-family": "sidebar",
22
+ "data-slot": "group-content",
23
+ className: cn("w-full", className),
24
+ ...props
25
+ });
26
+ }
27
+ function SidebarMenuAction({ className, render, showOnHover = false, children, ...props }) {
28
+ return useRender({
29
+ defaultTagName: "button",
30
+ render,
31
+ props: {
32
+ type: "button",
33
+ ...props,
34
+ "data-control-ui": "sidebar",
35
+ "data-control-family": "sidebar",
36
+ "data-slot": "menu-action",
37
+ "data-show-on-hover": showOnHover || void 0,
38
+ className: cn("end-1 flex size-5 items-center justify-center -translate-y-1/2 disabled:pointer-events-none group-data-[collapsible=icon]:hidden [&>svg]:size-4 [&>svg]:shrink-0", className, "absolute"),
39
+ children
40
+ }
41
+ });
42
+ }
43
+ function SidebarGroup({ className, ...props }) {
44
+ return /* @__PURE__ */ jsx("div", {
45
+ "data-control-ui": "sidebar",
46
+ "data-control-family": "sidebar",
47
+ "data-slot": "group",
48
+ className: cn("relative flex w-full min-w-0 flex-col", className),
49
+ ...props
50
+ });
51
+ }
52
+ function SidebarGroupLabel({ className, render, children, ...props }) {
53
+ return useRender({
54
+ defaultTagName: "div",
55
+ render,
56
+ props: {
57
+ ...props,
58
+ "data-control-ui": "sidebar",
59
+ "data-control-family": "sidebar",
60
+ "data-slot": "group-label",
61
+ className: cn("flex h-[var(--control-h-sm)] shrink-0 items-center [&>svg]:size-4 [&>svg]:shrink-0", "group-data-[collapsible=icon]:invisible group-data-[collapsible=icon]:-mt-[var(--control-h-sm)] group-data-[collapsible=icon]:opacity-0", className),
62
+ children
63
+ }
64
+ });
65
+ }
66
+ const SidebarMenuContext = createContext("none");
67
+ function SidebarMenu({ className, indicator, style, children, ...props }) {
68
+ const resolvedIndicator = indicator ?? skinIndicator("sidebar") ?? "none";
69
+ const hasHighlight = resolvedIndicator !== "none";
70
+ const list = /* @__PURE__ */ jsx("ul", {
71
+ "data-control-ui": "sidebar",
72
+ "data-control-family": "sidebar",
73
+ "data-slot": "menu",
74
+ "data-indicator": resolvedIndicator,
75
+ className: cn("flex min-w-0 flex-col", hasHighlight ? void 0 : className),
76
+ style: hasHighlight ? void 0 : style,
77
+ ...props,
78
+ children: /* @__PURE__ */ jsx(SidebarMenuContext.Provider, {
79
+ value: resolvedIndicator,
80
+ children
81
+ })
82
+ });
83
+ if (!hasHighlight) return list;
84
+ return /* @__PURE__ */ jsxs("div", {
85
+ "data-control-ui": "sidebar",
86
+ "data-control-family": "sidebar",
87
+ "data-slot": "menu-track",
88
+ "data-indicator": resolvedIndicator,
89
+ "data-track": resolvedIndicator,
90
+ className: cn("relative isolate", className),
91
+ style,
92
+ children: [list, /* @__PURE__ */ jsx(TrackHighlight, {})]
93
+ });
94
+ }
95
+ function SidebarMenuItem({ className, ...props }) {
96
+ return /* @__PURE__ */ jsx("li", {
97
+ "data-control-ui": "sidebar",
98
+ "data-control-family": "sidebar",
99
+ "data-slot": "menu-item",
100
+ className: cn("group/menu-item relative", className),
101
+ ...props
102
+ });
103
+ }
104
+ const sidebarMenuButtonClasses = cva("peer/menu-button flex w-full items-center overflow-hidden text-start group-data-[collapsible=icon]:px-0! disabled:pointer-events-none aria-disabled:pointer-events-none [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0", {
105
+ variants: {
106
+ variant: {
107
+ default: null,
108
+ outline: null
109
+ },
110
+ size: {
111
+ default: "group-data-[collapsible=icon]:size-[var(--control-h-md)]!",
112
+ sm: "group-data-[collapsible=icon]:size-[var(--control-h-sm)]!",
113
+ lg: "group-data-[collapsible=icon]:size-[var(--control-h-lg)]!"
114
+ }
115
+ },
116
+ defaultVariants: {
117
+ variant: "default",
118
+ size: "default"
119
+ }
120
+ });
121
+ function SidebarMenuButton({ render, isActive = false, variant = "default", size = "default", tooltip, className, children, ...props }) {
122
+ const { isMobile, state } = useSidebar();
123
+ const indicator = useContext(SidebarMenuContext);
124
+ const button = useRender({
125
+ defaultTagName: "button",
126
+ render,
127
+ props: {
128
+ type: "button",
129
+ ...props,
130
+ "data-control-ui": "sidebar",
131
+ "data-control-family": "sidebar",
132
+ "data-slot": "menu-button",
133
+ "data-size": size,
134
+ "data-variant": variant,
135
+ "data-active": isActive || void 0,
136
+ "data-track-item": indicator !== "none" ? "" : void 0,
137
+ className: cn(sidebarMenuButtonClasses({
138
+ variant,
139
+ size
140
+ }), className),
141
+ children
142
+ }
143
+ });
144
+ if (!tooltip) return button;
145
+ return /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, { render: button }), /* @__PURE__ */ jsx(TooltipContent, {
146
+ side: "right",
147
+ align: "center",
148
+ hidden: state !== "collapsed" || isMobile,
149
+ children: tooltip
150
+ })] });
151
+ }
152
+ function SidebarMenuSub({ className, ...props }) {
153
+ return /* @__PURE__ */ jsx(SidebarMenu, {
154
+ "data-submenu": "",
155
+ className: cn("group-data-[collapsible=icon]:hidden", className),
156
+ ...props
157
+ });
158
+ }
159
+ //#endregion
160
+ export { SidebarGroup, SidebarGroupContent, SidebarGroupLabel, SidebarMenu, SidebarMenuAction, SidebarMenuButton, SidebarMenuItem, SidebarMenuSub, sidebarMenuButtonSizes, sidebarMenuButtonVariants };