@rovula/ui 0.0.12 → 0.0.14

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 (99) hide show
  1. package/dist/cjs/bundle.css +227 -16
  2. package/dist/cjs/bundle.js +3 -3
  3. package/dist/cjs/bundle.js.map +1 -1
  4. package/dist/cjs/types/components/ActionButton/ActionButton.d.ts +20 -0
  5. package/dist/cjs/types/components/ActionButton/ActionButton.stories.d.ts +311 -0
  6. package/dist/cjs/types/components/ActionButton/ActionButton.styles.d.ts +6 -0
  7. package/dist/cjs/types/components/Avatar/Avatar.d.ts +32 -0
  8. package/dist/cjs/types/components/Avatar/Avatar.stories.d.ts +64 -0
  9. package/dist/cjs/types/components/Avatar/Avatar.styles.d.ts +4 -0
  10. package/dist/cjs/types/components/Avatar/AvatarBase.d.ts +6 -0
  11. package/dist/cjs/types/components/Avatar/AvatarGroup.d.ts +11 -0
  12. package/dist/cjs/types/components/Avatar/AvatarGroup.stories.d.ts +31 -0
  13. package/dist/cjs/types/components/Input/Input.d.ts +21 -4
  14. package/dist/cjs/types/components/Input/Input.stories.d.ts +340 -22
  15. package/dist/cjs/types/components/Input/Input.styles.d.ts +9 -0
  16. package/dist/cjs/types/components/Label/Label.d.ts +6 -1
  17. package/dist/cjs/types/components/Label/Label.stories.d.ts +10 -1
  18. package/dist/cjs/types/components/Label/Label.styles.d.ts +6 -0
  19. package/dist/cjs/types/components/Navbar/Navbar.d.ts +12 -0
  20. package/dist/cjs/types/components/Navbar/Navbar.stories.d.ts +35 -0
  21. package/dist/cjs/types/components/Search/Search.d.ts +2 -0
  22. package/dist/cjs/types/components/Search/Search.stories.d.ts +21 -0
  23. package/dist/cjs/types/components/ThemeToggle.d.ts +2 -0
  24. package/dist/components/ActionButton/ActionButton.js +38 -0
  25. package/dist/components/ActionButton/ActionButton.stories.js +45 -0
  26. package/dist/components/ActionButton/ActionButton.styles.js +71 -0
  27. package/dist/components/Avatar/Avatar.js +22 -0
  28. package/dist/components/Avatar/Avatar.stories.js +47 -0
  29. package/dist/components/Avatar/Avatar.styles.js +23 -0
  30. package/dist/components/Avatar/AvatarBase.js +43 -0
  31. package/dist/components/Avatar/AvatarGroup.js +21 -0
  32. package/dist/components/Avatar/AvatarGroup.stories.js +47 -0
  33. package/dist/components/Button/Button.styles.js +6 -6
  34. package/dist/components/Dropdown/Dropdown.js +39 -2
  35. package/dist/components/Dropdown/Dropdown.stories.js +29 -4
  36. package/dist/components/Input/Input.js +5 -4
  37. package/dist/components/Input/Input.stories.js +2 -4
  38. package/dist/components/Input/Input.styles.js +45 -0
  39. package/dist/components/Label/Label.js +7 -3
  40. package/dist/components/Label/Label.styles.js +57 -0
  41. package/dist/components/Navbar/Navbar.js +9 -0
  42. package/dist/components/Navbar/Navbar.stories.js +41 -0
  43. package/dist/components/Search/Search.js +19 -0
  44. package/dist/components/Search/Search.stories.js +36 -0
  45. package/dist/components/Text/Text.js +2 -1
  46. package/dist/components/ThemeToggle.js +17 -0
  47. package/dist/esm/bundle.css +227 -16
  48. package/dist/esm/bundle.js +3 -3
  49. package/dist/esm/bundle.js.map +1 -1
  50. package/dist/esm/types/components/ActionButton/ActionButton.d.ts +20 -0
  51. package/dist/esm/types/components/ActionButton/ActionButton.stories.d.ts +311 -0
  52. package/dist/esm/types/components/ActionButton/ActionButton.styles.d.ts +6 -0
  53. package/dist/esm/types/components/Avatar/Avatar.d.ts +32 -0
  54. package/dist/esm/types/components/Avatar/Avatar.stories.d.ts +64 -0
  55. package/dist/esm/types/components/Avatar/Avatar.styles.d.ts +4 -0
  56. package/dist/esm/types/components/Avatar/AvatarBase.d.ts +6 -0
  57. package/dist/esm/types/components/Avatar/AvatarGroup.d.ts +11 -0
  58. package/dist/esm/types/components/Avatar/AvatarGroup.stories.d.ts +31 -0
  59. package/dist/esm/types/components/Input/Input.d.ts +21 -4
  60. package/dist/esm/types/components/Input/Input.stories.d.ts +340 -22
  61. package/dist/esm/types/components/Input/Input.styles.d.ts +9 -0
  62. package/dist/esm/types/components/Label/Label.d.ts +6 -1
  63. package/dist/esm/types/components/Label/Label.stories.d.ts +10 -1
  64. package/dist/esm/types/components/Label/Label.styles.d.ts +6 -0
  65. package/dist/esm/types/components/Navbar/Navbar.d.ts +12 -0
  66. package/dist/esm/types/components/Navbar/Navbar.stories.d.ts +35 -0
  67. package/dist/esm/types/components/Search/Search.d.ts +2 -0
  68. package/dist/esm/types/components/Search/Search.stories.d.ts +21 -0
  69. package/dist/esm/types/components/ThemeToggle.d.ts +2 -0
  70. package/dist/index.d.ts +22 -10
  71. package/dist/src/theme/global.css +290 -21
  72. package/dist/theme/global.css +11 -0
  73. package/dist/theme/presets/colors.js +28 -0
  74. package/package.json +2 -1
  75. package/src/components/ActionButton/ActionButton.stories.tsx +176 -0
  76. package/src/components/ActionButton/ActionButton.styles.ts +79 -0
  77. package/src/components/ActionButton/ActionButton.tsx +42 -0
  78. package/src/components/Avatar/Avatar.stories.tsx +107 -0
  79. package/src/components/Avatar/Avatar.styles.ts +28 -0
  80. package/src/components/Avatar/Avatar.tsx +88 -0
  81. package/src/components/Avatar/AvatarBase.tsx +50 -0
  82. package/src/components/Avatar/AvatarGroup.stories.tsx +77 -0
  83. package/src/components/Avatar/AvatarGroup.tsx +55 -0
  84. package/src/components/Button/Button.styles.ts +6 -6
  85. package/src/components/Dropdown/Dropdown.stories.tsx +25 -3
  86. package/src/components/Dropdown/Dropdown.tsx +61 -2
  87. package/src/components/Input/Input.stories.tsx +8 -6
  88. package/src/components/Input/Input.styles.tsx +51 -0
  89. package/src/components/Input/Input.tsx +30 -6
  90. package/src/components/Label/Label.styles.ts +61 -0
  91. package/src/components/Label/Label.tsx +13 -7
  92. package/src/components/Navbar/Navbar.stories.tsx +86 -0
  93. package/src/components/Navbar/Navbar.tsx +56 -0
  94. package/src/components/Search/Search.stories.tsx +44 -0
  95. package/src/components/Search/Search.tsx +25 -0
  96. package/src/components/Text/Text.tsx +2 -1
  97. package/src/components/ThemeToggle.tsx +19 -0
  98. package/src/theme/global.css +11 -0
  99. package/src/theme/presets/colors.js +28 -0
@@ -0,0 +1,45 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import ActionButton from "./ActionButton";
14
+ import { ArrowsUpDownIcon } from "@heroicons/react/16/solid";
15
+ var meta = {
16
+ title: "Components/ActionButton",
17
+ component: ActionButton,
18
+ tags: ["autodocs"],
19
+ parameters: {
20
+ layout: "fullscreen",
21
+ },
22
+ decorators: [
23
+ function (Story) { return (_jsx("div", { className: "p-5", children: _jsx(Story, {}) })); },
24
+ ],
25
+ };
26
+ export default meta;
27
+ export var Default = {
28
+ args: {
29
+ variant: "solid",
30
+ size: "lg",
31
+ },
32
+ render: function (args) {
33
+ console.log("args ", args);
34
+ var props = __assign({}, args);
35
+ return (_jsx("div", { className: "flex flex-row justify-between", children: _jsx(ActionButton, __assign({}, props, { children: _jsx(ArrowsUpDownIcon, {}) })) }));
36
+ },
37
+ };
38
+ export var Preview = {
39
+ args: {},
40
+ render: function (args) {
41
+ console.log("args ", args);
42
+ var props = __assign({}, args);
43
+ return (_jsxs("div", { className: "flex flex-col gap-2 w-full bg-black p-20", children: [_jsxs("div", { className: "flex flex-row justify-between items-center", children: [_jsx("h6", { className: "w-[20px] text-white", children: "Default:" }), _jsxs("div", { className: "flex flex-row gap-2 ", children: [_jsx(ActionButton, { variant: "solid", size: "lg", children: _jsx(ArrowsUpDownIcon, {}) }), _jsx(ActionButton, { variant: "solid", size: "md", children: _jsx(ArrowsUpDownIcon, {}) }), _jsx(ActionButton, { variant: "solid", size: "sm", children: _jsx(ArrowsUpDownIcon, {}) })] }), _jsxs("div", { className: "flex flex-row gap-2", children: [_jsx(ActionButton, { variant: "outline", size: "lg", children: _jsx(ArrowsUpDownIcon, {}) }), _jsx(ActionButton, { variant: "outline", size: "md", children: _jsx(ArrowsUpDownIcon, {}) }), _jsx(ActionButton, { variant: "outline", size: "sm", children: _jsx(ArrowsUpDownIcon, {}) })] }), _jsxs("div", { className: "flex flex-row gap-2", children: [_jsx(ActionButton, { variant: "icon", size: "lg", children: _jsx(ArrowsUpDownIcon, {}) }), _jsx(ActionButton, { variant: "icon", size: "md", children: _jsx(ArrowsUpDownIcon, {}) }), _jsx(ActionButton, { variant: "icon", size: "sm", children: _jsx(ArrowsUpDownIcon, {}) }), _jsx(ActionButton, { variant: "icon", size: "xs", children: _jsx(ArrowsUpDownIcon, {}) })] })] }), _jsxs("div", { className: "flex flex-row justify-between", children: [_jsx("h6", { className: "w-[20px] text-white", children: "Active:" }), _jsxs("div", { className: "flex flex-row gap-2", children: [_jsx(ActionButton, { variant: "solid", size: "lg", active: true, children: _jsx(ArrowsUpDownIcon, {}) }), _jsx(ActionButton, { variant: "solid", size: "md", active: true, children: _jsx(ArrowsUpDownIcon, {}) }), _jsx(ActionButton, { variant: "solid", size: "sm", active: true, children: _jsx(ArrowsUpDownIcon, {}) })] }), _jsxs("div", { className: "flex flex-row gap-2", children: [_jsx(ActionButton, { variant: "outline", size: "lg", active: true, children: _jsx(ArrowsUpDownIcon, {}) }), _jsx(ActionButton, { variant: "outline", size: "md", active: true, children: _jsx(ArrowsUpDownIcon, {}) }), _jsx(ActionButton, { variant: "outline", size: "sm", active: true, children: _jsx(ArrowsUpDownIcon, {}) })] }), _jsxs("div", { className: "flex flex-row gap-2", children: [_jsx(ActionButton, { variant: "icon", size: "lg", active: true, children: _jsx(ArrowsUpDownIcon, {}) }), _jsx(ActionButton, { variant: "icon", size: "md", active: true, children: _jsx(ArrowsUpDownIcon, {}) }), _jsx(ActionButton, { variant: "icon", size: "sm", active: true, children: _jsx(ArrowsUpDownIcon, {}) }), _jsx(ActionButton, { variant: "icon", size: "xs", active: true, children: _jsx(ArrowsUpDownIcon, {}) })] })] }), _jsxs("div", { className: "flex flex-row justify-between", children: [_jsx("h6", { className: "w-[20px] text-white", children: "Disabled:" }), _jsxs("div", { className: "flex flex-row gap-2", children: [_jsx(ActionButton, { variant: "solid", size: "lg", disabled: true, children: _jsx(ArrowsUpDownIcon, {}) }), _jsx(ActionButton, { variant: "solid", size: "md", disabled: true, children: _jsx(ArrowsUpDownIcon, {}) }), _jsx(ActionButton, { variant: "solid", size: "sm", disabled: true, children: _jsx(ArrowsUpDownIcon, {}) })] }), _jsxs("div", { className: "flex flex-row gap-2", children: [_jsx(ActionButton, { variant: "outline", size: "lg", disabled: true, children: _jsx(ArrowsUpDownIcon, {}) }), _jsx(ActionButton, { variant: "outline", size: "md", disabled: true, children: _jsx(ArrowsUpDownIcon, {}) }), _jsx(ActionButton, { variant: "outline", size: "sm", disabled: true, children: _jsx(ArrowsUpDownIcon, {}) })] }), _jsxs("div", { className: "flex flex-row gap-2", children: [_jsx(ActionButton, { variant: "icon", size: "lg", disabled: true, children: _jsx(ArrowsUpDownIcon, {}) }), _jsx(ActionButton, { variant: "icon", size: "md", disabled: true, children: _jsx(ArrowsUpDownIcon, {}) }), _jsx(ActionButton, { variant: "icon", size: "sm", disabled: true, children: _jsx(ArrowsUpDownIcon, {}) }), _jsx(ActionButton, { variant: "icon", size: "xs", disabled: true, children: _jsx(ArrowsUpDownIcon, {}) })] })] })] }));
44
+ },
45
+ };
@@ -0,0 +1,71 @@
1
+ import { cva } from "class-variance-authority";
2
+ export var actionButtonVariants = cva(["bg-primary rounded box-border flex items-center justify-center"], {
3
+ variants: {
4
+ variant: {
5
+ solid: " bg-secondary-20 hover:bg-secondary-5 fill-secondary-foreground text-secondary-foreground",
6
+ outline: [
7
+ "bg-transparent border border-main-transparent-secondary-32 fill-secondary-70 text-secondary-70",
8
+ "hover:bg-main-transparent-secondary-8 hover:border-main-secondary-48 hover:fill-secondary-5 hover:text-secondary-5",
9
+ ],
10
+ icon: [
11
+ "rounded-full bg-transparent fill-secondary-70 text-secondary-70",
12
+ "hover:bg-main-transparent-secondary-8 hover:fill-secondary-5 hover:text-secondary-5",
13
+ ],
14
+ },
15
+ size: {
16
+ xs: "p-[2px] w-[18px] h-[18px]",
17
+ sm: "px-2 py-1 w-[38px] h-[30px]",
18
+ md: "px-3 py-2 w-[46px] h-[38px]",
19
+ lg: "px-4 py-3 w-[64px] h-[56px]",
20
+ },
21
+ disabled: {
22
+ true: "pointer-events-none border-grey2-500/[.32] text-grey2-500/[.32] fill-red-500",
23
+ },
24
+ active: {
25
+ false: "",
26
+ },
27
+ },
28
+ compoundVariants: [
29
+ {
30
+ variant: "solid",
31
+ disabled: true,
32
+ className: "bg-grey2-500 text-textcolor-medium fill-textcolor-medium",
33
+ },
34
+ {
35
+ variant: "solid",
36
+ active: true,
37
+ className: "bg-primary-120 hover:bg-primary-100 text-primary-foreground",
38
+ },
39
+ {
40
+ variant: "outline",
41
+ active: true,
42
+ className: "border-main-transparent-primary-48 hover:bg-main-transparent-primary-8 hover:text-primary text-primary",
43
+ },
44
+ {
45
+ variant: "icon",
46
+ active: true,
47
+ className: "border-main-transparent-primary-48 hover:bg-main-transparent-primary-8 hover:text-primary text-primary",
48
+ },
49
+ {
50
+ size: "lg",
51
+ variant: "icon",
52
+ className: "w-[56px] h-[56px]",
53
+ },
54
+ {
55
+ size: "md",
56
+ variant: "icon",
57
+ className: "w-[38px] h-[38px]",
58
+ },
59
+ {
60
+ size: "sm",
61
+ variant: "icon",
62
+ className: "w-[30px] h-[30px]",
63
+ },
64
+ ],
65
+ defaultVariants: {
66
+ size: "md",
67
+ variant: "solid",
68
+ disabled: false,
69
+ active: false,
70
+ },
71
+ });
@@ -0,0 +1,22 @@
1
+ "use client";
2
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { cn } from "@/utils/cn";
4
+ import { AvatarBase, AvatarFallback, AvatarImage } from "./AvatarBase";
5
+ import { avatarVariants } from "./Avatar.styles";
6
+ export var formatAvatarName = function (text) {
7
+ var _a, _b, _c;
8
+ if (!text.length)
9
+ return "-";
10
+ var spitWithSpace = text.split(" ");
11
+ var first = text === null || text === void 0 ? void 0 : text.charAt(0);
12
+ var last = (_c = (_b = (_a = spitWithSpace === null || spitWithSpace === void 0 ? void 0 : spitWithSpace[1]) === null || _a === void 0 ? void 0 : _a.charAt(0)) !== null && _b !== void 0 ? _b : text === null || text === void 0 ? void 0 : text.charAt(1)) !== null && _c !== void 0 ? _c : "";
13
+ return "".concat(first).concat(last);
14
+ };
15
+ var Avatar = function (_a) {
16
+ var text = _a.text, imageUrl = _a.imageUrl, icon = _a.icon, fallback = _a.fallback, size = _a.size, rounded = _a.rounded, className = _a.className, imageClassName = _a.imageClassName, fallbackClassName = _a.fallbackClassName, _b = _a.type, type = _b === void 0 ? "text" : _b, children = _a.children, style = _a.style;
17
+ var avatarClassname = avatarVariants({ size: size, rounded: rounded });
18
+ return (_jsx(AvatarBase, { className: cn(avatarClassname, className), style: style, children: children || (_jsxs(_Fragment, { children: [type === "image" && (_jsxs(_Fragment, { children: [_jsx(AvatarImage, { src: imageUrl, className: cn(imageClassName) }), _jsx(AvatarFallback, { className: cn(fallbackClassName), children: typeof fallback === "string"
19
+ ? formatAvatarName(fallback)
20
+ : fallback })] })), type === "text" && formatAvatarName(text !== null && text !== void 0 ? text : ""), type === "icon" && icon] })) }));
21
+ };
22
+ export default Avatar;
@@ -0,0 +1,47 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import Avatar from "./Avatar";
14
+ var meta = {
15
+ title: "Components/Avatar/Avatar",
16
+ component: Avatar,
17
+ tags: ["autodocs"],
18
+ parameters: {
19
+ layout: "fullscreen",
20
+ },
21
+ decorators: [
22
+ function (Story) { return (_jsx("div", { className: "p-5", children: _jsx(Story, {}) })); },
23
+ ],
24
+ };
25
+ export default meta;
26
+ export var Default = {
27
+ args: {
28
+ imageUrl: "",
29
+ text: "AN",
30
+ size: "lg",
31
+ rounded: "full",
32
+ },
33
+ render: function (args) {
34
+ console.log("args ", args);
35
+ var props = __assign({}, args);
36
+ return (_jsx("div", { className: "flex flex-row justify-between", children: _jsx(Avatar, __assign({}, props)) }));
37
+ },
38
+ };
39
+ export var Preview = {
40
+ args: {},
41
+ render: function (args) {
42
+ console.log("args ", args);
43
+ var props = __assign({}, args);
44
+ var BORDER = ["full", "normal", "none"];
45
+ return (_jsxs("div", { className: "flex flex-col gap-2 w-full bg-black p-20", children: [BORDER.map(function (rounded) { return (_jsxs("div", { className: "flex flex-row items-center gap-3", children: [_jsx(Avatar, { size: "xxs", rounded: rounded, type: "image", imageUrl: "https://i.pravatar.cc/300?img=59", fallback: "AS" }), _jsx(Avatar, { size: "xs", rounded: rounded, type: "image", imageUrl: "https://i.pravatar.cc/300?img=59", fallback: "AS" }), _jsx(Avatar, { size: "sm", rounded: rounded, type: "image", imageUrl: "https://i.pravatar.cc/300?img=59", fallback: "AS" }), _jsx(Avatar, { size: "md", rounded: rounded, type: "image", imageUrl: "https://i.pravatar.cc/300?img=59", fallback: "AS" }), _jsx(Avatar, { size: "lg", rounded: rounded, type: "image", imageUrl: "https://i.pravatar.cc/300?img=59", fallback: "AS" })] }, rounded)); }), BORDER.map(function (rounded) { return (_jsxs("div", { className: "flex flex-row items-center gap-3", children: [_jsx(Avatar, { size: "xxs", rounded: rounded, type: "text", text: "AS" }), _jsx(Avatar, { size: "xs", rounded: rounded, type: "text", text: "AS" }), _jsx(Avatar, { size: "sm", rounded: rounded, type: "text", text: "AS" }), _jsx(Avatar, { size: "md", rounded: rounded, type: "text", text: "AS" }), _jsx(Avatar, { size: "lg", rounded: rounded, type: "text", text: "AS" })] }, rounded)); })] }));
46
+ },
47
+ };
@@ -0,0 +1,23 @@
1
+ import { cva } from "class-variance-authority";
2
+ export var avatarVariants = cva([
3
+ "flex items-center justify-center bg-grey2-700 text-white typography-subtitile2 truncate",
4
+ ], {
5
+ variants: {
6
+ size: {
7
+ xxs: "w-[24px] h-[24px] typography-subtitile3",
8
+ xs: "w-[32px] h-[32px]",
9
+ sm: "w-[40px] h-[40px]",
10
+ md: "w-[48px] h-[48px]",
11
+ lg: "w-[64px] h-[64px]",
12
+ },
13
+ rounded: {
14
+ normal: "rounded",
15
+ full: "rounded-full",
16
+ none: "rounded-none",
17
+ },
18
+ },
19
+ defaultVariants: {
20
+ size: "md",
21
+ rounded: "normal",
22
+ },
23
+ });
@@ -0,0 +1,43 @@
1
+ "use client";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __rest = (this && this.__rest) || function (s, e) {
14
+ var t = {};
15
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
16
+ t[p] = s[p];
17
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
18
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
19
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
20
+ t[p[i]] = s[p[i]];
21
+ }
22
+ return t;
23
+ };
24
+ import { jsx as _jsx } from "react/jsx-runtime";
25
+ import * as React from "react";
26
+ import * as AvatarPrimitive from "@radix-ui/react-avatar";
27
+ import { cn } from "@/utils/cn";
28
+ var AvatarBase = React.forwardRef(function (_a, ref) {
29
+ var className = _a.className, props = __rest(_a, ["className"]);
30
+ return (_jsx(AvatarPrimitive.Root, __assign({ ref: ref, className: cn("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full", className) }, props)));
31
+ });
32
+ AvatarBase.displayName = AvatarPrimitive.Root.displayName;
33
+ var AvatarImage = React.forwardRef(function (_a, ref) {
34
+ var className = _a.className, props = __rest(_a, ["className"]);
35
+ return (_jsx(AvatarPrimitive.Image, __assign({ ref: ref, className: cn("aspect-square h-full w-full", className) }, props)));
36
+ });
37
+ AvatarImage.displayName = AvatarPrimitive.Image.displayName;
38
+ var AvatarFallback = React.forwardRef(function (_a, ref) {
39
+ var className = _a.className, props = __rest(_a, ["className"]);
40
+ return (_jsx(AvatarPrimitive.Fallback, __assign({ ref: ref, className: cn("flex h-full w-full items-center justify-center rounded-full bg-muted", className) }, props)));
41
+ });
42
+ AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName;
43
+ export { AvatarBase, AvatarImage, AvatarFallback };
@@ -0,0 +1,21 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { Children, cloneElement } from "react";
4
+ var AvatarGroup = function (_a) {
5
+ var _b = _a.borderWidth, borderWidth = _b === void 0 ? 2 : _b, _c = _a.borderColor, borderColor = _c === void 0 ? "white" : _c, _d = _a.maxDisplay, maxDisplay = _d === void 0 ? 4 : _d, children = _a.children, remainingText = _a.remainingText, remainingAvatar = _a.remainingAvatar;
6
+ var avatars = Children.toArray(children);
7
+ var displayAvatars = avatars.slice(0, maxDisplay);
8
+ var remainingCount = Math.max(0, avatars.length - maxDisplay);
9
+ var remainingComp = remainingAvatar ||
10
+ cloneElement(displayAvatars[0], {
11
+ style: { borderWidth: borderWidth, borderColor: borderColor },
12
+ className: "relative z-0",
13
+ children: remainingText || "+".concat(remainingCount),
14
+ });
15
+ return (_jsxs("div", { className: "flex items-center -space-x-2", children: [displayAvatars.map(function (avatar, index) {
16
+ return (_jsx("div", { className: "relative", style: { zIndex: avatars.length - index }, children: cloneElement(avatar, {
17
+ style: { borderWidth: borderWidth, borderColor: borderColor },
18
+ }) }, index));
19
+ }), remainingCount > 0 && remainingComp] }));
20
+ };
21
+ export default AvatarGroup;
@@ -0,0 +1,47 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import AvatarGroup from "./AvatarGroup";
14
+ import Avatar from "./Avatar";
15
+ var meta = {
16
+ title: "Components/Avatar/AvatarGroup",
17
+ component: AvatarGroup,
18
+ tags: ["autodocs"],
19
+ parameters: {
20
+ layout: "fullscreen",
21
+ },
22
+ decorators: [
23
+ function (Story) { return (_jsx("div", { className: "p-5", children: _jsx(Story, {}) })); },
24
+ ],
25
+ };
26
+ export default meta;
27
+ export var Default = {
28
+ args: {
29
+ imageUrl: "",
30
+ text: "AN",
31
+ size: "lg",
32
+ rounded: "full",
33
+ },
34
+ render: function (args) {
35
+ console.log("args ", args);
36
+ var props = __assign({}, args);
37
+ return (_jsx("div", { className: "flex flex-row justify-between", children: _jsxs(AvatarGroup, __assign({}, props, { children: [_jsx(Avatar, { size: "lg", rounded: "full", type: "text", text: "AS" }), _jsx(Avatar, { size: "lg", rounded: "full", type: "text", text: "AS" }), _jsx(Avatar, { size: "lg", rounded: "full", type: "text", text: "AS" })] })) }));
38
+ },
39
+ };
40
+ export var Preview = {
41
+ args: {},
42
+ render: function (args) {
43
+ console.log("args ", args);
44
+ var props = __assign({}, args);
45
+ return (_jsx("div", { className: "flex flex-col gap-2 w-full bg-black p-20", children: _jsx("div", { className: "flex flex-row items-center gap-3", children: _jsxs(AvatarGroup, { children: [_jsx(Avatar, { size: "lg", rounded: "full", type: "text", text: "AS" }), _jsx(Avatar, { size: "lg", rounded: "full", type: "text", text: "AS" }), _jsx(Avatar, { size: "lg", rounded: "full", type: "image", imageUrl: "https://i.pravatar.cc/300?img=59", fallback: "AS" }), _jsx(Avatar, { size: "lg", rounded: "full", type: "text", text: "AS" }), _jsx(Avatar, { size: "lg", rounded: "full", type: "text", text: "AS" })] }) }) }));
46
+ },
47
+ };
@@ -49,12 +49,12 @@ export var buttonVariants = cva([
49
49
  color: "secondary",
50
50
  class: "text-secondary-foreground",
51
51
  },
52
- {
53
- variant: "solid",
54
- disabled: true,
55
- color: "secondary",
56
- class: "text-white",
57
- },
52
+ // {
53
+ // variant: "solid",
54
+ // disabled: true,
55
+ // color: "secondary",
56
+ // class: "text-white",
57
+ // },
58
58
  {
59
59
  variant: "solid",
60
60
  color: "tertiary",
@@ -21,7 +21,7 @@ var __rest = (this && this.__rest) || function (s, e) {
21
21
  return t;
22
22
  };
23
23
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
24
- import { Fragment, forwardRef, useCallback, useEffect, useMemo, useState, } from "react";
24
+ import { Fragment, forwardRef, useCallback, useEffect, useMemo, useRef, useState, } from "react";
25
25
  import TextInput from "../TextInput/TextInput";
26
26
  import { customInputVariant, dropdownIconVariant, iconWrapperVariant, } from "./Dropdown.styles";
27
27
  import { ChevronDownIcon } from "@heroicons/react/16/solid";
@@ -31,6 +31,7 @@ var Dropdown = forwardRef(function (_a, ref) {
31
31
  var _k = useState(false), isFocused = _k[0], setIsFocused = _k[1];
32
32
  var _l = useState(null), selectedOption = _l[0], setSelectedOption = _l[1];
33
33
  var _m = useState(""), textValue = _m[0], setTextValue = _m[1];
34
+ var keyCode = useRef("");
34
35
  useEffect(function () {
35
36
  if (value && !selectedOption) {
36
37
  setSelectedOption(value);
@@ -63,6 +64,42 @@ var Dropdown = forwardRef(function (_a, ref) {
63
64
  }
64
65
  return (_jsx("li", { onMouseDown: function () { return handleOptionClick(option); }, className: "px-4 py-2 hover:bg-gray-100 cursor-pointer ".concat((selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.value) === option.value ? " bg-gray-200" : ""), children: option.label }, option.value));
65
66
  }), optionsFiltered.length === 0 && (_jsx("li", { className: "px-4 py-14 text-center text-input-text", children: "Not found" }))] })); };
66
- return (_jsxs("div", { className: "relative ".concat(fullwidth ? "w-full" : ""), children: [_jsx(TextInput, __assign({}, props, { ref: ref, readOnly: !filterMode, value: textValue, onChange: handleOnChangeText, label: label, placeholder: " ", type: "text", rounded: rounded, variant: variant, helperText: helperText, errorMessage: errorMessage, fullwidth: fullwidth, error: error, required: required, id: _id, disabled: disabled, hasClearIcon: false, size: size, className: customInputVariant({ size: size }), onFocus: function () { return setIsFocused(true); }, onBlur: function () { return setIsFocused(false); }, endIcon: _jsx("div", { className: iconWrapperVariant({ size: size }), children: _jsx(ChevronDownIcon, { className: dropdownIconVariant({ size: size, isFocus: isFocused }) }) }) })), isFocused && renderOptions()] }));
67
+ var handleOnFocus = useCallback(function (e) {
68
+ var _a;
69
+ setIsFocused(true);
70
+ (_a = props === null || props === void 0 ? void 0 : props.onFocus) === null || _a === void 0 ? void 0 : _a.call(props, e);
71
+ }, [props === null || props === void 0 ? void 0 : props.onFocus]);
72
+ var clearMismatchValue = useCallback(function (e) {
73
+ var matchSelectedValue = optionsFiltered.find(function (opt) { var _a, _b; return opt.value === ((_a = e.target) === null || _a === void 0 ? void 0 : _a.value) || opt.label === ((_b = e.target) === null || _b === void 0 ? void 0 : _b.value); });
74
+ var isMatchSelectedValue = !!matchSelectedValue;
75
+ var option = matchSelectedValue || {
76
+ value: "",
77
+ label: "",
78
+ };
79
+ if (!isMatchSelectedValue && textValue) {
80
+ option = {
81
+ value: "",
82
+ label: "",
83
+ };
84
+ }
85
+ if (keyCode.current === "Enter") {
86
+ return;
87
+ }
88
+ setSelectedOption(option);
89
+ setTextValue(option.label);
90
+ onSelect === null || onSelect === void 0 ? void 0 : onSelect(option);
91
+ }, [optionsFiltered, textValue]);
92
+ var handleOnBlur = useCallback(function (e) {
93
+ var _a;
94
+ setIsFocused(false);
95
+ clearMismatchValue(e);
96
+ (_a = props === null || props === void 0 ? void 0 : props.onBlur) === null || _a === void 0 ? void 0 : _a.call(props, e);
97
+ }, [props === null || props === void 0 ? void 0 : props.onBlur]);
98
+ var handleOnKeyDown = useCallback(function (e) {
99
+ var _a;
100
+ keyCode.current = e.code;
101
+ (_a = props === null || props === void 0 ? void 0 : props.onKeyDown) === null || _a === void 0 ? void 0 : _a.call(props, e);
102
+ }, [props === null || props === void 0 ? void 0 : props.onKeyDown]);
103
+ return (_jsxs("div", { className: "relative ".concat(fullwidth ? "w-full" : ""), children: [_jsx(TextInput, __assign({}, props, { ref: ref, readOnly: !filterMode, value: textValue, onChange: handleOnChangeText, label: label, placeholder: " ", type: "text", rounded: rounded, variant: variant, helperText: helperText, errorMessage: errorMessage, fullwidth: fullwidth, error: error, required: required, id: _id, disabled: disabled, hasClearIcon: false, size: size, className: customInputVariant({ size: size }), onFocus: handleOnFocus, onBlur: handleOnBlur, onKeyDown: handleOnKeyDown, endIcon: _jsx("div", { className: iconWrapperVariant({ size: size }), children: _jsx(ChevronDownIcon, { className: dropdownIconVariant({ size: size, isFocus: isFocused }) }) }) })), isFocused && renderOptions()] }));
67
104
  });
68
105
  export default Dropdown;
@@ -9,8 +9,17 @@ var __assign = (this && this.__assign) || function () {
9
9
  };
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
13
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
14
+ if (ar || !(i in from)) {
15
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
16
+ ar[i] = from[i];
17
+ }
18
+ }
19
+ return to.concat(ar || Array.prototype.slice.call(from));
20
+ };
12
21
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
- import { useRef } from "react";
22
+ import { useRef, useState } from "react";
14
23
  import Dropdown from "./Dropdown";
15
24
  import Button from "../Button/Button";
16
25
  import { cn } from "@/utils/cn";
@@ -46,9 +55,25 @@ export var Default = {
46
55
  };
47
56
  var DropdownWithRef = function (props) {
48
57
  var inputRef = useRef(null);
49
- return (_jsx(Dropdown, __assign({ id: "1", size: "lg" }, props, { ref: inputRef, labelClassName: "peer-focus:bg-red-500", onKeyDown: function (e) {
58
+ var _a = useState(customOptions), options = _a[0], setOptions = _a[1];
59
+ var _b = useState({
60
+ label: "",
61
+ value: "",
62
+ }), value = _b[0], setValue = _b[1];
63
+ var _c = useState(""), text = _c[0], setText = _c[1];
64
+ return (_jsx(Dropdown, __assign({ id: "1", size: "lg" }, props, { value: value, options: options, ref: inputRef, labelClassName: "peer-focus:bg-red-500", onSelect: setValue, onChangeText: function (e) { return setText(e.target.value); }, onKeyDown: function (e) {
50
65
  var _a, _b;
51
66
  if (e.code === "Enter") {
67
+ setOptions(function (options) { return __spreadArray(__spreadArray([], options, true), [
68
+ {
69
+ label: text,
70
+ value: text,
71
+ },
72
+ ], false); });
73
+ setValue({
74
+ label: text,
75
+ value: text,
76
+ });
52
77
  (_b = (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.blur) === null || _b === void 0 ? void 0 : _b.call(_a);
53
78
  }
54
79
  } })));
@@ -63,7 +88,7 @@ export var WithRef = {
63
88
  render: function (args) {
64
89
  console.log("args ", args);
65
90
  var props = __assign({}, args);
66
- return (_jsxs("div", { className: "flex flex-row gap-4 w-full", children: [_jsx(DropdownWithRef, __assign({ id: "1", size: "lg", options: options }, args)), "\\"] }));
91
+ return (_jsx("div", { className: "flex flex-row gap-4 w-full", children: _jsx(DropdownWithRef, __assign({ id: "1", size: "lg", options: options }, args)) }));
67
92
  },
68
93
  };
69
94
  var customOptions = new Array(100).fill("").map(function (__, index) { return ({
@@ -86,6 +111,6 @@ export var CustomOption = {
86
111
  render: function (args) {
87
112
  console.log("args ", args);
88
113
  var props = __assign({}, args);
89
- return (_jsxs("div", { className: "flex flex-row gap-4 w-full", children: [_jsx(DropdownWithRef, __assign({ id: "1", size: "lg", options: options }, args)), "\\"] }));
114
+ return (_jsx("div", { className: "flex flex-row gap-4 w-full", children: _jsx(DropdownWithRef, __assign({ id: "1", size: "lg", options: options }, args)) }));
90
115
  },
91
116
  };
@@ -21,11 +21,12 @@ var __rest = (this && this.__rest) || function (s, e) {
21
21
  return t;
22
22
  };
23
23
  import { jsx as _jsx } from "react/jsx-runtime";
24
- import * as React from "react";
24
+ import { forwardRef } from "react";
25
25
  import { cn } from "@/utils/cn";
26
- var Input = React.forwardRef(function (_a, ref) {
27
- var className = _a.className, type = _a.type, props = __rest(_a, ["className", "type"]);
28
- return (_jsx("input", __assign({ type: type, className: cn("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50", className), ref: ref }, props)));
26
+ import { inputVariants } from "./Input.styles";
27
+ var Input = forwardRef(function (_a, ref) {
28
+ var className = _a.className, _b = _a.type, type = _b === void 0 ? "text" : _b, _c = _a.size, size = _c === void 0 ? "md" : _c, _d = _a.variant, variant = _d === void 0 ? "outline" : _d, _e = _a.fullwidth, fullwidth = _e === void 0 ? false : _e, _f = _a.disabled, disabled = _f === void 0 ? false : _f, _g = _a.error, error = _g === void 0 ? false : _g, _h = _a.required, required = _h === void 0 ? false : _h, _j = _a.hiddenPlaceholder, hiddenPlaceholder = _j === void 0 ? false : _j, props = __rest(_a, ["className", "type", "size", "variant", "fullwidth", "disabled", "error", "required", "hiddenPlaceholder"]);
29
+ return (_jsx("input", __assign({ type: type, className: cn(inputVariants({ size: size, variant: variant, fullwidth: fullwidth, error: error, hiddenPlaceholder: hiddenPlaceholder }), className), ref: ref, disabled: disabled }, props)));
29
30
  });
30
31
  Input.displayName = "Input";
31
32
  export { Input };
@@ -9,7 +9,7 @@ var __assign = (this && this.__assign) || function () {
9
9
  };
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
- import { jsx as _jsx } from "react/jsx-runtime";
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
13
  import { Input } from "./Input";
14
14
  var meta = {
15
15
  title: "Components/Input",
@@ -25,13 +25,11 @@ var meta = {
25
25
  export default meta;
26
26
  export var Default = {
27
27
  args: {
28
- // label: "Lorem Ipsum",
29
- // value: "Lorem Ipsum",
30
28
  // fullwidth: true,
31
29
  },
32
30
  render: function (args) {
33
31
  console.log("args ", args);
34
32
  var props = __assign({}, args);
35
- return (_jsx("div", { className: "flex flex-row gap-4 w-full", children: _jsx(Input, { type: "email", placeholder: "Email" }) }));
33
+ return (_jsxs("div", { className: "flex flex-row gap-4", children: [_jsx(Input, __assign({ id: "1", size: "lg", placeholder: "Email" }, args)), _jsx(Input, __assign({ id: "2", size: "md", placeholder: "Email" }, args)), _jsx(Input, __assign({ id: "3", size: "sm", placeholder: "Email" }, args))] }));
36
34
  },
37
35
  };
@@ -0,0 +1,45 @@
1
+ import { cva } from "class-variance-authority";
2
+ export var inputVariants = cva([
3
+ "border-0 outline-none",
4
+ "p-1 flex w-auto h-fit box-border",
5
+ "peer text-black",
6
+ ], {
7
+ variants: {
8
+ size: {
9
+ sm: "p-2 px-3 typography-small1",
10
+ md: "py-2 px-3 typography-subtitile4",
11
+ lg: "p-4 typography-subtitile1",
12
+ },
13
+ rounded: {
14
+ none: "rounded-none",
15
+ normal: "rounded-xl",
16
+ full: "rounded-full",
17
+ },
18
+ variant: {
19
+ flat: "",
20
+ outline: "ring-1 ring-inset ring-input-stroke hover:ring-input-active focus:ring-1 focus:ring-inset focus:ring-input-stroke-active",
21
+ underline: "border-b-2 border-input-stroke transition-colors hover:border-input-stroke-active focus:border-input-stroke",
22
+ },
23
+ hiddenPlaceholder: {
24
+ true: "placeholder:text-transparent",
25
+ },
26
+ fullwidth: {
27
+ true: "w-full",
28
+ },
29
+ disabled: {
30
+ true: "text-input-text-disabled ring-input-stroke-disabled placeholder:text-input-text-disabled",
31
+ },
32
+ error: {
33
+ true: "ring-error focus:ring-error",
34
+ },
35
+ },
36
+ defaultVariants: {
37
+ size: "md",
38
+ variant: "outline",
39
+ rounded: "normal",
40
+ fullwidth: false,
41
+ disabled: false,
42
+ error: false,
43
+ hiddenPlaceholder: true,
44
+ },
45
+ });
@@ -24,12 +24,16 @@ var __rest = (this && this.__rest) || function (s, e) {
24
24
  import { jsx as _jsx } from "react/jsx-runtime";
25
25
  import * as React from "react";
26
26
  import * as LabelPrimitive from "@radix-ui/react-label";
27
- import { cva } from "class-variance-authority";
28
27
  import { cn } from "@/utils/cn";
29
- var labelVariants = cva("typography-label1 peer-disabled:cursor-not-allowed peer-disabled:opacity-70");
28
+ import { labelVariant } from "./Label.styles";
30
29
  var Label = React.forwardRef(function (_a, ref) {
31
30
  var className = _a.className, props = __rest(_a, ["className"]);
32
- return (_jsx(LabelPrimitive.Root, __assign({ ref: ref, className: cn(labelVariants(), className) }, props)));
31
+ return (_jsx(LabelPrimitive.Root, __assign({ ref: ref, className: cn(labelVariant({
32
+ size: props.size,
33
+ disabled: props.disabled,
34
+ error: props.error,
35
+ isFloatable: props.isFloatable,
36
+ }), className) }, props)));
33
37
  });
34
38
  Label.displayName = LabelPrimitive.Root.displayName;
35
39
  export { Label };