@agentero/design-system 0.22.2 → 0.23.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentero/design-system",
3
- "version": "0.22.2",
3
+ "version": "0.23.0",
4
4
  "description": "A React component library built with Tailwind CSS v4 and Radix UI primitives",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -61,6 +61,10 @@
61
61
  "types": "./src/hover-card/index.d.ts",
62
62
  "import": "./src/hover-card/index.js"
63
63
  },
64
+ "./label": {
65
+ "types": "./src/label/index.d.ts",
66
+ "import": "./src/label/index.js"
67
+ },
64
68
  "./loading": {
65
69
  "types": "./src/loading/index.d.ts",
66
70
  "import": "./src/loading/index.js"
@@ -132,6 +136,7 @@
132
136
  "@radix-ui/react-dialog": "^1.1.19",
133
137
  "@radix-ui/react-dropdown-menu": "^2.1.16",
134
138
  "@radix-ui/react-hover-card": "^1.1.19",
139
+ "@radix-ui/react-label": "^2.1.11",
135
140
  "@radix-ui/react-popover": "^1.1.15",
136
141
  "@radix-ui/react-progress": "^1.1.12",
137
142
  "@radix-ui/react-separator": "^1.1.8",
@@ -0,0 +1,2 @@
1
+ export { Label, labelRecipe } from './label';
2
+ export type { LabelProps, LabelVariants } from './label';
@@ -0,0 +1,2 @@
1
+ import { Label as e, labelRecipe as t } from "./label.js";
2
+ export { e as Label, t as labelRecipe };
@@ -0,0 +1,61 @@
1
+ import { ComponentPropsWithRef } from 'react';
2
+ import { VariantProps } from 'tailwind-variants';
3
+ import * as LabelPrimitive from '@radix-ui/react-label';
4
+ /** Style recipe for Label. Slots: `root`, `text`, `required`. */
5
+ export declare const labelRecipe: import('tailwind-variants').TVReturnType<{
6
+ optional: {
7
+ true: {
8
+ text: string;
9
+ };
10
+ };
11
+ }, {
12
+ root: string;
13
+ text: string;
14
+ required: string;
15
+ }, undefined, {
16
+ optional: {
17
+ true: {
18
+ text: string;
19
+ };
20
+ };
21
+ }, {
22
+ root: string;
23
+ text: string;
24
+ required: string;
25
+ }, import('tailwind-variants').TVReturnType<{
26
+ optional: {
27
+ true: {
28
+ text: string;
29
+ };
30
+ };
31
+ }, {
32
+ root: string;
33
+ text: string;
34
+ required: string;
35
+ }, undefined, unknown, unknown, undefined>>;
36
+ export type LabelVariants = VariantProps<typeof labelRecipe>;
37
+ export type LabelProps = ComponentPropsWithRef<typeof LabelPrimitive.Root> & LabelVariants & {
38
+ /** Appends a muted " (optional)" suffix. Ignored when `required` is set. */
39
+ optional?: boolean;
40
+ /** Appends a decorative asterisk. Mark the control itself `required` too — the asterisk is `aria-hidden`. */
41
+ required?: boolean;
42
+ };
43
+ /**
44
+ * Accessible caption for a form control, built on Radix's Label primitive so it
45
+ * associates with the control via `htmlFor` and does not select text on
46
+ * double-click.
47
+ *
48
+ * Keep it text-only. Nesting an interactive element (a help tooltip trigger, a
49
+ * button) inside a `<label>` gives that element the label's accessible name and
50
+ * makes a click focus the control — render it as a sibling instead.
51
+ *
52
+ * @summary Accessible caption for a form control
53
+ *
54
+ * @example
55
+ * <Label htmlFor="phone" optional>Phone number</Label>
56
+ * <Input id="phone" type="tel" />
57
+ */
58
+ export declare const Label: {
59
+ ({ className, children, optional, required, ...props }: LabelProps): import("react/jsx-runtime").JSX.Element;
60
+ displayName: string;
61
+ };
@@ -0,0 +1,33 @@
1
+ "use client";
2
+ import { cn as e } from "../../lib/utils.js";
3
+ import { tv as t } from "tailwind-variants";
4
+ import { jsx as n, jsxs as r } from "react/jsx-runtime";
5
+ import * as i from "@radix-ui/react-label";
6
+ //#region src/label/label.tsx
7
+ var a = t({
8
+ slots: {
9
+ root: "flex flex-wrap gap-1 py-0.25 text-sm font-semibold text-text-input-normal",
10
+ text: "align-middle",
11
+ required: "ms-1 align-middle text-text-input-destructive"
12
+ },
13
+ variants: { optional: { true: { text: "after:font-normal after:text-text-input-placeholder after:content-[\"_(optional)\"]" } } },
14
+ defaultVariants: { optional: !1 }
15
+ }), o = ({ className: t, children: o, optional: s = !1, required: c = !1, ...l }) => {
16
+ let u = a({ optional: s && !c });
17
+ return /* @__PURE__ */ r(i.Root, {
18
+ "data-slot": "label",
19
+ className: e(u.root(), t),
20
+ ...l,
21
+ children: [/* @__PURE__ */ n("span", {
22
+ className: u.text(),
23
+ children: o
24
+ }), c && /* @__PURE__ */ n("span", {
25
+ "aria-hidden": !0,
26
+ className: u.required(),
27
+ children: "*"
28
+ })]
29
+ });
30
+ };
31
+ o.displayName = "Label";
32
+ //#endregion
33
+ export { o as Label, a as labelRecipe };
@@ -34,7 +34,7 @@ var s = n.Portal, c = e({ base: [
34
34
  "data-[state=open]:data-[side=top]:animate-dropdown-slide-in-from-bottom",
35
35
  "data-[state=closed]:animate-dropdown-slide-out",
36
36
  "motion-reduce:animate-none!"
37
- ] }), l = ({ className: e, sideOffset: r = 1, ...i }) => /* @__PURE__ */ t(n.Portal, { children: /* @__PURE__ */ t(n.Content, {
37
+ ] }), l = ({ className: e, sideOffset: r = 8, ...i }) => /* @__PURE__ */ t(n.Portal, { children: /* @__PURE__ */ t(n.Content, {
38
38
  "data-slot": "popover-content",
39
39
  sideOffset: r,
40
40
  className: c({ className: e }),