@six-vallees/ui-react 0.2.0 → 0.2.1
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/button/button.js
CHANGED
|
@@ -8,7 +8,9 @@ import { Slot } from "@radix-ui/react-slot";
|
|
|
8
8
|
import { cva } from "class-variance-authority";
|
|
9
9
|
import { jsx } from "react/jsx-runtime";
|
|
10
10
|
var buttonVariants = cva(
|
|
11
|
-
|
|
11
|
+
// A soft accent halo on hover (a fill-grade ring in `accent-halo`, box-shadow so it never shifts
|
|
12
|
+
// layout and coexists with the focus-visible outline). Disabled buttons can't hover, so no halo.
|
|
13
|
+
"inline-flex items-center justify-center gap-2 leading-none rounded-control font-medium whitespace-nowrap transition-[background-color,border-color,box-shadow,filter] duration-150 outline-none hover:[box-shadow:0_0_0_4px_var(--sv-sys-color-accent-halo)] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus disabled:pointer-events-none disabled:opacity-40",
|
|
12
14
|
{
|
|
13
15
|
variants: {
|
|
14
16
|
variant: {
|
|
@@ -38,4 +40,4 @@ export {
|
|
|
38
40
|
buttonVariants,
|
|
39
41
|
Button
|
|
40
42
|
};
|
|
41
|
-
//# sourceMappingURL=chunk-
|
|
43
|
+
//# sourceMappingURL=chunk-KUKSVVDZ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/button/button.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Slot } from '@radix-ui/react-slot';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { cn } from '@/lib/utils';\n\n/**\n * Cairn Button. Consumes the design tokens through the Tailwind bridge\n * (bg-primary, rounded-control, …), install the Cairn theme in the target project.\n */\nconst buttonVariants = cva(\n // A soft accent halo on hover (a fill-grade ring in `accent-halo`, box-shadow so it never shifts\n // layout and coexists with the focus-visible outline). Disabled buttons can't hover, so no halo.\n 'inline-flex items-center justify-center gap-2 leading-none rounded-control font-medium whitespace-nowrap transition-[background-color,border-color,box-shadow,filter] duration-150 outline-none hover:[box-shadow:0_0_0_4px_var(--sv-sys-color-accent-halo)] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus disabled:pointer-events-none disabled:opacity-40',\n {\n variants: {\n variant: {\n primary: 'bg-primary text-on-primary hover:bg-primary-hover active:brightness-90',\n secondary:\n 'border border-outline-strong bg-surface text-on-surface hover:bg-surface-subtle active:bg-surface-muted',\n ghost: 'text-on-surface hover:bg-surface-subtle active:bg-surface-muted',\n danger: 'bg-danger text-on-danger hover:brightness-95 active:brightness-90',\n },\n size: {\n sm: 'h-9 px-3 text-sm',\n md: 'h-11 px-5 text-sm',\n lg: 'h-12 px-6 text-base',\n },\n },\n defaultVariants: { variant: 'primary', size: 'md' },\n }\n);\n\nexport interface ButtonProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement>,\n VariantProps<typeof buttonVariants> {\n /** Visual style of the button. */\n variant?: 'primary' | 'secondary' | 'ghost' | 'danger';\n /** Control height and padding. */\n size?: 'sm' | 'md' | 'lg';\n /** Render as the child element (e.g. an `<a>`) instead of a `<button>`. */\n asChild?: boolean;\n}\n\nexport const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n ({ className, variant, size, asChild = false, ...props }, ref) => {\n const Comp = asChild ? Slot : 'button';\n return (\n <Comp ref={ref} className={cn(buttonVariants({ variant, size }), className)} {...props} />\n );\n }\n);\nButton.displayName = 'Button';\n\nexport { buttonVariants };\n"],"mappings":";;;;;AAAA,YAAY,WAAW;AACvB,SAAS,YAAY;AACrB,SAAS,WAA8B;AA6CjC;AAtCN,IAAM,iBAAiB;AAAA;AAAA;AAAA,EAGrB;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,SAAS;AAAA,QACP,SAAS;AAAA,QACT,WACE;AAAA,QACF,OAAO;AAAA,QACP,QAAQ;AAAA,MACV;AAAA,MACA,MAAM;AAAA,QACJ,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,IAAI;AAAA,MACN;AAAA,IACF;AAAA,IACA,iBAAiB,EAAE,SAAS,WAAW,MAAM,KAAK;AAAA,EACpD;AACF;AAaO,IAAM,SAAe;AAAA,EAC1B,CAAC,EAAE,WAAW,SAAS,MAAM,UAAU,OAAO,GAAG,MAAM,GAAG,QAAQ;AAChE,UAAM,OAAO,UAAU,OAAO;AAC9B,WACE,oBAAC,QAAK,KAAU,WAAW,GAAG,eAAe,EAAE,SAAS,KAAK,CAAC,GAAG,SAAS,GAAI,GAAG,OAAO;AAAA,EAE5F;AACF;AACA,OAAO,cAAc;","names":[]}
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/button/button.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Slot } from '@radix-ui/react-slot';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { cn } from '@/lib/utils';\n\n/**\n * Cairn Button. Consumes the design tokens through the Tailwind bridge\n * (bg-primary, rounded-control, …), install the Cairn theme in the target project.\n */\nconst buttonVariants = cva(\n 'inline-flex items-center justify-center gap-2 leading-none rounded-control font-medium whitespace-nowrap transition-[background-color,border-color,filter] duration-150 outline-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus disabled:pointer-events-none disabled:opacity-40',\n {\n variants: {\n variant: {\n primary: 'bg-primary text-on-primary hover:bg-primary-hover active:brightness-90',\n secondary:\n 'border border-outline-strong bg-surface text-on-surface hover:bg-surface-subtle active:bg-surface-muted',\n ghost: 'text-on-surface hover:bg-surface-subtle active:bg-surface-muted',\n danger: 'bg-danger text-on-danger hover:brightness-95 active:brightness-90',\n },\n size: {\n sm: 'h-9 px-3 text-sm',\n md: 'h-11 px-5 text-sm',\n lg: 'h-12 px-6 text-base',\n },\n },\n defaultVariants: { variant: 'primary', size: 'md' },\n }\n);\n\nexport interface ButtonProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement>,\n VariantProps<typeof buttonVariants> {\n /** Visual style of the button. */\n variant?: 'primary' | 'secondary' | 'ghost' | 'danger';\n /** Control height and padding. */\n size?: 'sm' | 'md' | 'lg';\n /** Render as the child element (e.g. an `<a>`) instead of a `<button>`. */\n asChild?: boolean;\n}\n\nexport const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n ({ className, variant, size, asChild = false, ...props }, ref) => {\n const Comp = asChild ? Slot : 'button';\n return (\n <Comp ref={ref} className={cn(buttonVariants({ variant, size }), className)} {...props} />\n );\n }\n);\nButton.displayName = 'Button';\n\nexport { buttonVariants };\n"],"mappings":";;;;;AAAA,YAAY,WAAW;AACvB,SAAS,YAAY;AACrB,SAAS,WAA8B;AA2CjC;AApCN,IAAM,iBAAiB;AAAA,EACrB;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,SAAS;AAAA,QACP,SAAS;AAAA,QACT,WACE;AAAA,QACF,OAAO;AAAA,QACP,QAAQ;AAAA,MACV;AAAA,MACA,MAAM;AAAA,QACJ,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,IAAI;AAAA,MACN;AAAA,IACF;AAAA,IACA,iBAAiB,EAAE,SAAS,WAAW,MAAM,KAAK;AAAA,EACpD;AACF;AAaO,IAAM,SAAe;AAAA,EAC1B,CAAC,EAAE,WAAW,SAAS,MAAM,UAAU,OAAO,GAAG,MAAM,GAAG,QAAQ;AAChE,UAAM,OAAO,UAAU,OAAO;AAC9B,WACE,oBAAC,QAAK,KAAU,WAAW,GAAG,eAAe,EAAE,SAAS,KAAK,CAAC,GAAG,SAAS,GAAI,GAAG,OAAO;AAAA,EAE5F;AACF;AACA,OAAO,cAAc;","names":[]}
|