@marigold/system 7.0.0 → 7.2.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,7 @@
1
1
  import * as React from 'react';
2
2
  import React__default, { ReactNode } from 'react';
3
3
  import { HtmlProps, KebabCase } from '@marigold/types';
4
+ import { DateFormatterOptions } from '@react-aria/i18n';
4
5
  import { StringToBoolean, ClassProp } from 'class-variance-authority/dist/types';
5
6
  export { VariantProps } from 'class-variance-authority';
6
7
 
@@ -10,6 +11,20 @@ interface SVGProps extends Omit<HtmlProps<'svg'>, 'fill'> {
10
11
  }
11
12
  declare const SVG: React__default.ForwardRefExoticComponent<SVGProps & React__default.RefAttributes<SVGSVGElement>>;
12
13
 
14
+ interface DateFormatProps extends DateFormatterOptions {
15
+ value: Date;
16
+ tabular?: boolean;
17
+ }
18
+ declare const DateFormat: ({ value, tabular, ...props }: DateFormatProps) => React__default.JSX.Element;
19
+
20
+ interface NumericFormatProps extends Omit<Intl.NumberFormatOptions, 'style'> {
21
+ value: number | bigint;
22
+ numberingSystem?: string;
23
+ tabular?: boolean;
24
+ styleFormat?: string;
25
+ }
26
+ declare const NumericFormat: ({ value, styleFormat, tabular, ...props }: NumericFormatProps) => React__default.JSX.Element;
27
+
13
28
  type ConfigSchema = Record<string, Record<string, ClassValue>>;
14
29
  type ConfigVariants<T extends ConfigSchema> = {
15
30
  [Variant in keyof T]?: StringToBoolean<keyof T[Variant]> | null | undefined;
@@ -62,6 +77,8 @@ type Theme = {
62
77
  [key: string]: string;
63
78
  };
64
79
  colors?: NestedStringObject;
80
+ shadow?: NestedStringObject;
81
+ height?: NestedStringObject;
65
82
  root?: ComponentStyleFunction;
66
83
  components: {
67
84
  Accordion?: Record<'button' | 'item', ComponentStyleFunction<string, string>>;
@@ -145,8 +162,9 @@ declare const useTheme: () => Theme;
145
162
  interface ThemeProviderProps<T extends Theme> {
146
163
  theme: T;
147
164
  children: ReactNode;
165
+ className?: string;
148
166
  }
149
- declare function ThemeProvider<T extends Theme>({ theme, children, }: ThemeProviderProps<T>): React__default.JSX.Element;
167
+ declare function ThemeProvider<T extends Theme>({ theme, children, className, }: ThemeProviderProps<T>): React__default.JSX.Element;
150
168
 
151
169
  declare const useSmallScreen: () => boolean;
152
170
 
@@ -691,4 +709,4 @@ type WidthProp = {
691
709
  width?: keyof typeof width;
692
710
  };
693
711
 
694
- export { AlignmentProp, AspectProp, ClassArray, ClassDictionary, ClassValue, ComponentClassNames, ComponentNames, ComponentState, ComponentStyleFunction, Config, ConfigSchema, ConfigVariants, ConfigVariantsMulti, CursorProp, FontSizeProp, FontStyleProp, FontWeightProp, GapSpaceProp, GridColsAlignProp, GridColumn, NestedStringObject, ObjectFitProp, ObjectPositionProp, PaddingBottomProp, PaddingLeftProp, PaddingRightProp, PaddingSpaceProp, PaddingSpacePropX, PaddingSpacePropY, PaddingTopProp, PlaceItemsProp, Props, SVG, SVGProps, StateAttrKeyProps, StateAttrProps, TextAlignProp, Theme, ThemeComponent, ThemeProvider, ThemeProviderProps, UseClassNamesProps, UseStateProps, WidthProp, alignment, aspect, cn, createVar, cursorStyle, cva, defaultTheme, fontWeight, gapSpace, get, gridColsAlign, gridColumn, objectFit, objectPosition, paddingBottom, paddingLeft, paddingRight, paddingSpace, paddingSpaceX, paddingSpaceY, paddingTop, placeItems, textAlign, textSize, textStyle, useClassNames, useResponsiveValue, useSmallScreen, useStateProps, useTheme, width };
712
+ export { type AlignmentProp, type AspectProp, type ClassArray, type ClassDictionary, type ClassValue, 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 GridColsAlignProp, type GridColumn, 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 TextAlignProp, type Theme, type ThemeComponent, ThemeProvider, type ThemeProviderProps, type UseClassNamesProps, type UseStateProps, type WidthProp, alignment, aspect, cn, createVar, cursorStyle, cva, defaultTheme, fontWeight, gapSpace, get, gridColsAlign, gridColumn, 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,7 @@
1
1
  import * as React from 'react';
2
2
  import React__default, { ReactNode } from 'react';
3
3
  import { HtmlProps, KebabCase } from '@marigold/types';
4
+ import { DateFormatterOptions } from '@react-aria/i18n';
4
5
  import { StringToBoolean, ClassProp } from 'class-variance-authority/dist/types';
5
6
  export { VariantProps } from 'class-variance-authority';
6
7
 
@@ -10,6 +11,20 @@ interface SVGProps extends Omit<HtmlProps<'svg'>, 'fill'> {
10
11
  }
11
12
  declare const SVG: React__default.ForwardRefExoticComponent<SVGProps & React__default.RefAttributes<SVGSVGElement>>;
12
13
 
14
+ interface DateFormatProps extends DateFormatterOptions {
15
+ value: Date;
16
+ tabular?: boolean;
17
+ }
18
+ declare const DateFormat: ({ value, tabular, ...props }: DateFormatProps) => React__default.JSX.Element;
19
+
20
+ interface NumericFormatProps extends Omit<Intl.NumberFormatOptions, 'style'> {
21
+ value: number | bigint;
22
+ numberingSystem?: string;
23
+ tabular?: boolean;
24
+ styleFormat?: string;
25
+ }
26
+ declare const NumericFormat: ({ value, styleFormat, tabular, ...props }: NumericFormatProps) => React__default.JSX.Element;
27
+
13
28
  type ConfigSchema = Record<string, Record<string, ClassValue>>;
14
29
  type ConfigVariants<T extends ConfigSchema> = {
15
30
  [Variant in keyof T]?: StringToBoolean<keyof T[Variant]> | null | undefined;
@@ -62,6 +77,8 @@ type Theme = {
62
77
  [key: string]: string;
63
78
  };
64
79
  colors?: NestedStringObject;
80
+ shadow?: NestedStringObject;
81
+ height?: NestedStringObject;
65
82
  root?: ComponentStyleFunction;
66
83
  components: {
67
84
  Accordion?: Record<'button' | 'item', ComponentStyleFunction<string, string>>;
@@ -145,8 +162,9 @@ declare const useTheme: () => Theme;
145
162
  interface ThemeProviderProps<T extends Theme> {
146
163
  theme: T;
147
164
  children: ReactNode;
165
+ className?: string;
148
166
  }
149
- declare function ThemeProvider<T extends Theme>({ theme, children, }: ThemeProviderProps<T>): React__default.JSX.Element;
167
+ declare function ThemeProvider<T extends Theme>({ theme, children, className, }: ThemeProviderProps<T>): React__default.JSX.Element;
150
168
 
151
169
  declare const useSmallScreen: () => boolean;
152
170
 
@@ -691,4 +709,4 @@ type WidthProp = {
691
709
  width?: keyof typeof width;
692
710
  };
693
711
 
694
- export { AlignmentProp, AspectProp, ClassArray, ClassDictionary, ClassValue, ComponentClassNames, ComponentNames, ComponentState, ComponentStyleFunction, Config, ConfigSchema, ConfigVariants, ConfigVariantsMulti, CursorProp, FontSizeProp, FontStyleProp, FontWeightProp, GapSpaceProp, GridColsAlignProp, GridColumn, NestedStringObject, ObjectFitProp, ObjectPositionProp, PaddingBottomProp, PaddingLeftProp, PaddingRightProp, PaddingSpaceProp, PaddingSpacePropX, PaddingSpacePropY, PaddingTopProp, PlaceItemsProp, Props, SVG, SVGProps, StateAttrKeyProps, StateAttrProps, TextAlignProp, Theme, ThemeComponent, ThemeProvider, ThemeProviderProps, UseClassNamesProps, UseStateProps, WidthProp, alignment, aspect, cn, createVar, cursorStyle, cva, defaultTheme, fontWeight, gapSpace, get, gridColsAlign, gridColumn, objectFit, objectPosition, paddingBottom, paddingLeft, paddingRight, paddingSpace, paddingSpaceX, paddingSpaceY, paddingTop, placeItems, textAlign, textSize, textStyle, useClassNames, useResponsiveValue, useSmallScreen, useStateProps, useTheme, width };
712
+ export { type AlignmentProp, type AspectProp, type ClassArray, type ClassDictionary, type ClassValue, 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 GridColsAlignProp, type GridColumn, 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 TextAlignProp, type Theme, type ThemeComponent, ThemeProvider, type ThemeProviderProps, type UseClassNamesProps, type UseStateProps, type WidthProp, alignment, aspect, cn, createVar, cursorStyle, cva, defaultTheme, fontWeight, gapSpace, get, gridColsAlign, gridColumn, objectFit, objectPosition, paddingBottom, paddingLeft, paddingRight, paddingSpace, paddingSpaceX, paddingSpaceY, paddingTop, placeItems, textAlign, textSize, textStyle, useClassNames, useResponsiveValue, useSmallScreen, useStateProps, useTheme, width };
package/dist/index.js CHANGED
@@ -30,6 +30,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  // src/index.ts
31
31
  var src_exports = {};
32
32
  __export(src_exports, {
33
+ DateFormat: () => DateFormat,
34
+ NumericFormat: () => NumericFormat,
33
35
  SVG: () => SVG,
34
36
  ThemeProvider: () => ThemeProvider,
35
37
  alignment: () => alignment,
@@ -110,8 +112,34 @@ var SVG = (0, import_react.forwardRef)(
110
112
  )
111
113
  );
112
114
 
113
- // src/hooks/useTheme.tsx
115
+ // src/components/Formatters/DateFormat.tsx
114
116
  var import_react2 = __toESM(require("react"));
117
+ var import_i18n = require("@react-aria/i18n");
118
+ var DateFormat = ({ value, tabular, ...props }) => {
119
+ const dateFormatter = (0, import_i18n.useDateFormatter)({
120
+ ...props
121
+ });
122
+ return /* @__PURE__ */ import_react2.default.createElement("span", { className: tabular ? "tabular-nums" : "" }, dateFormatter.format(value));
123
+ };
124
+
125
+ // src/components/Formatters/NumericFormat.tsx
126
+ var import_react3 = __toESM(require("react"));
127
+ var import_i18n2 = require("@react-aria/i18n");
128
+ var NumericFormat = ({
129
+ value,
130
+ styleFormat,
131
+ tabular = true,
132
+ ...props
133
+ }) => {
134
+ const numberFormatter = (0, import_i18n2.useNumberFormatter)({
135
+ style: styleFormat,
136
+ ...props
137
+ });
138
+ return /* @__PURE__ */ import_react3.default.createElement("span", { className: tabular ? "tabular-nums" : "" }, numberFormatter.format(value));
139
+ };
140
+
141
+ // src/hooks/useTheme.tsx
142
+ var import_react4 = __toESM(require("react"));
115
143
 
116
144
  // src/defaultTheme.ts
117
145
  var defaultTheme = {
@@ -127,17 +155,19 @@ var defaultTheme = {
127
155
  };
128
156
 
129
157
  // src/hooks/useTheme.tsx
130
- var InternalContext = (0, import_react2.createContext)(defaultTheme);
158
+ var InternalContext = (0, import_react4.createContext)(defaultTheme);
131
159
  var useTheme = () => {
132
- const theme = (0, import_react2.useContext)(InternalContext);
160
+ const theme = (0, import_react4.useContext)(InternalContext);
133
161
  return theme;
134
162
  };
135
163
  function ThemeProvider({
136
164
  theme,
137
- children
165
+ children,
166
+ className
138
167
  }) {
139
- var _a, _b;
140
- return /* @__PURE__ */ import_react2.default.createElement("div", { "data-theme": theme.name, className: (_b = (_a = theme.root) == null ? void 0 : _a.call(theme)) != null ? _b : "" }, /* @__PURE__ */ import_react2.default.createElement(InternalContext.Provider, { value: theme }, children));
168
+ var _a;
169
+ const root = (_a = theme.root) == null ? void 0 : _a.call(theme);
170
+ return /* @__PURE__ */ import_react4.default.createElement(InternalContext.Provider, { value: theme }, /* @__PURE__ */ import_react4.default.createElement("div", { className: cn(root ? root : "", className) }, children));
141
171
  }
142
172
 
143
173
  // src/hooks/useClassNames.tsx
@@ -184,7 +214,7 @@ var useClassNames = ({
184
214
  };
185
215
 
186
216
  // src/hooks/useResponsiveValue.ts
187
- var import_react3 = require("react");
217
+ var import_react5 = require("react");
188
218
  var useResponsiveValue = (values, defaultIndex = 0) => {
189
219
  const theme = useTheme();
190
220
  const screens = theme.screens || defaultTheme.screens;
@@ -193,8 +223,8 @@ var useResponsiveValue = (values, defaultIndex = 0) => {
193
223
  `Default breakpoint index is out of bounds. Theme has ${Object.keys(screens).length + 1} breakpoints, default is ${defaultIndex}.`
194
224
  );
195
225
  }
196
- const [index, setIndex] = (0, import_react3.useState)(defaultIndex);
197
- (0, import_react3.useEffect)(() => {
226
+ const [index, setIndex] = (0, import_react5.useState)(defaultIndex);
227
+ (0, import_react5.useEffect)(() => {
198
228
  if (typeof window == "undefined")
199
229
  return;
200
230
  const getIndex = () => Object.values(screens).filter(
@@ -214,12 +244,12 @@ var useResponsiveValue = (values, defaultIndex = 0) => {
214
244
  };
215
245
 
216
246
  // src/hooks/useStateProps.ts
217
- var import_react4 = require("react");
247
+ var import_react6 = require("react");
218
248
  var import_react_fast_compare = __toESM(require("react-fast-compare"));
219
249
  var KEBAB_REGEX = /[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g;
220
250
  var toKebap = (val) => val.replace(KEBAB_REGEX, (match) => `-${match.toLocaleLowerCase()}`);
221
251
  var useStateProps = (states) => {
222
- const statePropsRef = (0, import_react4.useRef)({});
252
+ const statePropsRef = (0, import_react6.useRef)({});
223
253
  let stateProps = {};
224
254
  for (let state in states) {
225
255
  if (states[state]) {
@@ -234,7 +264,7 @@ var useStateProps = (states) => {
234
264
  };
235
265
 
236
266
  // src/hooks/useSmallScreen.ts
237
- var import_react5 = require("react");
267
+ var import_react7 = require("react");
238
268
  var useSmallScreen = () => {
239
269
  const getMatches = () => {
240
270
  if (typeof window == "undefined") {
@@ -242,11 +272,11 @@ var useSmallScreen = () => {
242
272
  }
243
273
  return window.matchMedia("(max-width: 600px)").matches;
244
274
  };
245
- const [matches, setMatches] = (0, import_react5.useState)(getMatches());
246
- const handleResize = (0, import_react5.useCallback)(() => {
275
+ const [matches, setMatches] = (0, import_react7.useState)(getMatches());
276
+ const handleResize = (0, import_react7.useCallback)(() => {
247
277
  setMatches(getMatches());
248
278
  }, []);
249
- (0, import_react5.useEffect)(() => {
279
+ (0, import_react7.useEffect)(() => {
250
280
  handleResize();
251
281
  if (typeof window == "undefined")
252
282
  return;
@@ -715,6 +745,8 @@ var cursorStyle = {
715
745
  };
716
746
  // Annotate the CommonJS export names for ESM import in node:
717
747
  0 && (module.exports = {
748
+ DateFormat,
749
+ NumericFormat,
718
750
  SVG,
719
751
  ThemeProvider,
720
752
  alignment,
package/dist/index.mjs CHANGED
@@ -42,8 +42,34 @@ var SVG = forwardRef(
42
42
  )
43
43
  );
44
44
 
45
+ // src/components/Formatters/DateFormat.tsx
46
+ import React2 from "react";
47
+ import { useDateFormatter } from "@react-aria/i18n";
48
+ var DateFormat = ({ value, tabular, ...props }) => {
49
+ const dateFormatter = useDateFormatter({
50
+ ...props
51
+ });
52
+ return /* @__PURE__ */ React2.createElement("span", { className: tabular ? "tabular-nums" : "" }, dateFormatter.format(value));
53
+ };
54
+
55
+ // src/components/Formatters/NumericFormat.tsx
56
+ import React3 from "react";
57
+ import { useNumberFormatter } from "@react-aria/i18n";
58
+ var NumericFormat = ({
59
+ value,
60
+ styleFormat,
61
+ tabular = true,
62
+ ...props
63
+ }) => {
64
+ const numberFormatter = useNumberFormatter({
65
+ style: styleFormat,
66
+ ...props
67
+ });
68
+ return /* @__PURE__ */ React3.createElement("span", { className: tabular ? "tabular-nums" : "" }, numberFormatter.format(value));
69
+ };
70
+
45
71
  // src/hooks/useTheme.tsx
46
- import React2, { createContext, useContext } from "react";
72
+ import React4, { createContext, useContext } from "react";
47
73
 
48
74
  // src/defaultTheme.ts
49
75
  var defaultTheme = {
@@ -66,10 +92,12 @@ var useTheme = () => {
66
92
  };
67
93
  function ThemeProvider({
68
94
  theme,
69
- children
95
+ children,
96
+ className
70
97
  }) {
71
- var _a, _b;
72
- return /* @__PURE__ */ React2.createElement("div", { "data-theme": theme.name, className: (_b = (_a = theme.root) == null ? void 0 : _a.call(theme)) != null ? _b : "" }, /* @__PURE__ */ React2.createElement(InternalContext.Provider, { value: theme }, children));
98
+ var _a;
99
+ const root = (_a = theme.root) == null ? void 0 : _a.call(theme);
100
+ return /* @__PURE__ */ React4.createElement(InternalContext.Provider, { value: theme }, /* @__PURE__ */ React4.createElement("div", { className: cn(root ? root : "", className) }, children));
73
101
  }
74
102
 
75
103
  // src/hooks/useClassNames.tsx
@@ -646,6 +674,8 @@ var cursorStyle = {
646
674
  zoomOut: "cursor-zoom-out"
647
675
  };
648
676
  export {
677
+ DateFormat,
678
+ NumericFormat,
649
679
  SVG,
650
680
  ThemeProvider,
651
681
  alignment,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marigold/system",
3
- "version": "7.0.0",
3
+ "version": "7.2.0",
4
4
  "description": "Marigold System Library",
5
5
  "license": "MIT",
6
6
  "keywords": [
@@ -24,10 +24,11 @@
24
24
  "directory": "packages/system"
25
25
  },
26
26
  "dependencies": {
27
+ "@react-aria/i18n": "3.10.0",
27
28
  "class-variance-authority": "0.7.0",
28
29
  "deepmerge": "^4.2.2",
29
30
  "react-fast-compare": "^3.2.0",
30
- "tailwind-merge": "2.0.0",
31
+ "tailwind-merge": "2.2.0",
31
32
  "@marigold/types": "1.1.0"
32
33
  },
33
34
  "peerDependencies": {
@@ -35,11 +36,11 @@
35
36
  "react-dom": "16.x || 17.x || 18.x"
36
37
  },
37
38
  "devDependencies": {
38
- "@babel/core": "7.23.3",
39
- "postcss": "8.4.31",
39
+ "@babel/core": "7.23.7",
40
+ "postcss": "8.4.33",
40
41
  "react": "18.2.0",
41
- "tailwindcss": "3.3.5",
42
- "tsup": "7.2.0",
42
+ "tailwindcss": "3.4.1",
43
+ "tsup": "8.0.1",
43
44
  "@marigold/tsconfig": "0.4.0"
44
45
  },
45
46
  "scripts": {