@primer/react 38.26.1-rc.6a367a51e → 38.27.0-rc.82d74c5ae
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/CHANGELOG.md +5 -1
- package/dist/Text/{Text-ca7603b7.css → Text-d649cda5.css} +2 -2
- package/dist/Text/Text-d649cda5.css.map +1 -0
- package/dist/Text/Text.d.ts +3 -0
- package/dist/Text/Text.d.ts.map +1 -1
- package/dist/Text/Text.js +20 -14
- package/dist/Text/Text.module.css.js +1 -1
- package/generated/components.json +20 -0
- package/package.json +1 -1
- package/dist/Text/Text-ca7603b7.css.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
# @primer/react
|
|
2
2
|
|
|
3
|
-
## 38.
|
|
3
|
+
## 38.27.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#7906](https://github.com/primer/react/pull/7906) [`adc5299`](https://github.com/primer/react/commit/adc5299f3d98519119fb9547e50dd2985fc96174) Thanks [@jonrohan](https://github.com/jonrohan)! - Text: Add `whiteSpace` prop to control the CSS `white-space` property
|
|
4
8
|
|
|
5
9
|
### Patch Changes
|
|
6
10
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
.prc-Text-Text-9mHv3:where([data-size=small]){font-size:var(--text-body-size-small,.75rem);line-height:var(--text-body-lineHeight-small,1.625)}.prc-Text-Text-9mHv3:where([data-size=medium]){font-size:var(--text-body-size-medium,.875rem);line-height:var(--text-body-lineHeight-medium,1.5)}.prc-Text-Text-9mHv3:where([data-size=large]){font-size:var(--text-body-size-large,1rem);line-height:var(--text-body-lineHeight-large,1.5)}.prc-Text-Text-9mHv3:where([data-weight=light]){font-weight:var(--base-text-weight-light,300)}.prc-Text-Text-9mHv3:where([data-weight=normal]){font-weight:var(--base-text-weight-normal,400)}.prc-Text-Text-9mHv3:where([data-weight=medium]){font-weight:var(--base-text-weight-medium,500)}.prc-Text-Text-9mHv3:where([data-weight=semibold]){font-weight:var(--base-text-weight-semibold,600)}
|
|
2
|
-
/*# sourceMappingURL=Text-
|
|
1
|
+
.prc-Text-Text-9mHv3:where([data-size=small]){font-size:var(--text-body-size-small,.75rem);line-height:var(--text-body-lineHeight-small,1.625)}.prc-Text-Text-9mHv3:where([data-size=medium]){font-size:var(--text-body-size-medium,.875rem);line-height:var(--text-body-lineHeight-medium,1.5)}.prc-Text-Text-9mHv3:where([data-size=large]){font-size:var(--text-body-size-large,1rem);line-height:var(--text-body-lineHeight-large,1.5)}.prc-Text-Text-9mHv3:where([data-weight=light]){font-weight:var(--base-text-weight-light,300)}.prc-Text-Text-9mHv3:where([data-weight=normal]){font-weight:var(--base-text-weight-normal,400)}.prc-Text-Text-9mHv3:where([data-weight=medium]){font-weight:var(--base-text-weight-medium,500)}.prc-Text-Text-9mHv3:where([data-weight=semibold]){font-weight:var(--base-text-weight-semibold,600)}.prc-Text-Text-9mHv3:where([data-white-space=pre]){white-space:pre}.prc-Text-Text-9mHv3:where([data-white-space=normal]){white-space:normal}.prc-Text-Text-9mHv3:where([data-white-space=nowrap]){white-space:nowrap}.prc-Text-Text-9mHv3:where([data-white-space=pre-wrap]){white-space:pre-wrap}.prc-Text-Text-9mHv3:where([data-white-space=pre-line]){white-space:pre-line}
|
|
2
|
+
/*# sourceMappingURL=Text-d649cda5.css.map */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/Text/Text.module.css.js"],"names":[],"mappings":"AACE,8CACE,4CAAsC,CACtC,mDACF,CAEA,+CACE,8CAAuC,CACvC,kDACF,CAEA,8CACE,0CAAsC,CACtC,iDACF,CAEA,gDACE,6CACF,CAEA,iDACE,8CACF,CAEA,iDACE,8CACF,CAEA,mDACE,gDACF,CAEA,mDACE,eACF,CAEA,sDACE,kBACF,CAEA,sDACE,kBACF,CAEA,wDACE,oBACF,CAEA,wDACE,oBACF","file":"Text-d649cda5.css","sourcesContent":[".Text {\n &:where([data-size='small']) {\n font-size: var(--text-body-size-small);\n line-height: var(--text-body-lineHeight-small);\n }\n\n &:where([data-size='medium']) {\n font-size: var(--text-body-size-medium);\n line-height: var(--text-body-lineHeight-medium);\n }\n\n &:where([data-size='large']) {\n font-size: var(--text-body-size-large);\n line-height: var(--text-body-lineHeight-large);\n }\n\n &:where([data-weight='light']) {\n font-weight: var(--base-text-weight-light);\n }\n\n &:where([data-weight='normal']) {\n font-weight: var(--base-text-weight-normal);\n }\n\n &:where([data-weight='medium']) {\n font-weight: var(--base-text-weight-medium);\n }\n\n &:where([data-weight='semibold']) {\n font-weight: var(--base-text-weight-semibold);\n }\n\n &:where([data-white-space='pre']) {\n white-space: pre;\n }\n\n &:where([data-white-space='normal']) {\n white-space: normal;\n }\n\n &:where([data-white-space='nowrap']) {\n white-space: nowrap;\n }\n\n &:where([data-white-space='pre-wrap']) {\n white-space: pre-wrap;\n }\n\n &:where([data-white-space='pre-line']) {\n white-space: pre-line;\n }\n}\n"]}
|
package/dist/Text/Text.d.ts
CHANGED
|
@@ -3,15 +3,18 @@ import { type PolymorphicProps } from '../utils/modern-polymorphic';
|
|
|
3
3
|
export type TextProps<As extends React.ElementType = 'span'> = PolymorphicProps<As, 'span', {
|
|
4
4
|
size?: 'large' | 'medium' | 'small';
|
|
5
5
|
weight?: 'light' | 'normal' | 'medium' | 'semibold';
|
|
6
|
+
whiteSpace?: 'pre' | 'normal' | 'nowrap' | 'pre-wrap' | 'pre-line';
|
|
6
7
|
className?: string;
|
|
7
8
|
}>;
|
|
8
9
|
declare const _default: <As extends React.ElementType>(props: (React.ComponentPropsWithRef<React.ElementType extends As ? "span" : As> & {
|
|
9
10
|
size?: "large" | "medium" | "small";
|
|
10
11
|
weight?: "light" | "normal" | "medium" | "semibold";
|
|
12
|
+
whiteSpace?: "pre" | "normal" | "nowrap" | "pre-wrap" | "pre-line";
|
|
11
13
|
className?: string;
|
|
12
14
|
} extends infer T ? T extends React.ComponentPropsWithRef<React.ElementType extends As ? "span" : As> & {
|
|
13
15
|
size?: "large" | "medium" | "small";
|
|
14
16
|
weight?: "light" | "normal" | "medium" | "semibold";
|
|
17
|
+
whiteSpace?: "pre" | "normal" | "nowrap" | "pre-wrap" | "pre-line";
|
|
15
18
|
className?: string;
|
|
16
19
|
} ? T extends unknown ? Omit<T, "as"> : never : never : never) & {
|
|
17
20
|
as?: As | undefined;
|
package/dist/Text/Text.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Text.d.ts","sourceRoot":"","sources":["../../src/Text/Text.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,OAAO,EAAkB,KAAK,gBAAgB,EAAC,MAAM,6BAA6B,CAAA;AAElF,MAAM,MAAM,SAAS,CAAC,EAAE,SAAS,KAAK,CAAC,WAAW,GAAG,MAAM,IAAI,gBAAgB,CAC7E,EAAE,EACF,MAAM,EACN;IACE,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAA;IACnC,MAAM,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,UAAU,CAAA;IACnD,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CACF,CAAA;yBAGa,EAAE,SAAS,KAAK,CAAC,WAAW;
|
|
1
|
+
{"version":3,"file":"Text.d.ts","sourceRoot":"","sources":["../../src/Text/Text.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,OAAO,EAAkB,KAAK,gBAAgB,EAAC,MAAM,6BAA6B,CAAA;AAElF,MAAM,MAAM,SAAS,CAAC,EAAE,SAAS,KAAK,CAAC,WAAW,GAAG,MAAM,IAAI,gBAAgB,CAC7E,EAAE,EACF,MAAM,EACN;IACE,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAA;IACnC,MAAM,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,UAAU,CAAA;IACnD,UAAU,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,QAAQ,GAAG,UAAU,GAAG,UAAU,CAAA;IAClE,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CACF,CAAA;yBAGa,EAAE,SAAS,KAAK,CAAC,WAAW;WAR/B,OAAO,GAAG,QAAQ,GAAG,OAAO;aAC1B,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,UAAU;iBACtC,KAAK,GAAG,QAAQ,GAAG,QAAQ,GAAG,UAAU,GAAG,UAAU;gBACtD,MAAM;;WAHX,OAAO,GAAG,QAAQ,GAAG,OAAO;aAC1B,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,UAAU;iBACtC,KAAK,GAAG,QAAQ,GAAG,QAAQ,GAAG,UAAU,GAAG,UAAU;gBACtD,MAAM;;;;AAsBtB,wBAAoC"}
|
package/dist/Text/Text.js
CHANGED
|
@@ -6,18 +6,20 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
6
6
|
|
|
7
7
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
8
8
|
function Text(props, ref) {
|
|
9
|
-
const $ = c(
|
|
9
|
+
const $ = c(17);
|
|
10
10
|
let className;
|
|
11
11
|
let rest;
|
|
12
12
|
let size;
|
|
13
13
|
let t0;
|
|
14
14
|
let weight;
|
|
15
|
+
let whiteSpace;
|
|
15
16
|
if ($[0] !== props) {
|
|
16
17
|
({
|
|
17
18
|
as: t0,
|
|
18
19
|
className,
|
|
19
20
|
size,
|
|
20
21
|
weight,
|
|
22
|
+
whiteSpace,
|
|
21
23
|
...rest
|
|
22
24
|
} = props);
|
|
23
25
|
$[0] = props;
|
|
@@ -26,40 +28,44 @@ function Text(props, ref) {
|
|
|
26
28
|
$[3] = size;
|
|
27
29
|
$[4] = t0;
|
|
28
30
|
$[5] = weight;
|
|
31
|
+
$[6] = whiteSpace;
|
|
29
32
|
} else {
|
|
30
33
|
className = $[1];
|
|
31
34
|
rest = $[2];
|
|
32
35
|
size = $[3];
|
|
33
36
|
t0 = $[4];
|
|
34
37
|
weight = $[5];
|
|
38
|
+
whiteSpace = $[6];
|
|
35
39
|
}
|
|
36
40
|
const Component = t0 === undefined ? "span" : t0;
|
|
37
41
|
let t1;
|
|
38
|
-
if ($[
|
|
42
|
+
if ($[7] !== className) {
|
|
39
43
|
t1 = clsx(className, classes.Text);
|
|
40
|
-
$[
|
|
41
|
-
$[
|
|
44
|
+
$[7] = className;
|
|
45
|
+
$[8] = t1;
|
|
42
46
|
} else {
|
|
43
|
-
t1 = $[
|
|
47
|
+
t1 = $[8];
|
|
44
48
|
}
|
|
45
49
|
let t2;
|
|
46
|
-
if ($[
|
|
50
|
+
if ($[9] !== Component || $[10] !== ref || $[11] !== rest || $[12] !== size || $[13] !== t1 || $[14] !== weight || $[15] !== whiteSpace) {
|
|
47
51
|
t2 = /*#__PURE__*/jsx(Component, {
|
|
48
52
|
className: t1,
|
|
49
53
|
"data-size": size,
|
|
50
54
|
"data-weight": weight,
|
|
55
|
+
"data-white-space": whiteSpace,
|
|
51
56
|
...rest,
|
|
52
57
|
ref: ref
|
|
53
58
|
});
|
|
54
|
-
$[
|
|
55
|
-
$[
|
|
56
|
-
$[
|
|
57
|
-
$[
|
|
58
|
-
$[
|
|
59
|
-
$[
|
|
60
|
-
$[
|
|
59
|
+
$[9] = Component;
|
|
60
|
+
$[10] = ref;
|
|
61
|
+
$[11] = rest;
|
|
62
|
+
$[12] = size;
|
|
63
|
+
$[13] = t1;
|
|
64
|
+
$[14] = weight;
|
|
65
|
+
$[15] = whiteSpace;
|
|
66
|
+
$[16] = t2;
|
|
61
67
|
} else {
|
|
62
|
-
t2 = $[
|
|
68
|
+
t2 = $[16];
|
|
63
69
|
}
|
|
64
70
|
return t2;
|
|
65
71
|
}
|
|
@@ -7520,6 +7520,26 @@
|
|
|
7520
7520
|
{
|
|
7521
7521
|
"id": "components-text-features--semibold-weight",
|
|
7522
7522
|
"code": "() => (\n <Text as=\"span\" weight=\"semibold\">\n Stylized text\n </Text>\n)"
|
|
7523
|
+
},
|
|
7524
|
+
{
|
|
7525
|
+
"id": "components-text-features--pre-white-space",
|
|
7526
|
+
"code": "() => (\n <Text as=\"span\" whiteSpace=\"pre\">\n Stylized text\n </Text>\n)"
|
|
7527
|
+
},
|
|
7528
|
+
{
|
|
7529
|
+
"id": "components-text-features--normal-white-space",
|
|
7530
|
+
"code": "() => (\n <Text as=\"span\" whiteSpace=\"normal\">\n Stylized text\n </Text>\n)"
|
|
7531
|
+
},
|
|
7532
|
+
{
|
|
7533
|
+
"id": "components-text-features--nowrap-white-space",
|
|
7534
|
+
"code": "() => (\n <Text as=\"span\" whiteSpace=\"nowrap\">\n Stylized text\n </Text>\n)"
|
|
7535
|
+
},
|
|
7536
|
+
{
|
|
7537
|
+
"id": "components-text-features--pre-wrap-white-space",
|
|
7538
|
+
"code": "() => (\n <Text as=\"span\" whiteSpace=\"pre-wrap\">\n Stylized text\n </Text>\n)"
|
|
7539
|
+
},
|
|
7540
|
+
{
|
|
7541
|
+
"id": "components-text-features--pre-line-white-space",
|
|
7542
|
+
"code": "() => (\n <Text as=\"span\" whiteSpace=\"pre-line\">\n Stylized text\n </Text>\n)"
|
|
7523
7543
|
}
|
|
7524
7544
|
],
|
|
7525
7545
|
"importPath": "@primer/react",
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/Text/Text.module.css.js"],"names":[],"mappings":"AACE,8CACE,4CAAsC,CACtC,mDACF,CAEA,+CACE,8CAAuC,CACvC,kDACF,CAEA,8CACE,0CAAsC,CACtC,iDACF,CAEA,gDACE,6CACF,CAEA,iDACE,8CACF,CAEA,iDACE,8CACF,CAEA,mDACE,gDACF","file":"Text-ca7603b7.css","sourcesContent":[".Text {\n &:where([data-size='small']) {\n font-size: var(--text-body-size-small);\n line-height: var(--text-body-lineHeight-small);\n }\n\n &:where([data-size='medium']) {\n font-size: var(--text-body-size-medium);\n line-height: var(--text-body-lineHeight-medium);\n }\n\n &:where([data-size='large']) {\n font-size: var(--text-body-size-large);\n line-height: var(--text-body-lineHeight-large);\n }\n\n &:where([data-weight='light']) {\n font-weight: var(--base-text-weight-light);\n }\n\n &:where([data-weight='normal']) {\n font-weight: var(--base-text-weight-normal);\n }\n\n &:where([data-weight='medium']) {\n font-weight: var(--base-text-weight-medium);\n }\n\n &:where([data-weight='semibold']) {\n font-weight: var(--base-text-weight-semibold);\n }\n}\n"]}
|