@naeil/ui 0.4.0 → 0.6.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 (42) hide show
  1. package/CHANGELOG.md +19 -1
  2. package/DESIGN.md +24 -1
  3. package/README.md +25 -9
  4. package/THIRD_PARTY_NOTICES.md +4 -0
  5. package/dist/chunk-CE73AEJZ.js +667 -0
  6. package/dist/{chunk-QKVN6Q6C.js → chunk-QSTGUEEI.js} +60 -175
  7. package/dist/chunk-VL7FS4QM.js +1512 -0
  8. package/dist/components/index.d.ts +19 -5
  9. package/dist/components/index.js +135 -1618
  10. package/dist/components/naeil-header.d.ts +54 -0
  11. package/dist/components/naeil-header.js +14 -0
  12. package/dist/components/ui/index.d.ts +2 -0
  13. package/dist/components/ui/index.js +40 -179
  14. package/dist/navigation-CL10a6Eb.d.ts +48 -0
  15. package/dist/site-footer-B67meCDv.d.ts +21 -0
  16. package/dist/source/components/footer.d.ts +13 -4
  17. package/dist/source/components/footer.js +74 -71
  18. package/dist/source/components/index.d.ts +5 -3
  19. package/dist/source/components/locale-switcher.js +1 -1
  20. package/dist/source/components/naeil-header-content.d.ts +171 -0
  21. package/dist/source/components/naeil-header-content.js +176 -0
  22. package/dist/source/components/naeil-header.d.ts +52 -0
  23. package/dist/source/components/naeil-header.js +196 -0
  24. package/dist/source/components/nav.d.ts +10 -2
  25. package/dist/source/components/nav.js +51 -347
  26. package/dist/source/components/ui/index.d.ts +2 -0
  27. package/dist/source/components/ui/index.js +4 -0
  28. package/dist/source/components/ui/navigation.d.ts +48 -0
  29. package/dist/source/components/ui/navigation.js +347 -0
  30. package/dist/source/components/ui/site-footer.d.ts +21 -0
  31. package/dist/source/components/ui/site-footer.js +93 -0
  32. package/docs/components/README.md +8 -1
  33. package/docs/components/application-layout.md +102 -0
  34. package/docs/components/common.md +2 -2
  35. package/docs/components/naeil-header.md +50 -0
  36. package/docs/components/navigation.md +57 -0
  37. package/docs/design/public-ui-support.md +14 -1
  38. package/docs/design/v2-migration.md +59 -26
  39. package/docs/package-release.md +40 -14
  40. package/package.json +13 -1
  41. package/src/styles/components.css +292 -0
  42. package/src/styles/theme.css +7 -1
@@ -1,4 +1,8 @@
1
1
  "use client";
2
+ import {
3
+ useOverlayRef,
4
+ useRadixHiddenInert
5
+ } from "./chunk-CE73AEJZ.js";
2
6
  import {
3
7
  __objRest,
4
8
  __spreadProps,
@@ -6,127 +10,70 @@ import {
6
10
  cn
7
11
  } from "./chunk-JBTDRVZ7.js";
8
12
 
9
- // src/components/ui/badge.tsx
10
- import { cva } from "class-variance-authority";
11
- import { Slot } from "radix-ui";
12
- import { jsx } from "react/jsx-runtime";
13
- var badgeVariants = cva(
14
- "inline-flex items-center justify-center rounded-sm border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none ui-focus aria-invalid:border-error transition-colors overflow-hidden",
15
- {
16
- variants: {
17
- variant: {
18
- success: "bg-success-bg text-success border-transparent",
19
- warning: "bg-warning-bg text-warning border-transparent",
20
- error: "bg-error-bg text-error border-transparent",
21
- info: "bg-info-bg text-info border-transparent",
22
- default: "bg-primary text-primary-foreground border-transparent [a&]:hover:bg-primary/90",
23
- secondary: "bg-secondary text-secondary-foreground border-transparent [a&]:hover:bg-secondary/80",
24
- outline: "border-border text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground",
25
- destructive: "bg-destructive text-destructive-foreground border-transparent [a&]:hover:bg-destructive/90"
26
- }
27
- },
28
- defaultVariants: {
29
- variant: "default"
30
- }
31
- }
32
- );
33
- function Badge(_a) {
13
+ // src/components/ui/site-footer.tsx
14
+ import { jsx, jsxs } from "react/jsx-runtime";
15
+ function SiteFooter(_a) {
34
16
  var _b = _a, {
17
+ brand,
18
+ description,
19
+ groups = [],
20
+ Link,
21
+ meta,
22
+ children,
23
+ containerClassName,
35
24
  className,
36
- variant = "default",
37
- asChild = false
25
+ variant = "full"
38
26
  } = _b, props = __objRest(_b, [
27
+ "brand",
28
+ "description",
29
+ "groups",
30
+ "Link",
31
+ "meta",
32
+ "children",
33
+ "containerClassName",
39
34
  "className",
40
- "variant",
41
- "asChild"
35
+ "variant"
42
36
  ]);
43
- const Comp = asChild ? Slot.Root : "span";
44
37
  return /* @__PURE__ */ jsx(
45
- Comp,
46
- __spreadValues({
47
- "data-slot": "badge",
38
+ "footer",
39
+ __spreadProps(__spreadValues({
40
+ "data-slot": "site-footer",
48
41
  "data-variant": variant,
49
- className: cn(badgeVariants({ variant }), className)
50
- }, props)
42
+ className: cn("ui-site-footer", className)
43
+ }, props), {
44
+ children: /* @__PURE__ */ jsxs("div", { className: cn("ui-site-footer-frame", containerClassName), children: [
45
+ /* @__PURE__ */ jsxs("div", { className: "ui-site-footer-brand", children: [
46
+ brand,
47
+ description && /* @__PURE__ */ jsx("div", { className: "ui-site-footer-description", children: description }),
48
+ children
49
+ ] }),
50
+ groups.map((group) => /* @__PURE__ */ jsxs("nav", { "aria-label": group.label, children: [
51
+ /* @__PURE__ */ jsx("h2", { className: "ui-site-footer-label", children: group.label }),
52
+ group.links.map((item) => {
53
+ const Component = !item.external && Link ? Link : "a";
54
+ return /* @__PURE__ */ jsx(
55
+ Component,
56
+ {
57
+ href: item.href,
58
+ target: item.target,
59
+ rel: item.target === "_blank" ? "noopener noreferrer" : void 0,
60
+ className: "ui-site-footer-link ui-focus",
61
+ children: item.label
62
+ },
63
+ item.id
64
+ );
65
+ })
66
+ ] }, group.id)),
67
+ meta && /* @__PURE__ */ jsx("div", { className: "ui-site-footer-meta", children: meta })
68
+ ] })
69
+ })
51
70
  );
52
71
  }
53
72
 
54
73
  // src/components/ui/dropdown-menu.tsx
55
74
  import { CheckIcon, ChevronRightIcon, CircleIcon } from "lucide-react";
56
75
  import { DropdownMenu as DropdownMenuPrimitive } from "radix-ui";
57
-
58
- // src/lib/design/modal-inert.ts
59
- import { useEffect, useMemo, useState } from "react";
60
- var ownershipKey = /* @__PURE__ */ Symbol.for("@naeil/ui/radix-hidden-inert/v1");
61
- function ownershipFor(doc) {
62
- var _a;
63
- const shared = doc;
64
- return (_a = shared[ownershipKey]) != null ? _a : shared[ownershipKey] = /* @__PURE__ */ new WeakMap();
65
- }
66
- function useRadixHiddenInert(content) {
67
- useEffect(() => {
68
- if (!content) return;
69
- const doc = content.ownerDocument;
70
- const ownership = ownershipFor(doc);
71
- const held = /* @__PURE__ */ new Set();
72
- function release(element) {
73
- held.delete(element);
74
- const state = ownership.get(element);
75
- if (!state || --state.users > 0) return;
76
- element.inert = state.original;
77
- ownership.delete(element);
78
- }
79
- function sync() {
80
- const hidden = (content == null ? void 0 : content.isConnected) && content.dataset.state === "open" ? [...doc.querySelectorAll('[data-aria-hidden="true"][aria-hidden="true"]')].filter((element) => !element.contains(content)) : [];
81
- const desired = new Set(hidden);
82
- for (const element of held) if (!desired.has(element)) release(element);
83
- for (const element of desired) {
84
- if (held.has(element)) continue;
85
- let state = ownership.get(element);
86
- if (!state) {
87
- state = { users: 0, original: element.inert };
88
- ownership.set(element, state);
89
- }
90
- state.users++;
91
- held.add(element);
92
- element.inert = true;
93
- }
94
- }
95
- const observer = new MutationObserver(sync);
96
- observer.observe(doc.body, {
97
- subtree: true,
98
- childList: true,
99
- attributes: true,
100
- attributeFilter: ["aria-hidden", "data-aria-hidden", "data-state"]
101
- });
102
- sync();
103
- return () => {
104
- observer.disconnect();
105
- for (const element of held) release(element);
106
- };
107
- }, [content]);
108
- }
109
- function assignObjectRef(ref, node) {
110
- ref.current = node;
111
- }
112
- function useOverlayRef(consumerRef) {
113
- const [node, setNode] = useState(null);
114
- const ref = useMemo(() => (value) => {
115
- setNode(value);
116
- const cleanup = typeof consumerRef === "function" ? consumerRef(value) : void 0;
117
- if (consumerRef && typeof consumerRef !== "function") assignObjectRef(consumerRef, value);
118
- return () => {
119
- setNode(null);
120
- if (typeof cleanup === "function") cleanup();
121
- else if (typeof consumerRef === "function") consumerRef(null);
122
- else if (consumerRef) assignObjectRef(consumerRef, null);
123
- };
124
- }, [consumerRef]);
125
- return [node, ref];
126
- }
127
-
128
- // src/components/ui/dropdown-menu.tsx
129
- import { jsx as jsx2, jsxs } from "react/jsx-runtime";
76
+ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
130
77
  function DropdownMenu(_a) {
131
78
  var props = __objRest(_a, []);
132
79
  return /* @__PURE__ */ jsx2(DropdownMenuPrimitive.Root, __spreadValues({ "data-slot": "dropdown-menu" }, props));
@@ -206,7 +153,7 @@ function DropdownMenuCheckboxItem(_a) {
206
153
  "children",
207
154
  "checked"
208
155
  ]);
209
- return /* @__PURE__ */ jsxs(
156
+ return /* @__PURE__ */ jsxs2(
210
157
  DropdownMenuPrimitive.CheckboxItem,
211
158
  __spreadProps(__spreadValues({
212
159
  "data-slot": "dropdown-menu-checkbox-item",
@@ -240,7 +187,7 @@ function DropdownMenuRadioItem(_a) {
240
187
  "className",
241
188
  "children"
242
189
  ]);
243
- return /* @__PURE__ */ jsxs(
190
+ return /* @__PURE__ */ jsxs2(
244
191
  DropdownMenuPrimitive.RadioItem,
245
192
  __spreadProps(__spreadValues({
246
193
  "data-slot": "dropdown-menu-radio-item",
@@ -321,7 +268,7 @@ function DropdownMenuSubTrigger(_a) {
321
268
  "inset",
322
269
  "children"
323
270
  ]);
324
- return /* @__PURE__ */ jsxs(
271
+ return /* @__PURE__ */ jsxs2(
325
272
  DropdownMenuPrimitive.SubTrigger,
326
273
  __spreadProps(__spreadValues({
327
274
  "data-slot": "dropdown-menu-sub-trigger",
@@ -356,68 +303,8 @@ function DropdownMenuSubContent(_a) {
356
303
  );
357
304
  }
358
305
 
359
- // src/components/ui/button.tsx
360
- import { cva as cva2 } from "class-variance-authority";
361
- import { Slot as Slot2 } from "radix-ui";
362
- import { jsx as jsx3 } from "react/jsx-runtime";
363
- var buttonVariants = cva2(
364
- "inline-flex items-center justify-center gap-2 whitespace-nowrap ui-control ui-focus rounded-md text-base font-medium transition-colors duration-(--ui-motion-fast) cursor-pointer disabled:pointer-events-none disabled:opacity-50 disabled:cursor-not-allowed [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 ui-focus aria-invalid:border-error",
365
- {
366
- variants: {
367
- variant: {
368
- default: "bg-primary text-primary-foreground hover:bg-primary-hover",
369
- destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90 ",
370
- outline: "border border-border-strong bg-background hover:bg-surface-subtle",
371
- secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
372
- ghost: "hover:bg-surface-subtle",
373
- link: "text-primary underline-offset-4 hover:underline"
374
- },
375
- size: {
376
- default: "px-4 has-[>svg]:px-3",
377
- xs: "gap-1 rounded-md px-2 text-xs has-[>svg]:px-1.5 [&_svg:not([class*='size-'])]:size-3",
378
- sm: "rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
379
- lg: "rounded-md px-6 has-[>svg]:px-4",
380
- icon: "",
381
- "icon-xs": "rounded-md [&_svg:not([class*='size-'])]:size-3",
382
- "icon-sm": "",
383
- "icon-lg": ""
384
- }
385
- },
386
- defaultVariants: {
387
- variant: "default",
388
- size: "default"
389
- }
390
- }
391
- );
392
- function Button(_a) {
393
- var _b = _a, {
394
- className,
395
- variant = "default",
396
- size = "default",
397
- asChild = false
398
- } = _b, props = __objRest(_b, [
399
- "className",
400
- "variant",
401
- "size",
402
- "asChild"
403
- ]);
404
- const Comp = asChild ? Slot2.Root : "button";
405
- return /* @__PURE__ */ jsx3(
406
- Comp,
407
- __spreadValues({
408
- "data-slot": "button",
409
- "data-variant": variant,
410
- "data-size": size,
411
- className: cn(buttonVariants({ variant, size, className }))
412
- }, props)
413
- );
414
- }
415
-
416
306
  export {
417
- badgeVariants,
418
- Badge,
419
- useRadixHiddenInert,
420
- useOverlayRef,
307
+ SiteFooter,
421
308
  DropdownMenu,
422
309
  DropdownMenuPortal,
423
310
  DropdownMenuTrigger,
@@ -432,7 +319,5 @@ export {
432
319
  DropdownMenuShortcut,
433
320
  DropdownMenuSub,
434
321
  DropdownMenuSubTrigger,
435
- DropdownMenuSubContent,
436
- buttonVariants,
437
- Button
322
+ DropdownMenuSubContent
438
323
  };