@boxcustodia/library 2.0.0-alpha.23 → 2.0.0-alpha.24
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/components/calendar/calendar.cjs.js +1 -1
- package/dist/components/calendar/calendar.es.js +1 -1
- package/dist/components/popover/popover.cjs.js +1 -1
- package/dist/components/popover/popover.es.js +1 -1
- package/dist/components/tag/tag.cjs.js +1 -1
- package/dist/components/tag/tag.es.js +37 -18
- package/dist/src/components/tag/tag.d.ts +2 -1
- package/package.json +1 -1
- package/src/components/calendar/calendar.tsx +1 -1
- package/src/components/popover/popover.tsx +1 -1
- package/src/components/tag/tag.stories.tsx +47 -2
- package/src/components/tag/tag.tsx +28 -6
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),w=require("date-fns/locale"),d=require("lucide-react"),C=require("react-day-picker"),f=require("../select/select.cjs.js"),o=require("../../lib/cn.cjs.js"),b=new Date().getFullYear(),N=new Date(b-100,0),j=new Date(b+100,11);function D({options:l=[],value:c,onChange:r}){const i=l.map(e=>({label:e.label??"",value:e.value??0})),u=i.find(e=>e.value===Number(c))??null;return s.jsx(f.Select,{items:i,value:u,icon:s.jsx(d.ChevronDownIcon,{className:f.selectTriggerIconClassName}),"aria-invalid":!1,className:"py-1 h-7 border-none font-medium! w-fit! [&>span]:capitalize",getLabel:e=>e.label,getId:e=>String(e.value),onValueChange:e=>{!r||e===null||r({target:{value:String(e.value)}})}})}const
|
|
2
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),w=require("date-fns/locale"),d=require("lucide-react"),C=require("react-day-picker"),f=require("../select/select.cjs.js"),o=require("../../lib/cn.cjs.js"),b=new Date().getFullYear(),N=new Date(b-100,0),j=new Date(b+100,11);function D({options:l=[],value:c,onChange:r}){const i=l.map(e=>({label:e.label??"",value:e.value??0})),u=i.find(e=>e.value===Number(c))??null;return s.jsx(f.Select,{items:i,value:u,icon:s.jsx(d.ChevronDownIcon,{className:f.selectTriggerIconClassName}),"aria-invalid":!1,className:"py-1 h-7 border-none font-medium! w-fit! [&>span]:capitalize",getLabel:e=>e.label,getId:e=>String(e.value),onValueChange:e=>{!r||e===null||r({target:{value:String(e.value)}})}})}const m="relative flex size-(--cell-size) text-base sm:text-sm items-center justify-center rounded-lg text-foreground not-in-data-selected:hover:bg-accent disabled:pointer-events-none disabled:opacity-64 [&_svg:not([class*='opacity-'])]:opacity-80 [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0";function k({className:l,classNames:c,showOutsideDays:r=!0,components:i,mode:u="single",captionLayout:e="dropdown",startMonth:x=N,endMonth:v=j,...h}){const g={button_next:m,button_previous:m,caption_label:"text-base sm:text-sm font-medium flex items-center gap-2 h-full",day:"size-(--cell-size) text-sm py-px",day_button:o.cn(m,"in-data-disabled:pointer-events-none in-[.range-middle]:rounded-none in-[.range-end:not(.range-start)]:rounded-s-none in-[.range-start:not(.range-end)]:rounded-e-none in-[.range-middle]:in-data-selected:bg-accent in-data-selected:bg-primary in-[.range-middle]:in-data-selected:text-foreground in-data-disabled:text-muted-foreground/72 in-data-outside:text-muted-foreground/72 in-data-selected:in-data-outside:text-primary-foreground in-data-selected:text-primary-foreground in-data-disabled:line-through outline-none in-[[data-selected]:not(.range-middle)]:transition-[color,background-color,border-radius,box-shadow] focus-visible:z-1 focus-visible:ring-[3px] focus-visible:ring-ring/50"),dropdown:"absolute bg-popover inset-0 opacity-0",dropdown_root:"relative has-focus:border-ring has-focus:ring-ring/50 has-focus:ring-[3px] border border-input shadow-xs/5 rounded-lg px-[calc(--spacing(3)-1px)] h-9 sm:h-8 [&_svg:not([class*='opacity-'])]:opacity-80 [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:-me-1",dropdowns:"w-full flex items-center text-base sm:text-sm justify-center h-(--cell-size) gap-1.5 *:[span]:font-medium",hidden:"invisible",month:"w-full",month_caption:"relative mx-(--cell-size) px-1 mb-1 flex h-(--cell-size) items-center justify-center z-2",months:"relative flex flex-col sm:flex-row gap-2",nav:"absolute top-0 flex w-full justify-between z-1",outside:"text-muted-foreground data-selected:bg-accent/50 data-selected:text-muted-foreground",range_end:"range-end",range_middle:"range-middle",range_start:"range-start",today:"*:after:pointer-events-none *:after:absolute *:after:bottom-1 *:after:start-1/2 *:after:z-1 *:after:size-[3px] *:after:-translate-x-1/2 *:after:rounded-full *:after:bg-primary [&[data-selected]:not(.range-middle)>*]:after:bg-background [&[data-disabled]>*]:after:bg-foreground/30 *:after:transition-colors",week_number:"size-(--cell-size) p-0 text-xs font-medium text-muted-foreground/72",weekday:"size-(--cell-size) p-0 text-xs font-medium text-muted-foreground/72"},z=Object.keys(g).reduce((t,n)=>{const a=c?.[n],p=g[n];return t[n]=a?o.cn(p,a):p,t},{...g}),y={...{Dropdown:D,Chevron:({className:t,orientation:n,...a})=>n==="left"?s.jsx(d.ChevronLeftIcon,{className:o.cn(t,"rtl:rotate-180"),...a,"aria-hidden":"true"}):n==="right"?s.jsx(d.ChevronRightIcon,{className:o.cn(t,"rtl:rotate-180"),...a,"aria-hidden":"true"}):s.jsx(d.ChevronDownIcon,{className:t,...a,"aria-hidden":"true"})},...i},_={className:o.cn("w-fit [--cell-size:--spacing(10)] sm:[--cell-size:--spacing(9)]","rounded-xl border bg-background","in-data-[slot=popover-popup]:rounded-none in-data-[slot=popover-popup]:border-0 in-data-[slot=popover-popup]:bg-transparent in-data-[slot=popover-popup]:p-0",l),classNames:z,components:y,"data-slot":"calendar",formatters:{formatMonthDropdown:t=>t.toLocaleString("es",{month:"short"})},locale:w.es,weekStartsOn:1,captionLayout:e,startMonth:x,endMonth:v,mode:u,showOutsideDays:r,...h};return s.jsx(C.DayPicker,{..._})}exports.Calendar=k;
|
|
@@ -107,7 +107,7 @@ function P({
|
|
|
107
107
|
// Standalone container surface. Inside a popover (DatePicker) the
|
|
108
108
|
// popup already paints border + background + padding, so strip ours
|
|
109
109
|
// to avoid a double border.
|
|
110
|
-
"rounded-xl border bg-background
|
|
110
|
+
"rounded-xl border bg-background",
|
|
111
111
|
"in-data-[slot=popover-popup]:rounded-none in-data-[slot=popover-popup]:border-0 in-data-[slot=popover-popup]:bg-transparent in-data-[slot=popover-popup]:p-0",
|
|
112
112
|
d
|
|
113
113
|
),
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),t=require("@base-ui/react/popover"),s=require("../../lib/cn.cjs.js"),y=t.Popover.createHandle,P=t.Popover.Root;function x({className:e,children:r,...a}){return o.jsx(t.Popover.Trigger,{className:e,"data-slot":"popover-trigger",...a,children:r})}function h({children:e,className:r,side:a="bottom",align:i="center",sideOffset:d=4,alignOffset:l=0,tooltipStyle:n=!1,matchTriggerWidth:p=!1,anchor:c,portalProps:v,viewportClassName:u,...g}){return o.jsx(t.Popover.Portal,{...v,children:o.jsx(t.Popover.Positioner,{align:i,alignOffset:l,anchor:c,className:"z-50 h-(--positioner-height) w-(--positioner-width) max-w-(--available-width) transition-[top,left,right,bottom,transform] data-instant:transition-none","data-slot":"popover-positioner",side:a,sideOffset:d,style:p?{width:"var(--anchor-width)"}:void 0,children:o.jsx(t.Popover.Popup,{className:s.cn("relative flex h-(--popup-height,auto) origin-(--transform-origin) rounded-lg border bg-popover not-dark:bg-clip-padding text-popover-foreground shadow-lg/5 outline-none transition-[width,height,scale,opacity] before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)] has-data-[slot=calendar]:rounded-
|
|
2
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),t=require("@base-ui/react/popover"),s=require("../../lib/cn.cjs.js"),y=t.Popover.createHandle,P=t.Popover.Root;function x({className:e,children:r,...a}){return o.jsx(t.Popover.Trigger,{className:e,"data-slot":"popover-trigger",...a,children:r})}function h({children:e,className:r,side:a="bottom",align:i="center",sideOffset:d=4,alignOffset:l=0,tooltipStyle:n=!1,matchTriggerWidth:p=!1,anchor:c,portalProps:v,viewportClassName:u,...g}){return o.jsx(t.Popover.Portal,{...v,children:o.jsx(t.Popover.Positioner,{align:i,alignOffset:l,anchor:c,className:"z-50 h-(--positioner-height) w-(--positioner-width) max-w-(--available-width) transition-[top,left,right,bottom,transform] data-instant:transition-none","data-slot":"popover-positioner",side:a,sideOffset:d,style:p?{width:"var(--anchor-width)"}:void 0,children:o.jsx(t.Popover.Popup,{className:s.cn("relative flex h-(--popup-height,auto) origin-(--transform-origin) rounded-lg border bg-popover not-dark:bg-clip-padding text-popover-foreground shadow-lg/5 outline-none transition-[width,height,scale,opacity] before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)] has-data-[slot=calendar]:rounded-md has-data-[slot=calendar]:before:rounded-[calc(var(--radius-xl)-1px)] data-starting-style:scale-98 data-starting-style:opacity-0 dark:before:shadow-[0_-1px_--theme(--color-white/6%)]",p?"w-full":"w-(--popup-width,auto) max-w-72",n&&"w-fit text-balance rounded-md text-xs shadow-md/5 before:rounded-[calc(var(--radius-md)-1px)]",r),"data-slot":"popover-popup",...g,children:o.jsx(t.Popover.Viewport,{className:s.cn("relative size-full max-h-(--available-height) overflow-clip px-(--viewport-inline-padding) py-4 [--viewport-inline-padding:--spacing(4)] has-data-[slot=calendar]:p-2 data-instant:transition-none **:data-current:data-ending-style:opacity-0 **:data-current:data-starting-style:opacity-0 **:data-previous:data-ending-style:opacity-0 **:data-previous:data-starting-style:opacity-0 **:data-current:w-[calc(var(--popup-width)-2*var(--viewport-inline-padding)-2px)] **:data-previous:w-[calc(var(--popup-width)-2*var(--viewport-inline-padding)-2px)] **:data-current:opacity-100 **:data-previous:opacity-100 **:data-current:transition-opacity **:data-previous:transition-opacity",n?"py-1 [--viewport-inline-padding:--spacing(2)]":"not-data-transitioning:overflow-y-auto",u),"data-slot":"popover-viewport",children:e})})})})}function j({...e}){return o.jsx(t.Popover.Close,{"data-slot":"popover-close",...e})}function w({className:e,...r}){return o.jsx(t.Popover.Title,{className:s.cn("font-semibold text-lg leading-none",e),"data-slot":"popover-title",...r})}function f({className:e,...r}){return o.jsx(t.Popover.Description,{className:s.cn("text-muted-foreground text-sm",e),"data-slot":"popover-description",...r})}function C({trigger:e,children:r,title:a,description:i,side:d,align:l,sideOffset:n,alignOffset:p,tooltipStyle:c,matchTriggerWidth:v,anchor:u,className:g,classNames:m,...b}){return o.jsxs(P,{...b,children:[e!==void 0&&o.jsx(x,{render:e}),o.jsxs(h,{side:d,align:l,sideOffset:n,alignOffset:p,tooltipStyle:c,matchTriggerWidth:v,anchor:u,className:g,viewportClassName:m?.viewport,children:[(a??i)&&o.jsxs("div",{className:"mb-2",children:[a&&o.jsx(w,{children:a}),i&&o.jsx(f,{children:i})]}),r]})]})}Object.defineProperty(exports,"PopoverPrimitive",{enumerable:!0,get:()=>t.Popover});exports.Popover=C;exports.PopoverClose=j;exports.PopoverContent=h;exports.PopoverCreateHandle=y;exports.PopoverDescription=f;exports.PopoverPopup=h;exports.PopoverRoot=P;exports.PopoverTitle=w;exports.PopoverTrigger=x;
|
|
@@ -48,7 +48,7 @@ function b({
|
|
|
48
48
|
e.Popup,
|
|
49
49
|
{
|
|
50
50
|
className: d(
|
|
51
|
-
"relative flex h-(--popup-height,auto) origin-(--transform-origin) rounded-lg border bg-popover not-dark:bg-clip-padding text-popover-foreground shadow-lg/5 outline-none transition-[width,height,scale,opacity] before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)] has-data-[slot=calendar]:rounded-
|
|
51
|
+
"relative flex h-(--popup-height,auto) origin-(--transform-origin) rounded-lg border bg-popover not-dark:bg-clip-padding text-popover-foreground shadow-lg/5 outline-none transition-[width,height,scale,opacity] before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)] has-data-[slot=calendar]:rounded-md has-data-[slot=calendar]:before:rounded-[calc(var(--radius-xl)-1px)] data-starting-style:scale-98 data-starting-style:opacity-0 dark:before:shadow-[0_-1px_--theme(--color-white/6%)]",
|
|
52
52
|
p ? "w-full" : "w-(--popup-width,auto) max-w-72",
|
|
53
53
|
n && "w-fit text-balance rounded-md text-xs shadow-md/5 before:rounded-[calc(var(--radius-md)-1px)]",
|
|
54
54
|
a
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("@base-ui/react/merge-props"),
|
|
2
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("@base-ui/react/merge-props"),g=require("@base-ui/react/use-render"),u=require("class-variance-authority"),b=require("../../lib/cn.cjs.js"),t=u.cva("group/tag inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 aria-invalid:border-error aria-invalid:ring-error/20 dark:aria-invalid:ring-error/40 [&>svg]:pointer-events-none [&>svg]:size-3!",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",error:"bg-error/10 text-error focus-visible:ring-error/20 dark:bg-error/20 dark:focus-visible:ring-error/40 [a]:hover:bg-error/20",success:"bg-success/10 text-success focus-visible:ring-success/20 dark:bg-success/20 dark:focus-visible:ring-success/40 [a]:hover:bg-success/20",warning:"bg-warning/10 text-warning focus-visible:ring-warning/20 dark:bg-warning/20 dark:focus-visible:ring-warning/40 [a]:hover:bg-warning/20",outline:"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",ghost:"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline"},color:{gray:"bg-gray-100 text-gray-600",red:"bg-red-100 text-red-600",orange:"bg-orange-100 text-orange-600",amber:"bg-amber-100 text-amber-600",green:"bg-green-100 text-green-600",teal:"bg-teal-100 text-teal-600",cyan:"bg-cyan-100 text-cyan-600",sky:"bg-sky-100 text-sky-600",blue:"bg-blue-100 text-blue-600",indigo:"bg-indigo-100 text-indigo-600",violet:"bg-violet-100 text-violet-600",purple:"bg-purple-100 text-purple-600",pink:"bg-pink-100 text-pink-600",rose:"bg-rose-100 text-rose-600"}}});function d({className:n,variant:i,color:e,render:a,...o}){const r=e?void 0:i??"default";return g.useRender({defaultTagName:"span",props:s.mergeProps({className:b.cn(t({variant:r,color:e}),n)},o),render:a,state:{slot:"tag",variant:r,color:e}})}exports.Tag=d;exports.tagVariants=t;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { mergeProps as
|
|
3
|
-
import { useRender as
|
|
2
|
+
import { mergeProps as a } from "@base-ui/react/merge-props";
|
|
3
|
+
import { useRender as g } from "@base-ui/react/use-render";
|
|
4
4
|
import { cva as s } from "class-variance-authority";
|
|
5
|
-
import { cn as
|
|
6
|
-
const
|
|
5
|
+
import { cn as b } from "../../lib/cn.es.js";
|
|
6
|
+
const d = s(
|
|
7
7
|
"group/tag inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 aria-invalid:border-error aria-invalid:ring-error/20 dark:aria-invalid:ring-error/40 [&>svg]:pointer-events-none [&>svg]:size-3!",
|
|
8
8
|
{
|
|
9
9
|
variants: {
|
|
@@ -16,35 +16,54 @@ const g = s(
|
|
|
16
16
|
outline: "border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",
|
|
17
17
|
ghost: "hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",
|
|
18
18
|
link: "text-primary underline-offset-4 hover:underline"
|
|
19
|
+
},
|
|
20
|
+
color: {
|
|
21
|
+
gray: "bg-gray-100 text-gray-600",
|
|
22
|
+
red: "bg-red-100 text-red-600",
|
|
23
|
+
orange: "bg-orange-100 text-orange-600",
|
|
24
|
+
amber: "bg-amber-100 text-amber-600",
|
|
25
|
+
green: "bg-green-100 text-green-600",
|
|
26
|
+
teal: "bg-teal-100 text-teal-600",
|
|
27
|
+
cyan: "bg-cyan-100 text-cyan-600",
|
|
28
|
+
sky: "bg-sky-100 text-sky-600",
|
|
29
|
+
blue: "bg-blue-100 text-blue-600",
|
|
30
|
+
indigo: "bg-indigo-100 text-indigo-600",
|
|
31
|
+
violet: "bg-violet-100 text-violet-600",
|
|
32
|
+
purple: "bg-purple-100 text-purple-600",
|
|
33
|
+
pink: "bg-pink-100 text-pink-600",
|
|
34
|
+
rose: "bg-rose-100 text-rose-600"
|
|
19
35
|
}
|
|
20
|
-
},
|
|
21
|
-
defaultVariants: {
|
|
22
|
-
variant: "default"
|
|
23
36
|
}
|
|
24
37
|
}
|
|
25
38
|
);
|
|
26
|
-
function
|
|
27
|
-
className:
|
|
28
|
-
variant:
|
|
29
|
-
|
|
39
|
+
function p({
|
|
40
|
+
className: t,
|
|
41
|
+
variant: i,
|
|
42
|
+
color: r,
|
|
43
|
+
render: n,
|
|
30
44
|
...o
|
|
31
45
|
}) {
|
|
32
|
-
|
|
46
|
+
const e = r ? void 0 : i ?? "default";
|
|
47
|
+
return g({
|
|
33
48
|
defaultTagName: "span",
|
|
34
|
-
props:
|
|
49
|
+
props: a(
|
|
35
50
|
{
|
|
36
|
-
className:
|
|
51
|
+
className: b(
|
|
52
|
+
d({ variant: e, color: r }),
|
|
53
|
+
t
|
|
54
|
+
)
|
|
37
55
|
},
|
|
38
56
|
o
|
|
39
57
|
),
|
|
40
|
-
render:
|
|
58
|
+
render: n,
|
|
41
59
|
state: {
|
|
42
60
|
slot: "tag",
|
|
43
|
-
variant:
|
|
61
|
+
variant: e,
|
|
62
|
+
color: r
|
|
44
63
|
}
|
|
45
64
|
});
|
|
46
65
|
}
|
|
47
66
|
export {
|
|
48
|
-
|
|
49
|
-
|
|
67
|
+
p as Tag,
|
|
68
|
+
d as tagVariants
|
|
50
69
|
};
|
|
@@ -2,6 +2,7 @@ import { useRender } from '@base-ui/react/use-render';
|
|
|
2
2
|
import { VariantProps } from 'class-variance-authority';
|
|
3
3
|
declare const tagVariants: (props?: ({
|
|
4
4
|
variant?: "default" | "link" | "error" | "success" | "warning" | "outline" | "secondary" | "ghost" | null | undefined;
|
|
5
|
+
color?: "blue" | "cyan" | "gray" | "green" | "indigo" | "orange" | "pink" | "purple" | "red" | "teal" | "violet" | "amber" | "sky" | "rose" | null | undefined;
|
|
5
6
|
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
6
|
-
declare function Tag({ className, variant, render, ...props }: useRender.ComponentProps<"span"> & VariantProps<typeof tagVariants>): import('react').ReactElement<unknown, string | import('react').JSXElementConstructor<any>>;
|
|
7
|
+
declare function Tag({ className, variant, color, render, ...props }: useRender.ComponentProps<"span"> & VariantProps<typeof tagVariants>): import('react').ReactElement<unknown, string | import('react').JSXElementConstructor<any>>;
|
|
7
8
|
export { Tag, tagVariants };
|
package/package.json
CHANGED
|
@@ -162,7 +162,7 @@ export function Calendar({
|
|
|
162
162
|
// Standalone container surface. Inside a popover (DatePicker) the
|
|
163
163
|
// popup already paints border + background + padding, so strip ours
|
|
164
164
|
// to avoid a double border.
|
|
165
|
-
"rounded-xl border bg-background
|
|
165
|
+
"rounded-xl border bg-background",
|
|
166
166
|
"in-data-[slot=popover-popup]:rounded-none in-data-[slot=popover-popup]:border-0 in-data-[slot=popover-popup]:bg-transparent in-data-[slot=popover-popup]:p-0",
|
|
167
167
|
className,
|
|
168
168
|
),
|
|
@@ -66,7 +66,7 @@ export function PopoverPopup({
|
|
|
66
66
|
>
|
|
67
67
|
<PopoverPrimitive.Popup
|
|
68
68
|
className={cn(
|
|
69
|
-
"relative flex h-(--popup-height,auto) origin-(--transform-origin) rounded-lg border bg-popover not-dark:bg-clip-padding text-popover-foreground shadow-lg/5 outline-none transition-[width,height,scale,opacity] before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)] has-data-[slot=calendar]:rounded-
|
|
69
|
+
"relative flex h-(--popup-height,auto) origin-(--transform-origin) rounded-lg border bg-popover not-dark:bg-clip-padding text-popover-foreground shadow-lg/5 outline-none transition-[width,height,scale,opacity] before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)] has-data-[slot=calendar]:rounded-md has-data-[slot=calendar]:before:rounded-[calc(var(--radius-xl)-1px)] data-starting-style:scale-98 data-starting-style:opacity-0 dark:before:shadow-[0_-1px_--theme(--color-white/6%)]",
|
|
70
70
|
matchTriggerWidth ? "w-full" : "w-(--popup-width,auto) max-w-72",
|
|
71
71
|
tooltipStyle &&
|
|
72
72
|
"w-fit text-balance rounded-md text-xs shadow-md/5 before:rounded-[calc(var(--radius-md)-1px)]",
|
|
@@ -43,6 +43,49 @@ export const Variants: Story = {
|
|
|
43
43
|
),
|
|
44
44
|
};
|
|
45
45
|
|
|
46
|
+
const PALETTE = [
|
|
47
|
+
"gray",
|
|
48
|
+
"red",
|
|
49
|
+
"orange",
|
|
50
|
+
"amber",
|
|
51
|
+
"green",
|
|
52
|
+
"teal",
|
|
53
|
+
"cyan",
|
|
54
|
+
"sky",
|
|
55
|
+
"blue",
|
|
56
|
+
"indigo",
|
|
57
|
+
"violet",
|
|
58
|
+
"purple",
|
|
59
|
+
"pink",
|
|
60
|
+
"rose",
|
|
61
|
+
] as const;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Use the `color` prop to pick from a curated palette when `variant` semantics
|
|
65
|
+
* (error/success/warning) don't fit — e.g. mapping many domain states to a
|
|
66
|
+
* stable set of visual treatments.
|
|
67
|
+
*
|
|
68
|
+
* Each color applies the same recipe (tinted background + saturated text), so
|
|
69
|
+
* the look stays consistent without hand-picking hex values.
|
|
70
|
+
*
|
|
71
|
+
* `color` takes precedence over `variant`: when both are set, the palette wins.
|
|
72
|
+
*
|
|
73
|
+
* ```tsx
|
|
74
|
+
* <Tag color="blue">In review</Tag>
|
|
75
|
+
* ```
|
|
76
|
+
*/
|
|
77
|
+
export const Colors: Story = {
|
|
78
|
+
render: () => (
|
|
79
|
+
<div className="flex flex-wrap items-center gap-2">
|
|
80
|
+
{PALETTE.map((color) => (
|
|
81
|
+
<Tag key={color} color={color}>
|
|
82
|
+
{color}
|
|
83
|
+
</Tag>
|
|
84
|
+
))}
|
|
85
|
+
</div>
|
|
86
|
+
),
|
|
87
|
+
};
|
|
88
|
+
|
|
46
89
|
/**
|
|
47
90
|
* Compose icons directly as children — JSX order determines position.
|
|
48
91
|
*
|
|
@@ -178,8 +221,10 @@ export const Closable: Story = {
|
|
|
178
221
|
};
|
|
179
222
|
|
|
180
223
|
/**
|
|
181
|
-
*
|
|
182
|
-
* Classes merge with the variant
|
|
224
|
+
* Escape hatch for colors outside the curated `color` palette: override with
|
|
225
|
+
* custom Tailwind classes via `className`. Classes merge with the variant
|
|
226
|
+
* defaults through `cn` (tailwind-merge). Prefer the `color` prop when the hue
|
|
227
|
+
* exists in the palette — it guarantees the accessible recipe and dark mode.
|
|
183
228
|
*/
|
|
184
229
|
export const CustomColors: Story = {
|
|
185
230
|
render: () => (
|
|
@@ -25,31 +25,53 @@ const tagVariants = cva(
|
|
|
25
25
|
"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",
|
|
26
26
|
link: "text-primary underline-offset-4 hover:underline",
|
|
27
27
|
},
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
color: {
|
|
29
|
+
gray: "bg-gray-100 text-gray-600",
|
|
30
|
+
red: "bg-red-100 text-red-600",
|
|
31
|
+
orange: "bg-orange-100 text-orange-600",
|
|
32
|
+
amber: "bg-amber-100 text-amber-600",
|
|
33
|
+
green: "bg-green-100 text-green-600",
|
|
34
|
+
teal: "bg-teal-100 text-teal-600",
|
|
35
|
+
cyan: "bg-cyan-100 text-cyan-600",
|
|
36
|
+
sky: "bg-sky-100 text-sky-600",
|
|
37
|
+
blue: "bg-blue-100 text-blue-600",
|
|
38
|
+
indigo: "bg-indigo-100 text-indigo-600",
|
|
39
|
+
violet: "bg-violet-100 text-violet-600",
|
|
40
|
+
purple: "bg-purple-100 text-purple-600",
|
|
41
|
+
pink: "bg-pink-100 text-pink-600",
|
|
42
|
+
rose: "bg-rose-100 text-rose-600",
|
|
43
|
+
},
|
|
31
44
|
},
|
|
32
45
|
},
|
|
33
46
|
);
|
|
34
47
|
|
|
35
48
|
function Tag({
|
|
36
49
|
className,
|
|
37
|
-
variant
|
|
50
|
+
variant,
|
|
51
|
+
color,
|
|
38
52
|
render,
|
|
39
53
|
...props
|
|
40
54
|
}: useRender.ComponentProps<"span"> & VariantProps<typeof tagVariants>) {
|
|
55
|
+
// `color` (curated palette) takes precedence over `variant`. When no color is
|
|
56
|
+
// set we fall back to the default variant so bare <Tag> keeps working.
|
|
57
|
+
const resolvedVariant = color ? undefined : (variant ?? "default");
|
|
58
|
+
|
|
41
59
|
return useRender({
|
|
42
60
|
defaultTagName: "span",
|
|
43
61
|
props: mergeProps<"span">(
|
|
44
62
|
{
|
|
45
|
-
className: cn(
|
|
63
|
+
className: cn(
|
|
64
|
+
tagVariants({ variant: resolvedVariant, color }),
|
|
65
|
+
className,
|
|
66
|
+
),
|
|
46
67
|
},
|
|
47
68
|
props,
|
|
48
69
|
),
|
|
49
70
|
render,
|
|
50
71
|
state: {
|
|
51
72
|
slot: "tag",
|
|
52
|
-
variant,
|
|
73
|
+
variant: resolvedVariant,
|
|
74
|
+
color,
|
|
53
75
|
},
|
|
54
76
|
});
|
|
55
77
|
}
|