@szum-tech/design-system 1.4.0 → 1.5.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.ts +31 -3
- package/dist/index.js +31 -3
- package/dist/index.mjs +32 -5
- package/package.json +2 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,35 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import React__default from 'react';
|
|
3
1
|
import { VariantProps } from 'class-variance-authority';
|
|
4
2
|
import * as class_variance_authority_dist_types from 'class-variance-authority/dist/types';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import React__default from 'react';
|
|
5
|
+
|
|
6
|
+
declare const avatarCva: (props?: ({
|
|
7
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
8
|
+
} & class_variance_authority_dist_types.ClassProp) | undefined) => string;
|
|
9
|
+
|
|
10
|
+
declare type AvatarCvaProps = VariantProps<typeof avatarCva>;
|
|
11
|
+
declare type AvatarSizeType = NonNullable<AvatarCvaProps["size"]>;
|
|
12
|
+
|
|
13
|
+
declare type AvatarProps = React.ComponentPropsWithoutRef<"div"> & {
|
|
14
|
+
/**
|
|
15
|
+
* Defines avatar image alt
|
|
16
|
+
*/
|
|
17
|
+
alt?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Defines background color
|
|
20
|
+
*/
|
|
21
|
+
bg?: `bg-${string}` | `bg-${string}-${number}`;
|
|
22
|
+
/**
|
|
23
|
+
* Defines avatar size
|
|
24
|
+
* @default 'md'
|
|
25
|
+
*/
|
|
26
|
+
size?: AvatarSizeType;
|
|
27
|
+
/**
|
|
28
|
+
* Defines avatar image src
|
|
29
|
+
*/
|
|
30
|
+
src?: string;
|
|
31
|
+
};
|
|
32
|
+
declare function Avatar({ alt, bg, children, size, src, ...props }: AvatarProps): JSX.Element;
|
|
5
33
|
|
|
6
34
|
declare const buttonCva: (props?: ({
|
|
7
35
|
color?: "neutral" | "primary" | "success" | "warning" | "error" | null | undefined;
|
|
@@ -68,4 +96,4 @@ declare function ThemeProvider({ children, defaultTheme, theme }: ThemeProviderP
|
|
|
68
96
|
|
|
69
97
|
declare const useTheme: () => ThemeContextType;
|
|
70
98
|
|
|
71
|
-
export { _default as Button, ThemeContext, ThemeContextType, ThemeProvider, ThemeProviderProps, ThemeType, useTheme };
|
|
99
|
+
export { Avatar, AvatarProps, AvatarSizeType, _default as Button, ThemeContext, ThemeContextType, ThemeProvider, ThemeProviderProps, ThemeType, useTheme };
|
package/dist/index.js
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var React3 = require('react');
|
|
6
5
|
var classVarianceAuthority = require('class-variance-authority');
|
|
7
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
var React3 = require('react');
|
|
8
8
|
|
|
9
9
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
10
10
|
|
|
@@ -29,7 +29,34 @@ function _interopNamespace(e) {
|
|
|
29
29
|
var React3__namespace = /*#__PURE__*/_interopNamespace(React3);
|
|
30
30
|
var React3__default = /*#__PURE__*/_interopDefaultLegacy(React3);
|
|
31
31
|
|
|
32
|
-
// src/components/
|
|
32
|
+
// src/components/Avatar/Avatar.styles.ts
|
|
33
|
+
var avatarCva = classVarianceAuthority.cva(
|
|
34
|
+
"select-none rounded font-semibold leading-none justify-center flex items-center bg-gray-500 text-white dark:text-black",
|
|
35
|
+
{
|
|
36
|
+
variants: {
|
|
37
|
+
size: {
|
|
38
|
+
sm: "h-6 w-6 text-lg",
|
|
39
|
+
md: "h-10 w-10 text-xl",
|
|
40
|
+
lg: "h-14 w-14 text-2xl"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
defaultVariants: {
|
|
44
|
+
size: "md"
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
);
|
|
48
|
+
function Avatar({ alt, bg, children, size = "md", src, ...props }) {
|
|
49
|
+
const avatarStyles = avatarCva({ size, className: bg });
|
|
50
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", {
|
|
51
|
+
className: avatarStyles,
|
|
52
|
+
...props,
|
|
53
|
+
children: src ? /* @__PURE__ */ jsxRuntime.jsx("img", {
|
|
54
|
+
className: "h-full w-full rounded object-cover object-center",
|
|
55
|
+
alt,
|
|
56
|
+
src
|
|
57
|
+
}) : children
|
|
58
|
+
});
|
|
59
|
+
}
|
|
33
60
|
var buttonCva = classVarianceAuthority.cva(
|
|
34
61
|
"border rounded font-sans font-medium leading-[1.75] tracking-[.02857em]",
|
|
35
62
|
{
|
|
@@ -167,7 +194,7 @@ var Button_default = React3__namespace.forwardRef(function({
|
|
|
167
194
|
const Component = as || "button";
|
|
168
195
|
const buttonRootStyles = buttonCva({ size, variant, color });
|
|
169
196
|
return /* @__PURE__ */ jsxRuntime.jsx(Component, {
|
|
170
|
-
className: buttonRootStyles
|
|
197
|
+
className: buttonRootStyles,
|
|
171
198
|
ref,
|
|
172
199
|
...restProps,
|
|
173
200
|
children
|
|
@@ -209,6 +236,7 @@ function ThemeProvider({ children, defaultTheme, theme }) {
|
|
|
209
236
|
// src/hooks/useTheme/useTheme.tsx
|
|
210
237
|
var useTheme = () => React3__default["default"].useContext(ThemeContext);
|
|
211
238
|
|
|
239
|
+
exports.Avatar = Avatar;
|
|
212
240
|
exports.Button = Button_default;
|
|
213
241
|
exports.ThemeContext = ThemeContext;
|
|
214
242
|
exports.ThemeProvider = ThemeProvider;
|
package/dist/index.mjs
CHANGED
|
@@ -1,9 +1,36 @@
|
|
|
1
|
-
import * as React3 from 'react';
|
|
2
|
-
import React3__default from 'react';
|
|
3
1
|
import { cva } from 'class-variance-authority';
|
|
4
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import * as React3 from 'react';
|
|
4
|
+
import React3__default from 'react';
|
|
5
5
|
|
|
6
|
-
// src/components/
|
|
6
|
+
// src/components/Avatar/Avatar.styles.ts
|
|
7
|
+
var avatarCva = cva(
|
|
8
|
+
"select-none rounded font-semibold leading-none justify-center flex items-center bg-gray-500 text-white dark:text-black",
|
|
9
|
+
{
|
|
10
|
+
variants: {
|
|
11
|
+
size: {
|
|
12
|
+
sm: "h-6 w-6 text-lg",
|
|
13
|
+
md: "h-10 w-10 text-xl",
|
|
14
|
+
lg: "h-14 w-14 text-2xl"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
defaultVariants: {
|
|
18
|
+
size: "md"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
);
|
|
22
|
+
function Avatar({ alt, bg, children, size = "md", src, ...props }) {
|
|
23
|
+
const avatarStyles = avatarCva({ size, className: bg });
|
|
24
|
+
return /* @__PURE__ */ jsx("div", {
|
|
25
|
+
className: avatarStyles,
|
|
26
|
+
...props,
|
|
27
|
+
children: src ? /* @__PURE__ */ jsx("img", {
|
|
28
|
+
className: "h-full w-full rounded object-cover object-center",
|
|
29
|
+
alt,
|
|
30
|
+
src
|
|
31
|
+
}) : children
|
|
32
|
+
});
|
|
33
|
+
}
|
|
7
34
|
var buttonCva = cva(
|
|
8
35
|
"border rounded font-sans font-medium leading-[1.75] tracking-[.02857em]",
|
|
9
36
|
{
|
|
@@ -141,7 +168,7 @@ var Button_default = React3.forwardRef(function({
|
|
|
141
168
|
const Component = as || "button";
|
|
142
169
|
const buttonRootStyles = buttonCva({ size, variant, color });
|
|
143
170
|
return /* @__PURE__ */ jsx(Component, {
|
|
144
|
-
className: buttonRootStyles
|
|
171
|
+
className: buttonRootStyles,
|
|
145
172
|
ref,
|
|
146
173
|
...restProps,
|
|
147
174
|
children
|
|
@@ -183,4 +210,4 @@ function ThemeProvider({ children, defaultTheme, theme }) {
|
|
|
183
210
|
// src/hooks/useTheme/useTheme.tsx
|
|
184
211
|
var useTheme = () => React3__default.useContext(ThemeContext);
|
|
185
212
|
|
|
186
|
-
export { Button_default as Button, ThemeContext, ThemeProvider, useTheme };
|
|
213
|
+
export { Avatar, Button_default as Button, ThemeContext, ThemeProvider, useTheme };
|
package/package.json
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
},
|
|
6
6
|
"description": "Szum-Tech design system with tailwindcss support",
|
|
7
7
|
"dependencies": {
|
|
8
|
+
"@heroicons/react": "^2.0.15",
|
|
8
9
|
"class-variance-authority": "^0.4.0",
|
|
9
10
|
"tailwindcss": "^3.2.4"
|
|
10
11
|
},
|
|
@@ -96,7 +97,7 @@
|
|
|
96
97
|
},
|
|
97
98
|
"sideEffects": false,
|
|
98
99
|
"types": "./dist/index.d.ts",
|
|
99
|
-
"version": "1.
|
|
100
|
+
"version": "1.5.0",
|
|
100
101
|
"peerDependencies": {
|
|
101
102
|
"@tailwindcss/container-queries": "^0.1.0",
|
|
102
103
|
"react": "^18.2.0",
|