@marigold/system 7.2.0 → 7.3.1
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 +14 -2
- package/dist/index.d.ts +14 -2
- package/dist/index.js +74 -54
- package/dist/index.mjs +61 -43
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -5,7 +5,7 @@ import { DateFormatterOptions } from '@react-aria/i18n';
|
|
|
5
5
|
import { StringToBoolean, ClassProp } from 'class-variance-authority/dist/types';
|
|
6
6
|
export { VariantProps } from 'class-variance-authority';
|
|
7
7
|
|
|
8
|
-
interface SVGProps extends Omit<HtmlProps<'svg'>, 'fill'> {
|
|
8
|
+
interface SVGProps extends Omit<HtmlProps<'svg'>, 'fill' | 'style'> {
|
|
9
9
|
size?: number | string | number[] | string[];
|
|
10
10
|
className?: string;
|
|
11
11
|
}
|
|
@@ -49,6 +49,9 @@ declare const cn: (...inputs: ClassValue[]) => string;
|
|
|
49
49
|
declare const createVar: (o: {
|
|
50
50
|
[key: string]: string | number | undefined;
|
|
51
51
|
}) => React.CSSProperties;
|
|
52
|
+
declare const isObject: (val: any) => val is {
|
|
53
|
+
[key: string]: any;
|
|
54
|
+
};
|
|
52
55
|
/**
|
|
53
56
|
* Safely get a dot-notated path within a nested object, with ability
|
|
54
57
|
* to return a default if the full key path does not exist or
|
|
@@ -57,6 +60,15 @@ declare const createVar: (o: {
|
|
|
57
60
|
* Based on: https://github.com/developit/dlv
|
|
58
61
|
*/
|
|
59
62
|
declare const get: (obj: object, path: string, fallback?: any) => any;
|
|
63
|
+
/**
|
|
64
|
+
* Safely get a color value from a Tailwind theme object. This also supports
|
|
65
|
+
* Tailwind's "DEFAULT" fallback.
|
|
66
|
+
*
|
|
67
|
+
* Note: Use the CSS "var name" (e.g. primary-500) not the dot notation.
|
|
68
|
+
*/
|
|
69
|
+
declare const getColor: (theme: {
|
|
70
|
+
colors?: object;
|
|
71
|
+
}, path: string, fallback?: any) => any;
|
|
60
72
|
|
|
61
73
|
interface NestedStringObject {
|
|
62
74
|
[key: string]: NestedStringObject | string;
|
|
@@ -709,4 +721,4 @@ type WidthProp = {
|
|
|
709
721
|
width?: keyof typeof width;
|
|
710
722
|
};
|
|
711
723
|
|
|
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 };
|
|
724
|
+
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, getColor, gridColsAlign, gridColumn, isObject, 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
|
@@ -5,7 +5,7 @@ import { DateFormatterOptions } from '@react-aria/i18n';
|
|
|
5
5
|
import { StringToBoolean, ClassProp } from 'class-variance-authority/dist/types';
|
|
6
6
|
export { VariantProps } from 'class-variance-authority';
|
|
7
7
|
|
|
8
|
-
interface SVGProps extends Omit<HtmlProps<'svg'>, 'fill'> {
|
|
8
|
+
interface SVGProps extends Omit<HtmlProps<'svg'>, 'fill' | 'style'> {
|
|
9
9
|
size?: number | string | number[] | string[];
|
|
10
10
|
className?: string;
|
|
11
11
|
}
|
|
@@ -49,6 +49,9 @@ declare const cn: (...inputs: ClassValue[]) => string;
|
|
|
49
49
|
declare const createVar: (o: {
|
|
50
50
|
[key: string]: string | number | undefined;
|
|
51
51
|
}) => React.CSSProperties;
|
|
52
|
+
declare const isObject: (val: any) => val is {
|
|
53
|
+
[key: string]: any;
|
|
54
|
+
};
|
|
52
55
|
/**
|
|
53
56
|
* Safely get a dot-notated path within a nested object, with ability
|
|
54
57
|
* to return a default if the full key path does not exist or
|
|
@@ -57,6 +60,15 @@ declare const createVar: (o: {
|
|
|
57
60
|
* Based on: https://github.com/developit/dlv
|
|
58
61
|
*/
|
|
59
62
|
declare const get: (obj: object, path: string, fallback?: any) => any;
|
|
63
|
+
/**
|
|
64
|
+
* Safely get a color value from a Tailwind theme object. This also supports
|
|
65
|
+
* Tailwind's "DEFAULT" fallback.
|
|
66
|
+
*
|
|
67
|
+
* Note: Use the CSS "var name" (e.g. primary-500) not the dot notation.
|
|
68
|
+
*/
|
|
69
|
+
declare const getColor: (theme: {
|
|
70
|
+
colors?: object;
|
|
71
|
+
}, path: string, fallback?: any) => any;
|
|
60
72
|
|
|
61
73
|
interface NestedStringObject {
|
|
62
74
|
[key: string]: NestedStringObject | string;
|
|
@@ -709,4 +721,4 @@ type WidthProp = {
|
|
|
709
721
|
width?: keyof typeof width;
|
|
710
722
|
};
|
|
711
723
|
|
|
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 };
|
|
724
|
+
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, getColor, gridColsAlign, gridColumn, isObject, objectFit, objectPosition, paddingBottom, paddingLeft, paddingRight, paddingSpace, paddingSpaceX, paddingSpaceY, paddingTop, placeItems, textAlign, textSize, textStyle, useClassNames, useResponsiveValue, useSmallScreen, useStateProps, useTheme, width };
|
package/dist/index.js
CHANGED
|
@@ -44,8 +44,10 @@ __export(src_exports, {
|
|
|
44
44
|
fontWeight: () => fontWeight,
|
|
45
45
|
gapSpace: () => gapSpace,
|
|
46
46
|
get: () => get,
|
|
47
|
+
getColor: () => getColor,
|
|
47
48
|
gridColsAlign: () => gridColsAlign,
|
|
48
49
|
gridColumn: () => gridColumn,
|
|
50
|
+
isObject: () => isObject,
|
|
49
51
|
objectFit: () => objectFit,
|
|
50
52
|
objectPosition: () => objectPosition,
|
|
51
53
|
paddingBottom: () => paddingBottom,
|
|
@@ -69,7 +71,7 @@ __export(src_exports, {
|
|
|
69
71
|
module.exports = __toCommonJS(src_exports);
|
|
70
72
|
|
|
71
73
|
// src/components/SVG/SVG.tsx
|
|
72
|
-
var
|
|
74
|
+
var import_react5 = __toESM(require("react"));
|
|
73
75
|
|
|
74
76
|
// src/utils.ts
|
|
75
77
|
var import_class_variance_authority = require("class-variance-authority");
|
|
@@ -86,6 +88,7 @@ var cn = (...inputs) => (0, import_tailwind_merge.twMerge)((0, import_class_vari
|
|
|
86
88
|
var createVar = (o) => Object.fromEntries(
|
|
87
89
|
Object.entries(o).map(([name, val]) => [`--${name}`, val])
|
|
88
90
|
);
|
|
91
|
+
var isObject = (val) => val && val.constructor === Object;
|
|
89
92
|
var get = (obj, path, fallback) => {
|
|
90
93
|
const key = path.split(".");
|
|
91
94
|
let result = obj;
|
|
@@ -96,50 +99,13 @@ var get = (obj, path, fallback) => {
|
|
|
96
99
|
}
|
|
97
100
|
return result === void 0 ? fallback : result;
|
|
98
101
|
};
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
({ size = 24, children, className, ...props }, ref) => /* @__PURE__ */ import_react.default.createElement(
|
|
103
|
-
"svg",
|
|
104
|
-
{
|
|
105
|
-
...props,
|
|
106
|
-
ref,
|
|
107
|
-
width: `${props.width || size}px`,
|
|
108
|
-
height: `${props.height || size}px`,
|
|
109
|
-
className: cn("flex-none fill-current", className)
|
|
110
|
-
},
|
|
111
|
-
children
|
|
112
|
-
)
|
|
113
|
-
);
|
|
114
|
-
|
|
115
|
-
// src/components/Formatters/DateFormat.tsx
|
|
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));
|
|
102
|
+
var getColor = (theme, path, fallback) => {
|
|
103
|
+
const result = get(theme.colors || {}, path.replace("-", "."), fallback);
|
|
104
|
+
return isObject(result) ? result["DEFAULT"] : result;
|
|
139
105
|
};
|
|
140
106
|
|
|
141
107
|
// src/hooks/useTheme.tsx
|
|
142
|
-
var
|
|
108
|
+
var import_react = __toESM(require("react"));
|
|
143
109
|
|
|
144
110
|
// src/defaultTheme.ts
|
|
145
111
|
var defaultTheme = {
|
|
@@ -155,9 +121,9 @@ var defaultTheme = {
|
|
|
155
121
|
};
|
|
156
122
|
|
|
157
123
|
// src/hooks/useTheme.tsx
|
|
158
|
-
var InternalContext = (0,
|
|
124
|
+
var InternalContext = (0, import_react.createContext)(defaultTheme);
|
|
159
125
|
var useTheme = () => {
|
|
160
|
-
const theme = (0,
|
|
126
|
+
const theme = (0, import_react.useContext)(InternalContext);
|
|
161
127
|
return theme;
|
|
162
128
|
};
|
|
163
129
|
function ThemeProvider({
|
|
@@ -167,7 +133,7 @@ function ThemeProvider({
|
|
|
167
133
|
}) {
|
|
168
134
|
var _a;
|
|
169
135
|
const root = (_a = theme.root) == null ? void 0 : _a.call(theme);
|
|
170
|
-
return /* @__PURE__ */
|
|
136
|
+
return /* @__PURE__ */ import_react.default.createElement(InternalContext.Provider, { value: theme }, /* @__PURE__ */ import_react.default.createElement("div", { className: cn(root ? root : "", className) }, children));
|
|
171
137
|
}
|
|
172
138
|
|
|
173
139
|
// src/hooks/useClassNames.tsx
|
|
@@ -214,7 +180,7 @@ var useClassNames = ({
|
|
|
214
180
|
};
|
|
215
181
|
|
|
216
182
|
// src/hooks/useResponsiveValue.ts
|
|
217
|
-
var
|
|
183
|
+
var import_react2 = require("react");
|
|
218
184
|
var useResponsiveValue = (values, defaultIndex = 0) => {
|
|
219
185
|
const theme = useTheme();
|
|
220
186
|
const screens = theme.screens || defaultTheme.screens;
|
|
@@ -223,8 +189,8 @@ var useResponsiveValue = (values, defaultIndex = 0) => {
|
|
|
223
189
|
`Default breakpoint index is out of bounds. Theme has ${Object.keys(screens).length + 1} breakpoints, default is ${defaultIndex}.`
|
|
224
190
|
);
|
|
225
191
|
}
|
|
226
|
-
const [index, setIndex] = (0,
|
|
227
|
-
(0,
|
|
192
|
+
const [index, setIndex] = (0, import_react2.useState)(defaultIndex);
|
|
193
|
+
(0, import_react2.useEffect)(() => {
|
|
228
194
|
if (typeof window == "undefined")
|
|
229
195
|
return;
|
|
230
196
|
const getIndex = () => Object.values(screens).filter(
|
|
@@ -244,12 +210,12 @@ var useResponsiveValue = (values, defaultIndex = 0) => {
|
|
|
244
210
|
};
|
|
245
211
|
|
|
246
212
|
// src/hooks/useStateProps.ts
|
|
247
|
-
var
|
|
213
|
+
var import_react3 = require("react");
|
|
248
214
|
var import_react_fast_compare = __toESM(require("react-fast-compare"));
|
|
249
215
|
var KEBAB_REGEX = /[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g;
|
|
250
216
|
var toKebap = (val) => val.replace(KEBAB_REGEX, (match) => `-${match.toLocaleLowerCase()}`);
|
|
251
217
|
var useStateProps = (states) => {
|
|
252
|
-
const statePropsRef = (0,
|
|
218
|
+
const statePropsRef = (0, import_react3.useRef)({});
|
|
253
219
|
let stateProps = {};
|
|
254
220
|
for (let state in states) {
|
|
255
221
|
if (states[state]) {
|
|
@@ -264,7 +230,7 @@ var useStateProps = (states) => {
|
|
|
264
230
|
};
|
|
265
231
|
|
|
266
232
|
// src/hooks/useSmallScreen.ts
|
|
267
|
-
var
|
|
233
|
+
var import_react4 = require("react");
|
|
268
234
|
var useSmallScreen = () => {
|
|
269
235
|
const getMatches = () => {
|
|
270
236
|
if (typeof window == "undefined") {
|
|
@@ -272,11 +238,11 @@ var useSmallScreen = () => {
|
|
|
272
238
|
}
|
|
273
239
|
return window.matchMedia("(max-width: 600px)").matches;
|
|
274
240
|
};
|
|
275
|
-
const [matches, setMatches] = (0,
|
|
276
|
-
const handleResize = (0,
|
|
241
|
+
const [matches, setMatches] = (0, import_react4.useState)(getMatches());
|
|
242
|
+
const handleResize = (0, import_react4.useCallback)(() => {
|
|
277
243
|
setMatches(getMatches());
|
|
278
244
|
}, []);
|
|
279
|
-
(0,
|
|
245
|
+
(0, import_react4.useEffect)(() => {
|
|
280
246
|
handleResize();
|
|
281
247
|
if (typeof window == "undefined")
|
|
282
248
|
return;
|
|
@@ -286,6 +252,58 @@ var useSmallScreen = () => {
|
|
|
286
252
|
return matches;
|
|
287
253
|
};
|
|
288
254
|
|
|
255
|
+
// src/components/SVG/SVG.tsx
|
|
256
|
+
var SVG = (0, import_react5.forwardRef)(
|
|
257
|
+
({ size = 24, children, className, color, ...props }, ref) => {
|
|
258
|
+
const theme = useTheme();
|
|
259
|
+
return /* @__PURE__ */ import_react5.default.createElement(
|
|
260
|
+
"svg",
|
|
261
|
+
{
|
|
262
|
+
...props,
|
|
263
|
+
ref,
|
|
264
|
+
width: `${props.width || size}px`,
|
|
265
|
+
height: `${props.height || size}px`,
|
|
266
|
+
className: cn("flex-none fill-current text-[--color]", className),
|
|
267
|
+
style: createVar({
|
|
268
|
+
color: color && getColor(
|
|
269
|
+
theme,
|
|
270
|
+
color,
|
|
271
|
+
color
|
|
272
|
+
/* fallback */
|
|
273
|
+
)
|
|
274
|
+
})
|
|
275
|
+
},
|
|
276
|
+
children
|
|
277
|
+
);
|
|
278
|
+
}
|
|
279
|
+
);
|
|
280
|
+
|
|
281
|
+
// src/components/Formatters/DateFormat.tsx
|
|
282
|
+
var import_react6 = __toESM(require("react"));
|
|
283
|
+
var import_i18n = require("@react-aria/i18n");
|
|
284
|
+
var DateFormat = ({ value, tabular, ...props }) => {
|
|
285
|
+
const dateFormatter = (0, import_i18n.useDateFormatter)({
|
|
286
|
+
...props
|
|
287
|
+
});
|
|
288
|
+
return /* @__PURE__ */ import_react6.default.createElement("span", { className: tabular ? "tabular-nums" : "" }, dateFormatter.format(value));
|
|
289
|
+
};
|
|
290
|
+
|
|
291
|
+
// src/components/Formatters/NumericFormat.tsx
|
|
292
|
+
var import_react7 = __toESM(require("react"));
|
|
293
|
+
var import_i18n2 = require("@react-aria/i18n");
|
|
294
|
+
var NumericFormat = ({
|
|
295
|
+
value,
|
|
296
|
+
styleFormat,
|
|
297
|
+
tabular = true,
|
|
298
|
+
...props
|
|
299
|
+
}) => {
|
|
300
|
+
const numberFormatter = (0, import_i18n2.useNumberFormatter)({
|
|
301
|
+
style: styleFormat,
|
|
302
|
+
...props
|
|
303
|
+
});
|
|
304
|
+
return /* @__PURE__ */ import_react7.default.createElement("span", { className: tabular ? "tabular-nums" : "" }, numberFormatter.format(value));
|
|
305
|
+
};
|
|
306
|
+
|
|
289
307
|
// src/style-props.tsx
|
|
290
308
|
var width = {
|
|
291
309
|
full: "w-full",
|
|
@@ -759,8 +777,10 @@ var cursorStyle = {
|
|
|
759
777
|
fontWeight,
|
|
760
778
|
gapSpace,
|
|
761
779
|
get,
|
|
780
|
+
getColor,
|
|
762
781
|
gridColsAlign,
|
|
763
782
|
gridColumn,
|
|
783
|
+
isObject,
|
|
764
784
|
objectFit,
|
|
765
785
|
objectPosition,
|
|
766
786
|
paddingBottom,
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/components/SVG/SVG.tsx
|
|
2
|
-
import
|
|
2
|
+
import React2, { forwardRef } from "react";
|
|
3
3
|
|
|
4
4
|
// src/utils.ts
|
|
5
5
|
import { cx } from "class-variance-authority";
|
|
@@ -16,6 +16,7 @@ var cn = (...inputs) => twMerge(cx(inputs));
|
|
|
16
16
|
var createVar = (o) => Object.fromEntries(
|
|
17
17
|
Object.entries(o).map(([name, val]) => [`--${name}`, val])
|
|
18
18
|
);
|
|
19
|
+
var isObject = (val) => val && val.constructor === Object;
|
|
19
20
|
var get = (obj, path, fallback) => {
|
|
20
21
|
const key = path.split(".");
|
|
21
22
|
let result = obj;
|
|
@@ -26,50 +27,13 @@ var get = (obj, path, fallback) => {
|
|
|
26
27
|
}
|
|
27
28
|
return result === void 0 ? fallback : result;
|
|
28
29
|
};
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
({ size = 24, children, className, ...props }, ref) => /* @__PURE__ */ React.createElement(
|
|
33
|
-
"svg",
|
|
34
|
-
{
|
|
35
|
-
...props,
|
|
36
|
-
ref,
|
|
37
|
-
width: `${props.width || size}px`,
|
|
38
|
-
height: `${props.height || size}px`,
|
|
39
|
-
className: cn("flex-none fill-current", className)
|
|
40
|
-
},
|
|
41
|
-
children
|
|
42
|
-
)
|
|
43
|
-
);
|
|
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));
|
|
30
|
+
var getColor = (theme, path, fallback) => {
|
|
31
|
+
const result = get(theme.colors || {}, path.replace("-", "."), fallback);
|
|
32
|
+
return isObject(result) ? result["DEFAULT"] : result;
|
|
69
33
|
};
|
|
70
34
|
|
|
71
35
|
// src/hooks/useTheme.tsx
|
|
72
|
-
import
|
|
36
|
+
import React, { createContext, useContext } from "react";
|
|
73
37
|
|
|
74
38
|
// src/defaultTheme.ts
|
|
75
39
|
var defaultTheme = {
|
|
@@ -97,7 +61,7 @@ function ThemeProvider({
|
|
|
97
61
|
}) {
|
|
98
62
|
var _a;
|
|
99
63
|
const root = (_a = theme.root) == null ? void 0 : _a.call(theme);
|
|
100
|
-
return /* @__PURE__ */
|
|
64
|
+
return /* @__PURE__ */ React.createElement(InternalContext.Provider, { value: theme }, /* @__PURE__ */ React.createElement("div", { className: cn(root ? root : "", className) }, children));
|
|
101
65
|
}
|
|
102
66
|
|
|
103
67
|
// src/hooks/useClassNames.tsx
|
|
@@ -216,6 +180,58 @@ var useSmallScreen = () => {
|
|
|
216
180
|
return matches;
|
|
217
181
|
};
|
|
218
182
|
|
|
183
|
+
// src/components/SVG/SVG.tsx
|
|
184
|
+
var SVG = forwardRef(
|
|
185
|
+
({ size = 24, children, className, color, ...props }, ref) => {
|
|
186
|
+
const theme = useTheme();
|
|
187
|
+
return /* @__PURE__ */ React2.createElement(
|
|
188
|
+
"svg",
|
|
189
|
+
{
|
|
190
|
+
...props,
|
|
191
|
+
ref,
|
|
192
|
+
width: `${props.width || size}px`,
|
|
193
|
+
height: `${props.height || size}px`,
|
|
194
|
+
className: cn("flex-none fill-current text-[--color]", className),
|
|
195
|
+
style: createVar({
|
|
196
|
+
color: color && getColor(
|
|
197
|
+
theme,
|
|
198
|
+
color,
|
|
199
|
+
color
|
|
200
|
+
/* fallback */
|
|
201
|
+
)
|
|
202
|
+
})
|
|
203
|
+
},
|
|
204
|
+
children
|
|
205
|
+
);
|
|
206
|
+
}
|
|
207
|
+
);
|
|
208
|
+
|
|
209
|
+
// src/components/Formatters/DateFormat.tsx
|
|
210
|
+
import React3 from "react";
|
|
211
|
+
import { useDateFormatter } from "@react-aria/i18n";
|
|
212
|
+
var DateFormat = ({ value, tabular, ...props }) => {
|
|
213
|
+
const dateFormatter = useDateFormatter({
|
|
214
|
+
...props
|
|
215
|
+
});
|
|
216
|
+
return /* @__PURE__ */ React3.createElement("span", { className: tabular ? "tabular-nums" : "" }, dateFormatter.format(value));
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
// src/components/Formatters/NumericFormat.tsx
|
|
220
|
+
import React4 from "react";
|
|
221
|
+
import { useNumberFormatter } from "@react-aria/i18n";
|
|
222
|
+
var NumericFormat = ({
|
|
223
|
+
value,
|
|
224
|
+
styleFormat,
|
|
225
|
+
tabular = true,
|
|
226
|
+
...props
|
|
227
|
+
}) => {
|
|
228
|
+
const numberFormatter = useNumberFormatter({
|
|
229
|
+
style: styleFormat,
|
|
230
|
+
...props
|
|
231
|
+
});
|
|
232
|
+
return /* @__PURE__ */ React4.createElement("span", { className: tabular ? "tabular-nums" : "" }, numberFormatter.format(value));
|
|
233
|
+
};
|
|
234
|
+
|
|
219
235
|
// src/style-props.tsx
|
|
220
236
|
var width = {
|
|
221
237
|
full: "w-full",
|
|
@@ -688,8 +704,10 @@ export {
|
|
|
688
704
|
fontWeight,
|
|
689
705
|
gapSpace,
|
|
690
706
|
get,
|
|
707
|
+
getColor,
|
|
691
708
|
gridColsAlign,
|
|
692
709
|
gridColumn,
|
|
710
|
+
isObject,
|
|
693
711
|
objectFit,
|
|
694
712
|
objectPosition,
|
|
695
713
|
paddingBottom,
|