@mond-design-system/react 1.0.0 → 2.0.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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Aaron Blum
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,100 @@
1
+ # @mond-design-system/react
2
+
3
+ Brand-agnostic React components. Self-styled, WCAG 2.2 AA, no theme object and
4
+ no product vocabulary.
5
+
6
+ Every component reads CSS custom properties from
7
+ [`@mond-design-system/tokens`](https://www.npmjs.com/package/@mond-design-system/tokens),
8
+ so restyling the whole library is one CSS file in your app.
9
+
10
+ ```sh
11
+ pnpm add @mond-design-system/react @mond-design-system/tokens
12
+ ```
13
+
14
+ React 19 or newer, as a peer dependency.
15
+
16
+ ## Setup
17
+
18
+ Load the tokens, then the components, then your brand. The order is the
19
+ mechanism: your brand file re-declares the same properties and wins by coming
20
+ last.
21
+
22
+ ```ts
23
+ import "@mond-design-system/tokens/styles.css";
24
+ import "@mond-design-system/react/styles.css";
25
+ import "./tokens/brand-acme.css";
26
+ ```
27
+
28
+ ```tsx
29
+ import { Button, Card, Field, Input, Stack } from "@mond-design-system/react";
30
+
31
+ export function SignIn() {
32
+ return (
33
+ <Card>
34
+ <Stack gap="loose">
35
+ <Field label="Email">
36
+ <Input type="email" />
37
+ </Field>
38
+ <Button variant="primary">Continue</Button>
39
+ </Stack>
40
+ </Card>
41
+ );
42
+ }
43
+ ```
44
+
45
+ Dark mode is `data-theme="dark"` on `<html>`. Nothing else changes.
46
+
47
+ ## Components
48
+
49
+ **Typography** — `Text`, `Heading`, `Link`, `Icon` (with `IconProvider`)
50
+
51
+ **Actions** — `Button`, `CountButton`
52
+
53
+ **Forms** — `Field`, `Input`, `PasswordInput`, `Textarea`, `Select`, `Checkbox`,
54
+ `Radio`, `Switch`, `SegmentedControl`, `SearchField`, `DateTimePicker`
55
+
56
+ **Content** — `Card`, `Avatar`, `AvatarGroup`, `Badge`, `Tag`, `Chip`,
57
+ `ChipGroup`, `ChipBar`, `Divider`, `ListGroup`, `ListItem`, `EmptyState`
58
+
59
+ **Feedback** — `Spinner`, `Skeleton`, `ProgressBar`, `ToastProvider` / `useToast`
60
+
61
+ **Layout** — `Stack`, `Inline`, `Container`, `Screen`, `ScreenContent`
62
+
63
+ **Navigation** — `Tabs`, `TabList`, `Tab`, `TabPanel`, `AppBar`, `TabBar`
64
+
65
+ **Overlays** — `Modal`, `Sheet`, `ConfirmDialog`
66
+
67
+ **Hooks** — `useOverlay`, `usePresence`, `useRovingGroup`, `useFieldContext`,
68
+ `cx`
69
+
70
+ ## Overlays and browser history
71
+
72
+ `Sheet` and `Modal` claim a history entry through `useOverlay`, so the back
73
+ gesture on a phone dismisses the overlay instead of leaving the screen behind
74
+ it. The library owns _when_, not _how_ — it has no router, and reaching for
75
+ `history.pushState` behind one corrupts the router's own index.
76
+
77
+ Supply the mechanism through `OverlayHistoryContext`. It is optional and null by
78
+ default, which is the right value in Storybook and unit tests.
79
+
80
+ ```tsx
81
+ import { OverlayHistoryContext } from "@mond-design-system/react";
82
+ ```
83
+
84
+ ## Icons
85
+
86
+ `Icon` renders whatever you give it. `IconProvider` sets the renderer once, so
87
+ components that draw an icon internally use your icon set rather than one the
88
+ library chose for you.
89
+
90
+ ## Accessibility
91
+
92
+ Focus is one treatment, declared once in the tokens package; components do not
93
+ restyle it. Disabled states are a color change, not opacity — compositing an
94
+ opacity over an arbitrary brand surface has no predictable contrast. Motion
95
+ collapses under `prefers-reduced-motion`, including the literal-duration
96
+ animations.
97
+
98
+ ## License
99
+
100
+ MIT
package/dist/index.cjs CHANGED
@@ -130,8 +130,8 @@ function Icon({ name, size = "md", label, className, ...rest }) {
130
130
  }
131
131
 
132
132
  // mds-cssmod:/home/runner/work/mond-design-system/mond-design-system/packages/react/src/components/Button/Button.module.css?mds-scoped
133
- var Button_module_default = { "button": "mds-Button__button", "size-sm": "mds-Button__size-sm", "size-md": "mds-Button__size-md", "size-lg": "mds-Button__size-lg", "variant-primary": "mds-Button__variant-primary", "variant-secondary": "mds-Button__variant-secondary", "variant-ghost": "mds-Button__variant-ghost", "variant-highlight": "mds-Button__variant-highlight", "variant-danger": "mds-Button__variant-danger", "variant-warning": "mds-Button__variant-warning", "fullWidth": "mds-Button__fullWidth", "icon-only": "mds-Button__icon-only" };
134
- var SPINNER_PX = { sm: 16, md: 18, lg: 20 };
133
+ var Button_module_default = { "button": "mds-Button__button", "size-sm": "mds-Button__size-sm", "size-md": "mds-Button__size-md", "size-lg": "mds-Button__size-lg", "slot": "mds-Button__slot", "variant-primary": "mds-Button__variant-primary", "variant-secondary": "mds-Button__variant-secondary", "variant-ghost": "mds-Button__variant-ghost", "variant-highlight": "mds-Button__variant-highlight", "variant-danger": "mds-Button__variant-danger", "variant-warning": "mds-Button__variant-warning", "fullWidth": "mds-Button__fullWidth", "icon-only": "mds-Button__icon-only" };
134
+ var ICON_PX = { sm: 16, md: 20, lg: 24 };
135
135
  function Button({
136
136
  variant = "primary",
137
137
  size = "md",
@@ -166,9 +166,9 @@ function Button({
166
166
  ...own,
167
167
  ...rest,
168
168
  children: [
169
- loading ? /* @__PURE__ */ jsxRuntime.jsx(Spinner, { size: SPINNER_PX[size], label: "", "aria-hidden": "true" }) : iconLeft,
169
+ loading ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: Button_module_default.slot, children: /* @__PURE__ */ jsxRuntime.jsx(Spinner, { size: ICON_PX[size], label: "", "aria-hidden": "true" }) }) : iconLeft ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: Button_module_default.slot, children: iconLeft }) : null,
170
170
  children,
171
- !loading && iconRight
171
+ !loading && iconRight ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: Button_module_default.slot, children: iconRight }) : null
172
172
  ]
173
173
  }
174
174
  );
@@ -279,7 +279,7 @@ function Badge({ tone = "neutral", className, ...rest }) {
279
279
  }
280
280
 
281
281
  // mds-cssmod:/home/runner/work/mond-design-system/mond-design-system/packages/react/src/components/Chip/Chip.module.css?mds-scoped
282
- var Chip_module_default = { "chip": "mds-Chip__chip", "variant-soft": "mds-Chip__variant-soft", "variant-outline": "mds-Chip__variant-outline", "variant-highlight": "mds-Chip__variant-highlight", "selected": "mds-Chip__selected", "interactive": "mds-Chip__interactive", "disabled": "mds-Chip__disabled" };
282
+ var Chip_module_default = { "chip": "mds-Chip__chip", "icon": "mds-Chip__icon", "variant-soft": "mds-Chip__variant-soft", "variant-outline": "mds-Chip__variant-outline", "variant-highlight": "mds-Chip__variant-highlight", "selected": "mds-Chip__selected", "interactive": "mds-Chip__interactive", "disabled": "mds-Chip__disabled" };
283
283
  function Chip({
284
284
  children,
285
285
  variant = "soft",
@@ -303,7 +303,7 @@ function Chip({
303
303
  ...rest
304
304
  };
305
305
  const content = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
306
- icon,
306
+ icon ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: Chip_module_default.icon, children: icon }) : null,
307
307
  children
308
308
  ] });
309
309
  return interactive ? /* @__PURE__ */ jsxRuntime.jsx(
@@ -347,7 +347,7 @@ function ChipBar({
347
347
 
348
348
  // mds-cssmod:/home/runner/work/mond-design-system/mond-design-system/packages/react/src/components/CountButton/CountButton.module.css?mds-scoped
349
349
  var CountButton_module_default = { "button": "mds-CountButton__button", "tone-accent": "mds-CountButton__tone-accent", "tone-danger": "mds-CountButton__tone-danger", "glyph": "mds-CountButton__glyph" };
350
- var SPINNER_PX2 = 20;
350
+ var SPINNER_PX = 20;
351
351
  function CountButton({
352
352
  icon,
353
353
  label,
@@ -371,7 +371,7 @@ function CountButton({
371
371
  className: cx(CountButton_module_default.button, active && CountButton_module_default[`tone-${tone}`], className),
372
372
  ...rest,
373
373
  children: [
374
- loading ? /* @__PURE__ */ jsxRuntime.jsx(Spinner, { size: SPINNER_PX2, label: "", "aria-hidden": "true" }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: CountButton_module_default.glyph, children: icon }),
374
+ loading ? /* @__PURE__ */ jsxRuntime.jsx(Spinner, { size: SPINNER_PX, label: "", "aria-hidden": "true" }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: CountButton_module_default.glyph, children: icon }),
375
375
  children != null ? /* @__PURE__ */ jsxRuntime.jsx("span", { children }) : null
376
376
  ]
377
377
  }