@meta-1/design 0.0.159

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/README.md +412 -0
  2. package/package.json +138 -0
  3. package/src/assets/icons/empty.svg +1 -0
  4. package/src/assets/icons/spin.svg +1 -0
  5. package/src/assets/locales/en-us.ts +74 -0
  6. package/src/assets/locales/zh-cn.ts +74 -0
  7. package/src/assets/locales/zh-tw.ts +74 -0
  8. package/src/assets/style/theme.css +173 -0
  9. package/src/components/icons/Empty.tsx +18 -0
  10. package/src/components/icons/Spin.tsx +16 -0
  11. package/src/components/icons/index.ts +2 -0
  12. package/src/components/ui/alert-dialog.tsx +111 -0
  13. package/src/components/ui/alert.tsx +49 -0
  14. package/src/components/ui/avatar.tsx +32 -0
  15. package/src/components/ui/badge.tsx +36 -0
  16. package/src/components/ui/breadcrumb.tsx +92 -0
  17. package/src/components/ui/button.tsx +52 -0
  18. package/src/components/ui/calendar.tsx +56 -0
  19. package/src/components/ui/card.tsx +56 -0
  20. package/src/components/ui/checkbox.tsx +28 -0
  21. package/src/components/ui/command.tsx +137 -0
  22. package/src/components/ui/dialog.tsx +127 -0
  23. package/src/components/ui/dropdown-menu.tsx +217 -0
  24. package/src/components/ui/form.tsx +138 -0
  25. package/src/components/ui/hover-card.tsx +36 -0
  26. package/src/components/ui/input-otp.tsx +66 -0
  27. package/src/components/ui/input.tsx +21 -0
  28. package/src/components/ui/label.tsx +21 -0
  29. package/src/components/ui/navigation-menu.tsx +142 -0
  30. package/src/components/ui/pagination.tsx +118 -0
  31. package/src/components/ui/popover.tsx +40 -0
  32. package/src/components/ui/progress.tsx +22 -0
  33. package/src/components/ui/radio-group.tsx +31 -0
  34. package/src/components/ui/resizable.tsx +46 -0
  35. package/src/components/ui/scroll-area.tsx +46 -0
  36. package/src/components/ui/select.tsx +158 -0
  37. package/src/components/ui/separator.tsx +26 -0
  38. package/src/components/ui/sheet.tsx +101 -0
  39. package/src/components/ui/skeleton.tsx +7 -0
  40. package/src/components/ui/sonner.tsx +23 -0
  41. package/src/components/ui/switch.tsx +26 -0
  42. package/src/components/ui/table.tsx +73 -0
  43. package/src/components/ui/tabs.tsx +40 -0
  44. package/src/components/ui/textarea.tsx +18 -0
  45. package/src/components/ui/tooltip.tsx +46 -0
  46. package/src/components/uix/action/index.tsx +37 -0
  47. package/src/components/uix/alert/index.tsx +43 -0
  48. package/src/components/uix/alert-dialog/index.tsx +109 -0
  49. package/src/components/uix/avatar/index.tsx +25 -0
  50. package/src/components/uix/breadcrumbs/index.tsx +38 -0
  51. package/src/components/uix/broadcast-channel-context/index.tsx +28 -0
  52. package/src/components/uix/button/index.tsx +29 -0
  53. package/src/components/uix/card/index.tsx +32 -0
  54. package/src/components/uix/checkbox/index.tsx +79 -0
  55. package/src/components/uix/checkbox-group/index.tsx +60 -0
  56. package/src/components/uix/combo-select/index.tsx +364 -0
  57. package/src/components/uix/config-provider/index.tsx +31 -0
  58. package/src/components/uix/data-table/index.tsx +491 -0
  59. package/src/components/uix/data-table/style.css +40 -0
  60. package/src/components/uix/date-picker/index.tsx +88 -0
  61. package/src/components/uix/date-range-picker/index.tsx +71 -0
  62. package/src/components/uix/dialog/index.tsx +70 -0
  63. package/src/components/uix/divider/index.tsx +23 -0
  64. package/src/components/uix/dropdown/index.tsx +117 -0
  65. package/src/components/uix/empty/index.tsx +29 -0
  66. package/src/components/uix/filters/index.tsx +105 -0
  67. package/src/components/uix/form/index.tsx +274 -0
  68. package/src/components/uix/image/index.tsx +13 -0
  69. package/src/components/uix/loading/index.tsx +24 -0
  70. package/src/components/uix/message/index.tsx +21 -0
  71. package/src/components/uix/pagination/index.tsx +180 -0
  72. package/src/components/uix/radio-group/index.tsx +35 -0
  73. package/src/components/uix/result/index.tsx +45 -0
  74. package/src/components/uix/select/index.tsx +93 -0
  75. package/src/components/uix/space/index.tsx +24 -0
  76. package/src/components/uix/spin/index.tsx +12 -0
  77. package/src/components/uix/steps/index.tsx +67 -0
  78. package/src/components/uix/switch/index.tsx +33 -0
  79. package/src/components/uix/tooltip/index.tsx +29 -0
  80. package/src/components/uix/tree/index.tsx +39 -0
  81. package/src/components/uix/tree/style.css +75 -0
  82. package/src/components/uix/tree-select/index.tsx +137 -0
  83. package/src/components/uix/tree-table/action.tsx +24 -0
  84. package/src/components/uix/tree-table/config.ts +2 -0
  85. package/src/components/uix/tree-table/index.tsx +86 -0
  86. package/src/components/uix/tree-table/utils.tsx +63 -0
  87. package/src/components/uix/uploader/index.tsx +237 -0
  88. package/src/components/uix/uploader/type.ts +20 -0
  89. package/src/components/uix/uploader/utils.ts +41 -0
  90. package/src/components/uix/value-formatter/index.tsx +59 -0
  91. package/src/hooks/index.ts +2 -0
  92. package/src/hooks/resize.ts +29 -0
  93. package/src/hooks/use.outside.ts +30 -0
  94. package/src/index.ts +159 -0
  95. package/src/lib/formatters.ts +13 -0
  96. package/src/lib/index.ts +4 -0
  97. package/src/lib/is.ts +6 -0
  98. package/src/lib/react-dom.ts +98 -0
  99. package/src/lib/utils.ts +39 -0
@@ -0,0 +1,74 @@
1
+ import "dayjs/locale/zh-tw";
2
+ import { zhTW } from "date-fns/locale";
3
+
4
+ export default {
5
+ key: "zh-TW",
6
+ Alert: {
7
+ okText: "確定",
8
+ cancelText: "取消",
9
+ },
10
+ ComboSelect: {
11
+ empty: "暫無數據",
12
+ clearText: "清空",
13
+ },
14
+ DataTable: {
15
+ empty: "暫無數據",
16
+ },
17
+ Filters: {
18
+ searchText: "搜尋",
19
+ resetText: "重置",
20
+ },
21
+ Pagination: {
22
+ totalPage: "共 %total 條",
23
+ total: "%page 頁",
24
+ size: "%size 條/頁",
25
+ go: "前往",
26
+ goSuffix: "頁",
27
+ },
28
+ Tree: {
29
+ emptyText: "暫無數據",
30
+ },
31
+ TreeTable: {
32
+ emptyText: "暫無數據",
33
+ },
34
+ DateRangePicker: {
35
+ locale: zhTW,
36
+ format: "yyyy-MM-dd",
37
+ },
38
+ Uploader: {
39
+ placeholder: "請拖曳文件到此處或點擊選擇文件",
40
+ uploadText: "上傳",
41
+ maxFilesExceeded: "已達到最大文件數量限制",
42
+ partialFilesAdded: ",只能再添加 %count 個文件",
43
+ },
44
+ DatePicker: {
45
+ locale: zhTW,
46
+ format: "yyyy-MM-dd",
47
+ presetPlaceholder: "快速選擇",
48
+ options: [
49
+ {
50
+ label: "今天",
51
+ value: "0",
52
+ },
53
+ {
54
+ label: "明天",
55
+ value: "1",
56
+ },
57
+ {
58
+ label: "三天後",
59
+ value: "3",
60
+ },
61
+ {
62
+ label: "一周後",
63
+ value: "7",
64
+ },
65
+ {
66
+ label: "一月後",
67
+ value: "30",
68
+ },
69
+ ],
70
+ },
71
+ Empty: {
72
+ text: "暫無數據",
73
+ },
74
+ };
@@ -0,0 +1,173 @@
1
+ @import "tw-animate-css";
2
+ @import "tailwindcss";
3
+ @custom-variant dark (&:is(.dark *));
4
+
5
+ @theme design {
6
+ --radius-sm: calc(var(--radius) - 4px);
7
+ --radius-md: calc(var(--radius) - 2px);
8
+ --radius-lg: var(--radius);
9
+ --radius-xl: calc(var(--radius) + 4px);
10
+ --color-background: var(--background);
11
+ --color-foreground: var(--foreground);
12
+ --color-card: var(--card);
13
+ --color-card-foreground: var(--card-foreground);
14
+ --color-popover: var(--popover);
15
+ --color-popover-foreground: var(--popover-foreground);
16
+ --color-primary: var(--primary);
17
+ --color-primary-foreground: var(--primary-foreground);
18
+ --color-secondary: var(--secondary);
19
+ --color-secondary-foreground: var(--secondary-foreground);
20
+ --color-muted: var(--muted);
21
+ --color-muted-foreground: var(--muted-foreground);
22
+ --color-accent: var(--accent);
23
+ --color-accent-foreground: var(--accent-foreground);
24
+ --color-destructive: var(--destructive);
25
+ --color-destructive-foreground: var(--destructive-foreground);
26
+ --color-success: var(--success);
27
+ --color-success-foreground: var(--success-foreground);
28
+ --color-error: var(--error);
29
+ --color-error-foreground: var(--error-foreground);
30
+ --color-warning: var(--warning);
31
+ --color-warning-foreground: var(--warning-foreground);
32
+ --color-border: var(--border);
33
+ --color-input: var(--input);
34
+ --color-ring: var(--ring);
35
+ --color-chart-1: var(--chart-1);
36
+ --color-chart-2: var(--chart-2);
37
+ --color-chart-3: var(--chart-3);
38
+ --color-chart-4: var(--chart-4);
39
+ --color-chart-5: var(--chart-5);
40
+ --color-sidebar: var(--sidebar);
41
+ --color-sidebar-foreground: var(--sidebar-foreground);
42
+ --color-sidebar-primary: var(--sidebar-primary);
43
+ --color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
44
+ --color-sidebar-accent: var(--sidebar-accent);
45
+ --color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
46
+ --color-sidebar-border: var(--sidebar-border);
47
+ --color-sidebar-ring: var(--sidebar-ring);
48
+ --color-action-hover: var(--action-hover);
49
+ }
50
+
51
+ @layer base {
52
+ :root {
53
+ --background: hsl(0 0% 100%);
54
+ --foreground: hsl(0 0% 3.9%);
55
+ --card: hsl(0 0% 100%);
56
+ --card-foreground: hsl(0 0% 3.9%);
57
+ --popover: hsl(0 0% 100%);
58
+ --popover-foreground: hsl(0 0% 3.9%);
59
+ --primary: rgba(53, 104, 82, 1);
60
+ --primary-foreground: hsl(0 0% 98%);
61
+ --secondary: hsl(0 0% 96.1%);
62
+ --secondary-foreground: hsl(0 0% 9%);
63
+ --success: rgba(232, 255, 234, 1);
64
+ --success-foreground: rgba(0, 180, 42, 1);
65
+ --error: rgba(255, 236, 232, 1);
66
+ --error-foreground: rgba(245, 63, 63, 1);
67
+ --warning: rgba(255, 247, 232, 1);
68
+ --warning-foreground: rgba(255, 125, 0, 1);
69
+ --muted: hsl(0 0% 96.1%);
70
+ --muted-foreground: hsl(0 0% 45.1%);
71
+ --accent: hsl(0 0% 96.1%);
72
+ --accent-foreground: hsl(0 0% 9%);
73
+ --destructive: rgba(245, 63, 63, 1);
74
+ --destructive-foreground: rgba(250, 250, 250, 1);
75
+ --radius: 0.5rem;
76
+ --border: oklch(0.922 0 0);
77
+ --input: oklch(0.922 0 0);
78
+ --ring: oklch(0.708 0 0);
79
+ --chart-1: oklch(0.646 0.222 41.116);
80
+ --chart-2: oklch(0.6 0.118 184.704);
81
+ --chart-3: oklch(0.398 0.07 227.392);
82
+ --chart-4: oklch(0.828 0.189 84.429);
83
+ --chart-5: oklch(0.769 0.188 70.08);
84
+ --sidebar: oklch(0.985 0 0);
85
+ --sidebar-foreground: oklch(0.145 0 0);
86
+ --sidebar-primary: oklch(0.205 0 0);
87
+ --sidebar-primary-foreground: oklch(0.985 0 0);
88
+ --sidebar-accent: oklch(0.97 0 0);
89
+ --sidebar-accent-foreground: oklch(0.205 0 0);
90
+ --sidebar-border: oklch(0.922 0 0);
91
+ --sidebar-ring: oklch(0.708 0 0);
92
+ --action-hover: rgba(0, 0, 0, 0.08);
93
+ }
94
+
95
+ .dark {
96
+ --background: hsl(0 0% 7%);
97
+ --foreground: hsl(0 0% 98%);
98
+ --card: hsl(0 0% 3.9%);
99
+ --card-foreground: hsl(0 0% 98%);
100
+ --popover: hsl(0 0% 3.9%);
101
+ --popover-foreground: hsl(0 0% 98%);
102
+ --primary: rgba(68, 133, 105, 1);
103
+ --primary-foreground: rgba(255, 255, 255, 1);
104
+ --success: rgba(232, 255, 234, 1);
105
+ --success-foreground: rgba(0, 180, 42, 1);
106
+ --error: rgba(255, 236, 232, 1);
107
+ --error-foreground: rgba(245, 63, 63, 1);
108
+ --warning: rgba(255, 247, 232, 1);
109
+ --warning-foreground: rgba(255, 125, 0, 1);
110
+ --secondary: hsl(0 0% 14.9%);
111
+ --secondary-foreground: hsl(0 0% 98%);
112
+ --muted: hsl(0 0% 14.9%);
113
+ --muted-foreground: hsl(0 0% 63.9%);
114
+ --accent: hsl(0 0% 14.9%);
115
+ --accent-foreground: hsl(0 0% 98%);
116
+ --destructive: rgba(245, 63, 63, 1);
117
+ --destructive-foreground: rgba(250, 250, 250, 1);
118
+ --border: oklch(1 0 0 / 10%);
119
+ --input: oklch(1 0 0 / 15%);
120
+ --ring: oklch(0.556 0 0);
121
+ --chart-1: oklch(0.488 0.243 264.376);
122
+ --chart-2: oklch(0.696 0.17 162.48);
123
+ --chart-3: oklch(0.769 0.188 70.08);
124
+ --chart-4: oklch(0.627 0.265 303.9);
125
+ --chart-5: oklch(0.645 0.246 16.439);
126
+ --sidebar: oklch(0.205 0 0);
127
+ --sidebar-foreground: oklch(0.985 0 0);
128
+ --sidebar-primary: oklch(0.488 0.243 264.376);
129
+ --sidebar-primary-foreground: oklch(0.985 0 0);
130
+ --sidebar-accent: oklch(0.269 0 0);
131
+ --sidebar-accent-foreground: oklch(0.985 0 0);
132
+ --sidebar-border: oklch(1 0 0 / 10%);
133
+ --sidebar-ring: oklch(0.556 0 0);
134
+ --action-hover: rgba(255, 255, 255, 0.08);
135
+ }
136
+
137
+ html {
138
+ @apply bg-background text-foreground;
139
+
140
+ *,
141
+ ::after,
142
+ ::before,
143
+ ::backdrop,
144
+ ::file-selector-button {
145
+ border-color: var(--border);
146
+ }
147
+
148
+ svg,
149
+ img {
150
+ display: inline-block;
151
+ }
152
+ }
153
+ }
154
+
155
+ @utility action-effect {
156
+ @apply hover:bg-[var(--action-hover)] hover:text-primary;
157
+ @apply focus:bg-[var(--action-hover)] focus:border-[var(--border)] focus:shadow-[0_0_0_1px_var(--card),0_0_0_3px_var(--primary)];
158
+ @apply dark:focus:border-[var(--sidebar-border)] dark:focus:shadow-[0_0_0_1px_var(--secondary),0_0_0_3px_var(--primary)];
159
+ }
160
+
161
+ @utility action-effect-active {
162
+ @apply active:bg-[var(--action-hover)] active:border-[var(--border)] active:shadow-[0_0_0_1px_var(--card),0_0_0_3px_var(--primary)];
163
+ @apply dark:active:border-[var(--sidebar-border)] dark:active:shadow-[0_0_0_1px_var(--secondary),0_0_0_3px_var(--primary)];
164
+ }
165
+
166
+ @utility action-active {
167
+ @apply text-primary bg-[var(--action-hover)] font-bold;
168
+ }
169
+
170
+ @utility action-effect-disabled {
171
+ @apply opacity-50 cursor-not-allowed focus:bg-transparent active:bg-transparent focus:shadow-none active:shadow-none focus:border-transparent active:border-transparent;
172
+ @apply hover:bg-transparent;
173
+ }
@@ -0,0 +1,18 @@
1
+ import type { SVGProps } from "react";
2
+
3
+ const SvgEmpty = (props: SVGProps<SVGSVGElement>) => (
4
+ <svg
5
+ className="empty_svg__svg_21efd88b67__icon"
6
+ height="1em"
7
+ viewBox="0 0 1485 1024"
8
+ width="1em"
9
+ xmlns="http://www.w3.org/2000/svg"
10
+ {...props}
11
+ >
12
+ <path
13
+ d="m1243.625 633.444-161.107-269.618c-3.034-6.358-8.38-10.26-14.593-10.26H401.248c-6.068 0-11.559 3.18-14.593 10.26L225.549 633.444c-1.59 1.59-1.59 3.179-1.59 6.357v329.87c0 10.26 6.069 16.617 16.183 16.617h989.756c9.97 0 16.183-6.357 16.183-16.616v-329.87c-.867-2.457-.867-4.046-2.456-6.358zM411.218 387.522h647.604l145.068 236.24H847.722c-9.97 0-16.183 6.359-16.183 16.617 0 54.762-43.78 99.843-96.663 99.843s-96.664-45.226-96.664-99.843c0-10.258-6.069-16.616-16.183-16.616H265.283l145.935-236.241zm801.775 566.256H256.18V657.14h351.4c8.38 65.02 62.852 116.603 127.295 116.603S854.513 722.161 862.17 657.14h351.544v296.493h-.722zM149.547 796.718v-18.206c0-4.769-3.901-8.67-8.38-8.67s-8.38 3.901-8.38 8.67v18.205h-17.629c-4.623 0-8.38 3.902-8.38 8.67s3.901 8.67 8.38 8.67h17.628v18.205c0 4.768 3.901 8.67 8.38 8.67 4.624 0 8.381-3.902 8.381-8.67v-18.206h17.628c4.624 0 8.38-3.901 8.38-8.67s-3.901-8.669-8.38-8.669h-17.628zm1157.075-360.792h26.875c6.936 0 13.004 6.358 13.004 13.438 0 7.947-5.346 13.437-13.004 13.437h-26.875v27.742c0 7.08-6.068 13.438-13.004 13.438s-13.004-5.49-13.004-13.438v-27.742h-26.875c-6.936 0-13.004-6.357-13.004-13.437 0-7.947 5.346-13.438 13.004-13.438h26.875v-27.742c0-7.08 6.069-13.438 13.004-13.438 7.658 0 13.004 5.491 13.004 13.438v27.742zm94.352 118.193h16.905c4.624 0 8.38 3.901 8.38 8.67s-3.9 8.669-8.38 8.669h-16.905v17.483c0 4.768-3.901 8.67-8.38 8.67-4.624 0-8.38-3.902-8.38-7.948V572.18h-16.906c-4.624 0-8.38-3.901-8.38-8.67s3.9-8.669 8.38-8.669h16.905v-18.205c0-4.769 3.902-8.67 8.38-8.67 4.624 0 8.381 3.901 8.381 8.67v17.483zM171.8 413.819v-27.742c0-7.947-6.07-13.438-13.005-13.438-7.658 0-13.004 6.358-13.004 13.438v27.02h-26.152c-7.658 0-13.004 6.357-13.004 13.437 0 7.947 6.068 13.438 13.004 13.438h26.152v27.02c0 7.946 6.069 13.437 13.004 13.437 7.658 0 13.005-6.358 13.005-13.438v-27.02h26.152c7.658 0 13.004-6.357 13.004-13.437 0-7.947-6.068-13.437-13.004-13.437 0 .722-26.152.722-26.152.722zM52.883 684.16C23.696 684.16 0 659.597 0 629.4s23.84-54.763 52.883-54.763c29.187 0 52.884 24.564 52.884 54.762.144 30.92-23.697 54.762-52.884 54.762zm0-27.019c14.594 0 26.153-11.848 26.153-27.02 0-15.026-11.56-27.02-26.153-27.02-14.593 0-26.152 11.85-26.152 27.02.144 15.172 11.559 27.02 26.152 27.02zm1407.91-151.425c-13.004 0-24.563-11.126-24.563-25.43 0-14.305 10.692-25.43 24.563-25.43 13.004 0 24.563 11.125 24.563 25.43 0 14.304-10.692 25.43-24.563 25.43zm0-11.848c6.936 0 12.282-5.491 12.282-12.716s-5.346-12.715-12.282-12.715-12.282 5.49-12.282 12.715c0 7.08 6.213 12.716 12.282 12.716zM393.591 94.93c10.692-11.126 28.32-11.126 39.156 0L531 195.64c10.693 11.125 10.693 29.33 0 40.457-10.692 11.125-28.32 11.125-39.156 0l-98.253-100.71c-10.693-11.126-10.693-29.331 0-40.457zm341.43-50.716c15.315 0 27.597 12.715 27.597 28.609v142.756c0 15.894-12.282 28.609-27.598 28.609-15.316 0-27.597-12.715-27.597-28.61V72.824c-.867-15.172 12.281-28.61 27.597-28.61-.722 0 0 0 0 0zm342.151 43.636c10.693 11.126 10.693 29.331 0 40.457l-97.386 100.71c-10.692 11.125-28.32 11.125-39.157 0-10.692-11.126-10.692-29.332 0-40.458l97.387-100.71c10.836-11.125 28.464-11.125 39.156 0z"
14
+ fill="currentColor"
15
+ />
16
+ </svg>
17
+ );
18
+ export default SvgEmpty;
@@ -0,0 +1,16 @@
1
+ import type { SVGProps } from "react";
2
+
3
+ const SvgSpin = (props: SVGProps<SVGSVGElement>) => (
4
+ <svg
5
+ className="spin_svg__svg_f013ea9dcb__svg_a0d71e7da7__icon"
6
+ fill="currentColor"
7
+ height="1em"
8
+ viewBox="0 0 1024 1024"
9
+ width="1em"
10
+ xmlns="http://www.w3.org/2000/svg"
11
+ {...props}
12
+ >
13
+ <path d="M512 1024c-136.768 0-265.344-53.248-362.048-149.952S0 648.768 0 512c0-96.832 27.2-191.104 78.592-272.704a513.28 513.28 0 0 1 204.352-185.28l43.008 85.824a417.92 417.92 0 0 0-166.144 150.656A414.72 414.72 0 0 0 96 512c0 229.376 186.624 416 416 416s416-186.624 416-416c0-78.72-22.08-155.264-63.808-221.504A416.96 416.96 0 0 0 698.048 139.84l43.008-85.824a513.28 513.28 0 0 1 204.352 185.28A510.784 510.784 0 0 1 1024 512c0 136.768-53.248 265.344-149.952 362.048S648.768 1024 512 1024z" />
14
+ </svg>
15
+ );
16
+ export default SvgSpin;
@@ -0,0 +1,2 @@
1
+ export { default as Empty } from "./Empty";
2
+ export { default as Spin } from "./Spin";
@@ -0,0 +1,111 @@
1
+ import type * as React from "react";
2
+ import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog";
3
+
4
+ import { buttonVariants } from "@meta-1/design/components/ui/button";
5
+ import { cn } from "@meta-1/design/lib/utils";
6
+
7
+ function AlertDialog({ ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Root>) {
8
+ return <AlertDialogPrimitive.Root data-slot="alert-dialog" {...props} />;
9
+ }
10
+
11
+ function AlertDialogTrigger({ ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Trigger>) {
12
+ return <AlertDialogPrimitive.Trigger data-slot="alert-dialog-trigger" {...props} />;
13
+ }
14
+
15
+ function AlertDialogPortal({ ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Portal>) {
16
+ return <AlertDialogPrimitive.Portal data-slot="alert-dialog-portal" {...props} />;
17
+ }
18
+
19
+ function AlertDialogOverlay({ className, ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Overlay>) {
20
+ return (
21
+ <AlertDialogPrimitive.Overlay
22
+ className={cn(
23
+ "data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=open]:animate-in",
24
+ className,
25
+ )}
26
+ data-slot="alert-dialog-overlay"
27
+ {...props}
28
+ />
29
+ );
30
+ }
31
+
32
+ function AlertDialogContent({ className, ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Content>) {
33
+ return (
34
+ <AlertDialogPortal>
35
+ <AlertDialogOverlay />
36
+ <AlertDialogPrimitive.Content
37
+ className={cn(
38
+ "data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-background p-6 shadow-lg duration-200 data-[state=closed]:animate-out data-[state=open]:animate-in sm:max-w-lg",
39
+ className,
40
+ )}
41
+ data-slot="alert-dialog-content"
42
+ {...props}
43
+ />
44
+ </AlertDialogPortal>
45
+ );
46
+ }
47
+
48
+ function AlertDialogHeader({ className, ...props }: React.ComponentProps<"div">) {
49
+ return (
50
+ <div
51
+ className={cn("flex flex-col gap-2 text-center sm:text-left", className)}
52
+ data-slot="alert-dialog-header"
53
+ {...props}
54
+ />
55
+ );
56
+ }
57
+
58
+ function AlertDialogFooter({ className, ...props }: React.ComponentProps<"div">) {
59
+ return (
60
+ <div
61
+ className={cn("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end", className)}
62
+ data-slot="alert-dialog-footer"
63
+ {...props}
64
+ />
65
+ );
66
+ }
67
+
68
+ function AlertDialogTitle({ className, ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Title>) {
69
+ return (
70
+ <AlertDialogPrimitive.Title
71
+ className={cn("font-semibold text-lg", className)}
72
+ data-slot="alert-dialog-title"
73
+ {...props}
74
+ />
75
+ );
76
+ }
77
+
78
+ function AlertDialogDescription({
79
+ className,
80
+ ...props
81
+ }: React.ComponentProps<typeof AlertDialogPrimitive.Description>) {
82
+ return (
83
+ <AlertDialogPrimitive.Description
84
+ className={cn("text-muted-foreground text-sm", className)}
85
+ data-slot="alert-dialog-description"
86
+ {...props}
87
+ />
88
+ );
89
+ }
90
+
91
+ function AlertDialogAction({ className, ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Action>) {
92
+ return <AlertDialogPrimitive.Action className={cn(buttonVariants(), className)} {...props} />;
93
+ }
94
+
95
+ function AlertDialogCancel({ className, ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Cancel>) {
96
+ return <AlertDialogPrimitive.Cancel className={cn(buttonVariants({ variant: "outline" }), className)} {...props} />;
97
+ }
98
+
99
+ export {
100
+ AlertDialog,
101
+ AlertDialogPortal,
102
+ AlertDialogOverlay,
103
+ AlertDialogTrigger,
104
+ AlertDialogContent,
105
+ AlertDialogHeader,
106
+ AlertDialogFooter,
107
+ AlertDialogTitle,
108
+ AlertDialogDescription,
109
+ AlertDialogAction,
110
+ AlertDialogCancel,
111
+ };
@@ -0,0 +1,49 @@
1
+ import type * as React from "react";
2
+ import { cva, type VariantProps } from "class-variance-authority";
3
+
4
+ import { cn } from "@meta-1/design/lib/utils";
5
+
6
+ const alertVariants = cva(
7
+ "relative grid w-full grid-cols-[0_1fr] items-start gap-y-0.5 rounded-lg border px-4 py-3 text-sm has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] has-[>svg]:gap-x-3 [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",
8
+ {
9
+ variants: {
10
+ variant: {
11
+ default: "bg-card text-card-foreground",
12
+ destructive:
13
+ "bg-card text-destructive *:data-[slot=alert-description]:text-destructive/90 [&>svg]:text-current",
14
+ },
15
+ },
16
+ defaultVariants: {
17
+ variant: "default",
18
+ },
19
+ },
20
+ );
21
+
22
+ function Alert({ className, variant, ...props }: React.ComponentProps<"div"> & VariantProps<typeof alertVariants>) {
23
+ return <div className={cn(alertVariants({ variant }), className)} data-slot="alert" role="alert" {...props} />;
24
+ }
25
+
26
+ function AlertTitle({ className, ...props }: React.ComponentProps<"div">) {
27
+ return (
28
+ <div
29
+ className={cn("col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight", className)}
30
+ data-slot="alert-title"
31
+ {...props}
32
+ />
33
+ );
34
+ }
35
+
36
+ function AlertDescription({ className, ...props }: React.ComponentProps<"div">) {
37
+ return (
38
+ <div
39
+ className={cn(
40
+ "col-start-2 grid justify-items-start gap-1 text-muted-foreground text-sm [&_p]:leading-relaxed",
41
+ className,
42
+ )}
43
+ data-slot="alert-description"
44
+ {...props}
45
+ />
46
+ );
47
+ }
48
+
49
+ export { Alert, AlertTitle, AlertDescription };
@@ -0,0 +1,32 @@
1
+ import type * as React from "react";
2
+ import * as AvatarPrimitive from "@radix-ui/react-avatar";
3
+
4
+ import { cn } from "@meta-1/design/lib/utils";
5
+
6
+ function Avatar({ className, ...props }: React.ComponentProps<typeof AvatarPrimitive.Root>) {
7
+ return (
8
+ <AvatarPrimitive.Root
9
+ className={cn("relative flex size-8 shrink-0 overflow-hidden rounded-full", className)}
10
+ data-slot="avatar"
11
+ {...props}
12
+ />
13
+ );
14
+ }
15
+
16
+ function AvatarImage({ className, ...props }: React.ComponentProps<typeof AvatarPrimitive.Image>) {
17
+ return (
18
+ <AvatarPrimitive.Image className={cn("aspect-square size-full", className)} data-slot="avatar-image" {...props} />
19
+ );
20
+ }
21
+
22
+ function AvatarFallback({ className, ...props }: React.ComponentProps<typeof AvatarPrimitive.Fallback>) {
23
+ return (
24
+ <AvatarPrimitive.Fallback
25
+ className={cn("flex size-full items-center justify-center rounded-full bg-muted", className)}
26
+ data-slot="avatar-fallback"
27
+ {...props}
28
+ />
29
+ );
30
+ }
31
+
32
+ export { Avatar, AvatarImage, AvatarFallback };
@@ -0,0 +1,36 @@
1
+ import type * as React from "react";
2
+ import { Slot } from "@radix-ui/react-slot";
3
+ import { cva, type VariantProps } from "class-variance-authority";
4
+
5
+ import { cn } from "@meta-1/design/lib/utils";
6
+
7
+ const badgeVariants = cva(
8
+ "inline-flex w-fit shrink-0 items-center justify-center gap-1 overflow-hidden whitespace-nowrap rounded-md border px-2 py-0.5 font-medium text-xs transition-[color,box-shadow] focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3",
9
+ {
10
+ variants: {
11
+ variant: {
12
+ default: "border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",
13
+ secondary: "border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",
14
+ destructive:
15
+ "border-transparent bg-destructive text-white focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40 [a&]:hover:bg-destructive/90",
16
+ outline: "text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground",
17
+ },
18
+ },
19
+ defaultVariants: {
20
+ variant: "default",
21
+ },
22
+ },
23
+ );
24
+
25
+ function Badge({
26
+ className,
27
+ variant,
28
+ asChild = false,
29
+ ...props
30
+ }: React.ComponentProps<"span"> & VariantProps<typeof badgeVariants> & { asChild?: boolean }) {
31
+ const Comp = asChild ? Slot : "span";
32
+
33
+ return <Comp className={cn(badgeVariants({ variant }), className)} data-slot="badge" {...props} />;
34
+ }
35
+
36
+ export { Badge, badgeVariants };
@@ -0,0 +1,92 @@
1
+ import type * as React from "react";
2
+ import { Slot } from "@radix-ui/react-slot";
3
+ import { ChevronRight, MoreHorizontal } from "lucide-react";
4
+
5
+ import { cn } from "@meta-1/design/lib/utils";
6
+
7
+ function Breadcrumb({ ...props }: React.ComponentProps<"nav">) {
8
+ return <nav aria-label="breadcrumb" data-slot="breadcrumb" {...props} />;
9
+ }
10
+
11
+ function BreadcrumbList({ className, ...props }: React.ComponentProps<"ol">) {
12
+ return (
13
+ <ol
14
+ className={cn(
15
+ "flex flex-wrap items-center gap-1.5 break-words text-muted-foreground text-sm sm:gap-2.5",
16
+ className,
17
+ )}
18
+ data-slot="breadcrumb-list"
19
+ {...props}
20
+ />
21
+ );
22
+ }
23
+
24
+ function BreadcrumbItem({ className, ...props }: React.ComponentProps<"li">) {
25
+ return <li className={cn("inline-flex items-center gap-1.5", className)} data-slot="breadcrumb-item" {...props} />;
26
+ }
27
+
28
+ function BreadcrumbLink({
29
+ asChild,
30
+ className,
31
+ ...props
32
+ }: React.ComponentProps<"a"> & {
33
+ asChild?: boolean;
34
+ }) {
35
+ const Comp = asChild ? Slot : "a";
36
+
37
+ return (
38
+ <Comp className={cn("transition-colors hover:text-foreground", className)} data-slot="breadcrumb-link" {...props} />
39
+ );
40
+ }
41
+
42
+ function BreadcrumbPage({ className, ...props }: React.ComponentProps<"span">) {
43
+ return (
44
+ <span
45
+ aria-current="page"
46
+ aria-disabled="true"
47
+ className={cn("font-normal text-foreground", className)}
48
+ data-slot="breadcrumb-page"
49
+ role="link"
50
+ {...props}
51
+ />
52
+ );
53
+ }
54
+
55
+ function BreadcrumbSeparator({ children, className, ...props }: React.ComponentProps<"li">) {
56
+ return (
57
+ <li
58
+ aria-hidden="true"
59
+ className={cn("[&>svg]:size-3.5", className)}
60
+ data-slot="breadcrumb-separator"
61
+ role="presentation"
62
+ {...props}
63
+ >
64
+ {children ?? <ChevronRight />}
65
+ </li>
66
+ );
67
+ }
68
+
69
+ function BreadcrumbEllipsis({ className, ...props }: React.ComponentProps<"span">) {
70
+ return (
71
+ <span
72
+ aria-hidden="true"
73
+ className={cn("flex size-9 items-center justify-center", className)}
74
+ data-slot="breadcrumb-ellipsis"
75
+ role="presentation"
76
+ {...props}
77
+ >
78
+ <MoreHorizontal className="size-4" />
79
+ <span className="sr-only">More</span>
80
+ </span>
81
+ );
82
+ }
83
+
84
+ export {
85
+ Breadcrumb,
86
+ BreadcrumbList,
87
+ BreadcrumbItem,
88
+ BreadcrumbLink,
89
+ BreadcrumbPage,
90
+ BreadcrumbSeparator,
91
+ BreadcrumbEllipsis,
92
+ };
@@ -0,0 +1,52 @@
1
+ import type * as React from "react";
2
+ import { Slot } from "@radix-ui/react-slot";
3
+ import { cva, type VariantProps } from "class-variance-authority";
4
+
5
+ import { cn } from "@meta-1/design/lib/utils";
6
+
7
+ const buttonVariants = cva(
8
+ "inline-flex shrink-0 items-center justify-center gap-2 whitespace-nowrap rounded-md font-medium text-sm outline-none transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",
9
+ {
10
+ variants: {
11
+ variant: {
12
+ default: "bg-primary text-primary-foreground hover:bg-primary/90",
13
+ destructive:
14
+ "bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40",
15
+ outline:
16
+ "border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",
17
+ secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
18
+ ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
19
+ link: "text-primary underline-offset-4 hover:underline",
20
+ },
21
+ size: {
22
+ default: "h-9 px-4 py-2 has-[>svg]:px-3",
23
+ sm: "h-8 gap-1.5 rounded-md px-3 has-[>svg]:px-2.5",
24
+ lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
25
+ icon: "size-9",
26
+ "icon-sm": "size-8",
27
+ "icon-lg": "size-10",
28
+ },
29
+ },
30
+ defaultVariants: {
31
+ variant: "default",
32
+ size: "default",
33
+ },
34
+ },
35
+ );
36
+
37
+ function Button({
38
+ className,
39
+ variant,
40
+ size,
41
+ asChild = false,
42
+ ...props
43
+ }: React.ComponentProps<"button"> &
44
+ VariantProps<typeof buttonVariants> & {
45
+ asChild?: boolean;
46
+ }) {
47
+ const Comp = asChild ? Slot : "button";
48
+
49
+ return <Comp className={cn(buttonVariants({ variant, size, className }))} data-slot="button" {...props} />;
50
+ }
51
+
52
+ export { Button, buttonVariants };