@cbrl/design 0.6.1 → 0.6.3

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.
package/README.md CHANGED
@@ -83,8 +83,8 @@ or `'?'`.
83
83
  ### Avatar group
84
84
 
85
85
  `AvatarGroup` overlaps its avatars. Pass `max` to show the first N and collapse
86
- the rest into a "+K" `AvatarGroupCount` (accessible name `"K more"`, override
87
- with `overflowLabel`). Without `max` it renders every child, as before.
86
+ the rest into a "+K" `AvatarGroupCount` (accessible name `"+K"`, language-neutral;
87
+ pass a localized `overflowLabel`). Without `max` it renders every child, as before.
88
88
 
89
89
  ```tsx
90
90
  <AvatarGroup max={3} overflowLabel={(n) => `mais ${n} pessoas`}>
@@ -267,6 +267,12 @@ export function SettingsModal() {
267
267
  // Anywhere: <a href="#settings/billing">Cobrança</a>
268
268
  ```
269
269
 
270
+ Next.js App Router: a fragment-only navigation (plain `<a href="#…">`, a typed
271
+ URL) bypasses the router, whose history sync then rewrites the URL without the
272
+ hash and would close the dialog at once. The hook re-states the URL through
273
+ `history.replaceState` on `hashchange` (keeping `history.state`, also in
274
+ `open`/`close`) so the router adopts it; outside Next this is a no-op.
275
+
270
276
  Uncontrolled use: `defaultOpen`/`defaultValue`. Slots: `settings-dialog`,
271
277
  `settings-dialog-nav`, `settings-dialog-content`.
272
278
 
@@ -12,7 +12,7 @@ type AvatarGroupProps = React.ComponentProps<'div'> & {
12
12
  * `AvatarGroupCount` reading "+K". Omit to render every child.
13
13
  */
14
14
  max?: number;
15
- /** Accessible name of the "+K" count. Defaults to `"K more"`. */
15
+ /** Accessible name of the "+K" count. Defaults to `"+K"` (language-neutral); pass a localized label. */
16
16
  overflowLabel?: (hidden: number) => string;
17
17
  };
18
18
  declare function AvatarGroup({ className, max, overflowLabel, children, ...props }: AvatarGroupProps): React.JSX.Element;
@@ -43,7 +43,7 @@ function AvatarGroup({ className, max, overflowLabel, children, ...props }) {
43
43
  ...props,
44
44
  children: [hidden > 0 ? items.slice(0, limit) : children, hidden > 0 ? /* @__PURE__ */ jsxs(AvatarGroupCount, {
45
45
  role: "img",
46
- "aria-label": overflowLabel?.(hidden) ?? `${hidden} more`,
46
+ "aria-label": overflowLabel?.(hidden) ?? `+${hidden}`,
47
47
  children: ["+", hidden]
48
48
  }) : null]
49
49
  });
@@ -1,7 +1,7 @@
1
1
  import * as React from "react";
2
2
  import { VariantProps } from "class-variance-authority";
3
3
  declare const badgeVariants: (props?: ({
4
- variant?: "default" | "secondary" | "destructive" | "success" | "warning" | "info" | "outline" | "ghost" | "link" | null | undefined;
4
+ variant?: "default" | "outline" | "secondary" | "ghost" | "destructive" | "link" | "success" | "warning" | "info" | null | undefined;
5
5
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
6
6
  declare function Badge({ className, variant, asChild, ...props }: React.ComponentProps<'span'> & VariantProps<typeof badgeVariants> & {
7
7
  asChild?: boolean;
@@ -1,7 +1,7 @@
1
1
  import * as React from "react";
2
2
  import { VariantProps } from "class-variance-authority";
3
3
  declare const buttonVariants: (props?: ({
4
- variant?: "default" | "secondary" | "destructive" | "outline" | "ghost" | "link" | null | undefined;
4
+ variant?: "default" | "outline" | "secondary" | "ghost" | "destructive" | "link" | null | undefined;
5
5
  size?: "default" | "xs" | "sm" | "lg" | "icon" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
6
6
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
7
7
  declare function Button({ className, variant, size, asChild, ...props }: React.ComponentProps<'button'> & VariantProps<typeof buttonVariants> & {
@@ -6,10 +6,10 @@ import { jsx } from "react/jsx-runtime";
6
6
  const statusDotVariants = cva("relative inline-flex shrink-0 rounded-full", {
7
7
  variants: {
8
8
  tone: {
9
- success: "bg-emerald-500",
10
- warning: "bg-amber-500",
9
+ success: "bg-emerald-500 dark:bg-emerald-400",
10
+ warning: "bg-amber-500 dark:bg-amber-400",
11
11
  destructive: "bg-destructive",
12
- info: "bg-sky-500",
12
+ info: "bg-sky-500 dark:bg-sky-400",
13
13
  muted: "bg-muted-foreground/50"
14
14
  },
15
15
  size: {
package/dist/globals.css CHANGED
@@ -40,6 +40,14 @@
40
40
  */
41
41
  overflow-y: scroll;
42
42
  }
43
+ /*
44
+ * Com o app shell (sidebar-wrapper: h-dvh overflow-hidden) o documento nunca
45
+ * rola — quem rola é o `app-scroll`. Forçar a barra no html ali desenha uma
46
+ * segunda barra, morta, ao lado da real.
47
+ */
48
+ html:has([data-slot='sidebar-wrapper']) {
49
+ overflow-y: hidden;
50
+ }
43
51
  }
44
52
 
45
53
  /*
@@ -1,7 +1,7 @@
1
1
  export type HashSection<K extends string> = {
2
2
  /** Section in `#<prefix>/<section>`, or null when the hash doesn't address one. */
3
3
  section: K | null;
4
- /** Points the hash at a section (replaceState: no history entry). */
4
+ /** Points the hash at a section (replaceState keeping `history.state`: no history entry). */
5
5
  open: (section: K) => void;
6
6
  /** Clears the hash, keeping path and query (replaceState). */
7
7
  close: () => void;
@@ -15,18 +15,22 @@ function useHashSection(prefix, keys) {
15
15
  React.useEffect(() => {
16
16
  const allowed = keysId === void 0 ? void 0 : keysId.split("\0");
17
17
  const sync = () => setSection(parse(window.location.hash, prefix, allowed));
18
+ const onHashChange = () => {
19
+ if (window.location.hash.startsWith(`#${prefix}/`)) window.history.replaceState(window.history.state, "", window.location.href);
20
+ sync();
21
+ };
18
22
  sync();
19
- window.addEventListener("hashchange", sync);
20
- return () => window.removeEventListener("hashchange", sync);
23
+ window.addEventListener("hashchange", onHashChange);
24
+ return () => window.removeEventListener("hashchange", onHashChange);
21
25
  }, [prefix, keysId]);
22
26
  return {
23
27
  section,
24
28
  open: React.useCallback((next) => {
25
- window.history.replaceState(null, "", `#${prefix}/${encodeURIComponent(next)}`);
29
+ window.history.replaceState(window.history.state, "", `#${prefix}/${encodeURIComponent(next)}`);
26
30
  setSection(next);
27
31
  }, [prefix]),
28
32
  close: React.useCallback(() => {
29
- window.history.replaceState(null, "", window.location.pathname + window.location.search);
33
+ window.history.replaceState(window.history.state, "", window.location.pathname + window.location.search);
30
34
  setSection(null);
31
35
  }, [])
32
36
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cbrl/design",
3
- "version": "0.6.1",
3
+ "version": "0.6.3",
4
4
  "description": "Design system on Radix + Tailwind v4: shadcn-style components, layout shells and design tokens with an overridable brand accent.",
5
5
  "license": "MIT",
6
6
  "author": "Kayron Cabral",
@@ -72,8 +72,8 @@
72
72
  "typescript": "^6.0.3",
73
73
  "vitest": "^5.1.1",
74
74
  "@cbrl/eslint-config": "0.3.0",
75
- "@cbrl/testing": "0.4.0",
76
- "@cbrl/tsconfig": "0.1.1"
75
+ "@cbrl/tsconfig": "0.1.1",
76
+ "@cbrl/testing": "0.4.0"
77
77
  },
78
78
  "publishConfig": {
79
79
  "access": "public"