@mond-design-system/react 1.1.0 → 3.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/dist/index.cjs CHANGED
@@ -103,14 +103,14 @@ function Spinner({
103
103
  }
104
104
 
105
105
  // mds-cssmod:/home/runner/work/mond-design-system/mond-design-system/packages/react/src/components/Icon/Icon.module.css?mds-scoped
106
- var Icon_module_default = { "icon": "mds-Icon__icon", "size-sm": "mds-Icon__size-sm", "size-md": "mds-Icon__size-md", "size-lg": "mds-Icon__size-lg" };
106
+ var Icon_module_default = { "icon": "mds-Icon__icon", "size-slot": "mds-Icon__size-slot", "size-sm": "mds-Icon__size-sm", "size-md": "mds-Icon__size-md", "size-lg": "mds-Icon__size-lg" };
107
107
  var IconContext = react.createContext(null);
108
108
  function IconProvider({ render, children }) {
109
109
  return /* @__PURE__ */ jsxRuntime.jsx(IconContext.Provider, { value: render, children });
110
110
  }
111
111
  var SIZE_PX = { sm: 16, md: 20, lg: 24 };
112
112
  var warned = /* @__PURE__ */ new Set();
113
- function Icon({ name, size = "md", label, className, ...rest }) {
113
+ function Icon({ name, size, label, className, ...rest }) {
114
114
  const render = react.useContext(IconContext);
115
115
  if (render === null && !warned.has(name)) {
116
116
  warned.add(name);
@@ -121,17 +121,17 @@ function Icon({ name, size = "md", label, className, ...rest }) {
121
121
  return /* @__PURE__ */ jsxRuntime.jsx(
122
122
  "span",
123
123
  {
124
- className: cx(Icon_module_default.icon, Icon_module_default[`size-${size}`], className),
124
+ className: cx(Icon_module_default.icon, Icon_module_default[`size-${size ?? "slot"}`], className),
125
125
  ...label ? { role: "img", "aria-label": label } : { "aria-hidden": true },
126
126
  ...rest,
127
- children: render?.(name, { size: SIZE_PX[size] })
127
+ children: render?.(name, { size: size === void 0 ? void 0 : SIZE_PX[size] })
128
128
  }
129
129
  );
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
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: CountButton_module_default.glyph, children: loading ? /* @__PURE__ */ jsxRuntime.jsx(Spinner, { size: SPINNER_PX, label: "", "aria-hidden": "true" }) : icon }),
375
375
  children != null ? /* @__PURE__ */ jsxRuntime.jsx("span", { children }) : null
376
376
  ]
377
377
  }