@lumx/react 2.1.1 → 2.1.5
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/README.md +1 -1
- package/esm/_internal/Avatar2.js +5 -1
- package/esm/_internal/Avatar2.js.map +1 -1
- package/esm/_internal/Button2.js.map +1 -1
- package/esm/_internal/ButtonRoot.js +14 -4
- package/esm/_internal/ButtonRoot.js.map +1 -1
- package/esm/_internal/ClickAwayProvider.js +1 -1
- package/esm/_internal/Dialog2.js +13 -8
- package/esm/_internal/Dialog2.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/IconButton.js +0 -2
- package/esm/_internal/IconButton.js.map +1 -1
- package/esm/_internal/List2.js +16 -9
- package/esm/_internal/List2.js.map +1 -1
- package/esm/_internal/Message2.js +2 -2
- package/esm/_internal/Message2.js.map +1 -1
- package/esm/_internal/SlideshowControls.js +3 -3
- package/esm/_internal/SlideshowControls.js.map +1 -1
- package/esm/_internal/TextField.js +5 -2
- package/esm/_internal/TextField.js.map +1 -1
- package/esm/_internal/Thumbnail2.js +29 -34
- package/esm/_internal/Thumbnail2.js.map +1 -1
- package/esm/_internal/Tooltip2.js +1 -1
- package/esm/_internal/UserBlock.js +44 -14
- package/esm/_internal/UserBlock.js.map +1 -1
- package/esm/_internal/getRootClassName.js +17 -1
- package/esm/_internal/getRootClassName.js.map +1 -1
- package/esm/_internal/user-block.js +1 -0
- package/esm/_internal/user-block.js.map +1 -1
- package/package.json +4 -8
- package/src/components/avatar/Avatar.stories.tsx +1 -1
- package/src/components/avatar/Avatar.tsx +8 -0
- package/src/components/button/Button.stories.tsx +85 -15
- package/src/components/button/Button.tsx +2 -0
- package/src/components/button/ButtonRoot.test.tsx +13 -0
- package/src/components/button/ButtonRoot.tsx +10 -1
- package/src/components/button/IconButton.test.tsx +9 -0
- package/src/components/button/IconButton.tsx +11 -26
- package/src/components/button/__snapshots__/ButtonRoot.test.tsx.snap +13 -0
- package/src/components/button/__snapshots__/IconButton.test.tsx.snap +19 -0
- package/src/components/comment-block/CommentBlock.stories.tsx +1 -1
- package/src/components/dialog/Dialog.stories.tsx +45 -3
- package/src/components/dialog/Dialog.tsx +15 -11
- package/src/components/dialog/__snapshots__/Dialog.test.tsx.snap +76 -0
- 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/image-block/ImageBlock.stories.tsx +1 -1
- package/src/components/link-preview/LinkPreview.stories.tsx +1 -1
- package/src/components/list/List.stories.tsx +7 -1
- package/src/components/list/ListItem.stories.tsx +28 -3
- package/src/components/list/ListItem.tsx +25 -7
- package/src/components/list/__snapshots__/List.test.tsx.snap +23 -3
- package/src/components/list/__snapshots__/ListItem.test.tsx.snap +84 -11
- package/src/components/list/useInteractiveList.tsx +1 -1
- package/src/components/message/Message.tsx +2 -2
- package/src/components/skeleton/SkeletonRectangle.stories.tsx +1 -1
- package/src/components/slideshow/useKeyNavigate.ts +2 -2
- package/src/components/text-field/TextField.stories.tsx +97 -82
- package/src/components/text-field/TextField.tsx +5 -0
- package/src/components/thumbnail/Thumbnail.stories.tsx +22 -1
- package/src/components/thumbnail/Thumbnail.test.tsx +20 -2
- package/src/components/thumbnail/Thumbnail.tsx +40 -15
- package/src/components/thumbnail/__snapshots__/Thumbnail.test.tsx.snap +53 -6
- package/src/components/user-block/UserBlock.stories.tsx +28 -5
- package/src/components/user-block/UserBlock.tsx +40 -16
- package/src/components/user-block/__snapshots__/UserBlock.test.tsx.snap +244 -145
- package/src/stories/generated/Button/Demos.stories.tsx +1 -0
- package/src/stories/knobs/buttonKnob.ts +9 -0
- package/src/stories/knobs/emphasisKnob.ts +8 -0
- package/src/utils/MaterialThemeSwitcher/MaterialThemeSwitcher.tsx +54 -0
- package/src/utils/MaterialThemeSwitcher/index.ts +1 -0
- package/src/stories/knobs/index.ts +0 -2
- package/types.d.ts +0 -2561
|
@@ -6,5 +6,6 @@ export default { title: 'LumX components/button/Demos' };
|
|
|
6
6
|
export { App as EmphasisHigh } from './emphasis-high';
|
|
7
7
|
export { App as EmphasisLow } from './emphasis-low';
|
|
8
8
|
export { App as EmphasisMedium } from './emphasis-medium';
|
|
9
|
+
export { App as FullWidth } from './full-width';
|
|
9
10
|
export { App as Small } from './small';
|
|
10
11
|
export { App as Toggle } from './toggle';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Button, ButtonProps, Size } from '@lumx/react';
|
|
2
|
+
import { select } from '@storybook/addon-knobs';
|
|
3
|
+
import { ButtonSize } from '@lumx/react/components/button/ButtonRoot';
|
|
4
|
+
|
|
5
|
+
export const buttonSize = (
|
|
6
|
+
name = 'Size',
|
|
7
|
+
value: ButtonSize = Button.defaultProps?.size as any,
|
|
8
|
+
groupId: string | undefined = undefined,
|
|
9
|
+
): ButtonProps['size'] => select(name, [Size.m, Size.s], value, groupId);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Emphasis } from '@lumx/react';
|
|
2
|
+
import { select } from '@storybook/addon-knobs';
|
|
3
|
+
|
|
4
|
+
export const emphasis = (
|
|
5
|
+
name = 'Emphasis',
|
|
6
|
+
value: Emphasis = Emphasis.high,
|
|
7
|
+
groupId: string | undefined = undefined,
|
|
8
|
+
): Emphasis => select(name, Emphasis, value, groupId);
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import React, { useCallback, useState } from 'react';
|
|
2
|
+
import { Switch } from '@lumx/react/components/switch';
|
|
3
|
+
import { Alignment } from '@lumx/react';
|
|
4
|
+
|
|
5
|
+
// Global state used to
|
|
6
|
+
const globalState = {
|
|
7
|
+
isEnabled: false,
|
|
8
|
+
styleSheet: null as any,
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
/** Toggle apply the material CSS override. */
|
|
12
|
+
async function toggleMaterialTheme(wasEnabled: boolean) {
|
|
13
|
+
globalState.isEnabled = !wasEnabled;
|
|
14
|
+
|
|
15
|
+
// Inject the material theme CSS file.
|
|
16
|
+
if (!globalState.styleSheet) {
|
|
17
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
18
|
+
// @ts-ignore
|
|
19
|
+
const cssCode = await import('!!raw-loader!@lumx/core/css/material.css');
|
|
20
|
+
|
|
21
|
+
// Inject CSS override in a <style> node in <head>
|
|
22
|
+
const style = document.createElement('style');
|
|
23
|
+
style.textContent = cssCode.default;
|
|
24
|
+
document.head.appendChild(style);
|
|
25
|
+
|
|
26
|
+
globalState.styleSheet = style.sheet;
|
|
27
|
+
}
|
|
28
|
+
// Disable/Enable stylesheet
|
|
29
|
+
globalState.styleSheet.disabled = !globalState.isEnabled;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export const MaterialThemeSwitcher: React.FC<any> = ({ theme }) => {
|
|
33
|
+
const [isEnabled, setEnabled] = useState(globalState.isEnabled);
|
|
34
|
+
const toggleTheme = useCallback(
|
|
35
|
+
() =>
|
|
36
|
+
setEnabled((wasEnabled) => {
|
|
37
|
+
toggleMaterialTheme(wasEnabled);
|
|
38
|
+
return !wasEnabled;
|
|
39
|
+
}),
|
|
40
|
+
[],
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<Switch
|
|
45
|
+
className="material-theme-switcher"
|
|
46
|
+
isChecked={isEnabled}
|
|
47
|
+
onChange={toggleTheme}
|
|
48
|
+
position={Alignment.right}
|
|
49
|
+
theme={theme}
|
|
50
|
+
>
|
|
51
|
+
Material theme
|
|
52
|
+
</Switch>
|
|
53
|
+
);
|
|
54
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './MaterialThemeSwitcher';
|