@brightlocal/ui-components 2.27.0 → 3.1.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 +568 -143
- package/deprecations.json +298 -1
- 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.js +18 -18
- package/dist/alert.cjs +1 -1
- package/dist/alert.d.ts +11 -1
- package/dist/alert.d.ts.map +1 -1
- package/dist/alert.js +31 -28
- package/dist/avatar.cjs +1 -1
- package/dist/avatar.js +4 -4
- package/dist/badge.cjs +1 -1
- package/dist/badge.d.ts.map +1 -1
- package/dist/badge.js +15 -11
- package/dist/blocks/empty-state.cjs +1 -0
- package/dist/blocks/empty-state.d.ts +172 -0
- package/dist/blocks/empty-state.d.ts.map +1 -0
- package/dist/blocks/empty-state.js +147 -0
- package/dist/blocks/input-list.cjs +2 -2
- package/dist/blocks/input-list.d.ts.map +1 -1
- package/dist/blocks/input-list.js +124 -108
- package/dist/blocks/progress-state.cjs +1 -0
- package/dist/blocks/{progress-screen.d.ts → progress-state.d.ts} +30 -18
- package/dist/blocks/progress-state.d.ts.map +1 -0
- package/dist/blocks/{progress-screen.js → progress-state.js} +100 -71
- package/dist/blocks/sidebar.cjs +1 -1
- package/dist/blocks/sidebar.d.ts.map +1 -1
- package/dist/blocks/sidebar.js +160 -161
- package/dist/breadcrumb.cjs +1 -1
- package/dist/breadcrumb.js +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 +12 -12
- package/dist/calendar.cjs +1 -1
- package/dist/calendar.d.ts.map +1 -1
- package/dist/calendar.js +37 -38
- package/dist/callout.cjs +1 -1
- package/dist/callout.d.ts +24 -2
- package/dist/callout.d.ts.map +1 -1
- package/dist/callout.js +57 -55
- package/dist/card.cjs +1 -1
- package/dist/card.d.ts +42 -3
- package/dist/card.d.ts.map +1 -1
- package/dist/card.js +102 -91
- package/dist/chart-empty.cjs +1 -0
- package/dist/chart-empty.d.ts +59 -0
- package/dist/chart-empty.d.ts.map +1 -0
- package/dist/chart-empty.js +29 -0
- package/dist/chart.cjs +6 -6
- package/dist/chart.d.ts +46 -13
- package/dist/chart.d.ts.map +1 -1
- package/dist/chart.js +172 -157
- 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 +100 -84
- package/dist/combobox.cjs +2 -2
- package/dist/combobox.d.ts.map +1 -1
- package/dist/combobox.js +81 -79
- 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 +248 -225
- package/dist/context-menu.cjs +1 -1
- package/dist/context-menu.d.ts.map +1 -1
- package/dist/context-menu.js +26 -29
- package/dist/data-table.cjs +1 -1
- package/dist/data-table.d.ts +75 -10
- package/dist/data-table.d.ts.map +1 -1
- package/dist/data-table.js +346 -334
- 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/description.cjs +1 -1
- package/dist/description.js +5 -5
- package/dist/dialog.cjs +1 -1
- package/dist/dialog.js +20 -20
- package/dist/drawer.cjs +1 -1
- package/dist/drawer.d.ts.map +1 -1
- package/dist/drawer.js +8 -11
- package/dist/dropdown-menu.cjs +1 -1
- package/dist/dropdown-menu.d.ts.map +1 -1
- package/dist/dropdown-menu.js +17 -20
- 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 +96 -65
- package/dist/global-layout.cjs +1 -1
- package/dist/global-layout.d.ts +130 -12
- package/dist/global-layout.d.ts.map +1 -1
- package/dist/global-layout.js +146 -127
- package/dist/grid.cjs +1 -0
- package/dist/grid.d.ts +56 -0
- package/dist/grid.d.ts.map +1 -0
- package/dist/grid.js +32 -0
- package/dist/header.d.ts +13 -0
- package/dist/header.d.ts.map +1 -1
- package/dist/hooks/use-delayed-pending.cjs +1 -0
- package/dist/hooks/use-delayed-pending.d.ts +34 -0
- package/dist/hooks/use-delayed-pending.d.ts.map +1 -0
- package/dist/hooks/use-delayed-pending.js +17 -0
- package/dist/hooks/use-mobile.cjs +1 -0
- package/dist/hooks/use-mobile.js +8 -0
- package/dist/hover-card.cjs +1 -1
- package/dist/hover-card.js +13 -13
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +554 -527
- package/dist/input-chip.cjs +1 -1
- package/dist/input-chip.js +25 -25
- package/dist/input-group.cjs +1 -1
- package/dist/input-group.js +9 -9
- 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 +17 -9
- package/dist/input-password.d.ts.map +1 -1
- package/dist/input-password.js +73 -72
- package/dist/input.cjs +1 -1
- package/dist/input.js +9 -9
- package/dist/label.cjs +1 -1
- package/dist/label.d.ts.map +1 -1
- package/dist/label.js +25 -28
- package/dist/lib/block-illustration.cjs +1 -0
- package/dist/lib/block-illustration.d.ts +28 -0
- package/dist/lib/block-illustration.d.ts.map +1 -0
- package/dist/lib/block-illustration.js +21 -0
- package/dist/lib/empty-canvas.cjs +1 -0
- package/dist/lib/empty-canvas.d.ts +27 -0
- package/dist/lib/empty-canvas.d.ts.map +1 -0
- package/dist/lib/empty-canvas.js +62 -0
- 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/optical-center.cjs +1 -0
- package/dist/lib/optical-center.d.ts +12 -0
- package/dist/lib/optical-center.d.ts.map +1 -0
- package/dist/lib/optical-center.js +11 -0
- package/dist/lib/utils.cjs +1 -1
- package/dist/lib/utils.d.ts.map +1 -1
- package/dist/lib/utils.js +28 -5
- package/dist/list.cjs +1 -1
- package/dist/list.d.ts.map +1 -1
- package/dist/list.js +62 -58
- package/dist/map.cjs +1 -1
- package/dist/map.d.ts +60 -2
- package/dist/map.d.ts.map +1 -1
- package/dist/map.js +187 -164
- package/dist/media-empty.cjs +1 -0
- package/dist/media-empty.d.ts +72 -0
- package/dist/media-empty.d.ts.map +1 -0
- package/dist/media-empty.js +45 -0
- package/dist/menubar.cjs +1 -1
- package/dist/menubar.d.ts.map +1 -1
- package/dist/menubar.js +17 -20
- package/dist/navigation-menu.cjs +1 -1
- package/dist/navigation-menu.js +7 -7
- package/dist/pagination.cjs +1 -1
- package/dist/pagination.d.ts +130 -1
- package/dist/pagination.d.ts.map +1 -1
- package/dist/pagination.js +193 -102
- package/dist/progress.cjs +1 -1
- package/dist/progress.d.ts +2 -26
- package/dist/progress.d.ts.map +1 -1
- package/dist/progress.js +79 -118
- 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 +13 -2
- package/dist/select.d.ts.map +1 -1
- package/dist/select.js +92 -87
- package/dist/separator.cjs +1 -1
- package/dist/separator.js +8 -8
- package/dist/sheet.cjs +1 -1
- package/dist/sheet.js +2 -2
- package/dist/skeleton.cjs +1 -1
- package/dist/skeleton.d.ts +38 -3
- package/dist/skeleton.d.ts.map +1 -1
- package/dist/skeleton.js +43 -20
- package/dist/sonner.cjs +1 -1
- package/dist/sonner.js +26 -26
- package/dist/stepper.cjs +1 -1
- package/dist/stepper.js +40 -40
- package/dist/table.cjs +1 -1
- package/dist/table.d.ts.map +1 -1
- package/dist/table.js +31 -28
- package/dist/tabs.cjs +1 -1
- package/dist/tabs.js +1 -1
- package/dist/text-reveal-motion.d.ts +10 -0
- package/dist/text-reveal-motion.d.ts.map +1 -1
- package/dist/textarea.cjs +1 -1
- package/dist/textarea.js +11 -11
- package/dist/toggle.cjs +1 -1
- package/dist/toggle.js +8 -8
- package/dist/tooltip.cjs +1 -1
- package/dist/tooltip.js +8 -8
- package/dist/typography-heading.cjs +1 -0
- package/dist/typography-heading.d.ts +129 -0
- package/dist/typography-heading.d.ts.map +1 -0
- package/dist/typography-heading.js +95 -0
- package/dist/typography-text.cjs +1 -0
- package/dist/typography-text.d.ts +127 -0
- package/dist/typography-text.d.ts.map +1 -0
- package/dist/typography-text.js +92 -0
- package/dist/typography.d.ts +13 -0
- package/dist/typography.d.ts.map +1 -1
- package/package.json +35 -7
- package/src/blocks/empty-state.tsx +412 -0
- package/src/blocks/input-list.tsx +66 -36
- package/src/blocks/{progress-screen.tsx → progress-state.tsx} +154 -93
- package/src/blocks/sidebar.tsx +25 -26
- package/src/components/accordion.tsx +82 -27
- package/src/components/alert-dialog.tsx +2 -2
- package/src/components/alert.tsx +27 -13
- package/src/components/avatar.tsx +1 -1
- package/src/components/badge.tsx +8 -4
- package/src/components/breadcrumb.tsx +1 -1
- package/src/components/button-group.tsx +112 -0
- package/src/components/button.tsx +4 -4
- package/src/components/calendar.tsx +5 -6
- package/src/components/callout.tsx +48 -15
- package/src/components/card.tsx +89 -19
- package/src/components/chart-empty.tsx +116 -0
- package/src/components/chart.tsx +103 -32
- package/src/components/chip.tsx +88 -13
- package/src/components/combobox.tsx +12 -10
- package/src/components/command.tsx +64 -13
- package/src/components/context-menu.tsx +6 -9
- package/src/components/data-table.tsx +135 -20
- package/src/components/date-picker.tsx +18 -7
- package/src/components/description.tsx +1 -1
- package/src/components/dialog.tsx +2 -2
- package/src/components/drawer.tsx +2 -5
- package/src/components/dropdown-menu.tsx +8 -11
- package/src/components/field.tsx +89 -16
- package/src/components/global-layout.tsx +210 -39
- package/src/components/grid.tsx +130 -0
- package/src/components/header.tsx +13 -0
- package/src/components/hover-card.tsx +1 -1
- package/src/components/input-chip.tsx +1 -1
- package/src/components/input-group.tsx +1 -1
- package/src/components/input-otp.tsx +1 -1
- package/src/components/input-password.tsx +24 -12
- package/src/components/input.tsx +1 -1
- package/src/components/label.tsx +10 -13
- package/src/components/list.tsx +13 -9
- package/src/components/map.tsx +101 -5
- package/src/components/media-empty.tsx +156 -0
- package/src/components/menubar.tsx +7 -10
- package/src/components/navigation-menu.tsx +1 -1
- package/src/components/pagination.tsx +286 -1
- package/src/components/progress.tsx +35 -113
- package/src/components/scroll-area.tsx +23 -10
- package/src/components/select.tsx +35 -10
- package/src/components/separator.tsx +1 -1
- package/src/components/sheet.tsx +2 -2
- package/src/components/skeleton.tsx +78 -7
- package/src/components/sonner.tsx +2 -2
- package/src/components/stepper.tsx +3 -3
- package/src/components/table.tsx +6 -3
- package/src/components/tabs.tsx +1 -1
- package/src/components/text-reveal-motion.tsx +10 -0
- package/src/components/textarea.tsx +1 -1
- package/src/components/toggle.tsx +1 -1
- package/src/components/tooltip.tsx +1 -1
- package/src/components/typography-heading.tsx +253 -0
- package/src/components/typography-text.tsx +250 -0
- package/src/components/typography.tsx +13 -0
- package/src/hooks/use-delayed-pending.ts +60 -0
- package/src/index.ts +11 -1
- package/src/lib/block-illustration.tsx +88 -0
- package/src/lib/empty-canvas.tsx +128 -0
- package/src/lib/empty-chip.ts +24 -0
- package/src/lib/optical-center.tsx +45 -0
- package/src/lib/utils.ts +26 -0
- package/dist/blocks/progress-screen.cjs +0 -1
- package/dist/blocks/progress-screen.d.ts.map +0 -1
|
@@ -14,6 +14,11 @@ import * as React from "react";
|
|
|
14
14
|
* <TypographyP dataHook="w2">Processing</TypographyP>
|
|
15
15
|
* </TextRevealMotion>
|
|
16
16
|
* ```
|
|
17
|
+
*
|
|
18
|
+
* @deprecated Removal planned once product usage is gone (DS-907). Cycling
|
|
19
|
+
* phrases on a timer violates the Loading pattern's Honesty principle — the
|
|
20
|
+
* phrases are not stages the backend reported. Use a section skeleton, or a
|
|
21
|
+
* named-stages running screen driven by real stage data (Patterns / Loading).
|
|
17
22
|
*/
|
|
18
23
|
export interface TextRevealMotionProps extends Omit<React.ComponentPropsWithoutRef<"div">, "children"> {
|
|
19
24
|
/**
|
|
@@ -72,6 +77,11 @@ export interface TextRevealMotionProps extends Omit<React.ComponentPropsWithoutR
|
|
|
72
77
|
* The ball rolls across each child, revealing it via clip-path, holds,
|
|
73
78
|
* then rolls back and cycles to the next child. Supports any Typography
|
|
74
79
|
* component as children.
|
|
80
|
+
*
|
|
81
|
+
* @deprecated Removal planned once product usage is gone (DS-907). Cycling
|
|
82
|
+
* phrases on a timer violates the Loading pattern's Honesty principle — the
|
|
83
|
+
* phrases are not stages the backend reported. Use a section skeleton, or a
|
|
84
|
+
* named-stages running screen driven by real stage data (Patterns / Loading).
|
|
75
85
|
*/
|
|
76
86
|
declare const TextRevealMotion: React.ForwardRefExoticComponent<TextRevealMotionProps & React.RefAttributes<HTMLDivElement>>;
|
|
77
87
|
export { TextRevealMotion };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-reveal-motion.d.ts","sourceRoot":"","sources":["../../src/components/text-reveal-motion.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AA4H/B
|
|
1
|
+
{"version":3,"file":"text-reveal-motion.d.ts","sourceRoot":"","sources":["../../src/components/text-reveal-motion.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AA4H/B;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,WAAW,qBAAsB,SAAQ,IAAI,CACjD,KAAK,CAAC,wBAAwB,CAAC,KAAK,CAAC,EACrC,UAAU,CACX;IACC;;;OAGG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;;;;;OAQG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAMD;;;;;;;;;;;GAWG;AACH,QAAA,MAAM,gBAAgB,8FAkiBrB,CAAC;AAIF,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
|
package/dist/textarea.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),d=require("react"),l=require("class-variance-authority"),b=require("@brightlocal/ui-components/lib/utils");function f(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const a=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,a.get?a:{enumerable:!0,get:()=>e[t]})}}return r.default=e,Object.freeze(r)}const g=f(d),v=l.cva(["flex w-full","border border-input bg-background rounded-md","outline-none transition-[border-color,background-color,box-shadow] duration-fast ease-out","text-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),d=require("react"),l=require("class-variance-authority"),b=require("@brightlocal/ui-components/lib/utils");function f(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const a=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,a.get?a:{enumerable:!0,get:()=>e[t]})}}return r.default=e,Object.freeze(r)}const g=f(d),v=l.cva(["flex w-full","border border-input bg-background rounded-md","outline-none transition-[border-color,background-color,box-shadow] duration-fast ease-out","text-body","text-foreground","px-3 py-2","focus-visible:outline-none focus-visible:border-ring focus-visible:bg-background","focus-visible:shadow-default","disabled:cursor-not-allowed disabled:opacity-50","placeholder:text-muted-foreground"]),n=g.forwardRef(({className:e,dataHook:r,error:t,trackingEl:a,trackingLabel:s,...o},c)=>{const i=t||o["aria-invalid"]===!0||o["aria-invalid"]==="true";return u.jsx("textarea",{ref:c,"aria-invalid":i?"true":void 0,className:b.cn(v(),i&&"border-destructive-40 focus-visible:border-destructive-40 focus-visible:shadow-destructive",e),"data-hook":r,"data-slot":"textarea","data-tracking-el":a,"data-tracking-label":s,...o})});n.displayName="Textarea";exports.Textarea=n;
|
package/dist/textarea.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import * as
|
|
1
|
+
import { jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import * as n from "react";
|
|
3
3
|
import { cva as u } from "class-variance-authority";
|
|
4
4
|
import { cn as c } from "@brightlocal/ui-components/lib/utils";
|
|
5
5
|
const b = u([
|
|
@@ -9,7 +9,7 @@ const b = u([
|
|
|
9
9
|
"border border-input bg-background rounded-md",
|
|
10
10
|
"outline-none transition-[border-color,background-color,box-shadow] duration-fast ease-out",
|
|
11
11
|
// Typography
|
|
12
|
-
"text-
|
|
12
|
+
"text-body",
|
|
13
13
|
"text-foreground",
|
|
14
14
|
// Spacing
|
|
15
15
|
"px-3 py-2",
|
|
@@ -20,24 +20,24 @@ const b = u([
|
|
|
20
20
|
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
21
21
|
// Pseudo-elements
|
|
22
22
|
"placeholder:text-muted-foreground"
|
|
23
|
-
]), f =
|
|
24
|
-
({ className:
|
|
25
|
-
const
|
|
26
|
-
return /* @__PURE__ */
|
|
23
|
+
]), f = n.forwardRef(
|
|
24
|
+
({ className: a, dataHook: o, error: t, trackingEl: i, trackingLabel: d, ...e }, s) => {
|
|
25
|
+
const r = t || e["aria-invalid"] === !0 || e["aria-invalid"] === "true";
|
|
26
|
+
return /* @__PURE__ */ l(
|
|
27
27
|
"textarea",
|
|
28
28
|
{
|
|
29
29
|
ref: s,
|
|
30
|
-
"aria-invalid":
|
|
30
|
+
"aria-invalid": r ? "true" : void 0,
|
|
31
31
|
className: c(
|
|
32
32
|
b(),
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
r && "border-destructive-40 focus-visible:border-destructive-40 focus-visible:shadow-destructive",
|
|
34
|
+
a
|
|
35
35
|
),
|
|
36
36
|
"data-hook": o,
|
|
37
37
|
"data-slot": "textarea",
|
|
38
38
|
"data-tracking-el": i,
|
|
39
39
|
"data-tracking-label": d,
|
|
40
|
-
...
|
|
40
|
+
...e
|
|
41
41
|
}
|
|
42
42
|
);
|
|
43
43
|
}
|
package/dist/toggle.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react/jsx-runtime"),b=require("react"),f=require("@radix-ui/react-toggle"),p=require("class-variance-authority"),m=require("@brightlocal/ui-components/lib/utils");function o(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const a in e)if(a!=="default"){const n=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(t,a,n.get?n:{enumerable:!0,get:()=>e[a]})}}return t.default=e,Object.freeze(t)}const v=o(b),h=o(f),r=p.cva("inline-flex items-center justify-center gap-2 rounded-md text-label hover:bg-muted hover:text-muted-foreground disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 focus-visible:border-ring focus-visible:shadow-default outline-none transition-[color,box-shadow] duration-fast ease-out whitespace-nowrap",{variants:{variant:{simple:"bg-transparent",outline:"border border-input bg-transparent shadow-xs hover:bg-accent hover:text-accent-foreground"},size:{default:"h-9 px-2 min-w-9",sm:"h-8 px-1.5 min-w-8",lg:"h-10 px-2.5 min-w-10"}},defaultVariants:{variant:"simple",size:"default"}}),i=v.forwardRef(({className:e,variant:t,size:a,dataHook:n,trackingEl:s,trackingLabel:l,ariaLabel:c,...g},u)=>d.jsx(h.Root,{ref:u,"aria-label":c,className:m.cn(r({variant:t,size:a,className:e})),"data-hook":n,"data-slot":"toggle","data-tracking-el":s||`toggle-${t}`,"data-tracking-label":l,...g}));i.displayName="Toggle";exports.Toggle=i;exports.toggleVariants=r;
|
package/dist/toggle.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as d } from "react/jsx-runtime";
|
|
2
2
|
import * as g from "react";
|
|
3
|
-
import * as
|
|
4
|
-
import { cva as
|
|
3
|
+
import * as c from "@radix-ui/react-toggle";
|
|
4
|
+
import { cva as m } from "class-variance-authority";
|
|
5
5
|
import { cn as p } from "@brightlocal/ui-components/lib/utils";
|
|
6
|
-
const f =
|
|
7
|
-
"inline-flex items-center justify-center gap-2 rounded-md text-
|
|
6
|
+
const f = m(
|
|
7
|
+
"inline-flex items-center justify-center gap-2 rounded-md text-label hover:bg-muted hover:text-muted-foreground disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 focus-visible:border-ring focus-visible:shadow-default outline-none transition-[color,box-shadow] duration-fast ease-out whitespace-nowrap",
|
|
8
8
|
{
|
|
9
9
|
variants: {
|
|
10
10
|
variant: {
|
|
@@ -32,10 +32,10 @@ const f = c(
|
|
|
32
32
|
trackingLabel: n,
|
|
33
33
|
ariaLabel: i,
|
|
34
34
|
...s
|
|
35
|
-
},
|
|
36
|
-
|
|
35
|
+
}, l) => /* @__PURE__ */ d(
|
|
36
|
+
c.Root,
|
|
37
37
|
{
|
|
38
|
-
ref:
|
|
38
|
+
ref: l,
|
|
39
39
|
"aria-label": i,
|
|
40
40
|
className: p(f({ variant: e, size: a, className: t })),
|
|
41
41
|
"data-hook": o,
|
package/dist/tooltip.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),m=require("react"),x=require("@radix-ui/react-tooltip"),l=require("@brightlocal/ui-components/lib/utils");function s(t){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const e in t)if(e!=="default"){const r=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(o,e,r.get?r:{enumerable:!0,get:()=>t[e]})}}return o.default=t,Object.freeze(o)}const c=s(m),i=s(x);function
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),m=require("react"),x=require("@radix-ui/react-tooltip"),l=require("@brightlocal/ui-components/lib/utils");function s(t){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const e in t)if(e!=="default"){const r=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(o,e,r.get?r:{enumerable:!0,get:()=>t[e]})}}return o.default=t,Object.freeze(o)}const c=s(m),i=s(x);function y({delayDuration:t=0,skipDelayDuration:o=0,...e}){return a.jsx(i.Provider,{delayDuration:t,skipDelayDuration:o,...e})}function b({...t}){return a.jsx(i.Root,{...t})}const d=c.forwardRef(({dataHook:t,trackingEl:o,trackingLabel:e,...r},n)=>a.jsx(i.Trigger,{ref:n,"data-hook":t,"data-slot":"tooltip-trigger","data-tracking-el":o,"data-tracking-label":e,...r}));d.displayName="TooltipTrigger";const p=c.forwardRef(({className:t,sideOffset:o=0,dataHook:e,trackingEl:r,trackingLabel:n,hideArrow:u=!1,children:g,...T},f)=>a.jsx(i.Portal,{children:a.jsxs(i.Content,{ref:f,className:l.cn("bg-secondary text-secondary-foreground text-body-xs z-50 w-max max-w-sm rounded-md px-3 py-1.5",l.FLOATING_CONTENT_ANIMATION,"**:data-[slot=tooltip-arrow]:-translate-y-px",t),"data-hook":e,"data-slot":"tooltip-content","data-tracking-el":r,"data-tracking-label":n,sideOffset:o,...T,children:[g,!u&&a.jsx(i.Arrow,{className:"fill-secondary","data-slot":"tooltip-arrow",height:7,width:14})]})}));p.displayName="TooltipContent";exports.Tooltip=b;exports.TooltipContent=p;exports.TooltipProvider=y;exports.TooltipTrigger=d;
|
package/dist/tooltip.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as e, jsxs as m } from "react/jsx-runtime";
|
|
2
2
|
import * as n from "react";
|
|
3
3
|
import * as o from "@radix-ui/react-tooltip";
|
|
4
|
-
import { cn as g, FLOATING_CONTENT_ANIMATION as
|
|
4
|
+
import { cn as g, FLOATING_CONTENT_ANIMATION as T } from "@brightlocal/ui-components/lib/utils";
|
|
5
5
|
function w({
|
|
6
6
|
delayDuration: t = 0,
|
|
7
7
|
skipDelayDuration: r = 0,
|
|
@@ -16,12 +16,12 @@ function w({
|
|
|
16
16
|
}
|
|
17
17
|
);
|
|
18
18
|
}
|
|
19
|
-
function
|
|
19
|
+
function y({
|
|
20
20
|
...t
|
|
21
21
|
}) {
|
|
22
22
|
return /* @__PURE__ */ e(o.Root, { ...t });
|
|
23
23
|
}
|
|
24
|
-
const
|
|
24
|
+
const f = n.forwardRef(({ dataHook: t, trackingEl: r, trackingLabel: a, ...i }, l) => /* @__PURE__ */ e(
|
|
25
25
|
o.Trigger,
|
|
26
26
|
{
|
|
27
27
|
ref: l,
|
|
@@ -32,7 +32,7 @@ const T = n.forwardRef(({ dataHook: t, trackingEl: r, trackingLabel: a, ...i },
|
|
|
32
32
|
...i
|
|
33
33
|
}
|
|
34
34
|
));
|
|
35
|
-
|
|
35
|
+
f.displayName = "TooltipTrigger";
|
|
36
36
|
const x = n.forwardRef(
|
|
37
37
|
({
|
|
38
38
|
className: t,
|
|
@@ -48,8 +48,8 @@ const x = n.forwardRef(
|
|
|
48
48
|
{
|
|
49
49
|
ref: c,
|
|
50
50
|
className: g(
|
|
51
|
-
"bg-secondary text-secondary-foreground z-50 w-max max-w-sm rounded-md px-3 py-1.5
|
|
52
|
-
|
|
51
|
+
"bg-secondary text-secondary-foreground text-body-xs z-50 w-max max-w-sm rounded-md px-3 py-1.5",
|
|
52
|
+
T,
|
|
53
53
|
"**:data-[slot=tooltip-arrow]:-translate-y-px",
|
|
54
54
|
t
|
|
55
55
|
),
|
|
@@ -76,8 +76,8 @@ const x = n.forwardRef(
|
|
|
76
76
|
);
|
|
77
77
|
x.displayName = "TooltipContent";
|
|
78
78
|
export {
|
|
79
|
-
|
|
79
|
+
y as Tooltip,
|
|
80
80
|
x as TooltipContent,
|
|
81
81
|
w as TooltipProvider,
|
|
82
|
-
|
|
82
|
+
f as TooltipTrigger
|
|
83
83
|
};
|
|
@@ -0,0 +1 @@
|
|
|
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;
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Heading levels — the rendered HTML tag (h1–h6).
|
|
4
|
+
* The level encodes the document outline position only; it is fully
|
|
5
|
+
* independent of the visual style, which is chosen via `variant`.
|
|
6
|
+
*/
|
|
7
|
+
type TypographyHeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;
|
|
8
|
+
/**
|
|
9
|
+
* Visual styles from the semantic type scale (DS-714). Weights below are the
|
|
10
|
+
* Figma spec values; each utility renders one step lighter in CSS — the
|
|
11
|
+
* Figma→Web parity offset (DS-305).
|
|
12
|
+
* Every heading is Figma 600 (renders 500) — Figma 700 (the `text-emphasis`
|
|
13
|
+
* utility) is inline emphasis only, never a heading.
|
|
14
|
+
* - `display` — Poppins 600 · 36/40. Brand moments only; never a default.
|
|
15
|
+
* Callout is the one component that uses it.
|
|
16
|
+
* - `page` — Poppins 600 · 24/32. The page title; exactly one per screen.
|
|
17
|
+
* - `section` — Inter 600 · 20/28. Card, dialog and sheet titles.
|
|
18
|
+
* - `subsection` — Inter 600 · 16/24. Sections inside a card, panel headers.
|
|
19
|
+
* - `compact` — Inter 600 · 14/20. Titles inside dense surfaces — alert and
|
|
20
|
+
* toast titles, step titles; the smallest heading. Table column headers are
|
|
21
|
+
* not headings — style the `th` as label-size text at 600 instead.
|
|
22
|
+
*/
|
|
23
|
+
type TypographyHeadingVariant = "display" | "page" | "section" | "subsection" | "compact";
|
|
24
|
+
/**
|
|
25
|
+
* Text alignment options.
|
|
26
|
+
*/
|
|
27
|
+
type TypographyHeadingAlign = "left" | "center" | "right";
|
|
28
|
+
/**
|
|
29
|
+
* Color role from the scale.
|
|
30
|
+
* - `default` — regular foreground.
|
|
31
|
+
* - `muted` — de-emphasis by color only; same size and weight.
|
|
32
|
+
* Headings have no destructive role — error/critical text is TypographyText
|
|
33
|
+
* `color="destructive"`, never a heading.
|
|
34
|
+
*/
|
|
35
|
+
type TypographyHeadingColor = "default" | "muted";
|
|
36
|
+
/**
|
|
37
|
+
* Props for the TypographyHeading component.
|
|
38
|
+
* Extends native heading props with design system tracking attributes.
|
|
39
|
+
*/
|
|
40
|
+
interface TypographyHeadingProps extends React.ComponentProps<"h1"> {
|
|
41
|
+
/**
|
|
42
|
+
* Document outline level — renders the corresponding h1–h6 tag.
|
|
43
|
+
* Pick it as if CSS didn't exist (one h1 per page, no skipped levels);
|
|
44
|
+
* the visual size is controlled separately via `variant`.
|
|
45
|
+
*/
|
|
46
|
+
level: TypographyHeadingLevel;
|
|
47
|
+
/**
|
|
48
|
+
* Visual style from the semantic type scale, independent of `level`.
|
|
49
|
+
* When omitted, derived from the level: 1 → "page", 2 → "section",
|
|
50
|
+
* 3–6 → "subsection". "display" is always explicit.
|
|
51
|
+
*/
|
|
52
|
+
variant?: TypographyHeadingVariant;
|
|
53
|
+
/**
|
|
54
|
+
* Color role: `muted` de-emphasises with color only (text-muted-foreground) —
|
|
55
|
+
* the scale never de-emphasises via lighter weight or smaller size. There is
|
|
56
|
+
* no destructive heading — error/critical text uses TypographyText
|
|
57
|
+
* `color="destructive"`.
|
|
58
|
+
* @default "default"
|
|
59
|
+
*/
|
|
60
|
+
color?: TypographyHeadingColor;
|
|
61
|
+
/**
|
|
62
|
+
* Text alignment. When omitted, no alignment class is applied and
|
|
63
|
+
* text keeps the default (left) or inherited alignment.
|
|
64
|
+
* @example "center"
|
|
65
|
+
*/
|
|
66
|
+
align?: TypographyHeadingAlign;
|
|
67
|
+
/**
|
|
68
|
+
* Tabular figures (fixed-width numerals) so live values don't jitter —
|
|
69
|
+
* for headings that contain a changing number. Inside Table/DataTable cells
|
|
70
|
+
* figures are already tabular (inherited from the Table root, DS-926);
|
|
71
|
+
* an explicit `false` restores proportional figures there. When omitted,
|
|
72
|
+
* figures follow the surrounding context. Numbers only: never enable
|
|
73
|
+
* it on regular text/prose — it only affects digits, and digits inside
|
|
74
|
+
* prose should stay proportional.
|
|
75
|
+
* No effect on `display`/`page`: Poppins ships no tabular figures, so the
|
|
76
|
+
* request is a harmless no-op there — and a large standalone number is a
|
|
77
|
+
* TypographyText `metric` (plus `tabular` if it must align), not a heading.
|
|
78
|
+
*/
|
|
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;
|
|
93
|
+
/**
|
|
94
|
+
* Render as a different element using Radix Slot pattern.
|
|
95
|
+
* When true, merges props onto the child element.
|
|
96
|
+
* @default false
|
|
97
|
+
*/
|
|
98
|
+
asChild?: boolean;
|
|
99
|
+
/**
|
|
100
|
+
* Data hook for automated testing (REQUIRED).
|
|
101
|
+
* Used to identify component in tests and E2E automation.
|
|
102
|
+
* @example "page-title", "card-heading"
|
|
103
|
+
*/
|
|
104
|
+
dataHook: string;
|
|
105
|
+
/**
|
|
106
|
+
* Tracking element identifier for analytics.
|
|
107
|
+
* @default "typography-heading-{variant}"
|
|
108
|
+
*/
|
|
109
|
+
trackingEl?: string;
|
|
110
|
+
/**
|
|
111
|
+
* Tracking label for analytics context.
|
|
112
|
+
*/
|
|
113
|
+
trackingLabel?: string;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Semantic heading with decoupled axes: `level` sets the HTML tag (document
|
|
117
|
+
* outline), `variant` sets the visual style (semantic type scale, DS-714).
|
|
118
|
+
* This makes "an h3 that looks like a section title" a first-class, correct
|
|
119
|
+
* combination — markup encodes meaning, the variant encodes appearance.
|
|
120
|
+
*
|
|
121
|
+
* @example
|
|
122
|
+
* <TypographyHeading level={2} variant="section" dataHook="card-title">
|
|
123
|
+
* Ranking performance
|
|
124
|
+
* </TypographyHeading>
|
|
125
|
+
*/
|
|
126
|
+
declare const TypographyHeading: React.ForwardRefExoticComponent<Omit<TypographyHeadingProps, "ref"> & React.RefAttributes<HTMLHeadingElement>>;
|
|
127
|
+
export { TypographyHeading };
|
|
128
|
+
export type { TypographyHeadingProps, TypographyHeadingLevel, TypographyHeadingVariant, TypographyHeadingAlign, TypographyHeadingColor, };
|
|
129
|
+
//# sourceMappingURL=typography-heading.d.ts.map
|
|
@@ -0,0 +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;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"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { jsx as m } from "react/jsx-runtime";
|
|
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
|
+
variants: {
|
|
8
|
+
variant: {
|
|
9
|
+
display: "text-display",
|
|
10
|
+
page: "text-heading-page",
|
|
11
|
+
section: "text-heading-section",
|
|
12
|
+
subsection: "text-heading-subsection",
|
|
13
|
+
compact: "text-heading-compact"
|
|
14
|
+
},
|
|
15
|
+
color: {
|
|
16
|
+
default: "text-foreground",
|
|
17
|
+
muted: "text-muted-foreground"
|
|
18
|
+
},
|
|
19
|
+
align: {
|
|
20
|
+
left: "text-left",
|
|
21
|
+
center: "text-center",
|
|
22
|
+
right: "text-right"
|
|
23
|
+
},
|
|
24
|
+
// Tri-state on purpose: `undefined` (the default) emits no class so the
|
|
25
|
+
// heading inherits its context — proportional everywhere except inside a
|
|
26
|
+
// Table root, which sets `tabular-nums` (DS-926). Explicit `false` must
|
|
27
|
+
// therefore emit `proportional-nums`, or opting out inside a Table would
|
|
28
|
+
// be a silent no-op.
|
|
29
|
+
tabular: {
|
|
30
|
+
true: "tabular-nums",
|
|
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"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
defaultVariants: {
|
|
44
|
+
color: "default"
|
|
45
|
+
}
|
|
46
|
+
}), k = {
|
|
47
|
+
1: "page",
|
|
48
|
+
2: "section",
|
|
49
|
+
3: "subsection",
|
|
50
|
+
4: "subsection",
|
|
51
|
+
5: "subsection",
|
|
52
|
+
6: "subsection"
|
|
53
|
+
}, V = h.forwardRef(
|
|
54
|
+
({
|
|
55
|
+
className: e,
|
|
56
|
+
level: t,
|
|
57
|
+
variant: o,
|
|
58
|
+
color: r = "default",
|
|
59
|
+
align: n,
|
|
60
|
+
tabular: i,
|
|
61
|
+
truncate: s = !1,
|
|
62
|
+
asChild: c = !1,
|
|
63
|
+
dataHook: d,
|
|
64
|
+
trackingEl: p,
|
|
65
|
+
trackingLabel: l,
|
|
66
|
+
...g
|
|
67
|
+
}, u) => {
|
|
68
|
+
const a = o ?? k[t], f = c ? y : `h${t}`;
|
|
69
|
+
return /* @__PURE__ */ m(
|
|
70
|
+
f,
|
|
71
|
+
{
|
|
72
|
+
ref: u,
|
|
73
|
+
className: b(
|
|
74
|
+
v({
|
|
75
|
+
variant: a,
|
|
76
|
+
color: r,
|
|
77
|
+
align: n,
|
|
78
|
+
tabular: i,
|
|
79
|
+
truncate: s
|
|
80
|
+
}),
|
|
81
|
+
e
|
|
82
|
+
),
|
|
83
|
+
"data-hook": d,
|
|
84
|
+
"data-slot": "typography-heading",
|
|
85
|
+
"data-tracking-el": p || `typography-heading-${a}`,
|
|
86
|
+
"data-tracking-label": l,
|
|
87
|
+
...g
|
|
88
|
+
}
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
);
|
|
92
|
+
V.displayName = "TypographyHeading";
|
|
93
|
+
export {
|
|
94
|
+
V as TypographyHeading
|
|
95
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
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;
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Visual styles from the semantic type scale (DS-714).
|
|
4
|
+
* - `body` — Inter 500 · 16/24. The default; card copy, descriptions, input values.
|
|
5
|
+
* - `body-sm` — Inter 500 · 14/20. Table cells, dense lists, app chrome. Density, never hierarchy.
|
|
6
|
+
* - `body-xs` — Inter 500 · 12/16. Helper text, captions, timestamps; the 12px floor.
|
|
7
|
+
* - `metric` — Inter 600 · 24/28. Large numbers only: KPIs, stat cards,
|
|
8
|
+
* scores — a metric presented as the point of its card. Figures are
|
|
9
|
+
* proportional; add `tabular` where metrics sit in a column or the value
|
|
10
|
+
* updates in place.
|
|
11
|
+
* - `code` — Geist Mono 400 · 16/24. IDs, keys, coordinates a user copies verbatim.
|
|
12
|
+
* Inside a sentence use the `text-code-inline` utility on a `code` element instead
|
|
13
|
+
* (0.9em, inherits the line's height).
|
|
14
|
+
*
|
|
15
|
+
* There are no standalone label variants on purpose: the `text-label` /
|
|
16
|
+
* `text-label-sm` tokens are reserved for control-owning components
|
|
17
|
+
* (Label/Field, tabs, nav, badges, chips) to adopt in follow-up work.
|
|
18
|
+
*/
|
|
19
|
+
type TypographyTextVariant = "body" | "body-sm" | "body-xs" | "metric" | "code";
|
|
20
|
+
/**
|
|
21
|
+
* Text alignment options.
|
|
22
|
+
*/
|
|
23
|
+
type TypographyTextAlign = "left" | "center" | "right";
|
|
24
|
+
/**
|
|
25
|
+
* Color role from the scale.
|
|
26
|
+
* - `default` — regular foreground.
|
|
27
|
+
* - `muted` — de-emphasis by color only; same size and weight.
|
|
28
|
+
* - `destructive` — error/critical text; pair with an icon or wording, never
|
|
29
|
+
* color alone.
|
|
30
|
+
*/
|
|
31
|
+
type TypographyTextColor = "default" | "muted" | "destructive";
|
|
32
|
+
/**
|
|
33
|
+
* Props for the TypographyText component.
|
|
34
|
+
* Extends native element props with design system tracking attributes.
|
|
35
|
+
*/
|
|
36
|
+
interface TypographyTextProps extends React.HTMLAttributes<HTMLElement> {
|
|
37
|
+
/**
|
|
38
|
+
* Visual style from the semantic type scale. Pick the name that matches
|
|
39
|
+
* what the text is doing — never pick a size. When in doubt, it's "body".
|
|
40
|
+
* @default "body"
|
|
41
|
+
*/
|
|
42
|
+
variant?: TypographyTextVariant;
|
|
43
|
+
/**
|
|
44
|
+
* Color role: `muted` de-emphasises with color only (text-muted-foreground) —
|
|
45
|
+
* the scale never de-emphasises via lighter weight or smaller size;
|
|
46
|
+
* `destructive` is for error/critical text and must be paired with an icon
|
|
47
|
+
* or wording (color is never the only indicator).
|
|
48
|
+
* @default "default"
|
|
49
|
+
*/
|
|
50
|
+
color?: TypographyTextColor;
|
|
51
|
+
/**
|
|
52
|
+
* Tabular figures (fixed-width numerals) so columns align and live values
|
|
53
|
+
* don't jitter. Opt in with `true` for numbers outside a Table — timestamps,
|
|
54
|
+
* counters, metric columns. Inside Table/DataTable cells figures are already
|
|
55
|
+
* tabular (inherited from the Table root, DS-926) — no prop needed; pass an
|
|
56
|
+
* explicit `false` there to restore proportional figures for a prose-heavy
|
|
57
|
+
* column. When omitted, figures follow the surrounding context. Numbers
|
|
58
|
+
* only: never enable it on regular text/prose — it only affects digits, and
|
|
59
|
+
* digits inside prose should stay proportional.
|
|
60
|
+
*/
|
|
61
|
+
tabular?: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Text alignment. When omitted, no alignment class is applied and
|
|
64
|
+
* text keeps the default (left) or inherited alignment.
|
|
65
|
+
* @example "center"
|
|
66
|
+
*/
|
|
67
|
+
align?: TypographyTextAlign;
|
|
68
|
+
/**
|
|
69
|
+
* Clip overflowing text to a single line with an ellipsis — table cells,
|
|
70
|
+
* list rows, dropdown options; anywhere text can outgrow its container.
|
|
71
|
+
* The surrounding layout must still allow the element to shrink: inside a
|
|
72
|
+
* flex row the element (or its wrapper) needs `min-w-0`, and in a grid
|
|
73
|
+
* column `minmax(0, …)` — otherwise the box grows instead of clipping.
|
|
74
|
+
* Forces `display: block` (an inline box cannot clip), so an inline
|
|
75
|
+
* default element (`metric`'s span, `code`'s code) or an inline `asChild`
|
|
76
|
+
* child becomes a block while truncating.
|
|
77
|
+
* Single-line only by design; a multi-line clamp can follow if demand
|
|
78
|
+
* appears.
|
|
79
|
+
* @default false
|
|
80
|
+
*/
|
|
81
|
+
truncate?: boolean;
|
|
82
|
+
/**
|
|
83
|
+
* Render as a different element using Radix Slot pattern.
|
|
84
|
+
* When true, merges props onto the child element.
|
|
85
|
+
* @default false
|
|
86
|
+
*/
|
|
87
|
+
asChild?: boolean;
|
|
88
|
+
/**
|
|
89
|
+
* Data hook for automated testing (REQUIRED).
|
|
90
|
+
* Used to identify component in tests and E2E automation.
|
|
91
|
+
* @example "card-description", "kpi-value"
|
|
92
|
+
*/
|
|
93
|
+
dataHook: string;
|
|
94
|
+
/**
|
|
95
|
+
* Tracking element identifier for analytics.
|
|
96
|
+
* @default "typography-text-{variant}"
|
|
97
|
+
*/
|
|
98
|
+
trackingEl?: string;
|
|
99
|
+
/**
|
|
100
|
+
* Tracking label for analytics context.
|
|
101
|
+
*/
|
|
102
|
+
trackingLabel?: string;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Semantic text styled by the type scale (DS-714). The variant chooses
|
|
106
|
+
* family, size, line-height, weight and tracking together; the rendered
|
|
107
|
+
* element defaults per variant (p / span / code) and can be changed with
|
|
108
|
+
* `asChild` when a different tag carries the right meaning.
|
|
109
|
+
*
|
|
110
|
+
* @example
|
|
111
|
+
* <TypographyText variant="body-sm" color="muted" dataHook="card-hint">
|
|
112
|
+
* Biggest rank changes this week
|
|
113
|
+
* </TypographyText>
|
|
114
|
+
*
|
|
115
|
+
* @example
|
|
116
|
+
* // Inline emphasis is Figma 700 — a few words inside a paragraph, never a
|
|
117
|
+
* // heading or a whole block. The `text-emphasis` utility encodes the weight
|
|
118
|
+
* // (and the Figma→Web parity offset) so nothing inline ever needs a raw
|
|
119
|
+
* // font-* class.
|
|
120
|
+
* <TypographyText dataHook="alert-body">
|
|
121
|
+
* Two locations are <strong className="text-emphasis">missing</strong> a primary category
|
|
122
|
+
* </TypographyText>
|
|
123
|
+
*/
|
|
124
|
+
declare const TypographyText: React.ForwardRefExoticComponent<TypographyTextProps & React.RefAttributes<HTMLElement>>;
|
|
125
|
+
export { TypographyText };
|
|
126
|
+
export type { TypographyTextProps, TypographyTextVariant, TypographyTextAlign, TypographyTextColor, };
|
|
127
|
+
//# sourceMappingURL=typography-text.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typography-text.d.ts","sourceRoot":"","sources":["../../src/components/typography-text.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B;;;;;;;;;;;;;;;;GAgBG;AACH,KAAK,qBAAqB,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,MAAM,CAAC;AAEhF;;GAEG;AACH,KAAK,mBAAmB,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEvD;;;;;;GAMG;AACH,KAAK,mBAAmB,GAAG,SAAS,GAAG,OAAO,GAAG,aAAa,CAAC;AAgE/D;;;GAGG;AACH,UAAU,mBAAoB,SAAQ,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC;IACrE;;;;OAIG;IACH,OAAO,CAAC,EAAE,qBAAqB,CAAC;IAChC;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,mBAAmB,CAAC;IAC5B;;;;;;;;;OASG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;OAIG;IACH,KAAK,CAAC,EAAE,mBAAmB,CAAC;IAC5B;;;;;;;;;;;;OAYG;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;;;;;;;;;;;;;;;;;;;GAmBG;AACH,QAAA,MAAM,cAAc,yFA8CnB,CAAC;AAGF,OAAO,EAAE,cAAc,EAAE,CAAC;AAC1B,YAAY,EACV,mBAAmB,EACnB,qBAAqB,EACrB,mBAAmB,EACnB,mBAAmB,GACpB,CAAC"}
|