@parallelworks/ui 0.61.0 → 0.62.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.
@@ -49,6 +49,7 @@ var labelSizes = {
49
49
  };
50
50
  var labelClassName = "flex items-center gap-1 font-medium";
51
51
  var actionsClassName = "ml-auto flex shrink-0 items-center gap-1";
52
+ var controlFirstExtrasClassName = "ms-1 inline-flex items-center gap-1 align-[-0.125em]";
52
53
  var errorTextClassName = "flex items-center gap-1.5 text-xs text-(--theme-error-text)";
53
54
  /** An error in the look a Field gives its own, for a control outside a Field, or for a part of
54
55
  * one rather than the whole of it, such as a row of a list editor. Give it an `id` and name it
@@ -188,7 +189,7 @@ function Field$1({ label, hint, help, actions, description, error, invalid, requ
188
189
  className: "w-52 shrink-0"
189
190
  }), /* @__PURE__ */ jsxs("div", {
190
191
  ref: help ? setControlBox : void 0,
191
- className: cx("flex w-fit max-w-full min-w-0 items-start gap-2", lined && labelSize.inlineLine, inRow && "row-start-2"),
192
+ className: cx("flex w-fit max-w-full min-w-0 items-start gap-2", lined ? labelSize.inlineLine : "py-0.5", inRow && "row-start-2"),
192
193
  children: [/* @__PURE__ */ jsx("div", {
193
194
  className: cx("flex h-lh shrink-0 items-center", labelSize.text),
194
195
  ...helpFocus,
@@ -197,10 +198,21 @@ function Field$1({ label, hint, help, actions, description, error, invalid, requ
197
198
  className: "flex min-w-0 flex-col gap-1",
198
199
  children: [/* @__PURE__ */ jsxs("div", {
199
200
  className: cx("font-medium", labelSize.text, disabled && "opacity-60"),
200
- children: [fieldLabel(disabled ? "cursor-not-allowed" : "cursor-pointer"), (help || hint || actions) && /* @__PURE__ */ jsx("span", {
201
- className: "ms-1 inline-flex items-center gap-1 align-[-0.125em]",
202
- children: labelExtras
203
- })]
201
+ children: [
202
+ fieldLabel(disabled ? "cursor-not-allowed" : "cursor-pointer"),
203
+ helpTip && /* @__PURE__ */ jsx("span", {
204
+ className: controlFirstExtrasClassName,
205
+ children: helpTip
206
+ }),
207
+ hint && /* @__PURE__ */ jsx("span", {
208
+ className: "ms-1",
209
+ children: hint
210
+ }),
211
+ actions && /* @__PURE__ */ jsx("span", {
212
+ className: controlFirstExtrasClassName,
213
+ children: actions
214
+ })
215
+ ]
204
216
  }), messages]
205
217
  })]
206
218
  })]
@@ -16,10 +16,17 @@ function BooleanField(props) {
16
16
  const onOption = field.options ? String(field.options.onOption ?? true) : true;
17
17
  const offOption = field.options ? String(field.options.offOption ?? false) : false;
18
18
  const checked = value === true || value === "true" || value === onOption;
19
- const stateName = (option) => typeof option === "string" ? option.charAt(0).toUpperCase() + option.slice(1).toLowerCase() : void 0;
19
+ const option = checked ? onOption : offOption;
20
+ const stateName = typeof option === "string" ? /* @__PURE__ */ jsx("span", {
21
+ "aria-hidden": "true",
22
+ className: "font-normal text-(--theme-muted-text-color)",
23
+ children: option.charAt(0).toUpperCase() + option.slice(1).toLowerCase()
24
+ }) : void 0;
20
25
  return /* @__PURE__ */ jsx(Field, {
21
26
  ...fieldFrame(props),
22
27
  required: false,
28
+ controlFirst: true,
29
+ hint: stateName,
23
30
  children: (control) => /* @__PURE__ */ jsx(Tooltip, {
24
31
  content: field.disabled_message,
25
32
  disabled: !disabled,
@@ -29,8 +36,6 @@ function BooleanField(props) {
29
36
  render: /* @__PURE__ */ jsx("button", { type: "button" }),
30
37
  checked,
31
38
  onCheckedChange: (on) => handleChange(on ? onOption : offOption),
32
- onLabel: stateName(onOption),
33
- offLabel: stateName(offOption),
34
39
  disabled
35
40
  })
36
41
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parallelworks/ui",
3
- "version": "0.61.0",
3
+ "version": "0.62.0",
4
4
  "description": "React UI components: a theme contract, icons, brand logos, 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": {