jenosize-ui 0.1.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/LICENSE +28 -0
- package/README.md +100 -0
- package/THIRD-PARTY-NOTICES.md +163 -0
- package/dist/Button-Bt7pzM4R.d.ts +82 -0
- package/dist/PaymentInput-CKPIPNWH.d.ts +141 -0
- package/dist/Select-CVbEQ2Ep.d.ts +118 -0
- package/dist/TagInput-CTJYOB4J.d.ts +90 -0
- package/dist/avatar.d.ts +161 -0
- package/dist/avatar.js +11 -0
- package/dist/badge.d.ts +109 -0
- package/dist/badge.js +10 -0
- package/dist/breadcrumb.d.ts +58 -0
- package/dist/breadcrumb.js +7 -0
- package/dist/button.d.ts +54 -0
- package/dist/button.js +14 -0
- package/dist/calendar.d.ts +368 -0
- package/dist/calendar.js +21 -0
- package/dist/callout.d.ts +70 -0
- package/dist/callout.js +16 -0
- package/dist/card-nWicloNi.d.ts +80 -0
- package/dist/card.d.ts +2 -0
- package/dist/card.js +7 -0
- package/dist/checkbox.d.ts +133 -0
- package/dist/checkbox.js +11 -0
- package/dist/chunk-24TO7E32.js +42 -0
- package/dist/chunk-3Y5X7B5C.js +146 -0
- package/dist/chunk-4OLULPQG.js +202 -0
- package/dist/chunk-4P2NBLBW.js +103 -0
- package/dist/chunk-52IFGFTL.js +11 -0
- package/dist/chunk-5FATN5YD.js +115 -0
- package/dist/chunk-5NOBSXJN.js +297 -0
- package/dist/chunk-5RAPA22E.js +106 -0
- package/dist/chunk-7EUAMHMU.js +16 -0
- package/dist/chunk-7EWQKTNQ.js +1336 -0
- package/dist/chunk-7HOIZ3UO.js +110 -0
- package/dist/chunk-7IU5TMFL.js +452 -0
- package/dist/chunk-7JBNLEJ7.js +29 -0
- package/dist/chunk-7S2TBALK.js +23 -0
- package/dist/chunk-BJUZVYQC.js +188 -0
- package/dist/chunk-BVJWBYIG.js +66 -0
- package/dist/chunk-CME4DIML.js +65 -0
- package/dist/chunk-CYPPEUX5.js +73 -0
- package/dist/chunk-D5BTFSL7.js +71 -0
- package/dist/chunk-D6TPWNRK.js +387 -0
- package/dist/chunk-DJSXIAFH.js +66 -0
- package/dist/chunk-DRZCJCBO.js +46 -0
- package/dist/chunk-DWKILXHE.js +17 -0
- package/dist/chunk-E7ZSWBAK.js +70 -0
- package/dist/chunk-EDSK6FEH.js +8 -0
- package/dist/chunk-F2K7VJUV.js +114 -0
- package/dist/chunk-F6NLE6XJ.js +40 -0
- package/dist/chunk-FHHAPGCR.js +32 -0
- package/dist/chunk-FXIBGTS5.js +14 -0
- package/dist/chunk-GCVA3OIV.js +72 -0
- package/dist/chunk-GFOAJVW5.js +336 -0
- package/dist/chunk-GRLSUQQE.js +136 -0
- package/dist/chunk-GTHJWR3Q.js +77 -0
- package/dist/chunk-HMUZE6EK.js +67 -0
- package/dist/chunk-I7WU4GTY.js +503 -0
- package/dist/chunk-J2BCKBHC.js +151 -0
- package/dist/chunk-J36M3KRX.js +1315 -0
- package/dist/chunk-J7ZQQFPT.js +113 -0
- package/dist/chunk-JP26LPCY.js +234 -0
- package/dist/chunk-JTNFJLIY.js +1046 -0
- package/dist/chunk-JVJRHBTD.js +50 -0
- package/dist/chunk-JYGR44ZC.js +133 -0
- package/dist/chunk-KDLPXXD2.js +173 -0
- package/dist/chunk-KMSYEE23.js +224 -0
- package/dist/chunk-KNYKWUYX.js +52 -0
- package/dist/chunk-LME57Z6J.js +138 -0
- package/dist/chunk-MFJP5FA7.js +20 -0
- package/dist/chunk-MKC5HNA7.js +1692 -0
- package/dist/chunk-MQGD2OUF.js +39 -0
- package/dist/chunk-MUFHLP4S.js +566 -0
- package/dist/chunk-O2LG3PNI.js +74 -0
- package/dist/chunk-O4GRKO3I.js +66 -0
- package/dist/chunk-OHUFNYGN.js +791 -0
- package/dist/chunk-PWKWNDBS.js +243 -0
- package/dist/chunk-QA74ITR4.js +103 -0
- package/dist/chunk-R6RGJF4L.js +170 -0
- package/dist/chunk-S7NNXWIN.js +7 -0
- package/dist/chunk-SV56BSUQ.js +162 -0
- package/dist/chunk-T7FCG7XV.js +435 -0
- package/dist/chunk-THC2ISYP.js +57 -0
- package/dist/chunk-VWC72TR3.js +115 -0
- package/dist/chunk-W46K56XU.js +216 -0
- package/dist/chunk-W5GGOUUI.js +75 -0
- package/dist/chunk-WEUJYDCV.js +269 -0
- package/dist/chunk-WFY7DKQD.js +279 -0
- package/dist/chunk-WZQFC7ZN.js +448 -0
- package/dist/chunk-Z3ETJN5G.js +136 -0
- package/dist/chunk-ZOOX3TUB.js +192 -0
- package/dist/chunk-ZSNJ6UA3.js +42 -0
- package/dist/chunk-ZZA2LUTL.js +130 -0
- package/dist/chunk-ZZT2E5VT.js +24 -0
- package/dist/color-CtSxc1Rh.d.ts +6 -0
- package/dist/combobox.d.ts +184 -0
- package/dist/combobox.js +21 -0
- package/dist/date-input.d.ts +83 -0
- package/dist/date-input.js +16 -0
- package/dist/date-picker.d.ts +249 -0
- package/dist/date-picker.js +29 -0
- package/dist/date-utils-7hTFTXNK.d.ts +34 -0
- package/dist/date-vMJBKAFK.d.ts +22 -0
- package/dist/dialog.d.ts +86 -0
- package/dist/dialog.js +15 -0
- package/dist/drawer.d.ts +77 -0
- package/dist/drawer.js +14 -0
- package/dist/dropdown-menu.d.ts +218 -0
- package/dist/dropdown-menu.js +10 -0
- package/dist/file-trigger.d.ts +42 -0
- package/dist/file-trigger.js +3 -0
- package/dist/form.d.ts +487 -0
- package/dist/form.js +1179 -0
- package/dist/header-navigation.d.ts +74 -0
- package/dist/header-navigation.js +23 -0
- package/dist/icons/app.d.ts +48 -0
- package/dist/icons/app.js +282 -0
- package/dist/icons/flag.d.ts +817 -0
- package/dist/icons/flag.js +58336 -0
- package/dist/icons/integration.d.ts +36 -0
- package/dist/icons/integration.js +531 -0
- package/dist/icons/payment.d.ts +116 -0
- package/dist/icons/payment.js +2418 -0
- package/dist/icons.d.ts +2013 -0
- package/dist/icons.js +2012 -0
- package/dist/illustration.d.ts +48 -0
- package/dist/illustration.js +4 -0
- package/dist/index.d.ts +68 -0
- package/dist/index.js +73 -0
- package/dist/indicator.d.ts +51 -0
- package/dist/indicator.js +7 -0
- package/dist/input.d.ts +66 -0
- package/dist/input.js +15 -0
- package/dist/multi-value-CJb_tnvi.d.ts +8 -0
- package/dist/nav-Bla0o_-1.d.ts +98 -0
- package/dist/number-input.d.ts +80 -0
- package/dist/number-input.js +15 -0
- package/dist/options-CPEIgjtd.d.ts +68 -0
- package/dist/overflow-Df0h42Oi.d.ts +29 -0
- package/dist/pagination.d.ts +77 -0
- package/dist/pagination.js +17 -0
- package/dist/payment-input.d.ts +7 -0
- package/dist/payment-input.js +15 -0
- package/dist/popover.d.ts +60 -0
- package/dist/popover.js +14 -0
- package/dist/progress.d.ts +87 -0
- package/dist/progress.js +5 -0
- package/dist/radio.d.ts +77 -0
- package/dist/radio.js +12 -0
- package/dist/select.d.ts +68 -0
- package/dist/select.js +24 -0
- package/dist/shared-BNXAdgh2.d.ts +9 -0
- package/dist/shared-BYXJPnsN.d.ts +11 -0
- package/dist/shared-Dc-GgA16.d.ts +42 -0
- package/dist/sidebar-navigation.d.ts +129 -0
- package/dist/sidebar-navigation.js +15 -0
- package/dist/styles.css +2 -0
- package/dist/switch.d.ts +23 -0
- package/dist/switch.js +7 -0
- package/dist/table.d.ts +692 -0
- package/dist/table.js +44 -0
- package/dist/tabs.d.ts +111 -0
- package/dist/tabs.js +8 -0
- package/dist/tag-input.d.ts +12 -0
- package/dist/tag-input.js +19 -0
- package/dist/tag.d.ts +98 -0
- package/dist/tag.js +9 -0
- package/dist/textarea.d.ts +40 -0
- package/dist/textarea.js +12 -0
- package/dist/theme-script.d.ts +29 -0
- package/dist/theme-script.js +15 -0
- package/dist/theme.css +929 -0
- package/dist/theme.d.ts +71 -0
- package/dist/theme.js +15 -0
- package/dist/toast.d.ts +242 -0
- package/dist/toast.js +15 -0
- package/dist/tooltip.d.ts +70 -0
- package/dist/tooltip.js +6 -0
- package/dist/tree.d.ts +308 -0
- package/dist/tree.js +11 -0
- package/package.json +352 -0
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
import { ACCENT, DISMISS, SOLID, OUTLINE, SUBTLE } from './chunk-CME4DIML.js';
|
|
2
|
+
import { overflowClasses, overflowBounded } from './chunk-DWKILXHE.js';
|
|
3
|
+
import { SEAMLESS_COLOR, SEAMLESS_CHIP_PX, SEAMLESS_CHIP_NUM, SEAMLESS_CHIP } from './chunk-KNYKWUYX.js';
|
|
4
|
+
import { Slot } from './chunk-52IFGFTL.js';
|
|
5
|
+
import { ArrowRightIcon, XIcon } from './chunk-24TO7E32.js';
|
|
6
|
+
import { devWarn } from './chunk-GCVA3OIV.js';
|
|
7
|
+
import { cn } from './chunk-ZSNJ6UA3.js';
|
|
8
|
+
import 'react';
|
|
9
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
10
|
+
|
|
11
|
+
// src/components/badge/shared.ts
|
|
12
|
+
var ELEVATION = "shadow-xs";
|
|
13
|
+
var ROOT_BASE = cn("rounded-full ring-1 ring-inset", ELEVATION);
|
|
14
|
+
var ADDON_BASE = cn("rounded-full ring-1 ring-inset", ELEVATION);
|
|
15
|
+
var LIGHT_ROOT = {
|
|
16
|
+
neutral: "bg-utility-neutral-50 text-utility-neutral-700 ring-utility-neutral-200 hover:bg-utility-neutral-100",
|
|
17
|
+
brand: "bg-utility-brand-50 text-utility-brand-700 ring-utility-brand-200 hover:bg-utility-brand-100",
|
|
18
|
+
success: "bg-utility-green-50 text-utility-green-700 ring-utility-green-200 hover:bg-utility-green-100",
|
|
19
|
+
warning: "bg-utility-amber-50 text-utility-amber-700 ring-utility-amber-200 hover:bg-utility-amber-100",
|
|
20
|
+
error: "bg-utility-red-50 text-utility-red-700 ring-utility-red-200 hover:bg-utility-red-100",
|
|
21
|
+
info: "bg-utility-blue-50 text-utility-blue-700 ring-utility-blue-200 hover:bg-utility-blue-100"
|
|
22
|
+
};
|
|
23
|
+
var LIGHT_ADDON = {
|
|
24
|
+
neutral: "bg-primary text-current ring-utility-neutral-200",
|
|
25
|
+
brand: "bg-primary text-current ring-utility-brand-200",
|
|
26
|
+
success: "bg-primary text-current ring-utility-green-200",
|
|
27
|
+
warning: "bg-primary text-current ring-utility-amber-200",
|
|
28
|
+
error: "bg-primary text-current ring-utility-red-200",
|
|
29
|
+
info: "bg-primary text-current ring-utility-blue-200"
|
|
30
|
+
};
|
|
31
|
+
var GEO = {
|
|
32
|
+
leading: {
|
|
33
|
+
md: {
|
|
34
|
+
root: "py-1 pr-2 pl-1 text-xs font-medium",
|
|
35
|
+
addon: "px-2 py-0.5",
|
|
36
|
+
icon: "ml-1 [&_svg]:size-4"
|
|
37
|
+
},
|
|
38
|
+
lg: {
|
|
39
|
+
root: "py-1 pr-2 pl-1 text-sm font-medium",
|
|
40
|
+
addon: "px-2.5 py-0.5",
|
|
41
|
+
icon: "ml-1 [&_svg]:size-4"
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
trailing: {
|
|
45
|
+
md: {
|
|
46
|
+
root: "py-1 pr-1 pl-3 text-xs font-medium",
|
|
47
|
+
addon: "py-0.5 pr-1.5 pl-2",
|
|
48
|
+
icon: "ml-0.5 [&_svg]:size-3 [&_svg]:[stroke-width:3px]"
|
|
49
|
+
},
|
|
50
|
+
lg: {
|
|
51
|
+
root: "py-1 pr-1 pl-3 text-sm font-medium",
|
|
52
|
+
addon: "py-0.5 pr-2 pl-2.5",
|
|
53
|
+
icon: "ml-1 [&_svg]:size-3 [&_svg]:[stroke-width:3px]"
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
function BadgeGroup(props) {
|
|
58
|
+
const { addonText, color = "brand", size = "md", align = "leading", leading, trailing, className, children, ...rest } = props;
|
|
59
|
+
const geo = GEO[align][size];
|
|
60
|
+
const hasText = children !== void 0 && children !== null && children !== false && children !== "";
|
|
61
|
+
const iconCls = cn(geo.icon, ACCENT[color]);
|
|
62
|
+
const iconNode = trailing === void 0 ? (
|
|
63
|
+
// The group's OWN glyph — decorative by construction, so it is `aria-hidden` here and does
|
|
64
|
+
// NOT go through `Slot` (which never adds semantics to a caller's node).
|
|
65
|
+
/* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: cn("inline-flex shrink-0", iconCls), children: /* @__PURE__ */ jsx(ArrowRightIcon, {}) })
|
|
66
|
+
) : trailing ? /* @__PURE__ */ jsx(Slot, { className: iconCls, children: trailing }) : null;
|
|
67
|
+
const leadingIconNode = leading ? /* @__PURE__ */ jsx(Slot, { className: cn("mr-1 [&_svg]:size-3 [&_svg]:[stroke-width:3px]", ACCENT[color]), children: leading }) : null;
|
|
68
|
+
const rootClasses2 = cn(
|
|
69
|
+
"inline-flex w-max cursor-pointer items-center whitespace-nowrap transition duration-100 ease-linear",
|
|
70
|
+
ROOT_BASE,
|
|
71
|
+
geo.root,
|
|
72
|
+
// UUI: an addon-only leading pill (no message, no arrow) tightens the right edge.
|
|
73
|
+
align === "leading" && !hasText && !iconNode && "pr-1",
|
|
74
|
+
LIGHT_ROOT[color],
|
|
75
|
+
className
|
|
76
|
+
);
|
|
77
|
+
const addonClasses = cn(
|
|
78
|
+
"inline-flex items-center",
|
|
79
|
+
ADDON_BASE,
|
|
80
|
+
geo.addon,
|
|
81
|
+
// UUI: the addon↔message spacing is a margin on the addon, not a root gap.
|
|
82
|
+
hasText && (align === "leading" ? "mr-2" : "ml-2"),
|
|
83
|
+
LIGHT_ADDON[color]
|
|
84
|
+
);
|
|
85
|
+
if (align === "trailing") {
|
|
86
|
+
return /* @__PURE__ */ jsxs("div", { className: rootClasses2, ...rest, children: [
|
|
87
|
+
children,
|
|
88
|
+
/* @__PURE__ */ jsxs("span", { className: addonClasses, children: [
|
|
89
|
+
leadingIconNode,
|
|
90
|
+
addonText,
|
|
91
|
+
iconNode
|
|
92
|
+
] })
|
|
93
|
+
] });
|
|
94
|
+
}
|
|
95
|
+
return /* @__PURE__ */ jsxs("div", { className: rootClasses2, ...rest, children: [
|
|
96
|
+
/* @__PURE__ */ jsxs("span", { className: addonClasses, children: [
|
|
97
|
+
leadingIconNode,
|
|
98
|
+
addonText
|
|
99
|
+
] }),
|
|
100
|
+
children,
|
|
101
|
+
iconNode
|
|
102
|
+
] });
|
|
103
|
+
}
|
|
104
|
+
var BASE = "inline-flex items-center justify-center align-middle select-none font-medium";
|
|
105
|
+
function shapeClasses(shape, size) {
|
|
106
|
+
if (shape === "pill") return "rounded-full";
|
|
107
|
+
return size === "lg" ? "rounded-lg" : "rounded-md";
|
|
108
|
+
}
|
|
109
|
+
function rootClasses(color, variant) {
|
|
110
|
+
if (variant === "solid") return SOLID[color];
|
|
111
|
+
if (variant === "outline") return OUTLINE[color];
|
|
112
|
+
return SUBTLE[color];
|
|
113
|
+
}
|
|
114
|
+
var PY = { sm: "py-0.5", md: "py-0.5", lg: "py-1" };
|
|
115
|
+
var MIN_W = { sm: "min-w-5.5", md: "min-w-6", lg: "min-w-7" };
|
|
116
|
+
var GEO_BASE = {
|
|
117
|
+
pill: { sm: { pl: "pl-2", pr: "pr-2" }, md: { pl: "pl-2.5", pr: "pr-2.5" }, lg: { pl: "pl-3", pr: "pr-3" } },
|
|
118
|
+
badge: { sm: { pl: "pl-1.5", pr: "pr-1.5" }, md: { pl: "pl-2", pr: "pr-2" }, lg: { pl: "pl-2.5", pr: "pr-2.5" } }
|
|
119
|
+
};
|
|
120
|
+
var GEO_LEADING = {
|
|
121
|
+
pill: {
|
|
122
|
+
sm: { pl: "pl-1.5", pr: "pr-2", gap: "gap-0.5" },
|
|
123
|
+
md: { pl: "pl-2", pr: "pr-2.5", gap: "gap-1" },
|
|
124
|
+
lg: { pl: "pl-2.5", pr: "pr-3", gap: "gap-1" }
|
|
125
|
+
},
|
|
126
|
+
badge: {
|
|
127
|
+
sm: { pl: "pl-1.5", pr: "pr-2", gap: "gap-0.5" },
|
|
128
|
+
md: { pl: "pl-1.5", pr: "pr-2", gap: "gap-1" },
|
|
129
|
+
lg: { pl: "pl-2", pr: "pr-2.5", gap: "gap-1" }
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
var GEO_TRAILING = {
|
|
133
|
+
pill: {
|
|
134
|
+
sm: { pl: "pl-2", pr: "pr-1.5", gap: "gap-0.5" },
|
|
135
|
+
md: { pl: "pl-2.5", pr: "pr-2", gap: "gap-1" },
|
|
136
|
+
lg: { pl: "pl-3", pr: "pr-2.5", gap: "gap-1" }
|
|
137
|
+
},
|
|
138
|
+
badge: {
|
|
139
|
+
sm: { pl: "pl-2", pr: "pr-1.5", gap: "gap-0.5" },
|
|
140
|
+
md: { pl: "pl-2", pr: "pr-1.5", gap: "gap-1" },
|
|
141
|
+
lg: { pl: "pl-2.5", pr: "pr-2", gap: "gap-1" }
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
var GEO_DISMISS_PR = {
|
|
145
|
+
pill: { sm: "pr-0.75", md: "pr-1", lg: "pr-1.5" },
|
|
146
|
+
badge: { sm: "pr-0.75", md: "pr-1", lg: "pr-1.5" }
|
|
147
|
+
};
|
|
148
|
+
var SLOT_ONLY_PAD = { sm: "p-1.25", md: "p-1.5", lg: "p-2" };
|
|
149
|
+
var SLOT_ONLY_PX = { sm: "px-1.25", md: "px-1.5", lg: "px-2" };
|
|
150
|
+
function slotOnlyGeometry(size, seamless) {
|
|
151
|
+
return seamless ? SLOT_ONLY_PX[size] : SLOT_ONLY_PAD[size];
|
|
152
|
+
}
|
|
153
|
+
function badgeGeometry(shape, size, leading, dismiss, trailing, seamless) {
|
|
154
|
+
const base = seamless && shape === "badge" ? { pl: SEAMLESS_CHIP_PX[size], pr: SEAMLESS_CHIP_PX[size] } : GEO_BASE[shape][size];
|
|
155
|
+
const lead = leading ? GEO_LEADING[shape][size] : null;
|
|
156
|
+
const trail = trailing ? GEO_TRAILING[shape][size] : null;
|
|
157
|
+
const pl = (lead ?? trail ?? base).pl;
|
|
158
|
+
const pr = dismiss ? GEO_DISMISS_PR[shape][size] : (trail ?? lead ?? base).pr;
|
|
159
|
+
const gap = lead ? lead.gap : trail ? trail.gap : dismiss ? "gap-0.5" : "";
|
|
160
|
+
const vertical = seamless ? SEAMLESS_CHIP_NUM : PY[size];
|
|
161
|
+
return cn(vertical, pl, pr, gap);
|
|
162
|
+
}
|
|
163
|
+
function badgeFloor(size, seamless, slotOnly, bounded) {
|
|
164
|
+
if (bounded) return false;
|
|
165
|
+
if (seamless) return SEAMLESS_CHIP[size];
|
|
166
|
+
return slotOnly ? false : MIN_W[size];
|
|
167
|
+
}
|
|
168
|
+
var TEXT_SIZE = { sm: "text-xs", md: "text-sm", lg: "text-sm" };
|
|
169
|
+
var GLYPH = "[&_svg]:size-3 [&_svg]:[stroke-width:3px]";
|
|
170
|
+
function Badge(props) {
|
|
171
|
+
const {
|
|
172
|
+
color = "neutral",
|
|
173
|
+
variant = "subtle",
|
|
174
|
+
shape = "badge",
|
|
175
|
+
size = "md",
|
|
176
|
+
leading,
|
|
177
|
+
trailing,
|
|
178
|
+
overflow = "visible",
|
|
179
|
+
seamless = false,
|
|
180
|
+
onDismiss,
|
|
181
|
+
dismissLabel = "Dismiss",
|
|
182
|
+
className,
|
|
183
|
+
children,
|
|
184
|
+
...rest
|
|
185
|
+
} = props;
|
|
186
|
+
if (seamless && (props.color !== void 0 || props.variant !== void 0)) {
|
|
187
|
+
devWarn("<Badge seamless> takes its color from the host \u2014 `color`/`variant` are ignored.");
|
|
188
|
+
}
|
|
189
|
+
const hasLeading = leading != null && leading !== false;
|
|
190
|
+
const hasLabel = children !== void 0 && children !== null && children !== false && children !== "";
|
|
191
|
+
const slotOnly = hasLeading && !hasLabel && !trailing && !onDismiss;
|
|
192
|
+
const isNamed = rest["aria-label"] !== void 0 || rest["aria-labelledby"] !== void 0;
|
|
193
|
+
const role = rest.role ?? (!hasLabel && isNamed ? "img" : void 0);
|
|
194
|
+
const isSoft = !seamless && variant !== "solid";
|
|
195
|
+
const accent = isSoft ? ACCENT[color] : void 0;
|
|
196
|
+
const ovf = overflowClasses(overflow);
|
|
197
|
+
const bounded = overflowBounded(overflow);
|
|
198
|
+
const leadingSlot = hasLeading ? /* @__PURE__ */ jsx(Slot, { className: cn(accent, GLYPH), children: leading }) : null;
|
|
199
|
+
return /* @__PURE__ */ jsxs(
|
|
200
|
+
"span",
|
|
201
|
+
{
|
|
202
|
+
className: cn(
|
|
203
|
+
BASE,
|
|
204
|
+
ovf.root,
|
|
205
|
+
shapeClasses(shape, size),
|
|
206
|
+
seamless ? SEAMLESS_COLOR : cn(rootClasses(color, variant), ELEVATION),
|
|
207
|
+
slotOnly ? slotOnlyGeometry(size, seamless) : badgeGeometry(shape, size, hasLeading, !!onDismiss, !!trailing, seamless),
|
|
208
|
+
badgeFloor(size, seamless, slotOnly, bounded),
|
|
209
|
+
TEXT_SIZE[size],
|
|
210
|
+
className
|
|
211
|
+
),
|
|
212
|
+
...rest,
|
|
213
|
+
role,
|
|
214
|
+
children: [
|
|
215
|
+
leadingSlot,
|
|
216
|
+
hasLabel && bounded ? /* @__PURE__ */ jsx("span", { className: ovf.label, children }) : children,
|
|
217
|
+
trailing ? /* @__PURE__ */ jsx(Slot, { className: cn(accent, GLYPH), children: trailing }) : null,
|
|
218
|
+
onDismiss ? /* @__PURE__ */ jsx(
|
|
219
|
+
"button",
|
|
220
|
+
{
|
|
221
|
+
type: "button",
|
|
222
|
+
"aria-label": dismissLabel,
|
|
223
|
+
onClick: onDismiss,
|
|
224
|
+
className: cn(
|
|
225
|
+
"inline-flex shrink-0 cursor-pointer items-center justify-center p-0.5",
|
|
226
|
+
shape === "pill" ? "rounded-full" : "rounded-[3px]",
|
|
227
|
+
// UUI BadgeWithButton: 100ms linear motion + a plain CSS focus outline
|
|
228
|
+
// (2px, no offset) — no pressed/active restyle.
|
|
229
|
+
"outline-focus-ring transition duration-100 ease-linear focus-visible:outline-2",
|
|
230
|
+
isSoft ? DISMISS[color] : "text-current hover:bg-current/10",
|
|
231
|
+
GLYPH
|
|
232
|
+
),
|
|
233
|
+
children: /* @__PURE__ */ jsx(XIcon, { strokeWidth: 3 })
|
|
234
|
+
}
|
|
235
|
+
) : null
|
|
236
|
+
]
|
|
237
|
+
}
|
|
238
|
+
);
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
export { Badge, BadgeGroup };
|
|
242
|
+
//# sourceMappingURL=chunk-PWKWNDBS.js.map
|
|
243
|
+
//# sourceMappingURL=chunk-PWKWNDBS.js.map
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { SeamlessProvider, addonSlotClasses } from './chunk-KNYKWUYX.js';
|
|
2
|
+
import { Slot } from './chunk-52IFGFTL.js';
|
|
3
|
+
import { SHELL_SIZE, BAR_SIZE, SLOT_ICON } from './chunk-J2BCKBHC.js';
|
|
4
|
+
import { cn } from './chunk-ZSNJ6UA3.js';
|
|
5
|
+
import { mergeProps } from '@base-ui/react/merge-props';
|
|
6
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
7
|
+
import 'react';
|
|
8
|
+
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
9
|
+
|
|
10
|
+
var ADDON_EDGE_PL = { sm: "pl-3", md: "pl-3", lg: "pl-3.5" };
|
|
11
|
+
var ADDON_EDGE_PR = { sm: "pr-3", md: "pr-3", lg: "pr-3.5" };
|
|
12
|
+
function Affix({ size, tone = "node", children }) {
|
|
13
|
+
return /* @__PURE__ */ jsx(
|
|
14
|
+
Slot,
|
|
15
|
+
{
|
|
16
|
+
tone,
|
|
17
|
+
className: cn(
|
|
18
|
+
"items-center",
|
|
19
|
+
// The slot owns its icon cap — the shell carries no `[&_svg]` rule (see SLOT_ICON). Direct-child
|
|
20
|
+
// form, so an <Avatar>/<Badge> the caller composed keeps the size the caller gave it.
|
|
21
|
+
tone === "node" && SLOT_ICON[size],
|
|
22
|
+
tone === "text" ? "text-tertiary" : "text-fg-quaternary"
|
|
23
|
+
),
|
|
24
|
+
children
|
|
25
|
+
}
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
function FieldShell(props) {
|
|
29
|
+
const {
|
|
30
|
+
size = "md",
|
|
31
|
+
fluid = false,
|
|
32
|
+
invalid = false,
|
|
33
|
+
disabled = false,
|
|
34
|
+
leading,
|
|
35
|
+
trailing,
|
|
36
|
+
leadingAddon,
|
|
37
|
+
trailingAddon,
|
|
38
|
+
glyphLeading,
|
|
39
|
+
glyphTrailing,
|
|
40
|
+
segmentLeading,
|
|
41
|
+
segmentTrailing,
|
|
42
|
+
segmentDivider = true,
|
|
43
|
+
children,
|
|
44
|
+
className,
|
|
45
|
+
render,
|
|
46
|
+
boxRef,
|
|
47
|
+
...rest
|
|
48
|
+
} = props;
|
|
49
|
+
const hasLeadingAddon = leadingAddon != null || segmentLeading != null;
|
|
50
|
+
const hasTrailingAddon = trailingAddon != null || segmentTrailing != null;
|
|
51
|
+
const hasAddon = hasLeadingAddon || hasTrailingAddon;
|
|
52
|
+
const className_ = cn(
|
|
53
|
+
"flex w-full items-center bg-primary text-primary shadow-xs transition-all duration-100 ease-linear",
|
|
54
|
+
// See the file header: an OUTLINE (not a ring) is what lets a full-height add-on divider sit
|
|
55
|
+
// under the edge instead of eating it. Focus widens it to 2px brand — one clean line.
|
|
56
|
+
"outline-1 -outline-offset-1 focus-within:outline-2 focus-within:-outline-offset-2",
|
|
57
|
+
// Clip full-height add-on fills/dividers to the rounded corners (outlines are NOT clipped, so
|
|
58
|
+
// the edge survives). This is also what squares off a nested add-on's inner corner for free.
|
|
59
|
+
hasAddon && "overflow-hidden",
|
|
60
|
+
fluid ? SHELL_SIZE[size] : BAR_SIZE[size],
|
|
61
|
+
invalid ? "outline-error_subtle focus-within:outline-focus-ring-error" : "outline-primary focus-within:outline-focus-ring",
|
|
62
|
+
disabled && "cursor-not-allowed opacity-50",
|
|
63
|
+
// Data-attribute forms for hosts whose shell element is a Base UI part that sets them itself
|
|
64
|
+
// (Combobox's `InputGroup`, NumberInput's `Group`). Harmless on a plain <div> — the selector
|
|
65
|
+
// simply never matches — and they are VARIANT classes, so tailwind-merge keeps them alongside
|
|
66
|
+
// the boolean-driven base colors above rather than collapsing one into the other.
|
|
67
|
+
"data-[invalid]:outline-error_subtle data-[invalid]:focus-within:outline-focus-ring-error",
|
|
68
|
+
"data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50",
|
|
69
|
+
className,
|
|
70
|
+
// AFTER `className` on purpose — an edge that carries an add-on belongs to the SHELL, not the
|
|
71
|
+
// caller. `addonSlotClasses`'s negative bleed is calibrated against the standard `BAR_PX`, so a
|
|
72
|
+
// host that re-tightens that side for its OWN inner geometry (PaymentInput's brand-plate inset,
|
|
73
|
+
// TagInput's with-pills inset, the listbox family's tighter sm chevron edge) would leave the
|
|
74
|
+
// segment hanging past the border box — `overflow-hidden` then clips it into a visibly short
|
|
75
|
+
// inner padding, which is the "padding seems off" tell. Those insets exist to position content
|
|
76
|
+
// against the field's own edge; once a bordered segment OWNS that edge they no longer apply.
|
|
77
|
+
hasLeadingAddon && ADDON_EDGE_PL[size],
|
|
78
|
+
hasTrailingAddon && ADDON_EDGE_PR[size]
|
|
79
|
+
);
|
|
80
|
+
const addon = (side, node, divider = true) => /* @__PURE__ */ jsx("span", { className: cn(addonSlotClasses(side, size), !divider && "border-0"), children: /* @__PURE__ */ jsx(SeamlessProvider, { value: { side, size }, children: node }) });
|
|
81
|
+
const affix = (node) => /* @__PURE__ */ jsx(Affix, { size, tone: typeof node === "string" ? "text" : "node", children: node });
|
|
82
|
+
const content = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
83
|
+
segmentLeading != null ? addon("leading", segmentLeading, segmentDivider) : null,
|
|
84
|
+
leadingAddon != null ? addon("leading", leadingAddon) : null,
|
|
85
|
+
leading != null ? affix(leading) : null,
|
|
86
|
+
glyphLeading,
|
|
87
|
+
children,
|
|
88
|
+
glyphTrailing,
|
|
89
|
+
trailing != null ? affix(trailing) : null,
|
|
90
|
+
trailingAddon != null ? addon("trailing", trailingAddon) : null,
|
|
91
|
+
segmentTrailing != null ? addon("trailing", segmentTrailing, segmentDivider) : null
|
|
92
|
+
] });
|
|
93
|
+
return useRender({
|
|
94
|
+
defaultTagName: "div",
|
|
95
|
+
render,
|
|
96
|
+
ref: boxRef,
|
|
97
|
+
props: mergeProps({ className: className_, children: content }, rest)
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export { FieldShell };
|
|
102
|
+
//# sourceMappingURL=chunk-QA74ITR4.js.map
|
|
103
|
+
//# sourceMappingURL=chunk-QA74ITR4.js.map
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { tagSlotClass, tagLabelClass, tagContentClass, tagCloseClass, tagRootClass, TAG_SELECTED, tagCheckboxGlyphClass, tagCheckboxBoxClass } from './chunk-4P2NBLBW.js';
|
|
2
|
+
import { overflowBounded } from './chunk-DWKILXHE.js';
|
|
3
|
+
import { Slot } from './chunk-52IFGFTL.js';
|
|
4
|
+
import { XIcon, CheckIcon } from './chunk-24TO7E32.js';
|
|
5
|
+
import { warnNeedsName } from './chunk-GCVA3OIV.js';
|
|
6
|
+
import { cn } from './chunk-ZSNJ6UA3.js';
|
|
7
|
+
import { Toggle } from '@base-ui/react/toggle';
|
|
8
|
+
import { ToggleGroup } from '@base-ui/react/toggle-group';
|
|
9
|
+
import * as React from 'react';
|
|
10
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
11
|
+
|
|
12
|
+
function TagCheckbox({ size }) {
|
|
13
|
+
return /* @__PURE__ */ jsx("span", { "aria-hidden": "true", "data-tag-checkbox": true, className: tagCheckboxBoxClass(size), children: /* @__PURE__ */ jsx(CheckIcon, { className: tagCheckboxGlyphClass(size) }) });
|
|
14
|
+
}
|
|
15
|
+
function Tag(props) {
|
|
16
|
+
const {
|
|
17
|
+
children,
|
|
18
|
+
size = "md",
|
|
19
|
+
leading,
|
|
20
|
+
trailing,
|
|
21
|
+
onRemove,
|
|
22
|
+
removeLabel,
|
|
23
|
+
removeExcludeFromTabOrder = false,
|
|
24
|
+
disabled = false,
|
|
25
|
+
overflow = "visible",
|
|
26
|
+
className,
|
|
27
|
+
...rest
|
|
28
|
+
} = props;
|
|
29
|
+
const label = removeLabel ?? (typeof children === "string" ? `Remove ${children}` : "Remove tag");
|
|
30
|
+
const bounded = overflowBounded(overflow);
|
|
31
|
+
return /* @__PURE__ */ jsxs(
|
|
32
|
+
"span",
|
|
33
|
+
{
|
|
34
|
+
className: cn(
|
|
35
|
+
// `cursor-default` FIRST so the disabled flag's `cursor-not-allowed`
|
|
36
|
+
// (appended inside tagRootClass) wins the tailwind-merge.
|
|
37
|
+
"cursor-default",
|
|
38
|
+
tagRootClass(size, {
|
|
39
|
+
withLeading: leading != null,
|
|
40
|
+
withTrailing: trailing != null,
|
|
41
|
+
withClose: !!onRemove,
|
|
42
|
+
disabled,
|
|
43
|
+
overflow
|
|
44
|
+
}),
|
|
45
|
+
className
|
|
46
|
+
),
|
|
47
|
+
...rest,
|
|
48
|
+
children: [
|
|
49
|
+
/* @__PURE__ */ jsxs("span", { className: tagContentClass(size, bounded), children: [
|
|
50
|
+
leading != null ? /* @__PURE__ */ jsx(Slot, { className: tagSlotClass(size), children: leading }) : null,
|
|
51
|
+
bounded ? /* @__PURE__ */ jsx("span", { className: tagLabelClass(overflow), children }) : children,
|
|
52
|
+
trailing != null ? /* @__PURE__ */ jsx(Slot, { className: tagSlotClass(size), children: trailing }) : null
|
|
53
|
+
] }),
|
|
54
|
+
onRemove ? /* @__PURE__ */ jsx(
|
|
55
|
+
"button",
|
|
56
|
+
{
|
|
57
|
+
type: "button",
|
|
58
|
+
"aria-label": label,
|
|
59
|
+
disabled,
|
|
60
|
+
tabIndex: removeExcludeFromTabOrder ? -1 : void 0,
|
|
61
|
+
onClick: onRemove,
|
|
62
|
+
className: tagCloseClass(size),
|
|
63
|
+
children: /* @__PURE__ */ jsx(XIcon, {})
|
|
64
|
+
}
|
|
65
|
+
) : null
|
|
66
|
+
]
|
|
67
|
+
}
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
Tag.displayName = "Tag";
|
|
71
|
+
var TagGroupContext = React.createContext({ size: "md", disabled: false, showCheck: true, overflow: "visible" });
|
|
72
|
+
function TagGroupRoot(props) {
|
|
73
|
+
const {
|
|
74
|
+
value,
|
|
75
|
+
defaultValue,
|
|
76
|
+
onValueChange,
|
|
77
|
+
multiple = true,
|
|
78
|
+
size = "md",
|
|
79
|
+
disabled = false,
|
|
80
|
+
showCheck = true,
|
|
81
|
+
loopFocus = true,
|
|
82
|
+
overflow = "visible",
|
|
83
|
+
options,
|
|
84
|
+
className,
|
|
85
|
+
...rest
|
|
86
|
+
} = props;
|
|
87
|
+
warnNeedsName("TagGroup", "aria-label" in rest || "aria-labelledby" in rest, "`aria-label` or `aria-labelledby`");
|
|
88
|
+
const ctx = React.useMemo(() => ({ size, disabled, showCheck, overflow }), [size, disabled, showCheck, overflow]);
|
|
89
|
+
const isControlled = value !== void 0;
|
|
90
|
+
const [innerValue, setInnerValue] = React.useState(defaultValue ?? []);
|
|
91
|
+
const currentValue = isControlled ? value : innerValue;
|
|
92
|
+
const handleValueChange = (next) => {
|
|
93
|
+
if (!multiple && next.length === 0) return;
|
|
94
|
+
if (!isControlled) setInnerValue(next);
|
|
95
|
+
onValueChange?.(next);
|
|
96
|
+
};
|
|
97
|
+
return /* @__PURE__ */ jsx(TagGroupContext.Provider, { value: ctx, children: /* @__PURE__ */ jsx(
|
|
98
|
+
ToggleGroup,
|
|
99
|
+
{
|
|
100
|
+
value: currentValue,
|
|
101
|
+
onValueChange: (groupValue) => handleValueChange(groupValue),
|
|
102
|
+
multiple,
|
|
103
|
+
disabled,
|
|
104
|
+
loopFocus,
|
|
105
|
+
className: cn("inline-flex flex-wrap items-center gap-2", className),
|
|
106
|
+
...rest,
|
|
107
|
+
children: options?.map((o) => /* @__PURE__ */ jsx(
|
|
108
|
+
TagGroupItem,
|
|
109
|
+
{
|
|
110
|
+
value: o.value,
|
|
111
|
+
leading: o.leading,
|
|
112
|
+
trailing: o.trailing,
|
|
113
|
+
disabled: o.disabled,
|
|
114
|
+
overflow: o.overflow,
|
|
115
|
+
className: o.className,
|
|
116
|
+
children: o.label
|
|
117
|
+
},
|
|
118
|
+
o.value
|
|
119
|
+
))
|
|
120
|
+
}
|
|
121
|
+
) });
|
|
122
|
+
}
|
|
123
|
+
TagGroupRoot.displayName = "TagGroup";
|
|
124
|
+
function TagGroupItem(props) {
|
|
125
|
+
const { value, children, leading, trailing, disabled = false, overflow, className } = props;
|
|
126
|
+
const ctx = React.useContext(TagGroupContext);
|
|
127
|
+
const isDisabled = ctx.disabled || disabled;
|
|
128
|
+
const itemOverflow = overflow ?? ctx.overflow;
|
|
129
|
+
const bounded = overflowBounded(itemOverflow);
|
|
130
|
+
return /* @__PURE__ */ jsx(
|
|
131
|
+
Toggle,
|
|
132
|
+
{
|
|
133
|
+
value,
|
|
134
|
+
disabled: isDisabled,
|
|
135
|
+
className: cn(
|
|
136
|
+
// The pill stays neutral at every state (UUI): no hover, no selected tint,
|
|
137
|
+
// no disabled dim — the persistent mini checkbox carries selection +
|
|
138
|
+
// disabled feedback. The whole pill IS the toggle button, so `cursor-pointer`
|
|
139
|
+
// covers all of it; kept FIRST so the disabled flag's `cursor-not-allowed`
|
|
140
|
+
// (appended inside tagRootClass) wins the merge.
|
|
141
|
+
"cursor-pointer",
|
|
142
|
+
tagRootClass(ctx.size, {
|
|
143
|
+
withCheckbox: ctx.showCheck,
|
|
144
|
+
withLeading: leading != null,
|
|
145
|
+
withTrailing: trailing != null,
|
|
146
|
+
disabled: isDisabled,
|
|
147
|
+
overflow: itemOverflow
|
|
148
|
+
}),
|
|
149
|
+
// House fallback: with the checkbox hidden, selection reads from the brand tint —
|
|
150
|
+
// and, since the checkbox is also the sole carrier of the disabled dim, the pill
|
|
151
|
+
// itself has to dim here (the UUI-faithful `showCheck` path keeps full color).
|
|
152
|
+
!ctx.showCheck && cn(TAG_SELECTED, "data-[disabled]:opacity-50"),
|
|
153
|
+
"outline-focus-ring focus-visible:outline-2 focus-visible:outline-offset-2",
|
|
154
|
+
className
|
|
155
|
+
),
|
|
156
|
+
children: /* @__PURE__ */ jsxs("span", { className: tagContentClass(ctx.size, bounded), children: [
|
|
157
|
+
ctx.showCheck ? /* @__PURE__ */ jsx(TagCheckbox, { size: ctx.size }) : null,
|
|
158
|
+
leading != null ? /* @__PURE__ */ jsx(Slot, { className: tagSlotClass(ctx.size), children: leading }) : null,
|
|
159
|
+
bounded ? /* @__PURE__ */ jsx("span", { className: tagLabelClass(itemOverflow), children }) : children,
|
|
160
|
+
trailing != null ? /* @__PURE__ */ jsx(Slot, { className: tagSlotClass(ctx.size), children: trailing }) : null
|
|
161
|
+
] })
|
|
162
|
+
}
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
TagGroupItem.displayName = "TagGroupItem";
|
|
166
|
+
var TagGroup = TagGroupRoot;
|
|
167
|
+
|
|
168
|
+
export { Tag, TagGroup };
|
|
169
|
+
//# sourceMappingURL=chunk-R6RGJF4L.js.map
|
|
170
|
+
//# sourceMappingURL=chunk-R6RGJF4L.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// src/components/overlay/close-reasons.ts
|
|
2
|
+
var EXPLICIT_CLOSE = /* @__PURE__ */ new Set(["close-press", "trigger-press", "imperative-action", "none"]);
|
|
3
|
+
var NO_RETURN_FOCUS = /* @__PURE__ */ new Set(["outside-press", "focus-out"]);
|
|
4
|
+
|
|
5
|
+
export { EXPLICIT_CLOSE, NO_RETURN_FOCUS };
|
|
6
|
+
//# sourceMappingURL=chunk-S7NNXWIN.js.map
|
|
7
|
+
//# sourceMappingURL=chunk-S7NNXWIN.js.map
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { OptionRow } from './chunk-GTHJWR3Q.js';
|
|
2
|
+
import { mapOptions } from './chunk-7JBNLEJ7.js';
|
|
3
|
+
import { useFieldValidity, FieldGroupFrame } from './chunk-J2BCKBHC.js';
|
|
4
|
+
import { warnNeedsName } from './chunk-GCVA3OIV.js';
|
|
5
|
+
import { cn } from './chunk-ZSNJ6UA3.js';
|
|
6
|
+
import { Radio } from '@base-ui/react/radio';
|
|
7
|
+
import { RadioGroup as RadioGroup$1 } from '@base-ui/react/radio-group';
|
|
8
|
+
import * as React from 'react';
|
|
9
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
10
|
+
|
|
11
|
+
var RadioGroupContext = React.createContext({
|
|
12
|
+
size: "md",
|
|
13
|
+
invalid: false,
|
|
14
|
+
disabled: false,
|
|
15
|
+
bordered: false
|
|
16
|
+
});
|
|
17
|
+
var ORIENTATION = {
|
|
18
|
+
// UUI RadioGroup root is `flex flex-col gap-4`; horizontal is our house addition.
|
|
19
|
+
vertical: "flex flex-col gap-4",
|
|
20
|
+
horizontal: "flex flex-row flex-wrap gap-x-6 gap-y-3"
|
|
21
|
+
};
|
|
22
|
+
var CONTROL_SIZE = {
|
|
23
|
+
md: "h-4 w-4",
|
|
24
|
+
lg: "h-5 w-5"
|
|
25
|
+
};
|
|
26
|
+
var INDICATOR_SIZE = {
|
|
27
|
+
md: "h-1.5 w-1.5",
|
|
28
|
+
lg: "h-2 w-2"
|
|
29
|
+
};
|
|
30
|
+
var CONTROL_BASE = "relative mt-0.5 inline-flex shrink-0 items-center justify-center rounded-full ring-1 ring-inset bg-primary transition-colors duration-100 ease-linear outline-focus-ring focus-visible:outline-2 focus-visible:outline-offset-2 data-[checked]:bg-brand-solid";
|
|
31
|
+
function controlClasses(size, invalid, disabled) {
|
|
32
|
+
return cn(
|
|
33
|
+
CONTROL_BASE,
|
|
34
|
+
CONTROL_SIZE[size],
|
|
35
|
+
"data-[checked]:ring-brand-solid",
|
|
36
|
+
// UUI has NO hover and NO active state on the control — the fill/rim change
|
|
37
|
+
// only on selection (matching Checkbox / Switch).
|
|
38
|
+
disabled ? cn("cursor-not-allowed opacity-50 data-[unchecked]:bg-tertiary", invalid ? "ring-error_subtle" : "ring-primary") : cn("cursor-pointer", invalid ? "ring-error_subtle outline-focus-ring-error" : "ring-primary")
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
function RadioGroupItem(props) {
|
|
42
|
+
const { value, label, hint, disabled = false, className, ...rest } = props;
|
|
43
|
+
const ctx = React.useContext(RadioGroupContext);
|
|
44
|
+
const isDisabled = ctx.disabled || disabled;
|
|
45
|
+
const labelId = React.useId();
|
|
46
|
+
const hintId = React.useId();
|
|
47
|
+
const hasHint = hint != null && hint !== "";
|
|
48
|
+
return /* @__PURE__ */ jsx(
|
|
49
|
+
OptionRow,
|
|
50
|
+
{
|
|
51
|
+
size: ctx.size,
|
|
52
|
+
bordered: ctx.bordered,
|
|
53
|
+
disabled: isDisabled,
|
|
54
|
+
label,
|
|
55
|
+
hint,
|
|
56
|
+
labelId,
|
|
57
|
+
hintId,
|
|
58
|
+
className,
|
|
59
|
+
control: /* @__PURE__ */ jsx(
|
|
60
|
+
Radio.Root,
|
|
61
|
+
{
|
|
62
|
+
value,
|
|
63
|
+
disabled,
|
|
64
|
+
"aria-labelledby": labelId,
|
|
65
|
+
"aria-describedby": hasHint ? hintId : void 0,
|
|
66
|
+
className: controlClasses(ctx.size, ctx.invalid, isDisabled),
|
|
67
|
+
children: /* @__PURE__ */ jsx(
|
|
68
|
+
Radio.Indicator,
|
|
69
|
+
{
|
|
70
|
+
keepMounted: true,
|
|
71
|
+
className: cn(
|
|
72
|
+
"rounded-full bg-fg-white opacity-0 transition-opacity duration-100 ease-linear data-[checked]:opacity-100",
|
|
73
|
+
INDICATOR_SIZE[ctx.size]
|
|
74
|
+
)
|
|
75
|
+
}
|
|
76
|
+
)
|
|
77
|
+
}
|
|
78
|
+
),
|
|
79
|
+
...rest
|
|
80
|
+
}
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
RadioGroupItem.displayName = "RadioGroupItem";
|
|
84
|
+
function RadioGroupSectionLabel({ children }) {
|
|
85
|
+
return /* @__PURE__ */ jsx("span", { className: "text-sm font-medium text-primary", children });
|
|
86
|
+
}
|
|
87
|
+
function RadioGroupRoot(props) {
|
|
88
|
+
const {
|
|
89
|
+
value,
|
|
90
|
+
defaultValue,
|
|
91
|
+
onValueChange,
|
|
92
|
+
size = "md",
|
|
93
|
+
orientation = "vertical",
|
|
94
|
+
name,
|
|
95
|
+
disabled = false,
|
|
96
|
+
required = false,
|
|
97
|
+
label,
|
|
98
|
+
hideRequiredIndicator = false,
|
|
99
|
+
tooltip,
|
|
100
|
+
tooltipDescription,
|
|
101
|
+
hint,
|
|
102
|
+
invalid = false,
|
|
103
|
+
error,
|
|
104
|
+
bordered = false,
|
|
105
|
+
fullWidth = true,
|
|
106
|
+
options,
|
|
107
|
+
className,
|
|
108
|
+
"aria-labelledby": ariaLabelledby,
|
|
109
|
+
...rest
|
|
110
|
+
} = props;
|
|
111
|
+
const { isInvalid, showError } = useFieldValidity(invalid, error);
|
|
112
|
+
const reactId = React.useId();
|
|
113
|
+
const labelId = `${reactId}-label`;
|
|
114
|
+
const hasLabel = label != null && label !== "";
|
|
115
|
+
warnNeedsName("RadioGroup", hasLabel || ariaLabelledby != null || "aria-label" in rest);
|
|
116
|
+
const contextValue = React.useMemo(() => ({ size, invalid: isInvalid, disabled, bordered }), [size, isInvalid, disabled, bordered]);
|
|
117
|
+
return /* @__PURE__ */ jsx(
|
|
118
|
+
FieldGroupFrame,
|
|
119
|
+
{
|
|
120
|
+
label,
|
|
121
|
+
labelId,
|
|
122
|
+
required,
|
|
123
|
+
hideRequiredIndicator,
|
|
124
|
+
tooltip,
|
|
125
|
+
tooltipDescription,
|
|
126
|
+
hint,
|
|
127
|
+
error,
|
|
128
|
+
isInvalid,
|
|
129
|
+
showError,
|
|
130
|
+
size,
|
|
131
|
+
disabled,
|
|
132
|
+
name,
|
|
133
|
+
fullWidth,
|
|
134
|
+
className,
|
|
135
|
+
children: /* @__PURE__ */ jsx(
|
|
136
|
+
RadioGroup$1,
|
|
137
|
+
{
|
|
138
|
+
value,
|
|
139
|
+
defaultValue,
|
|
140
|
+
required,
|
|
141
|
+
onValueChange: onValueChange ? (next, details) => onValueChange(next, details.event) : void 0,
|
|
142
|
+
className: ORIENTATION[orientation],
|
|
143
|
+
"aria-labelledby": hasLabel ? labelId : ariaLabelledby,
|
|
144
|
+
...rest,
|
|
145
|
+
children: /* @__PURE__ */ jsx(RadioGroupContext.Provider, { value: contextValue, children: options ? mapOptions(options, {
|
|
146
|
+
item: (o) => /* @__PURE__ */ jsx(RadioGroupItem, { value: o.value, label: o.label, hint: o.hint, disabled: o.disabled, className: o.className }, o.value),
|
|
147
|
+
group: (groupLabel, groupChildren) => /* @__PURE__ */ jsxs("div", { role: "group", "aria-label": groupLabel, className: ORIENTATION[orientation], children: [
|
|
148
|
+
/* @__PURE__ */ jsx(RadioGroupSectionLabel, { children: groupLabel }),
|
|
149
|
+
groupChildren
|
|
150
|
+
] }, groupLabel)
|
|
151
|
+
}) : null })
|
|
152
|
+
}
|
|
153
|
+
)
|
|
154
|
+
}
|
|
155
|
+
);
|
|
156
|
+
}
|
|
157
|
+
RadioGroupRoot.displayName = "RadioGroup";
|
|
158
|
+
var RadioGroup = RadioGroupRoot;
|
|
159
|
+
|
|
160
|
+
export { RadioGroup };
|
|
161
|
+
//# sourceMappingURL=chunk-SV56BSUQ.js.map
|
|
162
|
+
//# sourceMappingURL=chunk-SV56BSUQ.js.map
|