@parallelworks/ui 0.48.1 → 0.50.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.
@@ -38,6 +38,10 @@ export interface FieldProps {
38
38
  layout?: FieldLayout | undefined;
39
39
  /** With `inline`, the label takes only its own width rather than the column's. */
40
40
  compact?: boolean | undefined;
41
+ /** Matches the label to a control of the same `size`. At `sm` the label is a small, muted
42
+ * caption for a compact control, such as a picker in a toolbar, and an inline label's row
43
+ * is the `sm` control's height. Set the control's own `size` to match. */
44
+ size?: FieldBoxSize | undefined;
41
45
  /** A set of controls, such as radios or checkboxes, that a legend names instead of a label. */
42
46
  group?: boolean | undefined;
43
47
  /** The control's id; one is made up when left out. */
@@ -57,7 +61,7 @@ export declare function ErrorText({ id, children }: {
57
61
  }): import("react").JSX.Element | null;
58
62
  /** A control with its label, help and error, tied to it for assistive technology. One frame
59
63
  * for every field, in a form or standing alone. */
60
- export declare function Field({ label, hint, actions, description, error, invalid, required, disabled, layout, compact, group, id: ownId, className, children, }: FieldProps): import("react").JSX.Element;
64
+ export declare function Field({ label, hint, actions, description, error, invalid, required, disabled, layout, compact, size, group, id: ownId, className, children, }: FieldProps): import("react").JSX.Element;
61
65
  /** One checkbox or radio and its label inside a Field, such as an option of a group. A bare
62
66
  * `<label>` there would take the Field's label as its own, so every option read as the field. */
63
67
  export declare function FieldOption({ disabled, className, children, }: {
@@ -17,7 +17,19 @@ var FieldRowContext = createContext(false);
17
17
  function useFieldControl() {
18
18
  return use(ControlContext);
19
19
  }
20
- var labelClassName = "flex items-center gap-1 text-sm font-medium text-(--theme-app)";
20
+ var labelSizes = {
21
+ sm: {
22
+ text: "text-xs text-(--theme-muted-text-color)",
23
+ inlineHeight: "min-h-7",
24
+ stackGap: "gap-1"
25
+ },
26
+ md: {
27
+ text: "text-sm text-(--theme-app)",
28
+ inlineHeight: "min-h-9",
29
+ stackGap: "gap-1.5"
30
+ }
31
+ };
32
+ var labelClassName = "flex items-center gap-1 font-medium";
21
33
  var actionsClassName = "ml-auto flex shrink-0 items-center gap-1";
22
34
  var errorTextClassName = "flex items-center gap-1.5 text-xs text-(--theme-error)";
23
35
  /** An error in the look a Field gives its own, for a control outside a Field, or for a part of
@@ -36,7 +48,7 @@ function ErrorText({ id, children }) {
36
48
  }
37
49
  /** A control with its label, help and error, tied to it for assistive technology. One frame
38
50
  * for every field, in a form or standing alone. */
39
- function Field$1({ label, hint, actions, description, error, invalid, required = false, disabled = false, layout = "stacked", compact = false, group = false, id: ownId, className, children }) {
51
+ function Field$1({ label, hint, actions, description, error, invalid, required = false, disabled = false, layout = "stacked", compact = false, size = "md", group = false, id: ownId, className, children }) {
40
52
  const uid = useId();
41
53
  const id = ownId ?? `${uid}control`;
42
54
  const labelId = `${uid}label`;
@@ -53,7 +65,8 @@ function Field$1({ label, hint, actions, description, error, invalid, required =
53
65
  };
54
66
  const inline = layout === "inline";
55
67
  const inRow = use(FieldRowContext) && !inline && !group;
56
- const labelBox = cx(labelClassName, inline && cx("min-h-9 shrink-0", compact ? "mr-2 w-fit" : "w-52 pr-3"), inRow && "row-start-1 self-end");
68
+ const labelSize = labelSizes[size];
69
+ const labelBox = cx(labelClassName, labelSize.text, inline && cx(labelSize.inlineHeight, "shrink-0", compact ? "mr-2 w-fit" : "w-52 pr-3"), inRow && "row-start-1 self-end");
57
70
  const labelContent = /* @__PURE__ */ jsxs(Fragment, { children: [
58
71
  /* @__PURE__ */ jsxs("span", { children: [label, required && /* @__PURE__ */ jsx(RequiredMark, {})] }),
59
72
  hint,
@@ -89,7 +102,7 @@ function Field$1({ label, hint, actions, description, error, invalid, required =
89
102
  })
90
103
  ]
91
104
  });
92
- const frame = inRow ? cx("contents", className) : cx("flex w-full", inline ? "items-start" : "flex-col gap-1.5", className);
105
+ const frame = inRow ? cx("contents", className) : cx("flex w-full", inline ? "items-start" : cx("flex-col", labelSize.stackGap), className);
93
106
  if (group) return /* @__PURE__ */ jsx(Field.Root, {
94
107
  invalid: isInvalid,
95
108
  disabled,
@@ -7,6 +7,8 @@ export interface OneTimeCodeInputProps extends Omit<OTPField.Root.Props, 'classN
7
7
  size?: FieldBoxSize | undefined;
8
8
  'aria-invalid'?: boolean | undefined;
9
9
  'aria-required'?: boolean | undefined;
10
+ /** Focuses the first box on mount, for a page or dialog whose only task is entering the code. */
11
+ autoFocus?: boolean | undefined;
10
12
  /** On the row of boxes: its margin or gap. */
11
13
  className?: string | undefined;
12
14
  }
@@ -20,4 +22,4 @@ export interface OneTimeCodeInputProps extends Omit<OTPField.Root.Props, 'classN
20
22
  * Name it with a Field or a `<label>` for its `id`, which is the first box's, or with
21
23
  * `aria-label`.
22
24
  */
23
- export declare function OneTimeCodeInput({ length, size, className, 'aria-label': ariaLabel, 'aria-invalid': ariaInvalid, 'aria-required': ariaRequired, ...rootProps }: OneTimeCodeInputProps): import("react").JSX.Element;
25
+ export declare function OneTimeCodeInput({ length, size, className, 'aria-label': ariaLabel, 'aria-invalid': ariaInvalid, 'aria-required': ariaRequired, autoFocus, ...rootProps }: OneTimeCodeInputProps): import("react").JSX.Element;
@@ -15,7 +15,7 @@ import { OTPField } from "@base-ui/react/otp-field";
15
15
  * Name it with a Field or a `<label>` for its `id`, which is the first box's, or with
16
16
  * `aria-label`.
17
17
  */
18
- function OneTimeCodeInput({ length = 6, size = "md", className, "aria-label": ariaLabel, "aria-invalid": ariaInvalid, "aria-required": ariaRequired, ...rootProps }) {
18
+ function OneTimeCodeInput({ length = 6, size = "md", className, "aria-label": ariaLabel, "aria-invalid": ariaInvalid, "aria-required": ariaRequired, autoFocus, ...rootProps }) {
19
19
  const t = useStrings().oneTimeCode;
20
20
  const labelId = useId();
21
21
  return /* @__PURE__ */ jsxs(OTPField.Root, {
@@ -31,6 +31,7 @@ function OneTimeCodeInput({ length = 6, size = "md", className, "aria-label": ar
31
31
  ...index > 0 ? { "aria-label": t.character(index + 1, length) } : ariaLabel ? { "aria-labelledby": labelId } : {},
32
32
  ...ariaInvalid && { "aria-invalid": true },
33
33
  ...ariaRequired && { "aria-required": true },
34
+ autoFocus: autoFocus && index === 0,
34
35
  className: cx(fieldBox({ size }), "px-0 text-center font-mono tabular-nums", size === "sm" ? "w-7" : "w-9 text-base")
35
36
  }, index))]
36
37
  });
@@ -41,7 +41,7 @@ export declare function BreadcrumbsTitleAction({ children }: {
41
41
  export declare function BreadcrumbsRightAction({ children }: {
42
42
  children: ReactNode;
43
43
  }): import("react").ReactPortal | null;
44
- export declare function BreadcrumbsActionButton({ icon: Icon, label, ariaLabel, href, onClick, disabled, tooltip, }: {
44
+ export declare function BreadcrumbsActionButton({ icon: Icon, label, ariaLabel, href, onClick, disabled, tooltip, destructive, }: {
45
45
  icon: ComponentType<{
46
46
  className?: string;
47
47
  }>;
@@ -51,6 +51,9 @@ export declare function BreadcrumbsActionButton({ icon: Icon, label, ariaLabel,
51
51
  onClick?: (() => void) | undefined;
52
52
  disabled?: boolean;
53
53
  tooltip?: string | undefined;
54
+ /** In the error color, as a destructive menu entry is, for an action that removes or breaks
55
+ * something. */
56
+ destructive?: boolean | undefined;
54
57
  }): import("react").JSX.Element;
55
58
  interface PageHeaderProps {
56
59
  breadcrumbs?: PageHeaderBreadcrumb[] | undefined;
@@ -97,22 +97,23 @@ function BreadcrumbsRightAction({ children }) {
97
97
  if (!rightActionSlot) return null;
98
98
  return createPortal(children, rightActionSlot);
99
99
  }
100
- var breadcrumbsActionClasses = "flex items-center gap-1 link text-xs whitespace-nowrap disabled:opacity-50 disabled:cursor-not-allowed";
101
- function BreadcrumbsActionButton({ icon: Icon, label, ariaLabel, href, onClick, disabled, tooltip }) {
100
+ var breadcrumbsActionClasses = "flex cursor-pointer items-center gap-1 text-xs whitespace-nowrap hover:not-disabled:underline disabled:cursor-not-allowed disabled:opacity-50";
101
+ function BreadcrumbsActionButton({ icon: Icon, label, ariaLabel, href, onClick, disabled, tooltip, destructive = false }) {
102
102
  const Link = useLink();
103
+ const className = cx(breadcrumbsActionClasses, destructive ? "text-(--theme-error)" : "text-(--theme-link)");
103
104
  const content = /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Icon, { className: "w-3 h-3" }), label] });
104
105
  return /* @__PURE__ */ jsx(Tooltip, {
105
106
  content: tooltip,
106
107
  children: href && !disabled ? /* @__PURE__ */ jsx(Link, {
107
108
  href,
108
- className: breadcrumbsActionClasses,
109
+ className,
109
110
  "aria-label": ariaLabel,
110
111
  children: content
111
112
  }) : /* @__PURE__ */ jsx("button", {
112
113
  type: "button",
113
114
  onClick,
114
115
  disabled,
115
- className: breadcrumbsActionClasses,
116
+ className,
116
117
  "aria-label": ariaLabel,
117
118
  children: content
118
119
  })
@@ -18,15 +18,21 @@ function useSplitter({ width, onWidthChange, min, max, side, defaultWidth, label
18
18
  e.currentTarget.setPointerCapture?.(e.pointerId);
19
19
  drag.current = {
20
20
  x: e.clientX,
21
- width
21
+ width,
22
+ live: width
22
23
  };
23
24
  setLive(width);
24
25
  };
25
26
  const onPointerMove = (e) => {
26
- if (drag.current) setLive(clamp(drag.current.width + (e.clientX - drag.current.x) * grows));
27
+ const current = drag.current;
28
+ if (current) {
29
+ current.live = clamp(current.width + (e.clientX - current.x) * grows);
30
+ setLive(current.live);
31
+ }
27
32
  };
28
33
  const onPointerUp = () => {
29
- if (drag.current && live !== null && live !== width) onWidthChange(live);
34
+ const ended = drag.current;
35
+ if (ended && ended.live !== ended.width) onWidthChange(ended.live);
30
36
  drag.current = null;
31
37
  setLive(null);
32
38
  };
@@ -2,12 +2,12 @@
2
2
  var monacoEnvironment = { getWorker(_moduleId, label) {
3
3
  if (label === "json") return new Worker(new URL(
4
4
  /* @vite-ignore */
5
- new URL("../assets/json.worker-Dqgjpq9F.js", import.meta.url).href,
5
+ new URL("../assets/json.worker-BKkHJbNB.js", import.meta.url).href,
6
6
  "" + import.meta.url
7
7
  ), { type: "module" });
8
8
  return new Worker(new URL(
9
9
  /* @vite-ignore */
10
- new URL("../assets/editor.worker-DfmPPyOL.js", import.meta.url).href,
10
+ new URL("../assets/editor.worker-Cc3TfJ_-.js", import.meta.url).href,
11
11
  "" + import.meta.url
12
12
  ), { type: "module" });
13
13
  } };
@@ -27,7 +27,7 @@ function setupMonacoWorkers() {
27
27
  function createYamlWorker() {
28
28
  return new Worker(new URL(
29
29
  /* @vite-ignore */
30
- new URL("../assets/yaml.worker-DLx0whrM.js", import.meta.url).href,
30
+ new URL("../assets/yaml.worker-k9AdOqzf.js", import.meta.url).href,
31
31
  "" + import.meta.url
32
32
  ), { type: "module" });
33
33
  }