@mond-design-system/react 4.7.0 → 4.9.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/README.md CHANGED
@@ -51,7 +51,8 @@ Dark mode is `data-theme="dark"` on `<html>`. Nothing else changes.
51
51
  **Actions** — `Button`, `CountButton`
52
52
 
53
53
  **Forms** — `Field`, `Input`, `PasswordInput`, `Textarea`, `Select`, `Checkbox`,
54
- `Radio`, `Switch`, `SegmentedControl`, `SearchField`, `DateTimePicker`
54
+ `Radio`, `Switch`, `SegmentedControl`, `SearchField`, `DateTimePicker`,
55
+ `FileDrop`
55
56
 
56
57
  **Content** — `Card`, `Avatar`, `AvatarGroup`, `Badge`, `Tag`, `Chip`,
57
58
  `ChipGroup`, `ChipBar`, `Divider`, `ListGroup`, `ListItem`, `EmptyState`
@@ -60,7 +61,7 @@ Dark mode is `data-theme="dark"` on `<html>`. Nothing else changes.
60
61
 
61
62
  **Layout** — `Stack`, `Inline`, `Container`, `Screen`, `ScreenContent`
62
63
 
63
- **Navigation** — `Tabs`, `TabList`, `Tab`, `TabPanel`, `AppBar`, `TabBar`
64
+ **Navigation** — `Tabs`, `TabList`, `Tab`, `TabPanel`, `AppBar`, `TabBar`, `SideNav`
64
65
 
65
66
  **Overlays** — `Modal`, `Sheet`, `ConfirmDialog`
66
67
 
package/dist/index.cjs CHANGED
@@ -1944,6 +1944,59 @@ function TabBarAction({ label, icon, onClick }) {
1944
1944
  return /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", "aria-label": label, className: TabBar_module_default.action, onClick, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: TabBar_module_default.icon, "aria-hidden": "true", children: icon }) });
1945
1945
  }
1946
1946
 
1947
+ // mds-cssmod:/home/runner/work/mond-design-system/mond-design-system/packages/react/src/components/SideNav/SideNav.module.css?mds-scoped
1948
+ var SideNav_module_default = { "nav": "mds-SideNav__nav", "group": "mds-SideNav__group", "heading": "mds-SideNav__heading", "item": "mds-SideNav__item", "active": "mds-SideNav__active", "icon": "mds-SideNav__icon", "label": "mds-SideNav__label", "count": "mds-SideNav__count" };
1949
+ function SideNav({ label, className, children, ref, ...rest }) {
1950
+ return /* @__PURE__ */ jsxRuntime.jsx("nav", { ref, "aria-label": label, className: cx(SideNav_module_default.nav, className), ...rest, children });
1951
+ }
1952
+ function SideNavGroup({
1953
+ label,
1954
+ className,
1955
+ children,
1956
+ ref,
1957
+ ...rest
1958
+ }) {
1959
+ const headingId = react.useId();
1960
+ return /* @__PURE__ */ jsxRuntime.jsxs(
1961
+ "div",
1962
+ {
1963
+ ref,
1964
+ className: cx(SideNav_module_default.group, className),
1965
+ role: label != null ? "group" : void 0,
1966
+ "aria-labelledby": label != null ? headingId : void 0,
1967
+ ...rest,
1968
+ children: [
1969
+ label != null && /* @__PURE__ */ jsxRuntime.jsx("span", { className: SideNav_module_default.heading, id: headingId, children: label }),
1970
+ children
1971
+ ]
1972
+ }
1973
+ );
1974
+ }
1975
+ function SideNavItem({
1976
+ label,
1977
+ icon,
1978
+ href,
1979
+ onClick,
1980
+ active = false,
1981
+ count,
1982
+ countLabel,
1983
+ max = 99,
1984
+ as
1985
+ }) {
1986
+ const className = cx(SideNav_module_default.item, active && SideNav_module_default.active);
1987
+ const current = active ? "page" : void 0;
1988
+ const content = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1989
+ icon != null && /* @__PURE__ */ jsxRuntime.jsx("span", { className: SideNav_module_default.icon, "aria-hidden": "true", children: icon }),
1990
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: SideNav_module_default.label, children: label }),
1991
+ count !== void 0 && count > 0 && /* @__PURE__ */ jsxRuntime.jsx(Badge, { tone: "accent", role: "status", "aria-label": countLabel, className: SideNav_module_default.count, children: count > max ? `${max}+` : count })
1992
+ ] });
1993
+ if (href !== void 0) {
1994
+ const Element = as ?? "a";
1995
+ return /* @__PURE__ */ jsxRuntime.jsx(Element, { href, className, "aria-current": current, onClick, children: content });
1996
+ }
1997
+ return /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className, "aria-current": current, onClick, children: content });
1998
+ }
1999
+
1947
2000
  // mds-cssmod:/home/runner/work/mond-design-system/mond-design-system/packages/react/src/components/MediaPlaceholder/MediaPlaceholder.module.css?mds-scoped
1948
2001
  var MediaPlaceholder_module_default = { "media": "mds-MediaPlaceholder__media", "fill": "mds-MediaPlaceholder__fill", "image": "mds-MediaPlaceholder__image", "caption": "mds-MediaPlaceholder__caption", "cover": "mds-MediaPlaceholder__cover", "blurred": "mds-MediaPlaceholder__blurred" };
1949
2002
  function MediaPlaceholder({
@@ -2218,6 +2271,80 @@ function UploadProgress({
2218
2271
  ] });
2219
2272
  }
2220
2273
 
2274
+ // mds-cssmod:/home/runner/work/mond-design-system/mond-design-system/packages/react/src/components/FileDrop/FileDrop.module.css?mds-scoped
2275
+ var FileDrop_module_default = { "drop": "mds-FileDrop__drop", "target": "mds-FileDrop__target", "over": "mds-FileDrop__over", "icon": "mds-FileDrop__icon", "picker": "mds-FileDrop__picker" };
2276
+ function FileDrop({
2277
+ label,
2278
+ hint,
2279
+ icon,
2280
+ accept,
2281
+ multiple = false,
2282
+ disabled = false,
2283
+ onFiles,
2284
+ className,
2285
+ ref,
2286
+ ...rest
2287
+ }) {
2288
+ const picker = react.useRef(null);
2289
+ const [over, setOver] = react.useState(false);
2290
+ const take = (list) => {
2291
+ if (disabled || list === null || list.length === 0) return;
2292
+ const files = [...list];
2293
+ onFiles(multiple ? files : files.slice(0, 1));
2294
+ };
2295
+ const dropped = (event) => {
2296
+ event.preventDefault();
2297
+ setOver(false);
2298
+ take(event.dataTransfer.files);
2299
+ };
2300
+ return /* @__PURE__ */ jsxRuntime.jsxs(
2301
+ "div",
2302
+ {
2303
+ className: cx(FileDrop_module_default.drop, over && FileDrop_module_default.over, className),
2304
+ ref,
2305
+ onDragOver: (event) => {
2306
+ event.preventDefault();
2307
+ setOver(!disabled);
2308
+ },
2309
+ onDragLeave: () => setOver(false),
2310
+ onDrop: dropped,
2311
+ ...rest,
2312
+ children: [
2313
+ /* @__PURE__ */ jsxRuntime.jsxs(
2314
+ "button",
2315
+ {
2316
+ type: "button",
2317
+ className: FileDrop_module_default.target,
2318
+ disabled,
2319
+ onClick: () => picker.current?.click(),
2320
+ children: [
2321
+ icon !== void 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: FileDrop_module_default.icon, children: icon }),
2322
+ /* @__PURE__ */ jsxRuntime.jsx(Text, { variant: "label", children: label }),
2323
+ hint !== void 0 && /* @__PURE__ */ jsxRuntime.jsx(Text, { variant: "meta", children: hint })
2324
+ ]
2325
+ }
2326
+ ),
2327
+ /* @__PURE__ */ jsxRuntime.jsx(
2328
+ "input",
2329
+ {
2330
+ type: "file",
2331
+ className: FileDrop_module_default.picker,
2332
+ ref: picker,
2333
+ tabIndex: -1,
2334
+ "aria-hidden": "true",
2335
+ multiple,
2336
+ ...accept === void 0 ? {} : { accept },
2337
+ onChange: (event) => {
2338
+ take(event.target.files);
2339
+ event.target.value = "";
2340
+ }
2341
+ }
2342
+ )
2343
+ ]
2344
+ }
2345
+ );
2346
+ }
2347
+
2221
2348
  // mds-cssmod:/home/runner/work/mond-design-system/mond-design-system/packages/react/src/components/Lightbox/Lightbox.module.css?mds-scoped
2222
2349
  var Lightbox_module_default = { "panel": "mds-Lightbox__panel", "bar": "mds-Lightbox__bar", "surface": "mds-Lightbox__surface", "image": "mds-Lightbox__image", "caption": "mds-Lightbox__caption" };
2223
2350
  var MIN_SCALE = 1;
@@ -2632,6 +2759,7 @@ exports.DateTimePicker = DateTimePicker;
2632
2759
  exports.Divider = Divider;
2633
2760
  exports.EmptyState = EmptyState;
2634
2761
  exports.Field = Field;
2762
+ exports.FileDrop = FileDrop;
2635
2763
  exports.Heading = Heading;
2636
2764
  exports.Icon = Icon;
2637
2765
  exports.IconProvider = IconProvider;
@@ -2660,6 +2788,9 @@ exports.Sheet = Sheet;
2660
2788
  exports.SheetBody = SheetBody;
2661
2789
  exports.SheetFooter = SheetFooter;
2662
2790
  exports.SheetHeader = SheetHeader;
2791
+ exports.SideNav = SideNav;
2792
+ exports.SideNavGroup = SideNavGroup;
2793
+ exports.SideNavItem = SideNavItem;
2663
2794
  exports.Skeleton = Skeleton;
2664
2795
  exports.Spinner = Spinner;
2665
2796
  exports.Stack = Stack;