@marigold/system 11.4.1 → 12.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.d.mts CHANGED
@@ -1,6 +1,6 @@
1
- import React$1, { ReactNode } from 'react';
1
+ import React$1, { Context, ReactNode } from 'react';
2
2
  import { HtmlProps, KebabCase } from '@marigold/types';
3
- import { DateFormatterOptions } from '@react-aria/i18n';
3
+ import { DateFormatterOptions, useNumberFormatter } from '@react-aria/i18n';
4
4
  import { ClassValue, StringToBoolean, ClassProp } from 'class-variance-authority/dist/types';
5
5
  export { ClassValue } from 'class-variance-authority/dist/types';
6
6
  export { VariantProps } from 'class-variance-authority';
@@ -30,11 +30,13 @@ interface DateFormatProps extends DateFormatterOptions {
30
30
  }
31
31
  declare const DateFormat: ({ value, tabular, ...props }: DateFormatProps) => React$1.JSX.Element;
32
32
 
33
- interface NumericFormatProps extends Intl.NumberFormatOptions {
33
+ type NumerFormatterOptions = NonNullable<Parameters<typeof useNumberFormatter>[0]>;
34
+ type StringNumericLiteral = `${number}` | 'Infinity' | '-Infinity' | '+Infinity';
35
+ interface NumericFormatProps extends NumerFormatterOptions {
34
36
  /**
35
37
  * Value to be formatted.
36
38
  */
37
- value: number | bigint;
39
+ value: number | bigint | StringNumericLiteral | [number, number] | [bigint, bigint] | [StringNumericLiteral, StringNumericLiteral];
38
40
  /**
39
41
  * The numberingSystem accessor property of Intl.Locale instances returns the numeral system for this locale.
40
42
  */
@@ -124,6 +126,7 @@ type Theme = {
124
126
  Body?: ComponentStyleFunction<string, string>;
125
127
  Button?: ComponentStyleFunction<string, string>;
126
128
  Card?: ComponentStyleFunction<string, string>;
129
+ CloseButton?: ComponentStyleFunction<string, string>;
127
130
  DateField?: Record<'segment' | 'field' | 'action', ComponentStyleFunction<string, string>>;
128
131
  Dialog?: Record<'closeButton' | 'container' | 'header' | 'content' | 'actions' | 'title', ComponentStyleFunction<string, string>>;
129
132
  Divider?: ComponentStyleFunction<string, string>;
@@ -144,6 +147,7 @@ type Theme = {
144
147
  Link?: ComponentStyleFunction<string, string>;
145
148
  ListBox?: Record<'container' | 'list' | 'item' | 'section' | 'header', ComponentStyleFunction<string, string>>;
146
149
  Menu?: Record<'container' | 'section' | 'item', ComponentStyleFunction<string, string>>;
150
+ Modal?: ComponentStyleFunction<string, string>;
147
151
  MultiSelect?: Record<'container' | 'closeButton' | 'field' | 'input' | 'icon' | 'listContainer' | 'list' | 'option' | 'tag' | 'valueContainer', ComponentStyleFunction<string, string>>;
148
152
  Pagination?: Record<'navigationButton' | 'pageButton' | 'icon', ComponentStyleFunction<string, string>>;
149
153
  ProgressCycle?: ComponentStyleFunction<string, string>;
@@ -169,6 +173,11 @@ type ComponentNames = keyof Theme['components'];
169
173
  type ThemeComponent<C extends ComponentNames> = NonNullable<Theme['components'][C]>;
170
174
  type ThemeComponentParts<C extends ComponentNames> = keyof ThemeComponent<C>;
171
175
 
176
+ interface ComponentContextProps {
177
+ size?: string;
178
+ variant?: string;
179
+ [key: string]: any;
180
+ }
172
181
  interface UseClassNamesProps<C extends ComponentNames> {
173
182
  component: C;
174
183
  variant?: string;
@@ -176,11 +185,12 @@ interface UseClassNamesProps<C extends ComponentNames> {
176
185
  className?: ThemeComponent<C> extends (...args: any) => any ? string : {
177
186
  [slot in keyof ThemeComponent<C>]?: string;
178
187
  };
188
+ context?: Context<ComponentContextProps>;
179
189
  }
180
190
  type ComponentClassNames<C extends ComponentNames> = ThemeComponent<C> extends (...args: any) => any ? string : {
181
191
  [slot in keyof ThemeComponent<C>]: string;
182
192
  };
183
- declare const useClassNames: <C extends ComponentNames>({ component, className, variant, size, }: UseClassNamesProps<C>) => ComponentClassNames<C>;
193
+ declare const useClassNames: <C extends ComponentNames>({ component, className, variant, size, context: ComponentContext, }: UseClassNamesProps<C>) => ComponentClassNames<C>;
184
194
 
185
195
  /**
186
196
  * Hook that can be used to return values based on the current screen size,
@@ -233,6 +243,7 @@ declare const extendTheme: (newStyles: StylesProps, theme: Theme) => {
233
243
  Body?: ComponentStyleFunction<string, string>;
234
244
  Button?: ComponentStyleFunction<string, string>;
235
245
  Card?: ComponentStyleFunction<string, string>;
246
+ CloseButton?: ComponentStyleFunction<string, string>;
236
247
  DateField?: Record<"segment" | "field" | "action", ComponentStyleFunction<string, string>>;
237
248
  Dialog?: Record<"closeButton" | "container" | "header" | "content" | "actions" | "title", ComponentStyleFunction<string, string>>;
238
249
  Divider?: ComponentStyleFunction<string, string>;
@@ -253,6 +264,7 @@ declare const extendTheme: (newStyles: StylesProps, theme: Theme) => {
253
264
  Link?: ComponentStyleFunction<string, string>;
254
265
  ListBox?: Record<"container" | "list" | "item" | "section" | "header", ComponentStyleFunction<string, string>>;
255
266
  Menu?: Record<"container" | "section" | "item", ComponentStyleFunction<string, string>>;
267
+ Modal?: ComponentStyleFunction<string, string>;
256
268
  MultiSelect?: Record<"container" | "closeButton" | "field" | "input" | "icon" | "listContainer" | "list" | "option" | "tag" | "valueContainer", ComponentStyleFunction<string, string>>;
257
269
  Pagination?: Record<"navigationButton" | "pageButton" | "icon", ComponentStyleFunction<string, string>>;
258
270
  ProgressCycle?: ComponentStyleFunction<string, string>;
@@ -366,6 +378,77 @@ declare const width: {
366
378
  '10/12': string;
367
379
  '11/12': string;
368
380
  };
381
+ declare const maxWidth: {
382
+ auto: string;
383
+ full: string;
384
+ fit: string;
385
+ min: string;
386
+ max: string;
387
+ screen: string;
388
+ svh: string;
389
+ lvh: string;
390
+ dvh: string;
391
+ px: string;
392
+ 0: string;
393
+ '0.5': string;
394
+ 1: string;
395
+ '1.5': string;
396
+ 2: string;
397
+ '2.5': string;
398
+ 3: string;
399
+ '3.5': string;
400
+ 4: string;
401
+ 5: string;
402
+ 6: string;
403
+ 7: string;
404
+ 8: string;
405
+ 9: string;
406
+ 10: string;
407
+ 11: string;
408
+ 12: string;
409
+ 14: string;
410
+ 16: string;
411
+ 20: string;
412
+ 24: string;
413
+ 28: string;
414
+ 32: string;
415
+ 36: string;
416
+ 40: string;
417
+ 44: string;
418
+ 48: string;
419
+ 52: string;
420
+ 56: string;
421
+ 60: string;
422
+ 64: string;
423
+ 72: string;
424
+ 80: string;
425
+ 96: string;
426
+ '1/2': string;
427
+ '1/3': string;
428
+ '2/3': string;
429
+ '1/4': string;
430
+ '2/4': string;
431
+ '3/4': string;
432
+ '1/5': string;
433
+ '2/5': string;
434
+ '3/5': string;
435
+ '1/6': string;
436
+ '2/6': string;
437
+ '3/6': string;
438
+ '4/6': string;
439
+ '5/6': string;
440
+ '1/12': string;
441
+ '2/12': string;
442
+ '3/12': string;
443
+ '4/12': string;
444
+ '5/12': string;
445
+ '6/12': string;
446
+ '7/12': string;
447
+ '8/12': string;
448
+ '9/12': string;
449
+ '10/12': string;
450
+ '11/12': string;
451
+ };
369
452
  declare const height: {
370
453
  auto: string;
371
454
  full: string;
@@ -960,10 +1043,16 @@ type TextAlignProp = {
960
1043
  };
961
1044
  type WidthProp = {
962
1045
  /**
963
- * Sets the width of the field. You can see allowed tokens [here](https://tailwindcss.com/docs/width).
1046
+ * Sets the width of the element. You can see allowed tokens [here](https://tailwindcss.com/docs/width).
964
1047
  */
965
1048
  width?: keyof typeof width;
966
1049
  };
1050
+ type MaxWidthProp = {
1051
+ /**
1052
+ * Sets the max-width of the element. You can see allowed tokens [here](https://tailwindcss.com/docs/max-width).
1053
+ */
1054
+ maxWidth?: keyof typeof maxWidth;
1055
+ };
967
1056
  type HeightProp = {
968
1057
  /**
969
1058
  * Set the height of the element. You can see allowed tokens [here](https://tailwindcss.com/docs/height).
@@ -971,4 +1060,4 @@ type HeightProp = {
971
1060
  height?: keyof typeof height;
972
1061
  };
973
1062
 
974
- export { type AlignmentProp, type AspectProp, type ComponentClassNames, type ComponentNames, type ComponentState, type ComponentStyleFunction, type Config, type ConfigSchema, type ConfigVariants, type ConfigVariantsMulti, type CursorProp, DateFormat, type FontSizeProp, type FontStyleProp, type FontWeightProp, type GapSpaceProp, type HeightProp, type NestedStringObject, NumericFormat, type ObjectFitProp, type ObjectPositionProp, type PaddingBottomProp, type PaddingLeftProp, type PaddingRightProp, type PaddingSpaceProp, type PaddingSpacePropX, type PaddingSpacePropY, type PaddingTopProp, type PlaceItemsProp, type Props, SVG, type SVGProps, type StateAttrKeyProps, type StateAttrProps, type StylesProps, type TextAlignProp, type Theme, type ThemeComponent, type ThemeComponentParts, ThemeProvider, type ThemeProviderProps, type UseClassNamesProps, type UseStateProps, type WidthProp, alignment, aspect, cn, createVar, cursorStyle, cva, defaultTheme, ensureCssVar, extendTheme, fontWeight, gapSpace, get, height, isValidCssCustomPropertyName, objectFit, objectPosition, paddingBottom, paddingLeft, paddingRight, paddingSpace, paddingSpaceX, paddingSpaceY, paddingTop, placeItems, textAlign, textSize, textStyle, useClassNames, useResponsiveValue, useSmallScreen, useStateProps, useTheme, width };
1063
+ export { type AlignmentProp, type AspectProp, type ComponentClassNames, type ComponentNames, type ComponentState, type ComponentStyleFunction, type Config, type ConfigSchema, type ConfigVariants, type ConfigVariantsMulti, type CursorProp, DateFormat, type FontSizeProp, type FontStyleProp, type FontWeightProp, type GapSpaceProp, type HeightProp, type MaxWidthProp, type NestedStringObject, type NumerFormatterOptions, NumericFormat, type ObjectFitProp, type ObjectPositionProp, type PaddingBottomProp, type PaddingLeftProp, type PaddingRightProp, type PaddingSpaceProp, type PaddingSpacePropX, type PaddingSpacePropY, type PaddingTopProp, type PlaceItemsProp, type Props, SVG, type SVGProps, type StateAttrKeyProps, type StateAttrProps, type StylesProps, type TextAlignProp, type Theme, type ThemeComponent, type ThemeComponentParts, ThemeProvider, type ThemeProviderProps, type UseClassNamesProps, type UseStateProps, type WidthProp, alignment, aspect, cn, createVar, cursorStyle, cva, defaultTheme, ensureCssVar, extendTheme, fontWeight, gapSpace, get, height, isValidCssCustomPropertyName, maxWidth, objectFit, objectPosition, paddingBottom, paddingLeft, paddingRight, paddingSpace, paddingSpaceX, paddingSpaceY, paddingTop, placeItems, textAlign, textSize, textStyle, useClassNames, useResponsiveValue, useSmallScreen, useStateProps, useTheme, width };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import React$1, { ReactNode } from 'react';
1
+ import React$1, { Context, ReactNode } from 'react';
2
2
  import { HtmlProps, KebabCase } from '@marigold/types';
3
- import { DateFormatterOptions } from '@react-aria/i18n';
3
+ import { DateFormatterOptions, useNumberFormatter } from '@react-aria/i18n';
4
4
  import { ClassValue, StringToBoolean, ClassProp } from 'class-variance-authority/dist/types';
5
5
  export { ClassValue } from 'class-variance-authority/dist/types';
6
6
  export { VariantProps } from 'class-variance-authority';
@@ -30,11 +30,13 @@ interface DateFormatProps extends DateFormatterOptions {
30
30
  }
31
31
  declare const DateFormat: ({ value, tabular, ...props }: DateFormatProps) => React$1.JSX.Element;
32
32
 
33
- interface NumericFormatProps extends Intl.NumberFormatOptions {
33
+ type NumerFormatterOptions = NonNullable<Parameters<typeof useNumberFormatter>[0]>;
34
+ type StringNumericLiteral = `${number}` | 'Infinity' | '-Infinity' | '+Infinity';
35
+ interface NumericFormatProps extends NumerFormatterOptions {
34
36
  /**
35
37
  * Value to be formatted.
36
38
  */
37
- value: number | bigint;
39
+ value: number | bigint | StringNumericLiteral | [number, number] | [bigint, bigint] | [StringNumericLiteral, StringNumericLiteral];
38
40
  /**
39
41
  * The numberingSystem accessor property of Intl.Locale instances returns the numeral system for this locale.
40
42
  */
@@ -124,6 +126,7 @@ type Theme = {
124
126
  Body?: ComponentStyleFunction<string, string>;
125
127
  Button?: ComponentStyleFunction<string, string>;
126
128
  Card?: ComponentStyleFunction<string, string>;
129
+ CloseButton?: ComponentStyleFunction<string, string>;
127
130
  DateField?: Record<'segment' | 'field' | 'action', ComponentStyleFunction<string, string>>;
128
131
  Dialog?: Record<'closeButton' | 'container' | 'header' | 'content' | 'actions' | 'title', ComponentStyleFunction<string, string>>;
129
132
  Divider?: ComponentStyleFunction<string, string>;
@@ -144,6 +147,7 @@ type Theme = {
144
147
  Link?: ComponentStyleFunction<string, string>;
145
148
  ListBox?: Record<'container' | 'list' | 'item' | 'section' | 'header', ComponentStyleFunction<string, string>>;
146
149
  Menu?: Record<'container' | 'section' | 'item', ComponentStyleFunction<string, string>>;
150
+ Modal?: ComponentStyleFunction<string, string>;
147
151
  MultiSelect?: Record<'container' | 'closeButton' | 'field' | 'input' | 'icon' | 'listContainer' | 'list' | 'option' | 'tag' | 'valueContainer', ComponentStyleFunction<string, string>>;
148
152
  Pagination?: Record<'navigationButton' | 'pageButton' | 'icon', ComponentStyleFunction<string, string>>;
149
153
  ProgressCycle?: ComponentStyleFunction<string, string>;
@@ -169,6 +173,11 @@ type ComponentNames = keyof Theme['components'];
169
173
  type ThemeComponent<C extends ComponentNames> = NonNullable<Theme['components'][C]>;
170
174
  type ThemeComponentParts<C extends ComponentNames> = keyof ThemeComponent<C>;
171
175
 
176
+ interface ComponentContextProps {
177
+ size?: string;
178
+ variant?: string;
179
+ [key: string]: any;
180
+ }
172
181
  interface UseClassNamesProps<C extends ComponentNames> {
173
182
  component: C;
174
183
  variant?: string;
@@ -176,11 +185,12 @@ interface UseClassNamesProps<C extends ComponentNames> {
176
185
  className?: ThemeComponent<C> extends (...args: any) => any ? string : {
177
186
  [slot in keyof ThemeComponent<C>]?: string;
178
187
  };
188
+ context?: Context<ComponentContextProps>;
179
189
  }
180
190
  type ComponentClassNames<C extends ComponentNames> = ThemeComponent<C> extends (...args: any) => any ? string : {
181
191
  [slot in keyof ThemeComponent<C>]: string;
182
192
  };
183
- declare const useClassNames: <C extends ComponentNames>({ component, className, variant, size, }: UseClassNamesProps<C>) => ComponentClassNames<C>;
193
+ declare const useClassNames: <C extends ComponentNames>({ component, className, variant, size, context: ComponentContext, }: UseClassNamesProps<C>) => ComponentClassNames<C>;
184
194
 
185
195
  /**
186
196
  * Hook that can be used to return values based on the current screen size,
@@ -233,6 +243,7 @@ declare const extendTheme: (newStyles: StylesProps, theme: Theme) => {
233
243
  Body?: ComponentStyleFunction<string, string>;
234
244
  Button?: ComponentStyleFunction<string, string>;
235
245
  Card?: ComponentStyleFunction<string, string>;
246
+ CloseButton?: ComponentStyleFunction<string, string>;
236
247
  DateField?: Record<"segment" | "field" | "action", ComponentStyleFunction<string, string>>;
237
248
  Dialog?: Record<"closeButton" | "container" | "header" | "content" | "actions" | "title", ComponentStyleFunction<string, string>>;
238
249
  Divider?: ComponentStyleFunction<string, string>;
@@ -253,6 +264,7 @@ declare const extendTheme: (newStyles: StylesProps, theme: Theme) => {
253
264
  Link?: ComponentStyleFunction<string, string>;
254
265
  ListBox?: Record<"container" | "list" | "item" | "section" | "header", ComponentStyleFunction<string, string>>;
255
266
  Menu?: Record<"container" | "section" | "item", ComponentStyleFunction<string, string>>;
267
+ Modal?: ComponentStyleFunction<string, string>;
256
268
  MultiSelect?: Record<"container" | "closeButton" | "field" | "input" | "icon" | "listContainer" | "list" | "option" | "tag" | "valueContainer", ComponentStyleFunction<string, string>>;
257
269
  Pagination?: Record<"navigationButton" | "pageButton" | "icon", ComponentStyleFunction<string, string>>;
258
270
  ProgressCycle?: ComponentStyleFunction<string, string>;
@@ -366,6 +378,77 @@ declare const width: {
366
378
  '10/12': string;
367
379
  '11/12': string;
368
380
  };
381
+ declare const maxWidth: {
382
+ auto: string;
383
+ full: string;
384
+ fit: string;
385
+ min: string;
386
+ max: string;
387
+ screen: string;
388
+ svh: string;
389
+ lvh: string;
390
+ dvh: string;
391
+ px: string;
392
+ 0: string;
393
+ '0.5': string;
394
+ 1: string;
395
+ '1.5': string;
396
+ 2: string;
397
+ '2.5': string;
398
+ 3: string;
399
+ '3.5': string;
400
+ 4: string;
401
+ 5: string;
402
+ 6: string;
403
+ 7: string;
404
+ 8: string;
405
+ 9: string;
406
+ 10: string;
407
+ 11: string;
408
+ 12: string;
409
+ 14: string;
410
+ 16: string;
411
+ 20: string;
412
+ 24: string;
413
+ 28: string;
414
+ 32: string;
415
+ 36: string;
416
+ 40: string;
417
+ 44: string;
418
+ 48: string;
419
+ 52: string;
420
+ 56: string;
421
+ 60: string;
422
+ 64: string;
423
+ 72: string;
424
+ 80: string;
425
+ 96: string;
426
+ '1/2': string;
427
+ '1/3': string;
428
+ '2/3': string;
429
+ '1/4': string;
430
+ '2/4': string;
431
+ '3/4': string;
432
+ '1/5': string;
433
+ '2/5': string;
434
+ '3/5': string;
435
+ '1/6': string;
436
+ '2/6': string;
437
+ '3/6': string;
438
+ '4/6': string;
439
+ '5/6': string;
440
+ '1/12': string;
441
+ '2/12': string;
442
+ '3/12': string;
443
+ '4/12': string;
444
+ '5/12': string;
445
+ '6/12': string;
446
+ '7/12': string;
447
+ '8/12': string;
448
+ '9/12': string;
449
+ '10/12': string;
450
+ '11/12': string;
451
+ };
369
452
  declare const height: {
370
453
  auto: string;
371
454
  full: string;
@@ -960,10 +1043,16 @@ type TextAlignProp = {
960
1043
  };
961
1044
  type WidthProp = {
962
1045
  /**
963
- * Sets the width of the field. You can see allowed tokens [here](https://tailwindcss.com/docs/width).
1046
+ * Sets the width of the element. You can see allowed tokens [here](https://tailwindcss.com/docs/width).
964
1047
  */
965
1048
  width?: keyof typeof width;
966
1049
  };
1050
+ type MaxWidthProp = {
1051
+ /**
1052
+ * Sets the max-width of the element. You can see allowed tokens [here](https://tailwindcss.com/docs/max-width).
1053
+ */
1054
+ maxWidth?: keyof typeof maxWidth;
1055
+ };
967
1056
  type HeightProp = {
968
1057
  /**
969
1058
  * Set the height of the element. You can see allowed tokens [here](https://tailwindcss.com/docs/height).
@@ -971,4 +1060,4 @@ type HeightProp = {
971
1060
  height?: keyof typeof height;
972
1061
  };
973
1062
 
974
- export { type AlignmentProp, type AspectProp, type ComponentClassNames, type ComponentNames, type ComponentState, type ComponentStyleFunction, type Config, type ConfigSchema, type ConfigVariants, type ConfigVariantsMulti, type CursorProp, DateFormat, type FontSizeProp, type FontStyleProp, type FontWeightProp, type GapSpaceProp, type HeightProp, type NestedStringObject, NumericFormat, type ObjectFitProp, type ObjectPositionProp, type PaddingBottomProp, type PaddingLeftProp, type PaddingRightProp, type PaddingSpaceProp, type PaddingSpacePropX, type PaddingSpacePropY, type PaddingTopProp, type PlaceItemsProp, type Props, SVG, type SVGProps, type StateAttrKeyProps, type StateAttrProps, type StylesProps, type TextAlignProp, type Theme, type ThemeComponent, type ThemeComponentParts, ThemeProvider, type ThemeProviderProps, type UseClassNamesProps, type UseStateProps, type WidthProp, alignment, aspect, cn, createVar, cursorStyle, cva, defaultTheme, ensureCssVar, extendTheme, fontWeight, gapSpace, get, height, isValidCssCustomPropertyName, objectFit, objectPosition, paddingBottom, paddingLeft, paddingRight, paddingSpace, paddingSpaceX, paddingSpaceY, paddingTop, placeItems, textAlign, textSize, textStyle, useClassNames, useResponsiveValue, useSmallScreen, useStateProps, useTheme, width };
1063
+ export { type AlignmentProp, type AspectProp, type ComponentClassNames, type ComponentNames, type ComponentState, type ComponentStyleFunction, type Config, type ConfigSchema, type ConfigVariants, type ConfigVariantsMulti, type CursorProp, DateFormat, type FontSizeProp, type FontStyleProp, type FontWeightProp, type GapSpaceProp, type HeightProp, type MaxWidthProp, type NestedStringObject, type NumerFormatterOptions, NumericFormat, type ObjectFitProp, type ObjectPositionProp, type PaddingBottomProp, type PaddingLeftProp, type PaddingRightProp, type PaddingSpaceProp, type PaddingSpacePropX, type PaddingSpacePropY, type PaddingTopProp, type PlaceItemsProp, type Props, SVG, type SVGProps, type StateAttrKeyProps, type StateAttrProps, type StylesProps, type TextAlignProp, type Theme, type ThemeComponent, type ThemeComponentParts, ThemeProvider, type ThemeProviderProps, type UseClassNamesProps, type UseStateProps, type WidthProp, alignment, aspect, cn, createVar, cursorStyle, cva, defaultTheme, ensureCssVar, extendTheme, fontWeight, gapSpace, get, height, isValidCssCustomPropertyName, maxWidth, objectFit, objectPosition, paddingBottom, paddingLeft, paddingRight, paddingSpace, paddingSpaceX, paddingSpaceY, paddingTop, placeItems, textAlign, textSize, textStyle, useClassNames, useResponsiveValue, useSmallScreen, useStateProps, useTheme, width };
package/dist/index.js CHANGED
@@ -48,6 +48,7 @@ __export(index_exports, {
48
48
  get: () => get,
49
49
  height: () => height,
50
50
  isValidCssCustomPropertyName: () => isValidCssCustomPropertyName,
51
+ maxWidth: () => maxWidth,
51
52
  objectFit: () => objectFit,
52
53
  objectPosition: () => objectPosition,
53
54
  paddingBottom: () => paddingBottom,
@@ -135,12 +136,15 @@ var NumericFormat = ({
135
136
  tabular = true,
136
137
  ...props
137
138
  }) => {
138
- const numberFormatter = (0, import_i18n2.useNumberFormatter)({
139
+ const formatter = (0, import_i18n2.useNumberFormatter)({
139
140
  ...props
140
141
  });
141
- return /* @__PURE__ */ import_react3.default.createElement("span", { className: tabular ? "tabular-nums" : void 0 }, numberFormatter.format(value));
142
+ return /* @__PURE__ */ import_react3.default.createElement("span", { className: tabular ? "tabular-nums" : void 0 }, Array.isArray(value) ? formatter.formatRange(value[0], value[1]) : formatter.format(value));
142
143
  };
143
144
 
145
+ // src/hooks/useClassNames.tsx
146
+ var import_react5 = require("react");
147
+
144
148
  // src/hooks/useTheme.tsx
145
149
  var import_react4 = __toESM(require("react"));
146
150
 
@@ -174,13 +178,20 @@ function ThemeProvider({
174
178
  }
175
179
 
176
180
  // src/hooks/useClassNames.tsx
181
+ var FallbackContext = (0, import_react5.createContext)(
182
+ null
183
+ );
177
184
  var useClassNames = ({
178
185
  component,
179
186
  className,
180
187
  variant,
181
- size
188
+ size,
189
+ context: ComponentContext
182
190
  }) => {
183
191
  const theme = useTheme();
192
+ const ctx = (0, import_react5.useContext)(ComponentContext != null ? ComponentContext : FallbackContext);
193
+ const currentSize = size != null ? size : ctx == null ? void 0 : ctx.size;
194
+ const currentVariant = variant != null ? variant : ctx == null ? void 0 : ctx.variant;
184
195
  const styles = theme.components[component];
185
196
  if (!styles) {
186
197
  throw new Error(
@@ -193,7 +204,13 @@ var useClassNames = ({
193
204
  '"className" must be a string, when using a component without slots'
194
205
  );
195
206
  }
196
- return cn(styles({ variant, size, className }));
207
+ return cn(
208
+ styles({
209
+ variant: currentVariant,
210
+ size: currentSize,
211
+ className
212
+ })
213
+ );
197
214
  }
198
215
  if (className !== void 0 && typeof className !== "object") {
199
216
  throw new Error(
@@ -206,8 +223,8 @@ var useClassNames = ({
206
223
  slot,
207
224
  cn(
208
225
  style({
209
- variant,
210
- size,
226
+ variant: currentVariant,
227
+ size: currentSize,
211
228
  className: className && className[slot]
212
229
  })
213
230
  )
@@ -217,7 +234,7 @@ var useClassNames = ({
217
234
  };
218
235
 
219
236
  // src/hooks/useResponsiveValue.ts
220
- var import_react5 = require("react");
237
+ var import_react6 = require("react");
221
238
  var useResponsiveValue = (values, defaultIndex = 0) => {
222
239
  const theme = useTheme();
223
240
  const screens = theme.screens || defaultTheme.screens;
@@ -226,8 +243,8 @@ var useResponsiveValue = (values, defaultIndex = 0) => {
226
243
  `Default breakpoint index is out of bounds. Theme has ${Object.keys(screens).length + 1} breakpoints, default is ${defaultIndex}.`
227
244
  );
228
245
  }
229
- const [index, setIndex] = (0, import_react5.useState)(defaultIndex);
230
- (0, import_react5.useEffect)(() => {
246
+ const [index, setIndex] = (0, import_react6.useState)(defaultIndex);
247
+ (0, import_react6.useEffect)(() => {
231
248
  if (typeof window == "undefined") return;
232
249
  const getIndex = () => Object.values(screens).filter(
233
250
  (breakpoint) => window.matchMedia(`screen and (min-width: ${breakpoint})`).matches
@@ -246,12 +263,12 @@ var useResponsiveValue = (values, defaultIndex = 0) => {
246
263
  };
247
264
 
248
265
  // src/hooks/useStateProps.ts
249
- var import_react6 = require("react");
266
+ var import_react7 = require("react");
250
267
  var import_react_fast_compare = __toESM(require("react-fast-compare"));
251
268
  var KEBAB_REGEX = /[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g;
252
269
  var toKebap = (val) => val.replace(KEBAB_REGEX, (match) => `-${match.toLocaleLowerCase()}`);
253
270
  var useStateProps = (states) => {
254
- const statePropsRef = (0, import_react6.useRef)({});
271
+ const statePropsRef = (0, import_react7.useRef)({});
255
272
  let stateProps = {};
256
273
  for (let state in states) {
257
274
  if (states[state]) {
@@ -266,7 +283,7 @@ var useStateProps = (states) => {
266
283
  };
267
284
 
268
285
  // src/hooks/useSmallScreen.ts
269
- var import_react7 = require("react");
286
+ var import_react8 = require("react");
270
287
  var useSmallScreen = () => {
271
288
  const getMatches = () => {
272
289
  if (typeof window == "undefined") {
@@ -274,11 +291,11 @@ var useSmallScreen = () => {
274
291
  }
275
292
  return window.matchMedia("(max-width: 600px)").matches;
276
293
  };
277
- const [matches, setMatches] = (0, import_react7.useState)(getMatches());
278
- const handleResize = (0, import_react7.useCallback)(() => {
294
+ const [matches, setMatches] = (0, import_react8.useState)(getMatches());
295
+ const handleResize = (0, import_react8.useCallback)(() => {
279
296
  setMatches(getMatches());
280
297
  }, []);
281
- (0, import_react7.useEffect)(() => {
298
+ (0, import_react8.useEffect)(() => {
282
299
  handleResize();
283
300
  if (typeof window == "undefined") return;
284
301
  window.addEventListener("resize", handleResize);
@@ -317,7 +334,10 @@ var extendTheme = (newStyles, theme) => {
317
334
  const variants = ["size", "variant"].reduce((acc, variantItem) => {
318
335
  var _a, _b, _c, _d;
319
336
  const newStylesVariants = (_a = newStyles[component].variants) == null ? void 0 : _a[variantItem];
320
- const mergedStylesVariants = (_b = mergedStyles[component].variants) == null ? void 0 : _b[variantItem];
337
+ const mergedStylesVariants = (
338
+ // @ts-expect-error any
339
+ (_b = mergedStyles[component].variants) == null ? void 0 : _b[variantItem]
340
+ );
321
341
  if (newStylesVariants && mergedStylesVariants) {
322
342
  const dupVariants = Object.keys(newStylesVariants).filter(
323
343
  (variant) => Object.keys(mergedStylesVariants).includes(variant)
@@ -327,7 +347,9 @@ var extendTheme = (newStyles, theme) => {
327
347
  }
328
348
  }
329
349
  acc[variantItem] = {
350
+ // @ts-expect-error any
330
351
  ...(_c = newStyles[component].variants) == null ? void 0 : _c[variantItem],
352
+ // @ts-expect-error any
331
353
  ...(_d = mergedStyles[component].variants) == null ? void 0 : _d[variantItem]
332
354
  };
333
355
  return acc;
@@ -413,6 +435,77 @@ var width = {
413
435
  "10/12": "w-10/12",
414
436
  "11/12": "w-11/12"
415
437
  };
438
+ var maxWidth = {
439
+ auto: "max-w-auto",
440
+ full: "max-w-full",
441
+ fit: "max-w-fit",
442
+ min: "max-w-min",
443
+ max: "max-w-max",
444
+ screen: "max-w-screen",
445
+ svh: "max-w-svh",
446
+ lvh: "max-w-lvh",
447
+ dvh: "max-w-dvh",
448
+ px: "max-w-px",
449
+ 0: "max-w-0",
450
+ "0.5": "max-w-0.5",
451
+ 1: "max-w-1",
452
+ "1.5": "max-w-1.5",
453
+ 2: "max-w-2",
454
+ "2.5": "max-w-2.5",
455
+ 3: "max-w-3",
456
+ "3.5": "max-w-3.5",
457
+ 4: "max-w-4",
458
+ 5: "max-w-5",
459
+ 6: "max-w-6",
460
+ 7: "max-w-7",
461
+ 8: "max-w-8",
462
+ 9: "max-w-9",
463
+ 10: "max-w-10",
464
+ 11: "max-w-11",
465
+ 12: "max-w-12",
466
+ 14: "max-w-14",
467
+ 16: "max-w-16",
468
+ 20: "max-w-20",
469
+ 24: "max-w-24",
470
+ 28: "max-w-28",
471
+ 32: "max-w-32",
472
+ 36: "max-w-36",
473
+ 40: "max-w-40",
474
+ 44: "max-w-44",
475
+ 48: "max-w-48",
476
+ 52: "max-w-52",
477
+ 56: "max-w-56",
478
+ 60: "max-w-60",
479
+ 64: "max-w-64",
480
+ 72: "max-w-72",
481
+ 80: "max-w-80",
482
+ 96: "max-w-96",
483
+ "1/2": "max-w-1/2",
484
+ "1/3": "max-w-1/3",
485
+ "2/3": "max-w-2/3",
486
+ "1/4": "max-w-1/4",
487
+ "2/4": "max-w-2/4",
488
+ "3/4": "max-w-3/4",
489
+ "1/5": "max-w-1/5",
490
+ "2/5": "max-w-2/5",
491
+ "3/5": "max-w-3/5",
492
+ "1/6": "max-w-1/6",
493
+ "2/6": "max-w-2/6",
494
+ "3/6": "max-w-3/6",
495
+ "4/6": "max-w-4/6",
496
+ "5/6": "max-w-5/6",
497
+ "1/12": "max-w-1/12",
498
+ "2/12": "max-w-2/12",
499
+ "3/12": "max-w-3/12",
500
+ "4/12": "max-w-4/12",
501
+ "5/12": "max-w-5/12",
502
+ "6/12": "max-w-6/12",
503
+ "7/12": "max-w-7/12",
504
+ "8/12": "max-w-8/12",
505
+ "9/12": "max-w-9/12",
506
+ "10/12": "max-w-10/12",
507
+ "11/12": "max-w-11/12"
508
+ };
416
509
  var height = {
417
510
  auto: "h-auto",
418
511
  full: "h-full",
@@ -914,6 +1007,7 @@ var cursorStyle = {
914
1007
  get,
915
1008
  height,
916
1009
  isValidCssCustomPropertyName,
1010
+ maxWidth,
917
1011
  objectFit,
918
1012
  objectPosition,
919
1013
  paddingBottom,
package/dist/index.mjs CHANGED
@@ -63,12 +63,15 @@ var NumericFormat = ({
63
63
  tabular = true,
64
64
  ...props
65
65
  }) => {
66
- const numberFormatter = useNumberFormatter({
66
+ const formatter = useNumberFormatter({
67
67
  ...props
68
68
  });
69
- return /* @__PURE__ */ React3.createElement("span", { className: tabular ? "tabular-nums" : void 0 }, numberFormatter.format(value));
69
+ return /* @__PURE__ */ React3.createElement("span", { className: tabular ? "tabular-nums" : void 0 }, Array.isArray(value) ? formatter.formatRange(value[0], value[1]) : formatter.format(value));
70
70
  };
71
71
 
72
+ // src/hooks/useClassNames.tsx
73
+ import { createContext as createContext2, useContext as useContext2 } from "react";
74
+
72
75
  // src/hooks/useTheme.tsx
73
76
  import React4, { createContext, useContext } from "react";
74
77
 
@@ -102,13 +105,20 @@ function ThemeProvider({
102
105
  }
103
106
 
104
107
  // src/hooks/useClassNames.tsx
108
+ var FallbackContext = createContext2(
109
+ null
110
+ );
105
111
  var useClassNames = ({
106
112
  component,
107
113
  className,
108
114
  variant,
109
- size
115
+ size,
116
+ context: ComponentContext
110
117
  }) => {
111
118
  const theme = useTheme();
119
+ const ctx = useContext2(ComponentContext != null ? ComponentContext : FallbackContext);
120
+ const currentSize = size != null ? size : ctx == null ? void 0 : ctx.size;
121
+ const currentVariant = variant != null ? variant : ctx == null ? void 0 : ctx.variant;
112
122
  const styles = theme.components[component];
113
123
  if (!styles) {
114
124
  throw new Error(
@@ -121,7 +131,13 @@ var useClassNames = ({
121
131
  '"className" must be a string, when using a component without slots'
122
132
  );
123
133
  }
124
- return cn(styles({ variant, size, className }));
134
+ return cn(
135
+ styles({
136
+ variant: currentVariant,
137
+ size: currentSize,
138
+ className
139
+ })
140
+ );
125
141
  }
126
142
  if (className !== void 0 && typeof className !== "object") {
127
143
  throw new Error(
@@ -134,8 +150,8 @@ var useClassNames = ({
134
150
  slot,
135
151
  cn(
136
152
  style({
137
- variant,
138
- size,
153
+ variant: currentVariant,
154
+ size: currentSize,
139
155
  className: className && className[slot]
140
156
  })
141
157
  )
@@ -245,7 +261,10 @@ var extendTheme = (newStyles, theme) => {
245
261
  const variants = ["size", "variant"].reduce((acc, variantItem) => {
246
262
  var _a, _b, _c, _d;
247
263
  const newStylesVariants = (_a = newStyles[component].variants) == null ? void 0 : _a[variantItem];
248
- const mergedStylesVariants = (_b = mergedStyles[component].variants) == null ? void 0 : _b[variantItem];
264
+ const mergedStylesVariants = (
265
+ // @ts-expect-error any
266
+ (_b = mergedStyles[component].variants) == null ? void 0 : _b[variantItem]
267
+ );
249
268
  if (newStylesVariants && mergedStylesVariants) {
250
269
  const dupVariants = Object.keys(newStylesVariants).filter(
251
270
  (variant) => Object.keys(mergedStylesVariants).includes(variant)
@@ -255,7 +274,9 @@ var extendTheme = (newStyles, theme) => {
255
274
  }
256
275
  }
257
276
  acc[variantItem] = {
277
+ // @ts-expect-error any
258
278
  ...(_c = newStyles[component].variants) == null ? void 0 : _c[variantItem],
279
+ // @ts-expect-error any
259
280
  ...(_d = mergedStyles[component].variants) == null ? void 0 : _d[variantItem]
260
281
  };
261
282
  return acc;
@@ -341,6 +362,77 @@ var width = {
341
362
  "10/12": "w-10/12",
342
363
  "11/12": "w-11/12"
343
364
  };
365
+ var maxWidth = {
366
+ auto: "max-w-auto",
367
+ full: "max-w-full",
368
+ fit: "max-w-fit",
369
+ min: "max-w-min",
370
+ max: "max-w-max",
371
+ screen: "max-w-screen",
372
+ svh: "max-w-svh",
373
+ lvh: "max-w-lvh",
374
+ dvh: "max-w-dvh",
375
+ px: "max-w-px",
376
+ 0: "max-w-0",
377
+ "0.5": "max-w-0.5",
378
+ 1: "max-w-1",
379
+ "1.5": "max-w-1.5",
380
+ 2: "max-w-2",
381
+ "2.5": "max-w-2.5",
382
+ 3: "max-w-3",
383
+ "3.5": "max-w-3.5",
384
+ 4: "max-w-4",
385
+ 5: "max-w-5",
386
+ 6: "max-w-6",
387
+ 7: "max-w-7",
388
+ 8: "max-w-8",
389
+ 9: "max-w-9",
390
+ 10: "max-w-10",
391
+ 11: "max-w-11",
392
+ 12: "max-w-12",
393
+ 14: "max-w-14",
394
+ 16: "max-w-16",
395
+ 20: "max-w-20",
396
+ 24: "max-w-24",
397
+ 28: "max-w-28",
398
+ 32: "max-w-32",
399
+ 36: "max-w-36",
400
+ 40: "max-w-40",
401
+ 44: "max-w-44",
402
+ 48: "max-w-48",
403
+ 52: "max-w-52",
404
+ 56: "max-w-56",
405
+ 60: "max-w-60",
406
+ 64: "max-w-64",
407
+ 72: "max-w-72",
408
+ 80: "max-w-80",
409
+ 96: "max-w-96",
410
+ "1/2": "max-w-1/2",
411
+ "1/3": "max-w-1/3",
412
+ "2/3": "max-w-2/3",
413
+ "1/4": "max-w-1/4",
414
+ "2/4": "max-w-2/4",
415
+ "3/4": "max-w-3/4",
416
+ "1/5": "max-w-1/5",
417
+ "2/5": "max-w-2/5",
418
+ "3/5": "max-w-3/5",
419
+ "1/6": "max-w-1/6",
420
+ "2/6": "max-w-2/6",
421
+ "3/6": "max-w-3/6",
422
+ "4/6": "max-w-4/6",
423
+ "5/6": "max-w-5/6",
424
+ "1/12": "max-w-1/12",
425
+ "2/12": "max-w-2/12",
426
+ "3/12": "max-w-3/12",
427
+ "4/12": "max-w-4/12",
428
+ "5/12": "max-w-5/12",
429
+ "6/12": "max-w-6/12",
430
+ "7/12": "max-w-7/12",
431
+ "8/12": "max-w-8/12",
432
+ "9/12": "max-w-9/12",
433
+ "10/12": "max-w-10/12",
434
+ "11/12": "max-w-11/12"
435
+ };
344
436
  var height = {
345
437
  auto: "h-auto",
346
438
  full: "h-full",
@@ -841,6 +933,7 @@ export {
841
933
  get,
842
934
  height,
843
935
  isValidCssCustomPropertyName,
936
+ maxWidth,
844
937
  objectFit,
845
938
  objectPosition,
846
939
  paddingBottom,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marigold/system",
3
- "version": "11.4.1",
3
+ "version": "12.0.0",
4
4
  "description": "Marigold System Library",
5
5
  "license": "MIT",
6
6
  "keywords": [
@@ -34,7 +34,7 @@
34
34
  "directory": "packages/system"
35
35
  },
36
36
  "dependencies": {
37
- "@react-aria/i18n": "3.12.7",
37
+ "@react-aria/i18n": "3.12.8",
38
38
  "class-variance-authority": "0.7.1",
39
39
  "deepmerge": "4.3.1",
40
40
  "react-fast-compare": "3.2.2",