@ctrl-ui/react 0.8.0 → 0.8.1

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 (59) 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 +70 -0
  8. package/dist/email/templates.d.ts +51 -0
  9. package/dist/email/templates.js +228 -0
  10. package/dist/email/theme.d.ts +23 -0
  11. package/dist/email/theme.js +98 -0
  12. package/dist/extensions/create-track-highlight.d.ts +0 -2
  13. package/dist/extensions/create-track-highlight.js +49 -8
  14. package/dist/extensions/supports-anchor-transitions.d.ts +4 -0
  15. package/dist/extensions/supports-anchor-transitions.js +31 -0
  16. package/dist/extensions/track-highlight.d.ts +0 -6
  17. package/dist/extensions/track-highlight.js +25 -9
  18. package/dist/knob-contracts/button-knobs.d.ts +1 -1
  19. package/dist/knob-contracts/button-knobs.js +4 -1
  20. package/dist/knob-contracts/progressive-blur-knobs.d.ts +5 -0
  21. package/dist/knob-contracts/progressive-blur-knobs.js +9 -0
  22. package/dist/scripts/contrast-eval.d.ts +46 -0
  23. package/dist/scripts/contrast-eval.js +327 -0
  24. package/dist/skin.config.js +9 -1
  25. package/dist/skin.d.ts +11 -9
  26. package/dist/skin.js +0 -1
  27. package/dist/styles/index.css +2 -1
  28. package/dist/styles/recipes/button-group.css +46 -0
  29. package/dist/styles/recipes/button.css +53 -5
  30. package/dist/styles/recipes/progressive-blur.css +145 -0
  31. package/dist/styles/recipes/scroll-area.css +140 -5
  32. package/dist/styles/recipes/sidebar.css +49 -0
  33. package/dist/styles/recipes/table-of-contents.css +1 -1
  34. package/dist/styles/recipes/track-highlight.css +126 -2
  35. package/dist/styles/recipes/tree.css +4 -0
  36. package/dist/ui/button-group.d.ts +3 -1
  37. package/dist/ui/button-group.js +21 -18
  38. package/dist/ui/button.d.ts +3 -1
  39. package/dist/ui/button.js +13 -4
  40. package/dist/ui/checkbox-group.d.ts +5 -3
  41. package/dist/ui/checkbox-group.js +23 -6
  42. package/dist/ui/color-picker.js +1 -1
  43. package/dist/ui/dropdown-menu.d.ts +2 -3
  44. package/dist/ui/dropdown-menu.js +1 -7
  45. package/dist/ui/progressive-blur.d.ts +12 -0
  46. package/dist/ui/progressive-blur.js +47 -0
  47. package/dist/ui/scroll-area.d.ts +4 -1
  48. package/dist/ui/scroll-area.js +27 -4
  49. package/dist/ui/sidebar-menu.d.ts +39 -0
  50. package/dist/ui/sidebar-menu.js +135 -0
  51. package/dist/ui/sidebar-provider.d.ts +28 -0
  52. package/dist/ui/sidebar-provider.js +80 -0
  53. package/dist/ui/sidebar.d.ts +4 -61
  54. package/dist/ui/sidebar.js +23 -202
  55. package/dist/ui/table-of-contents.js +3 -11
  56. package/dist/ui/toggle.d.ts +3 -2
  57. package/dist/ui/toggle.js +22 -10
  58. package/dist/ui/tree.js +13 -19
  59. package/package.json +5 -1
@@ -1,4 +1,4 @@
1
- import { ControlledMultiChoice } from "../control-props.js";
1
+ import { ControlledMultiChoice, HoverIndicator } from "../control-props.js";
2
2
  import { ButtonProps } from "./button.js";
3
3
  import { ComponentProps } from "react";
4
4
  //#region src/ui/toggle.d.ts
@@ -13,8 +13,9 @@ type ToggleGroupProps<TValue extends string = string> = Omit<ComponentProps<"div
13
13
  multiple?: boolean;
14
14
  disabled?: boolean;
15
15
  orientation?: "horizontal" | "vertical";
16
+ indicator?: HoverIndicator;
16
17
  };
17
18
  declare function Toggle({ variant, size, tone, active, showCheck, className, pressed, defaultPressed, onPressedChange, value, disabled, children, ...props }: ToggleProps): import("react").JSX.Element;
18
- declare function ToggleGroup<TValue extends string = string>({ className, orientation, ...props }: ToggleGroupProps<TValue>): import("react").JSX.Element;
19
+ declare function ToggleGroup<TValue extends string = string>({ className, orientation, indicator, children, ...props }: ToggleGroupProps<TValue>): import("react").JSX.Element;
19
20
  //#endregion
20
21
  export { Toggle, ToggleGroup, ToggleGroupProps, ToggleProps };
package/dist/ui/toggle.js CHANGED
@@ -1,12 +1,17 @@
1
1
  "use client";
2
2
  import { cn } from "../lib/cn.js";
3
- import { buttonContentClasses, buttonStructureClasses } from "./button.js";
3
+ import { skinIndicator } from "../skin.js";
4
+ import { ButtonTrackContext, buttonContentClasses, buttonStructureClasses, buttonTrackStructureClasses } from "./button.js";
5
+ import { TrackHighlight } from "../extensions/track-highlight.js";
6
+ import { useContext } from "react";
4
7
  import { jsx, jsxs } from "react/jsx-runtime";
5
8
  import { Toggle as Toggle$1 } from "@base-ui/react/toggle";
6
9
  import { ToggleGroup as ToggleGroup$1 } from "@base-ui/react/toggle-group";
7
10
  //#region src/ui/toggle.tsx
8
11
  function Toggle({ variant = "surface", size = "sm", tone = "neutral", active, showCheck = false, className, pressed, defaultPressed, onPressedChange, value, disabled, children, ...props }) {
12
+ const tracksHover = useContext(ButtonTrackContext);
9
13
  return /* @__PURE__ */ jsx(Toggle$1, {
14
+ "data-track-item": tracksHover ? "" : void 0,
10
15
  pressed,
11
16
  defaultPressed,
12
17
  onPressedChange,
@@ -56,15 +61,22 @@ function Toggle({ variant = "surface", size = "sm", tone = "neutral", active, sh
56
61
  children
57
62
  });
58
63
  }
59
- function ToggleGroup({ className, orientation = "horizontal", ...props }) {
60
- return /* @__PURE__ */ jsx(ToggleGroup$1, {
61
- "data-control-ui": "toggle",
62
- "data-control-family": "button",
63
- "data-slot": "group",
64
- "data-orientation": orientation,
65
- orientation,
66
- className: cn("inline-flex items-center", orientation === "vertical" && "flex-col", className),
67
- ...props
64
+ function ToggleGroup({ className, orientation = "horizontal", indicator, children, ...props }) {
65
+ const resolvedIndicator = indicator ?? skinIndicator("toggle-group") ?? "none";
66
+ const tracksHover = resolvedIndicator === "hover";
67
+ return /* @__PURE__ */ jsx(ButtonTrackContext, {
68
+ value: tracksHover,
69
+ children: /* @__PURE__ */ jsxs(ToggleGroup$1, {
70
+ "data-control-ui": "toggle",
71
+ "data-control-family": "button",
72
+ "data-slot": "group",
73
+ "data-orientation": orientation,
74
+ "data-track": resolvedIndicator,
75
+ orientation,
76
+ className: cn(buttonTrackStructureClasses, "inline-flex items-center data-[track=hover]:gap-0", orientation === "vertical" && "flex-col", className),
77
+ ...props,
78
+ children: [children, tracksHover ? /* @__PURE__ */ jsx(TrackHighlight, { className: "z-0" }) : null]
79
+ })
68
80
  });
69
81
  }
70
82
  //#endregion
package/dist/ui/tree.js CHANGED
@@ -1,13 +1,13 @@
1
1
  "use client";
2
2
  import { cn } from "../lib/cn.js";
3
3
  import { skinIndicator } from "../skin.js";
4
- import { Children, Suspense, createContext, isValidElement, lazy, useContext, useRef, useState } from "react";
4
+ import { TrackHighlight } from "../extensions/track-highlight.js";
5
+ import { Children, createContext, isValidElement, useContext, useRef, useState } from "react";
5
6
  import { useRender } from "@base-ui/react/use-render";
6
7
  import { jsx, jsxs } from "react/jsx-runtime";
7
8
  import { ChevronRightIcon } from "lucide-react";
8
9
  import { Collapsible } from "@base-ui/react/collapsible";
9
10
  //#region src/ui/tree.tsx
10
- const TrackHighlight = lazy(() => import("../extensions/track-highlight.js").then((module) => ({ default: module.TrackHighlight })));
11
11
  const TYPEAHEAD_TIMEOUT = 500;
12
12
  const TreeContext = createContext(null);
13
13
  function useTree() {
@@ -211,17 +211,14 @@ function Tree({ selectionMode = "single", indicator, value, defaultValue, onValu
211
211
  toggleExpanded,
212
212
  setFocusedValue
213
213
  };
214
- const rootStyle = style;
215
214
  const sliding = resolvedIndicator === "slide";
216
215
  const list = /* @__PURE__ */ jsx("ul", {
217
216
  "data-control-ui": "tree",
218
217
  "data-control-family": "tree",
219
- "data-indicator": resolvedIndicator,
220
- "data-slot": "root",
218
+ "data-slot": "list",
221
219
  role: "tree",
222
220
  "aria-multiselectable": selectionMode === "multiple" || void 0,
223
- className: cn("flex flex-col", sliding ? void 0 : className),
224
- style: sliding ? void 0 : rootStyle,
221
+ className: "flex flex-col",
225
222
  onKeyDown: (event) => {
226
223
  onKeyDown?.(event);
227
224
  handleTreeKeyDown(event, contextValue, typeahead);
@@ -238,21 +235,18 @@ function Tree({ selectionMode = "single", indicator, value, defaultValue, onValu
238
235
  });
239
236
  return /* @__PURE__ */ jsx(TreeContext.Provider, {
240
237
  value: contextValue,
241
- children: sliding ? /* @__PURE__ */ jsxs("div", {
238
+ children: /* @__PURE__ */ jsxs("div", {
242
239
  "data-control-ui": "tree",
243
240
  "data-control-family": "tree",
244
- "data-slot": "track",
241
+ "data-slot": "root",
245
242
  "data-indicator": resolvedIndicator,
246
- className: cn("relative isolate", className),
247
- style: rootStyle,
248
- children: [/* @__PURE__ */ jsx(Suspense, {
249
- fallback: null,
250
- children: /* @__PURE__ */ jsx(TrackHighlight, {
251
- itemSelector: "[data-control-ui=tree][data-slot=item-trigger]",
252
- activeSelector: "[data-control-ui=tree][data-slot=item-trigger][data-selected]"
253
- })
254
- }), list]
255
- }) : list
243
+ className: cn(sliding && "relative isolate", className),
244
+ style,
245
+ children: [sliding ? /* @__PURE__ */ jsx(TrackHighlight, {
246
+ itemSelector: "[data-control-ui=tree][data-slot=item-trigger]",
247
+ activeSelector: "[data-control-ui=tree][data-slot=item-trigger][data-selected]"
248
+ }) : null, list]
249
+ })
256
250
  });
257
251
  }
258
252
  function TreeItem({ value, disabled = false, label, className, style, children, ref, ...props }) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ctrl-ui/react",
3
- "version": "0.8.0",
3
+ "version": "0.8.1",
4
4
  "description": "Control UI components, blocks, and primitives with the Refined skin, as a versioned package.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -50,6 +50,7 @@
50
50
  "prosemirror-view": "^1.42.2",
51
51
  "react": "^19.2.8",
52
52
  "react-day-picker": "^10.0.1",
53
+ "react-email": "^6.9.5",
53
54
  "react-phone-number-input": "^3.4.17",
54
55
  "react-resizable-panels": "^4.12.2",
55
56
  "shiki": "^4.4.3",
@@ -91,6 +92,9 @@
91
92
  "react-day-picker": {
92
93
  "optional": true
93
94
  },
95
+ "react-email": {
96
+ "optional": true
97
+ },
94
98
  "react-phone-number-input": {
95
99
  "optional": true
96
100
  },