opacacms 0.1.0 → 0.1.2

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 (247) hide show
  1. package/dist/admin/index.js +49 -0
  2. package/dist/{chunk-2zm8cy1w.js → admin/webcomponent.js} +116 -168
  3. package/dist/{chunk-6dhs73zq.js → chunk-2yz1nsxs.js} +1 -1
  4. package/dist/chunk-fa5mg0hr.js +96 -0
  5. package/dist/{chunk-kwp83w8b.js → chunk-m09hahe2.js} +7 -7
  6. package/dist/{chunk-hmhcense.js → chunk-ry15hke8.js} +253 -4
  7. package/dist/chunk-vtvqfhgy.js +2442 -0
  8. package/dist/{chunk-f3nvxn63.js → chunk-y8hc6nm4.js} +1 -1
  9. package/dist/{src/cli → cli}/index.js +10 -10
  10. package/dist/{src/client.js → client.js} +2 -2
  11. package/dist/{src/db → db}/bun-sqlite.js +10 -10
  12. package/dist/{src/db → db}/d1.js +8 -8
  13. package/dist/db/index.d.ts +2 -0
  14. package/dist/db/index.js +7 -0
  15. package/dist/db/migration.d.ts +39 -0
  16. package/dist/{src/db → db}/postgres.js +10 -10
  17. package/dist/{src/db → db}/sqlite.js +8 -8
  18. package/dist/index.d.ts +0 -2
  19. package/dist/index.js +13 -0
  20. package/dist/{src/runtimes → runtimes}/bun.js +5 -6
  21. package/dist/{src/runtimes → runtimes}/cloudflare-workers.js +5 -6
  22. package/dist/{src/runtimes → runtimes}/next.js +5 -6
  23. package/dist/{src/runtimes → runtimes}/node.js +5 -6
  24. package/dist/{src/server.js → server.js} +7 -8
  25. package/dist/storage/index.d.ts +0 -3
  26. package/dist/storage/index.js +35 -0
  27. package/dist/types.d.ts +5 -2
  28. package/package.json +161 -39
  29. package/bun.lock +0 -34
  30. package/dist/api.d.ts +0 -6
  31. package/dist/chunk-8gkhn1d4.js +0 -309
  32. package/dist/chunk-dy5t83hr.js +0 -261
  33. package/dist/src/admin/index.js +0 -176
  34. package/dist/src/admin/webcomponent.js +0 -19
  35. package/dist/src/api.js +0 -27
  36. package/dist/src/index.js +0 -20
  37. package/dist/src/storage/index.js +0 -355
  38. package/global.d.ts +0 -11
  39. package/src/admin/api-client.ts +0 -63
  40. package/src/admin/auth-client.ts +0 -40
  41. package/src/admin/custom-field.ts +0 -179
  42. package/src/admin/index.ts +0 -15
  43. package/src/admin/react.tsx +0 -72
  44. package/src/admin/router.ts +0 -9
  45. package/src/admin/stores/admin-queries.ts +0 -121
  46. package/src/admin/stores/auth.ts +0 -61
  47. package/src/admin/stores/column-visibility.ts +0 -67
  48. package/src/admin/stores/config.ts +0 -15
  49. package/src/admin/stores/media.ts +0 -95
  50. package/src/admin/stores/query.ts +0 -13
  51. package/src/admin/stores/ui.ts +0 -29
  52. package/src/admin/ui/admin-client.tsx +0 -283
  53. package/src/admin/ui/admin-layout.tsx +0 -276
  54. package/src/admin/ui/components/ColumnVisibilityToggle.tsx +0 -141
  55. package/src/admin/ui/components/DataDetailSheet.tsx +0 -141
  56. package/src/admin/ui/components/DataDetailView.tsx +0 -175
  57. package/src/admin/ui/components/Table.tsx +0 -67
  58. package/src/admin/ui/components/fields/ArrayField.tsx +0 -166
  59. package/src/admin/ui/components/fields/BlocksField.tsx +0 -202
  60. package/src/admin/ui/components/fields/BooleanField.tsx +0 -50
  61. package/src/admin/ui/components/fields/CollapsibleField.tsx +0 -75
  62. package/src/admin/ui/components/fields/DateField.tsx +0 -45
  63. package/src/admin/ui/components/fields/FileField.tsx +0 -322
  64. package/src/admin/ui/components/fields/GroupField.tsx +0 -50
  65. package/src/admin/ui/components/fields/JoinField.tsx +0 -23
  66. package/src/admin/ui/components/fields/NumberField.tsx +0 -46
  67. package/src/admin/ui/components/fields/RadioField.tsx +0 -62
  68. package/src/admin/ui/components/fields/RelationshipField.tsx +0 -278
  69. package/src/admin/ui/components/fields/RowField.tsx +0 -40
  70. package/src/admin/ui/components/fields/SelectField.tsx +0 -59
  71. package/src/admin/ui/components/fields/TabsField.tsx +0 -101
  72. package/src/admin/ui/components/fields/TextAreaField.tsx +0 -54
  73. package/src/admin/ui/components/fields/TextField.tsx +0 -49
  74. package/src/admin/ui/components/fields/VirtualField.tsx +0 -53
  75. package/src/admin/ui/components/fields/index.tsx +0 -371
  76. package/src/admin/ui/components/fields/richtext-editor/index.tsx +0 -211
  77. package/src/admin/ui/components/fields/richtext-editor/nodes/ImageComponent.tsx +0 -142
  78. package/src/admin/ui/components/fields/richtext-editor/nodes/ImageNode.tsx +0 -95
  79. package/src/admin/ui/components/fields/richtext-editor/plugins/ComponentPickerPlugin.tsx +0 -226
  80. package/src/admin/ui/components/fields/richtext-editor/plugins/EditableSyncPlugin.tsx +0 -16
  81. package/src/admin/ui/components/fields/richtext-editor/plugins/NotionToolbarPlugin.tsx +0 -184
  82. package/src/admin/ui/components/fields/richtext-editor/plugins/SimpleToolbarPlugin.tsx +0 -240
  83. package/src/admin/ui/components/fields/richtext-editor/plugins/ValueSyncPlugin.tsx +0 -40
  84. package/src/admin/ui/components/fields/utils.ts +0 -1
  85. package/src/admin/ui/components/link.tsx +0 -41
  86. package/src/admin/ui/components/media/AssetManagerModal.tsx +0 -334
  87. package/src/admin/ui/components/toast.tsx +0 -72
  88. package/src/admin/ui/components/ui/accordion.tsx +0 -51
  89. package/src/admin/ui/components/ui/alert-dialog.tsx +0 -98
  90. package/src/admin/ui/components/ui/blocks.tsx +0 -32
  91. package/src/admin/ui/components/ui/breadcrumbs.tsx +0 -59
  92. package/src/admin/ui/components/ui/button.tsx +0 -26
  93. package/src/admin/ui/components/ui/collapsible.tsx +0 -124
  94. package/src/admin/ui/components/ui/dialog.tsx +0 -79
  95. package/src/admin/ui/components/ui/group.tsx +0 -20
  96. package/src/admin/ui/components/ui/index.ts +0 -17
  97. package/src/admin/ui/components/ui/input.tsx +0 -12
  98. package/src/admin/ui/components/ui/join.tsx +0 -53
  99. package/src/admin/ui/components/ui/label.tsx +0 -11
  100. package/src/admin/ui/components/ui/radio-group.tsx +0 -75
  101. package/src/admin/ui/components/ui/relationship-detail-sheet.tsx +0 -122
  102. package/src/admin/ui/components/ui/relationship.tsx +0 -58
  103. package/src/admin/ui/components/ui/scroll-area.tsx +0 -19
  104. package/src/admin/ui/components/ui/select.tsx +0 -187
  105. package/src/admin/ui/components/ui/separator.tsx +0 -21
  106. package/src/admin/ui/components/ui/sheet.tsx +0 -106
  107. package/src/admin/ui/components/ui/tabs.tsx +0 -116
  108. package/src/admin/ui/components/ui/utils.ts +0 -3
  109. package/src/admin/ui/hooks/use-debounce.ts +0 -15
  110. package/src/admin/ui/styles/_locale-switcher.scss +0 -33
  111. package/src/admin/ui/styles/accordion.scss +0 -60
  112. package/src/admin/ui/styles/animations.scss +0 -41
  113. package/src/admin/ui/styles/asset-manager.scss +0 -547
  114. package/src/admin/ui/styles/badge.scss +0 -13
  115. package/src/admin/ui/styles/base.scss +0 -22
  116. package/src/admin/ui/styles/button.scss +0 -161
  117. package/src/admin/ui/styles/card.scss +0 -13
  118. package/src/admin/ui/styles/collapsible.scss +0 -75
  119. package/src/admin/ui/styles/data-detail.scss +0 -92
  120. package/src/admin/ui/styles/dialog.scss +0 -102
  121. package/src/admin/ui/styles/empty-state.scss +0 -22
  122. package/src/admin/ui/styles/group.scss +0 -19
  123. package/src/admin/ui/styles/index.scss +0 -33
  124. package/src/admin/ui/styles/input.scss +0 -80
  125. package/src/admin/ui/styles/label.scss +0 -12
  126. package/src/admin/ui/styles/layout.scss +0 -56
  127. package/src/admin/ui/styles/lexical.scss +0 -469
  128. package/src/admin/ui/styles/loading.scss +0 -102
  129. package/src/admin/ui/styles/media-registry.scss +0 -597
  130. package/src/admin/ui/styles/pagination.scss +0 -20
  131. package/src/admin/ui/styles/radio-group.scss +0 -66
  132. package/src/admin/ui/styles/row.scss +0 -17
  133. package/src/admin/ui/styles/scrollbar.scss +0 -36
  134. package/src/admin/ui/styles/select.scss +0 -121
  135. package/src/admin/ui/styles/separator.scss +0 -14
  136. package/src/admin/ui/styles/sheet.scss +0 -152
  137. package/src/admin/ui/styles/sidebar.scss +0 -148
  138. package/src/admin/ui/styles/switch.scss +0 -59
  139. package/src/admin/ui/styles/table.scss +0 -207
  140. package/src/admin/ui/styles/tabs.scss +0 -62
  141. package/src/admin/ui/styles/toast.scss +0 -45
  142. package/src/admin/ui/styles/variables.scss +0 -24
  143. package/src/admin/ui/views/collection-list-view.tsx +0 -720
  144. package/src/admin/ui/views/dashboard-view.tsx +0 -263
  145. package/src/admin/ui/views/document-edit-view.tsx +0 -384
  146. package/src/admin/ui/views/global-edit-view.tsx +0 -226
  147. package/src/admin/ui/views/init-view.tsx +0 -182
  148. package/src/admin/ui/views/login-view.tsx +0 -123
  149. package/src/admin/ui/views/media-registry-view.tsx +0 -1104
  150. package/src/admin/ui/views/settings-view.tsx +0 -729
  151. package/src/admin/webcomponent.tsx +0 -15
  152. package/src/api.ts +0 -9
  153. package/src/auth/index.ts +0 -194
  154. package/src/auth/migrations.ts +0 -87
  155. package/src/auth/premissions.ts +0 -46
  156. package/src/cli/commands/generate-types.ts +0 -116
  157. package/src/cli/commands/init.ts +0 -95
  158. package/src/cli/commands/migrate-commands.ts +0 -160
  159. package/src/cli/commands/seed-command.ts +0 -11
  160. package/src/cli/d1-mock.ts +0 -101
  161. package/src/cli/index.test.ts +0 -84
  162. package/src/cli/index.ts +0 -183
  163. package/src/cli/r2-mock.ts +0 -217
  164. package/src/cli/seeding.ts +0 -405
  165. package/src/client.ts +0 -181
  166. package/src/config-utils.ts +0 -102
  167. package/src/config.ts +0 -49
  168. package/src/db/adapter.ts +0 -53
  169. package/src/db/better-sqlite.ts +0 -630
  170. package/src/db/bun-sqlite.ts +0 -646
  171. package/src/db/d1.ts +0 -711
  172. package/src/db/kysely/data-mapper.ts +0 -142
  173. package/src/db/kysely/field-mapper.ts +0 -148
  174. package/src/db/kysely/migration-generator.ts +0 -223
  175. package/src/db/kysely/query-builder.ts +0 -92
  176. package/src/db/kysely/schema-builder.ts +0 -439
  177. package/src/db/kysely/sql-utils.ts +0 -13
  178. package/src/db/postgres.ts +0 -621
  179. package/src/db/sqlite.ts +0 -658
  180. package/src/db/system-schema.ts +0 -121
  181. package/src/index.ts +0 -13
  182. package/src/runtimes/README.md +0 -59
  183. package/src/runtimes/bun.ts +0 -49
  184. package/src/runtimes/cloudflare-workers.ts +0 -38
  185. package/src/runtimes/next.ts +0 -26
  186. package/src/runtimes/node.ts +0 -52
  187. package/src/schema/collection.ts +0 -184
  188. package/src/schema/fields/base.ts +0 -164
  189. package/src/schema/fields/index.ts +0 -427
  190. package/src/schema/global.ts +0 -145
  191. package/src/schema/index.ts +0 -4
  192. package/src/schema/infer.ts +0 -72
  193. package/src/server/admin-router.ts +0 -20
  194. package/src/server/admin.ts +0 -142
  195. package/src/server/assets.ts +0 -306
  196. package/src/server/collection-router.ts +0 -55
  197. package/src/server/handlers.ts +0 -722
  198. package/src/server/middlewares/admin.ts +0 -27
  199. package/src/server/middlewares/auth.ts +0 -89
  200. package/src/server/middlewares/context.ts +0 -17
  201. package/src/server/middlewares/cors.ts +0 -24
  202. package/src/server/middlewares/database-init.ts +0 -74
  203. package/src/server/middlewares/rate-limit.ts +0 -71
  204. package/src/server/router.ts +0 -47
  205. package/src/server/setup-middlewares.ts +0 -58
  206. package/src/server/system-router.ts +0 -35
  207. package/src/server.ts +0 -9
  208. package/src/storage/adapters/cloudflare-r2.ts +0 -136
  209. package/src/storage/adapters/local.ts +0 -146
  210. package/src/storage/adapters/s3.ts +0 -186
  211. package/src/storage/errors.ts +0 -46
  212. package/src/storage/index.ts +0 -5
  213. package/src/storage/types.ts +0 -39
  214. package/src/types.ts +0 -577
  215. package/src/utils/lexical.ts +0 -37
  216. package/src/utils/logger.ts +0 -73
  217. package/src/validation.ts +0 -429
  218. package/src/validator.ts +0 -179
  219. package/test/admin-custom-field.test.ts +0 -162
  220. package/test/admin-react-field.test.tsx +0 -134
  221. package/test/api-features.test.ts +0 -78
  222. package/test/api.test.ts +0 -178
  223. package/test/auth.test.ts +0 -62
  224. package/test/cli-integration.test.ts +0 -146
  225. package/test/cli.test.ts +0 -25
  226. package/test/db/postgres.test.ts +0 -95
  227. package/test/db/sqlite-filter.test.ts +0 -53
  228. package/test/db/sqlite.test.ts +0 -82
  229. package/test/engine-features.test.ts +0 -79
  230. package/test/globals.test.ts +0 -74
  231. package/test/integration-tmp/db-app/opacacms.config.ts +0 -15
  232. package/test/integration-tmp/my-sqlite-app/opacacms.config.ts +0 -25
  233. package/test/integration-tmp/my-test-app/index.ts +0 -8
  234. package/test/integration-tmp/my-test-app/opacacms.config.ts +0 -16
  235. package/test/integration-tmp/my-test-app/package.json +0 -12
  236. package/test/populate.test.ts +0 -79
  237. package/test/runtimes.test.ts +0 -43
  238. package/test/schema-builder.test.ts +0 -107
  239. package/test/schema-features.test.ts +0 -63
  240. package/test/seeding.test.ts +0 -68
  241. package/test/storage/local.test.ts +0 -72
  242. package/test/storage/s3.test.ts +0 -60
  243. package/test/structural-data.test.ts +0 -100
  244. package/test/test-setup.ts +0 -11
  245. package/test/validation.test.ts +0 -162
  246. package/tsconfig.json +0 -42
  247. /package/dist/{src/admin/index.css → admin/webcomponent.css} +0 -0
@@ -1,187 +0,0 @@
1
- import { ChevronDown } from "lucide-react";
2
- import * as React from "react";
3
- import { createPortal } from "react-dom";
4
- import { cn } from "./utils";
5
- import "../../styles/select.scss";
6
-
7
- export interface SelectProps {
8
- value?: string;
9
- onValueChange?: (value: string) => void;
10
- children: React.ReactNode;
11
- placeholder?: string;
12
- disabled?: boolean;
13
- className?: string;
14
- }
15
-
16
- const SelectContext = React.createContext<{
17
- value?: string;
18
- onValueChange?: (value: string) => void;
19
- open: boolean;
20
- setOpen: (open: boolean) => void;
21
- triggerRef: React.RefObject<HTMLButtonElement | null>;
22
- } | null>(null);
23
-
24
- export function Select({
25
- value,
26
- onValueChange,
27
- children,
28
- open: controlledOpen,
29
- onOpenChange,
30
- }: SelectProps & { open?: boolean; onOpenChange?: (open: boolean) => void }) {
31
- const [internalOpen, setInternalOpen] = React.useState(false);
32
- const open = controlledOpen ?? internalOpen;
33
- const setOpen = onOpenChange ?? setInternalOpen;
34
- const triggerRef = React.useRef<HTMLButtonElement>(null);
35
-
36
- return (
37
- <SelectContext.Provider value={{ value, onValueChange, open, setOpen, triggerRef }}>
38
- <div className="opaca-ui-select">{children}</div>
39
- </SelectContext.Provider>
40
- );
41
- }
42
-
43
- export function SelectTrigger({
44
- children,
45
- className,
46
- }: {
47
- children?: React.ReactNode;
48
- className?: string;
49
- }) {
50
- const context = React.useContext(SelectContext);
51
- if (!context) throw new Error("SelectTrigger must be used within a Select");
52
-
53
- return (
54
- <button
55
- ref={context.triggerRef}
56
- type="button"
57
- className={cn("opaca-ui-select-trigger", className)}
58
- onClick={() => context.setOpen(!context.open)}
59
- data-state={context.open ? "open" : "closed"}
60
- >
61
- <span className="trigger-content">{children}</span>
62
- <ChevronDown size={14} className="trigger-icon" />
63
- </button>
64
- );
65
- }
66
-
67
- export function SelectValue({ placeholder }: { placeholder?: string }) {
68
- const context = React.useContext(SelectContext);
69
- if (!context) throw new Error("SelectValue must be used within a Select");
70
-
71
- return (
72
- <span className={!context.value ? "trigger-placeholder" : ""}>
73
- {context.value || placeholder}
74
- </span>
75
- );
76
- }
77
-
78
- export function SelectContent({
79
- children,
80
- className,
81
- }: {
82
- children: React.ReactNode;
83
- className?: string;
84
- }) {
85
- const context = React.useContext(SelectContext);
86
- if (!context) throw new Error("SelectContent must be used within a Select");
87
-
88
- const [position, setPosition] = React.useState({ top: 0, left: 0, width: 0 });
89
-
90
- const updatePosition = React.useCallback(() => {
91
- if (context.open && context.triggerRef.current) {
92
- const rect = context.triggerRef.current.getBoundingClientRect();
93
- setPosition({
94
- top: rect.bottom,
95
- left: rect.left,
96
- width: rect.width,
97
- });
98
- }
99
- }, [context.open, context.triggerRef]);
100
-
101
- React.useEffect(() => {
102
- if (context.open) {
103
- updatePosition();
104
- window.addEventListener("scroll", updatePosition, true);
105
- window.addEventListener("resize", updatePosition);
106
- return () => {
107
- window.removeEventListener("scroll", updatePosition, true);
108
- window.removeEventListener("resize", updatePosition);
109
- };
110
- }
111
- }, [context.open, updatePosition]);
112
-
113
- if (!context.open) return null;
114
-
115
- return createPortal(
116
- <div
117
- className="opaca-ui-select-portal"
118
- style={{
119
- top: position.top + 4,
120
- left: position.left,
121
- width: position.width,
122
- }}
123
- >
124
- <button
125
- type="button"
126
- className="opaca-ui-select-content-overlay"
127
- style={{
128
- position: "fixed",
129
- inset: 0,
130
- zIndex: -1,
131
- background: "transparent",
132
- border: "none",
133
- padding: 0,
134
- width: "100%",
135
- height: "100%",
136
- cursor: "default",
137
- }}
138
- onClick={() => context.setOpen(false)}
139
- tabIndex={-1}
140
- aria-hidden="true"
141
- />
142
- <div className={cn("opaca-ui-select-content", className)}>{children}</div>
143
- </div>,
144
- document.body,
145
- );
146
- }
147
-
148
- export function SelectItem({
149
- value,
150
- children,
151
- className,
152
- }: {
153
- value: string;
154
- children: React.ReactNode;
155
- className?: string;
156
- }) {
157
- const context = React.useContext(SelectContext);
158
- if (!context) throw new Error("SelectItem must be used within a Select");
159
-
160
- const isSelected = context.value === value;
161
-
162
- return (
163
- <button
164
- type="button"
165
- className={cn("opaca-ui-select-item", className)}
166
- data-selected={isSelected}
167
- onClick={() => {
168
- context.onValueChange?.(value);
169
- context.setOpen(false);
170
- }}
171
- >
172
- {children}
173
- </button>
174
- );
175
- }
176
-
177
- export function SelectGroup({ children }: { children: React.ReactNode }) {
178
- return <div className="opaca-ui-select-group">{children}</div>;
179
- }
180
-
181
- export function SelectLabel({ children }: { children: React.ReactNode }) {
182
- return <div className="opaca-ui-select-label">{children}</div>;
183
- }
184
-
185
- export function SelectSeparator() {
186
- return <div className="opaca-ui-select-separator" />;
187
- }
@@ -1,21 +0,0 @@
1
- import type React from "react";
2
-
3
- interface SeparatorProps {
4
- className?: string;
5
- orientation?: "horizontal" | "vertical";
6
- margin?: string;
7
- }
8
-
9
- export const Separator: React.FC<SeparatorProps> = ({
10
- className = "",
11
- orientation = "horizontal",
12
- margin,
13
- }) => {
14
- return (
15
- <div
16
- className={`opaca-separator ${orientation} ${className}`}
17
- style={margin ? { margin } : undefined}
18
- role="none"
19
- />
20
- );
21
- };
@@ -1,106 +0,0 @@
1
- import type * as React from "react";
2
- import { createPortal } from "react-dom";
3
- import { cn } from "./utils";
4
- import "../../styles/sheet.scss";
5
-
6
- export function Sheet({
7
- open,
8
- onOpenChange,
9
- children,
10
- }: {
11
- open: boolean;
12
- onOpenChange: (open: boolean) => void;
13
- children: React.ReactNode;
14
- }) {
15
- if (!open) return null;
16
- return createPortal(
17
- <div className="opaca-ui-sheet-portal">
18
- <button
19
- type="button"
20
- className="opaca-ui-sheet-overlay"
21
- onClick={() => onOpenChange(false)}
22
- tabIndex={-1}
23
- aria-hidden="true"
24
- />
25
- <div className="opaca-ui-sheet-wrapper">{children}</div>
26
- </div>,
27
- document.body,
28
- );
29
- }
30
-
31
- export function SheetContent({
32
- children,
33
- className,
34
- onClose,
35
- }: {
36
- children: React.ReactNode;
37
- className?: string;
38
- onClose?: () => void;
39
- }) {
40
- return (
41
- <div className={cn("opaca-ui-sheet-content", className)}>
42
- {children}
43
- {onClose && (
44
- <button type="button" onClick={onClose} className="opaca-ui-sheet-close">
45
- <svg
46
- aria-hidden="true"
47
- xmlns="http://www.w3.org/2000/svg"
48
- width="24"
49
- height="24"
50
- viewBox="0 0 24 24"
51
- fill="none"
52
- stroke="currentColor"
53
- strokeWidth="2"
54
- strokeLinecap="round"
55
- strokeLinejoin="round"
56
- className="opaca-ui-sheet-close-icon"
57
- >
58
- <line x1="18" x2="6" y1="6" y2="18"></line>
59
- <line x1="6" x2="18" y1="6" y2="18"></line>
60
- </svg>
61
- <span className="opaca-ui-sr-only">Close</span>
62
- </button>
63
- )}
64
- </div>
65
- );
66
- }
67
-
68
- export function SheetHeader({
69
- children,
70
- className,
71
- }: {
72
- children: React.ReactNode;
73
- className?: string;
74
- }) {
75
- return <div className={cn("opaca-ui-sheet-header", className)}>{children}</div>;
76
- }
77
-
78
- export function SheetTitle({
79
- children,
80
- className,
81
- }: {
82
- children: React.ReactNode;
83
- className?: string;
84
- }) {
85
- return <h2 className={cn("opaca-ui-sheet-title", className)}>{children}</h2>;
86
- }
87
-
88
- export function SheetDescription({
89
- children,
90
- className,
91
- }: {
92
- children: React.ReactNode;
93
- className?: string;
94
- }) {
95
- return <p className={cn("opaca-ui-sheet-description", className)}>{children}</p>;
96
- }
97
-
98
- export function SheetFooter({
99
- children,
100
- className,
101
- }: {
102
- children: React.ReactNode;
103
- className?: string;
104
- }) {
105
- return <div className={cn("opaca-ui-sheet-footer", className)}>{children}</div>;
106
- }
@@ -1,116 +0,0 @@
1
- import * as React from "react";
2
- import { cn } from "./utils";
3
- import "../../styles/tabs.scss";
4
-
5
- interface TabsContextValue {
6
- value?: string;
7
- onValueChange?: (value: string) => void;
8
- }
9
-
10
- const TabsContext = React.createContext<TabsContextValue>({});
11
-
12
- export interface TabsProps extends React.HTMLAttributes<HTMLDivElement> {
13
- value?: string;
14
- defaultValue?: string;
15
- onValueChange?: (value: string) => void;
16
- }
17
-
18
- export const Tabs = React.forwardRef<HTMLDivElement, TabsProps>(
19
- ({ className, value, defaultValue, onValueChange, children, ...props }, ref) => {
20
- const [uncontrolledValue, setUncontrolledValue] = React.useState<string | undefined>(
21
- defaultValue,
22
- );
23
-
24
- const isControlled = value !== undefined;
25
- const currentValue = isControlled ? value : uncontrolledValue;
26
-
27
- const handleValueChange = React.useCallback(
28
- (newValue: string) => {
29
- if (!isControlled) {
30
- setUncontrolledValue(newValue);
31
- }
32
- if (onValueChange) {
33
- onValueChange(newValue);
34
- }
35
- },
36
- [isControlled, onValueChange],
37
- );
38
-
39
- const contextValue = React.useMemo(
40
- () => ({ value: currentValue, onValueChange: handleValueChange }),
41
- [currentValue, handleValueChange],
42
- );
43
-
44
- return (
45
- <TabsContext.Provider value={contextValue}>
46
- <div ref={ref} className={cn("opaca-ui-tabs", className)} {...props}>
47
- {children}
48
- </div>
49
- </TabsContext.Provider>
50
- );
51
- },
52
- );
53
- Tabs.displayName = "Tabs";
54
-
55
- export const TabsList = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
56
- ({ className, ...props }, ref) => (
57
- <div ref={ref} className={cn("opaca-ui-tabs-list", className)} role="tablist" {...props} />
58
- ),
59
- );
60
- TabsList.displayName = "TabsList";
61
-
62
- export interface TabsTriggerProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
63
- value: string;
64
- }
65
-
66
- export const TabsTrigger = React.forwardRef<HTMLButtonElement, TabsTriggerProps>(
67
- ({ className, value, disabled, ...props }, ref) => {
68
- const context = React.useContext(TabsContext);
69
- const isSelected = context.value === value;
70
-
71
- return (
72
- <button
73
- type="button"
74
- role="tab"
75
- aria-selected={isSelected}
76
- data-state={isSelected ? "active" : "inactive"}
77
- disabled={disabled}
78
- onClick={() => {
79
- if (!disabled && context.onValueChange) {
80
- context.onValueChange(value);
81
- }
82
- }}
83
- ref={ref}
84
- className={cn("opaca-ui-tabs-trigger", className)}
85
- {...props}
86
- />
87
- );
88
- },
89
- );
90
- TabsTrigger.displayName = "TabsTrigger";
91
-
92
- export interface TabsContentProps extends React.HTMLAttributes<HTMLDivElement> {
93
- value: string;
94
- }
95
-
96
- export const TabsContent = React.forwardRef<HTMLDivElement, TabsContentProps>(
97
- ({ className, value, ...props }, ref) => {
98
- const context = React.useContext(TabsContext);
99
- const isSelected = context.value === value;
100
-
101
- if (!isSelected) {
102
- return null;
103
- }
104
-
105
- return (
106
- <div
107
- role="tabpanel"
108
- data-state={isSelected ? "active" : "inactive"}
109
- ref={ref}
110
- className={cn("opaca-ui-tabs-content", className)}
111
- {...props}
112
- />
113
- );
114
- },
115
- );
116
- TabsContent.displayName = "TabsContent";
@@ -1,3 +0,0 @@
1
- export function cn(...classes: (string | undefined | null | false)[]) {
2
- return classes.filter(Boolean).join(" ");
3
- }
@@ -1,15 +0,0 @@
1
- import { useEffect, useState } from "react";
2
-
3
- export function useDebounce<T>(value: T, delay?: number): T {
4
- const [debouncedValue, setDebouncedValue] = useState<T>(value);
5
-
6
- useEffect(() => {
7
- const timer = setTimeout(() => setDebouncedValue(value), delay || 500);
8
-
9
- return () => {
10
- clearTimeout(timer);
11
- };
12
- }, [value, delay]);
13
-
14
- return debouncedValue;
15
- }
@@ -1,33 +0,0 @@
1
- .opaca-locale-switcher {
2
- display: flex;
3
- align-items: center;
4
- gap: 0.5rem;
5
- background: var(--opaca-card-bg);
6
- padding: 0.25rem;
7
- border-radius: var(--opaca-radius);
8
- border: 1px solid var(--opaca-border);
9
- box-shadow: var(--opaca-shadow-sm);
10
- }
11
-
12
- .opaca-locale-btn {
13
- background: none;
14
- border: none;
15
- padding: 0.375rem 0.75rem;
16
- border-radius: calc(var(--opaca-radius) - 2px);
17
- font-size: 0.75rem;
18
- font-weight: 600;
19
- color: var(--opaca-text-dim);
20
- cursor: pointer;
21
- transition: all var(--opaca-transition);
22
-
23
- &:hover {
24
- color: var(--opaca-text);
25
- background: rgba(255, 255, 255, 0.05);
26
- }
27
-
28
- &.active {
29
- background: var(--opaca-accent);
30
- color: white;
31
- box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
32
- }
33
- }
@@ -1,60 +0,0 @@
1
- .opaca-sidebar-accordion {
2
- margin-bottom: 0.25rem;
3
- border: none !important;
4
- background: transparent !important;
5
-
6
- .opaca-sidebar-accordion-trigger {
7
- background: transparent;
8
- padding: 1rem 0.75rem 0.5rem 0.75rem;
9
- font-size: 0.625rem;
10
- color: var(--opaca-text-dim);
11
- text-transform: uppercase;
12
- letter-spacing: 0.06em;
13
- font-weight: 500;
14
- width: 100%;
15
- display: flex;
16
- align-items: center;
17
- justify-content: space-between;
18
- cursor: pointer;
19
- transition: color var(--opaca-transition);
20
- border: none;
21
- outline: none;
22
-
23
- &:hover {
24
- color: var(--opaca-text);
25
- }
26
-
27
- .opaca-sidebar-accordion-icon {
28
- width: 12px;
29
- height: 12px;
30
- stroke: var(--opaca-text-dim);
31
- fill: none;
32
- stroke-width: 2;
33
- stroke-linecap: round;
34
- stroke-linejoin: round;
35
- transition: transform 0.2s cubic-bezier(0.87, 0, 0.13, 1);
36
- }
37
-
38
- &[aria-expanded="true"] {
39
- .opaca-sidebar-accordion-icon {
40
- transform: rotate(180deg);
41
- }
42
- }
43
- }
44
-
45
- .opaca-sidebar-accordion-content {
46
- display: grid;
47
- grid-template-rows: 0fr;
48
- transition: grid-template-rows 0.2s cubic-bezier(0.87, 0, 0.13, 1);
49
-
50
- &[data-state="open"] {
51
- grid-template-rows: 1fr;
52
- }
53
-
54
- .opaca-sidebar-accordion-content-inner {
55
- overflow: hidden;
56
- display: flex;
57
- flex-direction: column;
58
- }
59
- }
60
- }
@@ -1,41 +0,0 @@
1
- @keyframes opaca-fade-in {
2
- from {
3
- opacity: 0;
4
- transform: translateY(8px);
5
- }
6
- to {
7
- opacity: 1;
8
- transform: translateY(0);
9
- }
10
- }
11
-
12
- @keyframes opaca-spin {
13
- from { transform: rotate(0deg); }
14
- to { transform: rotate(360deg); }
15
- }
16
-
17
- @keyframes opaca-toast-in {
18
- from {
19
- opacity: 0;
20
- transform: translateX(100%);
21
- }
22
- to {
23
- opacity: 1;
24
- transform: translateX(0);
25
- }
26
- }
27
-
28
- @keyframes opaca-pulse {
29
- 0%, 100% {
30
- transform: scale(1);
31
- opacity: 0.2;
32
- }
33
- 50% {
34
- transform: scale(1.4);
35
- opacity: 0;
36
- }
37
- }
38
-
39
- .opaca-spin {
40
- animation: opaca-spin 1s linear infinite;
41
- }