@mond-design-system/react 4.10.2 → 4.11.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
@@ -1125,16 +1125,21 @@ interface ToastProviderProps {
1125
1125
  */
1126
1126
  declare function ToastProvider({ children, regionLabel, dismissLabel, }: ToastProviderProps): ReactElement;
1127
1127
 
1128
+ /** A component's own props, plus every prop the element it renders takes. */
1129
+ type Polymorphic<T extends ElementType, Own> = Own & {
1130
+ /** Element to render. Default div. */
1131
+ as?: T;
1132
+ } & Omit<ComponentPropsWithRef<T>, keyof Own | "as">;
1133
+
1128
1134
  type StackGap = "hairline" | "tight" | "base" | "loose" | "group" | "section";
1129
1135
  type StackAlign = "start" | "center" | "end" | "stretch";
1130
- interface StackProps extends HTMLAttributes<HTMLElement> {
1136
+ interface StackOwnProps {
1131
1137
  /** Space between children, on the gap scale. Default "base". */
1132
1138
  gap?: StackGap;
1133
1139
  /** Cross-axis alignment. Default "stretch". */
1134
1140
  align?: StackAlign;
1135
- /** Element to render. Default div. */
1136
- as?: ElementType;
1137
1141
  }
1142
+ type StackProps<T extends ElementType = "div"> = Polymorphic<T, StackOwnProps>;
1138
1143
  /**
1139
1144
  * Vertical flow. The parent owns spacing between siblings via gap —
1140
1145
  * children carry no outer margins. Token-bounded on purpose: no arbitrary
@@ -1147,12 +1152,12 @@ interface StackProps extends HTMLAttributes<HTMLElement> {
1147
1152
  * </Stack>
1148
1153
  * ```
1149
1154
  */
1150
- declare function Stack({ gap, align, as, className, ...rest }: StackProps): ReactElement;
1155
+ declare function Stack<T extends ElementType = "div">(props: StackProps<T>): ReactElement;
1151
1156
 
1152
1157
  type InlineGap = "hairline" | "tight" | "base" | "loose";
1153
1158
  type InlineAlign = "start" | "center" | "end" | "baseline";
1154
1159
  type InlineJustify = "start" | "center" | "end" | "between";
1155
- interface InlineProps extends HTMLAttributes<HTMLElement> {
1160
+ interface InlineOwnProps {
1156
1161
  /** Space between children, on the gap scale. Default "base". */
1157
1162
  gap?: InlineGap;
1158
1163
  /** Cross-axis alignment. Default "center". */
@@ -1161,9 +1166,8 @@ interface InlineProps extends HTMLAttributes<HTMLElement> {
1161
1166
  justify?: InlineJustify;
1162
1167
  /** Allow wrapping onto new lines. */
1163
1168
  wrap?: boolean;
1164
- /** Element to render. Default div. */
1165
- as?: ElementType;
1166
1169
  }
1170
+ type InlineProps<T extends ElementType = "div"> = Polymorphic<T, InlineOwnProps>;
1167
1171
  /**
1168
1172
  * Horizontal flow — Stack's row twin. Same token-bounded contract.
1169
1173
  *
@@ -1174,15 +1178,14 @@ interface InlineProps extends HTMLAttributes<HTMLElement> {
1174
1178
  * </Inline>
1175
1179
  * ```
1176
1180
  */
1177
- declare function Inline({ gap, align, justify, wrap, as, className, ...rest }: InlineProps): ReactElement;
1181
+ declare function Inline<T extends ElementType = "div">(props: InlineProps<T>): ReactElement;
1178
1182
 
1179
1183
  type ContainerWidth = "content" | "wide";
1180
- interface ContainerProps extends HTMLAttributes<HTMLElement> {
1184
+ interface ContainerOwnProps {
1181
1185
  /** content = reading column, wide = desktop shell. Default "content". */
1182
1186
  width?: ContainerWidth;
1183
- /** Element to render. Default div. */
1184
- as?: ElementType;
1185
1187
  }
1188
+ type ContainerProps<T extends ElementType = "div"> = Polymorphic<T, ContainerOwnProps>;
1186
1189
  /**
1187
1190
  * Centered max-width column with page-edge padding.
1188
1191
  *
@@ -1192,7 +1195,7 @@ interface ContainerProps extends HTMLAttributes<HTMLElement> {
1192
1195
  * </Container>
1193
1196
  * ```
1194
1197
  */
1195
- declare function Container({ width, as, className, ...rest }: ContainerProps): ReactElement;
1198
+ declare function Container<T extends ElementType = "div">(props: ContainerProps<T>): ReactElement;
1196
1199
 
1197
1200
  type CardVariant = "card" | "raised" | "sunken";
1198
1201
  interface CardProps extends Omit<HTMLAttributes<HTMLElement>, "onClick"> {
package/dist/index.d.ts CHANGED
@@ -1125,16 +1125,21 @@ interface ToastProviderProps {
1125
1125
  */
1126
1126
  declare function ToastProvider({ children, regionLabel, dismissLabel, }: ToastProviderProps): ReactElement;
1127
1127
 
1128
+ /** A component's own props, plus every prop the element it renders takes. */
1129
+ type Polymorphic<T extends ElementType, Own> = Own & {
1130
+ /** Element to render. Default div. */
1131
+ as?: T;
1132
+ } & Omit<ComponentPropsWithRef<T>, keyof Own | "as">;
1133
+
1128
1134
  type StackGap = "hairline" | "tight" | "base" | "loose" | "group" | "section";
1129
1135
  type StackAlign = "start" | "center" | "end" | "stretch";
1130
- interface StackProps extends HTMLAttributes<HTMLElement> {
1136
+ interface StackOwnProps {
1131
1137
  /** Space between children, on the gap scale. Default "base". */
1132
1138
  gap?: StackGap;
1133
1139
  /** Cross-axis alignment. Default "stretch". */
1134
1140
  align?: StackAlign;
1135
- /** Element to render. Default div. */
1136
- as?: ElementType;
1137
1141
  }
1142
+ type StackProps<T extends ElementType = "div"> = Polymorphic<T, StackOwnProps>;
1138
1143
  /**
1139
1144
  * Vertical flow. The parent owns spacing between siblings via gap —
1140
1145
  * children carry no outer margins. Token-bounded on purpose: no arbitrary
@@ -1147,12 +1152,12 @@ interface StackProps extends HTMLAttributes<HTMLElement> {
1147
1152
  * </Stack>
1148
1153
  * ```
1149
1154
  */
1150
- declare function Stack({ gap, align, as, className, ...rest }: StackProps): ReactElement;
1155
+ declare function Stack<T extends ElementType = "div">(props: StackProps<T>): ReactElement;
1151
1156
 
1152
1157
  type InlineGap = "hairline" | "tight" | "base" | "loose";
1153
1158
  type InlineAlign = "start" | "center" | "end" | "baseline";
1154
1159
  type InlineJustify = "start" | "center" | "end" | "between";
1155
- interface InlineProps extends HTMLAttributes<HTMLElement> {
1160
+ interface InlineOwnProps {
1156
1161
  /** Space between children, on the gap scale. Default "base". */
1157
1162
  gap?: InlineGap;
1158
1163
  /** Cross-axis alignment. Default "center". */
@@ -1161,9 +1166,8 @@ interface InlineProps extends HTMLAttributes<HTMLElement> {
1161
1166
  justify?: InlineJustify;
1162
1167
  /** Allow wrapping onto new lines. */
1163
1168
  wrap?: boolean;
1164
- /** Element to render. Default div. */
1165
- as?: ElementType;
1166
1169
  }
1170
+ type InlineProps<T extends ElementType = "div"> = Polymorphic<T, InlineOwnProps>;
1167
1171
  /**
1168
1172
  * Horizontal flow — Stack's row twin. Same token-bounded contract.
1169
1173
  *
@@ -1174,15 +1178,14 @@ interface InlineProps extends HTMLAttributes<HTMLElement> {
1174
1178
  * </Inline>
1175
1179
  * ```
1176
1180
  */
1177
- declare function Inline({ gap, align, justify, wrap, as, className, ...rest }: InlineProps): ReactElement;
1181
+ declare function Inline<T extends ElementType = "div">(props: InlineProps<T>): ReactElement;
1178
1182
 
1179
1183
  type ContainerWidth = "content" | "wide";
1180
- interface ContainerProps extends HTMLAttributes<HTMLElement> {
1184
+ interface ContainerOwnProps {
1181
1185
  /** content = reading column, wide = desktop shell. Default "content". */
1182
1186
  width?: ContainerWidth;
1183
- /** Element to render. Default div. */
1184
- as?: ElementType;
1185
1187
  }
1188
+ type ContainerProps<T extends ElementType = "div"> = Polymorphic<T, ContainerOwnProps>;
1186
1189
  /**
1187
1190
  * Centered max-width column with page-edge padding.
1188
1191
  *
@@ -1192,7 +1195,7 @@ interface ContainerProps extends HTMLAttributes<HTMLElement> {
1192
1195
  * </Container>
1193
1196
  * ```
1194
1197
  */
1195
- declare function Container({ width, as, className, ...rest }: ContainerProps): ReactElement;
1198
+ declare function Container<T extends ElementType = "div">(props: ContainerProps<T>): ReactElement;
1196
1199
 
1197
1200
  type CardVariant = "card" | "raised" | "sunken";
1198
1201
  interface CardProps extends Omit<HTMLAttributes<HTMLElement>, "onClick"> {
package/dist/index.js CHANGED
@@ -1786,13 +1786,14 @@ function ToastProvider({
1786
1786
  var Stack_module_default = { "stack": "mds-Stack__stack", "gap-hairline": "mds-Stack__gap-hairline", "gap-tight": "mds-Stack__gap-tight", "gap-base": "mds-Stack__gap-base", "gap-loose": "mds-Stack__gap-loose", "gap-group": "mds-Stack__gap-group", "gap-section": "mds-Stack__gap-section", "align-start": "mds-Stack__align-start", "align-center": "mds-Stack__align-center", "align-end": "mds-Stack__align-end", "align-stretch": "mds-Stack__align-stretch" };
1787
1787
 
1788
1788
  // src/components/Stack/Stack.tsx
1789
- function Stack({
1790
- gap = "base",
1791
- align = "stretch",
1792
- as = "div",
1793
- className,
1794
- ...rest
1795
- }) {
1789
+ function Stack(props) {
1790
+ const {
1791
+ gap = "base",
1792
+ align = "stretch",
1793
+ as = "div",
1794
+ className,
1795
+ ...rest
1796
+ } = props;
1796
1797
  return createElement(as, {
1797
1798
  className: cx(Stack_module_default.stack, Stack_module_default[`gap-${gap}`], Stack_module_default[`align-${align}`], className),
1798
1799
  ...rest
@@ -1803,15 +1804,16 @@ function Stack({
1803
1804
  var Inline_module_default = { "inline": "mds-Inline__inline", "gap-hairline": "mds-Inline__gap-hairline", "gap-tight": "mds-Inline__gap-tight", "gap-base": "mds-Inline__gap-base", "gap-loose": "mds-Inline__gap-loose", "align-start": "mds-Inline__align-start", "align-center": "mds-Inline__align-center", "align-end": "mds-Inline__align-end", "align-baseline": "mds-Inline__align-baseline", "justify-start": "mds-Inline__justify-start", "justify-center": "mds-Inline__justify-center", "justify-end": "mds-Inline__justify-end", "justify-between": "mds-Inline__justify-between", "wrap": "mds-Inline__wrap" };
1804
1805
 
1805
1806
  // src/components/Inline/Inline.tsx
1806
- function Inline({
1807
- gap = "base",
1808
- align = "center",
1809
- justify = "start",
1810
- wrap = false,
1811
- as = "div",
1812
- className,
1813
- ...rest
1814
- }) {
1807
+ function Inline(props) {
1808
+ const {
1809
+ gap = "base",
1810
+ align = "center",
1811
+ justify = "start",
1812
+ wrap = false,
1813
+ as = "div",
1814
+ className,
1815
+ ...rest
1816
+ } = props;
1815
1817
  return createElement(as, {
1816
1818
  className: cx(
1817
1819
  Inline_module_default.inline,
@@ -1829,12 +1831,8 @@ function Inline({
1829
1831
  var Container_module_default = { "container": "mds-Container__container", "width-content": "mds-Container__width-content", "width-wide": "mds-Container__width-wide" };
1830
1832
 
1831
1833
  // src/components/Container/Container.tsx
1832
- function Container({
1833
- width = "content",
1834
- as = "div",
1835
- className,
1836
- ...rest
1837
- }) {
1834
+ function Container(props) {
1835
+ const { width = "content", as = "div", className, ...rest } = props;
1838
1836
  return createElement(as, {
1839
1837
  className: cx(Container_module_default.container, Container_module_default[`width-${width}`], className),
1840
1838
  ...rest