@glasshome/ui 1.38.0 → 1.39.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.
package/SPEC.md CHANGED
@@ -187,6 +187,7 @@ role clears 4.5:1 against `--background`/`--card`/`--popover`/`--muted` (3:1 for
187
187
  | a status chip | `<Badge tone="var(--success)">` | `rounded-lg bg-green-500/10` |
188
188
  | a callout | `<Alert tone="warning">` | `border-amber-500/30 bg-amber-500/10` |
189
189
  | a button while the work its press started runs | `<Button busy={saving()}>`: keeps focus, so the popover or dialog around it stays open | `disabled={saving()}`, which drops focus to the page |
190
+ | a switch or text field while the work its change started runs | `<Switch busy={saving()}>` / `<Input busy={saving()}>`: keeps focus, ignores the press or edit | `disabled={saving()}` |
190
191
  | a labelled group inside a card | `<SectionGroup icon label count action>` | a hand-rolled `SectionIcon` + `SectionSubtitle` header row |
191
192
  | a titled group of form rows | `<FieldSet>` + `<FieldLegend>` (+ `<FieldDescription>`) | a tracked uppercase `SectionLabel` eyebrow |
192
193
  | rows that belong to the row above them | `<FieldSubGroup>` | a bare `<Separator>` and a left pad |
@@ -13160,15 +13160,26 @@ var Ob = /*#__PURE__*/ K("<div data-slot=empty>"), kb = /*#__PURE__*/ K("<div da
13160
13160
  } }, n), !1, !1), e;
13161
13161
  })();
13162
13162
  }, Vb = /*#__PURE__*/ K("<input data-slot=input>"), Hb = (e) => {
13163
- let [t, n] = I(e, ["class", "type"]);
13163
+ let [t, n] = I(e, [
13164
+ "class",
13165
+ "type",
13166
+ "busy",
13167
+ "readOnly"
13168
+ ]);
13164
13169
  return (() => {
13165
13170
  var e = Vb();
13166
13171
  return G(e, U({
13167
13172
  get type() {
13168
13173
  return t.type;
13169
13174
  },
13175
+ get readOnly() {
13176
+ return t.busy || t.readOnly;
13177
+ },
13178
+ get "aria-busy"() {
13179
+ return t.busy || void 0;
13180
+ },
13170
13181
  get class() {
13171
- return D($e, t.class);
13182
+ return D($e, "aria-busy:cursor-progress aria-busy:opacity-50", t.class);
13172
13183
  }
13173
13184
  }, n), !1, !1), e;
13174
13185
  })();
@@ -15463,7 +15474,7 @@ var vC = Object.assign(gC, {
15463
15474
  width: 12,
15464
15475
  height: 12
15465
15476
  })), B((t) => {
15466
- var r = `Remove ${e().label}`, i = D("bg-destructive text-destructive-foreground absolute top-0 left-0 z-10 flex size-5 items-center justify-center rounded-full shadow-sm", "before:absolute before:-top-2 before:right-0 before:bottom-0 before:-left-2");
15477
+ var r = `Remove ${e().label}`, i = D("bg-card border-foreground/25 text-destructive absolute top-0 left-0 z-10 flex size-5 items-center justify-center rounded-full border shadow-sm", "before:absolute before:-top-2 before:right-0 before:bottom-0 before:-left-2");
15467
15478
  return r !== t.e && W(n, "aria-label", t.e = r), i !== t.t && R(n, t.t = i), t;
15468
15479
  }, {
15469
15480
  e: void 0,
@@ -19796,7 +19807,8 @@ var mA = (e) => {
19796
19807
  "defaultChecked",
19797
19808
  "onChange",
19798
19809
  "disabled",
19799
- "name"
19810
+ "name",
19811
+ "busy"
19800
19812
  ]), [r, i] = N(e.defaultChecked ?? !1), a = () => t.checked ?? r();
19801
19813
  return (() => {
19802
19814
  var e = CA(), r = e.firstChild;
@@ -19813,10 +19825,17 @@ var mA = (e) => {
19813
19825
  get disabled() {
19814
19826
  return t.disabled;
19815
19827
  },
19828
+ get "aria-busy"() {
19829
+ return t.busy || void 0;
19830
+ },
19831
+ get "aria-disabled"() {
19832
+ return t.busy || void 0;
19833
+ },
19816
19834
  get class() {
19817
- return D(`group/switch peer transition-glass relative inline-flex h-7 w-14 shrink-0 cursor-pointer items-center rounded-xl duration-200 ease-out disabled:cursor-not-allowed disabled:opacity-50 ${Ne}`, a() ? Ee : Ge, t.class);
19835
+ return D(`group/switch peer transition-glass relative inline-flex h-7 w-14 shrink-0 cursor-pointer items-center rounded-xl duration-200 ease-out disabled:cursor-not-allowed disabled:opacity-50 aria-busy:cursor-progress aria-busy:opacity-50 ${Ne}`, a() ? Ee : Ge, t.class);
19818
19836
  },
19819
19837
  onClick: () => {
19838
+ if (t.busy) return;
19820
19839
  let e = !a();
19821
19840
  i(e), t.onChange?.(e);
19822
19841
  }
@@ -1,3 +1,6 @@
1
1
  import { type Component, type ComponentProps } from "solid-js";
2
- declare const Input: Component<ComponentProps<"input">>;
2
+ type InputProps = ComponentProps<"input"> & {
3
+ busy?: boolean;
4
+ };
5
+ declare const Input: Component<InputProps>;
3
6
  export { Input };
@@ -3,6 +3,7 @@ type SwitchProps = Omit<ComponentProps<"button">, "onChange" | "children"> & {
3
3
  checked?: boolean;
4
4
  defaultChecked?: boolean;
5
5
  onChange?: (checked: boolean) => void;
6
+ busy?: boolean;
6
7
  };
7
8
  declare const Switch: Component<SwitchProps>;
8
9
  export { Switch };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glasshome/ui",
3
- "version": "1.38.0",
3
+ "version": "1.39.0",
4
4
  "description": "SolidJS component library for GlassHome, built on Kobalte",
5
5
  "keywords": [
6
6
  "components",
@@ -491,7 +491,7 @@ const Dock: Component<DockProps> = (props) => {
491
491
  aria-label={`Remove ${item().label}`}
492
492
  onClick={() => local.onRemove?.(item().id)}
493
493
  class={cn(
494
- "bg-destructive text-destructive-foreground absolute top-0 left-0 z-10 flex size-5 items-center justify-center rounded-full shadow-sm",
494
+ "bg-card border-foreground/25 text-destructive absolute top-0 left-0 z-10 flex size-5 items-center justify-center rounded-full border shadow-sm",
495
495
  "before:absolute before:-top-2 before:right-0 before:bottom-0 before:-left-2",
496
496
  )}
497
497
  >
@@ -2,10 +2,19 @@ import { type Component, type ComponentProps, splitProps } from "solid-js";
2
2
  import { INPUT_CLASS } from "../lib/input-classes.js";
3
3
  import { cn } from "../lib/utils.js";
4
4
 
5
- const Input: Component<ComponentProps<"input">> = (props) => {
6
- const [local, others] = splitProps(props, ["class", "type"]);
5
+ type InputProps = ComponentProps<"input"> & { busy?: boolean };
6
+
7
+ const Input: Component<InputProps> = (props) => {
8
+ const [local, others] = splitProps(props, ["class", "type", "busy", "readOnly"]);
7
9
  return (
8
- <input type={local.type} data-slot="input" class={cn(INPUT_CLASS, local.class)} {...others} />
10
+ <input
11
+ type={local.type}
12
+ data-slot="input"
13
+ readOnly={local.busy || local.readOnly}
14
+ aria-busy={local.busy || undefined}
15
+ class={cn(INPUT_CLASS, "aria-busy:cursor-progress aria-busy:opacity-50", local.class)}
16
+ {...others}
17
+ />
9
18
  );
10
19
  };
11
20
 
@@ -7,6 +7,7 @@ type SwitchProps = Omit<ComponentProps<"button">, "onChange" | "children"> & {
7
7
  checked?: boolean;
8
8
  defaultChecked?: boolean;
9
9
  onChange?: (checked: boolean) => void;
10
+ busy?: boolean;
10
11
  };
11
12
 
12
13
  const Switch: Component<SwitchProps> = (props) => {
@@ -17,6 +18,7 @@ const Switch: Component<SwitchProps> = (props) => {
17
18
  "onChange",
18
19
  "disabled",
19
20
  "name",
21
+ "busy",
20
22
  ]);
21
23
  const [uncontrolled, setUncontrolled] = createSignal(props.defaultChecked ?? false);
22
24
  const checked = () => local.checked ?? uncontrolled();
@@ -30,15 +32,18 @@ const Switch: Component<SwitchProps> = (props) => {
30
32
  data-slot="switch"
31
33
  data-checked={checked() ? "" : undefined}
32
34
  disabled={local.disabled}
35
+ aria-busy={local.busy || undefined}
36
+ aria-disabled={local.busy || undefined}
33
37
  class={cn(
34
38
  // Unchecked wears the recessed input surface, the same dug-out glass as
35
39
  // the slider rail; checked matches the slider fill. A `border-input`
36
40
  // utility here would beat `:where(.glass)` and flatten the rim.
37
- `group/switch peer transition-glass relative inline-flex h-7 w-14 shrink-0 cursor-pointer items-center rounded-xl duration-200 ease-out disabled:cursor-not-allowed disabled:opacity-50 ${FOCUS_RING}`,
41
+ `group/switch peer transition-glass relative inline-flex h-7 w-14 shrink-0 cursor-pointer items-center rounded-xl duration-200 ease-out disabled:cursor-not-allowed disabled:opacity-50 aria-busy:cursor-progress aria-busy:opacity-50 ${FOCUS_RING}`,
38
42
  checked() ? CONTROL_ON : FIELD_CHROME,
39
43
  local.class,
40
44
  )}
41
45
  onClick={() => {
46
+ if (local.busy) return;
42
47
  const next = !checked();
43
48
  setUncontrolled(next);
44
49
  local.onChange?.(next);