@adamjanicki/ui 1.5.8 → 1.6.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.
Files changed (38) hide show
  1. package/components/Accordion/Accordion.d.ts +3 -11
  2. package/components/Accordion/Accordion.js +27 -5
  3. package/components/Box/Box.js +3 -38
  4. package/components/Button/Button.d.ts +6 -12
  5. package/components/Button/Button.js +12 -12
  6. package/components/Carousel/Carousel.js +5 -1
  7. package/components/ClickOutside/ClickOutside.d.ts +3 -3
  8. package/components/ClickOutside/ClickOutside.js +1 -1
  9. package/components/Icon/Icon.d.ts +3 -2
  10. package/components/Icon/Icon.js +2 -4
  11. package/components/Icon/icons.d.ts +2 -7
  12. package/components/Icon/icons.js +174 -23
  13. package/components/Input/IconInput.js +1 -1
  14. package/components/Input/Input.js +1 -1
  15. package/components/Input/TextArea.js +1 -1
  16. package/components/Layer/Layer.d.ts +3 -3
  17. package/components/Layer/Layer.js +19 -18
  18. package/components/Link/Link.d.ts +38 -8
  19. package/components/Link/Link.js +14 -8
  20. package/components/Link/index.d.ts +2 -2
  21. package/components/Link/index.js +2 -2
  22. package/components/Select/Select.js +1 -1
  23. package/dist/aui.cjs.js +22 -0
  24. package/dist/aui.es.js +1091 -0
  25. package/dist/aui.umd.js +22 -0
  26. package/functions/assertDefined.d.ts +8 -0
  27. package/functions/assertDefined.js +13 -0
  28. package/functions/classNames.js +4 -1
  29. package/functions/index.d.ts +2 -2
  30. package/functions/index.js +2 -2
  31. package/package.json +14 -4
  32. package/style.css +1 -564
  33. package/utils/transformLayout.d.ts +2 -0
  34. package/utils/transformLayout.js +76 -0
  35. package/utils/types.d.ts +51 -34
  36. package/vite.config.ts +23 -0
  37. package/functions/assert.d.ts +0 -15
  38. package/functions/assert.js +0 -24
package/utils/types.d.ts CHANGED
@@ -16,47 +16,64 @@ export type ContentType = "success" | "warning" | "error" | "info" | "static";
16
16
  */
17
17
  export type Style = React.CSSProperties;
18
18
  /**
19
- * Size variants used for CSS.
19
+ * Used for width and height
20
20
  */
21
- type SizeToken = "xxs" | "xs" | "s" | "m" | "l" | "xl" | "xxl";
21
+ export type SizeDimension = "full" | "fit" | "min" | "max";
22
22
  /**
23
- * Size prop used to transform into a CSS class or style value if a number.
23
+ * Size variants used for CSS.
24
24
  */
25
- type Size = SizeToken | number;
25
+ type SizeToken = "none" | "xxs" | "xs" | "s" | "m" | "l" | "xl" | "xxl";
26
26
  /**
27
- * Layout props for a box component.
27
+ * Used for margin
28
28
  */
29
+ type AutoSize = SizeToken | "auto";
30
+ /** Layout props for a component */
29
31
  export type Layout = {
30
- /**
31
- * Direction the box spans; along the x-axis or y-axis
32
- * (Equivalent to flex-direction)
33
- */
34
- axis: "x" | "y";
35
- /**
36
- * Spacing between children of the box
37
- */
38
- gap?: Size;
39
- /**
40
- * Alignment orthogonal to the selected axis
41
- * (Equivalent to align-items)
42
- */
32
+ /** Direction the layout spans; along the x-axis or y-axis (Equivalent to flex-direction) */
33
+ axis?: "x" | "y" | "-x" | "-y";
34
+ /** Spacing between children of the layout */
35
+ gap?: SizeToken;
36
+ /** Alignment orthogonal to the selected axis (Equivalent to align-items) */
43
37
  align?: "start" | "center" | "end";
44
- /**
45
- * How to layout the children
46
- * (Equivalent to justify-content)
47
- */
48
- justify?: "start" | "center" | "between" | "end";
49
- /**
50
- * Padding on the inside of the box
51
- */
52
- padding?: Size;
53
- /**
54
- * Margin on the outside of the box
55
- */
56
- margin?: Size;
57
- /**
58
- * Whether to allow wrapping of box children
59
- */
38
+ /** How to layout the children (Equivalent to justify-content) */
39
+ justify?: "start" | "center" | "between" | "around" | "end";
40
+ /** Whether to allow wrapping of layout children */
60
41
  wrap?: boolean;
42
+ /** Padding inside the layout */
43
+ padding?: SizeToken;
44
+ /** Horizontal padding inside the layout */
45
+ paddingX?: SizeToken;
46
+ /** Vertical padding inside the layout */
47
+ paddingY?: SizeToken;
48
+ /** Top padding inside the layout */
49
+ paddingTop?: SizeToken;
50
+ /** Bottom padding inside the layout */
51
+ paddingBottom?: SizeToken;
52
+ /** Left padding inside the layout */
53
+ paddingLeft?: SizeToken;
54
+ /** Right padding inside the layout */
55
+ paddingRight?: SizeToken;
56
+ /** Margin outside the layout */
57
+ margin?: AutoSize;
58
+ /** Horizontal margin outside the layout */
59
+ marginX?: AutoSize;
60
+ /** Vertical margin outside the layout */
61
+ marginY?: AutoSize;
62
+ /** Top margin outside the layout */
63
+ marginTop?: AutoSize;
64
+ /** Bottom margin outside the layout */
65
+ marginBottom?: AutoSize;
66
+ /** Left margin outside the layout */
67
+ marginLeft?: AutoSize;
68
+ /** Right margin outside the layout */
69
+ marginRight?: AutoSize;
70
+ /** Width of the layout */
71
+ width?: SizeDimension;
72
+ /** Maximum width of the layout */
73
+ maxWidth?: SizeDimension;
74
+ /** Height of the laout */
75
+ height?: SizeDimension;
76
+ /** Maximum of the layout */
77
+ maxHeight?: SizeDimension;
61
78
  };
62
79
  export {};
package/vite.config.ts ADDED
@@ -0,0 +1,23 @@
1
+ import { defineConfig } from "vite";
2
+ import react from "@vitejs/plugin-react";
3
+
4
+ export default defineConfig({
5
+ plugins: [react()],
6
+ build: {
7
+ lib: {
8
+ entry: "src/index.tsx",
9
+ name: "Aui",
10
+ formats: ["es", "cjs", "umd"],
11
+ fileName: (format) => `aui.${format}.js`,
12
+ },
13
+ rollupOptions: {
14
+ external: ["react", "react-dom"],
15
+ output: {
16
+ globals: {
17
+ react: "React",
18
+ "react-dom": "ReactDOM",
19
+ },
20
+ },
21
+ },
22
+ },
23
+ });
@@ -1,15 +0,0 @@
1
- /**
2
- * Assert a condition
3
- *
4
- * @param predicate the condition to assert
5
- * @param message optional error message
6
- */
7
- export default function assert<T>(predicate: T, message?: string): void;
8
- /**
9
- * Assert a value is defined
10
- *
11
- * @param value the value to assert presence of
12
- * @param message optional error message
13
- * @returns the present value
14
- */
15
- export declare function assertDefined<T>(value: T | undefined, message?: string): T;
@@ -1,24 +0,0 @@
1
- /**
2
- * Assert a condition
3
- *
4
- * @param predicate the condition to assert
5
- * @param message optional error message
6
- */
7
- export default function assert(predicate, message) {
8
- if (!predicate) {
9
- throw new Error(message || "Assertion error");
10
- }
11
- }
12
- /**
13
- * Assert a value is defined
14
- *
15
- * @param value the value to assert presence of
16
- * @param message optional error message
17
- * @returns the present value
18
- */
19
- export function assertDefined(value, message) {
20
- if (value === undefined) {
21
- throw new Error(message || "Unexpected undefined value");
22
- }
23
- return value;
24
- }