@lumx/react 3.6.1-alpha.1 → 3.6.1
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/_internal/types.d.ts +13 -1
- package/index.d.ts +8 -2
- package/index.js +25 -4
- package/index.js.map +1 -1
- package/package.json +3 -3
- package/src/components/index.ts +13 -0
- package/src/components/text/Text.stories.tsx +26 -1
- package/src/components/text/Text.test.tsx +6 -0
- package/src/components/text/Text.tsx +18 -2
- package/src/components/tooltip/Tooltip.test.tsx +32 -35
- package/src/components/tooltip/useTooltipOpen.tsx +1 -1
package/_internal/types.d.ts
CHANGED
|
@@ -262,6 +262,18 @@ declare const Kind: {
|
|
|
262
262
|
readonly error: "error";
|
|
263
263
|
};
|
|
264
264
|
declare type Kind = ValueOf<typeof Kind>;
|
|
265
|
+
/**
|
|
266
|
+
* All available white-space values
|
|
267
|
+
* */
|
|
268
|
+
declare const WhiteSpace: {
|
|
269
|
+
normal: string;
|
|
270
|
+
nowrap: string;
|
|
271
|
+
pre: string;
|
|
272
|
+
'pre-wrap': string;
|
|
273
|
+
'pre-line': string;
|
|
274
|
+
'break-spaces': string;
|
|
275
|
+
};
|
|
276
|
+
declare type WhiteSpace = ValueOf<typeof WhiteSpace>;
|
|
265
277
|
|
|
266
278
|
/**
|
|
267
279
|
* Focal point using vertical alignment, horizontal alignment or coordinates (from -1 to 1).
|
|
@@ -298,4 +310,4 @@ declare const ThumbnailVariant: {
|
|
|
298
310
|
};
|
|
299
311
|
declare type ThumbnailVariant = ValueOf<typeof ThumbnailVariant>;
|
|
300
312
|
|
|
301
|
-
export { Alignment as A, Comp as C, Emphasis as E, Falsy as F, GenericProps as G, HasTheme as H, Kind as K, Orientation as O, Size as S, Typography as T, ValueOf as V, HorizontalAlignment as a, ColorPalette as b, VerticalAlignment as c, ColorVariant as d, TextElement as e, HeadingElement as f, AspectRatio as g, FocusPoint as h, ThumbnailSize as i, ThumbnailVariant as j, HasClassName as k, HasAriaLabelOrLabelledBy as l, ComponentRef as m, GlobalSize as n, TypographyInterface as o, Color as p, Theme as q, TypographyTitleCustom as r, TypographyCustom as s, Callback as t, ThumbnailAspectRatio as u };
|
|
313
|
+
export { Alignment as A, Comp as C, Emphasis as E, Falsy as F, GenericProps as G, HasTheme as H, Kind as K, Orientation as O, Size as S, Typography as T, ValueOf as V, WhiteSpace as W, HorizontalAlignment as a, ColorPalette as b, VerticalAlignment as c, ColorVariant as d, TextElement as e, HeadingElement as f, AspectRatio as g, FocusPoint as h, ThumbnailSize as i, ThumbnailVariant as j, HasClassName as k, HasAriaLabelOrLabelledBy as l, ComponentRef as m, GlobalSize as n, TypographyInterface as o, Color as p, Theme as q, TypographyTitleCustom as r, TypographyCustom as s, Callback as t, ThumbnailAspectRatio as u };
|
package/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { ReactNode, SyntheticEvent, ReactElement, MouseEventHandler, KeyboardEventHandler, AriaAttributes, DetailedHTMLProps, ButtonHTMLAttributes, InputHTMLAttributes, Ref, RefObject, ImgHTMLAttributes, CSSProperties, SetStateAction, Key } from 'react';
|
|
2
|
-
import { K as Kind, C as Comp, G as GenericProps, H as HasTheme, a as HorizontalAlignment, S as Size, b as ColorPalette, E as Emphasis, V as ValueOf, A as Alignment, c as VerticalAlignment, O as Orientation, d as ColorVariant, T as Typography, e as TextElement, f as HeadingElement, g as AspectRatio, F as Falsy, h as FocusPoint, i as ThumbnailSize, j as ThumbnailVariant, k as HasClassName, l as HasAriaLabelOrLabelledBy, m as ComponentRef, n as GlobalSize, o as TypographyInterface } from './_internal/types.js';
|
|
3
|
-
export { A as Alignment, g as AspectRatio, t as Callback, p as Color, b as ColorPalette, d as ColorVariant, E as Emphasis, h as FocusPoint, G as GenericProps, n as GlobalSize, f as HeadingElement, a as HorizontalAlignment, K as Kind, O as Orientation, S as Size, e as TextElement, q as Theme, u as ThumbnailAspectRatio, i as ThumbnailSize, j as ThumbnailVariant, T as Typography, s as TypographyCustom, o as TypographyInterface, r as TypographyTitleCustom, c as VerticalAlignment } from './_internal/types.js';
|
|
2
|
+
import { K as Kind, C as Comp, G as GenericProps, H as HasTheme, a as HorizontalAlignment, S as Size, b as ColorPalette, E as Emphasis, V as ValueOf, A as Alignment, c as VerticalAlignment, O as Orientation, d as ColorVariant, T as Typography, e as TextElement, W as WhiteSpace, f as HeadingElement, g as AspectRatio, F as Falsy, h as FocusPoint, i as ThumbnailSize, j as ThumbnailVariant, k as HasClassName, l as HasAriaLabelOrLabelledBy, m as ComponentRef, n as GlobalSize, o as TypographyInterface } from './_internal/types.js';
|
|
3
|
+
export { A as Alignment, g as AspectRatio, t as Callback, p as Color, b as ColorPalette, d as ColorVariant, E as Emphasis, h as FocusPoint, G as GenericProps, n as GlobalSize, f as HeadingElement, a as HorizontalAlignment, K as Kind, O as Orientation, S as Size, e as TextElement, q as Theme, u as ThumbnailAspectRatio, i as ThumbnailSize, j as ThumbnailVariant, T as Typography, s as TypographyCustom, o as TypographyInterface, r as TypographyTitleCustom, c as VerticalAlignment, W as WhiteSpace } from './_internal/types.js';
|
|
4
4
|
|
|
5
5
|
interface AlertDialogProps extends Omit<DialogProps, 'header' | 'footer'> {
|
|
6
6
|
/** Message variant. */
|
|
@@ -1105,6 +1105,12 @@ interface TextProps extends GenericProps {
|
|
|
1105
1105
|
* (automatically activated when single line text truncate is activated).
|
|
1106
1106
|
*/
|
|
1107
1107
|
noWrap?: boolean;
|
|
1108
|
+
/**
|
|
1109
|
+
* WhiteSpace variant
|
|
1110
|
+
* Ignored when `noWrap` is set to true
|
|
1111
|
+
* Ignored when `truncate` is set to true or lines: 1
|
|
1112
|
+
* */
|
|
1113
|
+
whiteSpace?: WhiteSpace;
|
|
1108
1114
|
}
|
|
1109
1115
|
/**
|
|
1110
1116
|
* Text component.
|
package/index.js
CHANGED
|
@@ -256,6 +256,17 @@ const Kind = {
|
|
|
256
256
|
warning: 'warning',
|
|
257
257
|
error: 'error'
|
|
258
258
|
};
|
|
259
|
+
/**
|
|
260
|
+
* All available white-space values
|
|
261
|
+
* */
|
|
262
|
+
const WhiteSpace = {
|
|
263
|
+
normal: 'normal',
|
|
264
|
+
nowrap: 'nowrap',
|
|
265
|
+
pre: 'pre',
|
|
266
|
+
'pre-wrap': 'pre-wrap',
|
|
267
|
+
'pre-line': 'pre-line',
|
|
268
|
+
'break-spaces': 'break-spaces'
|
|
269
|
+
};
|
|
259
270
|
|
|
260
271
|
/**
|
|
261
272
|
* Re-exporting some utils types.
|
|
@@ -7009,7 +7020,7 @@ const GenericBlock = Object.assign(BaseGenericBlock, {
|
|
|
7009
7020
|
*/
|
|
7010
7021
|
const GenericBlockGapSize = pick(Size, ['tiny', 'regular', 'medium', 'big', 'huge']);
|
|
7011
7022
|
|
|
7012
|
-
const _excluded$s = ["as", "children", "className", "color", "colorVariant", "noWrap", "typography", "truncate", "style"];
|
|
7023
|
+
const _excluded$s = ["as", "children", "className", "color", "colorVariant", "noWrap", "typography", "truncate", "whiteSpace", "style"];
|
|
7013
7024
|
|
|
7014
7025
|
/**
|
|
7015
7026
|
* Defines the props of the component.
|
|
@@ -7047,6 +7058,7 @@ const Text = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
7047
7058
|
noWrap,
|
|
7048
7059
|
typography,
|
|
7049
7060
|
truncate,
|
|
7061
|
+
whiteSpace,
|
|
7050
7062
|
style
|
|
7051
7063
|
} = props,
|
|
7052
7064
|
forwardedProps = _objectWithoutProperties(props, _excluded$s);
|
|
@@ -7059,6 +7071,15 @@ const Text = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
7059
7071
|
};
|
|
7060
7072
|
const isTruncatedMultiline = !!truncateLinesStyle;
|
|
7061
7073
|
const isTruncated = !!truncate;
|
|
7074
|
+
|
|
7075
|
+
/**
|
|
7076
|
+
* Add custom white-space style if specified
|
|
7077
|
+
* Disabled if noWrap is specified
|
|
7078
|
+
* Disabled if truncated on one-line
|
|
7079
|
+
* */
|
|
7080
|
+
const whiteSpaceStyle = !noWrap && !(isTruncated && !isTruncatedMultiline) && whiteSpace && {
|
|
7081
|
+
'--lumx-text-white-space': whiteSpace
|
|
7082
|
+
};
|
|
7062
7083
|
return /*#__PURE__*/React.createElement(Component, _extends({
|
|
7063
7084
|
ref: ref,
|
|
7064
7085
|
className: classnames(className, handleBasicClasses({
|
|
@@ -7066,7 +7087,7 @@ const Text = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
7066
7087
|
isTruncated: isTruncated && !isTruncatedMultiline,
|
|
7067
7088
|
isTruncatedMultiline
|
|
7068
7089
|
}), typographyClass, colorClass, noWrap && `${CLASSNAME$o}--no-wrap`),
|
|
7069
|
-
style: _objectSpread2(_objectSpread2({}, truncateLinesStyle), style)
|
|
7090
|
+
style: _objectSpread2(_objectSpread2(_objectSpread2({}, truncateLinesStyle), whiteSpaceStyle), style)
|
|
7070
7091
|
}, forwardedProps), children && Children.toArray(children).map((child, index) => {
|
|
7071
7092
|
// Force wrap spaces around icons to make sure they are never stuck against text.
|
|
7072
7093
|
if (isComponent(Icon)(child)) {
|
|
@@ -12846,7 +12867,7 @@ function useTooltipOpen(delay, anchorElement) {
|
|
|
12846
12867
|
|
|
12847
12868
|
// Global close on escape
|
|
12848
12869
|
const [closeCallback, setCloseCallback] = useState(undefined);
|
|
12849
|
-
useCallbackOnEscape(closeCallback);
|
|
12870
|
+
useCallbackOnEscape(isOpen ? closeCallback : undefined);
|
|
12850
12871
|
useEffect(() => {
|
|
12851
12872
|
if (!anchorElement) {
|
|
12852
12873
|
return undefined;
|
|
@@ -13301,5 +13322,5 @@ UserBlock.displayName = COMPONENT_NAME$1l;
|
|
|
13301
13322
|
UserBlock.className = CLASSNAME$1i;
|
|
13302
13323
|
UserBlock.defaultProps = DEFAULT_PROPS$13;
|
|
13303
13324
|
|
|
13304
|
-
export { AlertDialog, Alignment, AspectRatio, Autocomplete, AutocompleteMultiple, Avatar, Badge, Button, ButtonEmphasis, ButtonGroup, Checkbox, Chip, ChipGroup, ColorPalette, ColorVariant, CommentBlock, CommentBlockVariant, DatePicker, DatePickerControlled, DatePickerField, Dialog, Divider, DragHandle, Dropdown, Emphasis, ExpansionPanel, Flag, FlexBox, GenericBlock, GenericBlockGapSize, Grid, GridColumn, GridItem, Heading, HeadingLevelProvider, Icon, IconButton, ImageBlock, ImageBlockCaptionPosition, InlineList, InputHelper, InputLabel, Kind, Lightbox, Link, LinkPreview, List, ListDivider, ListItem, ListSubheader, Message, Mosaic, Navigation, Notification, Orientation, Placement, Popover, PopoverDialog, PostBlock, Progress, ProgressCircular, ProgressLinear, ProgressTracker, ProgressTrackerProvider, ProgressTrackerStep, ProgressTrackerStepPanel, ProgressVariant, RadioButton, RadioGroup, Select, SelectMultiple, SelectMultipleField, SelectVariant, SideNavigation, SideNavigationItem, Size, SkeletonCircle, SkeletonRectangle, SkeletonRectangleVariant, SkeletonTypography, Slider, Slides, Slideshow, SlideshowControls, SlideshowItem, Switch, Tab, TabList, TabListLayout, TabPanel, TabProvider, Table, TableBody, TableCell, TableCellVariant, TableHeader, TableRow, Text, TextField, ThOrder, Theme, Thumbnail, ThumbnailAspectRatio, ThumbnailVariant, Toolbar, Tooltip, Typography, TypographyCustom, TypographyInterface, TypographyTitleCustom, Uploader, UploaderVariant, UserBlock, clamp, isClickable, useFocusPointStyle, useHeadingLevel };
|
|
13325
|
+
export { AlertDialog, Alignment, AspectRatio, Autocomplete, AutocompleteMultiple, Avatar, Badge, Button, ButtonEmphasis, ButtonGroup, Checkbox, Chip, ChipGroup, ColorPalette, ColorVariant, CommentBlock, CommentBlockVariant, DatePicker, DatePickerControlled, DatePickerField, Dialog, Divider, DragHandle, Dropdown, Emphasis, ExpansionPanel, Flag, FlexBox, GenericBlock, GenericBlockGapSize, Grid, GridColumn, GridItem, Heading, HeadingLevelProvider, Icon, IconButton, ImageBlock, ImageBlockCaptionPosition, InlineList, InputHelper, InputLabel, Kind, Lightbox, Link, LinkPreview, List, ListDivider, ListItem, ListSubheader, Message, Mosaic, Navigation, Notification, Orientation, Placement, Popover, PopoverDialog, PostBlock, Progress, ProgressCircular, ProgressLinear, ProgressTracker, ProgressTrackerProvider, ProgressTrackerStep, ProgressTrackerStepPanel, ProgressVariant, RadioButton, RadioGroup, Select, SelectMultiple, SelectMultipleField, SelectVariant, SideNavigation, SideNavigationItem, Size, SkeletonCircle, SkeletonRectangle, SkeletonRectangleVariant, SkeletonTypography, Slider, Slides, Slideshow, SlideshowControls, SlideshowItem, Switch, Tab, TabList, TabListLayout, TabPanel, TabProvider, Table, TableBody, TableCell, TableCellVariant, TableHeader, TableRow, Text, TextField, ThOrder, Theme, Thumbnail, ThumbnailAspectRatio, ThumbnailVariant, Toolbar, Tooltip, Typography, TypographyCustom, TypographyInterface, TypographyTitleCustom, Uploader, UploaderVariant, UserBlock, WhiteSpace, clamp, isClickable, useFocusPointStyle, useHeadingLevel };
|
|
13305
13326
|
//# sourceMappingURL=index.js.map
|