@mond-design-system/react 1.0.0-alpha.2 → 1.0.0-alpha.3
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.cjs +132 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +144 -2
- package/dist/index.css.map +1 -1
- package/dist/index.d.cts +68 -24
- package/dist/index.d.ts +68 -24
- package/dist/index.js +132 -15
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -173,6 +173,7 @@ var Button_default = {
|
|
|
173
173
|
"variant-primary": "Button_variant-primary",
|
|
174
174
|
"variant-secondary": "Button_variant-secondary",
|
|
175
175
|
"variant-ghost": "Button_variant-ghost",
|
|
176
|
+
"variant-highlight": "Button_variant-highlight",
|
|
176
177
|
"variant-danger": "Button_variant-danger",
|
|
177
178
|
fullWidth: "Button_fullWidth",
|
|
178
179
|
"icon-only": "Button_icon-only"
|
|
@@ -224,22 +225,36 @@ function Button({
|
|
|
224
225
|
var Link_default = {
|
|
225
226
|
link: "Link_link",
|
|
226
227
|
"variant-inline": "Link_variant-inline",
|
|
227
|
-
"variant-standalone": "Link_variant-standalone"
|
|
228
|
+
"variant-standalone": "Link_variant-standalone",
|
|
229
|
+
"variant-plain": "Link_variant-plain",
|
|
230
|
+
"size-xs": "Link_size-xs",
|
|
231
|
+
"size-sm": "Link_size-sm",
|
|
232
|
+
"size-base": "Link_size-base",
|
|
233
|
+
"size-lg": "Link_size-lg",
|
|
234
|
+
"size-xl": "Link_size-xl"
|
|
228
235
|
};
|
|
229
236
|
function Link({
|
|
230
237
|
variant = "inline",
|
|
238
|
+
size,
|
|
231
239
|
external = false,
|
|
232
240
|
as: Element = "a",
|
|
233
241
|
className,
|
|
234
242
|
...rest
|
|
235
243
|
}) {
|
|
236
244
|
const externalProps = external ? { target: "_blank", rel: "noopener noreferrer" } : {};
|
|
245
|
+
const typeProps = Element === "button" ? { type: rest.type ?? "button" } : {};
|
|
237
246
|
return /* @__PURE__ */ jsx(
|
|
238
247
|
Element,
|
|
239
248
|
{
|
|
240
|
-
className: cx(
|
|
249
|
+
className: cx(
|
|
250
|
+
Link_default.link,
|
|
251
|
+
Link_default[`variant-${variant}`],
|
|
252
|
+
size && Link_default[`size-${size}`],
|
|
253
|
+
className
|
|
254
|
+
),
|
|
241
255
|
...externalProps,
|
|
242
|
-
...rest
|
|
256
|
+
...rest,
|
|
257
|
+
...typeProps
|
|
243
258
|
}
|
|
244
259
|
);
|
|
245
260
|
}
|
|
@@ -247,9 +262,16 @@ function Link({
|
|
|
247
262
|
// src/components/Avatar/Avatar.module.css
|
|
248
263
|
var Avatar_default = {
|
|
249
264
|
avatar: "Avatar_avatar",
|
|
265
|
+
"size-xs": "Avatar_size-xs",
|
|
250
266
|
"size-sm": "Avatar_size-sm",
|
|
251
267
|
"size-md": "Avatar_size-md",
|
|
252
268
|
"size-lg": "Avatar_size-lg",
|
|
269
|
+
"size-xl": "Avatar_size-xl",
|
|
270
|
+
"tone-1": "Avatar_tone-1",
|
|
271
|
+
"tone-2": "Avatar_tone-2",
|
|
272
|
+
"tone-3": "Avatar_tone-3",
|
|
273
|
+
"tone-4": "Avatar_tone-4",
|
|
274
|
+
"tone-5": "Avatar_tone-5",
|
|
253
275
|
image: "Avatar_image",
|
|
254
276
|
initials: "Avatar_initials"
|
|
255
277
|
};
|
|
@@ -259,8 +281,37 @@ function initials(name) {
|
|
|
259
281
|
const last = words.length > 1 ? words.at(-1)?.[0] ?? "" : "";
|
|
260
282
|
return (first + last).toUpperCase();
|
|
261
283
|
}
|
|
262
|
-
function Avatar({
|
|
263
|
-
|
|
284
|
+
function Avatar({
|
|
285
|
+
name,
|
|
286
|
+
src,
|
|
287
|
+
size = "md",
|
|
288
|
+
tone,
|
|
289
|
+
decorative = false,
|
|
290
|
+
className,
|
|
291
|
+
...rest
|
|
292
|
+
}) {
|
|
293
|
+
return /* @__PURE__ */ jsx(
|
|
294
|
+
"span",
|
|
295
|
+
{
|
|
296
|
+
className: cx(
|
|
297
|
+
Avatar_default.avatar,
|
|
298
|
+
Avatar_default[`size-${size}`],
|
|
299
|
+
tone !== void 0 && Avatar_default[`tone-${tone}`],
|
|
300
|
+
className
|
|
301
|
+
),
|
|
302
|
+
"aria-hidden": decorative || void 0,
|
|
303
|
+
...rest,
|
|
304
|
+
children: src ? /* @__PURE__ */ jsx("img", { className: Avatar_default.image, src, alt: decorative ? "" : name }) : /* @__PURE__ */ jsx(
|
|
305
|
+
"span",
|
|
306
|
+
{
|
|
307
|
+
role: decorative ? void 0 : "img",
|
|
308
|
+
"aria-label": decorative ? void 0 : name,
|
|
309
|
+
className: Avatar_default.initials,
|
|
310
|
+
children: initials(name)
|
|
311
|
+
}
|
|
312
|
+
)
|
|
313
|
+
}
|
|
314
|
+
);
|
|
264
315
|
}
|
|
265
316
|
|
|
266
317
|
// src/components/AvatarGroup/AvatarGroup.module.css
|
|
@@ -303,6 +354,7 @@ var Badge_default = {
|
|
|
303
354
|
badge: "Badge_badge",
|
|
304
355
|
"tone-neutral": "Badge_tone-neutral",
|
|
305
356
|
"tone-accent": "Badge_tone-accent",
|
|
357
|
+
"tone-highlight": "Badge_tone-highlight",
|
|
306
358
|
"tone-danger": "Badge_tone-danger",
|
|
307
359
|
"tone-warning": "Badge_tone-warning",
|
|
308
360
|
"tone-success": "Badge_tone-success"
|
|
@@ -316,6 +368,7 @@ var Chip_default = {
|
|
|
316
368
|
chip: "Chip_chip",
|
|
317
369
|
"variant-soft": "Chip_variant-soft",
|
|
318
370
|
"variant-outline": "Chip_variant-outline",
|
|
371
|
+
"variant-highlight": "Chip_variant-highlight",
|
|
319
372
|
selected: "Chip_selected",
|
|
320
373
|
interactive: "Chip_interactive",
|
|
321
374
|
disabled: "Chip_disabled"
|
|
@@ -1074,20 +1127,45 @@ var Input_default = {
|
|
|
1074
1127
|
input: "Input_input",
|
|
1075
1128
|
"size-sm": "Input_size-sm",
|
|
1076
1129
|
"size-md": "Input_size-md",
|
|
1077
|
-
"size-lg": "Input_size-lg"
|
|
1130
|
+
"size-lg": "Input_size-lg",
|
|
1131
|
+
iconWrap: "Input_iconWrap",
|
|
1132
|
+
icon: "Input_icon",
|
|
1133
|
+
iconLeft: "Input_iconLeft",
|
|
1134
|
+
iconRight: "Input_iconRight",
|
|
1135
|
+
"with-icon-left": "Input_with-icon-left",
|
|
1136
|
+
"with-icon-right": "Input_with-icon-right"
|
|
1078
1137
|
};
|
|
1079
|
-
function Input({
|
|
1138
|
+
function Input({
|
|
1139
|
+
size = "md",
|
|
1140
|
+
invalid,
|
|
1141
|
+
iconLeft,
|
|
1142
|
+
iconRight,
|
|
1143
|
+
className,
|
|
1144
|
+
...rest
|
|
1145
|
+
}) {
|
|
1080
1146
|
const field = useFieldContext();
|
|
1081
|
-
|
|
1147
|
+
const input = /* @__PURE__ */ jsx(
|
|
1082
1148
|
"input",
|
|
1083
1149
|
{
|
|
1084
1150
|
id: rest.id ?? field?.id,
|
|
1085
1151
|
"aria-describedby": rest["aria-describedby"] ?? field?.describedBy,
|
|
1086
|
-
"aria-invalid": rest["aria-invalid"] ?? (field?.invalid || void 0),
|
|
1087
|
-
className: cx(
|
|
1152
|
+
"aria-invalid": rest["aria-invalid"] ?? ((invalid ?? field?.invalid) || void 0),
|
|
1153
|
+
className: cx(
|
|
1154
|
+
Input_default.input,
|
|
1155
|
+
Input_default[`size-${size}`],
|
|
1156
|
+
iconLeft != null && Input_default["with-icon-left"],
|
|
1157
|
+
iconRight != null && Input_default["with-icon-right"],
|
|
1158
|
+
className
|
|
1159
|
+
),
|
|
1088
1160
|
...rest
|
|
1089
1161
|
}
|
|
1090
1162
|
);
|
|
1163
|
+
if (iconLeft == null && iconRight == null) return input;
|
|
1164
|
+
return /* @__PURE__ */ jsxs("span", { className: Input_default.iconWrap, children: [
|
|
1165
|
+
input,
|
|
1166
|
+
iconLeft != null && /* @__PURE__ */ jsx("span", { className: cx(Input_default.icon, Input_default.iconLeft), "aria-hidden": "true", children: iconLeft }),
|
|
1167
|
+
iconRight != null && /* @__PURE__ */ jsx("span", { className: cx(Input_default.icon, Input_default.iconRight), "aria-hidden": "true", children: iconRight })
|
|
1168
|
+
] });
|
|
1091
1169
|
}
|
|
1092
1170
|
|
|
1093
1171
|
// src/components/PasswordInput/PasswordInput.module.css
|
|
@@ -1191,12 +1269,33 @@ function Radio({ label, className, ...rest }) {
|
|
|
1191
1269
|
var Switch_default = {
|
|
1192
1270
|
root: "Switch_root",
|
|
1193
1271
|
track: "Switch_track",
|
|
1272
|
+
trackWrap: "Switch_trackWrap",
|
|
1273
|
+
spinner: "Switch_spinner",
|
|
1194
1274
|
label: "Switch_label"
|
|
1195
1275
|
};
|
|
1196
|
-
function Switch({
|
|
1276
|
+
function Switch({
|
|
1277
|
+
label,
|
|
1278
|
+
loading = false,
|
|
1279
|
+
disabled = false,
|
|
1280
|
+
className,
|
|
1281
|
+
...rest
|
|
1282
|
+
}) {
|
|
1197
1283
|
return /* @__PURE__ */ jsxs("label", { className: cx(Switch_default.root, className), children: [
|
|
1198
|
-
/* @__PURE__ */
|
|
1199
|
-
|
|
1284
|
+
/* @__PURE__ */ jsxs("span", { className: Switch_default.trackWrap, children: [
|
|
1285
|
+
/* @__PURE__ */ jsx(
|
|
1286
|
+
"input",
|
|
1287
|
+
{
|
|
1288
|
+
type: "checkbox",
|
|
1289
|
+
role: "switch",
|
|
1290
|
+
className: Switch_default.track,
|
|
1291
|
+
disabled: disabled || loading,
|
|
1292
|
+
"aria-busy": loading || void 0,
|
|
1293
|
+
...rest
|
|
1294
|
+
}
|
|
1295
|
+
),
|
|
1296
|
+
loading && /* @__PURE__ */ jsx(Spinner, { size: 12, label: "", "aria-hidden": "true", className: Switch_default.spinner })
|
|
1297
|
+
] }),
|
|
1298
|
+
label !== void 0 && /* @__PURE__ */ jsx("span", { className: Switch_default.label, children: label })
|
|
1200
1299
|
] });
|
|
1201
1300
|
}
|
|
1202
1301
|
|
|
@@ -1212,6 +1311,7 @@ function SegmentedControl({
|
|
|
1212
1311
|
options,
|
|
1213
1312
|
value,
|
|
1214
1313
|
onChange,
|
|
1314
|
+
disabled = false,
|
|
1215
1315
|
className
|
|
1216
1316
|
}) {
|
|
1217
1317
|
const name = useId();
|
|
@@ -1224,6 +1324,7 @@ function SegmentedControl({
|
|
|
1224
1324
|
value: option.value,
|
|
1225
1325
|
checked: option.value === value,
|
|
1226
1326
|
onChange: () => onChange(option.value),
|
|
1327
|
+
disabled,
|
|
1227
1328
|
className: SegmentedControl_default.input
|
|
1228
1329
|
}
|
|
1229
1330
|
),
|
|
@@ -1279,6 +1380,10 @@ function SearchField({ label, value, onChange, className, ...rest }) {
|
|
|
1279
1380
|
var List_default = {
|
|
1280
1381
|
group: "List_group",
|
|
1281
1382
|
item: "List_item",
|
|
1383
|
+
"surface-card": "List_surface-card",
|
|
1384
|
+
"surface-sunken": "List_surface-sunken",
|
|
1385
|
+
"surface-accent": "List_surface-accent",
|
|
1386
|
+
"surface-plain": "List_surface-plain",
|
|
1282
1387
|
row: "List_row",
|
|
1283
1388
|
interactive: "List_interactive",
|
|
1284
1389
|
leading: "List_leading",
|
|
@@ -1287,8 +1392,9 @@ var List_default = {
|
|
|
1287
1392
|
title: "List_title",
|
|
1288
1393
|
description: "List_description"
|
|
1289
1394
|
};
|
|
1395
|
+
var ListGroupContext = createContext(false);
|
|
1290
1396
|
function ListGroup({ className, ...rest }) {
|
|
1291
|
-
return /* @__PURE__ */ jsx("ul", { className: cx(List_default.group, className), ...rest });
|
|
1397
|
+
return /* @__PURE__ */ jsx(ListGroupContext.Provider, { value: true, children: /* @__PURE__ */ jsx("ul", { className: cx(List_default.group, className), ...rest }) });
|
|
1292
1398
|
}
|
|
1293
1399
|
function ListItem({
|
|
1294
1400
|
title,
|
|
@@ -1297,9 +1403,13 @@ function ListItem({
|
|
|
1297
1403
|
trailing,
|
|
1298
1404
|
onClick,
|
|
1299
1405
|
href,
|
|
1406
|
+
surface,
|
|
1300
1407
|
className,
|
|
1301
1408
|
...rest
|
|
1302
1409
|
}) {
|
|
1410
|
+
const inGroup = useContext(ListGroupContext);
|
|
1411
|
+
const Root = inGroup ? "li" : "div";
|
|
1412
|
+
const resolved = surface ?? (inGroup ? void 0 : "card");
|
|
1303
1413
|
const content = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1304
1414
|
leading != null && /* @__PURE__ */ jsx("span", { className: List_default.leading, children: leading }),
|
|
1305
1415
|
/* @__PURE__ */ jsxs("span", { className: List_default.text, children: [
|
|
@@ -1308,7 +1418,14 @@ function ListItem({
|
|
|
1308
1418
|
] }),
|
|
1309
1419
|
trailing != null && /* @__PURE__ */ jsx("span", { className: List_default.trailing, children: trailing })
|
|
1310
1420
|
] });
|
|
1311
|
-
return /* @__PURE__ */ jsx(
|
|
1421
|
+
return /* @__PURE__ */ jsx(
|
|
1422
|
+
Root,
|
|
1423
|
+
{
|
|
1424
|
+
className: cx(List_default.item, resolved && List_default[`surface-${resolved}`], className),
|
|
1425
|
+
...rest,
|
|
1426
|
+
children: href !== void 0 ? /* @__PURE__ */ jsx("a", { className: cx(List_default.row, List_default.interactive), href, children: content }) : onClick !== void 0 ? /* @__PURE__ */ jsx("button", { type: "button", className: cx(List_default.row, List_default.interactive), onClick, children: content }) : /* @__PURE__ */ jsx("span", { className: List_default.row, children: content })
|
|
1427
|
+
}
|
|
1428
|
+
);
|
|
1312
1429
|
}
|
|
1313
1430
|
|
|
1314
1431
|
// src/components/EmptyState/EmptyState.module.css
|