@taicode/common-web 3.2.0 → 3.3.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 (46) hide show
  1. package/output/components/alert-dialog.js +10 -10
  2. package/output/components/alert.js +5 -5
  3. package/output/components/avatar.js +7 -7
  4. package/output/components/badge.js +2 -2
  5. package/output/components/button.js +2 -2
  6. package/output/components/card.js +7 -7
  7. package/output/components/checkbox.js +2 -2
  8. package/output/components/command.js +10 -10
  9. package/output/components/dialog.js +7 -7
  10. package/output/components/dropdown-menu.js +10 -10
  11. package/output/components/field.js +11 -11
  12. package/output/components/input-group.js +7 -7
  13. package/output/components/input.js +2 -2
  14. package/output/components/item.js +11 -11
  15. package/output/components/json-view/index.js +2 -2
  16. package/output/components/kbd.js +3 -3
  17. package/output/components/label.js +2 -2
  18. package/output/components/native-select.js +3 -3
  19. package/output/components/popover.js +5 -5
  20. package/output/components/progress.js +2 -2
  21. package/output/components/radio-group.js +3 -3
  22. package/output/components/scroll-area.js +3 -3
  23. package/output/components/select.js +9 -9
  24. package/output/components/separator.js +2 -2
  25. package/output/components/sheet.js +7 -7
  26. package/output/components/skeleton.js +2 -2
  27. package/output/components/spinner.js +2 -2
  28. package/output/components/switch.js +2 -2
  29. package/output/components/table.js +9 -9
  30. package/output/components/tabs.js +5 -5
  31. package/output/components/textarea.js +2 -2
  32. package/output/components/tooltip.js +2 -2
  33. package/output/features/confirm-dialog/index.js +2 -2
  34. package/output/layout/app/index.js +7 -7
  35. package/output/layout/dashboard/index.js +2 -2
  36. package/output/utils/merge-class-names/index.d.ts +3 -0
  37. package/output/utils/merge-class-names/index.d.ts.map +1 -0
  38. package/output/utils/{cn → merge-class-names}/index.js +1 -1
  39. package/output/utils/merge-class-names/index.test.d.ts.map +1 -0
  40. package/output/utils/merge-class-names/index.test.js +7 -0
  41. package/package.json +2 -42
  42. package/output/utils/cn/index.d.ts +0 -3
  43. package/output/utils/cn/index.d.ts.map +0 -1
  44. package/output/utils/cn/index.test.d.ts.map +0 -1
  45. package/output/utils/cn/index.test.js +0 -7
  46. /package/output/utils/{cn → merge-class-names}/index.test.d.ts +0 -0
@@ -1,9 +1,9 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useEffect, useState } from 'react';
3
- import { cn } from '../../utils/cn/index.js';
3
+ import { mergeClassNames } from '../../utils/merge-class-names/index.js';
4
4
  export function AppLayout(props) {
5
5
  const { header, footer, mobileNavigation, children, contentClassName } = props;
6
- return (_jsxs("div", { className: "flex min-h-dvh min-w-0 flex-col bg-background", children: [header, _jsx("main", { className: cn('min-w-0 flex-1', contentClassName), children: children }), footer && _jsx("div", { className: "border-t border-border bg-transparent", children: footer }), mobileNavigation] }));
6
+ return (_jsxs("div", { className: "flex min-h-dvh min-w-0 flex-col bg-background", children: [header, _jsx("main", { className: mergeClassNames('min-w-0 flex-1', contentClassName), children: children }), footer && _jsx("div", { className: "border-t border-border bg-transparent", children: footer }), mobileNavigation] }));
7
7
  }
8
8
  export function AppNavigation(props) {
9
9
  const { variant = 'standard', brand, navigation, actions, mobileBrand = brand, mobileActions = actions, } = props;
@@ -16,19 +16,19 @@ export function AppNavigation(props) {
16
16
  window.addEventListener('scroll', handleScroll, { passive: true });
17
17
  return () => window.removeEventListener('scroll', handleScroll);
18
18
  }, [variant]);
19
- return (_jsx("header", { className: cn('sticky top-0 z-50 transition-all duration-300', variant === 'standard' ? 'border-b border-border/70 bg-background/90 backdrop-blur-xl' : 'py-3 md:py-4'), children: _jsxs("div", { className: cn('w-full px-4 sm:px-6 lg:px-8', variant === 'standard' && 'mx-auto max-w-6xl'), children: [_jsxs("nav", { "aria-label": "Global", className: cn('hidden items-center justify-between gap-5 transition-all duration-300 lg:flex', variant === 'standard'
19
+ return (_jsx("header", { className: mergeClassNames('sticky top-0 z-50 transition-all duration-300', variant === 'standard' ? 'border-b border-border/70 bg-background/90 backdrop-blur-xl' : 'py-3 md:py-4'), children: _jsxs("div", { className: mergeClassNames('w-full px-4 sm:px-6 lg:px-8', variant === 'standard' && 'mx-auto max-w-6xl'), children: [_jsxs("nav", { "aria-label": "Global", className: mergeClassNames('hidden items-center justify-between gap-5 transition-all duration-300 lg:flex', variant === 'standard'
20
20
  ? 'h-16'
21
- : cn('rounded-full border px-6 py-3 shadow-sm backdrop-blur', isScrolled
21
+ : mergeClassNames('rounded-full border px-6 py-3 shadow-sm backdrop-blur', isScrolled
22
22
  ? 'border-border/10 bg-background/60 shadow-xl backdrop-blur-2xl'
23
- : 'border-border/70 bg-background/80')), children: [_jsx("div", { className: "flex h-8 items-center gap-1 lg:flex-1", children: brand }), navigation, _jsx("div", { className: "hidden lg:flex lg:flex-1 lg:items-center lg:justify-end lg:gap-3", children: actions })] }), _jsxs("div", { className: cn('flex items-center justify-between gap-4 lg:hidden', variant === 'standard'
23
+ : 'border-border/70 bg-background/80')), children: [_jsx("div", { className: "flex h-8 items-center gap-1 lg:flex-1", children: brand }), navigation, _jsx("div", { className: "hidden lg:flex lg:flex-1 lg:items-center lg:justify-end lg:gap-3", children: actions })] }), _jsxs("div", { className: mergeClassNames('flex items-center justify-between gap-4 lg:hidden', variant === 'standard'
24
24
  ? 'h-14'
25
25
  : 'rounded-full border border-border bg-background/80 px-4 py-3 shadow-sm backdrop-blur'), children: [mobileBrand, _jsx("div", { className: "ml-auto flex items-center gap-1", children: mobileActions })] })] }) }));
26
26
  }
27
27
  export function AppMobileNavigation(props) {
28
28
  const { label, children, className } = props;
29
- return (_jsx("nav", { className: "fixed inset-x-0 bottom-0 z-50 border-t border-border/70 bg-background/90 backdrop-blur-xl lg:hidden", "aria-label": label, children: _jsx("div", { className: cn('mx-auto grid max-w-lg grid-cols-4 px-2 pb-[max(0.375rem,env(safe-area-inset-bottom))] pt-1.5', className), children: children }) }));
29
+ return (_jsx("nav", { className: "fixed inset-x-0 bottom-0 z-50 border-t border-border/70 bg-background/90 backdrop-blur-xl lg:hidden", "aria-label": label, children: _jsx("div", { className: mergeClassNames('mx-auto grid max-w-lg grid-cols-4 px-2 pb-[max(0.375rem,env(safe-area-inset-bottom))] pt-1.5', className), children: children }) }));
30
30
  }
31
31
  export function AppContent(props) {
32
32
  const { title, description, back, toolbar, children, className } = props;
33
- return (_jsxs("div", { className: cn('mx-auto w-full max-w-6xl min-w-0 px-4 py-6 sm:px-6 md:py-10 lg:px-8', className), children: [(back || title || description || toolbar) && (_jsxs("div", { className: "mb-8 space-y-3 border-b pb-5", children: [back, _jsxs("div", { className: "flex min-w-0 items-start justify-between gap-3", children: [_jsxs("div", { className: "min-w-0 flex-1", children: [title && _jsx("h1", { className: "text-2xl font-semibold md:text-3xl", children: title }), description && _jsx("p", { className: "mt-1 text-sm text-muted-foreground md:text-base", children: description })] }), toolbar && _jsx("div", { className: "flex min-h-9 shrink-0 items-center gap-2", children: toolbar })] })] })), children] }));
33
+ return (_jsxs("div", { className: mergeClassNames('mx-auto w-full max-w-6xl min-w-0 px-4 py-6 sm:px-6 md:py-10 lg:px-8', className), children: [(back || title || description || toolbar) && (_jsxs("div", { className: "mb-8 space-y-3 border-b pb-5", children: [back, _jsxs("div", { className: "flex min-w-0 items-start justify-between gap-3", children: [_jsxs("div", { className: "min-w-0 flex-1", children: [title && _jsx("h1", { className: "text-2xl font-semibold md:text-3xl", children: title }), description && _jsx("p", { className: "mt-1 text-sm text-muted-foreground md:text-base", children: description })] }), toolbar && _jsx("div", { className: "flex min-h-9 shrink-0 items-center gap-2", children: toolbar })] })] })), children] }));
34
34
  }
@@ -12,14 +12,14 @@ var __rest = (this && this.__rest) || function (s, e) {
12
12
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
13
13
  import { ArrowLeftIcon, ChevronLeft, ChevronRight, ChevronsLeft, ChevronsRight, RefreshCwIcon, RotateCcwIcon, SearchIcon } from 'lucide-react';
14
14
  import { Button } from '../../components/button.js';
15
- import { cn } from '../../utils/cn/index.js';
15
+ import { mergeClassNames } from '../../utils/merge-class-names/index.js';
16
16
  export function DashboardLayout(props) {
17
17
  const { sidebar, header, children } = props;
18
18
  return (_jsxs(_Fragment, { children: [sidebar, _jsxs("div", { className: "flex min-h-0 min-w-0 flex-1 flex-col", children: [header, _jsx("div", { className: "flex min-h-0 min-w-0 flex-1 flex-col", children: _jsx("div", { className: "@container/main flex min-w-0 flex-1 flex-col gap-2", children: children }) })] })] }));
19
19
  }
20
20
  export function DashboardMain(props) {
21
21
  const { className } = props, rest = __rest(props, ["className"]);
22
- return _jsx("div", Object.assign({ className: cn('w-full min-w-0 px-4 lg:px-6', className) }, rest));
22
+ return _jsx("div", Object.assign({ className: mergeClassNames('w-full min-w-0 px-4 lg:px-6', className) }, rest));
23
23
  }
24
24
  export function DashboardContent(props) {
25
25
  const { title, description, back, toolbar, filters, children } = props;
@@ -0,0 +1,3 @@
1
+ import { type ClassValue } from 'clsx';
2
+ export declare function mergeClassNames(...inputs: ClassValue[]): string;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/utils/merge-class-names/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,UAAU,EAAE,MAAM,MAAM,CAAA;AAG5C,wBAAgB,eAAe,CAAC,GAAG,MAAM,EAAE,UAAU,EAAE,UAEtD"}
@@ -1,5 +1,5 @@
1
1
  import { clsx } from 'clsx';
2
2
  import { twMerge } from 'tailwind-merge';
3
- export function cn(...inputs) {
3
+ export function mergeClassNames(...inputs) {
4
4
  return twMerge(clsx(inputs));
5
5
  }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../../../source/utils/merge-class-names/index.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,7 @@
1
+ import { describe, expect, it } from 'vitest';
2
+ import { mergeClassNames } from './index.js';
3
+ describe('mergeClassNames', () => {
4
+ it('merges conditional and conflicting Tailwind classes', () => {
5
+ expect(mergeClassNames('px-2', false && 'text-muted-foreground', 'px-4')).toBe('px-4');
6
+ });
7
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taicode/common-web",
3
- "version": "3.2.0",
3
+ "version": "3.3.0",
4
4
  "author": "Alain",
5
5
  "license": "ISC",
6
6
  "description": "",
@@ -10,50 +10,10 @@
10
10
  },
11
11
  "exports": {
12
12
  "./styles.css": "./styles.css",
13
- "./ui": {
13
+ "./components": {
14
14
  "types": "./output/components/index.d.ts",
15
15
  "default": "./output/components/index.js"
16
16
  },
17
- "./service": {
18
- "types": "./output/services/service/index.d.ts",
19
- "default": "./output/services/service/index.js"
20
- },
21
- "./toaster": {
22
- "types": "./output/components/toaster/index.d.ts",
23
- "default": "./output/components/toaster/index.js"
24
- },
25
- "./loading-button": {
26
- "types": "./output/components/loading-button/index.d.ts",
27
- "default": "./output/components/loading-button/index.js"
28
- },
29
- "./size-provider": {
30
- "types": "./output/components/size-provider/index.d.ts",
31
- "default": "./output/components/size-provider/index.js"
32
- },
33
- "./use-loading": {
34
- "types": "./output/hooks/use-loading/index.d.ts",
35
- "default": "./output/hooks/use-loading/index.js"
36
- },
37
- "./use-observer": {
38
- "types": "./output/hooks/use-observer/index.d.ts",
39
- "default": "./output/hooks/use-observer/index.js"
40
- },
41
- "./cn": {
42
- "types": "./output/utils/cn/index.d.ts",
43
- "default": "./output/utils/cn/index.js"
44
- },
45
- "./cache-api": {
46
- "types": "./output/services/cache-api/index.d.ts",
47
- "default": "./output/services/cache-api/index.js"
48
- },
49
- "./side-cache": {
50
- "types": "./output/services/side-cache/index.d.ts",
51
- "default": "./output/services/side-cache/index.js"
52
- },
53
- "./signin": {
54
- "types": "./output/features/signin/index.d.ts",
55
- "default": "./output/features/signin/index.js"
56
- },
57
17
  "./vite-config": {
58
18
  "types": "./output/vite-config/index.d.ts",
59
19
  "default": "./output/vite-config/index.js"
@@ -1,3 +0,0 @@
1
- import { type ClassValue } from 'clsx';
2
- export declare function cn(...inputs: ClassValue[]): string;
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/utils/cn/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,UAAU,EAAE,MAAM,MAAM,CAAA;AAG5C,wBAAgB,EAAE,CAAC,GAAG,MAAM,EAAE,UAAU,EAAE,UAEzC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../../../source/utils/cn/index.test.ts"],"names":[],"mappings":""}
@@ -1,7 +0,0 @@
1
- import { describe, expect, it } from 'vitest';
2
- import { cn } from './index.js';
3
- describe('cn', () => {
4
- it('merges conditional and conflicting Tailwind classes', () => {
5
- expect(cn('px-2', false && 'text-muted-foreground', 'px-4')).toBe('px-4');
6
- });
7
- });