@yenio-pld/blocks 1.2.0-rc.29 → 1.2.0-rc.30
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/ui/button.d.ts +7 -2
- package/dist/ui/button.js +20 -10
- package/dist/ui/button.js.map +1 -1
- package/package.json +1 -1
- package/src/theme.css +10 -8
package/dist/ui/button.d.ts
CHANGED
|
@@ -3,10 +3,15 @@ import * as class_variance_authority_types from 'class-variance-authority/types'
|
|
|
3
3
|
import { Button as Button$1 } from '@base-ui/react/button';
|
|
4
4
|
import { VariantProps } from 'class-variance-authority';
|
|
5
5
|
|
|
6
|
-
declare const
|
|
6
|
+
declare const buttonVariantsCva: (props?: ({
|
|
7
7
|
variant?: "link" | "default" | "outline" | "secondary" | "ghost" | "destructive" | null | undefined;
|
|
8
8
|
size?: "default" | "sm" | "xs" | "lg" | "cta" | "touch" | "xl" | "icon" | "icon-xs" | "icon-sm" | "icon-lg" | "icon-touch" | "icon-xl" | null | undefined;
|
|
9
9
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
10
|
-
|
|
10
|
+
type ButtonVariantProps = VariantProps<typeof buttonVariantsCva> & {
|
|
11
|
+
className?: string;
|
|
12
|
+
};
|
|
13
|
+
/** Always twMerge so size/variant radius and consumer className cannot fight. */
|
|
14
|
+
declare function buttonVariants({ className, ...props }?: ButtonVariantProps): string;
|
|
15
|
+
declare function Button({ className, variant, size, ...props }: Button$1.Props & VariantProps<typeof buttonVariantsCva>): React.JSX.Element;
|
|
11
16
|
|
|
12
17
|
export { Button, buttonVariants };
|
package/dist/ui/button.js
CHANGED
|
@@ -9,12 +9,15 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
9
9
|
function cn(...inputs) {
|
|
10
10
|
return twMerge(clsx(inputs));
|
|
11
11
|
}
|
|
12
|
-
var
|
|
13
|
-
|
|
12
|
+
var buttonVariantsCva = cva(
|
|
13
|
+
// Pill radius is the default for every size. Prefer rounded-full over rounded-lg so
|
|
14
|
+
// raw `buttonVariants()` consumers (anchors) never lose the pill to CSS source order.
|
|
15
|
+
"group/button inline-flex shrink-0 items-center justify-center rounded-full border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
14
16
|
{
|
|
15
17
|
variants: {
|
|
16
18
|
variant: {
|
|
17
|
-
|
|
19
|
+
// Brighten on hover instead of /80 opacity (opacity on gold reads as disabled).
|
|
20
|
+
default: "bg-primary text-primary-foreground hover:brightness-110 active:brightness-95",
|
|
18
21
|
outline: "border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",
|
|
19
22
|
secondary: "bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",
|
|
20
23
|
ghost: "hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",
|
|
@@ -23,18 +26,18 @@ var buttonVariants = cva(
|
|
|
23
26
|
},
|
|
24
27
|
size: {
|
|
25
28
|
default: "h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
|
|
26
|
-
xs: "h-6 gap-1
|
|
27
|
-
sm: "h-7 gap-1
|
|
29
|
+
xs: "h-6 gap-1 px-2 text-xs has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",
|
|
30
|
+
sm: "h-7 gap-1 px-2.5 text-[0.8rem] has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",
|
|
28
31
|
lg: "h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
|
|
29
|
-
/** Marketing / empty-state pill CTA — not the product default. */
|
|
30
|
-
cta: "min-h-12 gap-2
|
|
32
|
+
/** Marketing / empty-state tall pill CTA — not the product default height. */
|
|
33
|
+
cta: "min-h-12 gap-2 px-6 text-base has-data-[icon=inline-end]:pr-5 has-data-[icon=inline-start]:pl-5 [&_svg:not([class*='size-'])]:size-5",
|
|
31
34
|
/** 44px touch target for POS register controls (WCAG AAA aim). */
|
|
32
35
|
touch: "h-11 gap-2 px-4 text-base has-data-[icon=inline-end]:pr-3 has-data-[icon=inline-start]:pl-3 [&_svg:not([class*='size-'])]:size-5",
|
|
33
36
|
/** 56px primary till actions (Charge, Exact cash). */
|
|
34
37
|
xl: "h-14 gap-2 px-5 text-base has-data-[icon=inline-end]:pr-4 has-data-[icon=inline-start]:pl-4 [&_svg:not([class*='size-'])]:size-5",
|
|
35
38
|
icon: "size-8",
|
|
36
|
-
"icon-xs": "size-6
|
|
37
|
-
"icon-sm": "size-7
|
|
39
|
+
"icon-xs": "size-6 [&_svg:not([class*='size-'])]:size-3",
|
|
40
|
+
"icon-sm": "size-7 [&_svg:not([class*='size-'])]:size-3.5",
|
|
38
41
|
"icon-lg": "size-9",
|
|
39
42
|
"icon-touch": "size-11 [&_svg:not([class*='size-'])]:size-5",
|
|
40
43
|
"icon-xl": "size-14 [&_svg:not([class*='size-'])]:size-6"
|
|
@@ -46,6 +49,9 @@ var buttonVariants = cva(
|
|
|
46
49
|
}
|
|
47
50
|
}
|
|
48
51
|
);
|
|
52
|
+
function buttonVariants({ className, ...props } = {}) {
|
|
53
|
+
return cn(buttonVariantsCva(props), className);
|
|
54
|
+
}
|
|
49
55
|
function Button({
|
|
50
56
|
className,
|
|
51
57
|
variant = "default",
|
|
@@ -56,7 +62,11 @@ function Button({
|
|
|
56
62
|
Button$1,
|
|
57
63
|
{
|
|
58
64
|
"data-slot": "button",
|
|
59
|
-
className:
|
|
65
|
+
className: buttonVariants({
|
|
66
|
+
variant,
|
|
67
|
+
size,
|
|
68
|
+
className: typeof className === "string" ? className : void 0
|
|
69
|
+
}),
|
|
60
70
|
...props
|
|
61
71
|
}
|
|
62
72
|
);
|
package/dist/ui/button.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/lib/utils.ts","../../src/ui/button.tsx"],"names":["ButtonPrimitive"],"mappings":";;;;;;;AAGO,SAAS,MAAM,MAAA,EAAsB;AAC3C,EAAA,OAAO,OAAA,CAAQ,IAAA,CAAK,MAAM,CAAC,CAAA;AAC5B;ACAA,IAAM,
|
|
1
|
+
{"version":3,"sources":["../../src/lib/utils.ts","../../src/ui/button.tsx"],"names":["ButtonPrimitive"],"mappings":";;;;;;;AAGO,SAAS,MAAM,MAAA,EAAsB;AAC3C,EAAA,OAAO,OAAA,CAAQ,IAAA,CAAK,MAAM,CAAC,CAAA;AAC5B;ACAA,IAAM,iBAAA,GAAoB,GAAA;AAAA;AAAA;AAAA,EAGzB,8lBAAA;AAAA,EACA;AAAA,IACC,QAAA,EAAU;AAAA,MACT,OAAA,EAAS;AAAA;AAAA,QAER,OAAA,EACC,8EAAA;AAAA,QACD,OAAA,EACC,iLAAA;AAAA,QACD,SAAA,EACC,gLAAA;AAAA,QACD,KAAA,EACC,kHAAA;AAAA,QACD,WAAA,EACC,6NAAA;AAAA,QACD,IAAA,EAAM;AAAA,OACP;AAAA,MACA,IAAA,EAAM;AAAA,QACL,OAAA,EACC,sFAAA;AAAA,QACD,EAAA,EAAI,mIAAA;AAAA,QACJ,EAAA,EAAI,6IAAA;AAAA,QACJ,EAAA,EAAI,sFAAA;AAAA;AAAA,QAEJ,GAAA,EAAK,sIAAA;AAAA;AAAA,QAEL,KAAA,EACC,kIAAA;AAAA;AAAA,QAED,EAAA,EAAI,kIAAA;AAAA,QACJ,IAAA,EAAM,QAAA;AAAA,QACN,SAAA,EAAW,6CAAA;AAAA,QACX,SAAA,EAAW,+CAAA;AAAA,QACX,SAAA,EAAW,QAAA;AAAA,QACX,YAAA,EAAc,8CAAA;AAAA,QACd,SAAA,EAAW;AAAA;AACZ,KACD;AAAA,IACA,eAAA,EAAiB;AAAA,MAChB,OAAA,EAAS,SAAA;AAAA,MACT,IAAA,EAAM;AAAA;AACP;AAEF,CAAA;AAOA,SAAS,eAAe,EAAE,SAAA,EAAW,GAAG,KAAA,EAAM,GAAwB,EAAC,EAAG;AACzE,EAAA,OAAO,EAAA,CAAG,iBAAA,CAAkB,KAAK,CAAA,EAAG,SAAS,CAAA;AAC9C;AAEA,SAAS,MAAA,CAAO;AAAA,EACf,SAAA;AAAA,EACA,OAAA,GAAU,SAAA;AAAA,EACV,IAAA,GAAO,SAAA;AAAA,EACP,GAAG;AACJ,CAAA,EAAmE;AAClE,EAAA,uBACC,GAAA;AAAA,IAACA,QAAA;AAAA,IAAA;AAAA,MACA,WAAA,EAAU,QAAA;AAAA,MACV,WAAW,cAAA,CAAe;AAAA,QACzB,OAAA;AAAA,QACA,IAAA;AAAA,QACA,SAAA,EAAW,OAAO,SAAA,KAAc,QAAA,GAAW,SAAA,GAAY;AAAA,OACvD,CAAA;AAAA,MACA,GAAG;AAAA;AAAA,GACL;AAEF","file":"button.js","sourcesContent":["import { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport function cn(...inputs: ClassValue[]) {\n\treturn twMerge(clsx(inputs));\n}\n","import { Button as ButtonPrimitive } from \"@base-ui/react/button\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\n\nimport { cn } from \"../lib/utils\";\n\nconst buttonVariantsCva = cva(\n\t// Pill radius is the default for every size. Prefer rounded-full over rounded-lg so\n\t// raw `buttonVariants()` consumers (anchors) never lose the pill to CSS source order.\n\t\"group/button inline-flex shrink-0 items-center justify-center rounded-full border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n\t{\n\t\tvariants: {\n\t\t\tvariant: {\n\t\t\t\t// Brighten on hover instead of /80 opacity (opacity on gold reads as disabled).\n\t\t\t\tdefault:\n\t\t\t\t\t\"bg-primary text-primary-foreground hover:brightness-110 active:brightness-95\",\n\t\t\t\toutline:\n\t\t\t\t\t\"border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50\",\n\t\t\t\tsecondary:\n\t\t\t\t\t\"bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground\",\n\t\t\t\tghost:\n\t\t\t\t\t\"hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50\",\n\t\t\t\tdestructive:\n\t\t\t\t\t\"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40\",\n\t\t\t\tlink: \"text-primary underline-offset-4 hover:underline\",\n\t\t\t},\n\t\t\tsize: {\n\t\t\t\tdefault:\n\t\t\t\t\t\"h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2\",\n\t\t\t\txs: \"h-6 gap-1 px-2 text-xs has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3\",\n\t\t\t\tsm: \"h-7 gap-1 px-2.5 text-[0.8rem] has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5\",\n\t\t\t\tlg: \"h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2\",\n\t\t\t\t/** Marketing / empty-state tall pill CTA — not the product default height. */\n\t\t\t\tcta: \"min-h-12 gap-2 px-6 text-base has-data-[icon=inline-end]:pr-5 has-data-[icon=inline-start]:pl-5 [&_svg:not([class*='size-'])]:size-5\",\n\t\t\t\t/** 44px touch target for POS register controls (WCAG AAA aim). */\n\t\t\t\ttouch:\n\t\t\t\t\t\"h-11 gap-2 px-4 text-base has-data-[icon=inline-end]:pr-3 has-data-[icon=inline-start]:pl-3 [&_svg:not([class*='size-'])]:size-5\",\n\t\t\t\t/** 56px primary till actions (Charge, Exact cash). */\n\t\t\t\txl: \"h-14 gap-2 px-5 text-base has-data-[icon=inline-end]:pr-4 has-data-[icon=inline-start]:pl-4 [&_svg:not([class*='size-'])]:size-5\",\n\t\t\t\ticon: \"size-8\",\n\t\t\t\t\"icon-xs\": \"size-6 [&_svg:not([class*='size-'])]:size-3\",\n\t\t\t\t\"icon-sm\": \"size-7 [&_svg:not([class*='size-'])]:size-3.5\",\n\t\t\t\t\"icon-lg\": \"size-9\",\n\t\t\t\t\"icon-touch\": \"size-11 [&_svg:not([class*='size-'])]:size-5\",\n\t\t\t\t\"icon-xl\": \"size-14 [&_svg:not([class*='size-'])]:size-6\",\n\t\t\t},\n\t\t},\n\t\tdefaultVariants: {\n\t\t\tvariant: \"default\",\n\t\t\tsize: \"default\",\n\t\t},\n\t},\n);\n\ntype ButtonVariantProps = VariantProps<typeof buttonVariantsCva> & {\n\tclassName?: string;\n};\n\n/** Always twMerge so size/variant radius and consumer className cannot fight. */\nfunction buttonVariants({ className, ...props }: ButtonVariantProps = {}) {\n\treturn cn(buttonVariantsCva(props), className);\n}\n\nfunction Button({\n\tclassName,\n\tvariant = \"default\",\n\tsize = \"default\",\n\t...props\n}: ButtonPrimitive.Props & VariantProps<typeof buttonVariantsCva>) {\n\treturn (\n\t\t<ButtonPrimitive\n\t\t\tdata-slot=\"button\"\n\t\t\tclassName={buttonVariants({\n\t\t\t\tvariant,\n\t\t\t\tsize,\n\t\t\t\tclassName: typeof className === \"string\" ? className : undefined,\n\t\t\t})}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nexport { Button, buttonVariants };\n"]}
|
package/package.json
CHANGED
package/src/theme.css
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/* Alhajero Onyx & Gold palette (brand kit).
|
|
2
2
|
Light: cream surfaces + onyx primary. Dark: gold primary on onyx-950 canvas.
|
|
3
3
|
Hex anchors (kit): cream-50 #FFFBF2, cream-100 #FBF4E4, cream-200 #F3E8CF,
|
|
4
|
-
onyx-900 #15120F, onyx-950 #0C0A08, gold-300 #EBC565, gold-
|
|
5
|
-
gold-700 #8A611A. Dark canvas / theme-color prefer onyx-950
|
|
4
|
+
onyx-900 #15120F, onyx-950 #0C0A08, gold-300 #EBC565, gold-400 #D9A545,
|
|
5
|
+
gold-500 #C99A3B, gold-700 #8A611A. Dark canvas / theme-color prefer onyx-950.
|
|
6
|
+
Dark primary fill uses gold-400 (active); gold-500 stays the logo / accent anchor.
|
|
6
7
|
This file is the only color-token source.
|
|
7
8
|
Import it after `tailwindcss`. Do not copy these values into an app.
|
|
8
9
|
CSS only: no JavaScript and no client boundary.
|
|
@@ -133,7 +134,8 @@
|
|
|
133
134
|
--card-foreground: var(--cream-50);
|
|
134
135
|
--popover: var(--onyx-900);
|
|
135
136
|
--popover-foreground: var(--cream-50);
|
|
136
|
-
|
|
137
|
+
/* gold-400 reads active on onyx; gold-500 looked disabled as a solid fill. */
|
|
138
|
+
--primary: var(--gold-400);
|
|
137
139
|
--primary-foreground: var(--onyx-950);
|
|
138
140
|
--secondary: var(--onyx-800);
|
|
139
141
|
--secondary-foreground: var(--cream-50);
|
|
@@ -147,27 +149,27 @@
|
|
|
147
149
|
--border: var(--onyx-700);
|
|
148
150
|
/* Slightly lighter than --border so filled fields still read. */
|
|
149
151
|
--input: var(--onyx-600);
|
|
150
|
-
--ring: var(--gold-
|
|
152
|
+
--ring: var(--gold-400);
|
|
151
153
|
--gold-text: var(--gold-300);
|
|
152
154
|
--hairline: color-mix(in oklch, var(--cream-50) 10%, transparent);
|
|
153
155
|
--table-row-highlight: color-mix(
|
|
154
156
|
in oklch,
|
|
155
|
-
var(--gold-
|
|
157
|
+
var(--gold-400) 16%,
|
|
156
158
|
var(--onyx-800)
|
|
157
159
|
);
|
|
158
|
-
--chart-1: var(--gold-
|
|
160
|
+
--chart-1: var(--gold-400);
|
|
159
161
|
--chart-2: var(--onyx-300);
|
|
160
162
|
--chart-3: var(--gold-300);
|
|
161
163
|
--chart-4: var(--onyx-500);
|
|
162
164
|
--chart-5: var(--gold-600);
|
|
163
165
|
--sidebar: var(--onyx-900);
|
|
164
166
|
--sidebar-foreground: var(--cream-50);
|
|
165
|
-
--sidebar-primary: var(--gold-
|
|
167
|
+
--sidebar-primary: var(--gold-400);
|
|
166
168
|
--sidebar-primary-foreground: var(--onyx-950);
|
|
167
169
|
--sidebar-accent: var(--onyx-800);
|
|
168
170
|
--sidebar-accent-foreground: var(--cream-50);
|
|
169
171
|
--sidebar-border: var(--onyx-700);
|
|
170
|
-
--sidebar-ring: var(--gold-
|
|
172
|
+
--sidebar-ring: var(--gold-400);
|
|
171
173
|
--font-sans: var(--font-inter), Inter, ui-sans-serif, sans-serif, system-ui;
|
|
172
174
|
--font-serif:
|
|
173
175
|
var(--font-outfit), Outfit, ui-sans-serif, sans-serif, system-ui;
|