@pibit.ai/cure-design-system 0.6.7 → 0.6.9
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/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +298 -282
- package/dist/patterns/accordion/accordion.d.ts +75 -0
- package/dist/patterns/accordion/accordion.d.ts.map +1 -0
- package/dist/patterns/accordion/accordion.js +151 -0
- package/dist/patterns/accordion/collapsible.d.ts +29 -0
- package/dist/patterns/accordion/collapsible.d.ts.map +1 -0
- package/dist/patterns/accordion/collapsible.js +30 -0
- package/dist/patterns/accordion/expandable-card.d.ts +30 -0
- package/dist/patterns/accordion/expandable-card.d.ts.map +1 -0
- package/dist/patterns/accordion/expandable-card.js +99 -0
- package/dist/patterns/accordion/index.d.ts +4 -0
- package/dist/patterns/accordion/index.d.ts.map +1 -0
- package/dist/patterns/table/toolbar/GroupByDropdown.js +1 -1
- package/dist/patterns/table/toolbar/ToolbarRadio.d.ts +5 -17
- package/dist/patterns/table/toolbar/ToolbarRadio.d.ts.map +1 -1
- package/dist/primitives/radio/index.d.ts +2 -0
- package/dist/primitives/radio/index.d.ts.map +1 -0
- package/dist/primitives/radio/radio.d.ts +61 -0
- package/dist/primitives/radio/radio.d.ts.map +1 -0
- package/dist/primitives/radio/radio.js +75 -0
- package/dist/primitives/textarea/index.d.ts +2 -0
- package/dist/primitives/textarea/index.d.ts.map +1 -0
- package/dist/primitives/textarea/textarea.d.ts +56 -0
- package/dist/primitives/textarea/textarea.d.ts.map +1 -0
- package/dist/primitives/textarea/textarea.js +107 -0
- package/dist/styles/components.css +1 -1
- package/package.json +1 -1
- package/dist/patterns/table/toolbar/ToolbarRadio.js +0 -64
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Hides any outer AccordionGroup from what is rendered inside it. React Aria joins every
|
|
4
|
+
* Disclosure to the nearest group, so without this an accordion (or a Collapsible) nested in
|
|
5
|
+
* another accordion's panel would become one more item of the outer group.
|
|
6
|
+
*/
|
|
7
|
+
export declare const IsolateFromAccordionGroup: ({ children }: {
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export interface AccordionProps {
|
|
11
|
+
/**
|
|
12
|
+
* Identifies the item inside an `AccordionGroup`, which then owns its open state
|
|
13
|
+
* (`defaultOpen` / `isOpen` are ignored). Without an id the accordion stays independent,
|
|
14
|
+
* even inside a group.
|
|
15
|
+
*/
|
|
16
|
+
id?: string;
|
|
17
|
+
title: string | ReactNode;
|
|
18
|
+
titleIcon?: ReactNode;
|
|
19
|
+
subtitle?: string;
|
|
20
|
+
children: ReactNode;
|
|
21
|
+
/** Initial open state when uncontrolled. */
|
|
22
|
+
defaultOpen?: boolean;
|
|
23
|
+
/** Controlled open state (outside a group). */
|
|
24
|
+
isOpen?: boolean;
|
|
25
|
+
/** Called with the new open state whenever the header is pressed. */
|
|
26
|
+
onOpenChange?: (isOpen: boolean) => void;
|
|
27
|
+
isDisabled?: boolean;
|
|
28
|
+
/** Classes for the outer wrapper. */
|
|
29
|
+
className?: string;
|
|
30
|
+
/** Classes for the content wrapper (padding etc.). */
|
|
31
|
+
childrenClassName?: string;
|
|
32
|
+
/** Classes added to the header button while open. */
|
|
33
|
+
activeTitleClassName?: string;
|
|
34
|
+
/** Classes for the header row inside the button. */
|
|
35
|
+
headerClassName?: string;
|
|
36
|
+
/** Classes for the header button itself (e.g. to drop its bottom border). Applied open or closed. */
|
|
37
|
+
buttonClassName?: string;
|
|
38
|
+
/** `true` (default) shows a rotating chevron; `false` shows plus / minus. */
|
|
39
|
+
showToggle?: boolean;
|
|
40
|
+
/** Set false to hide the built-in chevron / plus-minus indicator entirely (caller renders its own). */
|
|
41
|
+
showIndicator?: boolean;
|
|
42
|
+
/** Rendered before the expand/collapse indicator (e.g. a row actions menu). Clicks do not toggle the accordion. */
|
|
43
|
+
headerActions?: ReactNode;
|
|
44
|
+
/** When true, content mounts only while open (and for the length of the close animation). */
|
|
45
|
+
lazyMount?: boolean;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* A collapsible section: a full-width header button over a panel that slides open
|
|
49
|
+
* (grid-rows 0fr → 1fr, 300ms) and fades in. Built on React Aria `Disclosure`, so the header
|
|
50
|
+
* is a real button with `aria-expanded` / `aria-controls`, and the panel is labelled by it.
|
|
51
|
+
*/
|
|
52
|
+
export declare const Accordion: ({ id, children, title, titleIcon, subtitle, defaultOpen, isOpen, onOpenChange, isDisabled, className, childrenClassName, activeTitleClassName, headerClassName, buttonClassName, showToggle, showIndicator, headerActions, lazyMount, }: AccordionProps) => import("react/jsx-runtime").JSX.Element;
|
|
53
|
+
export interface AccordionGroupProps {
|
|
54
|
+
/** Initially open item (single mode). */
|
|
55
|
+
defaultOpenId?: string;
|
|
56
|
+
/** Initially open items. In single mode only the first is used. */
|
|
57
|
+
defaultOpenIds?: string[];
|
|
58
|
+
/** Controlled open items. */
|
|
59
|
+
openIds?: string[];
|
|
60
|
+
/** Called with the new open items whenever one is opened or closed. */
|
|
61
|
+
onOpenIdsChange?: (openIds: string[]) => void;
|
|
62
|
+
/** Allow several items open at once. */
|
|
63
|
+
multiple?: boolean;
|
|
64
|
+
/** Allow closing an open item by pressing its header. Without it an open item stays open. */
|
|
65
|
+
collapsible?: boolean;
|
|
66
|
+
isDisabled?: boolean;
|
|
67
|
+
children: ReactNode;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Coordinates the `Accordion`s (with an `id`) rendered anywhere below it: single or multiple
|
|
71
|
+
* expansion, controlled (`openIds` + `onOpenIdsChange`) or uncontrolled. Renders no element
|
|
72
|
+
* of its own, so it can wrap items laid out by the parent.
|
|
73
|
+
*/
|
|
74
|
+
export declare function AccordionGroup({ defaultOpenId, defaultOpenIds, openIds: controlledOpenIds, onOpenIdsChange, multiple, collapsible, isDisabled, children, }: AccordionGroupProps): import("react/jsx-runtime").JSX.Element;
|
|
75
|
+
//# sourceMappingURL=accordion.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accordion.d.ts","sourceRoot":"","sources":["../../../src/patterns/accordion/accordion.tsx"],"names":[],"mappings":"AAEA,OAAO,EAA8D,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAenG;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,GAAI,cAAc;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,4CAE9E,CAAC;AAEF,MAAM,WAAW,cAAc;IAC7B;;;;OAIG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,SAAS,CAAC;IACpB,4CAA4C;IAC5C,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,+CAA+C;IAC/C,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,qEAAqE;IACrE,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;IACzC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,qCAAqC;IACrC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sDAAsD;IACtD,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,qDAAqD;IACrD,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,oDAAoD;IACpD,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,qGAAqG;IACrG,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,6EAA6E;IAC7E,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,uGAAuG;IACvG,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,mHAAmH;IACnH,aAAa,CAAC,EAAE,SAAS,CAAC;IAC1B,6FAA6F;IAC7F,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED;;;;GAIG;AACH,eAAO,MAAM,SAAS,GAAI,yOAmBvB,cAAc,4CAoEhB,CAAC;AAiDF,MAAM,WAAW,mBAAmB;IAClC,yCAAyC;IACzC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,mEAAmE;IACnE,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,6BAA6B;IAC7B,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,uEAAuE;IACvE,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IAC9C,wCAAwC;IACxC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,6FAA6F;IAC7F,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,EAC7B,aAAa,EACb,cAAc,EACd,OAAO,EAAE,iBAAiB,EAC1B,eAAe,EACf,QAAgB,EAChB,WAAmB,EACnB,UAAkB,EAClB,QAAQ,GACT,EAAE,mBAAmB,2CA6BrB"}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { jsx as o, jsxs as w, Fragment as A } from "react/jsx-runtime";
|
|
2
|
+
import { ChevronDown as D, Minus as G, Plus as M } from "@untitledui/icons";
|
|
3
|
+
import { useControlledState as O } from "@react-stately/utils";
|
|
4
|
+
import { useContext as j, useMemo as q, useState as K, useEffect as W } from "react";
|
|
5
|
+
import { DisclosureGroupStateContext as S, Disclosure as F, Button as _, DisclosurePanel as b } from "react-aria-components";
|
|
6
|
+
import { cx as d } from "../../utils/cn.js";
|
|
7
|
+
const B = 300, I = ({ children: r }) => /* @__PURE__ */ o(S.Provider, { value: null, children: r }), U = ({
|
|
8
|
+
id: r,
|
|
9
|
+
children: t,
|
|
10
|
+
title: n,
|
|
11
|
+
titleIcon: u,
|
|
12
|
+
subtitle: e,
|
|
13
|
+
defaultOpen: s,
|
|
14
|
+
isOpen: a,
|
|
15
|
+
onOpenChange: x,
|
|
16
|
+
isDisabled: p,
|
|
17
|
+
className: i,
|
|
18
|
+
childrenClassName: l,
|
|
19
|
+
activeTitleClassName: N,
|
|
20
|
+
headerClassName: y,
|
|
21
|
+
buttonClassName: m,
|
|
22
|
+
showToggle: c = !0,
|
|
23
|
+
showIndicator: f = !0,
|
|
24
|
+
headerActions: h,
|
|
25
|
+
lazyMount: T = !1
|
|
26
|
+
}) => {
|
|
27
|
+
const P = j(S), g = P != null && r != null, k = /* @__PURE__ */ o(
|
|
28
|
+
F,
|
|
29
|
+
{
|
|
30
|
+
id: g ? r : void 0,
|
|
31
|
+
isExpanded: g ? void 0 : a,
|
|
32
|
+
defaultExpanded: g ? void 0 : s,
|
|
33
|
+
onExpandedChange: x,
|
|
34
|
+
isDisabled: p,
|
|
35
|
+
className: d("rounded-md", i),
|
|
36
|
+
children: ({ isExpanded: v }) => /* @__PURE__ */ w(A, { children: [
|
|
37
|
+
/* @__PURE__ */ o(
|
|
38
|
+
_,
|
|
39
|
+
{
|
|
40
|
+
slot: "trigger",
|
|
41
|
+
className: d(
|
|
42
|
+
"flex flex-col items-start w-full cursor-pointer gap-3 text-left border-b border-secondary",
|
|
43
|
+
m,
|
|
44
|
+
v && N
|
|
45
|
+
),
|
|
46
|
+
children: /* @__PURE__ */ w("div", { className: d("flex items-center w-full cursor-pointer py-3", y), children: [
|
|
47
|
+
/* @__PURE__ */ w("div", { className: "flex flex-1 gap-3 justify-start items-center", children: [
|
|
48
|
+
u,
|
|
49
|
+
typeof n == "string" ? /* @__PURE__ */ o("h4", { className: "text-[16px]", children: n }) : n,
|
|
50
|
+
e && /* @__PURE__ */ o("span", { className: "text-sm text-secondary", children: e })
|
|
51
|
+
] }),
|
|
52
|
+
h ? /* @__PURE__ */ o(
|
|
53
|
+
"div",
|
|
54
|
+
{
|
|
55
|
+
className: "p-1.5 mx-2 flex shrink-0 items-center",
|
|
56
|
+
onClick: (C) => C.stopPropagation(),
|
|
57
|
+
onPointerDown: (C) => C.stopPropagation(),
|
|
58
|
+
children: h
|
|
59
|
+
}
|
|
60
|
+
) : null,
|
|
61
|
+
f ? c ? /* @__PURE__ */ o(
|
|
62
|
+
"span",
|
|
63
|
+
{
|
|
64
|
+
className: d(
|
|
65
|
+
"p-1 ml-auto shrink-0 transform transition-transform duration-300",
|
|
66
|
+
v ? "rotate-180" : "rotate-0"
|
|
67
|
+
),
|
|
68
|
+
children: /* @__PURE__ */ o(D, { strokeWidth: 1.25, color: "var(--color-fg-quaternary)" })
|
|
69
|
+
}
|
|
70
|
+
) : /* @__PURE__ */ w("span", { className: "ml-auto transform transition-transform duration-300", children: [
|
|
71
|
+
v ? /* @__PURE__ */ o(G, { size: 16, strokeWidth: 1.25, color: "var(--color-fg-quaternary)" }) : /* @__PURE__ */ o(M, { size: 16, strokeWidth: 1.25, color: "var(--color-fg-quaternary)" }),
|
|
72
|
+
" "
|
|
73
|
+
] }) : null
|
|
74
|
+
] })
|
|
75
|
+
}
|
|
76
|
+
),
|
|
77
|
+
/* @__PURE__ */ o(R, { isExpanded: v, lazyMount: T, childrenClassName: l, children: t })
|
|
78
|
+
] })
|
|
79
|
+
}
|
|
80
|
+
);
|
|
81
|
+
return P != null && !g ? /* @__PURE__ */ o(I, { children: k }) : k;
|
|
82
|
+
}, R = ({
|
|
83
|
+
isExpanded: r,
|
|
84
|
+
lazyMount: t,
|
|
85
|
+
childrenClassName: n,
|
|
86
|
+
children: u
|
|
87
|
+
}) => {
|
|
88
|
+
const [e, s] = K(!t || r);
|
|
89
|
+
return W(() => {
|
|
90
|
+
if (!t) return;
|
|
91
|
+
if (r) {
|
|
92
|
+
s(!0);
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
const a = window.setTimeout(() => s(!1), B);
|
|
96
|
+
return () => window.clearTimeout(a);
|
|
97
|
+
}, [r, t]), /* @__PURE__ */ o(
|
|
98
|
+
b,
|
|
99
|
+
{
|
|
100
|
+
className: d(
|
|
101
|
+
"grid motion-safe:transition-[grid-template-rows] motion-safe:duration-300 motion-safe:ease-in-out will-change-[grid-template-rows]",
|
|
102
|
+
r ? "grid-rows-[1fr]" : "grid-rows-[0fr]"
|
|
103
|
+
),
|
|
104
|
+
children: /* @__PURE__ */ o("div", { className: "min-h-0 overflow-hidden", children: /* @__PURE__ */ o(
|
|
105
|
+
"div",
|
|
106
|
+
{
|
|
107
|
+
className: d(
|
|
108
|
+
"pt-4 pb-1 motion-safe:transition-opacity motion-safe:duration-200 motion-safe:ease-out",
|
|
109
|
+
r ? "opacity-100" : "opacity-0",
|
|
110
|
+
n
|
|
111
|
+
),
|
|
112
|
+
children: /* @__PURE__ */ o(I, { children: e && u })
|
|
113
|
+
}
|
|
114
|
+
) })
|
|
115
|
+
}
|
|
116
|
+
);
|
|
117
|
+
};
|
|
118
|
+
function V({
|
|
119
|
+
defaultOpenId: r,
|
|
120
|
+
defaultOpenIds: t,
|
|
121
|
+
openIds: n,
|
|
122
|
+
onOpenIdsChange: u,
|
|
123
|
+
multiple: e = !1,
|
|
124
|
+
collapsible: s = !1,
|
|
125
|
+
isDisabled: a = !1,
|
|
126
|
+
children: x
|
|
127
|
+
}) {
|
|
128
|
+
const p = t ?? (r != null ? [r] : []), [i, l] = O(
|
|
129
|
+
n,
|
|
130
|
+
e ? p : p.slice(0, 1),
|
|
131
|
+
u
|
|
132
|
+
), N = q(() => {
|
|
133
|
+
const y = (m) => {
|
|
134
|
+
const c = String(m), f = i.includes(c);
|
|
135
|
+
f && !s || l(e ? f ? i.filter((h) => h !== c) : [...i, c] : f ? [] : [c]);
|
|
136
|
+
};
|
|
137
|
+
return {
|
|
138
|
+
allowsMultipleExpanded: e,
|
|
139
|
+
isDisabled: a,
|
|
140
|
+
expandedKeys: new Set(i),
|
|
141
|
+
toggleKey: y,
|
|
142
|
+
setExpandedKeys: (m) => l(Array.from(m, String))
|
|
143
|
+
};
|
|
144
|
+
}, [s, a, e, i, l]);
|
|
145
|
+
return /* @__PURE__ */ o(S.Provider, { value: N, children: x });
|
|
146
|
+
}
|
|
147
|
+
export {
|
|
148
|
+
U as Accordion,
|
|
149
|
+
V as AccordionGroup,
|
|
150
|
+
I as IsolateFromAccordionGroup
|
|
151
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { ButtonProps as AriaButtonProps, DisclosurePanelProps, DisclosureProps } from 'react-aria-components';
|
|
3
|
+
export interface CollapsibleProps extends Omit<DisclosureProps, "isExpanded" | "defaultExpanded" | "onExpandedChange" | "id" | "className" | "children"> {
|
|
4
|
+
/** Controlled open state. */
|
|
5
|
+
isOpen?: boolean;
|
|
6
|
+
/** Initial open state when uncontrolled. */
|
|
7
|
+
defaultOpen?: boolean;
|
|
8
|
+
onOpenChange?: (isOpen: boolean) => void;
|
|
9
|
+
className?: string;
|
|
10
|
+
children: ReactNode;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Unstyled show / hide region: a `CollapsibleTrigger` button and a `CollapsibleContent`
|
|
14
|
+
* panel, with no animation. Built on React Aria `Disclosure`; for a styled, animated
|
|
15
|
+
* section use `Accordion`.
|
|
16
|
+
*/
|
|
17
|
+
export declare function Collapsible({ isOpen, defaultOpen, onOpenChange, className, children, ...props }: CollapsibleProps): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export type CollapsibleTriggerProps = Omit<AriaButtonProps, "slot">;
|
|
19
|
+
/** The button that opens and closes its `Collapsible`. Unstyled; pass `className`. */
|
|
20
|
+
export declare function CollapsibleTrigger(props: CollapsibleTriggerProps): import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export interface CollapsibleContentProps extends Omit<DisclosurePanelProps, "className" | "children"> {
|
|
22
|
+
className?: string;
|
|
23
|
+
children?: ReactNode;
|
|
24
|
+
/** Keep the children mounted while closed (they are hidden). By default they unmount. */
|
|
25
|
+
forceMount?: boolean;
|
|
26
|
+
}
|
|
27
|
+
/** The region a `Collapsible` shows and hides. Takes no space while closed. */
|
|
28
|
+
export declare function CollapsibleContent({ className, children, forceMount, ...props }: CollapsibleContentProps): import("react/jsx-runtime").JSX.Element;
|
|
29
|
+
//# sourceMappingURL=collapsible.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collapsible.d.ts","sourceRoot":"","sources":["../../../src/patterns/accordion/collapsible.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AACnD,OAAO,EAKL,KAAK,WAAW,IAAI,eAAe,EACnC,KAAK,oBAAoB,EACzB,KAAK,eAAe,EACrB,MAAM,uBAAuB,CAAC;AAI/B,MAAM,WAAW,gBAAiB,SAAQ,IAAI,CAC5C,eAAe,EACf,YAAY,GAAG,iBAAiB,GAAG,kBAAkB,GAAG,IAAI,GAAG,WAAW,GAAG,UAAU,CACxF;IACC,6BAA6B;IAC7B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,4CAA4C;IAC5C,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;IACzC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,YAAY,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,gBAAgB,2CAcjH;AAED,MAAM,MAAM,uBAAuB,GAAG,IAAI,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC;AAEpE,sFAAsF;AACtF,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,uBAAuB,2CAEhE;AAED,MAAM,WAAW,uBAAwB,SAAQ,IAAI,CAAC,oBAAoB,EAAE,WAAW,GAAG,UAAU,CAAC;IACnG,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,yFAAyF;IACzF,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,+EAA+E;AAC/E,wBAAgB,kBAAkB,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAkB,EAAE,GAAG,KAAK,EAAE,EAAE,uBAAuB,2CAOhH"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { useContext as s } from "react";
|
|
3
|
+
import { Disclosure as d, Button as a, DisclosureStateContext as p, DisclosurePanel as u } from "react-aria-components";
|
|
4
|
+
import { cx as c } from "../../utils/cn.js";
|
|
5
|
+
import { IsolateFromAccordionGroup as m } from "./accordion.js";
|
|
6
|
+
function E({ isOpen: o, defaultOpen: n, onOpenChange: t, className: i, children: e, ...l }) {
|
|
7
|
+
return /* @__PURE__ */ r(m, { children: /* @__PURE__ */ r(
|
|
8
|
+
d,
|
|
9
|
+
{
|
|
10
|
+
...l,
|
|
11
|
+
isExpanded: o,
|
|
12
|
+
defaultExpanded: n,
|
|
13
|
+
onExpandedChange: t,
|
|
14
|
+
className: i,
|
|
15
|
+
children: e
|
|
16
|
+
}
|
|
17
|
+
) });
|
|
18
|
+
}
|
|
19
|
+
function b(o) {
|
|
20
|
+
return /* @__PURE__ */ r(a, { ...o, slot: "trigger" });
|
|
21
|
+
}
|
|
22
|
+
function D({ className: o, children: n, forceMount: t = !1, ...i }) {
|
|
23
|
+
const e = s(p);
|
|
24
|
+
return /* @__PURE__ */ r(u, { ...i, className: c("[&[hidden]]:hidden", o), children: t || e != null && e.isExpanded ? n : null });
|
|
25
|
+
}
|
|
26
|
+
export {
|
|
27
|
+
E as Collapsible,
|
|
28
|
+
D as CollapsibleContent,
|
|
29
|
+
b as CollapsibleTrigger
|
|
30
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export interface ExpandableCardProps {
|
|
3
|
+
title: string;
|
|
4
|
+
description: string;
|
|
5
|
+
/** Rendered in a rounded 32px tile before the title. */
|
|
6
|
+
icon?: ReactNode;
|
|
7
|
+
/** Background of the icon tile (any CSS colour). */
|
|
8
|
+
iconBgColor?: string;
|
|
9
|
+
/** Initial expanded state when uncontrolled. */
|
|
10
|
+
defaultExpanded?: boolean;
|
|
11
|
+
/** Controlled expanded state. */
|
|
12
|
+
isExpanded?: boolean;
|
|
13
|
+
onExpandedChange?: (isExpanded: boolean) => void;
|
|
14
|
+
/** Show the on/off switch in the header. */
|
|
15
|
+
showToggle?: boolean;
|
|
16
|
+
/** Initial switch state. */
|
|
17
|
+
defaultToggled?: boolean;
|
|
18
|
+
/** Called when the switch changes. Changing it never expands or collapses the card. */
|
|
19
|
+
onToggle?: (checked: boolean) => void;
|
|
20
|
+
isToggleDisabled?: boolean;
|
|
21
|
+
children?: ReactNode;
|
|
22
|
+
className?: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* A bordered card with an icon, title and description that expands to show its children,
|
|
26
|
+
* with an optional on/off switch in the header. Clicking anywhere on the header expands it;
|
|
27
|
+
* the chevron is the keyboard-accessible trigger.
|
|
28
|
+
*/
|
|
29
|
+
export declare const ExpandableCard: ({ showToggle, title, description, icon, iconBgColor, defaultExpanded, isExpanded, onExpandedChange, defaultToggled, onToggle, children, className, isToggleDisabled, }: ExpandableCardProps) => import("react/jsx-runtime").JSX.Element;
|
|
30
|
+
//# sourceMappingURL=expandable-card.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"expandable-card.d.ts","sourceRoot":"","sources":["../../../src/patterns/accordion/expandable-card.tsx"],"names":[],"mappings":"AACA,OAAO,EAAqC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAO1E,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,wDAAwD;IACxD,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,oDAAoD;IACpD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gDAAgD;IAChD,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,iCAAiC;IACjC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,gBAAgB,CAAC,EAAE,CAAC,UAAU,EAAE,OAAO,KAAK,IAAI,CAAC;IACjD,4CAA4C;IAC5C,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,4BAA4B;IAC5B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,uFAAuF;IACvF,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IACtC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;GAIG;AACH,eAAO,MAAM,cAAc,GAAI,wKAc5B,mBAAmB,4CAuFrB,CAAC"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { jsx as e, jsxs as t, Fragment as k } from "react/jsx-runtime";
|
|
2
|
+
import { ChevronDown as z } from "@untitledui/icons";
|
|
3
|
+
import { useState as D, useRef as j } from "react";
|
|
4
|
+
import { Disclosure as E, DisclosurePanel as F } from "react-aria-components";
|
|
5
|
+
import { cx as a } from "../../utils/cn.js";
|
|
6
|
+
import { IsolateFromAccordionGroup as I } from "./accordion.js";
|
|
7
|
+
import { Toggle as P } from "../../primitives/toggle/toggle.js";
|
|
8
|
+
import { ButtonUtility as R } from "../../primitives/button/button-utility.js";
|
|
9
|
+
const K = ({
|
|
10
|
+
showToggle: f = !0,
|
|
11
|
+
title: o,
|
|
12
|
+
description: x,
|
|
13
|
+
icon: n,
|
|
14
|
+
iconBgColor: g = "var(--color-bg-warning-secondary)",
|
|
15
|
+
defaultExpanded: p = !1,
|
|
16
|
+
isExpanded: u,
|
|
17
|
+
onExpandedChange: h,
|
|
18
|
+
defaultToggled: v = !0,
|
|
19
|
+
onToggle: i,
|
|
20
|
+
children: l,
|
|
21
|
+
className: b,
|
|
22
|
+
isToggleDisabled: N = !1
|
|
23
|
+
}) => {
|
|
24
|
+
const [d, y] = D(v), c = j(null), C = (r) => {
|
|
25
|
+
y(r), i == null || i(r);
|
|
26
|
+
};
|
|
27
|
+
return /* @__PURE__ */ e(I, { children: /* @__PURE__ */ e(
|
|
28
|
+
E,
|
|
29
|
+
{
|
|
30
|
+
isExpanded: u,
|
|
31
|
+
defaultExpanded: p,
|
|
32
|
+
onExpandedChange: h,
|
|
33
|
+
className: a("bg-white rounded-lg border border-[var(--color-border-secondary)]", b),
|
|
34
|
+
children: ({ isExpanded: r, state: w }) => /* @__PURE__ */ t(k, { children: [
|
|
35
|
+
/* @__PURE__ */ t(
|
|
36
|
+
"div",
|
|
37
|
+
{
|
|
38
|
+
className: "flex items-center gap-4 p-3 cursor-pointer",
|
|
39
|
+
onClick: (s) => {
|
|
40
|
+
var m;
|
|
41
|
+
(m = c.current) != null && m.contains(s.target) || w.toggle();
|
|
42
|
+
},
|
|
43
|
+
children: [
|
|
44
|
+
/* @__PURE__ */ t("div", { className: "flex items-center gap-3 flex-1 min-w-0", children: [
|
|
45
|
+
n && /* @__PURE__ */ e(
|
|
46
|
+
"div",
|
|
47
|
+
{
|
|
48
|
+
className: "flex items-center justify-center size-8 rounded-lg shrink-0",
|
|
49
|
+
style: { backgroundColor: g },
|
|
50
|
+
children: n
|
|
51
|
+
}
|
|
52
|
+
),
|
|
53
|
+
/* @__PURE__ */ t("div", { className: "flex flex-col flex-1 min-w-0", children: [
|
|
54
|
+
/* @__PURE__ */ e("p", { className: "text-[var(--color-text-secondary)] text-md font-medium leading-6", children: o }),
|
|
55
|
+
/* @__PURE__ */ e("p", { className: "text-[var(--color-text-tertiary)] text-sm font-normal leading-5", children: x })
|
|
56
|
+
] })
|
|
57
|
+
] }),
|
|
58
|
+
/* @__PURE__ */ t("div", { className: "flex items-center gap-2 shrink-0", children: [
|
|
59
|
+
f && /* @__PURE__ */ e("div", { onClick: (s) => s.stopPropagation(), children: /* @__PURE__ */ e(
|
|
60
|
+
P,
|
|
61
|
+
{
|
|
62
|
+
size: "sm",
|
|
63
|
+
isSelected: d,
|
|
64
|
+
onChange: C,
|
|
65
|
+
isDisabled: N,
|
|
66
|
+
disabledClasses: d ? "bg-brand-solid" : ""
|
|
67
|
+
}
|
|
68
|
+
) }),
|
|
69
|
+
/* @__PURE__ */ e("div", { ref: c, className: "contents", children: /* @__PURE__ */ e(
|
|
70
|
+
R,
|
|
71
|
+
{
|
|
72
|
+
slot: "trigger",
|
|
73
|
+
size: "xs",
|
|
74
|
+
color: "tertiary",
|
|
75
|
+
"aria-label": o,
|
|
76
|
+
icon: /* @__PURE__ */ e(
|
|
77
|
+
z,
|
|
78
|
+
{
|
|
79
|
+
size: 20,
|
|
80
|
+
className: a(
|
|
81
|
+
"text-[var(--color-text-quaternary)] transition-transform duration-200",
|
|
82
|
+
r && "rotate-180"
|
|
83
|
+
)
|
|
84
|
+
}
|
|
85
|
+
)
|
|
86
|
+
}
|
|
87
|
+
) })
|
|
88
|
+
] })
|
|
89
|
+
]
|
|
90
|
+
}
|
|
91
|
+
),
|
|
92
|
+
l && /* @__PURE__ */ e(F, { className: "[&[hidden]]:hidden", children: /* @__PURE__ */ e("div", { className: a("px-3 pb-3 pt-3", r && "animate-in fade-in duration-200"), children: l }) })
|
|
93
|
+
] })
|
|
94
|
+
}
|
|
95
|
+
) });
|
|
96
|
+
};
|
|
97
|
+
export {
|
|
98
|
+
K as ExpandableCard
|
|
99
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { Accordion, AccordionGroup, type AccordionProps, type AccordionGroupProps } from './accordion';
|
|
2
|
+
export { Collapsible, CollapsibleTrigger, CollapsibleContent, type CollapsibleProps, type CollapsibleTriggerProps, type CollapsibleContentProps, } from './collapsible';
|
|
3
|
+
export { ExpandableCard, type ExpandableCardProps } from './expandable-card';
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/patterns/accordion/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,KAAK,cAAc,EAAE,KAAK,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACvG,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,kBAAkB,EAClB,KAAK,gBAAgB,EACrB,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,GAC7B,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,cAAc,EAAE,KAAK,mBAAmB,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -3,9 +3,9 @@ import { useState as p, useEffect as O, useMemo as y } from "react";
|
|
|
3
3
|
import { cx as R } from "../../../utils/cn.js";
|
|
4
4
|
import { TOOLBAR_ICONS as _ } from "../toolbar-icons.js";
|
|
5
5
|
import { resolveColumnLabel as c } from "./tableToolbarHelpers.js";
|
|
6
|
-
import { RadioGroup as A, RadioButton as S } from "./ToolbarRadio.js";
|
|
7
6
|
import { Dropdown as v } from "../../../primitives/dropdown/dropdown.js";
|
|
8
7
|
import { Button as m } from "../../../primitives/button/button.js";
|
|
8
|
+
import { RadioGroup as A, RadioButton as S } from "../../../primitives/radio/radio.js";
|
|
9
9
|
const E = /* @__PURE__ */ new Set([
|
|
10
10
|
"string",
|
|
11
11
|
"number",
|
|
@@ -1,18 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
interface RadioButtonProps extends AriaRadioProps {
|
|
7
|
-
size?: "sm" | "md";
|
|
8
|
-
label?: ReactNode;
|
|
9
|
-
ref?: Ref<HTMLLabelElement>;
|
|
10
|
-
}
|
|
11
|
-
export declare const RadioButton: FC<RadioButtonProps>;
|
|
12
|
-
interface RadioGroupProps extends RadioGroupContextType, AriaRadioGroupProps {
|
|
13
|
-
children: ReactNode;
|
|
14
|
-
className?: string;
|
|
15
|
-
}
|
|
16
|
-
export declare const RadioGroup: FC<RadioGroupProps>;
|
|
17
|
-
export {};
|
|
1
|
+
/**
|
|
2
|
+
* @deprecated Internal alias kept so code and tests that import `./ToolbarRadio` keep working.
|
|
3
|
+
* Import from `@/primitives/radio` instead.
|
|
4
|
+
*/
|
|
5
|
+
export { RadioButton, RadioGroup } from '../../../primitives/radio';
|
|
18
6
|
//# sourceMappingURL=ToolbarRadio.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToolbarRadio.d.ts","sourceRoot":"","sources":["../../../../src/patterns/table/toolbar/ToolbarRadio.tsx"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"ToolbarRadio.d.ts","sourceRoot":"","sources":["../../../../src/patterns/table/toolbar/ToolbarRadio.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/primitives/radio/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,eAAe,EACf,UAAU,EACV,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EACzB,KAAK,eAAe,EACpB,KAAK,SAAS,GACf,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { ReactNode, Ref } from 'react';
|
|
2
|
+
import { RadioGroupProps as AriaRadioGroupProps, RadioProps as AriaRadioProps } from 'react-aria-components';
|
|
3
|
+
export type RadioSize = "xs" | "sm" | "md";
|
|
4
|
+
interface RadioGroupContextType {
|
|
5
|
+
size?: RadioSize;
|
|
6
|
+
}
|
|
7
|
+
export interface RadioButtonBaseProps {
|
|
8
|
+
/** `xs` and `sm` are a 16px circle, `md` is 20px. */
|
|
9
|
+
size?: RadioSize;
|
|
10
|
+
className?: string;
|
|
11
|
+
isFocusVisible?: boolean;
|
|
12
|
+
isSelected?: boolean;
|
|
13
|
+
isDisabled?: boolean;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* The circle on its own, for rows that handle selection themselves (menu rows, option cards
|
|
17
|
+
* built from buttons). Frozen to platform-ui's `base/radio-buttons`.
|
|
18
|
+
*/
|
|
19
|
+
export declare const RadioButtonBase: {
|
|
20
|
+
({ className, isFocusVisible, isSelected, isDisabled, size }: RadioButtonBaseProps): import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
displayName: string;
|
|
22
|
+
};
|
|
23
|
+
export interface RadioButtonProps extends AriaRadioProps {
|
|
24
|
+
/** Overrides the group's `size` for this radio. */
|
|
25
|
+
size?: RadioSize;
|
|
26
|
+
label?: ReactNode;
|
|
27
|
+
/** Secondary text under the label. */
|
|
28
|
+
hint?: ReactNode;
|
|
29
|
+
/**
|
|
30
|
+
* Replaces the built-in circle and label, for option cards that lay out their own content.
|
|
31
|
+
* Render `RadioButtonBase` inside it to keep the circle. The option stays a React Aria radio.
|
|
32
|
+
*/
|
|
33
|
+
children?: AriaRadioProps["children"];
|
|
34
|
+
ref?: Ref<HTMLLabelElement>;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* A radio option built on React Aria. Use it inside a `RadioGroup`.
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* <RadioGroup aria-label="Format" value={format} onChange={setFormat}>
|
|
41
|
+
* <RadioButton value="csv" label="CSV" hint="Opens in any spreadsheet" />
|
|
42
|
+
* <RadioButton value="xlsx" label="Excel" />
|
|
43
|
+
* </RadioGroup>
|
|
44
|
+
*/
|
|
45
|
+
export declare const RadioButton: {
|
|
46
|
+
({ label, hint, className, size, children, ...ariaRadioProps }: RadioButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
47
|
+
displayName: string;
|
|
48
|
+
};
|
|
49
|
+
export interface RadioGroupProps extends RadioGroupContextType, AriaRadioGroupProps {
|
|
50
|
+
/** Size of every radio in the group, unless a radio sets its own. */
|
|
51
|
+
size?: RadioSize;
|
|
52
|
+
children: ReactNode;
|
|
53
|
+
className?: string;
|
|
54
|
+
}
|
|
55
|
+
/** A React Aria radio group. Stacks its options in a column; pass `className="flex-row"` for a row. */
|
|
56
|
+
export declare const RadioGroup: {
|
|
57
|
+
({ children, className, size, ...props }: RadioGroupProps): import("react/jsx-runtime").JSX.Element;
|
|
58
|
+
displayName: string;
|
|
59
|
+
};
|
|
60
|
+
export {};
|
|
61
|
+
//# sourceMappingURL=radio.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"radio.d.ts","sourceRoot":"","sources":["../../../src/primitives/radio/radio.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,EAGL,KAAK,eAAe,IAAI,mBAAmB,EAC3C,KAAK,UAAU,IAAI,cAAc,EAElC,MAAM,uBAAuB,CAAC;AAG/B,MAAM,MAAM,SAAS,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAE3C,UAAU,qBAAqB;IAC7B,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB;AAID,MAAM,WAAW,oBAAoB;IACnC,qDAAqD;IACrD,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;;GAGG;AACH,eAAO,MAAM,eAAe;kEAAwE,oBAAoB;;CAoBvH,CAAC;AASF,MAAM,WAAW,gBAAiB,SAAQ,cAAc;IACtD,mDAAmD;IACnD,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,sCAAsC;IACtC,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB;;;OAGG;IACH,QAAQ,CAAC,EAAE,cAAc,CAAC,UAAU,CAAC,CAAC;IACtC,GAAG,CAAC,EAAE,GAAG,CAAC,gBAAgB,CAAC,CAAC;CAC7B;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,WAAW;oEAAmE,gBAAgB;;CAmD1G,CAAC;AAGF,MAAM,WAAW,eAAgB,SAAQ,qBAAqB,EAAE,mBAAmB;IACjF,qEAAqE;IACrE,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,QAAQ,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,uGAAuG;AACvG,eAAO,MAAM,UAAU;8CAAoD,eAAe;;CAMzF,CAAC"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { jsx as i, jsxs as u, Fragment as h } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as N, useContext as v, useId as R } from "react";
|
|
3
|
+
import { RadioGroup as z, Radio as B, Text as w } from "react-aria-components";
|
|
4
|
+
import { cx as a } from "../../utils/cn.js";
|
|
5
|
+
const x = N(null), f = ({ className: e, isFocusVisible: t, isSelected: o, isDisabled: r, size: n = "sm" }) => /* @__PURE__ */ i(
|
|
6
|
+
"div",
|
|
7
|
+
{
|
|
8
|
+
className: a(
|
|
9
|
+
"flex size-4 min-h-4 min-w-4 cursor-pointer appearance-none items-center justify-center rounded-full bg-primary ring-1 ring-primary ring-inset",
|
|
10
|
+
n === "md" && "size-5 min-h-5 min-w-5",
|
|
11
|
+
o && !r && "bg-brand-solid ring-bg-brand-solid",
|
|
12
|
+
r && "cursor-not-allowed border-disabled bg-disabled_subtle",
|
|
13
|
+
t && "outline-2 outline-offset-2 outline-focus-ring",
|
|
14
|
+
e
|
|
15
|
+
),
|
|
16
|
+
children: /* @__PURE__ */ i(
|
|
17
|
+
"div",
|
|
18
|
+
{
|
|
19
|
+
className: a(
|
|
20
|
+
"size-1.5 rounded-full bg-fg-white opacity-0 transition-inherit-all",
|
|
21
|
+
n === "md" && "size-2",
|
|
22
|
+
r && "bg-fg-disabled_subtle",
|
|
23
|
+
o && "opacity-100"
|
|
24
|
+
)
|
|
25
|
+
}
|
|
26
|
+
)
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
f.displayName = "RadioButtonBase";
|
|
30
|
+
const d = {
|
|
31
|
+
xs: { root: "gap-2", textWrapper: "", label: "text-xs font-medium", hint: "text-xs" },
|
|
32
|
+
sm: { root: "gap-2", textWrapper: "", label: "text-sm font-medium", hint: "text-sm" },
|
|
33
|
+
md: { root: "gap-3", textWrapper: "gap-0.5", label: "text-md font-medium", hint: "text-md" }
|
|
34
|
+
}, G = ({ label: e, hint: t, className: o, size: r, children: n, ...m }) => {
|
|
35
|
+
const c = v(x), s = r ?? (c == null ? void 0 : c.size) ?? "sm", p = R(), b = e && t && !m["aria-label"] && !m["aria-labelledby"] ? p : void 0;
|
|
36
|
+
return /* @__PURE__ */ i(
|
|
37
|
+
B,
|
|
38
|
+
{
|
|
39
|
+
"aria-labelledby": b,
|
|
40
|
+
...m,
|
|
41
|
+
className: (l) => a(
|
|
42
|
+
// `relative` keeps React Aria's hidden input inside the label, so focusing it never scrolls the page.
|
|
43
|
+
"relative flex items-start",
|
|
44
|
+
l.isDisabled && "cursor-not-allowed",
|
|
45
|
+
d[s].root,
|
|
46
|
+
typeof o == "function" ? o(l) : o
|
|
47
|
+
),
|
|
48
|
+
children: n ?? (({ isSelected: l, isDisabled: g, isFocusVisible: y }) => /* @__PURE__ */ u(h, { children: [
|
|
49
|
+
/* @__PURE__ */ i(
|
|
50
|
+
f,
|
|
51
|
+
{
|
|
52
|
+
size: s,
|
|
53
|
+
isSelected: l,
|
|
54
|
+
isDisabled: g,
|
|
55
|
+
isFocusVisible: y,
|
|
56
|
+
className: e || t ? "mt-0.5" : ""
|
|
57
|
+
}
|
|
58
|
+
),
|
|
59
|
+
(e || t) && /* @__PURE__ */ u("div", { className: a("inline-flex flex-col", d[s].textWrapper), children: [
|
|
60
|
+
e && /* @__PURE__ */ i("p", { id: p, className: a("text-secondary select-none", d[s].label), children: e }),
|
|
61
|
+
t && // The description slot sets the input's aria-describedby, so the hint reads as a description.
|
|
62
|
+
/* @__PURE__ */ i(w, { slot: "description", className: a("text-tertiary", d[s].hint), children: t })
|
|
63
|
+
] })
|
|
64
|
+
] }))
|
|
65
|
+
}
|
|
66
|
+
);
|
|
67
|
+
};
|
|
68
|
+
G.displayName = "RadioButton";
|
|
69
|
+
const W = ({ children: e, className: t, size: o = "sm", ...r }) => /* @__PURE__ */ i(x.Provider, { value: { size: o }, children: /* @__PURE__ */ i(z, { ...r, className: a("flex flex-col gap-4", t), children: e }) });
|
|
70
|
+
W.displayName = "RadioGroup";
|
|
71
|
+
export {
|
|
72
|
+
G as RadioButton,
|
|
73
|
+
f as RadioButtonBase,
|
|
74
|
+
W as RadioGroup
|
|
75
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/primitives/textarea/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,KAAK,aAAa,EAAE,KAAK,iBAAiB,EAAE,MAAM,YAAY,CAAC"}
|