@sruim/nexus-design 0.0.1

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 (92) hide show
  1. package/README.md +195 -0
  2. package/dist/assets/grid.webp.js +3 -0
  3. package/dist/components/credits-button/index.d.ts +8 -0
  4. package/dist/components/credits-button/index.js +40 -0
  5. package/dist/components/icon/index.d.ts +7 -0
  6. package/dist/components/icon/index.js +32 -0
  7. package/dist/components/icon-button/index.d.ts +9 -0
  8. package/dist/components/icon-button/index.js +36 -0
  9. package/dist/components/img-uploader/index.d.ts +19 -0
  10. package/dist/components/img-uploader/index.js +107 -0
  11. package/dist/components/img-viewer/index.d.ts +16 -0
  12. package/dist/components/img-viewer/index.js +80 -0
  13. package/dist/components/index.d.ts +9 -0
  14. package/dist/components/loadable/index.d.ts +8 -0
  15. package/dist/components/loadable/index.js +67 -0
  16. package/dist/components/loading/assets/loading.webp.js +3 -0
  17. package/dist/components/loading/index.d.ts +16 -0
  18. package/dist/components/loading/index.js +85 -0
  19. package/dist/components/model-uploader/index.d.ts +17 -0
  20. package/dist/components/model-uploader/index.js +93 -0
  21. package/dist/components/tree/index.d.ts +14 -0
  22. package/dist/components/tree/index.js +50 -0
  23. package/dist/components/tree/node.d.ts +23 -0
  24. package/dist/components/tree/node.js +185 -0
  25. package/dist/index.d.ts +4 -0
  26. package/dist/index.js +43 -0
  27. package/dist/style.css +1193 -0
  28. package/dist/theme.d.ts +2 -0
  29. package/dist/theme.js +96 -0
  30. package/dist/tokens/materials.d.ts +4 -0
  31. package/dist/tokens/materials.js +4 -0
  32. package/dist/tokens/nexus.d.ts +51 -0
  33. package/dist/tokens/nexus.js +42 -0
  34. package/dist/ui/avatar/index.d.ts +11 -0
  35. package/dist/ui/avatar/index.js +55 -0
  36. package/dist/ui/badge/index.d.ts +2 -0
  37. package/dist/ui/badge/index.js +45 -0
  38. package/dist/ui/button.d.ts +8 -0
  39. package/dist/ui/button.js +61 -0
  40. package/dist/ui/carousel/index.d.ts +43 -0
  41. package/dist/ui/carousel/index.js +186 -0
  42. package/dist/ui/checkbox/index.d.ts +4 -0
  43. package/dist/ui/checkbox/index.js +34 -0
  44. package/dist/ui/collapsible/index.d.ts +9 -0
  45. package/dist/ui/collapsible/index.js +7 -0
  46. package/dist/ui/dialog/confirm.d.ts +20 -0
  47. package/dist/ui/dialog/confirm.js +80 -0
  48. package/dist/ui/dialog/dialog.d.ts +26 -0
  49. package/dist/ui/dialog/dialog.js +97 -0
  50. package/dist/ui/dialog/index.d.ts +2 -0
  51. package/dist/ui/drawer.d.ts +22 -0
  52. package/dist/ui/drawer.js +98 -0
  53. package/dist/ui/form.d.ts +33 -0
  54. package/dist/ui/form.js +138 -0
  55. package/dist/ui/index.d.ts +24 -0
  56. package/dist/ui/input-otp.d.ts +14 -0
  57. package/dist/ui/input-otp.js +73 -0
  58. package/dist/ui/label.d.ts +4 -0
  59. package/dist/ui/label.js +32 -0
  60. package/dist/ui/masonry/index.d.ts +13 -0
  61. package/dist/ui/masonry/index.js +45 -0
  62. package/dist/ui/popover/index.d.ts +15 -0
  63. package/dist/ui/popover/index.js +78 -0
  64. package/dist/ui/progress.d.ts +6 -0
  65. package/dist/ui/progress.js +48 -0
  66. package/dist/ui/select/index.d.ts +21 -0
  67. package/dist/ui/select/index.js +127 -0
  68. package/dist/ui/slider/index.d.ts +9 -0
  69. package/dist/ui/slider/index.js +87 -0
  70. package/dist/ui/snap-input.d.ts +7 -0
  71. package/dist/ui/snap-input.js +38 -0
  72. package/dist/ui/sonner.d.ts +5 -0
  73. package/dist/ui/sonner.js +50 -0
  74. package/dist/ui/switch.d.ts +4 -0
  75. package/dist/ui/switch.js +33 -0
  76. package/dist/ui/table/index.d.ts +22 -0
  77. package/dist/ui/table/index.js +70 -0
  78. package/dist/ui/tabs/index.d.ts +12 -0
  79. package/dist/ui/tabs/index.js +60 -0
  80. package/dist/ui/toggle/index.d.ts +2 -0
  81. package/dist/ui/toggle/toggle-group.d.ts +9 -0
  82. package/dist/ui/toggle/toggle-group.js +54 -0
  83. package/dist/ui/toggle/toggle.d.ts +11 -0
  84. package/dist/ui/toggle/toggle.js +45 -0
  85. package/dist/ui/tooltip/index.d.ts +17 -0
  86. package/dist/ui/tooltip/index.js +68 -0
  87. package/dist/utils/config.d.ts +2 -0
  88. package/dist/utils/config.js +48 -0
  89. package/dist/utils/index.d.ts +2 -0
  90. package/dist/utils/utils.d.ts +8 -0
  91. package/dist/utils/utils.js +91 -0
  92. package/package.json +148 -0
@@ -0,0 +1,70 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { cn } from '../../utils/config.js';
3
+ import '@radix-ui/react-portal';
4
+ import '../avatar/index.js';
5
+ import '../button.js';
6
+ import '../carousel/index.js';
7
+ import '../checkbox/index.js';
8
+ import '../collapsible/index.js';
9
+ import '../dialog/confirm.js';
10
+ import '../dialog/dialog.js';
11
+ import '../drawer.js';
12
+ import '../form.js';
13
+ import '../input-otp.js';
14
+ import '../label.js';
15
+ import * as React from 'react';
16
+ import '../popover/index.js';
17
+ import '../progress.js';
18
+ import '../select/index.js';
19
+ import '../slider/index.js';
20
+ import '../sonner.js';
21
+ import '../switch.js';
22
+ import '../tabs/index.js';
23
+ import '../toggle/toggle.js';
24
+ import '../toggle/toggle-group.js';
25
+ import '../tooltip/index.js';
26
+ import * as reactTable from '@tanstack/react-table';
27
+ export { reactTable as TanstackTable };
28
+
29
+ const TableRoot = React.forwardRef(
30
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsx("table", { ref, className: cn("w-full caption-bottom text-3.5", className), ...props })
31
+ );
32
+ TableRoot.displayName = "Table";
33
+ const TableHeader = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("thead", { ref, className: cn("bg-surface-secondary", className), ...props }));
34
+ TableHeader.displayName = "TableHeader";
35
+ const TableBody = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("tbody", { ref, className: cn("[&_tr:last-child]:border-0", className), ...props }));
36
+ TableBody.displayName = "TableBody";
37
+ const TableFooter = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("tfoot", { ref, className, ...props }));
38
+ TableFooter.displayName = "TableFooter";
39
+ const TableRow = React.forwardRef(
40
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsx(
41
+ "tr",
42
+ {
43
+ ref,
44
+ className: cn(
45
+ "border-b border-border-dim transition-colors duration-fast ease-smooth hover:bg-surface-hover",
46
+ className
47
+ ),
48
+ ...props
49
+ }
50
+ )
51
+ );
52
+ TableRow.displayName = "TableRow";
53
+ const TableHead = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("th", { className: cn("font-normal text-start", className), ref, ...props }));
54
+ TableHead.displayName = "TableHead";
55
+ const TableCell = React.forwardRef((props, ref) => /* @__PURE__ */ jsx("td", { ref, ...props }));
56
+ TableCell.displayName = "TableCell";
57
+ const TableCaption = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("caption", { ref, className: cn("mt-4 text-3.5", className), ...props }));
58
+ TableCaption.displayName = "TableCaption";
59
+ const Table = React.forwardRef((props, ref) => /* @__PURE__ */ jsx(TableRoot, { ...props, ref }));
60
+ Table.displayName = "Table";
61
+ Table.Root = TableRoot;
62
+ Table.Body = TableBody;
63
+ Table.Caption = TableCaption;
64
+ Table.Cell = TableCell;
65
+ Table.Footer = TableFooter;
66
+ Table.Head = TableHead;
67
+ Table.Header = TableHeader;
68
+ Table.Row = TableRow;
69
+
70
+ export { Table };
@@ -0,0 +1,12 @@
1
+ import * as TabsPrimitive from '@radix-ui/react-tabs';
2
+ import * as React from 'react';
3
+ interface TTabs extends React.ForwardRefExoticComponent<TabsPrimitive.TabsProps & React.RefAttributes<HTMLDivElement>> {
4
+ List: typeof List;
5
+ Trigger: typeof Trigger;
6
+ Content: typeof Content;
7
+ }
8
+ declare const List: React.ForwardRefExoticComponent<Omit<TabsPrimitive.TabsListProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
9
+ declare const Trigger: React.ForwardRefExoticComponent<Omit<TabsPrimitive.TabsTriggerProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
10
+ declare const Content: React.ForwardRefExoticComponent<Omit<TabsPrimitive.TabsContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
11
+ declare const Tabs: TTabs;
12
+ export { Tabs };
@@ -0,0 +1,60 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { cn } from '../../utils/config.js';
3
+ import '@radix-ui/react-portal';
4
+ import '../avatar/index.js';
5
+ import '../button.js';
6
+ import '../carousel/index.js';
7
+ import '../checkbox/index.js';
8
+ import '../collapsible/index.js';
9
+ import '../dialog/confirm.js';
10
+ import '../dialog/dialog.js';
11
+ import '../drawer.js';
12
+ import '../form.js';
13
+ import '../input-otp.js';
14
+ import '../label.js';
15
+ import * as React from 'react';
16
+ import '../popover/index.js';
17
+ import '../progress.js';
18
+ import '../select/index.js';
19
+ import '../slider/index.js';
20
+ import '../sonner.js';
21
+ import '../switch.js';
22
+ import '../table/index.js';
23
+ import '../toggle/toggle.js';
24
+ import '../toggle/toggle-group.js';
25
+ import '../tooltip/index.js';
26
+ import * as TabsPrimitive from '@radix-ui/react-tabs';
27
+
28
+ const List = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
29
+ TabsPrimitive.List,
30
+ {
31
+ ref,
32
+ className: cn("flex items-center justify-center", className),
33
+ ...props
34
+ }
35
+ ));
36
+ List.displayName = TabsPrimitive.List.displayName;
37
+ const Trigger = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
38
+ TabsPrimitive.Trigger,
39
+ {
40
+ ref,
41
+ className: cn("focus-visible:outline-none", className),
42
+ ...props
43
+ }
44
+ ));
45
+ Trigger.displayName = TabsPrimitive.Trigger.displayName;
46
+ const Content = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
47
+ TabsPrimitive.Content,
48
+ {
49
+ ref,
50
+ className: cn("focus-visible:outline-none", className),
51
+ ...props
52
+ }
53
+ ));
54
+ Content.displayName = TabsPrimitive.Content.displayName;
55
+ const Tabs = TabsPrimitive.Root;
56
+ Tabs.List = List;
57
+ Tabs.Trigger = Trigger;
58
+ Tabs.Content = Content;
59
+
60
+ export { Tabs };
@@ -0,0 +1,2 @@
1
+ export * from './toggle';
2
+ export * from './toggle-group';
@@ -0,0 +1,9 @@
1
+ import { Variant } from './toggle';
2
+ import * as ToggleGroupPrimitive from '@radix-ui/react-toggle-group';
3
+ import * as React from 'react';
4
+ interface IToggleGroup extends React.ForwardRefExoticComponent<React.PropsWithoutRef<React.ComponentPropsWithoutRef<typeof ToggleGroupPrimitive.Root>> & React.RefAttributes<React.ComponentRef<typeof ToggleGroupPrimitive.Root>>> {
5
+ Item: typeof Item;
6
+ }
7
+ declare const ToggleGroup: IToggleGroup;
8
+ declare const Item: React.ForwardRefExoticComponent<Omit<ToggleGroupPrimitive.ToggleGroupItemProps & React.RefAttributes<HTMLButtonElement>, "ref"> & Variant & React.RefAttributes<HTMLButtonElement>>;
9
+ export { ToggleGroup };
@@ -0,0 +1,54 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { cn } from '../../utils/config.js';
3
+ import '@radix-ui/react-portal';
4
+ import '../avatar/index.js';
5
+ import '../button.js';
6
+ import '../carousel/index.js';
7
+ import '../checkbox/index.js';
8
+ import '../collapsible/index.js';
9
+ import '../dialog/confirm.js';
10
+ import '../dialog/dialog.js';
11
+ import '../drawer.js';
12
+ import '../form.js';
13
+ import '../input-otp.js';
14
+ import '../label.js';
15
+ import * as React from 'react';
16
+ import '../popover/index.js';
17
+ import '../progress.js';
18
+ import '../select/index.js';
19
+ import '../slider/index.js';
20
+ import '../sonner.js';
21
+ import '../switch.js';
22
+ import '../table/index.js';
23
+ import '../tabs/index.js';
24
+ import { BaseStyle, ButtonStyle, NavigationStyle, iconClassName } from './toggle.js';
25
+ import '../tooltip/index.js';
26
+ import * as ToggleGroupPrimitive from '@radix-ui/react-toggle-group';
27
+
28
+ const ToggleGroup = React.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsx(
29
+ ToggleGroupPrimitive.Root,
30
+ {
31
+ ref,
32
+ className: cn("flex items-center justify-center gap-1", className),
33
+ ...props,
34
+ children
35
+ }
36
+ ));
37
+ ToggleGroup.displayName = ToggleGroupPrimitive.Root.displayName;
38
+ const Item = React.forwardRef(({ className, children, variant, ...props }, ref) => {
39
+ let style = "";
40
+ if (variant === "button") {
41
+ style = ButtonStyle;
42
+ }
43
+ if (variant === "navigation") {
44
+ style = NavigationStyle;
45
+ }
46
+ if (variant === "icon") {
47
+ style = iconClassName;
48
+ }
49
+ return /* @__PURE__ */ jsx(ToggleGroupPrimitive.Item, { ref, className: cn(BaseStyle, style, className), ...props, children });
50
+ });
51
+ Item.displayName = ToggleGroupPrimitive.Item.displayName;
52
+ ToggleGroup.Item = Item;
53
+
54
+ export { ToggleGroup };
@@ -0,0 +1,11 @@
1
+ import * as TogglePrimitive from '@radix-ui/react-toggle';
2
+ import * as React from 'react';
3
+ export type Variant = {
4
+ variant?: 'button' | 'navigation' | 'icon';
5
+ };
6
+ declare const BaseStyle = "box-border flex items-center justify-center transition-colors duration-fast ease-smooth";
7
+ declare const NavigationStyle = "text-text-disabled text-5 px-3 py-2 rounded-3 hover:bg-surface-hover data-[state=on]:bg-surface-hover data-[state=on]:text-text-primary";
8
+ declare const ButtonStyle = "border border-white/8 rounded-6 text-3 px-3.75 py-1.75 text-text-secondary hover:bg-surface-hover data-[state=on]:bg-core-blue/20 data-[state=on]:border-core-blue data-[state=on]:text-text-primary";
9
+ declare const iconClassName = "w-10 h-10 rounded-3 p-2 hover:bg-surface-hover data-[state=on]:text-core-blue";
10
+ declare const Toggle: React.ForwardRefExoticComponent<Omit<TogglePrimitive.ToggleProps & React.RefAttributes<HTMLButtonElement>, "ref"> & Variant & React.RefAttributes<HTMLButtonElement>>;
11
+ export { BaseStyle, ButtonStyle, iconClassName, NavigationStyle, Toggle };
@@ -0,0 +1,45 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { cn } from '../../utils/config.js';
3
+ import '@radix-ui/react-portal';
4
+ import '../avatar/index.js';
5
+ import '../button.js';
6
+ import '../carousel/index.js';
7
+ import '../checkbox/index.js';
8
+ import '../collapsible/index.js';
9
+ import '../dialog/confirm.js';
10
+ import '../dialog/dialog.js';
11
+ import '../drawer.js';
12
+ import '../form.js';
13
+ import '../input-otp.js';
14
+ import '../label.js';
15
+ import * as React from 'react';
16
+ import '../popover/index.js';
17
+ import '../progress.js';
18
+ import '../select/index.js';
19
+ import '../slider/index.js';
20
+ import '../sonner.js';
21
+ import '../switch.js';
22
+ import '../table/index.js';
23
+ import '../tabs/index.js';
24
+ import './toggle-group.js';
25
+ import '../tooltip/index.js';
26
+ import * as TogglePrimitive from '@radix-ui/react-toggle';
27
+
28
+ const BaseStyle = "box-border flex items-center justify-center transition-colors duration-fast ease-smooth";
29
+ const NavigationStyle = "text-text-disabled text-5 px-3 py-2 rounded-3 hover:bg-surface-hover data-[state=on]:bg-surface-hover data-[state=on]:text-text-primary";
30
+ const ButtonStyle = "border border-white/8 rounded-6 text-3 px-3.75 py-1.75 text-text-secondary hover:bg-surface-hover data-[state=on]:bg-core-blue/20 data-[state=on]:border-core-blue data-[state=on]:text-text-primary";
31
+ const iconClassName = "w-10 h-10 rounded-3 p-2 hover:bg-surface-hover data-[state=on]:text-core-blue";
32
+ const VariantStyle = {
33
+ button: ButtonStyle,
34
+ navigation: NavigationStyle,
35
+ icon: iconClassName
36
+ };
37
+ const Toggle = React.forwardRef(
38
+ ({ className, variant, ...props }, ref) => {
39
+ const style = variant ? VariantStyle[variant] : "";
40
+ return /* @__PURE__ */ jsx(TogglePrimitive.Root, { ref, className: cn(BaseStyle, style, className), ...props });
41
+ }
42
+ );
43
+ Toggle.displayName = TogglePrimitive.Root.displayName;
44
+
45
+ export { BaseStyle, ButtonStyle, NavigationStyle, Toggle, iconClassName };
@@ -0,0 +1,17 @@
1
+ import * as TooltipPrimitive from '@radix-ui/react-hover-card';
2
+ import * as React from 'react';
3
+ declare const Content: React.ForwardRefExoticComponent<Omit<TooltipPrimitive.HoverCardContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
4
+ interface TTooltip extends React.FC<TooltipPrimitive.HoverCardProps> {
5
+ Trigger: typeof TooltipPrimitive.Trigger;
6
+ Content: typeof Content;
7
+ Portal: typeof TooltipPrimitive.Portal;
8
+ Arrow: typeof TooltipPrimitive.Arrow;
9
+ Tips: typeof Tips;
10
+ }
11
+ declare const Tooltip: TTooltip;
12
+ interface TipsProps {
13
+ children: React.ReactNode;
14
+ side?: 'top' | 'right' | 'bottom' | 'left';
15
+ }
16
+ declare const Tips: React.FC<TipsProps>;
17
+ export { Tooltip };
@@ -0,0 +1,68 @@
1
+ import { jsx, jsxs } from 'react/jsx-runtime';
2
+ import '@radix-ui/react-portal';
3
+ import '../avatar/index.js';
4
+ import { cn } from '../../utils/config.js';
5
+ import '../button.js';
6
+ import '../carousel/index.js';
7
+ import '../checkbox/index.js';
8
+ import '../collapsible/index.js';
9
+ import '../dialog/confirm.js';
10
+ import '../dialog/dialog.js';
11
+ import '../drawer.js';
12
+ import '../form.js';
13
+ import '../input-otp.js';
14
+ import '../label.js';
15
+ import * as React from 'react';
16
+ import '../popover/index.js';
17
+ import '../progress.js';
18
+ import '../select/index.js';
19
+ import '../slider/index.js';
20
+ import '../sonner.js';
21
+ import '../switch.js';
22
+ import '../table/index.js';
23
+ import '../tabs/index.js';
24
+ import '../toggle/toggle.js';
25
+ import '../toggle/toggle-group.js';
26
+ import { Icon } from '../../components/icon/index.js';
27
+ import '../../components/img-uploader/index.js';
28
+ import '../../components/img-viewer/index.js';
29
+ import '../../components/loading/index.js';
30
+ import '../../components/model-uploader/index.js';
31
+ import { FrostGlass } from '../../tokens/materials.js';
32
+ import * as TooltipPrimitive from '@radix-ui/react-hover-card';
33
+
34
+ const AnimationBaseStyle = "duration-base ease-smooth data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=closed]:animate-out data-[state=closed]:fade-out-0";
35
+ const AnimationInStyle = "data-[side=bottom]:slide-in-t-2 data-[side=left]:slide-in-r-2 data-[side=right]:slide-in-l-2 data-[side=top]:slide-in-b-2";
36
+ const AnimationOutStyle = "data-[side=bottom]:slide-out-t-2 data-[side=left]:slide-out-r-2 data-[side=right]:slide-out-l-2 data-[side=top]:slide-out-b-2";
37
+ const BaseStyle = cn("z-50 rounded-full shadow-md outline-none", FrostGlass);
38
+ const Content = React.forwardRef(
39
+ ({ className, children, collisionPadding = 12, sideOffset = 12, side = "top", ...props }, ref) => /* @__PURE__ */ jsx(
40
+ TooltipPrimitive.Content,
41
+ {
42
+ ref,
43
+ side,
44
+ sideOffset,
45
+ collisionPadding,
46
+ className: cn(BaseStyle, AnimationBaseStyle, AnimationInStyle, AnimationOutStyle, className),
47
+ ...props,
48
+ children
49
+ }
50
+ )
51
+ );
52
+ Content.displayName = TooltipPrimitive.Content.displayName;
53
+ const Tooltip = ({ children, ...props }) => {
54
+ return /* @__PURE__ */ jsx(TooltipPrimitive.Root, { openDelay: 0, closeDelay: 200, ...props, children });
55
+ };
56
+ const Tips = ({ children, side }) => {
57
+ return /* @__PURE__ */ jsxs(Tooltip, { children: [
58
+ /* @__PURE__ */ jsx(Tooltip.Trigger, { children: /* @__PURE__ */ jsx(Icon, { icon: "i-nexus:tips-monotone", className: "size-4 text-text-secondary" }) }),
59
+ /* @__PURE__ */ jsx(Tooltip.Content, { side, className: "max-w-56 rounded-4 p-3 text-3 text-text-secondary", children })
60
+ ] });
61
+ };
62
+ Tooltip.Trigger = TooltipPrimitive.Trigger;
63
+ Tooltip.Content = Content;
64
+ Tooltip.Portal = TooltipPrimitive.Portal;
65
+ Tooltip.Arrow = TooltipPrimitive.Arrow;
66
+ Tooltip.Tips = Tips;
67
+
68
+ export { Tooltip };
@@ -0,0 +1,2 @@
1
+ import { ClassValue } from 'clsx';
2
+ export declare function cn(...inputs: ClassValue[]): string;
@@ -0,0 +1,48 @@
1
+ import { theme } from '../theme.js';
2
+ import clsx from 'clsx';
3
+ import { extendTailwindMerge } from 'tailwind-merge';
4
+
5
+ function flattenThemeColors(colorsObj, prefix = "") {
6
+ const result = [];
7
+ if (!colorsObj) return result;
8
+ Object.entries(colorsObj).forEach(([key, value]) => {
9
+ const currentKey = key === "DEFAULT" ? prefix : prefix ? `${prefix}-${key}` : key;
10
+ if (typeof value === "string") {
11
+ result.push(currentKey);
12
+ } else if (typeof value === "object" && value !== null) {
13
+ const nestedColors = flattenThemeColors(value, currentKey);
14
+ result.push(...nestedColors);
15
+ }
16
+ });
17
+ return result;
18
+ }
19
+ const twMerge = extendTailwindMerge({
20
+ extend: {
21
+ theme: {
22
+ colors: flattenThemeColors(theme.colors)
23
+ },
24
+ classGroups: {
25
+ "font-size": [
26
+ {
27
+ text: [(arg) => !isNaN(Number(arg))]
28
+ }
29
+ ],
30
+ "text-color": [
31
+ {
32
+ c: [(arg) => isNaN(Number(arg))],
33
+ color: [(arg) => isNaN(Number(arg))]
34
+ }
35
+ ],
36
+ rounded: [
37
+ {
38
+ rounded: [(arg) => !isNaN(Number(arg))]
39
+ }
40
+ ]
41
+ }
42
+ }
43
+ });
44
+ function cn(...inputs) {
45
+ return twMerge(clsx(inputs));
46
+ }
47
+
48
+ export { cn };
@@ -0,0 +1,2 @@
1
+ export * from './config';
2
+ export * from './utils';
@@ -0,0 +1,8 @@
1
+ export declare function isMobileDevice(ua: string | null): boolean;
2
+ export declare const sleep: (ms: number) => Promise<unknown>;
3
+ export declare const jump: (url: string, blank?: boolean) => void;
4
+ export declare const download: (url: string, name?: string) => void;
5
+ export declare const copy: (copyText: string, toastText: string) => void;
6
+ export declare const getSuffix: (file: File | string) => string | undefined;
7
+ export declare const checkSize: (file: File, size?: number) => boolean;
8
+ export declare const checkType: (file: File, type: "image" | "model") => boolean;
@@ -0,0 +1,91 @@
1
+ import '@radix-ui/react-portal';
2
+ import '../ui/avatar/index.js';
3
+ import 'react/jsx-runtime';
4
+ import './config.js';
5
+ import '../ui/button.js';
6
+ import '../ui/carousel/index.js';
7
+ import '../ui/checkbox/index.js';
8
+ import '../ui/collapsible/index.js';
9
+ import '../ui/dialog/confirm.js';
10
+ import '../ui/dialog/dialog.js';
11
+ import '../ui/drawer.js';
12
+ import '../ui/form.js';
13
+ import '../ui/input-otp.js';
14
+ import '../ui/label.js';
15
+ import 'react';
16
+ import '../ui/popover/index.js';
17
+ import '../ui/progress.js';
18
+ import '../ui/select/index.js';
19
+ import '../ui/slider/index.js';
20
+ import '../ui/sonner.js';
21
+ import '../ui/switch.js';
22
+ import '../ui/table/index.js';
23
+ import '../ui/tabs/index.js';
24
+ import '../ui/toggle/toggle.js';
25
+ import '../ui/toggle/toggle-group.js';
26
+ import '../ui/tooltip/index.js';
27
+ import { toast } from 'sonner';
28
+
29
+ function isMobileDevice(ua) {
30
+ if (!ua) return false;
31
+ if (/android|webos|iphone|ipod|blackberry|iemobile|opera mini/i.test(ua)) {
32
+ return true;
33
+ } else {
34
+ return false;
35
+ }
36
+ }
37
+ const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
38
+ const jump = (url, blank = true) => {
39
+ const a = document.createElement("a");
40
+ a.href = url;
41
+ if (blank) {
42
+ a.target = "_blank";
43
+ }
44
+ a.click();
45
+ };
46
+ const download = (url, name) => {
47
+ const a = document.createElement("a");
48
+ a.href = url;
49
+ if (name) {
50
+ a.download = name;
51
+ }
52
+ a.click();
53
+ };
54
+ const copy = (copyText, toastText) => {
55
+ navigator.clipboard.writeText(copyText).then(() => {
56
+ toast(toastText);
57
+ }).catch((error) => {
58
+ console.error("Failed to copy text:", error);
59
+ });
60
+ };
61
+ const getSuffix = (file) => {
62
+ const name = typeof file === "string" ? file : file.name;
63
+ let suffix = name.split(".").pop()?.toLowerCase();
64
+ if (file instanceof File) {
65
+ suffix = suffix || file.type.split("/").pop();
66
+ }
67
+ return suffix;
68
+ };
69
+ const checkSize = (file, size = 5) => {
70
+ const maxFileSize = size * 1024 * 1024;
71
+ if (file.size > maxFileSize) {
72
+ console.log(`The uploaded file size cannot exceed ${size} MB`);
73
+ return false;
74
+ }
75
+ return true;
76
+ };
77
+ const checkType = (file, type) => {
78
+ const m = {
79
+ image: ["webp", "png", "jpg", "jpeg"],
80
+ model: ["fbx", "obj", "stl", "glb"]
81
+ };
82
+ const suffix = getSuffix(file);
83
+ if (m[type].findIndex((v) => v === suffix) > -1) {
84
+ return true;
85
+ } else {
86
+ console.log("This file type is not supported.");
87
+ return false;
88
+ }
89
+ };
90
+
91
+ export { checkSize, checkType, copy, download, getSuffix, isMobileDevice, jump, sleep };
package/package.json ADDED
@@ -0,0 +1,148 @@
1
+ {
2
+ "name": "@sruim/nexus-design",
3
+ "version": "0.0.1",
4
+ "type": "module",
5
+ "main": "dist/index.js",
6
+ "module": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "import": "./dist/index.js",
11
+ "types": "./dist/index.d.ts"
12
+ },
13
+ "./components": {
14
+ "import": "./dist/components/index.js",
15
+ "types": "./dist/components/index.d.ts"
16
+ },
17
+ "./ui": {
18
+ "import": "./dist/ui/index.js",
19
+ "types": "./dist/ui/index.d.ts"
20
+ },
21
+ "./utils": {
22
+ "import": "./dist/utils/index.js",
23
+ "types": "./dist/utils/index.d.ts"
24
+ },
25
+ "./theme": {
26
+ "import": "./dist/theme.js",
27
+ "types": "./dist/theme.d.ts"
28
+ },
29
+ "./ui/*": {
30
+ "import": "./dist/ui/*.js",
31
+ "types": "./dist/ui/*.d.ts"
32
+ },
33
+ "./components/*": {
34
+ "import": "./dist/components/*.js",
35
+ "types": "./dist/components/*.d.ts"
36
+ },
37
+ "./style.css": "./dist/style.css"
38
+ },
39
+ "files": [
40
+ "dist"
41
+ ],
42
+ "scripts": {
43
+ "prepare": "husky",
44
+ "lint": "eslint . --fix",
45
+ "typecheck": "tsc --noEmit",
46
+ "build": "tsc -p tsconfig.build.json && vite build",
47
+ "dev": "vite build --watch",
48
+ "storybook": "storybook dev -p 6006",
49
+ "build-storybook": "storybook build"
50
+ },
51
+ "dependencies": {
52
+ "@hookform/resolvers": "^4.1.3",
53
+ "@radix-ui/react-avatar": "^1.1.3",
54
+ "@radix-ui/react-checkbox": "^1.1.4",
55
+ "@radix-ui/react-collapsible": "^1.1.3",
56
+ "@radix-ui/react-dialog": "^1.1.14",
57
+ "@radix-ui/react-hover-card": "^1.1.6",
58
+ "@radix-ui/react-label": "^2.1.2",
59
+ "@radix-ui/react-popover": "^1.1.6",
60
+ "@radix-ui/react-portal": "^1.1.4",
61
+ "@radix-ui/react-progress": "^1.1.2",
62
+ "@radix-ui/react-select": "^2.1.6",
63
+ "@radix-ui/react-slider": "^1.2.3",
64
+ "@radix-ui/react-slot": "^1.1.2",
65
+ "@radix-ui/react-switch": "^1.1.3",
66
+ "@radix-ui/react-tabs": "^1.1.3",
67
+ "@radix-ui/react-toggle": "^1.1.2",
68
+ "@radix-ui/react-toggle-group": "^1.1.2",
69
+ "@radix-ui/react-visually-hidden": "^1.1.2",
70
+ "@tanstack/react-table": "^8.21.2",
71
+ "@unocss/reset": "^66.2.3",
72
+ "class-variance-authority": "^0.7.1",
73
+ "clsx": "^2.1.1",
74
+ "embla-carousel-autoplay": "^8.6.0",
75
+ "embla-carousel-react": "^8.5.2",
76
+ "input-otp": "^1.4.2",
77
+ "lodash-es": "^4.17.21",
78
+ "react-hook-form": "^7.54.2",
79
+ "sonner": "^2.0.1",
80
+ "tailwind-merge": "^2.6.0",
81
+ "vaul": "^1.1.2",
82
+ "zod": "^3.25.67"
83
+ },
84
+ "devDependencies": {
85
+ "@chromatic-com/storybook": "^5.0.0",
86
+ "@eslint/js": "^9.29.0",
87
+ "@storybook/addon-a11y": "^10.1.11",
88
+ "@storybook/addon-docs": "^10.1.11",
89
+ "@storybook/addon-onboarding": "^10.1.11",
90
+ "@storybook/addon-vitest": "^10.1.11",
91
+ "@storybook/react": "^10.1.11",
92
+ "@storybook/react-vite": "^10.1.11",
93
+ "@types/lodash-es": "^4.17.12",
94
+ "@types/node": "^22.10.6",
95
+ "@types/react": "^19.1.8",
96
+ "@types/react-dom": "^19.1.6",
97
+ "@typescript-eslint/eslint-plugin": "^8.34.1",
98
+ "@unocss/eslint-config": "^66.2.3",
99
+ "@unocss/postcss": "^66.2.3",
100
+ "@vitejs/plugin-react": "^4.5.2",
101
+ "@vitest/browser-playwright": "^4.0.17",
102
+ "@vitest/coverage-v8": "^4.0.17",
103
+ "eslint": "^9.29.0",
104
+ "eslint-config-prettier": "^10.1.5",
105
+ "eslint-plugin-jsx-a11y": "^6.10.2",
106
+ "eslint-plugin-prettier": "^5.5.0",
107
+ "eslint-plugin-react": "^7.37.5",
108
+ "eslint-plugin-react-hooks": "^5.2.0",
109
+ "eslint-plugin-storybook": "^10.1.11",
110
+ "globals": "^16.2.0",
111
+ "husky": "^9.1.7",
112
+ "lint-staged": "^15.4.3",
113
+ "playwright": "^1.57.0",
114
+ "prettier": "^3.5.3",
115
+ "prettier-plugin-organize-imports": "^4.1.0",
116
+ "react": "^19.1.0",
117
+ "react-dom": "^19.0.0",
118
+ "sass-embedded": "^1.89.2",
119
+ "storybook": "^10.1.11",
120
+ "stylelint": "^16.23.1",
121
+ "stylelint-config-standard-scss": "^15.0.1",
122
+ "stylelint-prettier": "^5.0.3",
123
+ "typescript": "^5.8.3",
124
+ "typescript-eslint": "^8.34.1",
125
+ "unocss": "^66.2.3",
126
+ "unocss-preset-animations": "^1.2.1",
127
+ "unocss-preset-shadcn": "^0.5.0",
128
+ "vite": "^6.3.5",
129
+ "vite-env-only": "^3.0.3",
130
+ "vite-plugin-dts": "^4.5.4",
131
+ "vite-tsconfig-paths": "^5.1.4",
132
+ "vitest": "^4.0.17"
133
+ },
134
+ "peerDependencies": {
135
+ "react": ">=18.0.0",
136
+ "react-dom": ">=18.0.0"
137
+ },
138
+ "lint-staged": {
139
+ "*.{ts,tsx,js,jsx}": [
140
+ "eslint --fix"
141
+ ]
142
+ },
143
+ "engines": {
144
+ "node": ">=20.0.0",
145
+ "pnpm": ">=9.6.0"
146
+ },
147
+ "packageManager": "pnpm@10.10.0+sha512.d615db246fe70f25dcfea6d8d73dee782ce23e2245e3c4f6f888249fb568149318637dca73c2c5c8ef2a4ca0d5657fb9567188bfab47f566d1ee6ce987815c39"
148
+ }