@adamjanicki/ui 1.6.5 → 1.6.7
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/components/Accordion/Accordion.js +12 -13
- package/components/Alert/Alert.d.ts +1 -6
- package/components/Alert/Alert.js +2 -2
- package/components/Animated/Animated.d.ts +21 -22
- package/components/Animated/Animated.js +2 -2
- package/components/Avatar/Avatar.d.ts +1 -6
- package/components/Avatar/Avatar.js +4 -4
- package/components/Badge/Badge.d.ts +1 -6
- package/components/Badge/Badge.js +2 -2
- package/components/Banner/Banner.js +2 -2
- package/components/Box/Box.d.ts +4 -13
- package/components/Box/Box.js +2 -30
- package/components/Button/Button.d.ts +19 -16
- package/components/Button/Button.js +18 -10
- package/components/Carousel/Carousel.js +16 -3
- package/components/Hamburger/Hamburger.d.ts +1 -1
- package/components/Icon/Icon.d.ts +2 -1
- package/components/Icon/Icon.js +2 -1
- package/components/Input/IconInput.d.ts +5 -17
- package/components/Input/IconInput.js +16 -3
- package/components/Input/Input.d.ts +5 -10
- package/components/Input/Input.js +3 -2
- package/components/Input/TextArea.d.ts +3 -9
- package/components/Input/TextArea.js +3 -2
- package/components/Layer/Layer.js +2 -2
- package/components/Link/Link.d.ts +7 -5
- package/components/Link/Link.js +12 -8
- package/components/Modal/Modal.js +11 -2
- package/components/Select/Select.d.ts +6 -5
- package/components/Select/Select.js +5 -3
- package/components/Spinner/Spinner.d.ts +2 -11
- package/components/Spinner/Spinner.js +1 -1
- package/components/ui.d.ts +16 -0
- package/components/ui.js +44 -0
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/package.json +1 -1
- package/style.css +1 -1
- package/utils/transformVfx.d.ts +2 -0
- package/utils/transformVfx.js +147 -0
- package/utils/types.d.ts +70 -50
- package/utils/transformLayout.d.ts +0 -2
- package/utils/transformLayout.js +0 -76
package/utils/types.d.ts
CHANGED
|
@@ -1,83 +1,103 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
/**
|
|
3
|
-
* Default children type; can be a node or list of nodes
|
|
4
|
-
*/
|
|
5
2
|
export type Children = React.ReactNode | React.ReactNode[];
|
|
6
|
-
/**
|
|
7
|
-
* The type of corner to display, controlling the border radius property.
|
|
8
|
-
*/
|
|
9
|
-
export type CornerType = "pill" | "rounded" | "sharp";
|
|
10
|
-
/**
|
|
11
|
-
* The type of message associated with a piece of content.
|
|
12
|
-
*/
|
|
13
3
|
export type ContentType = "success" | "warning" | "error" | "info" | "static";
|
|
14
|
-
/**
|
|
15
|
-
* Standard style object to apply inline styling to components.
|
|
16
|
-
*/
|
|
17
4
|
export type Style = React.CSSProperties;
|
|
18
|
-
/**
|
|
19
|
-
* Used for width and height
|
|
20
|
-
*/
|
|
21
5
|
export type SizeDimension = "full" | "fit" | "min" | "max";
|
|
22
|
-
/**
|
|
23
|
-
* Size variants used for CSS.
|
|
24
|
-
*/
|
|
25
6
|
export type SizeToken = "xxs" | "xs" | "s" | "m" | "l" | "xl" | "xxl";
|
|
26
|
-
|
|
27
|
-
* Size variants used for padding & margin
|
|
28
|
-
*/
|
|
29
|
-
type SpacingSize = "none" | "xxs" | "xs" | "s" | "m" | "l" | "xl" | "xxl";
|
|
30
|
-
/**
|
|
31
|
-
* Used for margin
|
|
32
|
-
*/
|
|
7
|
+
type SpacingSize = SizeToken | "none";
|
|
33
8
|
type AutoSize = SpacingSize | "auto";
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
9
|
+
type Color = "default" | "muted" | "inherit" | "transparent";
|
|
10
|
+
type Overflow = "hidden" | "scroll";
|
|
11
|
+
export type Vfx = {
|
|
12
|
+
/** Element's positioning */
|
|
13
|
+
pos?: "static" | "relative" | "absolute" | "fixed" | "sticky";
|
|
14
|
+
/** Direction the content spans; along the x-axis or y-axis (Equivalent to flex-direction) */
|
|
37
15
|
axis?: "x" | "y" | "-x" | "-y";
|
|
38
|
-
/** Spacing between children of the
|
|
16
|
+
/** Spacing between children of the content */
|
|
39
17
|
gap?: SpacingSize;
|
|
40
18
|
/** Alignment orthogonal to the selected axis (Equivalent to align-items) */
|
|
41
19
|
align?: "start" | "center" | "end";
|
|
42
|
-
/** How to
|
|
20
|
+
/** How to content the children (Equivalent to justify-content) */
|
|
43
21
|
justify?: "start" | "center" | "between" | "around" | "end";
|
|
44
|
-
/** Whether to allow wrapping of
|
|
22
|
+
/** Whether to allow wrapping of children */
|
|
45
23
|
wrap?: boolean;
|
|
46
|
-
/**
|
|
24
|
+
/** How to handle overflow in the container */
|
|
25
|
+
overflow?: Overflow;
|
|
26
|
+
/** How to handle overflow in the X direction */
|
|
27
|
+
overflowX?: Overflow;
|
|
28
|
+
/** How to handle overflow in the Y direction */
|
|
29
|
+
overflowY?: Overflow;
|
|
30
|
+
/** Z-index to position the element at */
|
|
31
|
+
z?: "auto" | "floating" | "nav" | "max";
|
|
32
|
+
/** Padding inside the content */
|
|
47
33
|
padding?: SpacingSize;
|
|
48
|
-
/** Horizontal padding inside the
|
|
34
|
+
/** Horizontal padding inside the content */
|
|
49
35
|
paddingX?: SpacingSize;
|
|
50
|
-
/** Vertical padding inside the
|
|
36
|
+
/** Vertical padding inside the content */
|
|
51
37
|
paddingY?: SpacingSize;
|
|
52
|
-
/** Top padding inside the
|
|
38
|
+
/** Top padding inside the content */
|
|
53
39
|
paddingTop?: SpacingSize;
|
|
54
|
-
/** Bottom padding inside the
|
|
40
|
+
/** Bottom padding inside the content */
|
|
55
41
|
paddingBottom?: SpacingSize;
|
|
56
|
-
/** Left padding inside the
|
|
42
|
+
/** Left padding inside the content */
|
|
57
43
|
paddingLeft?: SpacingSize;
|
|
58
|
-
/** Right padding inside the
|
|
44
|
+
/** Right padding inside the content */
|
|
59
45
|
paddingRight?: SpacingSize;
|
|
60
|
-
/** Margin outside the
|
|
46
|
+
/** Margin outside the content */
|
|
61
47
|
margin?: AutoSize;
|
|
62
|
-
/** Horizontal margin outside the
|
|
48
|
+
/** Horizontal margin outside the content */
|
|
63
49
|
marginX?: AutoSize;
|
|
64
|
-
/** Vertical margin outside the
|
|
50
|
+
/** Vertical margin outside the content */
|
|
65
51
|
marginY?: AutoSize;
|
|
66
|
-
/** Top margin outside the
|
|
52
|
+
/** Top margin outside the content */
|
|
67
53
|
marginTop?: AutoSize;
|
|
68
|
-
/** Bottom margin outside the
|
|
54
|
+
/** Bottom margin outside the content */
|
|
69
55
|
marginBottom?: AutoSize;
|
|
70
|
-
/** Left margin outside the
|
|
56
|
+
/** Left margin outside the content */
|
|
71
57
|
marginLeft?: AutoSize;
|
|
72
|
-
/** Right margin outside the
|
|
58
|
+
/** Right margin outside the content */
|
|
73
59
|
marginRight?: AutoSize;
|
|
74
|
-
/** Width of the
|
|
60
|
+
/** Width of the content */
|
|
75
61
|
width?: SizeDimension;
|
|
76
|
-
/** Maximum width of the
|
|
62
|
+
/** Maximum width of the content */
|
|
77
63
|
maxWidth?: SizeDimension;
|
|
78
|
-
/** Height of the
|
|
64
|
+
/** Height of the content */
|
|
79
65
|
height?: SizeDimension;
|
|
80
|
-
/** Maximum of the
|
|
66
|
+
/** Maximum of the content */
|
|
81
67
|
maxHeight?: SizeDimension;
|
|
68
|
+
/** Border radius of the content */
|
|
69
|
+
radius?: "none" | "subtle" | "rounded" | "max";
|
|
70
|
+
/** Border for all edges */
|
|
71
|
+
border?: boolean;
|
|
72
|
+
/** Border top */
|
|
73
|
+
borderTop?: boolean;
|
|
74
|
+
/** Border bottom */
|
|
75
|
+
borderBottom?: boolean;
|
|
76
|
+
/** Border left */
|
|
77
|
+
borderLeft?: boolean;
|
|
78
|
+
/** Border right */
|
|
79
|
+
borderRight?: boolean;
|
|
80
|
+
/** Border thickness */
|
|
81
|
+
borderWidth?: SpacingSize;
|
|
82
|
+
/** Border type */
|
|
83
|
+
borderStyle?: "none" | "solid" | "dotted" | "dashed";
|
|
84
|
+
/** Border color */
|
|
85
|
+
borderColor?: "default" | "primary";
|
|
86
|
+
/** Box shadow presets */
|
|
87
|
+
shadow?: "subtle" | "floating" | "sharp";
|
|
88
|
+
/** Opacity presets */
|
|
89
|
+
opacity?: "none" | "disabled" | "dim" | "full";
|
|
90
|
+
/** Font size */
|
|
91
|
+
fontSize?: SizeToken;
|
|
92
|
+
/** Font weight */
|
|
93
|
+
fontWeight?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
|
|
94
|
+
/** Text alignment */
|
|
95
|
+
textAlign?: "center" | "left" | "right";
|
|
96
|
+
/** Use italics? */
|
|
97
|
+
italics?: boolean;
|
|
98
|
+
/** Color */
|
|
99
|
+
color?: Color;
|
|
100
|
+
/** Background color */
|
|
101
|
+
backgroundColor?: Color;
|
|
82
102
|
};
|
|
83
103
|
export {};
|
package/utils/transformLayout.js
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
-
var t = {};
|
|
3
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
-
t[p] = s[p];
|
|
5
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
-
t[p[i]] = s[p[i]];
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
|
-
import { classNames } from "../functions";
|
|
13
|
-
// Prefix maps for padding and margin keys
|
|
14
|
-
var spacingPrefixMap = {
|
|
15
|
-
padding: "pa",
|
|
16
|
-
paddingTop: "pt",
|
|
17
|
-
paddingBottom: "pb",
|
|
18
|
-
paddingLeft: "pl",
|
|
19
|
-
paddingRight: "pr",
|
|
20
|
-
margin: "ma",
|
|
21
|
-
marginTop: "mt",
|
|
22
|
-
marginBottom: "mb",
|
|
23
|
-
marginLeft: "ml",
|
|
24
|
-
marginRight: "mr",
|
|
25
|
-
};
|
|
26
|
-
var dimensionPrefixMap = {
|
|
27
|
-
width: "w",
|
|
28
|
-
maxWidth: "mw",
|
|
29
|
-
height: "h",
|
|
30
|
-
maxHeight: "mh",
|
|
31
|
-
};
|
|
32
|
-
export default function transformLayout(layout) {
|
|
33
|
-
if (!layout)
|
|
34
|
-
return null;
|
|
35
|
-
var axis = layout.axis, gap = layout.gap, align = layout.align, justify = layout.justify, wrap = layout.wrap, padding = layout.padding, paddingTop = layout.paddingTop, paddingBottom = layout.paddingBottom, paddingLeft = layout.paddingLeft, paddingRight = layout.paddingRight, paddingX = layout.paddingX, paddingY = layout.paddingY, margin = layout.margin, marginTop = layout.marginTop, marginBottom = layout.marginBottom, marginLeft = layout.marginLeft, marginRight = layout.marginRight, marginX = layout.marginX, marginY = layout.marginY, rest = __rest(layout, ["axis", "gap", "align", "justify", "wrap", "padding", "paddingTop", "paddingBottom", "paddingLeft", "paddingRight", "paddingX", "paddingY", "margin", "marginTop", "marginBottom", "marginLeft", "marginRight", "marginX", "marginY"]);
|
|
36
|
-
var className = axis ? "aui-flex-".concat(axis) : null;
|
|
37
|
-
if (wrap)
|
|
38
|
-
className = classNames(className, "aui-flex-wrap");
|
|
39
|
-
if (align)
|
|
40
|
-
className = classNames(className, "aui-align-".concat(align));
|
|
41
|
-
if (justify)
|
|
42
|
-
className = classNames(className, "aui-justify-".concat(justify));
|
|
43
|
-
// Gap
|
|
44
|
-
if (gap) {
|
|
45
|
-
className = classNames(className, "aui-gap-".concat(gap));
|
|
46
|
-
}
|
|
47
|
-
// Padding & margin
|
|
48
|
-
var spacingProps = [
|
|
49
|
-
["padding", padding],
|
|
50
|
-
["paddingTop", paddingTop !== null && paddingTop !== void 0 ? paddingTop : paddingY],
|
|
51
|
-
["paddingBottom", paddingBottom !== null && paddingBottom !== void 0 ? paddingBottom : paddingY],
|
|
52
|
-
["paddingLeft", paddingLeft !== null && paddingLeft !== void 0 ? paddingLeft : paddingX],
|
|
53
|
-
["paddingRight", paddingRight !== null && paddingRight !== void 0 ? paddingRight : paddingX],
|
|
54
|
-
["margin", margin],
|
|
55
|
-
["marginTop", marginTop !== null && marginTop !== void 0 ? marginTop : marginY],
|
|
56
|
-
["marginBottom", marginBottom !== null && marginBottom !== void 0 ? marginBottom : marginY],
|
|
57
|
-
["marginLeft", marginLeft !== null && marginLeft !== void 0 ? marginLeft : marginX],
|
|
58
|
-
["marginRight", marginRight !== null && marginRight !== void 0 ? marginRight : marginX],
|
|
59
|
-
];
|
|
60
|
-
spacingProps.forEach(function (_a) {
|
|
61
|
-
var prop = _a[0], value = _a[1];
|
|
62
|
-
if (value) {
|
|
63
|
-
var prefix = spacingPrefixMap[prop];
|
|
64
|
-
className = classNames(className, "aui-".concat(prefix, "-").concat(value));
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
var dimensionProps = ["width", "height", "maxWidth", "maxHeight"];
|
|
68
|
-
dimensionProps.forEach(function (prop) {
|
|
69
|
-
var value = rest[prop];
|
|
70
|
-
if (value) {
|
|
71
|
-
var prefix = dimensionPrefixMap[prop];
|
|
72
|
-
className = classNames(className, "aui-".concat(prefix, "-").concat(value));
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
return className;
|
|
76
|
-
}
|