@rojaostudio/ds 2.0.0-next.10 → 2.0.0-next.11
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/heading.d.ts +39 -0
- package/dist/components/heading.js +25 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +3 -0
- package/package.json +2 -2
- package/styles/rds/components-styles.css +42 -0
- package/styles/rds/components.css +2 -0
- package/styles/rds/theme.css +1 -1
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
/** The [RDS] type scale for titles: band 36/48, heading 24/30, value 20/30. */
|
|
5
|
+
type HeadingLevel = 'band' | 'heading' | 'value';
|
|
6
|
+
/** default: text/heading (navy on light in Rojão, white on dark and on the brand plate). accent: the logo orange. */
|
|
7
|
+
type HeadingTone = 'default' | 'accent';
|
|
8
|
+
/** The element in the page outline. The visual level never decides it: the order of the page does. */
|
|
9
|
+
type HeadingElement = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
10
|
+
interface HeadingProps extends HTMLAttributes<HTMLHeadingElement> {
|
|
11
|
+
/** The size, from the type scale (Figma `level`). */
|
|
12
|
+
level?: HeadingLevel;
|
|
13
|
+
/** The colour of the brand pair (Figma `tone`). The Mark takes the other one. */
|
|
14
|
+
tone?: HeadingTone;
|
|
15
|
+
/** The heading element. Default h2. */
|
|
16
|
+
as?: HeadingElement;
|
|
17
|
+
/** The text (Figma `text`), with an optional <Heading.Mark> stretch (Figma `showMark` + `mark`). */
|
|
18
|
+
children: ReactNode;
|
|
19
|
+
}
|
|
20
|
+
interface HeadingMarkProps extends HTMLAttributes<HTMLSpanElement> {
|
|
21
|
+
children: ReactNode;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Heading.Mark — Figma [RDS] .heading/mark. A stretch of the title in the other colour of the pair: accent inside a
|
|
25
|
+
* default Heading, default inside an accent one. A plain span: screen readers read the whole title, unannounced.
|
|
26
|
+
*/
|
|
27
|
+
declare function HeadingMark({ className, children, ...rest }: HeadingMarkProps): react.JSX.Element;
|
|
28
|
+
/**
|
|
29
|
+
* Heading — Figma [RDS] Content/Heading. A title in the brand pair: one colour, or both in the same title with a
|
|
30
|
+
* Heading.Mark. The colour is chosen per screen; tone=default is the rule. Orange on white fails contrast even for
|
|
31
|
+
* a large title (2.9:1 in Rojão): tone=accent belongs on dark or on the brand plate. Styles: heading.css.
|
|
32
|
+
*/
|
|
33
|
+
declare function HeadingRoot({ level, tone, as: Tag, className, children, ...rest }: HeadingProps): react.JSX.Element;
|
|
34
|
+
/** `<Heading>` with `<Heading.Mark>` for the stretch in the other colour. */
|
|
35
|
+
declare const Heading: typeof HeadingRoot & {
|
|
36
|
+
Mark: typeof HeadingMark;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export { Heading, type HeadingElement, type HeadingLevel, HeadingMark, type HeadingMarkProps, type HeadingProps, type HeadingTone };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__objRest,
|
|
3
|
+
__spreadProps,
|
|
4
|
+
__spreadValues
|
|
5
|
+
} from "../chunk-ORMEWXMH.js";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
function HeadingMark(_a) {
|
|
8
|
+
var _b = _a, { className, children } = _b, rest = __objRest(_b, ["className", "children"]);
|
|
9
|
+
return /* @__PURE__ */ jsx("span", __spreadProps(__spreadValues({}, rest), { className: ["rds-heading__mark", className].filter(Boolean).join(" "), children }));
|
|
10
|
+
}
|
|
11
|
+
function HeadingRoot(_c) {
|
|
12
|
+
var _d = _c, { level = "heading", tone = "default", as: Tag = "h2", className, children } = _d, rest = __objRest(_d, ["level", "tone", "as", "className", "children"]);
|
|
13
|
+
return /* @__PURE__ */ jsx(
|
|
14
|
+
Tag,
|
|
15
|
+
__spreadProps(__spreadValues({}, rest), {
|
|
16
|
+
className: ["rds-heading", `rds-heading--${level}`, tone === "accent" && "rds-heading--accent", className].filter(Boolean).join(" "),
|
|
17
|
+
children
|
|
18
|
+
})
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
const Heading = Object.assign(HeadingRoot, { Mark: HeadingMark });
|
|
22
|
+
export {
|
|
23
|
+
Heading,
|
|
24
|
+
HeadingMark
|
|
25
|
+
};
|
|
@@ -77,6 +77,7 @@ export { Switch, SwitchProps } from './switch.js';
|
|
|
77
77
|
export { Tooltip, TooltipProps, TooltipSide } from './tooltip.js';
|
|
78
78
|
export { ToastFn, ToastOptions, ToastTone, ToastVariant, ToastView, ToastViewProps, Toaster, ToasterProps, toast, toastClassName, useToast } from './toast.js';
|
|
79
79
|
export { Separator, SeparatorOrientation, SeparatorProps } from './separator.js';
|
|
80
|
+
export { Heading, HeadingElement, HeadingLevel, HeadingMark, HeadingMarkProps, HeadingProps, HeadingTone } from './heading.js';
|
|
80
81
|
export { Avatar, AvatarGroup, AvatarGroupProps, AvatarGroupSize, AvatarProps, AvatarSize, AvatarType, AvatarVariant, initials } from './avatar.js';
|
|
81
82
|
export { IconButton, IconButtonProps } from './icon-button.js';
|
|
82
83
|
export { ButtonGroup, ButtonGroupOrientation, ButtonGroupProps } from './button-group.js';
|
package/dist/components/index.js
CHANGED
|
@@ -84,6 +84,7 @@ import { Switch } from "./switch.js";
|
|
|
84
84
|
import { Tooltip } from "./tooltip.js";
|
|
85
85
|
import { Toaster, ToastView, toast, useToast, toastClassName } from "./toast.js";
|
|
86
86
|
import { Separator } from "./separator.js";
|
|
87
|
+
import { Heading, HeadingMark } from "./heading.js";
|
|
87
88
|
import { Avatar, AvatarGroup, initials } from "./avatar.js";
|
|
88
89
|
import { IconButton } from "./icon-button.js";
|
|
89
90
|
import { ButtonGroup } from "./button-group.js";
|
|
@@ -208,6 +209,8 @@ export {
|
|
|
208
209
|
GoogleButton,
|
|
209
210
|
GoogleConsent,
|
|
210
211
|
GoogleSignIn,
|
|
212
|
+
Heading,
|
|
213
|
+
HeadingMark,
|
|
211
214
|
HoverCard,
|
|
212
215
|
IconButton,
|
|
213
216
|
Input,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rojaostudio/ds",
|
|
3
|
-
"version": "2.0.0-next.
|
|
3
|
+
"version": "2.0.0-next.11",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Rojão Design System — componentes React, estilos e alvo React Native. O motor vive em @rojaostudio/ds-core.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -191,7 +191,7 @@
|
|
|
191
191
|
"@radix-ui/react-toggle": "^1.1.18",
|
|
192
192
|
"@radix-ui/react-toggle-group": "^1.1.19",
|
|
193
193
|
"@radix-ui/react-tooltip": "^1.2.16",
|
|
194
|
-
"@rojaostudio/ds-core": "1.1.0-next.
|
|
194
|
+
"@rojaostudio/ds-core": "1.1.0-next.6"
|
|
195
195
|
},
|
|
196
196
|
"scripts": {
|
|
197
197
|
"build": "pnpm run build:tokens && pnpm run build:themes && pnpm run build:rds && pnpm run build:native && tsup",
|
|
@@ -4785,6 +4785,48 @@ input:focus-visible + .rds-checkbox__box {
|
|
|
4785
4785
|
}
|
|
4786
4786
|
}
|
|
4787
4787
|
|
|
4788
|
+
/* components/heading.css */
|
|
4789
|
+
/* @tokens heading */
|
|
4790
|
+
/*
|
|
4791
|
+
* Heading (Content collection, heading/*): a title in the brand pair. heading/default is text/heading, heading/accent
|
|
4792
|
+
* the logo orange; .heading/mark paints a stretch in the other one. level follows the type scale (band, heading,
|
|
4793
|
+
* value), all bold.
|
|
4794
|
+
*/
|
|
4795
|
+
.rds-heading {
|
|
4796
|
+
margin: 0;
|
|
4797
|
+
font-family: var(--type-font-stack);
|
|
4798
|
+
font-weight: var(--type-heading-weight);
|
|
4799
|
+
color: var(--heading-default);
|
|
4800
|
+
text-wrap: balance;
|
|
4801
|
+
}
|
|
4802
|
+
|
|
4803
|
+
.rds-heading--band {
|
|
4804
|
+
font-size: var(--type-band-size);
|
|
4805
|
+
line-height: var(--type-band-line);
|
|
4806
|
+
}
|
|
4807
|
+
|
|
4808
|
+
.rds-heading--heading {
|
|
4809
|
+
font-size: var(--type-heading-size);
|
|
4810
|
+
line-height: var(--type-heading-line);
|
|
4811
|
+
}
|
|
4812
|
+
|
|
4813
|
+
.rds-heading--value {
|
|
4814
|
+
font-size: var(--type-value-size);
|
|
4815
|
+
line-height: var(--type-value-line);
|
|
4816
|
+
}
|
|
4817
|
+
|
|
4818
|
+
.rds-heading--accent {
|
|
4819
|
+
color: var(--heading-accent);
|
|
4820
|
+
}
|
|
4821
|
+
|
|
4822
|
+
.rds-heading__mark {
|
|
4823
|
+
color: var(--heading-accent);
|
|
4824
|
+
}
|
|
4825
|
+
|
|
4826
|
+
.rds-heading--accent .rds-heading__mark {
|
|
4827
|
+
color: var(--heading-default);
|
|
4828
|
+
}
|
|
4829
|
+
|
|
4788
4830
|
/* components/hover-card.css */
|
|
4789
4831
|
/* @tokens hovercard */
|
|
4790
4832
|
/* HoverCard (Feedback collection, hovercard/*): 320 wide, 16 inside, 12 between avatar and text, elevation/overlay. */
|
|
@@ -386,6 +386,8 @@
|
|
|
386
386
|
--choice-list-item-trailing-disabled: var(--text-disabled);
|
|
387
387
|
--choice-list-focus-ring: var(--focus-ring);
|
|
388
388
|
--choice-list-item-description-selected: var(--text-on-tint);
|
|
389
|
+
--heading-default: var(--text-heading);
|
|
390
|
+
--heading-accent: var(--colors-accent-default);
|
|
389
391
|
|
|
390
392
|
/* external */
|
|
391
393
|
--google-button-light-background: #ffffff;
|
package/styles/rds/theme.css
CHANGED