@lumx/react 2.1.6 → 2.1.9-alpha-thumbnail

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.
Files changed (57) hide show
  1. package/esm/_internal/DragHandle.js +1 -1
  2. package/esm/_internal/DragHandle.js.map +1 -1
  3. package/esm/_internal/Flag2.js +3 -1
  4. package/esm/_internal/Flag2.js.map +1 -1
  5. package/esm/_internal/List2.js.map +1 -1
  6. package/esm/_internal/Message2.js +2 -2
  7. package/esm/_internal/Message2.js.map +1 -1
  8. package/esm/_internal/Slider2.js +21 -2
  9. package/esm/_internal/Slider2.js.map +1 -1
  10. package/esm/_internal/TextField.js +2 -2
  11. package/esm/_internal/TextField.js.map +1 -1
  12. package/esm/_internal/Thumbnail2.js +63 -764
  13. package/esm/_internal/Thumbnail2.js.map +1 -1
  14. package/esm/_internal/UserBlock.js +1 -0
  15. package/esm/_internal/UserBlock.js.map +1 -1
  16. package/esm/_internal/avatar.js +0 -3
  17. package/esm/_internal/avatar.js.map +1 -1
  18. package/esm/_internal/comment-block.js +0 -3
  19. package/esm/_internal/comment-block.js.map +1 -1
  20. package/esm/_internal/image-block.js +0 -3
  21. package/esm/_internal/image-block.js.map +1 -1
  22. package/esm/_internal/link-preview.js +0 -3
  23. package/esm/_internal/link-preview.js.map +1 -1
  24. package/esm/_internal/mdi.js +2 -2
  25. package/esm/_internal/mdi.js.map +1 -1
  26. package/esm/_internal/mosaic.js +0 -3
  27. package/esm/_internal/mosaic.js.map +1 -1
  28. package/esm/_internal/post-block.js +0 -3
  29. package/esm/_internal/post-block.js.map +1 -1
  30. package/esm/_internal/slider.js +1 -2
  31. package/esm/_internal/slider.js.map +1 -1
  32. package/esm/_internal/thumbnail.js +0 -3
  33. package/esm/_internal/thumbnail.js.map +1 -1
  34. package/esm/_internal/user-block.js +0 -2
  35. package/esm/_internal/user-block.js.map +1 -1
  36. package/esm/index.js +2 -3
  37. package/esm/index.js.map +1 -1
  38. package/package.json +4 -4
  39. package/src/components/drag-handle/DragHandle.tsx +1 -5
  40. package/src/components/flag/Flag.test.tsx +2 -1
  41. package/src/components/flag/Flag.tsx +10 -2
  42. package/src/components/flag/__snapshots__/Flag.test.tsx.snap +15 -0
  43. package/src/components/message/Message.tsx +2 -2
  44. package/src/components/text-field/TextField.stories.tsx +30 -0
  45. package/src/components/text-field/TextField.tsx +11 -9
  46. package/src/components/thumbnail/Thumbnail.stories.tsx +343 -59
  47. package/src/components/thumbnail/Thumbnail.test.tsx +6 -6
  48. package/src/components/thumbnail/Thumbnail.tsx +37 -34
  49. package/src/components/thumbnail/useFocusPoint.ts +18 -10
  50. package/src/components/thumbnail/useImageLoad.ts +23 -22
  51. package/src/components/user-block/UserBlock.stories.tsx +4 -1
  52. package/src/components/user-block/UserBlock.tsx +1 -0
  53. package/src/hooks/useOnResize.ts +6 -0
  54. package/src/stories/knobs/image.ts +35 -3
  55. package/types.d.ts +2 -0
  56. package/esm/_internal/clamp.js +0 -22
  57. package/esm/_internal/clamp.js.map +0 -1
@@ -7,12 +7,9 @@ import 'lodash/isBoolean';
7
7
  import 'lodash/isEmpty';
8
8
  import 'lodash/kebabCase';
9
9
  import 'lodash/noop';
10
- import './constants.js';
11
10
  import './mergeRefs.js';
12
11
  import './Icon2.js';
13
12
  import 'lodash/take';
14
13
  export { M as Mosaic } from './Mosaic2.js';
15
- import './clamp.js';
16
14
  import './Thumbnail2.js';
17
- import 'lodash';
18
15
  //# sourceMappingURL=mosaic.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"mosaic.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"mosaic.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;"}
@@ -7,13 +7,10 @@ import 'lodash/isBoolean';
7
7
  import 'lodash/isEmpty';
8
8
  import 'lodash/kebabCase';
9
9
  import 'lodash/noop';
10
- import './constants.js';
11
10
  import './mergeRefs.js';
12
11
  import './Icon2.js';
13
12
  import 'lodash/isObject';
14
13
  export { P as PostBlock } from './PostBlock.js';
15
- import './clamp.js';
16
14
  import './Thumbnail2.js';
17
- import 'lodash';
18
15
  import './types.js';
19
16
  //# sourceMappingURL=post-block.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"post-block.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"post-block.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;"}
@@ -9,6 +9,5 @@ import 'lodash/kebabCase';
9
9
  import 'lodash/noop';
10
10
  import './InputHelper.js';
11
11
  import './InputLabel.js';
12
- export { S as Slider } from './Slider2.js';
13
- export { c as clamp } from './clamp.js';
12
+ export { S as Slider, c as clamp } from './Slider2.js';
14
13
  //# sourceMappingURL=slider.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"slider.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;"}
1
+ {"version":3,"file":"slider.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;"}
@@ -7,11 +7,8 @@ import 'lodash/isBoolean';
7
7
  import 'lodash/isEmpty';
8
8
  import 'lodash/kebabCase';
9
9
  import 'lodash/noop';
10
- import './constants.js';
11
10
  import './mergeRefs.js';
12
11
  import './Icon2.js';
13
- import './clamp.js';
14
12
  export { T as Thumbnail } from './Thumbnail2.js';
15
- import 'lodash';
16
13
  export { T as ThumbnailAspectRatio, a as ThumbnailVariant } from './types.js';
17
14
  //# sourceMappingURL=thumbnail.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"thumbnail.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"thumbnail.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;"}
@@ -7,12 +7,10 @@ import 'lodash/isBoolean';
7
7
  import 'lodash/isEmpty';
8
8
  import 'lodash/kebabCase';
9
9
  import 'lodash/noop';
10
- import './constants.js';
11
10
  import './mergeRefs.js';
12
11
  import './Avatar2.js';
13
12
  import './renderLink.js';
14
13
  import './Icon2.js';
15
- import './clamp.js';
16
14
  import './Thumbnail2.js';
17
15
  import 'lodash';
18
16
  export { U as UserBlock } from './UserBlock.js';
@@ -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
@@ -74,19 +74,18 @@ export { R as RadioButton, a as RadioGroup } from './_internal/RadioGroup.js';
74
74
  export { a as Select, c as SelectMultiple, b as SelectMultipleField, S as SelectVariant } from './_internal/SelectMultiple.js';
75
75
  export { S as SideNavigation, a as SideNavigationItem } from './_internal/SideNavigationItem.js';
76
76
  export { S as SkeletonCircle, b as SkeletonRectangle, a as SkeletonRectangleVariant, c as SkeletonTypography } from './_internal/SkeletonTypography.js';
77
- export { S as Slider } from './_internal/Slider2.js';
78
- export { c as clamp } from './_internal/clamp.js';
77
+ export { S as Slider, c as clamp } from './_internal/Slider2.js';
79
78
  export { S as Slideshow, b as SlideshowControls, a as SlideshowItem } from './_internal/SlideshowControls.js';
80
79
  export { S as Switch } from './_internal/Switch2.js';
81
80
  export { T as Table, a as TableBody, d as TableCell, c as TableCellVariant, e as TableHeader, f as TableRow, b as ThOrder } from './_internal/TableRow.js';
82
81
  export { c as Tab, b as TabList, a as TabListLayout, d as TabPanel, T as TabProvider } from './_internal/TabPanel.js';
83
82
  export { T as TextField } from './_internal/TextField.js';
84
83
  export { T as Thumbnail } from './_internal/Thumbnail2.js';
85
- import 'lodash';
86
84
  export { T as ThumbnailAspectRatio, a as ThumbnailVariant } from './_internal/types.js';
87
85
  export { T as Toolbar } from './_internal/Toolbar2.js';
88
86
  export { T as Tooltip } from './_internal/Tooltip2.js';
89
87
  import 'lodash/debounce';
90
88
  export { a as Uploader, U as UploaderVariant } from './_internal/Uploader2.js';
89
+ import 'lodash';
91
90
  export { U as UserBlock } from './_internal/UserBlock.js';
92
91
  //# 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.6",
11
- "@lumx/icons": "^2.1.6",
10
+ "@lumx/core": "^2.1.9-alpha-thumbnail",
11
+ "@lumx/icons": "^2.1.9-alpha-thumbnail",
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.6",
124
- "gitHead": "239840a0fcbfe1dd0fe8b3bb09a9c640964bd1e1"
123
+ "version": "2.1.9-alpha-thumbnail",
124
+ "gitHead": "e89e3ca2d44ff4b4aeb73af5662aea190d93f8a3"
125
125
  }
@@ -40,11 +40,7 @@ export const DragHandle: Comp<DragHandleProps, HTMLDivElement> = forwardRef((pro
40
40
  {...forwardedProps}
41
41
  className={classNames(className, handleBasicClasses({ prefix: CLASSNAME, theme }))}
42
42
  >
43
- <Icon
44
- icon={mdiDragVertical}
45
- color={theme === Theme.dark ? ColorPalette.light : ColorPalette.dark}
46
- size={Size.xs}
47
- />
43
+ <Icon icon={mdiDragVertical} color={theme === Theme.dark ? ColorPalette.light : undefined} size={Size.xs} />
48
44
  </div>
49
45
  );
50
46
  });
@@ -69,8 +69,9 @@ describe(`<${Flag.displayName} />`, () => {
69
69
 
70
70
  it('should use the color', () => {
71
71
  const color = ColorPalette.green;
72
- const { wrapper } = setup({ icon: mdiAbTesting, color });
72
+ const { wrapper, iconEl } = setup({ icon: mdiAbTesting, color });
73
73
 
74
+ expect(iconEl.prop('color')).toEqual(color);
74
75
  expect(wrapper).toHaveClassName(
75
76
  getBasicClass({
76
77
  prefix: CLASSNAME,
@@ -1,7 +1,7 @@
1
1
  import React, { forwardRef } from 'react';
2
2
  import classNames from 'classnames';
3
3
 
4
- import { ColorPalette, Icon, Size, Theme } from '@lumx/react';
4
+ import { ColorPalette, ColorVariant, 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,7 +38,15 @@ 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 && <Icon icon={icon} size={Size.xxs} className={`${CLASSNAME}__icon`} />}
41
+ {icon && (
42
+ <Icon
43
+ icon={icon}
44
+ color={color}
45
+ colorVariant={ColorVariant.D2}
46
+ size={Size.xxs}
47
+ className={`${CLASSNAME}__icon`}
48
+ />
49
+ )}
42
50
  <span className={`${CLASSNAME}__label`}>{label}</span>
43
51
  </div>
44
52
  );
@@ -19,6 +19,8 @@ Array [
19
19
  >
20
20
  <Icon
21
21
  className="lumx-flag__icon"
22
+ color="blue"
23
+ colorVariant="D2"
22
24
  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"
23
25
  size="xxs"
24
26
  />
@@ -33,6 +35,8 @@ Array [
33
35
  >
34
36
  <Icon
35
37
  className="lumx-flag__icon"
38
+ color="dark"
39
+ colorVariant="D2"
36
40
  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"
37
41
  size="xxs"
38
42
  />
@@ -47,6 +51,8 @@ Array [
47
51
  >
48
52
  <Icon
49
53
  className="lumx-flag__icon"
54
+ color="green"
55
+ colorVariant="D2"
50
56
  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"
51
57
  size="xxs"
52
58
  />
@@ -61,6 +67,8 @@ Array [
61
67
  >
62
68
  <Icon
63
69
  className="lumx-flag__icon"
70
+ color="primary"
71
+ colorVariant="D2"
64
72
  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"
65
73
  size="xxs"
66
74
  />
@@ -75,6 +83,8 @@ Array [
75
83
  >
76
84
  <Icon
77
85
  className="lumx-flag__icon"
86
+ color="red"
87
+ colorVariant="D2"
78
88
  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"
79
89
  size="xxs"
80
90
  />
@@ -89,6 +99,8 @@ Array [
89
99
  >
90
100
  <Icon
91
101
  className="lumx-flag__icon"
102
+ color="secondary"
103
+ colorVariant="D2"
92
104
  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"
93
105
  size="xxs"
94
106
  />
@@ -103,6 +115,8 @@ Array [
103
115
  >
104
116
  <Icon
105
117
  className="lumx-flag__icon"
118
+ color="yellow"
119
+ colorVariant="D2"
106
120
  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"
107
121
  size="xxs"
108
122
  />
@@ -121,6 +135,7 @@ exports[`<Flag /> Snapshots and structure should render story 'withIcon' 1`] = `
121
135
  >
122
136
  <Icon
123
137
  className="lumx-flag__icon"
138
+ colorVariant="D2"
124
139
  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"
125
140
  size="xxs"
126
141
  />
@@ -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={`${CLASSNAME}__icon`} icon={customIcon || icon} size={Size.xs} />}
66
- <div className={`${CLASSNAME}__text`}>{children}</div>
65
+ {(customIcon || icon) && <Icon className="lumx-message__icon" icon={customIcon || icon} size={Size.xs} />}
66
+ <div className="lumx-message__text">{children}</div>
67
67
  </div>
68
68
  );
69
69
  });
@@ -137,3 +137,33 @@ export const WithAfterElement = ({ theme }: any) => {
137
137
  />
138
138
  );
139
139
  };
140
+
141
+ export const WithMaxLengthNoLabel = ({ theme }: any) => {
142
+ const [value, onChange] = React.useState('Value');
143
+ const multiline = boolean('Multiline', true);
144
+ const minimumRows = number('Minimum number of rows', 2, { min: 0, max: 100 });
145
+ const isClearable = boolean('Clearable', true);
146
+ const hasError = boolean('Has error', true);
147
+ return (
148
+ <TextField
149
+ value={value}
150
+ placeholder={text('Placeholder', 'Placeholder')}
151
+ theme={theme}
152
+ onChange={onChange}
153
+ multiline={multiline}
154
+ minimumRows={minimumRows}
155
+ hasError={hasError}
156
+ maxLength={200}
157
+ clearButtonProps={isClearable ? { label: 'Clear' } : undefined}
158
+ helper={<span>{text('Helper', 'Helper')}</span>}
159
+ afterElement={
160
+ <IconButton
161
+ label="foo"
162
+ emphasis={emphasis('Button emphasis', Emphasis.medium, 'After element')}
163
+ size={buttonSize('Button size', Size.s, 'After element')}
164
+ icon={mdiTranslate}
165
+ />
166
+ }
167
+ />
168
+ );
169
+ };
@@ -307,16 +307,18 @@ export const TextField: Comp<TextFieldProps, HTMLDivElement> = forwardRef((props
307
307
  }),
308
308
  )}
309
309
  >
310
- {label && (
310
+ {(label || maxLength) && (
311
311
  <div className={`${CLASSNAME}__header`}>
312
- <InputLabel
313
- htmlFor={textFieldId}
314
- className={`${CLASSNAME}__label`}
315
- isRequired={isRequired}
316
- theme={theme}
317
- >
318
- {label}
319
- </InputLabel>
312
+ {label && (
313
+ <InputLabel
314
+ htmlFor={textFieldId}
315
+ className={`${CLASSNAME}__label`}
316
+ isRequired={isRequired}
317
+ theme={theme}
318
+ >
319
+ {label}
320
+ </InputLabel>
321
+ )}
320
322
 
321
323
  {maxLength && (
322
324
  <div className={`${CLASSNAME}__char-counter`}>