@brightlocal/ui-components 3.0.0 → 3.2.0
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 +7 -1
- package/component-meta.json +749 -53
- package/deprecations.json +114 -4
- package/dist/accordion.cjs +1 -1
- package/dist/accordion.d.ts +36 -0
- package/dist/accordion.d.ts.map +1 -1
- package/dist/accordion.js +74 -61
- package/dist/alert-dialog.cjs +1 -1
- package/dist/alert-dialog.d.ts +32 -3
- package/dist/alert-dialog.d.ts.map +1 -1
- package/dist/alert-dialog.js +61 -58
- package/dist/alert.cjs +1 -1
- package/dist/alert.d.ts.map +1 -1
- package/dist/alert.js +58 -57
- package/dist/badge.cjs +1 -1
- package/dist/badge.d.ts +9 -0
- package/dist/badge.d.ts.map +1 -1
- package/dist/badge.js +50 -30
- package/dist/banner.cjs +1 -0
- package/dist/banner.d.ts +81 -0
- package/dist/banner.d.ts.map +1 -0
- package/dist/banner.js +176 -0
- package/dist/blocks/empty-state.cjs +1 -1
- package/dist/blocks/empty-state.d.ts +4 -3
- package/dist/blocks/empty-state.d.ts.map +1 -1
- package/dist/blocks/empty-state.js +50 -57
- package/dist/blocks/progress-state.d.ts +2 -2
- package/dist/blocks/sidebar.cjs +1 -1
- package/dist/blocks/sidebar.d.ts +17 -0
- package/dist/blocks/sidebar.d.ts.map +1 -1
- package/dist/blocks/sidebar.js +8 -2
- package/dist/brand-illustration-motif.d.ts +1 -1
- package/dist/button-group.cjs +1 -0
- package/dist/button-group.d.ts +36 -0
- package/dist/button-group.d.ts.map +1 -0
- package/dist/button-group.js +47 -0
- package/dist/button.cjs +1 -1
- package/dist/button.js +1 -1
- package/dist/card.cjs +1 -1
- package/dist/card.d.ts +105 -7
- package/dist/card.d.ts.map +1 -1
- package/dist/card.js +198 -101
- package/dist/chart.cjs +3 -3
- package/dist/chart.d.ts +270 -24
- package/dist/chart.d.ts.map +1 -1
- package/dist/chart.js +497 -322
- package/dist/checkbox.cjs +1 -1
- package/dist/checkbox.d.ts +1 -1
- package/dist/checkbox.d.ts.map +1 -1
- package/dist/checkbox.js +2 -1
- package/dist/chip.cjs +1 -1
- package/dist/chip.d.ts +38 -4
- package/dist/chip.d.ts.map +1 -1
- package/dist/chip.js +95 -81
- package/dist/combobox.cjs +1 -1
- package/dist/combobox.js +2 -2
- package/dist/command.cjs +1 -1
- package/dist/command.d.ts +23 -1
- package/dist/command.d.ts.map +1 -1
- package/dist/command.js +251 -225
- package/dist/data-table.cjs +1 -1
- package/dist/data-table.d.ts +201 -23
- package/dist/data-table.d.ts.map +1 -1
- package/dist/data-table.js +712 -568
- package/dist/date-picker.cjs +1 -1
- package/dist/date-picker.d.ts +13 -5
- package/dist/date-picker.d.ts.map +1 -1
- package/dist/date-picker.js +54 -53
- package/dist/field.cjs +1 -1
- package/dist/field.d.ts +8 -1
- package/dist/field.d.ts.map +1 -1
- package/dist/field.js +79 -52
- package/dist/global-layout.cjs +1 -1
- package/dist/global-layout.d.ts +105 -13
- package/dist/global-layout.d.ts.map +1 -1
- package/dist/global-layout.js +146 -129
- package/dist/grid.d.ts +26 -3
- package/dist/grid.d.ts.map +1 -1
- package/dist/hooks/use-breakpoint.cjs +1 -1
- package/dist/hooks/use-breakpoint.d.ts +1 -1
- package/dist/hooks/use-breakpoint.d.ts.map +1 -1
- package/dist/hooks/use-breakpoint.js +1 -0
- package/dist/hooks/use-mobile.cjs +1 -0
- package/dist/hooks/use-mobile.js +8 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +594 -553
- package/dist/info-tooltip.cjs +1 -0
- package/dist/info-tooltip.d.ts +39 -0
- package/dist/info-tooltip.d.ts.map +1 -0
- package/dist/info-tooltip.js +41 -0
- package/dist/input-chip.cjs +1 -1
- package/dist/input-chip.js +1 -1
- package/dist/input-group.cjs +1 -1
- package/dist/input-group.d.ts +33 -2
- package/dist/input-group.d.ts.map +1 -1
- package/dist/input-group.js +167 -54
- package/dist/input-otp.cjs +1 -1
- package/dist/input-otp.js +9 -9
- package/dist/input-password.cjs +1 -1
- package/dist/input-password.d.ts +45 -15
- package/dist/input-password.d.ts.map +1 -1
- package/dist/input-password.js +31 -30
- package/dist/input.cjs +1 -1
- package/dist/input.js +10 -10
- package/dist/lib/block-illustration.cjs +1 -1
- package/dist/lib/block-illustration.d.ts +4 -1
- package/dist/lib/block-illustration.d.ts.map +1 -1
- package/dist/lib/block-illustration.js +12 -11
- package/dist/lib/empty-chip.cjs +1 -0
- package/dist/lib/empty-chip.d.ts +4 -0
- package/dist/lib/empty-chip.d.ts.map +1 -0
- package/dist/lib/empty-chip.js +13 -0
- package/dist/lib/utils.cjs +1 -1
- package/dist/lib/utils.d.ts.map +1 -1
- package/dist/lib/utils.js +4 -3
- package/dist/list.cjs +1 -1
- package/dist/list.js +1 -1
- package/dist/multi-select-filter.cjs +1 -0
- package/dist/multi-select-filter.d.ts +178 -0
- package/dist/multi-select-filter.d.ts.map +1 -0
- package/dist/multi-select-filter.js +463 -0
- package/dist/pagination.cjs +1 -1
- package/dist/pagination.d.ts +3 -0
- package/dist/pagination.d.ts.map +1 -1
- package/dist/pagination.js +57 -57
- package/dist/progress.cjs +1 -1
- package/dist/progress.d.ts +123 -16
- package/dist/progress.d.ts.map +1 -1
- package/dist/progress.js +89 -75
- package/dist/rating.cjs +1 -1
- package/dist/rating.js +18 -18
- package/dist/relative-date.cjs +1 -0
- package/dist/relative-date.d.ts +65 -0
- package/dist/relative-date.d.ts.map +1 -0
- package/dist/relative-date.js +128 -0
- package/dist/scroll-area.cjs +1 -1
- package/dist/scroll-area.d.ts +15 -6
- package/dist/scroll-area.d.ts.map +1 -1
- package/dist/scroll-area.js +38 -36
- package/dist/select.cjs +2 -2
- package/dist/select.d.ts +24 -3
- package/dist/select.d.ts.map +1 -1
- package/dist/select.js +130 -110
- package/dist/sheet.cjs +1 -1
- package/dist/sheet.d.ts +78 -2
- package/dist/sheet.d.ts.map +1 -1
- package/dist/sheet.js +192 -85
- package/dist/single-select-filter.cjs +1 -0
- package/dist/single-select-filter.d.ts +81 -0
- package/dist/single-select-filter.d.ts.map +1 -0
- package/dist/single-select-filter.js +226 -0
- package/dist/sonner.cjs +1 -1
- package/dist/sonner.d.ts.map +1 -1
- package/dist/sonner.js +22 -22
- package/dist/split-layout.cjs +1 -1
- package/dist/split-layout.d.ts +1 -1
- package/dist/split-layout.js +13 -13
- package/dist/table.cjs +1 -1
- package/dist/table.d.ts +45 -4
- package/dist/table.d.ts.map +1 -1
- package/dist/table.js +90 -73
- package/dist/tabs.cjs +1 -1
- package/dist/tabs.d.ts +12 -1
- package/dist/tabs.d.ts.map +1 -1
- package/dist/tabs.js +148 -126
- package/dist/textarea.cjs +1 -1
- package/dist/textarea.js +1 -1
- package/dist/tooltip.cjs +1 -1
- package/dist/tooltip.d.ts +38 -36
- package/dist/tooltip.d.ts.map +1 -1
- package/dist/tooltip.js +262 -73
- package/dist/typography-heading.cjs +1 -1
- package/dist/typography-heading.d.ts +13 -0
- package/dist/typography-heading.d.ts.map +1 -1
- package/dist/typography-heading.js +32 -21
- package/dist/typography-text.cjs +1 -1
- package/dist/typography-text.d.ts +15 -2
- package/dist/typography-text.d.ts.map +1 -1
- package/dist/typography-text.js +35 -24
- package/dist/typography.d.ts +1 -1
- package/package.json +5 -6
- package/src/blocks/empty-state.tsx +17 -24
- package/src/blocks/progress-state.tsx +2 -2
- package/src/blocks/sidebar.tsx +26 -2
- package/src/components/accordion.tsx +82 -27
- package/src/components/alert-dialog.tsx +50 -5
- package/src/components/alert.tsx +16 -8
- package/src/components/badge.tsx +40 -3
- package/src/components/banner.tsx +288 -0
- package/src/components/brand-illustration-motif.tsx +1 -1
- package/src/components/button-group.tsx +112 -0
- package/src/components/button.tsx +1 -1
- package/src/components/card.tsx +249 -27
- package/src/components/chart.tsx +586 -53
- package/src/components/checkbox.tsx +1 -1
- package/src/components/chip.tsx +83 -10
- package/src/components/combobox.tsx +2 -2
- package/src/components/command.tsx +56 -4
- package/src/components/data-table.tsx +842 -199
- package/src/components/date-picker.tsx +18 -7
- package/src/components/field.tsx +81 -12
- package/src/components/global-layout.tsx +176 -38
- package/src/components/grid.tsx +34 -3
- package/src/components/info-tooltip.tsx +94 -0
- package/src/components/input-chip.tsx +1 -1
- package/src/components/input-group.tsx +246 -11
- package/src/components/input-otp.tsx +1 -1
- package/src/components/input-password.tsx +56 -22
- package/src/components/input.tsx +1 -1
- package/src/components/list.tsx +1 -1
- package/src/components/multi-select-filter.tsx +912 -0
- package/src/components/pagination.tsx +10 -3
- package/src/components/progress.tsx +190 -31
- package/src/components/rating.tsx +1 -1
- package/src/components/relative-date.tsx +230 -0
- package/src/components/scroll-area.tsx +23 -10
- package/src/components/select.tsx +65 -11
- package/src/components/sheet.tsx +240 -4
- package/src/components/single-select-filter.tsx +443 -0
- package/src/components/sonner.tsx +16 -5
- package/src/components/split-layout.tsx +2 -2
- package/src/components/table.tsx +71 -11
- package/src/components/tabs.tsx +93 -46
- package/src/components/textarea.tsx +1 -1
- package/src/components/tooltip.tsx +440 -68
- package/src/components/typography-heading.tsx +24 -0
- package/src/components/typography-text.tsx +27 -3
- package/src/components/typography.tsx +1 -1
- package/src/hooks/use-breakpoint.ts +2 -1
- package/src/index.ts +6 -0
- package/src/lib/block-illustration.tsx +5 -1
- package/src/lib/empty-chip.ts +24 -0
- package/src/lib/utils.ts +1 -0
package/dist/textarea.js
CHANGED
package/dist/tooltip.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("react/jsx-runtime"),V=require("react"),U=require("@radix-ui/react-popover"),J=require("@radix-ui/react-slot"),A=require("@brightlocal/ui-components/lib/utils");function F(t){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const l=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(i,n,l.get?l:{enumerable:!0,get:()=>t[n]})}}return i.default=t,Object.freeze(i)}const e=F(V),y=F(U),L=e.createContext({delayDuration:0,skipDelayDuration:0});function K({delayDuration:t=0,skipDelayDuration:i=0,children:n}){const l=e.useMemo(()=>({delayDuration:t,skipDelayDuration:i}),[t,i]);return p.jsx(L.Provider,{value:l,children:n})}function a(t,i){return n=>{t?.(n),n.defaultPrevented||i(n)}}const Q=200,M=e.createContext(null);function q(){const t=e.useContext(M);if(!t)throw new Error("Tooltip components must be used within <Tooltip>");return t}function W({open:t,defaultOpen:i=!1,onOpenChange:n,children:l}){const{delayDuration:v}=e.useContext(L),[k,x]=e.useState(i??!1),m=t!==void 0,d=m?t:k,f=e.useRef(void 0),g=e.useRef(void 0),P=e.useRef(null),T=e.useRef("hover"),c=e.useRef(null),b=e.useId(),s=e.useCallback(o=>{o||(T.current="hover"),m||x(o),n?.(o)},[m,n]),r=e.useCallback(()=>{f.current!==void 0&&(clearTimeout(f.current),f.current=void 0),g.current!==void 0&&(clearTimeout(g.current),g.current=void 0)},[]);e.useEffect(()=>r,[r]);const u=e.useCallback(()=>{r(),T.current!=="touch"&&(v>0?g.current=setTimeout(()=>s(!0),v):s(!0))},[r,v,s]),C=e.useCallback(()=>{r(),T.current!=="touch"&&(f.current=setTimeout(()=>s(!1),Q))},[r,s]),O=e.useCallback(o=>{o.pointerType!=="touch"&&u()},[u]),R=e.useCallback(o=>{o.pointerType!=="touch"&&(c.current=null,C())},[C]),j=e.useCallback(o=>{c.current=o.pointerType==="touch"?"touch":"mouse"},[]),w=e.useCallback(()=>{c.current=null},[]),E=e.useCallback(()=>{const o=c.current;c.current=null,o==="touch"&&(r(),d?s(!1):(T.current="touch",s(!0)))},[r,d,s]),N=e.useCallback(()=>{c.current||u()},[u]),I=e.useCallback(()=>{C()},[C]),h=e.useCallback(()=>{r()},[r]),_=e.useCallback(o=>{o.pointerType!=="touch"&&C()},[C]),D=e.useCallback(o=>{const S=o.target;S instanceof Node&&P.current?.contains(S)&&o.preventDefault()},[]),z=e.useCallback(o=>{o||(r(),s(!1))},[r,s]),G=e.useMemo(()=>({open:d,tooltipId:b,triggerRef:P,onTriggerPointerEnter:O,onTriggerPointerLeave:R,onTriggerPointerDown:j,onTriggerPointerCancel:w,onTriggerClick:E,onTriggerFocus:N,onTriggerBlur:I,onContentPointerEnter:h,onContentPointerLeave:_,onContentInteractOutside:D}),[d,b,O,R,j,w,E,N,I,h,_,D]);return p.jsx(M.Provider,{value:G,children:p.jsx(y.Root,{open:d,onOpenChange:z,children:l})})}const H=e.forwardRef(({dataHook:t,trackingEl:i,trackingLabel:n,asChild:l,children:v,onBlur:k,onClick:x,onFocus:m,onPointerCancel:d,onPointerDown:f,onPointerEnter:g,onPointerLeave:P,...T},c)=>{const{open:b,tooltipId:s,triggerRef:r,onTriggerPointerEnter:u,onTriggerPointerLeave:C,onTriggerPointerDown:O,onTriggerPointerCancel:R,onTriggerClick:j,onTriggerFocus:w,onTriggerBlur:E}=q(),N=e.useCallback(h=>{r.current=h,typeof c=="function"?c(h):c&&(c.current=h)},[c,r]),I=l?J.Slot:"button";return p.jsx(y.Anchor,{asChild:!0,children:p.jsx(I,{ref:N,"data-slot":"tooltip-trigger",...T,"aria-describedby":b?s:void 0,"data-hook":t,"data-tracking-el":i,"data-tracking-label":n,type:l?void 0:"button",onBlur:a(k,E),onClick:a(x,j),onFocus:a(m,w),onPointerCancel:a(d,R),onPointerDown:a(f,O),onPointerEnter:a(g,u),onPointerLeave:a(P,C),children:v})})});H.displayName="TooltipTrigger";const B=e.forwardRef(({className:t,side:i="top",sideOffset:n=0,dataHook:l,trackingEl:v,trackingLabel:k,hideArrow:x=!1,children:m,onInteractOutside:d,onPointerEnter:f,onPointerLeave:g,...P},T)=>{const{tooltipId:c,onContentPointerEnter:b,onContentPointerLeave:s,onContentInteractOutside:r}=q();return p.jsx(y.Portal,{children:p.jsxs(y.Content,{ref:T,className:A.cn("bg-secondary text-secondary-foreground text-body-xs z-50 w-max max-w-sm rounded-md px-3 py-1.5",A.FLOATING_CONTENT_ANIMATION,"**:data-[slot=tooltip-arrow]:-translate-y-px",t),"data-hook":l,"data-slot":"tooltip-content","data-tracking-el":v,"data-tracking-label":k,side:i,sideOffset:n,onCloseAutoFocus:u=>u.preventDefault(),onOpenAutoFocus:u=>u.preventDefault(),...P,role:"none",onInteractOutside:a(d,r),onPointerEnter:a(f,b),onPointerLeave:a(g,s),children:[p.jsx("span",{id:c,role:"tooltip",children:m}),!x&&p.jsx(y.Arrow,{className:"fill-secondary","data-slot":"tooltip-arrow",height:7,width:14})]})})});B.displayName="TooltipContent";exports.Tooltip=W;exports.TooltipContent=B;exports.TooltipProvider=K;exports.TooltipTrigger=H;
|
package/dist/tooltip.d.ts
CHANGED
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import * as
|
|
3
|
-
interface TooltipProviderProps
|
|
2
|
+
import * as PopoverPrimitive from "@radix-ui/react-popover";
|
|
3
|
+
interface TooltipProviderProps {
|
|
4
|
+
/**
|
|
5
|
+
* The duration in ms to wait before showing the tooltip.
|
|
6
|
+
* @default 0
|
|
7
|
+
*/
|
|
4
8
|
delayDuration?: number;
|
|
9
|
+
/**
|
|
10
|
+
* The duration in ms to skip the delay when moving between tooltips.
|
|
11
|
+
* @default 0
|
|
12
|
+
*/
|
|
5
13
|
skipDelayDuration?: number;
|
|
14
|
+
children: React.ReactNode;
|
|
6
15
|
}
|
|
7
16
|
/**
|
|
8
17
|
* TooltipProvider - Wraps your application or a section of it to provide shared tooltip configuration.
|
|
@@ -20,12 +29,19 @@ interface TooltipProviderProps extends React.ComponentProps<typeof TooltipPrimit
|
|
|
20
29
|
* @param delayDuration - The duration in ms to wait before showing the tooltip (default: 0)
|
|
21
30
|
* @param skipDelayDuration - The duration in ms to skip the delay when moving between tooltips (default: 0)
|
|
22
31
|
*/
|
|
23
|
-
declare function TooltipProvider({ delayDuration, skipDelayDuration,
|
|
32
|
+
declare function TooltipProvider({ delayDuration, skipDelayDuration, children, }: TooltipProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
24
33
|
/**
|
|
25
|
-
* Tooltip - Displays a popup with additional information
|
|
34
|
+
* Tooltip - Displays a popup with additional information.
|
|
35
|
+
*
|
|
36
|
+
* Toggletip behaviour by input type:
|
|
37
|
+
* - **Mouse / pen / keyboard**: opens on hover or focus, closes when the pointer
|
|
38
|
+
* leaves (after a short grace period so the pointer can move onto the content)
|
|
39
|
+
* or focus moves away.
|
|
40
|
+
* - **Touch**: a tap toggles it. While open it ignores hover/blur signals so the
|
|
41
|
+
* text can be long-pressed and copied; it closes on a second tap of the
|
|
42
|
+
* trigger, a tap outside, or Escape.
|
|
26
43
|
*
|
|
27
44
|
* @example
|
|
28
|
-
* // Basic usage (requires TooltipProvider wrapper):
|
|
29
45
|
* <Tooltip>
|
|
30
46
|
* <TooltipTrigger asChild>
|
|
31
47
|
* <Button>Hover me</Button>
|
|
@@ -36,50 +52,36 @@ declare function TooltipProvider({ delayDuration, skipDelayDuration, ...props }:
|
|
|
36
52
|
* </Tooltip>
|
|
37
53
|
*
|
|
38
54
|
* @remarks
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
* multiple tooltips.
|
|
55
|
+
* Wrap your app once in a TooltipProvider to share `delayDuration` across all
|
|
56
|
+
* tooltips. Without one the provider defaults (no delay) apply.
|
|
42
57
|
*/
|
|
43
|
-
declare function Tooltip({
|
|
44
|
-
interface TooltipTriggerProps extends React.
|
|
58
|
+
declare function Tooltip({ open: controlledOpen, defaultOpen, onOpenChange, children, }: React.ComponentProps<typeof PopoverPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
|
|
59
|
+
interface TooltipTriggerProps extends React.ComponentPropsWithoutRef<"button"> {
|
|
45
60
|
/**
|
|
46
|
-
* Data hook for automated testing, rendered as the `data-hook` attribute
|
|
47
|
-
* (the platform test-selector contract).
|
|
48
|
-
*
|
|
61
|
+
* Data hook for automated testing, rendered as the `data-hook` attribute.
|
|
49
62
|
* Optional because `TooltipTrigger` is commonly used with `asChild`, where the
|
|
50
|
-
* child element
|
|
51
|
-
* `asChild` is set, the child's `data-hook` wins over this one.
|
|
63
|
+
* child element already carries its own `dataHook`.
|
|
52
64
|
*/
|
|
53
65
|
dataHook?: string;
|
|
54
|
-
/**
|
|
55
|
-
* Optional analytics element identifier
|
|
56
|
-
*/
|
|
66
|
+
/** Optional analytics element identifier */
|
|
57
67
|
trackingEl?: string;
|
|
58
|
-
/**
|
|
59
|
-
* Optional analytics label context
|
|
60
|
-
*/
|
|
68
|
+
/** Optional analytics label context */
|
|
61
69
|
trackingLabel?: string;
|
|
70
|
+
/** Render as child element using Radix Slot */
|
|
71
|
+
asChild?: boolean;
|
|
62
72
|
}
|
|
63
|
-
declare const TooltipTrigger: React.ForwardRefExoticComponent<
|
|
64
|
-
interface TooltipContentProps extends React.
|
|
65
|
-
/**
|
|
66
|
-
* Required data-hook attribute for testing and analytics
|
|
67
|
-
*/
|
|
73
|
+
declare const TooltipTrigger: React.ForwardRefExoticComponent<TooltipTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
74
|
+
interface TooltipContentProps extends Omit<React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content>, "onOpenAutoFocus" | "onCloseAutoFocus"> {
|
|
75
|
+
/** Required data-hook attribute for testing and analytics */
|
|
68
76
|
dataHook: string;
|
|
69
|
-
/**
|
|
70
|
-
* Optional analytics element identifier
|
|
71
|
-
*/
|
|
77
|
+
/** Optional analytics element identifier */
|
|
72
78
|
trackingEl?: string;
|
|
73
|
-
/**
|
|
74
|
-
* Optional analytics label context
|
|
75
|
-
*/
|
|
79
|
+
/** Optional analytics label context */
|
|
76
80
|
trackingLabel?: string;
|
|
77
|
-
/**
|
|
78
|
-
* Hide the tooltip arrow
|
|
79
|
-
*/
|
|
81
|
+
/** Hide the tooltip arrow */
|
|
80
82
|
hideArrow?: boolean;
|
|
81
83
|
}
|
|
82
|
-
declare const TooltipContent: React.ForwardRefExoticComponent<
|
|
84
|
+
declare const TooltipContent: React.ForwardRefExoticComponent<TooltipContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
83
85
|
export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };
|
|
84
86
|
export type { TooltipContentProps, TooltipProviderProps, TooltipTriggerProps };
|
|
85
87
|
//# sourceMappingURL=tooltip.d.ts.map
|
package/dist/tooltip.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tooltip.d.ts","sourceRoot":"","sources":["../../src/components/tooltip.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,gBAAgB,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"tooltip.d.ts","sourceRoot":"","sources":["../../src/components/tooltip.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,gBAAgB,MAAM,yBAAyB,CAAC;AAU5D,UAAU,oBAAoB;IAC5B;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAcD;;;;;;;;;;;;;;;GAeG;AACH,iBAAS,eAAe,CAAC,EACvB,aAAiB,EACjB,iBAAqB,EACrB,QAAQ,GACT,EAAE,oBAAoB,2CAUtB;AAqED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,iBAAS,OAAO,CAAC,EACf,IAAI,EAAE,cAAc,EACpB,WAAmB,EACnB,YAAY,EACZ,QAAQ,GACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,gBAAgB,CAAC,IAAI,CAAC,2CA8LpD;AAID,UAAU,mBAAoB,SAAQ,KAAK,CAAC,wBAAwB,CAAC,QAAQ,CAAC;IAC5E;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,4CAA4C;IAC5C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,uCAAuC;IACvC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,+CAA+C;IAC/C,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,QAAA,MAAM,cAAc,+FA+EnB,CAAC;AAMF,UAAU,mBAAoB,SAAQ,IAAI,CACxC,KAAK,CAAC,wBAAwB,CAAC,OAAO,gBAAgB,CAAC,OAAO,CAAC,EAC/D,iBAAiB,GAAG,kBAAkB,CACvC;IACC,6DAA6D;IAC7D,QAAQ,EAAE,MAAM,CAAC;IACjB,4CAA4C;IAC5C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,uCAAuC;IACvC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,6BAA6B;IAC7B,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,QAAA,MAAM,cAAc,4FA4EnB,CAAC;AAIF,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,eAAe,EAAE,CAAC;AACpE,YAAY,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,CAAC"}
|
package/dist/tooltip.js
CHANGED
|
@@ -1,83 +1,272 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import * as
|
|
3
|
-
import * as
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { jsx as T, jsxs as j } from "react/jsx-runtime";
|
|
2
|
+
import * as e from "react";
|
|
3
|
+
import * as y from "@radix-ui/react-popover";
|
|
4
|
+
import { Slot as G } from "@radix-ui/react-slot";
|
|
5
|
+
import { cn as V, FLOATING_CONTENT_ANIMATION as z } from "@brightlocal/ui-components/lib/utils";
|
|
6
|
+
const _ = e.createContext(
|
|
7
|
+
{
|
|
8
|
+
delayDuration: 0,
|
|
9
|
+
skipDelayDuration: 0
|
|
10
|
+
}
|
|
11
|
+
);
|
|
12
|
+
function X({
|
|
13
|
+
delayDuration: n = 0,
|
|
14
|
+
skipDelayDuration: s = 0,
|
|
15
|
+
children: c
|
|
9
16
|
}) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
delayDuration: t,
|
|
14
|
-
skipDelayDuration: r,
|
|
15
|
-
...a
|
|
16
|
-
}
|
|
17
|
+
const d = e.useMemo(
|
|
18
|
+
() => ({ delayDuration: n, skipDelayDuration: s }),
|
|
19
|
+
[n, s]
|
|
17
20
|
);
|
|
21
|
+
return /* @__PURE__ */ T(_.Provider, { value: d, children: c });
|
|
22
|
+
}
|
|
23
|
+
function a(n, s) {
|
|
24
|
+
return (c) => {
|
|
25
|
+
n?.(c), c.defaultPrevented || s(c);
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
const U = 200, H = e.createContext(null);
|
|
29
|
+
function M() {
|
|
30
|
+
const n = e.useContext(H);
|
|
31
|
+
if (!n)
|
|
32
|
+
throw new Error("Tooltip components must be used within <Tooltip>");
|
|
33
|
+
return n;
|
|
18
34
|
}
|
|
19
|
-
function
|
|
20
|
-
|
|
35
|
+
function Y({
|
|
36
|
+
open: n,
|
|
37
|
+
defaultOpen: s = !1,
|
|
38
|
+
onOpenChange: c,
|
|
39
|
+
children: d
|
|
21
40
|
}) {
|
|
22
|
-
|
|
41
|
+
const { delayDuration: m } = e.useContext(_), [k, x] = e.useState(
|
|
42
|
+
s ?? !1
|
|
43
|
+
), v = n !== void 0, u = v ? n : k, p = e.useRef(void 0), f = e.useRef(void 0), P = e.useRef(null), g = e.useRef("hover"), r = e.useRef(null), h = e.useId(), i = e.useCallback(
|
|
44
|
+
(t) => {
|
|
45
|
+
t || (g.current = "hover"), v || x(t), c?.(t);
|
|
46
|
+
},
|
|
47
|
+
[v, c]
|
|
48
|
+
), o = e.useCallback(() => {
|
|
49
|
+
p.current !== void 0 && (clearTimeout(p.current), p.current = void 0), f.current !== void 0 && (clearTimeout(f.current), f.current = void 0);
|
|
50
|
+
}, []);
|
|
51
|
+
e.useEffect(() => o, [o]);
|
|
52
|
+
const l = e.useCallback(() => {
|
|
53
|
+
o(), g.current !== "touch" && (m > 0 ? f.current = setTimeout(() => i(!0), m) : i(!0));
|
|
54
|
+
}, [o, m, i]), C = e.useCallback(() => {
|
|
55
|
+
o(), g.current !== "touch" && (p.current = setTimeout(
|
|
56
|
+
() => i(!1),
|
|
57
|
+
U
|
|
58
|
+
));
|
|
59
|
+
}, [o, i]), w = e.useCallback(
|
|
60
|
+
(t) => {
|
|
61
|
+
t.pointerType !== "touch" && l();
|
|
62
|
+
},
|
|
63
|
+
[l]
|
|
64
|
+
), R = e.useCallback(
|
|
65
|
+
(t) => {
|
|
66
|
+
t.pointerType !== "touch" && (r.current = null, C());
|
|
67
|
+
},
|
|
68
|
+
[C]
|
|
69
|
+
), E = e.useCallback((t) => {
|
|
70
|
+
r.current = t.pointerType === "touch" ? "touch" : "mouse";
|
|
71
|
+
}, []), O = e.useCallback(() => {
|
|
72
|
+
r.current = null;
|
|
73
|
+
}, []), I = e.useCallback(() => {
|
|
74
|
+
const t = r.current;
|
|
75
|
+
r.current = null, t === "touch" && (o(), u ? i(!1) : (g.current = "touch", i(!0)));
|
|
76
|
+
}, [o, u, i]), N = e.useCallback(() => {
|
|
77
|
+
r.current || l();
|
|
78
|
+
}, [l]), A = e.useCallback(() => {
|
|
79
|
+
C();
|
|
80
|
+
}, [C]), b = e.useCallback(() => {
|
|
81
|
+
o();
|
|
82
|
+
}, [o]), F = e.useCallback(
|
|
83
|
+
(t) => {
|
|
84
|
+
t.pointerType !== "touch" && C();
|
|
85
|
+
},
|
|
86
|
+
[C]
|
|
87
|
+
), L = e.useCallback((t) => {
|
|
88
|
+
const D = t.target;
|
|
89
|
+
D instanceof Node && P.current?.contains(D) && t.preventDefault();
|
|
90
|
+
}, []), S = e.useCallback(
|
|
91
|
+
(t) => {
|
|
92
|
+
t || (o(), i(!1));
|
|
93
|
+
},
|
|
94
|
+
[o, i]
|
|
95
|
+
), B = e.useMemo(
|
|
96
|
+
() => ({
|
|
97
|
+
open: u,
|
|
98
|
+
tooltipId: h,
|
|
99
|
+
triggerRef: P,
|
|
100
|
+
onTriggerPointerEnter: w,
|
|
101
|
+
onTriggerPointerLeave: R,
|
|
102
|
+
onTriggerPointerDown: E,
|
|
103
|
+
onTriggerPointerCancel: O,
|
|
104
|
+
onTriggerClick: I,
|
|
105
|
+
onTriggerFocus: N,
|
|
106
|
+
onTriggerBlur: A,
|
|
107
|
+
onContentPointerEnter: b,
|
|
108
|
+
onContentPointerLeave: F,
|
|
109
|
+
onContentInteractOutside: L
|
|
110
|
+
}),
|
|
111
|
+
[
|
|
112
|
+
u,
|
|
113
|
+
h,
|
|
114
|
+
w,
|
|
115
|
+
R,
|
|
116
|
+
E,
|
|
117
|
+
O,
|
|
118
|
+
I,
|
|
119
|
+
N,
|
|
120
|
+
A,
|
|
121
|
+
b,
|
|
122
|
+
F,
|
|
123
|
+
L
|
|
124
|
+
]
|
|
125
|
+
);
|
|
126
|
+
return /* @__PURE__ */ T(H.Provider, { value: B, children: /* @__PURE__ */ T(y.Root, { open: u, onOpenChange: S, children: d }) });
|
|
23
127
|
}
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
128
|
+
const q = e.forwardRef(
|
|
129
|
+
({
|
|
130
|
+
dataHook: n,
|
|
131
|
+
trackingEl: s,
|
|
132
|
+
trackingLabel: c,
|
|
133
|
+
asChild: d,
|
|
134
|
+
children: m,
|
|
135
|
+
onBlur: k,
|
|
136
|
+
onClick: x,
|
|
137
|
+
onFocus: v,
|
|
138
|
+
onPointerCancel: u,
|
|
139
|
+
onPointerDown: p,
|
|
140
|
+
onPointerEnter: f,
|
|
141
|
+
onPointerLeave: P,
|
|
142
|
+
...g
|
|
143
|
+
}, r) => {
|
|
144
|
+
const {
|
|
145
|
+
open: h,
|
|
146
|
+
tooltipId: i,
|
|
147
|
+
triggerRef: o,
|
|
148
|
+
onTriggerPointerEnter: l,
|
|
149
|
+
onTriggerPointerLeave: C,
|
|
150
|
+
onTriggerPointerDown: w,
|
|
151
|
+
onTriggerPointerCancel: R,
|
|
152
|
+
onTriggerClick: E,
|
|
153
|
+
onTriggerFocus: O,
|
|
154
|
+
onTriggerBlur: I
|
|
155
|
+
} = M(), N = e.useCallback(
|
|
156
|
+
(b) => {
|
|
157
|
+
o.current = b, typeof r == "function" ? r(b) : r && (r.current = b);
|
|
158
|
+
},
|
|
159
|
+
[r, o]
|
|
160
|
+
), A = d ? G : "button";
|
|
161
|
+
return /* @__PURE__ */ T(y.Anchor, { asChild: !0, children: /* @__PURE__ */ T(
|
|
162
|
+
A,
|
|
163
|
+
{
|
|
164
|
+
ref: N,
|
|
165
|
+
"data-slot": "tooltip-trigger",
|
|
166
|
+
...g,
|
|
167
|
+
"aria-describedby": h ? i : void 0,
|
|
168
|
+
"data-hook": n,
|
|
169
|
+
"data-tracking-el": s,
|
|
170
|
+
"data-tracking-label": c,
|
|
171
|
+
type: d ? void 0 : "button",
|
|
172
|
+
onBlur: a(k, I),
|
|
173
|
+
onClick: a(x, E),
|
|
174
|
+
onFocus: a(v, O),
|
|
175
|
+
onPointerCancel: a(
|
|
176
|
+
u,
|
|
177
|
+
R
|
|
178
|
+
),
|
|
179
|
+
onPointerDown: a(
|
|
180
|
+
p,
|
|
181
|
+
w
|
|
182
|
+
),
|
|
183
|
+
onPointerEnter: a(
|
|
184
|
+
f,
|
|
185
|
+
l
|
|
186
|
+
),
|
|
187
|
+
onPointerLeave: a(
|
|
188
|
+
P,
|
|
189
|
+
C
|
|
190
|
+
),
|
|
191
|
+
children: m
|
|
192
|
+
}
|
|
193
|
+
) });
|
|
33
194
|
}
|
|
34
|
-
)
|
|
35
|
-
|
|
36
|
-
const
|
|
195
|
+
);
|
|
196
|
+
q.displayName = "TooltipTrigger";
|
|
197
|
+
const J = e.forwardRef(
|
|
37
198
|
({
|
|
38
|
-
className:
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
199
|
+
className: n,
|
|
200
|
+
side: s = "top",
|
|
201
|
+
sideOffset: c = 0,
|
|
202
|
+
dataHook: d,
|
|
203
|
+
trackingEl: m,
|
|
204
|
+
trackingLabel: k,
|
|
205
|
+
hideArrow: x = !1,
|
|
206
|
+
children: v,
|
|
207
|
+
onInteractOutside: u,
|
|
208
|
+
onPointerEnter: p,
|
|
209
|
+
onPointerLeave: f,
|
|
210
|
+
...P
|
|
211
|
+
}, g) => {
|
|
212
|
+
const {
|
|
213
|
+
tooltipId: r,
|
|
214
|
+
onContentPointerEnter: h,
|
|
215
|
+
onContentPointerLeave: i,
|
|
216
|
+
onContentInteractOutside: o
|
|
217
|
+
} = M();
|
|
218
|
+
return /* @__PURE__ */ T(y.Portal, { children: /* @__PURE__ */ j(
|
|
219
|
+
y.Content,
|
|
220
|
+
{
|
|
221
|
+
ref: g,
|
|
222
|
+
className: V(
|
|
223
|
+
"bg-secondary text-secondary-foreground text-body-xs z-50 w-max max-w-sm rounded-md px-3 py-1.5",
|
|
224
|
+
z,
|
|
225
|
+
"**:data-[slot=tooltip-arrow]:-translate-y-px",
|
|
226
|
+
n
|
|
227
|
+
),
|
|
228
|
+
"data-hook": d,
|
|
229
|
+
"data-slot": "tooltip-content",
|
|
230
|
+
"data-tracking-el": m,
|
|
231
|
+
"data-tracking-label": k,
|
|
232
|
+
side: s,
|
|
233
|
+
sideOffset: c,
|
|
234
|
+
onCloseAutoFocus: (l) => l.preventDefault(),
|
|
235
|
+
onOpenAutoFocus: (l) => l.preventDefault(),
|
|
236
|
+
...P,
|
|
237
|
+
role: "none",
|
|
238
|
+
onInteractOutside: a(
|
|
239
|
+
u,
|
|
240
|
+
o
|
|
241
|
+
),
|
|
242
|
+
onPointerEnter: a(
|
|
243
|
+
p,
|
|
244
|
+
h
|
|
245
|
+
),
|
|
246
|
+
onPointerLeave: a(
|
|
247
|
+
f,
|
|
248
|
+
i
|
|
249
|
+
),
|
|
250
|
+
children: [
|
|
251
|
+
/* @__PURE__ */ T("span", { id: r, role: "tooltip", children: v }),
|
|
252
|
+
!x && /* @__PURE__ */ T(
|
|
253
|
+
y.Arrow,
|
|
254
|
+
{
|
|
255
|
+
className: "fill-secondary",
|
|
256
|
+
"data-slot": "tooltip-arrow",
|
|
257
|
+
height: 7,
|
|
258
|
+
width: 14
|
|
259
|
+
}
|
|
260
|
+
)
|
|
261
|
+
]
|
|
262
|
+
}
|
|
263
|
+
) });
|
|
264
|
+
}
|
|
76
265
|
);
|
|
77
|
-
|
|
266
|
+
J.displayName = "TooltipContent";
|
|
78
267
|
export {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
268
|
+
Y as Tooltip,
|
|
269
|
+
J as TooltipContent,
|
|
270
|
+
X as TooltipProvider,
|
|
271
|
+
q as TooltipTrigger
|
|
83
272
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("react/jsx-runtime"),h=require("react"),m=require("@radix-ui/react-slot"),x=require("class-variance-authority"),j=require("@brightlocal/ui-components/lib/utils");function v(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const a in t)if(a!=="default"){const r=Object.getOwnPropertyDescriptor(t,a);Object.defineProperty(e,a,r.get?r:{enumerable:!0,get:()=>t[a]})}}return e.default=t,Object.freeze(e)}const O=v(h),S=x.cva("",{variants:{variant:{display:"text-display",page:"text-heading-page",section:"text-heading-section",subsection:"text-heading-subsection",compact:"text-heading-compact"},color:{default:"text-foreground",muted:"text-muted-foreground"},align:{left:"text-left",center:"text-center",right:"text-right"},tabular:{true:"tabular-nums",false:"proportional-nums"},truncate:{true:"block truncate"}},defaultVariants:{color:"default"}}),k={1:"page",2:"section",3:"subsection",4:"subsection",5:"subsection",6:"subsection"},o=O.forwardRef(({className:t,level:e,variant:a,color:r="default",align:c,tabular:i,truncate:s=!1,asChild:u=!1,dataHook:l,trackingEl:d,trackingLabel:g,...p},f)=>{const n=a??k[e],y=u?m.Slot:`h${e}`;return b.jsx(y,{ref:f,className:j.cn(S({variant:n,color:r,align:c,tabular:i,truncate:s}),t),"data-hook":l,"data-slot":"typography-heading","data-tracking-el":d||`typography-heading-${n}`,"data-tracking-label":g,...p})});o.displayName="TypographyHeading";exports.TypographyHeading=o;
|
|
@@ -77,6 +77,19 @@ interface TypographyHeadingProps extends React.ComponentProps<"h1"> {
|
|
|
77
77
|
* TypographyText `metric` (plus `tabular` if it must align), not a heading.
|
|
78
78
|
*/
|
|
79
79
|
tabular?: boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Clip overflowing text to a single line with an ellipsis — card titles in
|
|
82
|
+
* a fixed-width grid, panel headers beside actions; anywhere a title can
|
|
83
|
+
* outgrow its container. The surrounding layout must still allow the
|
|
84
|
+
* element to shrink: inside a flex row the element (or its wrapper) needs
|
|
85
|
+
* `min-w-0`, and in a grid column `minmax(0, …)` — otherwise the box grows
|
|
86
|
+
* instead of clipping. Forces `display: block` (an inline box cannot
|
|
87
|
+
* clip), so an inline `asChild` child becomes a block while truncating —
|
|
88
|
+
* a no-op on the default h1–h6. Single-line only by design; a multi-line
|
|
89
|
+
* clamp can follow if demand appears.
|
|
90
|
+
* @default false
|
|
91
|
+
*/
|
|
92
|
+
truncate?: boolean;
|
|
80
93
|
/**
|
|
81
94
|
* Render as a different element using Radix Slot pattern.
|
|
82
95
|
* When true, merges props onto the child element.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typography-heading.d.ts","sourceRoot":"","sources":["../../src/components/typography-heading.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B;;;;GAIG;AACH,KAAK,sBAAsB,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAEpD;;;;;;;;;;;;;;GAcG;AACH,KAAK,wBAAwB,GACzB,SAAS,GACT,MAAM,GACN,SAAS,GACT,YAAY,GACZ,SAAS,CAAC;AAEd;;GAEG;AACH,KAAK,sBAAsB,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;AAE1D;;;;;;GAMG;AACH,KAAK,sBAAsB,GAAG,SAAS,GAAG,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"typography-heading.d.ts","sourceRoot":"","sources":["../../src/components/typography-heading.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B;;;;GAIG;AACH,KAAK,sBAAsB,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAEpD;;;;;;;;;;;;;;GAcG;AACH,KAAK,wBAAwB,GACzB,SAAS,GACT,MAAM,GACN,SAAS,GACT,YAAY,GACZ,SAAS,CAAC;AAEd;;GAEG;AACH,KAAK,sBAAsB,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;AAE1D;;;;;;GAMG;AACH,KAAK,sBAAsB,GAAG,SAAS,GAAG,OAAO,CAAC;AA4DlD;;;GAGG;AACH,UAAU,sBAAuB,SAAQ,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC;IACjE;;;;OAIG;IACH,KAAK,EAAE,sBAAsB,CAAC;IAC9B;;;;OAIG;IACH,OAAO,CAAC,EAAE,wBAAwB,CAAC;IACnC;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,sBAAsB,CAAC;IAC/B;;;;OAIG;IACH,KAAK,CAAC,EAAE,sBAAsB,CAAC;IAC/B;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;OAIG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;;;;;;GAUG;AACH,QAAA,MAAM,iBAAiB,gHA4CtB,CAAC;AAGF,OAAO,EAAE,iBAAiB,EAAE,CAAC;AAC7B,YAAY,EACV,sBAAsB,EACtB,sBAAsB,EACtB,wBAAwB,EACxB,sBAAsB,EACtB,sBAAsB,GACvB,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as m } from "react/jsx-runtime";
|
|
2
|
-
import * as
|
|
3
|
-
import { Slot as
|
|
4
|
-
import { cva as
|
|
5
|
-
import { cn as
|
|
6
|
-
const
|
|
2
|
+
import * as h from "react";
|
|
3
|
+
import { Slot as y } from "@radix-ui/react-slot";
|
|
4
|
+
import { cva as x } from "class-variance-authority";
|
|
5
|
+
import { cn as b } from "@brightlocal/ui-components/lib/utils";
|
|
6
|
+
const v = x("", {
|
|
7
7
|
variants: {
|
|
8
8
|
variant: {
|
|
9
9
|
display: "text-display",
|
|
@@ -29,19 +29,28 @@ const b = y("", {
|
|
|
29
29
|
tabular: {
|
|
30
30
|
true: "tabular-nums",
|
|
31
31
|
false: "proportional-nums"
|
|
32
|
+
},
|
|
33
|
+
// Boolean on purpose (no `false` class): unlike tabular there is no
|
|
34
|
+
// inherited context to undo — either the element clips or it doesn't.
|
|
35
|
+
// `block` is load-bearing: an inline asChild child (e.g. a `span`) cannot
|
|
36
|
+
// clip — overflow does not apply to non-replaced inlines — so the variant
|
|
37
|
+
// forces a block container. A no-op on the default h1–h6 (already block)
|
|
38
|
+
// and on flex/grid items (blockified by the layout).
|
|
39
|
+
truncate: {
|
|
40
|
+
true: "block truncate"
|
|
32
41
|
}
|
|
33
42
|
},
|
|
34
43
|
defaultVariants: {
|
|
35
44
|
color: "default"
|
|
36
45
|
}
|
|
37
|
-
}),
|
|
46
|
+
}), k = {
|
|
38
47
|
1: "page",
|
|
39
48
|
2: "section",
|
|
40
49
|
3: "subsection",
|
|
41
50
|
4: "subsection",
|
|
42
51
|
5: "subsection",
|
|
43
52
|
6: "subsection"
|
|
44
|
-
}, V =
|
|
53
|
+
}, V = h.forwardRef(
|
|
45
54
|
({
|
|
46
55
|
className: e,
|
|
47
56
|
level: t,
|
|
@@ -49,30 +58,32 @@ const b = y("", {
|
|
|
49
58
|
color: r = "default",
|
|
50
59
|
align: n,
|
|
51
60
|
tabular: i,
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
61
|
+
truncate: s = !1,
|
|
62
|
+
asChild: c = !1,
|
|
63
|
+
dataHook: d,
|
|
64
|
+
trackingEl: p,
|
|
65
|
+
trackingLabel: l,
|
|
56
66
|
...g
|
|
57
|
-
},
|
|
58
|
-
const a = o ??
|
|
67
|
+
}, u) => {
|
|
68
|
+
const a = o ?? k[t], f = c ? y : `h${t}`;
|
|
59
69
|
return /* @__PURE__ */ m(
|
|
60
|
-
|
|
70
|
+
f,
|
|
61
71
|
{
|
|
62
|
-
ref:
|
|
63
|
-
className:
|
|
64
|
-
|
|
72
|
+
ref: u,
|
|
73
|
+
className: b(
|
|
74
|
+
v({
|
|
65
75
|
variant: a,
|
|
66
76
|
color: r,
|
|
67
77
|
align: n,
|
|
68
|
-
tabular: i
|
|
78
|
+
tabular: i,
|
|
79
|
+
truncate: s
|
|
69
80
|
}),
|
|
70
81
|
e
|
|
71
82
|
),
|
|
72
|
-
"data-hook":
|
|
83
|
+
"data-hook": d,
|
|
73
84
|
"data-slot": "typography-heading",
|
|
74
|
-
"data-tracking-el":
|
|
75
|
-
"data-tracking-label":
|
|
85
|
+
"data-tracking-el": p || `typography-heading-${a}`,
|
|
86
|
+
"data-tracking-label": l,
|
|
76
87
|
...g
|
|
77
88
|
}
|
|
78
89
|
);
|
package/dist/typography-text.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("react/jsx-runtime"),b=require("react"),x=require("@radix-ui/react-slot"),g=require("class-variance-authority"),m=require("@brightlocal/ui-components/lib/utils");function h(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const r in t)if(r!=="default"){const o=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,o.get?o:{enumerable:!0,get:()=>t[r]})}}return e.default=t,Object.freeze(e)}const T=h(b),j=g.cva("",{variants:{variant:{body:"text-body","body-sm":"text-body-sm","body-xs":"text-body-xs",metric:"text-metric",code:"text-code"},color:{default:"text-foreground",muted:"text-muted-foreground",destructive:"text-destructive-foreground"},tabular:{true:"tabular-nums",false:"proportional-nums"},align:{left:"text-left",center:"text-center",right:"text-right"},truncate:{true:"block truncate"}},defaultVariants:{variant:"body",color:"default"}}),v={body:"p","body-sm":"p","body-xs":"p",metric:"span",code:"code"},a=T.forwardRef(({className:t,variant:e="body",color:r="default",tabular:o,align:c,truncate:n=!1,asChild:s=!1,dataHook:u,trackingEl:d,trackingLabel:l,...i},y)=>{const p=s?x.Slot:v[e];return f.jsx(p,{ref:y,className:m.cn(j({variant:e,color:r,tabular:o,align:c,truncate:n}),t),"data-hook":u,"data-slot":"typography-text","data-tracking-el":d||`typography-text-${e}`,"data-tracking-label":l,...i})});a.displayName="TypographyText";exports.TypographyText=a;
|