@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.js CHANGED
@@ -101,14 +101,14 @@ function Spinner({
101
101
  }
102
102
 
103
103
  // mds-cssmod:/home/runner/work/mond-design-system/mond-design-system/packages/react/src/components/Icon/Icon.module.css?mds-scoped
104
- 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" };
104
+ 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" };
105
105
  var IconContext = createContext(null);
106
106
  function IconProvider({ render, children }) {
107
107
  return /* @__PURE__ */ jsx(IconContext.Provider, { value: render, children });
108
108
  }
109
109
  var SIZE_PX = { sm: 16, md: 20, lg: 24 };
110
110
  var warned = /* @__PURE__ */ new Set();
111
- function Icon({ name, size = "md", label, className, ...rest }) {
111
+ function Icon({ name, size, label, className, ...rest }) {
112
112
  const render = useContext(IconContext);
113
113
  if (render === null && !warned.has(name)) {
114
114
  warned.add(name);
@@ -119,17 +119,17 @@ function Icon({ name, size = "md", label, className, ...rest }) {
119
119
  return /* @__PURE__ */ jsx(
120
120
  "span",
121
121
  {
122
- className: cx(Icon_module_default.icon, Icon_module_default[`size-${size}`], className),
122
+ className: cx(Icon_module_default.icon, Icon_module_default[`size-${size ?? "slot"}`], className),
123
123
  ...label ? { role: "img", "aria-label": label } : { "aria-hidden": true },
124
124
  ...rest,
125
- children: render?.(name, { size: SIZE_PX[size] })
125
+ children: render?.(name, { size: size === void 0 ? void 0 : SIZE_PX[size] })
126
126
  }
127
127
  );
128
128
  }
129
129
 
130
130
  // mds-cssmod:/home/runner/work/mond-design-system/mond-design-system/packages/react/src/components/Button/Button.module.css?mds-scoped
131
- 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" };
132
- var SPINNER_PX = { sm: 16, md: 18, lg: 20 };
131
+ 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" };
132
+ var ICON_PX = { sm: 16, md: 20, lg: 24 };
133
133
  function Button({
134
134
  variant = "primary",
135
135
  size = "md",
@@ -164,9 +164,9 @@ function Button({
164
164
  ...own,
165
165
  ...rest,
166
166
  children: [
167
- loading ? /* @__PURE__ */ jsx(Spinner, { size: SPINNER_PX[size], label: "", "aria-hidden": "true" }) : iconLeft,
167
+ loading ? /* @__PURE__ */ jsx("span", { className: Button_module_default.slot, children: /* @__PURE__ */ jsx(Spinner, { size: ICON_PX[size], label: "", "aria-hidden": "true" }) }) : iconLeft ? /* @__PURE__ */ jsx("span", { className: Button_module_default.slot, children: iconLeft }) : null,
168
168
  children,
169
- !loading && iconRight
169
+ !loading && iconRight ? /* @__PURE__ */ jsx("span", { className: Button_module_default.slot, children: iconRight }) : null
170
170
  ]
171
171
  }
172
172
  );
@@ -277,7 +277,7 @@ function Badge({ tone = "neutral", className, ...rest }) {
277
277
  }
278
278
 
279
279
  // mds-cssmod:/home/runner/work/mond-design-system/mond-design-system/packages/react/src/components/Chip/Chip.module.css?mds-scoped
280
- 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" };
280
+ 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" };
281
281
  function Chip({
282
282
  children,
283
283
  variant = "soft",
@@ -301,7 +301,7 @@ function Chip({
301
301
  ...rest
302
302
  };
303
303
  const content = /* @__PURE__ */ jsxs(Fragment, { children: [
304
- icon,
304
+ icon ? /* @__PURE__ */ jsx("span", { className: Chip_module_default.icon, children: icon }) : null,
305
305
  children
306
306
  ] });
307
307
  return interactive ? /* @__PURE__ */ jsx(
@@ -345,7 +345,7 @@ function ChipBar({
345
345
 
346
346
  // mds-cssmod:/home/runner/work/mond-design-system/mond-design-system/packages/react/src/components/CountButton/CountButton.module.css?mds-scoped
347
347
  var CountButton_module_default = { "button": "mds-CountButton__button", "tone-accent": "mds-CountButton__tone-accent", "tone-danger": "mds-CountButton__tone-danger", "glyph": "mds-CountButton__glyph" };
348
- var SPINNER_PX2 = 20;
348
+ var SPINNER_PX = 20;
349
349
  function CountButton({
350
350
  icon,
351
351
  label,
@@ -369,7 +369,7 @@ function CountButton({
369
369
  className: cx(CountButton_module_default.button, active && CountButton_module_default[`tone-${tone}`], className),
370
370
  ...rest,
371
371
  children: [
372
- loading ? /* @__PURE__ */ jsx(Spinner, { size: SPINNER_PX2, label: "", "aria-hidden": "true" }) : /* @__PURE__ */ jsx("span", { className: CountButton_module_default.glyph, children: icon }),
372
+ /* @__PURE__ */ jsx("span", { className: CountButton_module_default.glyph, children: loading ? /* @__PURE__ */ jsx(Spinner, { size: SPINNER_PX, label: "", "aria-hidden": "true" }) : icon }),
373
373
  children != null ? /* @__PURE__ */ jsx("span", { children }) : null
374
374
  ]
375
375
  }