@hyphen/hyphen-components 5.7.4 → 5.8.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/dist/components/Box/Box.d.ts +9 -1
- package/dist/components/Box/Box.stories.d.ts +2 -0
- package/dist/css/utilities.css +73 -1
- package/dist/css/variables.css +11 -2
- package/dist/hyphen-components.cjs.development.js +6 -2
- package/dist/hyphen-components.cjs.development.js.map +1 -1
- package/dist/hyphen-components.cjs.production.min.js +1 -1
- package/dist/hyphen-components.cjs.production.min.js.map +1 -1
- package/dist/hyphen-components.esm.js +6 -2
- package/dist/hyphen-components.esm.js.map +1 -1
- package/dist/types/index.d.ts +3 -1
- package/package.json +2 -2
- package/src/components/Box/Box.stories.tsx +111 -0
- package/src/components/Box/Box.tsx +14 -0
- package/src/types/index.ts +10 -1
package/dist/types/index.d.ts
CHANGED
|
@@ -29,8 +29,10 @@ export type CssAlignContentValue = 'flex-start' | 'flex-end' | 'center' | 'stret
|
|
|
29
29
|
export type CssFlexDirectionValue = 'column' | 'column-reverse' | 'row' | 'row-reverse' | undefined;
|
|
30
30
|
export type CssAlignItemsValue = 'flex-start' | 'flex-end' | 'center' | 'baseline' | 'stretch';
|
|
31
31
|
export type CssFlexValue = 'auto' | 'initial' | 'none' | 'inherit' | 'unset';
|
|
32
|
-
export type CssOverflowValue = 'visible' | 'hidden' | 'clip' | '
|
|
32
|
+
export type CssOverflowValue = 'visible' | 'hidden' | 'clip' | 'auto' | 'scroll' | 'inherit' | 'initial' | 'unset';
|
|
33
33
|
export type CssDisplayValue = 'none' | 'flex' | 'inline-flex' | 'block' | 'inline-block' | 'inline' | 'inherit' | 'grid' | 'table-cell' | 'contents';
|
|
34
|
+
export type CssWhiteSpaceValue = 'normal' | 'nowrap' | 'pre' | 'pre-wrap' | 'pre-line';
|
|
35
|
+
export type CssWordBreakValue = 'normal' | 'break-all' | 'keep-all';
|
|
34
36
|
export type CssTextAlignValue = 'left' | 'center' | 'right';
|
|
35
37
|
export type BaseSpacing = SpacingSize | string | undefined;
|
|
36
38
|
export type BorderRadiusSize = BorderRadius | string | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hyphen/hyphen-components",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.8.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "@hyphen"
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
],
|
|
63
63
|
"dependencies": {
|
|
64
64
|
"@emotion/react": "^11.14.0",
|
|
65
|
-
"@hyphen/hyphen-design-tokens": "^4.
|
|
65
|
+
"@hyphen/hyphen-design-tokens": "^4.40.0",
|
|
66
66
|
"@popperjs/core": "^2.11.8",
|
|
67
67
|
"@radix-ui/react-collapsible": "^1.1.11",
|
|
68
68
|
"@radix-ui/react-dropdown-menu": "^2.1.15",
|
|
@@ -9,6 +9,9 @@ const meta: Meta<typeof Box> = {
|
|
|
9
9
|
|
|
10
10
|
export default meta;
|
|
11
11
|
|
|
12
|
+
const placeholderText =
|
|
13
|
+
'Built by developers, for developers, Hyphen automates access management and connects your team with the services and cloud resources they need to ship great software.';
|
|
14
|
+
|
|
12
15
|
export const Overview = () => (
|
|
13
16
|
<Box gap="md">
|
|
14
17
|
<Box
|
|
@@ -964,6 +967,71 @@ export const Shadow = () => (
|
|
|
964
967
|
</Box>
|
|
965
968
|
);
|
|
966
969
|
|
|
970
|
+
export const WhiteSpace = () => (
|
|
971
|
+
<Box gap="lg">
|
|
972
|
+
<Box padding="md" gap="md" width="8xl" background="secondary">
|
|
973
|
+
<Box>Normal</Box>
|
|
974
|
+
<Box
|
|
975
|
+
as="p"
|
|
976
|
+
display="block"
|
|
977
|
+
whiteSpace="normal"
|
|
978
|
+
borderWidth="0 sm"
|
|
979
|
+
borderColor="danger"
|
|
980
|
+
>
|
|
981
|
+
{placeholderText}
|
|
982
|
+
</Box>
|
|
983
|
+
</Box>
|
|
984
|
+
<Box padding="md" gap="md" width="8xl" background="secondary">
|
|
985
|
+
<Box>Nowrap</Box>
|
|
986
|
+
<Box
|
|
987
|
+
as="p"
|
|
988
|
+
display="block"
|
|
989
|
+
whiteSpace="nowrap"
|
|
990
|
+
borderWidth="0 sm"
|
|
991
|
+
borderColor="danger"
|
|
992
|
+
>
|
|
993
|
+
{placeholderText}
|
|
994
|
+
</Box>
|
|
995
|
+
</Box>
|
|
996
|
+
<Box padding="md" gap="md" width="8xl" background="secondary">
|
|
997
|
+
<Box>Pre</Box>
|
|
998
|
+
<Box
|
|
999
|
+
as="p"
|
|
1000
|
+
display="block"
|
|
1001
|
+
whiteSpace="pre"
|
|
1002
|
+
borderWidth="0 sm"
|
|
1003
|
+
borderColor="danger"
|
|
1004
|
+
>
|
|
1005
|
+
{placeholderText}
|
|
1006
|
+
</Box>
|
|
1007
|
+
</Box>
|
|
1008
|
+
<Box padding="md" gap="md" width="8xl" background="secondary">
|
|
1009
|
+
<Box>Pre-wrap</Box>
|
|
1010
|
+
<Box
|
|
1011
|
+
as="p"
|
|
1012
|
+
display="block"
|
|
1013
|
+
whiteSpace="pre-wrap"
|
|
1014
|
+
borderWidth="0 sm"
|
|
1015
|
+
borderColor="danger"
|
|
1016
|
+
>
|
|
1017
|
+
{placeholderText}
|
|
1018
|
+
</Box>
|
|
1019
|
+
</Box>
|
|
1020
|
+
<Box padding="md" gap="md" width="8xl" background="secondary">
|
|
1021
|
+
<Box>Pre-line</Box>
|
|
1022
|
+
<Box
|
|
1023
|
+
as="p"
|
|
1024
|
+
display="block"
|
|
1025
|
+
whiteSpace="pre-line"
|
|
1026
|
+
borderWidth="0 sm"
|
|
1027
|
+
borderColor="danger"
|
|
1028
|
+
>
|
|
1029
|
+
{placeholderText}
|
|
1030
|
+
</Box>
|
|
1031
|
+
</Box>
|
|
1032
|
+
</Box>
|
|
1033
|
+
);
|
|
1034
|
+
|
|
967
1035
|
export const Width = () => (
|
|
968
1036
|
<Box background="secondary" gap="xs">
|
|
969
1037
|
<Box background="tertiary" width="227px">
|
|
@@ -1115,6 +1183,49 @@ export const WidthMin = () => (
|
|
|
1115
1183
|
</Box>
|
|
1116
1184
|
);
|
|
1117
1185
|
|
|
1186
|
+
export const WordBreak = () => (
|
|
1187
|
+
<Box gap="lg">
|
|
1188
|
+
<Box padding="3xl" gap="md" width="8xl" background="secondary">
|
|
1189
|
+
<Box>Normal</Box>
|
|
1190
|
+
<Box
|
|
1191
|
+
as="p"
|
|
1192
|
+
display="block"
|
|
1193
|
+
wordBreak="normal"
|
|
1194
|
+
borderWidth="0 sm 0 sm"
|
|
1195
|
+
borderColor="danger"
|
|
1196
|
+
>
|
|
1197
|
+
{placeholderText}
|
|
1198
|
+
</Box>
|
|
1199
|
+
</Box>
|
|
1200
|
+
|
|
1201
|
+
<Box padding="3xl" gap="md" width="8xl" background="secondary">
|
|
1202
|
+
<Box>Break-All</Box>
|
|
1203
|
+
<Box
|
|
1204
|
+
as="p"
|
|
1205
|
+
display="block"
|
|
1206
|
+
wordBreak="break-all"
|
|
1207
|
+
borderWidth="0 sm 0 sm"
|
|
1208
|
+
borderColor="danger"
|
|
1209
|
+
>
|
|
1210
|
+
{placeholderText}
|
|
1211
|
+
</Box>
|
|
1212
|
+
</Box>
|
|
1213
|
+
|
|
1214
|
+
<Box padding="3xl" gap="md" width="8xl" background="secondary">
|
|
1215
|
+
<Box>Keep-All</Box>
|
|
1216
|
+
<Box
|
|
1217
|
+
as="p"
|
|
1218
|
+
display="block"
|
|
1219
|
+
wordBreak="keep-all"
|
|
1220
|
+
borderWidth="0 sm 0 sm"
|
|
1221
|
+
borderColor="danger"
|
|
1222
|
+
>
|
|
1223
|
+
{placeholderText}
|
|
1224
|
+
</Box>
|
|
1225
|
+
</Box>
|
|
1226
|
+
</Box>
|
|
1227
|
+
);
|
|
1228
|
+
|
|
1118
1229
|
export const Height = () => (
|
|
1119
1230
|
<Box background="secondary" gap="xs">
|
|
1120
1231
|
<Box
|
|
@@ -25,6 +25,8 @@ import {
|
|
|
25
25
|
ZIndexSize,
|
|
26
26
|
BackgroundColor,
|
|
27
27
|
BorderColor,
|
|
28
|
+
CssWhiteSpaceValue,
|
|
29
|
+
CssWordBreakValue,
|
|
28
30
|
} from '../../types';
|
|
29
31
|
import {
|
|
30
32
|
CSSProperties,
|
|
@@ -249,6 +251,10 @@ export interface BoxProps {
|
|
|
249
251
|
* the alignment of the text
|
|
250
252
|
*/
|
|
251
253
|
textAlign?: CssTextAlignValue | ResponsiveProp<CssTextAlignValue>;
|
|
254
|
+
/**
|
|
255
|
+
* Control the whitespace behavior of the Box
|
|
256
|
+
*/
|
|
257
|
+
whiteSpace?: CssWhiteSpaceValue | ResponsiveProp<CssWhiteSpaceValue>;
|
|
252
258
|
/**
|
|
253
259
|
* By default, a Box's items will all try to fit onto one line.
|
|
254
260
|
* Change that and allow the items to wrap as needed wrap
|
|
@@ -259,6 +265,10 @@ export interface BoxProps {
|
|
|
259
265
|
* or a [width token](/?path=/docs/foundation-design-tokens--docs#width)
|
|
260
266
|
*/
|
|
261
267
|
width?: DimensionSize | ResponsiveProp<DimensionSize> | string;
|
|
268
|
+
/**
|
|
269
|
+
* Control the word break behavior of the Box
|
|
270
|
+
*/
|
|
271
|
+
wordBreak?: CssWordBreakValue | ResponsiveProp<CssWordBreakValue>;
|
|
262
272
|
/**
|
|
263
273
|
* ZIndex value for the element. Can be one of the predetermined token values.
|
|
264
274
|
* Can be responsive.
|
|
@@ -315,7 +325,9 @@ export const Box: FC<BoxProps> = forwardRef(
|
|
|
315
325
|
style = {},
|
|
316
326
|
textAlign = undefined,
|
|
317
327
|
wrap = undefined,
|
|
328
|
+
whiteSpace = undefined,
|
|
318
329
|
width = undefined,
|
|
330
|
+
wordBreak = undefined,
|
|
319
331
|
zIndex = undefined,
|
|
320
332
|
...restProps
|
|
321
333
|
},
|
|
@@ -414,6 +426,8 @@ export const Box: FC<BoxProps> = forwardRef(
|
|
|
414
426
|
generateResponsiveClasses('text-align', textAlign),
|
|
415
427
|
generateResponsiveClasses('position', position),
|
|
416
428
|
generateResponsiveClasses('z-index', zIndex),
|
|
429
|
+
generateResponsiveClasses('whitespace', whiteSpace),
|
|
430
|
+
generateResponsiveClasses('break', wordBreak),
|
|
417
431
|
...(hoverClasses ?? []),
|
|
418
432
|
...(focusClasses ?? []),
|
|
419
433
|
{
|
package/src/types/index.ts
CHANGED
|
@@ -104,8 +104,8 @@ export type CssOverflowValue =
|
|
|
104
104
|
| 'visible'
|
|
105
105
|
| 'hidden'
|
|
106
106
|
| 'clip'
|
|
107
|
-
| 'scroll'
|
|
108
107
|
| 'auto'
|
|
108
|
+
| 'scroll'
|
|
109
109
|
| 'inherit'
|
|
110
110
|
| 'initial'
|
|
111
111
|
| 'unset';
|
|
@@ -122,6 +122,15 @@ export type CssDisplayValue =
|
|
|
122
122
|
| 'table-cell'
|
|
123
123
|
| 'contents';
|
|
124
124
|
|
|
125
|
+
export type CssWhiteSpaceValue =
|
|
126
|
+
| 'normal'
|
|
127
|
+
| 'nowrap'
|
|
128
|
+
| 'pre'
|
|
129
|
+
| 'pre-wrap'
|
|
130
|
+
| 'pre-line';
|
|
131
|
+
|
|
132
|
+
export type CssWordBreakValue = 'normal' | 'break-all' | 'keep-all';
|
|
133
|
+
|
|
125
134
|
export type CssTextAlignValue = 'left' | 'center' | 'right';
|
|
126
135
|
|
|
127
136
|
export type BaseSpacing = SpacingSize | string | undefined;
|