@fluidattacks/design 1.2.0 → 1.2.2
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/dist/design.d.mts +9 -0
- package/dist/dist/design.d.ts +9 -0
- package/dist/eslint.config.d.mts +2 -0
- package/dist/src/components/@core/constants.d.ts +2 -0
- package/dist/src/components/@core/styles.d.ts +3 -0
- package/dist/src/components/@core/types.d.ts +80 -0
- package/dist/src/components/@core/utils.d.ts +11 -0
- package/dist/src/components/@core/variants/utils.d.ts +60 -0
- package/dist/src/components/cloud-image/index.d.ts +12 -0
- package/dist/src/components/colors/index.d.ts +10 -0
- package/dist/src/hooks/index.d.ts +2 -0
- package/dist/src/hooks/use-cloudinary-image.d.ts +7 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/vite.config.d.ts +3 -0
- package/package.json +20 -12
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { default as Yr } from 'react';
|
|
2
|
+
export { bu as CloudImage };
|
|
3
|
+
declare const bu: Yr.MemoExoticComponent<({ alt: t, height: e, publicId: r, width: n, plugins: s }: {
|
|
4
|
+
alt: any;
|
|
5
|
+
height: any;
|
|
6
|
+
publicId: any;
|
|
7
|
+
width: any;
|
|
8
|
+
plugins?: (((r?: any, n?: any, s?: any, c?: any) => false | Promise<any>) | ((e?: any, r?: any, n?: any, s?: any, c?: any) => true | Promise<any> | undefined))[] | undefined;
|
|
9
|
+
}) => any>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { ou as CloudImage };
|
|
2
|
+
declare const ou: Gt.MemoExoticComponent<({ alt: t, height: e, publicId: r, width: n, plugins: s }: {
|
|
3
|
+
alt: any;
|
|
4
|
+
height: any;
|
|
5
|
+
publicId: any;
|
|
6
|
+
width: any;
|
|
7
|
+
plugins?: (((r?: any, n?: any, s?: any, c?: any) => false | Promise<any>) | ((e?: any, r?: any, n?: any, s?: any, c?: any) => true | Promise<any> | undefined))[] | undefined;
|
|
8
|
+
}) => any>;
|
|
9
|
+
import Gt = require("react");
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { TModifiable } from './types';
|
|
2
|
+
declare const BaseComponent: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, TModifiable>> & string;
|
|
3
|
+
export { BaseComponent };
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { Property } from 'csstype';
|
|
2
|
+
import { DefaultTheme } from 'styled-components';
|
|
3
|
+
type TSpacing = keyof DefaultTheme["spacing"];
|
|
4
|
+
type TShadows = keyof DefaultTheme["shadows"];
|
|
5
|
+
interface IPaddingModifiable {
|
|
6
|
+
padding?: [TSpacing, TSpacing, TSpacing, TSpacing];
|
|
7
|
+
px?: TSpacing;
|
|
8
|
+
py?: TSpacing;
|
|
9
|
+
pl?: TSpacing;
|
|
10
|
+
pr?: TSpacing;
|
|
11
|
+
pt?: TSpacing;
|
|
12
|
+
pb?: TSpacing;
|
|
13
|
+
}
|
|
14
|
+
interface IMarginModifiable {
|
|
15
|
+
margin?: [TSpacing, TSpacing, TSpacing, TSpacing];
|
|
16
|
+
mx?: TSpacing;
|
|
17
|
+
my?: TSpacing;
|
|
18
|
+
ml?: TSpacing;
|
|
19
|
+
mr?: TSpacing;
|
|
20
|
+
mt?: TSpacing;
|
|
21
|
+
mb?: TSpacing;
|
|
22
|
+
}
|
|
23
|
+
interface IPositionModifiable {
|
|
24
|
+
zIndex?: number;
|
|
25
|
+
position?: Property.Position;
|
|
26
|
+
top?: string;
|
|
27
|
+
right?: string;
|
|
28
|
+
bottom?: string;
|
|
29
|
+
left?: string;
|
|
30
|
+
}
|
|
31
|
+
interface IBorderModifiable {
|
|
32
|
+
border?: string;
|
|
33
|
+
borderTop?: string;
|
|
34
|
+
borderRight?: string;
|
|
35
|
+
borderBottom?: string;
|
|
36
|
+
borderLeft?: string;
|
|
37
|
+
borderColor?: string;
|
|
38
|
+
borderRadius?: string;
|
|
39
|
+
}
|
|
40
|
+
interface IDisplayModifiable {
|
|
41
|
+
scroll?: "none" | "x" | "xy" | "y";
|
|
42
|
+
visibility?: Property.Visibility;
|
|
43
|
+
display?: Property.Display;
|
|
44
|
+
height?: string;
|
|
45
|
+
width?: string;
|
|
46
|
+
maxHeight?: string;
|
|
47
|
+
maxWidth?: string;
|
|
48
|
+
minHeight?: string;
|
|
49
|
+
minWidth?: string;
|
|
50
|
+
shadow?: TShadows;
|
|
51
|
+
bgColor?: string;
|
|
52
|
+
bgGradient?: string;
|
|
53
|
+
gap?: TSpacing;
|
|
54
|
+
flexDirection?: Property.FlexDirection;
|
|
55
|
+
flexGrow?: Property.FlexGrow;
|
|
56
|
+
justify?: Property.JustifyContent;
|
|
57
|
+
justifySelf?: Property.JustifyContent;
|
|
58
|
+
alignItems?: Property.AlignItems;
|
|
59
|
+
alignSelf?: Property.AlignItems;
|
|
60
|
+
wrap?: Property.FlexWrap;
|
|
61
|
+
}
|
|
62
|
+
interface ITextModifiable {
|
|
63
|
+
color?: string;
|
|
64
|
+
fontSize?: Property.FontSize<number | string>;
|
|
65
|
+
fontWeight?: Property.FontWeight;
|
|
66
|
+
lineSpacing?: Property.LineHeight<number | string>;
|
|
67
|
+
textAlign?: Property.TextAlign;
|
|
68
|
+
textOverflow?: Property.Overflow;
|
|
69
|
+
whiteSpace?: Property.WhiteSpace;
|
|
70
|
+
wordBreak?: Property.WordBreak;
|
|
71
|
+
}
|
|
72
|
+
interface IInteractionModifiable {
|
|
73
|
+
cursor?: Property.Cursor;
|
|
74
|
+
transition?: string;
|
|
75
|
+
borderColorHover?: string;
|
|
76
|
+
bgColorHover?: string;
|
|
77
|
+
shadowHover?: TShadows;
|
|
78
|
+
}
|
|
79
|
+
type TModifiable = IBorderModifiable & IDisplayModifiable & IInteractionModifiable & IMarginModifiable & IPaddingModifiable & IPositionModifiable & ITextModifiable;
|
|
80
|
+
export type { TSpacing, IPaddingModifiable, IMarginModifiable, IDisplayModifiable, ITextModifiable, IInteractionModifiable, IPositionModifiable, IBorderModifiable, TModifiable, };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { StyledOptions } from 'styled-components';
|
|
2
|
+
import { IBorderModifiable, IDisplayModifiable, IInteractionModifiable, IMarginModifiable, IPaddingModifiable, IPositionModifiable, ITextModifiable } from './types';
|
|
3
|
+
declare const setPadding: (props: Readonly<IPaddingModifiable>) => string;
|
|
4
|
+
declare const setMargin: (props: Readonly<IMarginModifiable>) => string;
|
|
5
|
+
declare const setPosition: (props: Readonly<IPositionModifiable>) => string;
|
|
6
|
+
declare const setBorder: (props: Readonly<IBorderModifiable>) => string;
|
|
7
|
+
declare const setDisplay: (props: Readonly<IDisplayModifiable>) => string;
|
|
8
|
+
declare const setText: (props: Readonly<ITextModifiable>) => string;
|
|
9
|
+
declare const setInteraction: (props: Readonly<IInteractionModifiable>) => string;
|
|
10
|
+
declare const getStyledConfig: () => StyledOptions<"web", object>;
|
|
11
|
+
export { setPadding, setText, setMargin, setInteraction, setPosition, setDisplay, setBorder, getStyledConfig, };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { IconPrefix } from '@fortawesome/free-solid-svg-icons';
|
|
2
|
+
import { DefaultTheme, Interpolation } from 'styled-components';
|
|
3
|
+
type TCssString = Interpolation<object>[];
|
|
4
|
+
/**
|
|
5
|
+
* Object with the icons to be printed on Iconography section.
|
|
6
|
+
* The key is the name of the icon and the value is an array of icon prefixes.
|
|
7
|
+
*
|
|
8
|
+
* Possible prefixes are:
|
|
9
|
+
* - `fas`: for solid icons
|
|
10
|
+
* - `far`: for regular icons
|
|
11
|
+
*
|
|
12
|
+
* Example:
|
|
13
|
+
* ```ts
|
|
14
|
+
* const icons: IconsList = {
|
|
15
|
+
* "user": ["far", "fas"],
|
|
16
|
+
* "search": ["fas"],
|
|
17
|
+
* ...
|
|
18
|
+
* };
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
type TIconsList = Record<string, [IconPrefix, IconPrefix] | [IconPrefix]>;
|
|
22
|
+
interface IComponentVariant<T extends string> {
|
|
23
|
+
/**
|
|
24
|
+
* Get the variant css string. It can be added to `styled` template string.
|
|
25
|
+
*
|
|
26
|
+
* @param theme Theme to use
|
|
27
|
+
* @param variant Variant to get
|
|
28
|
+
* @returns Css string for the variant
|
|
29
|
+
*/
|
|
30
|
+
getVariant: (theme: Readonly<DefaultTheme>, variant: T) => TCssString;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Builder function to create a function for getting component variants
|
|
34
|
+
* injecting the theme.
|
|
35
|
+
*
|
|
36
|
+
* Example:
|
|
37
|
+
* ```ts
|
|
38
|
+
* const { getVariant } = variantBuilder((theme) => ({
|
|
39
|
+
* primary: css`
|
|
40
|
+
* background: ${theme.colors.primary};
|
|
41
|
+
* border: 2px solid ${theme.colors.primary};
|
|
42
|
+
* color: ${theme.colors.white};
|
|
43
|
+
* `,
|
|
44
|
+
* secondary: css`
|
|
45
|
+
* background: ${theme.colors.secondary};
|
|
46
|
+
* border: 2px solid ${theme.colors.secondary};
|
|
47
|
+
* color: ${theme.colors.white};
|
|
48
|
+
* `,
|
|
49
|
+
* }));
|
|
50
|
+
*
|
|
51
|
+
* getVariant(theme, "primary"); // returns the primary variant
|
|
52
|
+
* ```
|
|
53
|
+
*
|
|
54
|
+
* @param variants A function that returns the variants of a component as
|
|
55
|
+
* an object with variants as keys and values as css strings.
|
|
56
|
+
* @returns An object with a function to get the variant.
|
|
57
|
+
*/
|
|
58
|
+
declare const variantBuilder: <T extends string>(variants: (theme: Readonly<DefaultTheme>) => Record<T, TCssString>) => IComponentVariant<T>;
|
|
59
|
+
export type { TCssString, IComponentVariant, TIconsList };
|
|
60
|
+
export { variantBuilder };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Plugins } from '@cloudinary/html';
|
|
2
|
+
import { default as React } from 'react';
|
|
3
|
+
interface IImageProps {
|
|
4
|
+
alt?: string;
|
|
5
|
+
height?: number | string;
|
|
6
|
+
publicId: string;
|
|
7
|
+
width?: number | string;
|
|
8
|
+
plugins?: Plugins;
|
|
9
|
+
}
|
|
10
|
+
declare const MemoizedImage: React.MemoExoticComponent<({ alt, height, publicId, width, plugins, }: Readonly<IImageProps>) => JSX.Element>;
|
|
11
|
+
export type { IImageProps };
|
|
12
|
+
export default MemoizedImage;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { IconName, IconPrefix } from '@fortawesome/free-solid-svg-icons';
|
|
2
|
+
import { default as React } from 'react';
|
|
3
|
+
import { DefaultTheme } from 'styled-components';
|
|
4
|
+
declare const icons: IconName[];
|
|
5
|
+
declare const uniqueIcons: [IconPrefix, IconName][];
|
|
6
|
+
declare const theme: DefaultTheme;
|
|
7
|
+
declare const CustomThemeProvider: ({ children, }: Readonly<{
|
|
8
|
+
children: React.ReactNode;
|
|
9
|
+
}>) => JSX.Element;
|
|
10
|
+
export { CustomThemeProvider, theme, icons, uniqueIcons };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { CloudinaryImage } from '@cloudinary/url-gen';
|
|
2
|
+
interface IUseCloudinaryImageProps {
|
|
3
|
+
readonly publicId: string;
|
|
4
|
+
readonly format?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare const useCloudinaryImage: ({ publicId, format, }: IUseCloudinaryImageProps) => CloudinaryImage;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as CloudImage } from './components/cloud-image';
|
package/package.json
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"@cloudinary/react": "1.13.0",
|
|
9
9
|
"@cloudinary/url-gen": "1.21.0",
|
|
10
|
+
"@fortawesome/free-solid-svg-icons": "6.6.0",
|
|
10
11
|
"react": "18.2.0",
|
|
11
12
|
"react-dom": "18.2.0",
|
|
12
13
|
"styled-components": "6.1.13"
|
|
@@ -15,17 +16,23 @@
|
|
|
15
16
|
"@types/react": "18.2.0",
|
|
16
17
|
"@types/react-dom": "18.2.0",
|
|
17
18
|
"@vitejs/plugin-react-swc": "3.7.1",
|
|
19
|
+
"eslint": "9.11.1",
|
|
20
|
+
"eslint-config-prettier": "9.1.0",
|
|
21
|
+
"eslint-plugin-functional": "7.0.2",
|
|
22
|
+
"eslint-plugin-jsx-a11y": "6.10.0",
|
|
23
|
+
"eslint-plugin-prettier": "5.2.1",
|
|
24
|
+
"eslint-plugin-react": "7.37.0",
|
|
25
|
+
"postcss-styled-syntax": "0.6.4",
|
|
26
|
+
"stylelint": "16.9.0",
|
|
27
|
+
"stylelint-config-standard": "36.0.1",
|
|
18
28
|
"typescript": "5.6.2",
|
|
19
|
-
"
|
|
20
|
-
"vite": "5.4.8"
|
|
29
|
+
"typescript-eslint": "8.8.0",
|
|
30
|
+
"vite": "5.4.8",
|
|
31
|
+
"vite-plugin-dts": "4.2.3"
|
|
21
32
|
},
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
|
|
25
|
-
"require": "./dist/index.cjs"
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
"files": ["dist"],
|
|
33
|
+
"files": [
|
|
34
|
+
"dist"
|
|
35
|
+
],
|
|
29
36
|
"homepage": "https://gitlab.com/fluidattacks/universe#readme",
|
|
30
37
|
"keywords": [
|
|
31
38
|
"components",
|
|
@@ -33,8 +40,9 @@
|
|
|
33
40
|
"fluidattacks"
|
|
34
41
|
],
|
|
35
42
|
"license": "MPL-2.0",
|
|
36
|
-
"main": "
|
|
37
|
-
"module": "
|
|
43
|
+
"main": "dist/design.js",
|
|
44
|
+
"module": "dist/design.mjs",
|
|
45
|
+
"types": "dist/src/index.d.ts",
|
|
38
46
|
"name": "@fluidattacks/design",
|
|
39
47
|
"publishConfig": {
|
|
40
48
|
"access": "public"
|
|
@@ -48,5 +56,5 @@
|
|
|
48
56
|
"build": "tsc && vite build",
|
|
49
57
|
"preview": "vite preview"
|
|
50
58
|
},
|
|
51
|
-
"version": "1.2.
|
|
59
|
+
"version": "1.2.2"
|
|
52
60
|
}
|