@fiestaboard/ui 5.0.1 → 5.2.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/dist/components/chrome/breadcrumb.d.ts +43 -0
- package/dist/components/chrome/breadcrumb.js +76 -0
- package/dist/components/chrome/breadcrumb.js.map +1 -0
- package/dist/components/chrome/sidebar.d.ts +8 -1
- package/dist/components/chrome/sidebar.js +106 -102
- package/dist/components/chrome/sidebar.js.map +1 -1
- package/dist/components/data/bar-list.d.ts +81 -0
- package/dist/components/data/bar-list.js +54 -0
- package/dist/components/data/bar-list.js.map +1 -0
- package/dist/components/data/stat-strip.d.ts +86 -0
- package/dist/components/data/stat-strip.js +36 -0
- package/dist/components/data/stat-strip.js.map +1 -0
- package/dist/components/feedback/chip.d.ts +28 -0
- package/dist/components/feedback/chip.js +29 -0
- package/dist/components/feedback/chip.js.map +1 -0
- package/dist/components/forms/toggle.d.ts +56 -0
- package/dist/components/forms/toggle.js +97 -0
- package/dist/components/forms/toggle.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +95 -90
- package/dist/theme.css +55 -10
- package/package.json +1 -1
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { cn as e } from "../../lib/utils.js";
|
|
2
|
+
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
3
|
+
//#region src/components/data/bar-list.tsx
|
|
4
|
+
var r = "min-w-0 truncate text-sm";
|
|
5
|
+
function i(e, t) {
|
|
6
|
+
return t <= 0 ? 0 : Math.min(100, Math.max(0, e / t * 100));
|
|
7
|
+
}
|
|
8
|
+
function a({ items: a, max: o, formatValue: s = (e) => e.toLocaleString(), className: c, ...l }) {
|
|
9
|
+
let u = o ?? Math.max(0, ...a.map((e) => e.value));
|
|
10
|
+
return /* @__PURE__ */ t("ul", {
|
|
11
|
+
role: "list",
|
|
12
|
+
"data-slot": "bar-list",
|
|
13
|
+
className: e("grid w-full list-none grid-cols-[fit-content(40%)_minmax(0,1fr)_max-content] items-center gap-x-3 gap-y-2 p-0", c),
|
|
14
|
+
...l,
|
|
15
|
+
children: a.map((e) => {
|
|
16
|
+
let a = i(e.value, u);
|
|
17
|
+
return /* @__PURE__ */ n("li", {
|
|
18
|
+
"data-slot": "bar-list-item",
|
|
19
|
+
className: "col-span-3 grid grid-cols-subgrid items-center",
|
|
20
|
+
children: [
|
|
21
|
+
e.renderLabel ? e.renderLabel({
|
|
22
|
+
className: r,
|
|
23
|
+
children: e.label
|
|
24
|
+
}) : /* @__PURE__ */ t("span", {
|
|
25
|
+
className: r,
|
|
26
|
+
children: e.label
|
|
27
|
+
}),
|
|
28
|
+
/* @__PURE__ */ t("div", {
|
|
29
|
+
"data-slot": "bar-list-track",
|
|
30
|
+
"aria-hidden": "true",
|
|
31
|
+
className: "h-4.5 overflow-hidden rounded-sm bg-muted",
|
|
32
|
+
children: /* @__PURE__ */ t("div", {
|
|
33
|
+
"data-slot": "bar-list-fill",
|
|
34
|
+
className: "h-full rounded-sm bg-brand",
|
|
35
|
+
style: a > 0 ? {
|
|
36
|
+
width: `${a}%`,
|
|
37
|
+
minWidth: "2px"
|
|
38
|
+
} : { width: 0 }
|
|
39
|
+
})
|
|
40
|
+
}),
|
|
41
|
+
/* @__PURE__ */ t("span", {
|
|
42
|
+
"data-slot": "bar-list-value",
|
|
43
|
+
className: "text-right text-sm tabular-nums text-muted-foreground",
|
|
44
|
+
children: s(e.value)
|
|
45
|
+
})
|
|
46
|
+
]
|
|
47
|
+
}, e.key);
|
|
48
|
+
})
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
//#endregion
|
|
52
|
+
export { a as BarList };
|
|
53
|
+
|
|
54
|
+
//# sourceMappingURL=bar-list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bar-list.js","names":[],"sources":["../../../src/components/data/bar-list.tsx"],"mappings":";;;AAkFA,IAAM,IAAc;AASpB,SAAS,EAAY,GAAe,GAAqB;CAEvD,OADI,KAAO,IAAU,IACd,KAAK,IAAI,KAAK,KAAK,IAAI,GAAI,IAAQ,IAAO,GAAG,CAAC;AACvD;AAEA,SAAS,EAAQ,EAAE,UAAO,QAAK,kBAAe,MAAM,EAAE,eAAe,GAAG,cAAW,GAAG,KAAuB;CAG3G,IAAM,IAAQ,KAAO,KAAK,IAAI,GAAG,GAAG,EAAM,KAAK,MAAS,EAAK,KAAK,CAAC;CACnE,OAeE,kBAAC,MAAD;EACE,MAAK;EACL,aAAU;EACV,WAAW,EACT,iHACA,CACF;EACA,GAAI;EAEH,UAAA,EAAM,KAAK,MAAS;GACnB,IAAM,IAAM,EAAY,EAAK,OAAO,CAAK;GACzC,OACE,kBAAC,MAAD;IAAmB,aAAU;IAAgB,WAAU;IAAvD,UAAA;KACG,EAAK,cACJ,EAAK,YAAY;MAAE,WAAW;MAAa,UAAU,EAAK;KAAM,CAAC,IAEjE,kBAAC,QAAD;MAAM,WAAW;MAAc,UAAA,EAAK;KAAY,CAAA;KAElD,kBAAC,OAAD;MAAK,aAAU;MAAiB,eAAY;MAAO,WAAU;MAC3D,UAAA,kBAAC,OAAD;OACE,aAAU;OACV,WAAU;OAIV,OAAO,IAAM,IAAI;QAAE,OAAO,GAAG,EAAI;QAAI,UAAU;OAAM,IAAI,EAAE,OAAO,EAAE;MACrE,CAAA;KACE,CAAA;KACL,kBAAC,QAAD;MAAM,aAAU;MAAiB,WAAU;MACxC,UAAA,EAAY,EAAK,KAAK;KACnB,CAAA;IACJ;GAnBK,GAAA,EAAK,GAmBV;EAER,CAAC;CACC,CAAA;AAER"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `data/` — the data-display family (#229).
|
|
3
|
+
*
|
|
4
|
+
* First member of a new family. The existing families each own a job —
|
|
5
|
+
* `containment` boxes things, `feedback` reports system state, `typography`
|
|
6
|
+
* sets prose — and none of them owns "render a derived number so a human can
|
|
7
|
+
* compare it". StatStrip (and the sibling BarList landing in a parallel PR)
|
|
8
|
+
* are exactly that: presentation of computed metrics, not chrome, not form
|
|
9
|
+
* input, not prose. Folding them into `feedback` would misfile them —
|
|
10
|
+
* feedback is the system talking about itself (alerts, spinners, status),
|
|
11
|
+
* not the product displaying the user's data. Hence `data/`.
|
|
12
|
+
*/
|
|
13
|
+
import * as React from "react";
|
|
14
|
+
type StatStripTone = "default" | "brand";
|
|
15
|
+
export interface StatStripItemData {
|
|
16
|
+
/** The big number. ReactNode so a consumer can wrap it in <abbr>, add a unit sup, etc. */
|
|
17
|
+
value: React.ReactNode;
|
|
18
|
+
/** The muted descriptor beside the value, e.g. "unique cloners (last 14 days)". */
|
|
19
|
+
label: React.ReactNode;
|
|
20
|
+
/**
|
|
21
|
+
* List key when `label` is not a plain string. Falls back to the array
|
|
22
|
+
* index, which is fine for the intended use (a short static header strip),
|
|
23
|
+
* wrong for anything reorderable — pass a key there.
|
|
24
|
+
*/
|
|
25
|
+
key?: string;
|
|
26
|
+
}
|
|
27
|
+
interface StatStripProps extends React.ComponentProps<"dl"> {
|
|
28
|
+
/**
|
|
29
|
+
* Data form: map an array straight onto the strip. Ignored when `children`
|
|
30
|
+
* is provided — the two forms answer the same question and mixing them
|
|
31
|
+
* would render duplicate stats.
|
|
32
|
+
*/
|
|
33
|
+
items?: StatStripItemData[];
|
|
34
|
+
/**
|
|
35
|
+
* Colour of every value in the strip. Strip-level rather than per-item
|
|
36
|
+
* deliberately: a summary strip is one statement, and mixing value colours
|
|
37
|
+
* inside it turns emphasis into noise. `brand` exists for the one real
|
|
38
|
+
* consumer (the docs stats header); the status tones (`destructive` etc.)
|
|
39
|
+
* are withheld until a real call site wants a red headline number —
|
|
40
|
+
* see heading.tsx for the same scoping argument.
|
|
41
|
+
*/
|
|
42
|
+
tone?: StatStripTone;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* An inline row of big-number stats — "52 plugins · 5,612 unique cloners" —
|
|
46
|
+
* promoted from the docs site's stats header (#229).
|
|
47
|
+
*
|
|
48
|
+
* Semantics: a `<dl>` of name/value groups, because that is what the content
|
|
49
|
+
* IS — each stat is a term ("plugins") described by a value ("52"). The spec
|
|
50
|
+
* allows `<div>` group wrappers inside `<dl>`, so the flex styling survives
|
|
51
|
+
* without semantic lies. The content model requires `<dt>` before `<dd>`,
|
|
52
|
+
* but the design shows the value first; `order-first` on the `<dd>` flips
|
|
53
|
+
* the visual order only, so a screen reader hears the natural dl reading
|
|
54
|
+
* ("plugins, 52") while sighted users get the big-number-first layout. Both
|
|
55
|
+
* sequences are meaningful, so SC 1.3.2 is satisfied either way.
|
|
56
|
+
*
|
|
57
|
+
* Typography: the value carries the unified title treatment (semibold +
|
|
58
|
+
* tracking-tight, per heading.tsx) at 1.5rem rather than the docs version's
|
|
59
|
+
* 700 weight — one title voice across the system beats a one-off bold.
|
|
60
|
+
* `leading-none` because a value never wraps (it's a number); it also keeps
|
|
61
|
+
* the strip from towering over the sm label it baselines against. No
|
|
62
|
+
* `tabular-nums`: values sit in distinct rows of one, never in a column
|
|
63
|
+
* where digits must align.
|
|
64
|
+
*
|
|
65
|
+
* Colour: values default to `text-foreground`, not the docs' brand — brand
|
|
66
|
+
* emphasis is a page-level choice, not a property of "a statistic", so it is
|
|
67
|
+
* opt-in via `tone="brand"`. Contrast is inherited from theme.css: --brand
|
|
68
|
+
* (--hue-orange) measures 5.08:1 light / 9.63:1 dark on --background, and
|
|
69
|
+
* --muted-foreground labels measure 8.32:1 light on --background.
|
|
70
|
+
*/
|
|
71
|
+
declare function StatStrip({ items, tone, className, children, ...props }: StatStripProps): React.JSX.Element;
|
|
72
|
+
interface StatStripItemProps extends Omit<React.ComponentProps<"div">, "children"> {
|
|
73
|
+
value: React.ReactNode;
|
|
74
|
+
label: React.ReactNode;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* One value/label pair. Exists as a public component (rather than only the
|
|
78
|
+
* `items` array) because the `<dl>` content model is an internal contract —
|
|
79
|
+
* a consumer composing custom markup should not need to know that the label
|
|
80
|
+
* must precede the value in the DOM, or that `order-first` restores the
|
|
81
|
+
* visual order. `value`/`label` stay props, not children slots: the pair is
|
|
82
|
+
* a fixed shape with no middle ground, the empty-state end of the
|
|
83
|
+
* config-vs-composition spectrum, not the card end.
|
|
84
|
+
*/
|
|
85
|
+
declare function StatStripItem({ value, label, className, ...props }: StatStripItemProps): React.JSX.Element;
|
|
86
|
+
export { StatStrip, StatStripItem };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { cn as e } from "../../lib/utils.js";
|
|
2
|
+
import "react";
|
|
3
|
+
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/data/stat-strip.tsx
|
|
5
|
+
function r({ items: n, tone: r = "default", className: a, children: o, ...s }) {
|
|
6
|
+
return /* @__PURE__ */ t("dl", {
|
|
7
|
+
"data-slot": "stat-strip",
|
|
8
|
+
"data-tone": r,
|
|
9
|
+
className: e("group/stat-strip flex flex-wrap items-baseline gap-x-5 gap-y-2 sm:gap-x-8", a),
|
|
10
|
+
...s,
|
|
11
|
+
children: o ?? n?.map((e, n) => /* @__PURE__ */ t(i, {
|
|
12
|
+
value: e.value,
|
|
13
|
+
label: e.label
|
|
14
|
+
}, e.key ?? n))
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
function i({ value: r, label: i, className: a, ...o }) {
|
|
18
|
+
return /* @__PURE__ */ n("div", {
|
|
19
|
+
"data-slot": "stat-strip-item",
|
|
20
|
+
className: e("flex items-baseline gap-1.5", a),
|
|
21
|
+
...o,
|
|
22
|
+
children: [/* @__PURE__ */ t("dt", {
|
|
23
|
+
"data-slot": "stat-strip-label",
|
|
24
|
+
className: "text-sm text-muted-foreground",
|
|
25
|
+
children: i
|
|
26
|
+
}), /* @__PURE__ */ t("dd", {
|
|
27
|
+
"data-slot": "stat-strip-value",
|
|
28
|
+
className: "order-first m-0 text-2xl leading-none font-semibold tracking-tight text-foreground group-data-[tone=brand]/stat-strip:text-brand",
|
|
29
|
+
children: r
|
|
30
|
+
})]
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
//#endregion
|
|
34
|
+
export { r as StatStrip, i as StatStripItem };
|
|
35
|
+
|
|
36
|
+
//# sourceMappingURL=stat-strip.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stat-strip.js","names":[],"sources":["../../../src/components/data/stat-strip.tsx"],"mappings":";;;;AA4EA,SAAS,EAAU,EAAE,UAAO,UAAO,WAAW,cAAW,aAAU,GAAG,KAAyB;CAC7F,OACE,kBAAC,MAAD;EACE,aAAU;EACV,aAAW;EAQX,WAAW,EAAG,6EAA6E,CAAS;EACpG,GAAI;EAEH,UAAA,KAAY,GAAO,KAAK,GAAM,MAAM,kBAAC,GAAD;GAAmC,OAAO,EAAK;GAAO,OAAO,EAAK;EAAQ,GAAtD,EAAK,OAAO,CAA0C,CAAC;CAC9G,CAAA;AAER;AAgBA,SAAS,EAAc,EAAE,UAAO,UAAO,cAAW,GAAG,KAA6B;CAChF,OACE,kBAAC,OAAD;EAAK,aAAU;EAAkB,WAAW,EAAG,+BAA+B,CAAS;EAAG,GAAI;EAA9F,UAAA,CACE,kBAAC,MAAD;GAAI,aAAU;GAAmB,WAAU;GACxC,UAAA;EACC,CAAA,GAGJ,kBAAC,MAAD;GACE,aAAU;GACV,WAAU;GAET,UAAA;EACC,CAAA,CACD;;AAET"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type VariantProps } from "class-variance-authority";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
/**
|
|
4
|
+
* Chip — the OPERABLE counterpart to {@link Badge} (#229).
|
|
5
|
+
*
|
|
6
|
+
* Badge is deliberately non-interactive content, which is why its comments
|
|
7
|
+
* wave off SC 1.4.11. Chip is a link or button wearing the same outline
|
|
8
|
+
* vocabulary, so 1.4.11 (3:1 non-text contrast for component/state visuals)
|
|
9
|
+
* DOES reach it, and every state below is measured. Selection is explicitly
|
|
10
|
+
* out of scope — a Chip never carries `aria-pressed`; that job belongs to
|
|
11
|
+
* ToggleGroup (#218).
|
|
12
|
+
*/
|
|
13
|
+
declare const chipVariants: (props?: ({
|
|
14
|
+
mono?: boolean | null | undefined;
|
|
15
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
16
|
+
/**
|
|
17
|
+
* A link/button-shaped tag: archived-version links, blog tags.
|
|
18
|
+
*
|
|
19
|
+
* The primary usage is `asChild` around a real anchor —
|
|
20
|
+
* `<Chip asChild><a href=…>5.11</a></Chip>` — so navigation keeps native
|
|
21
|
+
* link semantics. Without `asChild` it renders a real `<button>`, never a
|
|
22
|
+
* styled span: a Chip is operable by definition, and a span default would
|
|
23
|
+
* hand every bare `<Chip onClick>` call site a focus/keyboard/AT bug.
|
|
24
|
+
*/
|
|
25
|
+
declare function Chip({ className, mono, asChild, children, ref, ...props }: React.ComponentProps<"button"> & VariantProps<typeof chipVariants> & {
|
|
26
|
+
asChild?: boolean;
|
|
27
|
+
}): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>;
|
|
28
|
+
export { Chip, chipVariants };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { cn as e } from "../../lib/utils.js";
|
|
2
|
+
import * as t from "react";
|
|
3
|
+
import { cva as n } from "class-variance-authority";
|
|
4
|
+
import { useRender as r } from "@base-ui/react/use-render";
|
|
5
|
+
//#region src/components/feedback/chip.tsx
|
|
6
|
+
var i = n("inline-flex items-center justify-center rounded-full border px-2.5 py-1 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none text-foreground no-underline hover:bg-accent hover:text-accent-foreground hover:border-brand active:bg-secondary focus-ring transition-[color,background-color,border-color,box-shadow] duration-control disabled:pointer-events-none disabled:opacity-50", {
|
|
7
|
+
variants: { mono: {
|
|
8
|
+
true: "font-mono",
|
|
9
|
+
false: ""
|
|
10
|
+
} },
|
|
11
|
+
defaultVariants: { mono: !1 }
|
|
12
|
+
});
|
|
13
|
+
function a({ className: n, mono: a, asChild: o = !1, children: s, ref: c, ...l }) {
|
|
14
|
+
return r({
|
|
15
|
+
defaultTagName: "button",
|
|
16
|
+
ref: c,
|
|
17
|
+
render: o ? t.Children.only(s) : void 0,
|
|
18
|
+
props: {
|
|
19
|
+
"data-slot": "chip",
|
|
20
|
+
className: e(i({ mono: a }), n),
|
|
21
|
+
...o ? {} : { children: s },
|
|
22
|
+
...l
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
//#endregion
|
|
27
|
+
export { a as Chip, i as chipVariants };
|
|
28
|
+
|
|
29
|
+
//# sourceMappingURL=chip.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chip.js","names":[],"sources":["../../../src/components/feedback/chip.tsx"],"mappings":";;;;;AAgBA,IAAM,IAAe,EA0CnB,2aACA;CACE,UAAU,EAMR,MAAM;EACJ,MAAM;EACN,OAAO;CACT,EACF;CACA,iBAAiB,EACf,MAAM,GACR;AACF,CACF;AAWA,SAAS,EAAK,EACZ,cACA,SACA,aAAU,IACV,aACA,QACA,GAAG,KAC0F;CAC7F,OAAO,EAAU;EACf,gBAAgB;EACX;EACL,QAAQ,IAAW,EAAM,SAAS,KAAK,CAAQ,IAA2B,KAAA;EAC1E,OAAO;GACL,aAAa;GACb,WAAW,EAAG,EAAa,EAAE,QAAK,CAAC,GAAG,CAAS;GAC/C,GAAI,IAAU,CAAC,IAAI,EAAE,YAAS;GAC9B,GAAG;EACL;CACF,CAAC;AACH"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { Toggle as TogglePrimitive } from "@base-ui/react/toggle";
|
|
2
|
+
import { ToggleGroup as ToggleGroupPrimitive } from "@base-ui/react/toggle-group";
|
|
3
|
+
import { type VariantProps } from "class-variance-authority";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import type { SelectionGroupNameProps } from "./toggle-card";
|
|
6
|
+
declare const toggleVariants: (props?: ({
|
|
7
|
+
variant?: "default" | "outline" | null | undefined;
|
|
8
|
+
size?: "default" | "icon" | "sm" | "lg" | "icon-sm" | null | undefined;
|
|
9
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
10
|
+
export type ToggleProps = Omit<React.ComponentProps<typeof TogglePrimitive>, "onPressedChange"> & VariantProps<typeof toggleVariants> & {
|
|
11
|
+
/**
|
|
12
|
+
* Fired with the next pressed state. Base UI passes `(pressed,
|
|
13
|
+
* eventDetails)`; the extra argument is dropped here for the same
|
|
14
|
+
* reason toggle-card.tsx drops it — it leaks into
|
|
15
|
+
* `onPressedChange={setState}` call sites.
|
|
16
|
+
*/
|
|
17
|
+
onPressedChange?: (pressed: boolean) => void;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* A two-state button — `aria-pressed`, pressed fill and focus ring included,
|
|
21
|
+
* so none of them can be forgotten at a call site (#218).
|
|
22
|
+
*
|
|
23
|
+
* Standalone it owns its pressed state (`pressed`/`defaultPressed`); inside a
|
|
24
|
+
* {@link ToggleGroup} it is driven by the group's `value` and MUST carry a
|
|
25
|
+
* `value` prop of its own (Base UI warns in dev if it doesn't).
|
|
26
|
+
*/
|
|
27
|
+
declare function Toggle({ className, variant, size, onPressedChange, ...props }: ToggleProps): React.JSX.Element;
|
|
28
|
+
declare const toggleGroupVariants: (props?: ({
|
|
29
|
+
segmented?: boolean | null | undefined;
|
|
30
|
+
orientation?: "horizontal" | "vertical" | null | undefined;
|
|
31
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
32
|
+
export type ToggleGroupProps = Omit<React.ComponentProps<typeof ToggleGroupPrimitive>, "onValueChange"> & SelectionGroupNameProps & VariantProps<typeof toggleGroupVariants> & {
|
|
33
|
+
/** Fired with the values of all pressed items (eventDetails dropped). */
|
|
34
|
+
onValueChange?: (groupValue: string[]) => void;
|
|
35
|
+
/**
|
|
36
|
+
* Joined toolbar look: one shared border, hairline dividers, items
|
|
37
|
+
* stripped of their own chrome. Off, items sit loose with a small gap.
|
|
38
|
+
*/
|
|
39
|
+
segmented?: boolean;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Shared state for a set of {@link Toggle}s — one tab stop, roving focus.
|
|
43
|
+
*
|
|
44
|
+
* The value model is Base UI's: always an array of the pressed items'
|
|
45
|
+
* values, single-select by default (`multiple` opts into any-of-N). The
|
|
46
|
+
* issue sketched Radix's `type="single" | "multiple"` with a
|
|
47
|
+
* `string | string[]` value instead; that union forks every controlled call
|
|
48
|
+
* site into runtime narrowing, and the empty single-selection ("none of
|
|
49
|
+
* these") falls out of the array shape for free, so Base UI's model stands.
|
|
50
|
+
*
|
|
51
|
+
* Single-select here CAN be emptied by pressing the pressed item again. If
|
|
52
|
+
* your group must always have a selection, that is a radiogroup — use
|
|
53
|
+
* SegmentedControl (toggle-card.tsx).
|
|
54
|
+
*/
|
|
55
|
+
declare function ToggleGroup({ className, segmented, orientation, onValueChange, ...props }: ToggleGroupProps): React.JSX.Element;
|
|
56
|
+
export { Toggle, ToggleGroup, toggleGroupVariants, toggleVariants };
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn as e } from "../../lib/utils.js";
|
|
3
|
+
import * as t from "react";
|
|
4
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
5
|
+
import { cva as r } from "class-variance-authority";
|
|
6
|
+
import { Toggle as i } from "@base-ui/react/toggle";
|
|
7
|
+
import { ToggleGroup as a } from "@base-ui/react/toggle-group";
|
|
8
|
+
//#region src/components/forms/toggle.tsx
|
|
9
|
+
var o = r([
|
|
10
|
+
"inline-flex shrink-0 items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium",
|
|
11
|
+
"transition-[color,background-color,border-color,box-shadow] duration-control focus-ring",
|
|
12
|
+
"disabled:pointer-events-none disabled:opacity-50",
|
|
13
|
+
"[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
14
|
+
"data-[pressed]:bg-primary data-[pressed]:text-primary-foreground",
|
|
15
|
+
"data-[pressed]:hover:bg-primary-hover data-[pressed]:active:bg-primary-active"
|
|
16
|
+
], {
|
|
17
|
+
variants: {
|
|
18
|
+
variant: {
|
|
19
|
+
default: [
|
|
20
|
+
"bg-transparent",
|
|
21
|
+
"not-data-[pressed]:hover:bg-accent not-data-[pressed]:hover:text-accent-foreground",
|
|
22
|
+
"dark:not-data-[pressed]:hover:bg-accent/50"
|
|
23
|
+
],
|
|
24
|
+
outline: [
|
|
25
|
+
"border bg-background shadow-xs",
|
|
26
|
+
"not-data-[pressed]:hover:bg-accent not-data-[pressed]:hover:text-accent-foreground",
|
|
27
|
+
"dark:border-input dark:not-data-[pressed]:bg-card dark:not-data-[pressed]:hover:bg-muted",
|
|
28
|
+
"data-[pressed]:border-primary"
|
|
29
|
+
]
|
|
30
|
+
},
|
|
31
|
+
size: {
|
|
32
|
+
default: "h-9 min-w-9 px-2",
|
|
33
|
+
sm: "h-8 min-w-8 px-1.5",
|
|
34
|
+
lg: "h-10 min-w-10 px-2.5",
|
|
35
|
+
icon: "size-9",
|
|
36
|
+
"icon-sm": "size-8"
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
defaultVariants: {
|
|
40
|
+
variant: "default",
|
|
41
|
+
size: "default"
|
|
42
|
+
}
|
|
43
|
+
}), s = t.createContext(null);
|
|
44
|
+
function c({ className: r, variant: a = "default", size: c = "default", onPressedChange: l, ...u }) {
|
|
45
|
+
let d = t.useContext(s);
|
|
46
|
+
return /* @__PURE__ */ n(i, {
|
|
47
|
+
"data-slot": "toggle",
|
|
48
|
+
"data-variant": a,
|
|
49
|
+
"data-size": c,
|
|
50
|
+
onPressedChange: (e) => l?.(e),
|
|
51
|
+
className: e(o({
|
|
52
|
+
variant: a,
|
|
53
|
+
size: c
|
|
54
|
+
}), d?.segmented && ["rounded-[0px] border-0 shadow-none focus-visible:z-10", d.orientation === "vertical" ? ["not-first:border-t not-first:border-input", "first:rounded-t-[calc(var(--radius-md)-1px)] last:rounded-b-[calc(var(--radius-md)-1px)]"] : ["not-first:border-l not-first:border-input", "first:rounded-l-[calc(var(--radius-md)-1px)] last:rounded-r-[calc(var(--radius-md)-1px)]"]], r),
|
|
55
|
+
...u
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
var l = r("flex w-fit items-center", {
|
|
59
|
+
variants: {
|
|
60
|
+
segmented: {
|
|
61
|
+
false: "gap-1",
|
|
62
|
+
true: "isolate rounded-md border border-input bg-background shadow-xs dark:bg-card"
|
|
63
|
+
},
|
|
64
|
+
orientation: {
|
|
65
|
+
horizontal: "flex-row",
|
|
66
|
+
vertical: "flex-col items-stretch"
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
defaultVariants: {
|
|
70
|
+
segmented: !1,
|
|
71
|
+
orientation: "horizontal"
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
function u({ className: r, segmented: i = !1, orientation: o = "horizontal", onValueChange: c, ...u }) {
|
|
75
|
+
let d = t.useMemo(() => ({
|
|
76
|
+
segmented: i,
|
|
77
|
+
orientation: o
|
|
78
|
+
}), [i, o]);
|
|
79
|
+
return /* @__PURE__ */ n(s.Provider, {
|
|
80
|
+
value: d,
|
|
81
|
+
children: /* @__PURE__ */ n(a, {
|
|
82
|
+
"data-slot": "toggle-group",
|
|
83
|
+
"data-segmented": i ? "" : void 0,
|
|
84
|
+
orientation: o,
|
|
85
|
+
onValueChange: (e) => c?.(e),
|
|
86
|
+
className: e(l({
|
|
87
|
+
segmented: i,
|
|
88
|
+
orientation: o
|
|
89
|
+
}), r),
|
|
90
|
+
...u
|
|
91
|
+
})
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
//#endregion
|
|
95
|
+
export { c as Toggle, u as ToggleGroup, l as toggleGroupVariants, o as toggleVariants };
|
|
96
|
+
|
|
97
|
+
//# sourceMappingURL=toggle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toggle.js","names":[],"sources":["../../../src/components/forms/toggle.tsx"],"mappings":";;;;;;;;AA0CA,IAAM,IAAiB,EACrB;CACE;CACA;CACA;CACA;CAOA;CACA;AACF,GACA;CACE,UAAU;EAKR,SAAS;GAEP,SAAS;IACP;IACA;IACA;GACF;GAKA,SAAS;IACP;IACA;IACA;IACA;GACF;EACF;EAMA,MAAM;GACJ,SAAS;GACT,IAAI;GACJ,IAAI;GACJ,MAAM;GACN,WAAW;EACb;CACF;CACA,iBAAiB;EACf,SAAS;EACT,MAAM;CACR;AACF,CACF,GAmBM,IAA0B,EAAM,cAAmD,IAAI;AAU7F,SAAS,EAAO,EAAE,cAAW,aAAU,WAAW,UAAO,WAAW,oBAAiB,GAAG,KAAsB;CAC5G,IAAM,IAAQ,EAAM,WAAW,CAAuB;CAEtD,OACE,kBAAC,GAAD;EACE,aAAU;EACV,gBAAc;EACd,aAAW;EACX,kBAAkB,MAAY,IAAkB,CAAO;EACvD,WAAW,EACT,EAAe;GAAE;GAAS;EAAK,CAAC,GAgChC,GAAO,aAAa,CAClB,yDACA,EAAM,gBAAgB,aAClB,CACE,6CACA,0FACF,IACA,CACE,6CACA,0FACF,CACN,GACA,CACF;EACA,GAAI;CACL,CAAA;AAEL;AAEA,IAAM,IAAsB,EAAI,2BAA2B;CACzD,UAAU;EACR,WAAW;GAET,OAAO;GAQP,MAAM;EACR;EACA,aAAa;GACX,YAAY;GACZ,UAAU;EACZ;CACF;CACA,iBAAiB;EACf,WAAW;EACX,aAAa;CACf;AACF,CAAC;AA8BD,SAAS,EAAY,EACnB,cACA,eAAY,IACZ,iBAAc,cACd,kBACA,GAAG,KACgB;CACnB,IAAM,IAAU,EAAM,eACb;EAAE;EAAW;CAAY,IAChC,CAAC,GAAW,CAAW,CACzB;CAEA,OACE,kBAAC,EAAwB,UAAzB;EAAkC,OAAO;EACvC,UAAA,kBAAC,GAAD;GACE,aAAU;GACV,kBAAgB,IAAY,KAAK,KAAA;GACpB;GACb,gBAAgB,MAAe,IAAgB,CAAU;GACzD,WAAW,EAAG,EAAoB;IAAE;IAAW;GAAY,CAAC,GAAG,CAAS;GACxE,GAAI;EACL,CAAA;CAC+B,CAAA;AAEtC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export * from "./components/containment/collapsible";
|
|
|
12
12
|
export * from "./components/containment/json-tree";
|
|
13
13
|
export * from "./components/feedback/alert";
|
|
14
14
|
export * from "./components/feedback/badge";
|
|
15
|
+
export * from "./components/feedback/chip";
|
|
15
16
|
export * from "./components/feedback/empty-state";
|
|
16
17
|
export * from "./components/forms/button";
|
|
17
18
|
export * from "./components/forms/checkbox";
|
|
@@ -40,6 +41,7 @@ export * from "./components/forms/slider";
|
|
|
40
41
|
export * from "./components/forms/switch";
|
|
41
42
|
export * from "./components/forms/textarea";
|
|
42
43
|
export * from "./components/forms/time-picker";
|
|
44
|
+
export * from "./components/forms/toggle";
|
|
43
45
|
export * from "./components/forms/toggle-card";
|
|
44
46
|
export * from "./components/layout/stack";
|
|
45
47
|
export * from "./components/overlays/sheet";
|
|
@@ -48,6 +50,7 @@ export * from "./components/typography/text";
|
|
|
48
50
|
export * from "./components/typography/text-link";
|
|
49
51
|
export * from "./components/chrome/board-icon";
|
|
50
52
|
export * from "./components/chrome/board-selector";
|
|
53
|
+
export * from "./components/chrome/breadcrumb";
|
|
51
54
|
export * from "./components/chrome/fiesta-icon";
|
|
52
55
|
export * from "./components/chrome/fiesta-logo";
|
|
53
56
|
export * from "./components/chrome/language-selector";
|
|
@@ -70,6 +73,8 @@ export * from "./lib/board-characters";
|
|
|
70
73
|
export * from "./lib/board-colors";
|
|
71
74
|
export * from "./lib/board-dimensions";
|
|
72
75
|
export * from "./lib/board-previews";
|
|
76
|
+
export * from "./components/data/bar-list";
|
|
77
|
+
export * from "./components/data/stat-strip";
|
|
73
78
|
export * from "./components/plugin/board-showcase";
|
|
74
79
|
export * from "./components/plugin/plugin-card";
|
|
75
80
|
export * from "./components/plugin/plugin-category-badge";
|