@bergetai/ui 0.11.1 → 0.11.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.
- package/dist/index.cjs +29 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +29 -1
- package/dist/index.js.map +1 -1
- package/dist/styles/index.css +6 -31
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -45,7 +45,7 @@ declare const buttonVariants: (props?: ({
|
|
|
45
45
|
declare function Button$1({ className, variant, size, ...props }: Button$2.Props & VariantProps<typeof buttonVariants>): react_jsx_runtime.JSX.Element;
|
|
46
46
|
|
|
47
47
|
/** Variants exposed by the Berget wrapper. */
|
|
48
|
-
type CustomVariant = 'default' | 'primary' | 'destructive' | 'link';
|
|
48
|
+
type CustomVariant = 'default' | 'primary' | 'destructive' | 'outline' | 'link';
|
|
49
49
|
/** Props for the Berget Button wrapper. */
|
|
50
50
|
interface ButtonProps extends Omit<React$1.ComponentProps<typeof Button$1>, 'variant' | 'ref'> {
|
|
51
51
|
/** Visual style variant. `primary` is Berget-specific. */
|
package/dist/index.d.ts
CHANGED
|
@@ -45,7 +45,7 @@ declare const buttonVariants: (props?: ({
|
|
|
45
45
|
declare function Button$1({ className, variant, size, ...props }: Button$2.Props & VariantProps<typeof buttonVariants>): react_jsx_runtime.JSX.Element;
|
|
46
46
|
|
|
47
47
|
/** Variants exposed by the Berget wrapper. */
|
|
48
|
-
type CustomVariant = 'default' | 'primary' | 'destructive' | 'link';
|
|
48
|
+
type CustomVariant = 'default' | 'primary' | 'destructive' | 'outline' | 'link';
|
|
49
49
|
/** Props for the Berget Button wrapper. */
|
|
50
50
|
interface ButtonProps extends Omit<React$1.ComponentProps<typeof Button$1>, 'variant' | 'ref'> {
|
|
51
51
|
/** Visual style variant. `primary` is Berget-specific. */
|
package/dist/index.js
CHANGED
|
@@ -301,9 +301,28 @@ function brandVariantClasses(variant) {
|
|
|
301
301
|
disabledClasses,
|
|
302
302
|
"disabled:bg-berget-button-destructive-disabled-bg"
|
|
303
303
|
);
|
|
304
|
+
case "outline":
|
|
305
|
+
return cn(
|
|
306
|
+
// Transparent fill with a theme-foreground-derived border (25% of the
|
|
307
|
+
// foreground). The state treatment is static: hover, press and
|
|
308
|
+
// keyboard focus render identically to rest — only the shared focus
|
|
309
|
+
// outline and the disabled treatment deviate.
|
|
310
|
+
"bg-transparent border-berget-button-outline-border text-berget-button-outline-fg",
|
|
311
|
+
// Hover: slight brightening (hover bg token); the border and
|
|
312
|
+
// foreground stay at rest. The dark:hover twin also neutralises
|
|
313
|
+
// the primitive ghost's dark:hover:bg-muted/50. Pressed drops the
|
|
314
|
+
// fill back to transparent (a pressed element is still hovered, so
|
|
315
|
+
// an explicit active override is needed in both colour schemes).
|
|
316
|
+
"hover:bg-berget-button-outline-hover dark:hover:bg-berget-button-outline-hover",
|
|
317
|
+
"active:bg-transparent dark:active:bg-transparent",
|
|
318
|
+
// Keep the resting border on focus — the shared outline is the indicator.
|
|
319
|
+
"focus-visible:border-berget-button-outline-border",
|
|
320
|
+
disabledClasses,
|
|
321
|
+
"disabled:bg-transparent disabled:border-berget-button-disabled-border"
|
|
322
|
+
);
|
|
304
323
|
case "link":
|
|
305
324
|
return cn(
|
|
306
|
-
"h-auto bg-transparent p-0 text-berget-button-link-fg underline-offset-4 shadow-none",
|
|
325
|
+
"h-auto bg-transparent p-0 text-berget-button-link-fg font-medium underline-offset-4 shadow-none",
|
|
307
326
|
"hover:bg-transparent hover:text-berget-button-link-hover-fg",
|
|
308
327
|
// On press, return to the resting foreground (hover fg otherwise sticks).
|
|
309
328
|
"active:text-berget-button-link-fg",
|
|
@@ -334,6 +353,7 @@ function primitiveVariant(variant) {
|
|
|
334
353
|
switch (variant) {
|
|
335
354
|
case "primary":
|
|
336
355
|
case "destructive":
|
|
356
|
+
case "outline":
|
|
337
357
|
return "ghost";
|
|
338
358
|
default:
|
|
339
359
|
return variant;
|
|
@@ -362,6 +382,14 @@ function Button2({
|
|
|
362
382
|
// larger button text. h-auto drops the primitive's fixed h-* so the
|
|
363
383
|
// vertical paddings take effect.
|
|
364
384
|
!isLink && !isIcon && "py-[0.57em] px-[1.14em] h-auto",
|
|
385
|
+
// Text ladder: size = typography scale; the em-based padding above
|
|
386
|
+
// follows automatically, so no per-size paddings are needed. Only
|
|
387
|
+
// default/lg/sm need overrides — xs keeps the primitive's text-xs.
|
|
388
|
+
!isLink && !isIcon && (size === "lg" ? "text-lg" : size === "sm" ? "text-sm" : size === "xs" ? "" : "text-base"),
|
|
389
|
+
// Normal weight for every non-link variant — tailwind-merge strips the
|
|
390
|
+
// primitive's font-medium (font-weight: var(--font-weight-medium)); the
|
|
391
|
+
// link variant keeps medium via its own classes above.
|
|
392
|
+
!isLink && "font-normal",
|
|
365
393
|
brandVariantClasses(variant),
|
|
366
394
|
interactionClasses,
|
|
367
395
|
!isLink && width === "full" && "w-full",
|