@mond-design-system/react 4.1.0 → 4.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -773,6 +773,12 @@ interface SegmentedControlProps<T extends string = string> {
773
773
  bar with an avatar and a menu, where the medium step is the tallest
774
774
  thing up there. */
775
775
  size?: SegmentedControlSize;
776
+ /** Report the segment already chosen being picked again. Off by default:
777
+ a radio only fires when its checked state changes, and for most choices
778
+ that is the whole story. Turn it on where confirming the value on screen
779
+ is itself an act — pinning a language that until now was inferred from
780
+ the browser, so it stops following it. */
781
+ repick?: boolean;
776
782
  /** Drop the frame: no tray, no padding around the segments. The tray is
777
783
  what makes the group read as a form field, and in a header bar a field
778
784
  is what it is not. The chosen segment still carries its own surface. */
@@ -795,7 +801,7 @@ interface SegmentedControlProps<T extends string = string> {
795
801
  * />
796
802
  * ```
797
803
  */
798
- declare function SegmentedControl<T extends string = string>({ label, options, value, onChange, disabled, fullWidth, size, bare, className, }: SegmentedControlProps<T>): ReactElement;
804
+ declare function SegmentedControl<T extends string = string>({ label, options, value, onChange, disabled, fullWidth, size, bare, repick, className, }: SegmentedControlProps<T>): ReactElement;
799
805
 
800
806
  interface SearchFieldProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "type" | "size" | "value" | "onChange"> {
801
807
  /** Accessible name. */
package/dist/index.d.ts CHANGED
@@ -773,6 +773,12 @@ interface SegmentedControlProps<T extends string = string> {
773
773
  bar with an avatar and a menu, where the medium step is the tallest
774
774
  thing up there. */
775
775
  size?: SegmentedControlSize;
776
+ /** Report the segment already chosen being picked again. Off by default:
777
+ a radio only fires when its checked state changes, and for most choices
778
+ that is the whole story. Turn it on where confirming the value on screen
779
+ is itself an act — pinning a language that until now was inferred from
780
+ the browser, so it stops following it. */
781
+ repick?: boolean;
776
782
  /** Drop the frame: no tray, no padding around the segments. The tray is
777
783
  what makes the group read as a form field, and in a header bar a field
778
784
  is what it is not. The chosen segment still carries its own surface. */
@@ -795,7 +801,7 @@ interface SegmentedControlProps<T extends string = string> {
795
801
  * />
796
802
  * ```
797
803
  */
798
- declare function SegmentedControl<T extends string = string>({ label, options, value, onChange, disabled, fullWidth, size, bare, className, }: SegmentedControlProps<T>): ReactElement;
804
+ declare function SegmentedControl<T extends string = string>({ label, options, value, onChange, disabled, fullWidth, size, bare, repick, className, }: SegmentedControlProps<T>): ReactElement;
799
805
 
800
806
  interface SearchFieldProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "type" | "size" | "value" | "onChange"> {
801
807
  /** Accessible name. */
package/dist/index.js CHANGED
@@ -1237,6 +1237,7 @@ function SegmentedControl({
1237
1237
  fullWidth = false,
1238
1238
  size = "md",
1239
1239
  bare = false,
1240
+ repick = false,
1240
1241
  className
1241
1242
  }) {
1242
1243
  const name = useId();
@@ -1261,6 +1262,7 @@ function SegmentedControl({
1261
1262
  value: option.value,
1262
1263
  checked: option.value === value,
1263
1264
  onChange: () => onChange(option.value),
1265
+ onClick: repick && option.value === value ? () => onChange(option.value) : void 0,
1264
1266
  disabled,
1265
1267
  className: SegmentedControl_module_default.input
1266
1268
  }
@@ -1519,34 +1521,42 @@ function ToastProvider({
1519
1521
  const value = useMemo(() => ({ toast, dismiss }), [toast, dismiss]);
1520
1522
  return /* @__PURE__ */ jsxs(ToastContext.Provider, { value, children: [
1521
1523
  children,
1522
- /* @__PURE__ */ jsx("div", { role: "region", "aria-label": regionLabel, className: Toast_module_default.viewport, children: toasts.map((entry) => /* @__PURE__ */ jsxs("div", { role: "status", className: cx(Toast_module_default.toast, Toast_module_default[`tone-${entry.tone}`]), children: [
1523
- /* @__PURE__ */ jsxs("span", { className: Toast_module_default.body, children: [
1524
- /* @__PURE__ */ jsx("span", { className: Toast_module_default.title, children: entry.title }),
1525
- entry.description !== void 0 && /* @__PURE__ */ jsx("span", { className: Toast_module_default.description, children: entry.description })
1526
- ] }),
1527
- entry.action !== void 0 && /* @__PURE__ */ jsx(
1528
- "button",
1529
- {
1530
- type: "button",
1531
- className: Toast_module_default.action,
1532
- onClick: () => {
1533
- entry.action?.onClick();
1534
- dismiss(entry.id);
1535
- },
1536
- children: entry.action.label
1537
- }
1538
- ),
1539
- /* @__PURE__ */ jsx(
1540
- "button",
1541
- {
1542
- type: "button",
1543
- "aria-label": `${dismissLabel}: ${entry.title}`,
1544
- className: Toast_module_default.close,
1545
- onClick: () => dismiss(entry.id),
1546
- children: /* @__PURE__ */ jsx(CloseGlyph, { className: Toast_module_default.closeGlyph })
1547
- }
1548
- )
1549
- ] }, entry.id)) })
1524
+ /* @__PURE__ */ jsx("div", { role: "region", "aria-label": regionLabel, className: Toast_module_default.viewport, children: toasts.map((entry) => /* @__PURE__ */ jsxs(
1525
+ "div",
1526
+ {
1527
+ role: entry.tone === "danger" ? "alert" : "status",
1528
+ className: cx(Toast_module_default.toast, Toast_module_default[`tone-${entry.tone}`]),
1529
+ children: [
1530
+ /* @__PURE__ */ jsxs("span", { className: Toast_module_default.body, children: [
1531
+ /* @__PURE__ */ jsx("span", { className: Toast_module_default.title, children: entry.title }),
1532
+ entry.description !== void 0 && /* @__PURE__ */ jsx("span", { className: Toast_module_default.description, children: entry.description })
1533
+ ] }),
1534
+ entry.action !== void 0 && /* @__PURE__ */ jsx(
1535
+ "button",
1536
+ {
1537
+ type: "button",
1538
+ className: Toast_module_default.action,
1539
+ onClick: () => {
1540
+ entry.action?.onClick();
1541
+ dismiss(entry.id);
1542
+ },
1543
+ children: entry.action.label
1544
+ }
1545
+ ),
1546
+ /* @__PURE__ */ jsx(
1547
+ "button",
1548
+ {
1549
+ type: "button",
1550
+ "aria-label": `${dismissLabel}: ${entry.title}`,
1551
+ className: Toast_module_default.close,
1552
+ onClick: () => dismiss(entry.id),
1553
+ children: /* @__PURE__ */ jsx(CloseGlyph, { className: Toast_module_default.closeGlyph })
1554
+ }
1555
+ )
1556
+ ]
1557
+ },
1558
+ entry.id
1559
+ )) })
1550
1560
  ] });
1551
1561
  }
1552
1562