@parallelworks/ui 0.43.0 → 0.44.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.
@@ -21,7 +21,10 @@ export type SelectProps<Value, Multiple extends boolean | undefined = false> = O
21
21
  trigger?: ReactElement | undefined;
22
22
  /** A hint on the trigger button. */
23
23
  triggerTooltip?: ReactNode;
24
+ /** The item a person is on as they move through the open list, then undefined once it
25
+ * closes, such as to preview a theme before it is chosen. */
26
+ onItemHighlighted?: ((value: Value | undefined) => void) | undefined;
24
27
  };
25
28
  /** Picks one value, or several with `multiple`, from a short list. Use
26
29
  * Combobox when the list is long enough to need filtering. */
27
- export declare function Select<Value, Multiple extends boolean | undefined = false>({ items, placeholder, className, 'aria-label': ariaLabel, 'aria-describedby': describedBy, 'aria-invalid': invalid, trigger, triggerTooltip, ...rootProps }: SelectProps<Value, Multiple>): import("react").JSX.Element;
30
+ export declare function Select<Value, Multiple extends boolean | undefined = false>({ items, placeholder, className, 'aria-label': ariaLabel, 'aria-describedby': describedBy, 'aria-invalid': invalid, trigger, triggerTooltip, onItemHighlighted, ...rootProps }: SelectProps<Value, Multiple>): import("react").JSX.Element;
@@ -9,7 +9,7 @@ import { Select } from "@base-ui/react/select";
9
9
  var triggerClassName = clsx("flex w-full items-center justify-between gap-2 rounded-md border border-(--theme-border) bg-(--theme-input-bg) py-2 pl-3 pr-2 text-left text-sm text-(--theme-app) cursor-pointer outline-none", "focus-visible:border-(--theme-element) focus-visible:ring-1 focus-visible:ring-(--theme-element)", "aria-invalid:border-(--theme-error) data-disabled:cursor-not-allowed data-disabled:bg-(--theme-input-disabled-bg) data-disabled:text-(--theme-input-disabled-text)");
10
10
  /** Picks one value, or several with `multiple`, from a short list. Use
11
11
  * Combobox when the list is long enough to need filtering. */
12
- function Select$1({ items, placeholder, className, "aria-label": ariaLabel, "aria-describedby": describedBy, "aria-invalid": invalid, trigger, triggerTooltip, ...rootProps }) {
12
+ function Select$1({ items, placeholder, className, "aria-label": ariaLabel, "aria-describedby": describedBy, "aria-invalid": invalid, trigger, triggerTooltip, onItemHighlighted, ...rootProps }) {
13
13
  const labelOf = (value) => items.find((item) => Object.is(item.value, value))?.label;
14
14
  const triggerProps = {
15
15
  "aria-label": ariaLabel,
@@ -19,6 +19,10 @@ function Select$1({ items, placeholder, className, "aria-label": ariaLabel, "ari
19
19
  return /* @__PURE__ */ jsxs(Select.Root, {
20
20
  items,
21
21
  ...rootProps,
22
+ onOpenChange: (open, details) => {
23
+ rootProps.onOpenChange?.(open, details);
24
+ if (!open) onItemHighlighted?.(void 0);
25
+ },
22
26
  children: [trigger ? /* @__PURE__ */ jsx(Tooltip, {
23
27
  content: triggerTooltip,
24
28
  children: /* @__PURE__ */ jsx(Select.Trigger, {
@@ -50,6 +54,7 @@ function Select$1({ items, placeholder, className, "aria-label": ariaLabel, "ari
50
54
  value: item.value,
51
55
  disabled: item.disabled,
52
56
  className: clsx("grid grid-cols-[1rem_1fr]", panelItemClassName),
57
+ onFocus: onItemHighlighted && (() => onItemHighlighted(item.value)),
53
58
  children: [
54
59
  /* @__PURE__ */ jsx(Select.ItemIndicator, {
55
60
  className: "col-start-1",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parallelworks/ui",
3
- "version": "0.43.0",
3
+ "version": "0.44.0",
4
4
  "description": "React UI components: a theme contract, icons, primitives, lists, forms, a job graph, a code editor, a log viewer, a file explorer and an AI chat, each on its own subpath",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {