@asanchez-sa/abby 0.2.0 → 0.3.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.
@@ -66,7 +66,12 @@ function OTPInputGroup(t0) {
66
66
  } else t2 = $[7];
67
67
  return t2;
68
68
  }
69
- const otpInputSlotVariants = cva("relative flex items-center justify-center rounded-full border border-input bg-transparent transition-colors focus-outline group-has-aria-invalid/otp-input:border-destructive group-has-aria-invalid/otp-input:ring-3 group-has-aria-invalid/otp-input:ring-destructive/20 after:pointer-events-none after:absolute after:hidden after:w-px after:bg-foreground data-active:focus-mark data-disabled:bg-input/50 data-fake-caret:after:block data-fake-caret:after:caret-blink dark:bg-input/30", {
69
+ const otpInputSlotVariants = cva([
70
+ "relative flex items-center justify-center rounded-full border border-input bg-transparent transition-colors data-disabled:bg-input/50 dark:bg-input/30",
71
+ "outline-3 outline-offset-0 outline-transparent data-active:border-(--focus-ring,var(--ring)) data-active:outline-(--focus-halo)",
72
+ "group-has-aria-invalid/otp-input:border-destructive group-has-aria-invalid/otp-input:ring-3 group-has-aria-invalid/otp-input:ring-destructive/20 group-has-aria-invalid/otp-input:data-active:border-destructive group-has-aria-invalid/otp-input:data-active:outline-transparent",
73
+ "after:pointer-events-none after:absolute after:hidden after:w-px after:bg-foreground data-fake-caret:after:block data-fake-caret:after:caret-blink"
74
+ ], {
70
75
  variants: { size: {
71
76
  default: "size-9 text-base after:h-4 md:text-sm",
72
77
  lg: "size-12 text-xl leading-6 tabular-nums after:h-5"
@@ -75,7 +80,7 @@ const otpInputSlotVariants = cva("relative flex items-center justify-center roun
75
80
  });
76
81
  /**
77
82
  * One cell, with the look of `Input`: a one-character field, so a circle. The one real input sits over all the
78
- * cells and takes focus, so the active cell draws the focus ring and the
83
+ * cells and takes focus, so the active cell draws a field's focus and the
79
84
  * caret itself. `size="lg"` is the 48px cell of a screen that asks only for
80
85
  * the code; the default stays at a field's 36px.
81
86
  */
@@ -117,35 +122,50 @@ function OTPInputSlot(t0) {
117
122
  } else t3 = $[10];
118
123
  return t3;
119
124
  }
125
+ /**
126
+ * The mark between two groups. With no children it draws Alma's: a short
127
+ * 8px bar, 1.5px thick, in a faint gray. Children replace it whole.
128
+ */
120
129
  function OTPInputSeparator(t0) {
121
- const $ = c(8);
130
+ const $ = c(12);
131
+ let children;
122
132
  let className;
123
133
  let props;
124
134
  if ($[0] !== t0) {
125
- ({className, ...props} = t0);
135
+ ({className, children, ...props} = t0);
126
136
  $[0] = t0;
127
- $[1] = className;
128
- $[2] = props;
137
+ $[1] = children;
138
+ $[2] = className;
139
+ $[3] = props;
129
140
  } else {
130
- className = $[1];
131
- props = $[2];
141
+ children = $[1];
142
+ className = $[2];
143
+ props = $[3];
132
144
  }
133
145
  let t1;
134
- if ($[3] !== className) {
146
+ if ($[4] !== className) {
135
147
  t1 = cnState("flex items-center text-muted-foreground", className);
136
- $[3] = className;
137
- $[4] = t1;
138
- } else t1 = $[4];
148
+ $[4] = className;
149
+ $[5] = t1;
150
+ } else t1 = $[5];
139
151
  let t2;
140
- if ($[5] !== props || $[6] !== t1) {
141
- t2 = /* @__PURE__ */ jsx(OTPInputSeparator$1, {
142
- className: t1,
143
- ...props
144
- });
145
- $[5] = props;
146
- $[6] = t1;
152
+ if ($[6] !== children) {
153
+ t2 = children ?? /* @__PURE__ */ jsx("span", { className: "block h-[--spacing(0.375)] w-2 rounded-full bg-foreground/22" });
154
+ $[6] = children;
147
155
  $[7] = t2;
148
156
  } else t2 = $[7];
149
- return t2;
157
+ let t3;
158
+ if ($[8] !== props || $[9] !== t1 || $[10] !== t2) {
159
+ t3 = /* @__PURE__ */ jsx(OTPInputSeparator$1, {
160
+ className: t1,
161
+ ...props,
162
+ children: t2
163
+ });
164
+ $[8] = props;
165
+ $[9] = t1;
166
+ $[10] = t2;
167
+ $[11] = t3;
168
+ } else t3 = $[11];
169
+ return t3;
150
170
  }
151
171
  export { OTPInput, OTPInputGroup, OTPInputSeparator, OTPInputSlot, createOTPInputController };
@@ -4,8 +4,8 @@ import { Icon } from "../icon/icon.js";
4
4
  import { buttonLook } from "../button/button.js";
5
5
  import { c } from "react/compiler-runtime";
6
6
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
7
- import { Cancel01Icon } from "@hugeicons/core-free-icons";
8
7
  import { Dialog, DialogBackdrop, DialogClose, DialogContent, DialogDescription, DialogTitle, DialogTrigger, createDialogController } from "@ui-sdk/react/dialog";
8
+ import { Cancel01Icon } from "@hugeicons/core-free-icons";
9
9
  // src/components/sheet/sheet.tsx
10
10
  function Sheet(props) {
11
11
  const $ = c(2);
@@ -1,6 +1,13 @@
1
1
  import { ComponentProps } from "react";
2
2
  import { Switch as Switch$1, SwitchThumb as SwitchThumb$1, createSwitchController } from "@ui-sdk/react/switch";
3
- declare function Switch({ className, ...props }: ComponentProps<typeof Switch$1>): import("react").JSX.Element;
3
+ type SwitchProps = ComponentProps<typeof Switch$1> & {
4
+ /**
5
+ * `sm` is Alma's mini switch, 30×18 with a 14px thumb, for dense rows like
6
+ * a list of models. Its touch area still reaches 54×34.
7
+ */
8
+ size?: "default" | "sm";
9
+ };
10
+ declare function Switch({ className, size, ...props }: SwitchProps): import("react").JSX.Element;
4
11
  /** The thumb. It slides to the far end while the switch is on, mirrored under `dir="rtl"`. */
5
12
  declare function SwitchThumb({ className, ...props }: ComponentProps<typeof SwitchThumb$1>): import("react").JSX.Element;
6
- export { Switch, SwitchThumb, createSwitchController };
13
+ export { Switch, type SwitchProps, SwitchThumb, createSwitchController };
@@ -5,35 +5,41 @@ import { jsx } from "react/jsx-runtime";
5
5
  import { Switch as Switch$1, SwitchThumb as SwitchThumb$1, createSwitchController } from "@ui-sdk/react/switch";
6
6
  // src/components/switch/switch.tsx
7
7
  function Switch(t0) {
8
- const $ = c(8);
8
+ const $ = c(10);
9
9
  let className;
10
10
  let props;
11
+ let t1;
11
12
  if ($[0] !== t0) {
12
- ({className, ...props} = t0);
13
+ ({className, size: t1, ...props} = t0);
13
14
  $[0] = t0;
14
15
  $[1] = className;
15
16
  $[2] = props;
17
+ $[3] = t1;
16
18
  } else {
17
19
  className = $[1];
18
20
  props = $[2];
21
+ t1 = $[3];
19
22
  }
20
- let t1;
21
- if ($[3] !== className) {
22
- t1 = cnState("peer relative inline-flex h-5 w-8 shrink-0 items-center rounded-full border border-transparent transition-colors focus-ring after:absolute after:-inset-x-3 after:-inset-y-2 data-checked:bg-brand data-disabled:cursor-not-allowed data-disabled:opacity-50 data-invalid:border-destructive data-invalid:ring-3 data-invalid:ring-destructive/20 data-unchecked:bg-input", className);
23
- $[3] = className;
24
- $[4] = t1;
25
- } else t1 = $[4];
23
+ const size = t1 === void 0 ? "default" : t1;
26
24
  let t2;
27
- if ($[5] !== props || $[6] !== t1) {
28
- t2 = /* @__PURE__ */ jsx(Switch$1, {
29
- className: t1,
25
+ if ($[4] !== className) {
26
+ t2 = cnState("peer group/switch relative inline-flex h-5 w-8 shrink-0 items-center rounded-full border border-transparent transition-colors focus-ring after:absolute after:-inset-x-3 after:-inset-y-2 data-checked:bg-brand data-disabled:cursor-not-allowed data-disabled:opacity-50 data-invalid:border-destructive data-invalid:ring-3 data-invalid:ring-destructive/20 data-unchecked:bg-input data-[size=sm]:h-4.5 data-[size=sm]:w-7.5 data-[size=sm]:px-px", className);
27
+ $[4] = className;
28
+ $[5] = t2;
29
+ } else t2 = $[5];
30
+ let t3;
31
+ if ($[6] !== props || $[7] !== size || $[8] !== t2) {
32
+ t3 = /* @__PURE__ */ jsx(Switch$1, {
33
+ "data-size": size,
34
+ className: t2,
30
35
  ...props
31
36
  });
32
- $[5] = props;
33
- $[6] = t1;
34
- $[7] = t2;
35
- } else t2 = $[7];
36
- return t2;
37
+ $[6] = props;
38
+ $[7] = size;
39
+ $[8] = t2;
40
+ $[9] = t3;
41
+ } else t3 = $[9];
42
+ return t3;
37
43
  }
38
44
  /** The thumb. It slides to the far end while the switch is on, mirrored under `dir="rtl"`. */
39
45
  function SwitchThumb(t0) {
@@ -51,7 +57,7 @@ function SwitchThumb(t0) {
51
57
  }
52
58
  let t1;
53
59
  if ($[3] !== className) {
54
- t1 = cnState("pointer-events-none block size-4 rounded-full bg-background transition-transform ease-out data-checked:translate-x-[calc(100%-2px)] data-unchecked:translate-x-0 motion-reduce:transition-none rtl:data-checked:-translate-x-[calc(100%-2px)]", className);
60
+ t1 = cnState("pointer-events-none block size-4 rounded-full group-data-[size=sm]/switch:size-3.5 bg-background transition-transform ease-out data-checked:translate-x-[calc(100%-2px)] data-unchecked:translate-x-0 motion-reduce:transition-none rtl:data-checked:-translate-x-[calc(100%-2px)]", className);
55
61
  $[3] = className;
56
62
  $[4] = t1;
57
63
  } else t1 = $[4];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@asanchez-sa/abby",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Sistema de diseño para React sobre ui-sdk y Tailwind CSS.",
5
5
  "keywords": [
6
6
  "agents",
@@ -11,7 +11,7 @@ metadata:
11
11
  risky steps and the app keeping its rules.
12
12
  type: core
13
13
  library: abby
14
- library_version: 0.2.0
14
+ library_version: 0.3.0
15
15
  requires:
16
16
  - compose-screens
17
17
  sources:
@@ -11,7 +11,7 @@ metadata:
11
11
  agent reads.
12
12
  type: lifecycle
13
13
  library: abby
14
- library_version: 0.2.0
14
+ library_version: 0.3.0
15
15
  sources:
16
16
  - src/blocks/notes/notes-block.tsx
17
17
  - src/blocks/notes/adapters.ts
@@ -11,7 +11,7 @@ metadata:
11
11
  accessible and usable by agents.
12
12
  type: core
13
13
  library: abby
14
- library_version: 0.2.0
14
+ library_version: 0.3.0
15
15
  requires:
16
16
  - setup
17
17
  sources:
@@ -59,6 +59,8 @@ import {
59
59
  DialogClose,
60
60
  DialogContent,
61
61
  DialogDescription,
62
+ DialogFooter,
63
+ DialogHeader,
62
64
  DialogTitle,
63
65
  DialogTrigger,
64
66
  } from "abby/dialog";
@@ -70,12 +72,14 @@ export function EditProfile() {
70
72
  <DialogTrigger variant="outline">Edit profile</DialogTrigger>
71
73
  <DialogBackdrop />
72
74
  <DialogContent>
73
- <DialogTitle>Edit your profile</DialogTitle>
74
- <DialogDescription>Save when you are done.</DialogDescription>
75
- <div className="flex justify-end gap-2">
75
+ <DialogHeader>
76
+ <DialogTitle>Edit your profile</DialogTitle>
77
+ <DialogDescription>Save when you are done.</DialogDescription>
78
+ </DialogHeader>
79
+ <DialogFooter>
76
80
  <DialogClose variant="outline">Cancel</DialogClose>
77
81
  <DialogClose value="save">Save changes</DialogClose>
78
- </div>
82
+ </DialogFooter>
79
83
  <DialogClose
80
84
  variant="ghost"
81
85
  size="icon-sm"
@@ -90,6 +94,10 @@ export function EditProfile() {
90
94
  }
91
95
  ```
92
96
 
97
+ A destructive action (delete a key, remove a person, close an organization) takes `variant="destructive-outline"`: a capsule with no fill, red text and a red edge at 30%. `variant="destructive"` is a red fill; keep it for an app that wants one, since Alma never fills a button red.
98
+
99
+ `DialogHeader` stacks the title and description; `DialogFooter` holds the actions, stacked on a phone and at the end from `sm` up. By default the footer is a band that bleeds to the dialog's edges on a muted fill under a hairline; `variant="inline"` keeps a plain row inside the padding. The band follows `--dialog-padding`, so change the padding with `className="[--dialog-padding:--spacing(6)]"` on `DialogContent`, never `p-6`, or the band stops short of the edges. `AlertDialogHeader` and `AlertDialogFooter` (`abby/alert-dialog`) work the same way.
100
+
93
101
  Popups (dialog, popover, menu, select, tooltip) open in the browser's top layer and render in place: there are no Portal, Positioner or Overlay parts. Placement (`side`, `align`, `sideOffset`) goes on the Content part. `presentation="sheet"` on `Dialog` opens it as a sheet.
94
102
 
95
103
  ### Use the sizes, not classes that resize
@@ -102,7 +110,9 @@ import { Button } from "abby/button";
102
110
  export const Small = () => <Button size="xs">Undo archive</Button>;
103
111
  ```
104
112
 
105
- A screen that asks for one thing (a sign-in, a code) uses the touch size. An `Input` with `size="lg"` measures what a `Button` with `size="lg"` does, so a field and its button stack as one column. An `OTPInputSlot` with `size="lg"` is a 48px cell with the digit at 20px, and the groups and the separator space out with it. The default size of either doesn't change.
113
+ A `Switch` takes `size="sm"`, Alma's mini switch (30×18), for dense rows such as one switch per model in a list; its touch area stays larger than the track. The default switch is 32×20.
114
+
115
+ A screen that asks for one thing (a sign-in, a code) uses the touch size. An `Input` (or a `FieldControl`) with `size="lg"` measures what a `Button` with `size="lg"` does, 44px with 15px text, so a field and its button stack as one column. An `OTPInputSlot` with `size="lg"` is a 48px cell with the digit at 20px, and the groups and the separator space out with it. An `OTPInputSeparator` with no children draws Alma's short bar. The default sizes don't change.
106
116
 
107
117
  ```tsx
108
118
  import { Button } from "abby/button";
@@ -284,6 +294,41 @@ export function Toasts() {
284
294
  }
285
295
  ```
286
296
 
297
+ ### Show a budget or seats with `Meter`'s parts
298
+
299
+ Inside `MeterTrack`, `MeterThreshold` marks a value (an alert at 80%), `MeterForecast` fills where the value is heading behind `MeterIndicator`, and `MeterSegment`s replace the indicator with stacked parts (`variant` `default`, `muted`, `empty`). `MeterTrack variant="segmented"` draws one cell per unit, like one per seat. A meter's content is presentational, so name the segments in a `MeterLegend` inside the `Meter` and give the threshold or the forecast a `label`: the meter reads them after its value. Give the meter the sum of the segments as its `value`.
300
+
301
+ ```tsx
302
+ import {
303
+ Meter,
304
+ MeterLabel,
305
+ MeterLegend,
306
+ MeterLegendItem,
307
+ MeterSegment,
308
+ MeterTrack,
309
+ MeterValue,
310
+ } from "abby/meter";
311
+
312
+ export function Seats() {
313
+ return (
314
+ <Meter value={8} max={10} format={(seats) => `${seats} of 10 seats`}>
315
+ <MeterLabel>Seats</MeterLabel>
316
+ <MeterValue />
317
+ <MeterTrack variant="segmented" className="h-2">
318
+ <MeterSegment value={6} />
319
+ <MeterSegment value={2} variant="muted" />
320
+ <MeterSegment value={2} variant="empty" />
321
+ </MeterTrack>
322
+ <MeterLegend>
323
+ <MeterLegendItem>6 people</MeterLegendItem>
324
+ <MeterLegendItem variant="muted">2 pending invitations</MeterLegendItem>
325
+ <MeterLegendItem variant="empty">2 free</MeterLegendItem>
326
+ </MeterLegend>
327
+ </Meter>
328
+ );
329
+ }
330
+ ```
331
+
287
332
  ### Build a window with a rail and a column
288
333
 
289
334
  An app's shell with two levels, Alma's, is shadcn's nested sidebars: one `Sidebar variant="inset" collapsible="icon"` holds a `SidebarTitlebar` and, in a row under it, a rail and a column as panels with `collapsible="none"`. The provider's width is both. Collapsed, the rail stays; with `peek`, the column floats out over the page while the pointer rests on the sidebar, and Escape sends it away. The column keeps its width (no `flex-1`): opening, the sidebar's edge uncovers it instead of squeezing its rows.
@@ -13,7 +13,7 @@ metadata:
13
13
  blocks a person does.
14
14
  type: core
15
15
  library: abby
16
- library_version: 0.2.0
16
+ library_version: 0.3.0
17
17
  requires:
18
18
  - compose-screens
19
19
  - agent-ready-ui
@@ -12,7 +12,7 @@ metadata:
12
12
  and keep both usable by an agent without loading the editor.
13
13
  type: core
14
14
  library: abby
15
- library_version: 0.2.0
15
+ library_version: 0.3.0
16
16
  sources:
17
17
  - src/components/note-status/note-status.tsx
18
18
  - src/components/note-place/note-place.tsx
@@ -9,7 +9,7 @@ metadata:
9
9
  imports, CSS order and server rendering rules the package expects.
10
10
  type: lifecycle
11
11
  library: abby
12
- library_version: 0.2.0
12
+ library_version: 0.3.0
13
13
  sources:
14
14
  - README.md
15
15
  - src/styles/index.css
@@ -9,7 +9,7 @@ metadata:
9
9
  contrast keep working, and shows how to switch schemes and themes.
10
10
  type: core
11
11
  library: abby
12
- library_version: 0.2.0
12
+ library_version: 0.3.0
13
13
  requires:
14
14
  - setup
15
15
  sources: