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