@lumx/react 2.1.9-alpha-thumbnail3 → 2.1.9-alpha-thumbnail4
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/esm/_internal/Avatar2.js +1 -5
- package/esm/_internal/Avatar2.js.map +1 -1
- package/esm/_internal/DragHandle.js +1 -1
- package/esm/_internal/DragHandle.js.map +1 -1
- package/esm/_internal/Flag2.js +1 -3
- package/esm/_internal/Flag2.js.map +1 -1
- package/esm/_internal/Icon2.js +9 -1
- package/esm/_internal/Icon2.js.map +1 -1
- package/esm/_internal/Message2.js +2 -2
- package/esm/_internal/Message2.js.map +1 -1
- package/esm/_internal/UserBlock.js +14 -45
- package/esm/_internal/UserBlock.js.map +1 -1
- package/esm/_internal/user-block.js +0 -2
- package/esm/_internal/user-block.js.map +1 -1
- package/esm/index.js +0 -1
- package/esm/index.js.map +1 -1
- package/package.json +4 -4
- package/src/components/avatar/Avatar.tsx +0 -8
- package/src/components/drag-handle/DragHandle.tsx +5 -1
- package/src/components/flag/Flag.test.tsx +1 -2
- package/src/components/flag/Flag.tsx +2 -10
- package/src/components/flag/__snapshots__/Flag.test.tsx.snap +0 -15
- package/src/components/icon/Icon.tsx +10 -1
- package/src/components/message/Message.tsx +2 -2
- package/src/components/thumbnail/__snapshots__/Thumbnail.test.tsx.snap +6 -53
- package/src/components/user-block/UserBlock.stories.tsx +4 -30
- package/src/components/user-block/UserBlock.tsx +16 -41
- package/src/components/user-block/__snapshots__/UserBlock.test.tsx.snap +145 -244
- package/types.d.ts +0 -8
package/esm/_internal/Avatar2.js
CHANGED
|
@@ -44,9 +44,7 @@ var Avatar = forwardRef(function (props, ref) {
|
|
|
44
44
|
size = props.size,
|
|
45
45
|
theme = props.theme,
|
|
46
46
|
thumbnailProps = props.thumbnailProps,
|
|
47
|
-
|
|
48
|
-
linkAs = props.linkAs,
|
|
49
|
-
forwardedProps = _objectWithoutProperties(props, ["actions", "alt", "badge", "className", "image", "onClick", "onKeyPress", "size", "theme", "thumbnailProps", "linkProps", "linkAs"]);
|
|
47
|
+
forwardedProps = _objectWithoutProperties(props, ["actions", "alt", "badge", "className", "image", "onClick", "onKeyPress", "size", "theme", "thumbnailProps"]);
|
|
50
48
|
|
|
51
49
|
return React.createElement("div", _extends({
|
|
52
50
|
ref: ref
|
|
@@ -57,8 +55,6 @@ var Avatar = forwardRef(function (props, ref) {
|
|
|
57
55
|
theme: theme
|
|
58
56
|
}))
|
|
59
57
|
}), React.createElement(Thumbnail, _extends({
|
|
60
|
-
linkProps: linkProps,
|
|
61
|
-
linkAs: linkAs,
|
|
62
58
|
className: "".concat(CLASSNAME, "__thumbnail"),
|
|
63
59
|
onClick: onClick,
|
|
64
60
|
onKeyPress: onKeyPress
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Avatar2.js","sources":["../../../src/components/avatar/Avatar.tsx"],"sourcesContent":["import React, { forwardRef, KeyboardEventHandler, MouseEventHandler, ReactElement, ReactNode } from 'react';\n\nimport classNames from 'classnames';\n\nimport { AspectRatio, Size, Theme, Thumbnail, ThumbnailProps } from '@lumx/react';\n\nimport { Comp, GenericProps, getRootClassName, handleBasicClasses } from '@lumx/react/utils';\n\n/**\n * Avatar sizes.\n */\nexport type AvatarSize = Extract<Size, 'xs' | 's' | 'm' | 'l' | 'xl' | 'xxl'>;\n\n/**\n * Defines the props of the component.\n */\nexport interface AvatarProps extends GenericProps {\n /** Action toolbar content. */\n actions?: ReactNode;\n /** Image alternative text. */\n alt: string;\n /** Badge. */\n badge?: ReactElement;\n /** Image URL. */\n image: string;\n /** On click callback. */\n onClick?: MouseEventHandler<HTMLDivElement>;\n /** On key press callback. */\n onKeyPress?: KeyboardEventHandler<HTMLDivElement>;\n /** Size variant. */\n size?: AvatarSize;\n /** Theme adapting the component to light or dark background. */\n theme?: Theme;\n /** Props to pass to the thumbnail (minus those already set by the Avatar props). */\n thumbnailProps?: Omit<\n ThumbnailProps,\n 'image' | 'alt' | 'size' | 'theme' | 'align' | 'fillHeight' | 'variant' | 'aspectRatio'\n >;\n
|
|
1
|
+
{"version":3,"file":"Avatar2.js","sources":["../../../src/components/avatar/Avatar.tsx"],"sourcesContent":["import React, { forwardRef, KeyboardEventHandler, MouseEventHandler, ReactElement, ReactNode } from 'react';\n\nimport classNames from 'classnames';\n\nimport { AspectRatio, Size, Theme, Thumbnail, ThumbnailProps } from '@lumx/react';\n\nimport { Comp, GenericProps, getRootClassName, handleBasicClasses } from '@lumx/react/utils';\n\n/**\n * Avatar sizes.\n */\nexport type AvatarSize = Extract<Size, 'xs' | 's' | 'm' | 'l' | 'xl' | 'xxl'>;\n\n/**\n * Defines the props of the component.\n */\nexport interface AvatarProps extends GenericProps {\n /** Action toolbar content. */\n actions?: ReactNode;\n /** Image alternative text. */\n alt: string;\n /** Badge. */\n badge?: ReactElement;\n /** Image URL. */\n image: string;\n /** On click callback. */\n onClick?: MouseEventHandler<HTMLDivElement>;\n /** On key press callback. */\n onKeyPress?: KeyboardEventHandler<HTMLDivElement>;\n /** Size variant. */\n size?: AvatarSize;\n /** Theme adapting the component to light or dark background. */\n theme?: Theme;\n /** Props to pass to the thumbnail (minus those already set by the Avatar props). */\n thumbnailProps?: Omit<\n ThumbnailProps,\n 'image' | 'alt' | 'size' | 'theme' | 'align' | 'fillHeight' | 'variant' | 'aspectRatio'\n >;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'Avatar';\n\n/**\n * Component default class name and class prefix.\n */\nconst CLASSNAME = getRootClassName(COMPONENT_NAME);\n\n/**\n * Component default props.\n */\nconst DEFAULT_PROPS: Partial<AvatarProps> = {\n size: Size.m,\n theme: Theme.light,\n};\n\n/**\n * Avatar component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const Avatar: Comp<AvatarProps, HTMLDivElement> = forwardRef((props, ref) => {\n const {\n actions,\n alt,\n badge,\n className,\n image,\n onClick,\n onKeyPress,\n size,\n theme,\n thumbnailProps,\n ...forwardedProps\n } = props;\n\n return (\n <div\n ref={ref}\n {...forwardedProps}\n className={classNames(className, handleBasicClasses({ prefix: CLASSNAME, size, theme }))}\n >\n <Thumbnail\n className={`${CLASSNAME}__thumbnail`}\n onClick={onClick}\n onKeyPress={onKeyPress}\n {...thumbnailProps}\n aspectRatio={AspectRatio.square}\n size={size}\n image={image}\n alt={alt}\n />\n {actions && <div className={`${CLASSNAME}__actions`}>{actions}</div>}\n {badge && <div className={`${CLASSNAME}__badge`}>{badge}</div>}\n </div>\n );\n});\nAvatar.displayName = COMPONENT_NAME;\nAvatar.className = CLASSNAME;\nAvatar.defaultProps = DEFAULT_PROPS;\n"],"names":["COMPONENT_NAME","CLASSNAME","getRootClassName","DEFAULT_PROPS","size","Size","m","theme","Theme","light","Avatar","forwardRef","props","ref","actions","alt","badge","className","image","onClick","onKeyPress","thumbnailProps","forwardedProps","classNames","handleBasicClasses","prefix","AspectRatio","square","displayName","defaultProps"],"mappings":";;;;;;AAQA;;;;AAgCA;;;AAGA,IAAMA,cAAc,GAAG,QAAvB;AAEA;;;;AAGA,IAAMC,SAAS,GAAGC,gBAAgB,CAACF,cAAD,CAAlC;AAEA;;;;AAGA,IAAMG,aAAmC,GAAG;AACxCC,EAAAA,IAAI,EAAEC,IAAI,CAACC,CAD6B;AAExCC,EAAAA,KAAK,EAAEC,KAAK,CAACC;AAF2B,CAA5C;AAKA;;;;;;;;IAOaC,MAAyC,GAAGC,UAAU,CAAC,UAACC,KAAD,EAAQC,GAAR,EAAgB;AAAA,MAE5EC,OAF4E,GAa5EF,KAb4E,CAE5EE,OAF4E;AAAA,MAG5EC,GAH4E,GAa5EH,KAb4E,CAG5EG,GAH4E;AAAA,MAI5EC,KAJ4E,GAa5EJ,KAb4E,CAI5EI,KAJ4E;AAAA,MAK5EC,SAL4E,GAa5EL,KAb4E,CAK5EK,SAL4E;AAAA,MAM5EC,KAN4E,GAa5EN,KAb4E,CAM5EM,KAN4E;AAAA,MAO5EC,OAP4E,GAa5E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mdiDragVertical,
|
|
43
|
-
color: theme === Theme.dark ? ColorPalette.light :
|
|
43
|
+
color: theme === Theme.dark ? ColorPalette.light : ColorPalette.dark,
|
|
44
44
|
size: Size.xs
|
|
45
45
|
}));
|
|
46
46
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DragHandle.js","sources":["../../../src/components/drag-handle/DragHandle.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\n\nimport classNames from 'classnames';\n\nimport { mdiDragVertical } from '@lumx/icons';\nimport { ColorPalette, Icon, Size, Theme } from '@lumx/react';\nimport { Comp, GenericProps, getRootClassName, handleBasicClasses } from '@lumx/react/utils';\n\n/**\n * Defines the props of the component.\n */\nexport interface DragHandleProps extends GenericProps {\n /** Theme adapting the component to light or dark background. */\n theme?: Theme;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'DragHandle';\n\n/**\n * Component default class name and class prefix.\n */\nconst CLASSNAME = getRootClassName(COMPONENT_NAME);\n\n/**\n * DragHandle component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const DragHandle: Comp<DragHandleProps, HTMLDivElement> = forwardRef((props, ref) => {\n const { className, theme, ...forwardedProps } = props;\n\n return (\n <div\n ref={ref}\n {...forwardedProps}\n className={classNames(className, handleBasicClasses({ prefix: CLASSNAME, theme }))}\n >\n <Icon
|
|
1
|
+
{"version":3,"file":"DragHandle.js","sources":["../../../src/components/drag-handle/DragHandle.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\n\nimport classNames from 'classnames';\n\nimport { mdiDragVertical } from '@lumx/icons';\nimport { ColorPalette, Icon, Size, Theme } from '@lumx/react';\nimport { Comp, GenericProps, getRootClassName, handleBasicClasses } from '@lumx/react/utils';\n\n/**\n * Defines the props of the component.\n */\nexport interface DragHandleProps extends GenericProps {\n /** Theme adapting the component to light or dark background. */\n theme?: Theme;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'DragHandle';\n\n/**\n * Component default class name and class prefix.\n */\nconst CLASSNAME = getRootClassName(COMPONENT_NAME);\n\n/**\n * DragHandle component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const DragHandle: Comp<DragHandleProps, HTMLDivElement> = forwardRef((props, ref) => {\n const { className, theme, ...forwardedProps } = props;\n\n return (\n <div\n ref={ref}\n {...forwardedProps}\n className={classNames(className, handleBasicClasses({ prefix: CLASSNAME, theme }))}\n >\n <Icon\n icon={mdiDragVertical}\n color={theme === Theme.dark ? ColorPalette.light : ColorPalette.dark}\n size={Size.xs}\n />\n </div>\n );\n});\nDragHandle.displayName = COMPONENT_NAME;\nDragHandle.className = CLASSNAME;\n"],"names":["COMPONENT_NAME","CLASSNAME","getRootClassName","DragHandle","forwardRef","props","ref","className","theme","forwardedProps","classNames","handleBasicClasses","prefix","mdiDragVertical","Theme","dark","ColorPalette","light","Size","xs","displayName"],"mappings":";;;;;;;AAQA;;;;AAQA;;;AAGA,IAAMA,cAAc,GAAG,YAAvB;AAEA;;;;AAGA,IAAMC,SAAS,GAAGC,gBAAgB,CAACF,cAAD,CAAlC;AAEA;;;;;;;;IAOaG,UAAiD,GAAGC,UAAU,CAAC,UAACC,KAAD,EAAQC,GAAR,EAAgB;AAAA,MAChFC,SADgF,GACxCF,KADwC,CAChFE,SADgF;AAAA,MACrEC,KADqE,GACxCH,KADwC,CACrEG,KADqE;AAAA,MAC3DC,cAD2D,4BACxCJ,KADwC;;AAGxF,SACI;AACI,IAAA,GAAG,EAAEC;AADT,KAEQG,cAFR;AAGI,IAAA,SAAS,EAAEC,UAAU,CAACH,SAAD,EAAYI,kBAAkB,CAAC;AAAEC,MAAAA,MAAM,EAAEX,SAAV;AAAqBO,MAAAA,KAAK,EAALA;AAArB,KAAD,CAA9B;AAHzB,MAKI,oBAAC,IAAD;AACI,IAAA,IAAI,EAAEK,eADV;AAEI,IAAA,KAAK,EAAEL,KAAK,KAAKM,KAAK,CAACC,IAAhB,GAAuBC,YAAY,CAACC,KAApC,GAA4CD,YAAY,CAACD,IAFpE;AAGI,IAAA,IAAI,EAAEG,IAAI,CAACC;AAHf,IALJ,CADJ;AAaH,CAhB0E;AAiB3EhB,UAAU,CAACiB,WAAX,GAAyBpB,cAAzB;AACAG,UAAU,CAACI,SAAX,GAAuBN,SAAvB;;;;"}
|
package/esm/_internal/Flag2.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { b as _objectWithoutProperties, c as _extends } from './_rollupPluginBabelHelpers.js';
|
|
2
|
-
import {
|
|
2
|
+
import { Size, Theme, ColorPalette } from './components.js';
|
|
3
3
|
import React, { forwardRef } from 'react';
|
|
4
4
|
import { g as getRootClassName, c as classnames, h as handleBasicClasses } from './getRootClassName.js';
|
|
5
5
|
import { I as Icon } from './Icon2.js';
|
|
@@ -34,8 +34,6 @@ var Flag = forwardRef(function (props, ref) {
|
|
|
34
34
|
ref: ref
|
|
35
35
|
}), icon && React.createElement(Icon, {
|
|
36
36
|
icon: icon,
|
|
37
|
-
color: color,
|
|
38
|
-
colorVariant: ColorVariant.D2,
|
|
39
37
|
size: Size.xxs,
|
|
40
38
|
className: "".concat(CLASSNAME, "__icon")
|
|
41
39
|
}), React.createElement("span", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Flag2.js","sources":["../../../src/components/flag/Flag.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\nimport classNames from 'classnames';\n\nimport { ColorPalette,
|
|
1
|
+
{"version":3,"file":"Flag2.js","sources":["../../../src/components/flag/Flag.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\nimport classNames from 'classnames';\n\nimport { ColorPalette, Icon, Size, Theme } from '@lumx/react';\nimport { Comp, GenericProps, getRootClassName, handleBasicClasses } from '@lumx/react/utils';\n\nexport interface FlagProps extends GenericProps {\n /** Theme adapting the component to light or dark background. */\n theme?: Theme;\n /** Color of the component. */\n color?: ColorPalette;\n /** Icon to use before the label. */\n icon?: string;\n /** Text label of the flag. */\n label: string;\n}\n\nconst COMPONENT_NAME = 'Flag';\nconst CLASSNAME = getRootClassName(COMPONENT_NAME);\nconst DEFAULT_PROPS: Partial<FlagProps> = {\n theme: Theme.light,\n};\n\n/**\n * Flag component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const Flag: Comp<FlagProps, HTMLDivElement> = forwardRef((props, ref) => {\n const { label, icon, color, className, theme, ...forwardedProps } = props;\n const flagColor = color || (theme === Theme.light ? ColorPalette.dark : ColorPalette.light);\n\n return (\n <div\n {...forwardedProps}\n className={classNames(className, handleBasicClasses({ prefix: CLASSNAME, color: flagColor }))}\n ref={ref}\n >\n {icon && <Icon icon={icon} size={Size.xxs} className={`${CLASSNAME}__icon`} />}\n <span className={`${CLASSNAME}__label`}>{label}</span>\n </div>\n );\n});\nFlag.displayName = COMPONENT_NAME;\nFlag.className = CLASSNAME;\nFlag.defaultProps = DEFAULT_PROPS;\n"],"names":["COMPONENT_NAME","CLASSNAME","getRootClassName","DEFAULT_PROPS","theme","Theme","light","Flag","forwardRef","props","ref","label","icon","color","className","forwardedProps","flagColor","ColorPalette","dark","classNames","handleBasicClasses","prefix","Size","xxs","displayName","defaultProps"],"mappings":";;;;;;AAiBA,IAAMA,cAAc,GAAG,MAAvB;AACA,IAAMC,SAAS,GAAGC,gBAAgB,CAACF,cAAD,CAAlC;AACA,IAAMG,aAAiC,GAAG;AACtCC,EAAAA,KAAK,EAAEC,KAAK,CAACC;AADyB,CAA1C;AAIA;;;;;;;;IAOaC,IAAqC,GAAGC,UAAU,CAAC,UAACC,KAAD,EAAQC,GAAR,EAAgB;AAAA,MACpEC,KADoE,GACRF,KADQ,CACpEE,KADoE;AAAA,MAC7DC,IAD6D,GACRH,KADQ,CAC7DG,IAD6D;AAAA,MACvDC,KADuD,GACRJ,KADQ,CACvDI,KADuD;AAAA,MAChDC,SADgD,GACRL,KADQ,CAChDK,SADgD;AAAA,MACrCV,KADqC,GACRK,KADQ,CACrCL,KADqC;AAAA,MAC3BW,cAD2B,4BACRN,KADQ;;AAE5E,MAAMO,SAAS,GAAGH,KAAK,KAAKT,KAAK,KAAKC,KAAK,CAACC,KAAhB,GAAwBW,YAAY,CAACC,IAArC,GAA4CD,YAAY,CAACX,KAA9D,CAAvB;AAEA,SACI,wCACQS,cADR;AAEI,IAAA,SAAS,EAAEI,UAAU,CAACL,SAAD,EAAYM,kBAAkB,CAAC;AAAEC,MAAAA,MAAM,EAAEpB,SAAV;AAAqBY,MAAAA,KAAK,EAAEG;AAA5B,KAAD,CAA9B,CAFzB;AAGI,IAAA,GAAG,EAAEN;AAHT,MAKKE,IAAI,IAAI,oBAAC,IAAD;AAAM,IAAA,IAAI,EAAEA,IAAZ;AAAkB,IAAA,IAAI,EAAEU,IAAI,CAACC,GAA7B;AAAkC,IAAA,SAAS,YAAKtB,SAAL;AAA3C,IALb,EAMI;AAAM,IAAA,SAAS,YAAKA,SAAL;AAAf,KAAyCU,KAAzC,CANJ,CADJ;AAUH,CAd8D;AAe/DJ,IAAI,CAACiB,WAAL,GAAmBxB,cAAnB;AACAO,IAAI,CAACO,SAAL,GAAiBb,SAAjB;AACAM,IAAI,CAACkB,YAAL,GAAoBtB,aAApB;;;;"}
|
package/esm/_internal/Icon2.js
CHANGED
|
@@ -36,11 +36,19 @@ var Icon = forwardRef(function (props, ref) {
|
|
|
36
36
|
forwardedProps = _objectWithoutProperties(props, ["className", "color", "colorVariant", "hasShape", "icon", "size", "theme"]);
|
|
37
37
|
|
|
38
38
|
var iconColor;
|
|
39
|
+
var iconColorVariant;
|
|
39
40
|
|
|
40
41
|
if (color) {
|
|
41
42
|
iconColor = color;
|
|
43
|
+
iconColorVariant = colorVariant;
|
|
42
44
|
} else if (theme) {
|
|
43
45
|
iconColor = theme === Theme.light ? ColorPalette.dark : ColorPalette.light;
|
|
46
|
+
|
|
47
|
+
if (colorVariant) {
|
|
48
|
+
iconColorVariant = colorVariant;
|
|
49
|
+
} else {
|
|
50
|
+
iconColorVariant = Theme.light ? 'L1' : 'N';
|
|
51
|
+
}
|
|
44
52
|
} else if (hasShape) {
|
|
45
53
|
iconColor = ColorPalette.dark;
|
|
46
54
|
}
|
|
@@ -68,7 +76,7 @@ var Icon = forwardRef(function (props, ref) {
|
|
|
68
76
|
}, forwardedProps, {
|
|
69
77
|
className: classnames(className, handleBasicClasses({
|
|
70
78
|
color: iconColor,
|
|
71
|
-
colorVariant:
|
|
79
|
+
colorVariant: iconColorVariant,
|
|
72
80
|
hasShape: hasShape,
|
|
73
81
|
prefix: CLASSNAME,
|
|
74
82
|
size: iconSize
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Icon2.js","sources":["../../../src/components/icon/Icon.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\n\nimport classNames from 'classnames';\n\nimport { Color, ColorPalette, ColorVariant, Size, Theme } from '@lumx/react';\nimport { Comp, GenericProps, getRootClassName, handleBasicClasses } from '@lumx/react/utils';\n\nexport type IconSizes = Extract<Size, 'xxs' | 'xs' | 's' | 'm' | 'l' | 'xl' | 'xxl'>;\n\n/**\n * Defines the props of the component.\n */\nexport interface IconProps extends GenericProps {\n /** Color variant. */\n color?: Color;\n /** Lightened or darkened variant of the selected icon color. */\n colorVariant?: ColorVariant;\n /** Whether the icon has a shape. */\n hasShape?: boolean;\n /**\n * Icon (SVG path).draw code (`d` property of the `<path>` SVG element).\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths}\n */\n icon: string;\n /** Size variant. */\n size?: IconSizes;\n /** Theme adapting the component to light or dark background. */\n theme?: Theme;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'Icon';\n\n/**\n * Component default class name and class prefix.\n */\nconst CLASSNAME = getRootClassName(COMPONENT_NAME);\n\n/**\n * Component default props.\n */\nconst DEFAULT_PROPS: Partial<IconProps> = {};\n\n/**\n * Icon component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const Icon: Comp<IconProps, HTMLElement> = forwardRef((props, ref) => {\n const { className, color, colorVariant, hasShape, icon, size, theme, ...forwardedProps } = props;\n let iconColor;\n if (color) {\n iconColor = color;\n } else if (theme) {\n iconColor = theme === Theme.light ? ColorPalette.dark : ColorPalette.light;\n } else if (hasShape) {\n iconColor = ColorPalette.dark;\n }\n\n let iconSize;\n if (size) {\n if (hasShape) {\n if (size === Size.xxs || size === Size.xs) {\n iconSize = Size.s;\n } else if (size === Size.xxl) {\n iconSize = Size.xl;\n } else {\n iconSize = size;\n }\n } else {\n iconSize = size;\n }\n } else if (hasShape) {\n iconSize = Size.m;\n }\n\n return (\n <i\n ref={ref}\n {...forwardedProps}\n className={classNames(\n className,\n handleBasicClasses({\n color: iconColor,\n colorVariant,\n hasShape,\n prefix: CLASSNAME,\n size: iconSize,\n }),\n !hasShape && `${CLASSNAME}--no-shape`,\n `${CLASSNAME}--path`,\n )}\n >\n <svg\n aria-hidden=\"true\"\n height=\"1em\"\n preserveAspectRatio=\"xMidYMid meet\"\n style={{ verticalAlign: '-0.125em' }}\n viewBox=\"0 0 24 24\"\n width=\"1em\"\n >\n <path d={icon} fill=\"currentColor\" />\n </svg>\n </i>\n );\n});\nIcon.displayName = COMPONENT_NAME;\nIcon.className = CLASSNAME;\nIcon.defaultProps = DEFAULT_PROPS;\n"],"names":["COMPONENT_NAME","CLASSNAME","getRootClassName","DEFAULT_PROPS","Icon","forwardRef","props","ref","className","color","colorVariant","hasShape","icon","size","theme","forwardedProps","iconColor","Theme","light","ColorPalette","dark","iconSize","Size","xxs","xs","s","xxl","xl","m","classNames","handleBasicClasses","prefix","verticalAlign","displayName","defaultProps"],"mappings":";;;;;AA8BA;;;AAGA,IAAMA,cAAc,GAAG,MAAvB;AAEA;;;;AAGA,IAAMC,SAAS,GAAGC,gBAAgB,CAACF,cAAD,CAAlC;AAEA;;;;AAGA,IAAMG,aAAiC,GAAG,EAA1C;AAEA;;;;;;;;IAOaC,IAAkC,GAAGC,UAAU,CAAC,UAACC,KAAD,EAAQC,GAAR,EAAgB;AAAA,MACjEC,SADiE,GACkBF,KADlB,CACjEE,SADiE;AAAA,MACtDC,KADsD,GACkBH,KADlB,CACtDG,KADsD;AAAA,MAC/CC,YAD+C,GACkBJ,KADlB,CAC/CI,YAD+C;AAAA,MACjCC,QADiC,GACkBL,KADlB,CACjCK,QADiC;AAAA,MACvBC,IADuB,GACkBN,KADlB,CACvBM,IADuB;AAAA,MACjBC,IADiB,GACkBP,KADlB,CACjBO,IADiB;AAAA,MACXC,KADW,GACkBR,KADlB,CACXQ,KADW;AAAA,MACDC,cADC,4BACkBT,KADlB;;
|
|
1
|
+
{"version":3,"file":"Icon2.js","sources":["../../../src/components/icon/Icon.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\n\nimport classNames from 'classnames';\n\nimport { Color, ColorPalette, ColorVariant, Size, Theme } from '@lumx/react';\nimport { Comp, GenericProps, getRootClassName, handleBasicClasses } from '@lumx/react/utils';\n\nexport type IconSizes = Extract<Size, 'xxs' | 'xs' | 's' | 'm' | 'l' | 'xl' | 'xxl'>;\n\n/**\n * Defines the props of the component.\n */\nexport interface IconProps extends GenericProps {\n /** Color variant. */\n color?: Color;\n /** Lightened or darkened variant of the selected icon color. */\n colorVariant?: ColorVariant;\n /** Whether the icon has a shape. */\n hasShape?: boolean;\n /**\n * Icon (SVG path).draw code (`d` property of the `<path>` SVG element).\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths}\n */\n icon: string;\n /** Size variant. */\n size?: IconSizes;\n /** Theme adapting the component to light or dark background. */\n theme?: Theme;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'Icon';\n\n/**\n * Component default class name and class prefix.\n */\nconst CLASSNAME = getRootClassName(COMPONENT_NAME);\n\n/**\n * Component default props.\n */\nconst DEFAULT_PROPS: Partial<IconProps> = {};\n\n/**\n * Icon component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const Icon: Comp<IconProps, HTMLElement> = forwardRef((props, ref) => {\n const { className, color, colorVariant, hasShape, icon, size, theme, ...forwardedProps } = props;\n\n let iconColor;\n let iconColorVariant;\n if (color) {\n iconColor = color;\n iconColorVariant = colorVariant;\n } else if (theme) {\n iconColor = theme === Theme.light ? ColorPalette.dark : ColorPalette.light;\n\n if (colorVariant) {\n iconColorVariant = colorVariant;\n } else {\n iconColorVariant = Theme.light ? 'L1' : 'N';\n }\n } else if (hasShape) {\n iconColor = ColorPalette.dark;\n }\n\n let iconSize;\n if (size) {\n if (hasShape) {\n if (size === Size.xxs || size === Size.xs) {\n iconSize = Size.s;\n } else if (size === Size.xxl) {\n iconSize = Size.xl;\n } else {\n iconSize = size;\n }\n } else {\n iconSize = size;\n }\n } else if (hasShape) {\n iconSize = Size.m;\n }\n\n return (\n <i\n ref={ref}\n {...forwardedProps}\n className={classNames(\n className,\n handleBasicClasses({\n color: iconColor,\n colorVariant: iconColorVariant,\n hasShape,\n prefix: CLASSNAME,\n size: iconSize,\n }),\n !hasShape && `${CLASSNAME}--no-shape`,\n `${CLASSNAME}--path`,\n )}\n >\n <svg\n aria-hidden=\"true\"\n height=\"1em\"\n preserveAspectRatio=\"xMidYMid meet\"\n style={{ verticalAlign: '-0.125em' }}\n viewBox=\"0 0 24 24\"\n width=\"1em\"\n >\n <path d={icon} fill=\"currentColor\" />\n </svg>\n </i>\n );\n});\nIcon.displayName = COMPONENT_NAME;\nIcon.className = CLASSNAME;\nIcon.defaultProps = DEFAULT_PROPS;\n"],"names":["COMPONENT_NAME","CLASSNAME","getRootClassName","DEFAULT_PROPS","Icon","forwardRef","props","ref","className","color","colorVariant","hasShape","icon","size","theme","forwardedProps","iconColor","iconColorVariant","Theme","light","ColorPalette","dark","iconSize","Size","xxs","xs","s","xxl","xl","m","classNames","handleBasicClasses","prefix","verticalAlign","displayName","defaultProps"],"mappings":";;;;;AA8BA;;;AAGA,IAAMA,cAAc,GAAG,MAAvB;AAEA;;;;AAGA,IAAMC,SAAS,GAAGC,g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|
65
65
|
}))
|
|
66
66
|
}, forwardedProps), (customIcon || icon) && React.createElement(Icon, {
|
|
67
|
-
className: "
|
|
67
|
+
className: "".concat(CLASSNAME, "__icon"),
|
|
68
68
|
icon: customIcon || icon,
|
|
69
69
|
size: Size.xs
|
|
70
70
|
}), React.createElement("div", {
|
|
71
|
-
className: "
|
|
71
|
+
className: "".concat(CLASSNAME, "__text")
|
|
72
72
|
}, children));
|
|
73
73
|
});
|
|
74
74
|
Message.displayName = COMPONENT_NAME;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Message2.js","sources":["../../../src/components/message/Message.tsx"],"sourcesContent":["import { mdiAlert, mdiAlertCircle, mdiCheckCircle, mdiInformation } from '@lumx/icons';\nimport { ColorPalette, Icon, Kind, Size } from '@lumx/react';\nimport { Comp, GenericProps, getRootClassName, handleBasicClasses } from '@lumx/react/utils';\nimport classNames from 'classnames';\nimport React, { forwardRef, ReactNode } from 'react';\n\n/**\n * Defines the props of the component.\n */\nexport interface MessageProps extends GenericProps {\n /** Content. */\n children?: ReactNode;\n /** Whether the message has a background or not. */\n hasBackground?: boolean;\n /** Message variant. */\n kind?: Kind;\n /** Message custom icon SVG path. */\n icon?: string;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'Message';\n\n/**\n * Component default class name and class prefix.\n */\nconst CLASSNAME = getRootClassName(COMPONENT_NAME);\n\n/**\n * Associative map from message kind to color and icon.\n */\nconst CONFIG = {\n [Kind.error]: { color: ColorPalette.red, icon: mdiAlert },\n [Kind.info]: { color: ColorPalette.dark, icon: mdiInformation },\n [Kind.success]: { color: ColorPalette.green, icon: mdiCheckCircle },\n [Kind.warning]: { color: ColorPalette.yellow, icon: mdiAlertCircle },\n};\n\n/**\n * Message component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const Message: Comp<MessageProps, HTMLDivElement> = forwardRef((props, ref) => {\n const { children, className, hasBackground, kind, icon: customIcon, ...forwardedProps } = props;\n const { color, icon } = CONFIG[kind as Kind] || {};\n\n return (\n <div\n ref={ref}\n className={classNames(\n className,\n handleBasicClasses({\n color,\n hasBackground,\n prefix: CLASSNAME,\n }),\n )}\n {...forwardedProps}\n >\n {(customIcon || icon) && <Icon className
|
|
1
|
+
{"version":3,"file":"Message2.js","sources":["../../../src/components/message/Message.tsx"],"sourcesContent":["import { mdiAlert, mdiAlertCircle, mdiCheckCircle, mdiInformation } from '@lumx/icons';\nimport { ColorPalette, Icon, Kind, Size } from '@lumx/react';\nimport { Comp, GenericProps, getRootClassName, handleBasicClasses } from '@lumx/react/utils';\nimport classNames from 'classnames';\nimport React, { forwardRef, ReactNode } from 'react';\n\n/**\n * Defines the props of the component.\n */\nexport interface MessageProps extends GenericProps {\n /** Content. */\n children?: ReactNode;\n /** Whether the message has a background or not. */\n hasBackground?: boolean;\n /** Message variant. */\n kind?: Kind;\n /** Message custom icon SVG path. */\n icon?: string;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'Message';\n\n/**\n * Component default class name and class prefix.\n */\nconst CLASSNAME = getRootClassName(COMPONENT_NAME);\n\n/**\n * Associative map from message kind to color and icon.\n */\nconst CONFIG = {\n [Kind.error]: { color: ColorPalette.red, icon: mdiAlert },\n [Kind.info]: { color: ColorPalette.dark, icon: mdiInformation },\n [Kind.success]: { color: ColorPalette.green, icon: mdiCheckCircle },\n [Kind.warning]: { color: ColorPalette.yellow, icon: mdiAlertCircle },\n};\n\n/**\n * Message component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const Message: Comp<MessageProps, HTMLDivElement> = forwardRef((props, ref) => {\n const { children, className, hasBackground, kind, icon: customIcon, ...forwardedProps } = props;\n const { color, icon } = CONFIG[kind as Kind] || {};\n\n return (\n <div\n ref={ref}\n className={classNames(\n className,\n handleBasicClasses({\n color,\n hasBackground,\n prefix: CLASSNAME,\n }),\n )}\n {...forwardedProps}\n >\n {(customIcon || icon) && <Icon className={`${CLASSNAME}__icon`} icon={customIcon || icon} size={Size.xs} />}\n <div className={`${CLASSNAME}__text`}>{children}</div>\n </div>\n );\n});\nMessage.displayName = COMPONENT_NAME;\nMessage.className = CLASSNAME;\n"],"names":["COMPONENT_NAME","CLASSNAME","getRootClassName","CONFIG","Kind","error","color","ColorPalette","red","icon","mdiAlert","info","dark","mdiInformation","success","green","mdiCheckCircle","warning","yellow","mdiAlertCircle","Message","forwardRef","props","ref","children","className","hasBackground","kind","customIcon","forwardedProps","classNames","handleBasicClasses","prefix","Size","xs","displayName"],"mappings":";;;;;;;;AAMA;;;;AAcA;;;AAGA,IAAMA,cAAc,GAAG,SAAvB;AAEA;;;;AAGA,IAAMC,SAAS,GAAGC,gBAAgB,CAACF,cAAD,CAAlC;AAEA;;;;AAGA,IAAMG,MAAM,2CACPC,IAAI,CAACC,KADE,EACM;AAAEC,EAAAA,KAAK,EAAEC,YAAY,CAACC,GAAtB;AAA2BC,EAAAA,IAAI,EAAEC;AAAjC,CADN,4BAEPN,IAAI,CAACO,IAFE,EAEK;AAAEL,EAAAA,KAAK,EAAEC,YAAY,CAACK,IAAtB;AAA4BH,EAAAA,IAAI,EAAEI;AAAlC,CAFL,4BAGPT,IAAI,CAACU,OAHE,EAGQ;AAAER,EAAAA,KAAK,EAAEC,YAAY,CAACQ,KAAtB;AAA6BN,EAAAA,IAAI,EAAEO;AAAnC,CAHR,4BAIPZ,IAAI,CAACa,OAJE,EAIQ;AAAEX,EAAAA,KAAK,EAAEC,YAAY,CAACW,MAAtB;AAA8BT,EAAAA,IAAI,EAAEU;AAApC,CAJR,WAAZ;AAOA;;;;;;;;IAOaC,OAA2C,GAAGC,UAAU,CAAC,UAACC,KAAD,EAAQC,GAAR,EAAgB;AAAA,MAC1EC,QAD0E,GACQF,KADR,CAC1EE,QAD0E;AAAA,MAChEC,SADgE,GACQH,KADR,CAChEG,SADgE;AAAA,MACrDC,aADqD,GACQJ,KADR,CACrDI,aADqD;AAAA,MACtCC,IADsC,GACQL,KADR,CACtCK,IADsC;AAAA,MAC1BC,UAD0B,GACQN,KADR,CAChCb,IADgC;AAAA,MACXoB,cADW,4BACQP,KADR;;AAAA,aAE1DnB,MAAM,CAACwB,IAAD,CAAN,IAAwB,EAFkC;AAAA,MAE1ErB,KAF0E,QAE1EA,KAF0E;AAAA,MAEnEG,IAFmE,QAEnEA,IAFmE;;AAIlF,SACI;AACI,IAAA,GAAG,EAAEc,GADT;AAEI,IAAA,SAAS,EAAEO,UAAU,CACjBL,SADiB,EAEjBM,kBAAkB,CAAC;AACfzB,MAAAA,KAAK,EAALA,KADe;AAEfoB,MAAAA,aAAa,EAAbA,aAFe;AAGfM,MAAAA,MAAM,EAAE/B;AAHO,KAAD,CAFD;AAFzB,KAUQ4B,cAVR,GAYK,CAACD,UAAU,IAAInB,IAAf,KAAwB,oBAAC,IAAD;AAAM,IAAA,SAAS,YAAKR,SAAL,WAAf;AAAuC,IAAA,IAAI,EAAE2B,UAAU,IAAInB,IAA3D;AAAiE,IAAA,IAAI,EAAEwB,IAAI,CAACC;AAA5E,IAZ7B,EAaI;AAAK,IAAA,SAAS,YAAKjC,SAAL;AAAd,KAAuCuB,QAAvC,CAbJ,CADJ;AAiBH,CArBoE;AAsBrEJ,OAAO,CAACe,WAAR,GAAsBnC,cAAtB;AACAoB,OAAO,CAACK,SAAR,GAAoBxB,SAApB;;;;"}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import { b as _objectWithoutProperties,
|
|
1
|
+
import { b as _objectWithoutProperties, c as _extends } from './_rollupPluginBabelHelpers.js';
|
|
2
2
|
import { Size, Orientation, Theme } from './components.js';
|
|
3
3
|
import React, { forwardRef } from 'react';
|
|
4
4
|
import { g as getRootClassName, c as classnames, h as handleBasicClasses } from './getRootClassName.js';
|
|
5
5
|
import { A as Avatar } from './Avatar2.js';
|
|
6
|
-
import { r as renderLink } from './renderLink.js';
|
|
7
|
-
import { isEmpty } from 'lodash';
|
|
8
6
|
|
|
9
7
|
/**
|
|
10
8
|
* Component display name.
|
|
@@ -45,9 +43,7 @@ var UserBlock = forwardRef(function (props, ref) {
|
|
|
45
43
|
simpleAction = props.simpleAction,
|
|
46
44
|
size = props.size,
|
|
47
45
|
theme = props.theme,
|
|
48
|
-
|
|
49
|
-
linkAs = props.linkAs,
|
|
50
|
-
forwardedProps = _objectWithoutProperties(props, ["avatarProps", "className", "fields", "multipleActions", "name", "onClick", "onMouseEnter", "onMouseLeave", "orientation", "simpleAction", "size", "theme", "linkProps", "linkAs"]);
|
|
46
|
+
forwardedProps = _objectWithoutProperties(props, ["avatarProps", "className", "fields", "multipleActions", "name", "onClick", "onMouseEnter", "onMouseLeave", "orientation", "simpleAction", "size", "theme"]);
|
|
51
47
|
|
|
52
48
|
var componentSize = size; // Special case - When using vertical orientation force the size to be Sizes.l.
|
|
53
49
|
|
|
@@ -56,37 +52,12 @@ var UserBlock = forwardRef(function (props, ref) {
|
|
|
56
52
|
}
|
|
57
53
|
|
|
58
54
|
var shouldDisplayActions = orientation === Orientation.vertical;
|
|
59
|
-
var
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
var nameClassName = classnames(handleBasicClasses({
|
|
67
|
-
prefix: "".concat(CLASSNAME, "__name"),
|
|
68
|
-
isClickable: isClickable
|
|
69
|
-
}), isLink && (linkProps === null || linkProps === void 0 ? void 0 : linkProps.className));
|
|
70
|
-
|
|
71
|
-
if (isLink) {
|
|
72
|
-
return renderLink(_objectSpread2({}, linkProps, {
|
|
73
|
-
linkAs: linkAs,
|
|
74
|
-
className: nameClassName
|
|
75
|
-
}), name);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
if (onClick) {
|
|
79
|
-
return React.createElement("button", {
|
|
80
|
-
onClick: onClick,
|
|
81
|
-
type: "button",
|
|
82
|
-
className: nameClassName
|
|
83
|
-
}, name);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
return React.createElement("span", {
|
|
87
|
-
className: nameClassName
|
|
88
|
-
}, name);
|
|
89
|
-
}, [isClickable, isLink, linkAs, linkProps, name, onClick]);
|
|
55
|
+
var nameBlock = name && // eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-noninteractive-tabindex,jsx-a11y/no-static-element-interactions
|
|
56
|
+
React.createElement("span", {
|
|
57
|
+
className: "".concat(CLASSNAME, "__name"),
|
|
58
|
+
onClick: onClick,
|
|
59
|
+
tabIndex: onClick ? 0 : -1
|
|
60
|
+
}, name);
|
|
90
61
|
var fieldsBlock = fields && componentSize !== Size.s && React.createElement("div", {
|
|
91
62
|
className: "".concat(CLASSNAME, "__fields")
|
|
92
63
|
}, fields.map(function (aField, idx) {
|
|
@@ -102,20 +73,18 @@ var UserBlock = forwardRef(function (props, ref) {
|
|
|
102
73
|
prefix: CLASSNAME,
|
|
103
74
|
orientation: orientation,
|
|
104
75
|
size: componentSize,
|
|
105
|
-
theme: theme
|
|
106
|
-
isClickable: isClickable
|
|
76
|
+
theme: theme
|
|
107
77
|
})),
|
|
108
78
|
onMouseLeave: onMouseLeave,
|
|
109
79
|
onMouseEnter: onMouseEnter
|
|
110
|
-
}), avatarProps && React.createElement(
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
}, avatarProps, {
|
|
114
|
-
className: classnames("".concat(CLASSNAME, "__avatar"), avatarProps.className),
|
|
80
|
+
}), avatarProps && React.createElement("div", {
|
|
81
|
+
className: "".concat(CLASSNAME, "__avatar")
|
|
82
|
+
}, React.createElement(Avatar, _extends({}, avatarProps, {
|
|
115
83
|
size: componentSize,
|
|
116
84
|
onClick: onClick,
|
|
85
|
+
tabIndex: onClick ? 0 : -1,
|
|
117
86
|
theme: theme
|
|
118
|
-
})), (fields || name) && React.createElement("div", {
|
|
87
|
+
}))), (fields || name) && React.createElement("div", {
|
|
119
88
|
className: "".concat(CLASSNAME, "__wrapper")
|
|
120
89
|
}, nameBlock, fieldsBlock), shouldDisplayActions && simpleAction && React.createElement("div", {
|
|
121
90
|
className: "".concat(CLASSNAME, "__action")
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserBlock.js","sources":["../../../src/components/user-block/UserBlock.tsx"],"sourcesContent":["import React, { forwardRef, ReactNode } from 'react';\n\nimport classNames from 'classnames';\n\nimport { Avatar, Orientation, Size, Theme } from '@lumx/react';\n\nimport { Comp, GenericProps, getRootClassName, handleBasicClasses } from '@lumx/react/utils';\nimport {
|
|
1
|
+
{"version":3,"file":"UserBlock.js","sources":["../../../src/components/user-block/UserBlock.tsx"],"sourcesContent":["import React, { forwardRef, ReactNode } from 'react';\n\nimport classNames from 'classnames';\n\nimport { Avatar, Orientation, Size, Theme } from '@lumx/react';\n\nimport { Comp, GenericProps, getRootClassName, handleBasicClasses } from '@lumx/react/utils';\nimport { AvatarProps } from '../avatar/Avatar';\n\n/**\n * User block sizes.\n */\nexport type UserBlockSize = Extract<Size, 's' | 'm' | 'l'>;\n\n/**\n * Defines the props of the component.\n */\nexport interface UserBlockProps extends GenericProps {\n /** Props to pass to the avatar. */\n avatarProps?: AvatarProps;\n /** Simple action toolbar content. */\n simpleAction?: ReactNode;\n /** Multiple action toolbar content. */\n multipleActions?: ReactNode;\n /** Additional fields used to describe the user. */\n fields?: string[];\n /** User name. */\n name?: string;\n /** Orientation. */\n orientation?: Orientation;\n /** Size variant. */\n size?: UserBlockSize;\n /** Theme adapting the component to light or dark background. */\n theme?: Theme;\n /** On click callback. */\n onClick?(): void;\n /** On mouse enter callback. */\n onMouseEnter?(): void;\n /** On mouse leave callback. */\n onMouseLeave?(): void;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'UserBlock';\n\n/**\n * Component default class name and class prefix.\n */\nconst CLASSNAME = getRootClassName(COMPONENT_NAME);\n\n/**\n * Component default props.\n */\nconst DEFAULT_PROPS: Partial<UserBlockProps> = {\n orientation: Orientation.horizontal,\n size: Size.m,\n theme: Theme.light,\n};\n\n/**\n * UserBlock component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const UserBlock: Comp<UserBlockProps, HTMLDivElement> = forwardRef((props, ref) => {\n const {\n avatarProps,\n className,\n fields,\n multipleActions,\n name,\n onClick,\n onMouseEnter,\n onMouseLeave,\n orientation,\n simpleAction,\n size,\n theme,\n ...forwardedProps\n } = props;\n let componentSize = size;\n\n // Special case - When using vertical orientation force the size to be Sizes.l.\n if (orientation === Orientation.vertical) {\n componentSize = Size.l;\n }\n\n const shouldDisplayActions: boolean = orientation === Orientation.vertical;\n\n const nameBlock: ReactNode = name && (\n // eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-noninteractive-tabindex,jsx-a11y/no-static-element-interactions\n <span className={`${CLASSNAME}__name`} onClick={onClick} tabIndex={onClick ? 0 : -1}>\n {name}\n </span>\n );\n\n const fieldsBlock: ReactNode = fields && componentSize !== Size.s && (\n <div className={`${CLASSNAME}__fields`}>\n {fields.map((aField: string, idx: number) => (\n <span key={idx} className={`${CLASSNAME}__field`}>\n {aField}\n </span>\n ))}\n </div>\n );\n\n return (\n <div\n ref={ref}\n {...forwardedProps}\n className={classNames(\n className,\n handleBasicClasses({ prefix: CLASSNAME, orientation, size: componentSize, theme }),\n )}\n onMouseLeave={onMouseLeave}\n onMouseEnter={onMouseEnter}\n >\n {avatarProps && (\n <div className={`${CLASSNAME}__avatar`}>\n <Avatar\n {...avatarProps}\n size={componentSize}\n onClick={onClick}\n tabIndex={onClick ? 0 : -1}\n theme={theme}\n />\n </div>\n )}\n {(fields || name) && (\n <div className={`${CLASSNAME}__wrapper`}>\n {nameBlock}\n {fieldsBlock}\n </div>\n )}\n {shouldDisplayActions && simpleAction && <div className={`${CLASSNAME}__action`}>{simpleAction}</div>}\n {shouldDisplayActions && multipleActions && (\n <div className={`${CLASSNAME}__actions`}>{multipleActions}</div>\n )}\n </div>\n );\n});\nUserBlock.displayName = COMPONENT_NAME;\nUserBlock.className = CLASSNAME;\nUserBlock.defaultProps = DEFAULT_PROPS;\n"],"names":["COMPONENT_NAME","CLASSNAME","getRootClassName","DEFAULT_PROPS","orientation","Orientation","horizontal","size","Size","m","theme","Theme","light","UserBlock","forwardRef","props","ref","avatarProps","className","fields","multipleActions","name","onClick","onMouseEnter","onMouseLeave","simpleAction","forwardedProps","componentSize","vertical","l","shouldDisplayActions","nameBlock","fieldsBlock","s","map","aField","idx","classNames","handleBasicClasses","prefix","displayName","defaultProps"],"mappings":";;;;;;AA0CA;;;AAGA,IAAMA,cAAc,GAAG,WAAvB;AAEA;;;;AAGA,IAAMC,SAAS,GAAGC,gBAAgB,CAACF,cAAD,CAAlC;AAEA;;;;AAGA,IAAMG,aAAsC,GAAG;AAC3CC,EAAAA,WAAW,EAAEC,WAAW,CAACC,UADkB;AAE3CC,EAAAA,IAAI,EAAEC,IAAI,CAACC,CAFgC;AAG3CC,EAAAA,KAAK,EAAEC,KAAK,CAACC;AAH8B,CAA/C;AAMA;;;;;;;;IAOaC,SAA+C,GAAGC,UAAU,CAAC,UAACC,KAAD,EAAQC,GAAR,EAAgB;AAAA,MAElFC,WAFkF,GAelFF,KAfkF,CAElFE,WAFkF;AAAA,MAGlFC,SAHkF,GAelFH,KAfkF,CAGlFG,SAHkF;AAAA,MAIlFC,MAJkF,GAelFJ,KAfkF,CAIlFI,MAJkF;AAAA,MAKlFC,eALkF,GAelFL,KAfkF,CAKlFK,eALkF;AAAA,MAMlFC,IANkF,GAelFN,KAfkF,CAMlFM,IANkF;AAAA,MAOlFC,OAPkF,GAelFP,KAfkF,CAOlFO,OAPkF;AAAA,MAQlFC,YARkF,GAelFR,KAfkF,CAQlFQ,YARkF;AAAA,MASlFC,YATkF,GAelFT,KAfkF,CASlFS,YATkF;AAAA,MAUlFpB,WAVkF,GAelFW,KAfkF,CAUlFX,WAVkF;AAAA,MAWlFqB,YAXkF,GAelFV,KAfkF,CAWlFU,YAXkF;AAAA,MAYlFlB,IAZkF,GAelFQ,KAfkF,CAYlFR,IAZkF;AAAA,MAalFG,KAbkF,GAelFK,KAf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,EAAEU,aAFV;AAGI,IAAA,OAAO,EAAEL,OAHb;AAII,IAAA,QAAQ,EAAEA,OAAO,GAAG,CAAH,GAAO,CAAC,CAJ7B;AAKI,IAAA,KAAK,EAAEZ;AALX,KADJ,CAXR,EAqBK,CAACS,MAAM,IAAIE,IAAX,KACG;AAAK,IAAA,SAAS,YAAKpB,SAAL;AAAd,KACK8B,SADL,EAEKC,WAFL,CAtBR,EA2BKF,oBAAoB,IAAIL,YAAxB,IAAwC;AAAK,IAAA,SAAS,YAAKxB,SAAL;AAAd,KAAyCwB,YAAzC,CA3B7C,EA4BKK,oBAAoB,IAAIV,eAAxB,IACG;AAAK,IAAA,SAAS,YAAKnB,SAAL;AAAd,KAA0CmB,eAA1C,CA7BR,CADJ;AAkCH,CA5EwE;AA6EzEP,SAAS,CAAC2B,WAAV,GAAwBxC,cAAxB;AACAa,SAAS,CAACK,SAAV,GAAsBjB,SAAtB;AACAY,SAAS,CAAC4B,YAAV,GAAyBtC,aAAzB;;;;"}
|
|
@@ -9,9 +9,7 @@ import 'lodash/kebabCase';
|
|
|
9
9
|
import 'lodash/noop';
|
|
10
10
|
import './mergeRefs.js';
|
|
11
11
|
import './Avatar2.js';
|
|
12
|
-
import './renderLink.js';
|
|
13
12
|
import './Icon2.js';
|
|
14
13
|
import './Thumbnail2.js';
|
|
15
|
-
import 'lodash';
|
|
16
14
|
export { U as UserBlock } from './UserBlock.js';
|
|
17
15
|
//# sourceMappingURL=user-block.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user-block.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"user-block.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;"}
|
package/esm/index.js
CHANGED
|
@@ -86,6 +86,5 @@ export { T as Toolbar } from './_internal/Toolbar2.js';
|
|
|
86
86
|
export { T as Tooltip } from './_internal/Tooltip2.js';
|
|
87
87
|
import 'lodash/debounce';
|
|
88
88
|
export { a as Uploader, U as UploaderVariant } from './_internal/Uploader2.js';
|
|
89
|
-
import 'lodash';
|
|
90
89
|
export { U as UserBlock } from './_internal/UserBlock.js';
|
|
91
90
|
//# sourceMappingURL=index.js.map
|
package/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/package.json
CHANGED
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"@juggle/resize-observer": "^3.2.0",
|
|
10
|
-
"@lumx/core": "^2.1.9-alpha-
|
|
11
|
-
"@lumx/icons": "^2.1.9-alpha-
|
|
10
|
+
"@lumx/core": "^2.1.9-alpha-thumbnail4",
|
|
11
|
+
"@lumx/icons": "^2.1.9-alpha-thumbnail4",
|
|
12
12
|
"@popperjs/core": "^2.5.4",
|
|
13
13
|
"body-scroll-lock": "^3.1.5",
|
|
14
14
|
"classnames": "^2.2.6",
|
|
@@ -120,6 +120,6 @@
|
|
|
120
120
|
"build:storybook": "cd storybook && ./build"
|
|
121
121
|
},
|
|
122
122
|
"sideEffects": false,
|
|
123
|
-
"version": "2.1.9-alpha-
|
|
124
|
-
"gitHead": "
|
|
123
|
+
"version": "2.1.9-alpha-thumbnail4",
|
|
124
|
+
"gitHead": "fa5191f099b3ac41f36405aeb23d0f6d254d4d39"
|
|
125
125
|
}
|
|
@@ -36,10 +36,6 @@ export interface AvatarProps extends GenericProps {
|
|
|
36
36
|
ThumbnailProps,
|
|
37
37
|
'image' | 'alt' | 'size' | 'theme' | 'align' | 'fillHeight' | 'variant' | 'aspectRatio'
|
|
38
38
|
>;
|
|
39
|
-
/** Props to pass to the link wrapping the thumbnail. */
|
|
40
|
-
linkProps?: React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>;
|
|
41
|
-
/** Custom react component for the link (can be used to inject react router Link). */
|
|
42
|
-
linkAs?: 'a' | any;
|
|
43
39
|
}
|
|
44
40
|
|
|
45
41
|
/**
|
|
@@ -79,8 +75,6 @@ export const Avatar: Comp<AvatarProps, HTMLDivElement> = forwardRef((props, ref)
|
|
|
79
75
|
size,
|
|
80
76
|
theme,
|
|
81
77
|
thumbnailProps,
|
|
82
|
-
linkProps,
|
|
83
|
-
linkAs,
|
|
84
78
|
...forwardedProps
|
|
85
79
|
} = props;
|
|
86
80
|
|
|
@@ -91,8 +85,6 @@ export const Avatar: Comp<AvatarProps, HTMLDivElement> = forwardRef((props, ref)
|
|
|
91
85
|
className={classNames(className, handleBasicClasses({ prefix: CLASSNAME, size, theme }))}
|
|
92
86
|
>
|
|
93
87
|
<Thumbnail
|
|
94
|
-
linkProps={linkProps}
|
|
95
|
-
linkAs={linkAs}
|
|
96
88
|
className={`${CLASSNAME}__thumbnail`}
|
|
97
89
|
onClick={onClick}
|
|
98
90
|
onKeyPress={onKeyPress}
|
|
@@ -40,7 +40,11 @@ export const DragHandle: Comp<DragHandleProps, HTMLDivElement> = forwardRef((pro
|
|
|
40
40
|
{...forwardedProps}
|
|
41
41
|
className={classNames(className, handleBasicClasses({ prefix: CLASSNAME, theme }))}
|
|
42
42
|
>
|
|
43
|
-
<Icon
|
|
43
|
+
<Icon
|
|
44
|
+
icon={mdiDragVertical}
|
|
45
|
+
color={theme === Theme.dark ? ColorPalette.light : ColorPalette.dark}
|
|
46
|
+
size={Size.xs}
|
|
47
|
+
/>
|
|
44
48
|
</div>
|
|
45
49
|
);
|
|
46
50
|
});
|
|
@@ -69,9 +69,8 @@ describe(`<${Flag.displayName} />`, () => {
|
|
|
69
69
|
|
|
70
70
|
it('should use the color', () => {
|
|
71
71
|
const color = ColorPalette.green;
|
|
72
|
-
const { wrapper
|
|
72
|
+
const { wrapper } = setup({ icon: mdiAbTesting, color });
|
|
73
73
|
|
|
74
|
-
expect(iconEl.prop('color')).toEqual(color);
|
|
75
74
|
expect(wrapper).toHaveClassName(
|
|
76
75
|
getBasicClass({
|
|
77
76
|
prefix: CLASSNAME,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { forwardRef } from 'react';
|
|
2
2
|
import classNames from 'classnames';
|
|
3
3
|
|
|
4
|
-
import { ColorPalette,
|
|
4
|
+
import { ColorPalette, Icon, Size, Theme } from '@lumx/react';
|
|
5
5
|
import { Comp, GenericProps, getRootClassName, handleBasicClasses } from '@lumx/react/utils';
|
|
6
6
|
|
|
7
7
|
export interface FlagProps extends GenericProps {
|
|
@@ -38,15 +38,7 @@ export const Flag: Comp<FlagProps, HTMLDivElement> = forwardRef((props, ref) =>
|
|
|
38
38
|
className={classNames(className, handleBasicClasses({ prefix: CLASSNAME, color: flagColor }))}
|
|
39
39
|
ref={ref}
|
|
40
40
|
>
|
|
41
|
-
{icon &&
|
|
42
|
-
<Icon
|
|
43
|
-
icon={icon}
|
|
44
|
-
color={color}
|
|
45
|
-
colorVariant={ColorVariant.D2}
|
|
46
|
-
size={Size.xxs}
|
|
47
|
-
className={`${CLASSNAME}__icon`}
|
|
48
|
-
/>
|
|
49
|
-
)}
|
|
41
|
+
{icon && <Icon icon={icon} size={Size.xxs} className={`${CLASSNAME}__icon`} />}
|
|
50
42
|
<span className={`${CLASSNAME}__label`}>{label}</span>
|
|
51
43
|
</div>
|
|
52
44
|
);
|
|
@@ -19,8 +19,6 @@ Array [
|
|
|
19
19
|
>
|
|
20
20
|
<Icon
|
|
21
21
|
className="lumx-flag__icon"
|
|
22
|
-
color="blue"
|
|
23
|
-
colorVariant="D2"
|
|
24
22
|
icon="M12,21.35L10.55,20.03C5.4,15.36 2,12.27 2,8.5C2,5.41 4.42,3 7.5,3C9.24,3 10.91,3.81 12,5.08C13.09,3.81 14.76,3 16.5,3C19.58,3 22,5.41 22,8.5C22,12.27 18.6,15.36 13.45,20.03L12,21.35Z"
|
|
25
23
|
size="xxs"
|
|
26
24
|
/>
|
|
@@ -35,8 +33,6 @@ Array [
|
|
|
35
33
|
>
|
|
36
34
|
<Icon
|
|
37
35
|
className="lumx-flag__icon"
|
|
38
|
-
color="dark"
|
|
39
|
-
colorVariant="D2"
|
|
40
36
|
icon="M12,21.35L10.55,20.03C5.4,15.36 2,12.27 2,8.5C2,5.41 4.42,3 7.5,3C9.24,3 10.91,3.81 12,5.08C13.09,3.81 14.76,3 16.5,3C19.58,3 22,5.41 22,8.5C22,12.27 18.6,15.36 13.45,20.03L12,21.35Z"
|
|
41
37
|
size="xxs"
|
|
42
38
|
/>
|
|
@@ -51,8 +47,6 @@ Array [
|
|
|
51
47
|
>
|
|
52
48
|
<Icon
|
|
53
49
|
className="lumx-flag__icon"
|
|
54
|
-
color="green"
|
|
55
|
-
colorVariant="D2"
|
|
56
50
|
icon="M12,21.35L10.55,20.03C5.4,15.36 2,12.27 2,8.5C2,5.41 4.42,3 7.5,3C9.24,3 10.91,3.81 12,5.08C13.09,3.81 14.76,3 16.5,3C19.58,3 22,5.41 22,8.5C22,12.27 18.6,15.36 13.45,20.03L12,21.35Z"
|
|
57
51
|
size="xxs"
|
|
58
52
|
/>
|
|
@@ -67,8 +61,6 @@ Array [
|
|
|
67
61
|
>
|
|
68
62
|
<Icon
|
|
69
63
|
className="lumx-flag__icon"
|
|
70
|
-
color="primary"
|
|
71
|
-
colorVariant="D2"
|
|
72
64
|
icon="M12,21.35L10.55,20.03C5.4,15.36 2,12.27 2,8.5C2,5.41 4.42,3 7.5,3C9.24,3 10.91,3.81 12,5.08C13.09,3.81 14.76,3 16.5,3C19.58,3 22,5.41 22,8.5C22,12.27 18.6,15.36 13.45,20.03L12,21.35Z"
|
|
73
65
|
size="xxs"
|
|
74
66
|
/>
|
|
@@ -83,8 +75,6 @@ Array [
|
|
|
83
75
|
>
|
|
84
76
|
<Icon
|
|
85
77
|
className="lumx-flag__icon"
|
|
86
|
-
color="red"
|
|
87
|
-
colorVariant="D2"
|
|
88
78
|
icon="M12,21.35L10.55,20.03C5.4,15.36 2,12.27 2,8.5C2,5.41 4.42,3 7.5,3C9.24,3 10.91,3.81 12,5.08C13.09,3.81 14.76,3 16.5,3C19.58,3 22,5.41 22,8.5C22,12.27 18.6,15.36 13.45,20.03L12,21.35Z"
|
|
89
79
|
size="xxs"
|
|
90
80
|
/>
|
|
@@ -99,8 +89,6 @@ Array [
|
|
|
99
89
|
>
|
|
100
90
|
<Icon
|
|
101
91
|
className="lumx-flag__icon"
|
|
102
|
-
color="secondary"
|
|
103
|
-
colorVariant="D2"
|
|
104
92
|
icon="M12,21.35L10.55,20.03C5.4,15.36 2,12.27 2,8.5C2,5.41 4.42,3 7.5,3C9.24,3 10.91,3.81 12,5.08C13.09,3.81 14.76,3 16.5,3C19.58,3 22,5.41 22,8.5C22,12.27 18.6,15.36 13.45,20.03L12,21.35Z"
|
|
105
93
|
size="xxs"
|
|
106
94
|
/>
|
|
@@ -115,8 +103,6 @@ Array [
|
|
|
115
103
|
>
|
|
116
104
|
<Icon
|
|
117
105
|
className="lumx-flag__icon"
|
|
118
|
-
color="yellow"
|
|
119
|
-
colorVariant="D2"
|
|
120
106
|
icon="M12,21.35L10.55,20.03C5.4,15.36 2,12.27 2,8.5C2,5.41 4.42,3 7.5,3C9.24,3 10.91,3.81 12,5.08C13.09,3.81 14.76,3 16.5,3C19.58,3 22,5.41 22,8.5C22,12.27 18.6,15.36 13.45,20.03L12,21.35Z"
|
|
121
107
|
size="xxs"
|
|
122
108
|
/>
|
|
@@ -135,7 +121,6 @@ exports[`<Flag /> Snapshots and structure should render story 'withIcon' 1`] = `
|
|
|
135
121
|
>
|
|
136
122
|
<Icon
|
|
137
123
|
className="lumx-flag__icon"
|
|
138
|
-
colorVariant="D2"
|
|
139
124
|
icon="M12,21.35L10.55,20.03C5.4,15.36 2,12.27 2,8.5C2,5.41 4.42,3 7.5,3C9.24,3 10.91,3.81 12,5.08C13.09,3.81 14.76,3 16.5,3C19.58,3 22,5.41 22,8.5C22,12.27 18.6,15.36 13.45,20.03L12,21.35Z"
|
|
140
125
|
size="xxs"
|
|
141
126
|
/>
|
|
@@ -52,11 +52,20 @@ const DEFAULT_PROPS: Partial<IconProps> = {};
|
|
|
52
52
|
*/
|
|
53
53
|
export const Icon: Comp<IconProps, HTMLElement> = forwardRef((props, ref) => {
|
|
54
54
|
const { className, color, colorVariant, hasShape, icon, size, theme, ...forwardedProps } = props;
|
|
55
|
+
|
|
55
56
|
let iconColor;
|
|
57
|
+
let iconColorVariant;
|
|
56
58
|
if (color) {
|
|
57
59
|
iconColor = color;
|
|
60
|
+
iconColorVariant = colorVariant;
|
|
58
61
|
} else if (theme) {
|
|
59
62
|
iconColor = theme === Theme.light ? ColorPalette.dark : ColorPalette.light;
|
|
63
|
+
|
|
64
|
+
if (colorVariant) {
|
|
65
|
+
iconColorVariant = colorVariant;
|
|
66
|
+
} else {
|
|
67
|
+
iconColorVariant = Theme.light ? 'L1' : 'N';
|
|
68
|
+
}
|
|
60
69
|
} else if (hasShape) {
|
|
61
70
|
iconColor = ColorPalette.dark;
|
|
62
71
|
}
|
|
@@ -86,7 +95,7 @@ export const Icon: Comp<IconProps, HTMLElement> = forwardRef((props, ref) => {
|
|
|
86
95
|
className,
|
|
87
96
|
handleBasicClasses({
|
|
88
97
|
color: iconColor,
|
|
89
|
-
colorVariant,
|
|
98
|
+
colorVariant: iconColorVariant,
|
|
90
99
|
hasShape,
|
|
91
100
|
prefix: CLASSNAME,
|
|
92
101
|
size: iconSize,
|
|
@@ -62,8 +62,8 @@ export const Message: Comp<MessageProps, HTMLDivElement> = forwardRef((props, re
|
|
|
62
62
|
)}
|
|
63
63
|
{...forwardedProps}
|
|
64
64
|
>
|
|
65
|
-
{(customIcon || icon) && <Icon className=
|
|
66
|
-
<div className=
|
|
65
|
+
{(customIcon || icon) && <Icon className={`${CLASSNAME}__icon`} icon={customIcon || icon} size={Size.xs} />}
|
|
66
|
+
<div className={`${CLASSNAME}__text`}>{children}</div>
|
|
67
67
|
</div>
|
|
68
68
|
);
|
|
69
69
|
});
|