tgui-core 1.0.2 → 1.0.4
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/{src/components → components}/AnimatedNumber.tsx +185 -185
- package/{src/components → components}/BlockQuote.tsx +15 -15
- package/{src/components → components}/BodyZoneSelector.tsx +149 -149
- package/{src/components → components}/Box.tsx +255 -255
- package/{src/components → components}/Button.tsx +415 -415
- package/{src/components → components}/ByondUi.jsx +121 -121
- package/{src/components → components}/Chart.tsx +160 -160
- package/{src/components → components}/ColorBox.tsx +30 -30
- package/{src/components → components}/Dimmer.tsx +19 -19
- package/{src/components → components}/Divider.tsx +26 -26
- package/{src/components → components}/DmIcon.tsx +72 -72
- package/{src/components → components}/DraggableControl.jsx +282 -282
- package/{src/components → components}/Dropdown.tsx +246 -246
- package/{src/components → components}/Flex.tsx +105 -105
- package/{src/components → components}/Icon.tsx +91 -91
- package/{src/components → components}/Input.tsx +181 -181
- package/{src/components → components}/KeyListener.tsx +40 -40
- package/{src/components → components}/Knob.tsx +185 -185
- package/{src/components → components}/LabeledList.tsx +130 -130
- package/{src/components → components}/MenuBar.tsx +233 -238
- package/{src/components → components}/Modal.tsx +25 -25
- package/{src/components → components}/NoticeBox.tsx +48 -48
- package/{src/components → components}/NumberInput.tsx +328 -328
- package/{src/components → components}/ProgressBar.tsx +79 -79
- package/{src/components → components}/RestrictedInput.jsx +301 -301
- package/{src/components → components}/RoundGauge.tsx +189 -189
- package/{src/components → components}/Section.tsx +125 -125
- package/{src/components → components}/Slider.tsx +173 -173
- package/{src/components → components}/Stack.tsx +101 -101
- package/{src/components → components}/Table.tsx +90 -90
- package/{src/components → components}/Tabs.tsx +90 -90
- package/{src/components → components}/TextArea.tsx +198 -198
- package/{src/components → components}/TimeDisplay.jsx +64 -64
- package/components/index.ts +51 -0
- package/{src/debug/KitchenSink.jsx → debug/KitchenSink.tsx} +56 -56
- package/{src/debug/actions.js → debug/actions.ts} +11 -11
- package/{src/debug/hooks.js → debug/hooks.ts} +10 -10
- package/{src/debug/middleware.js → debug/middleware.ts} +67 -86
- package/{src/debug/reducer.js → debug/reducer.ts} +27 -22
- package/{src/debug/selectors.js → debug/selectors.ts} +7 -7
- package/{src/layouts → layouts}/Layout.tsx +75 -75
- package/{src/layouts → layouts}/NtosWindow.tsx +162 -162
- package/{src/layouts → layouts}/Pane.tsx +56 -56
- package/{src/layouts → layouts}/Window.tsx +227 -227
- package/layouts/index.ts +10 -0
- package/package.json +3 -2
- package/src/assets.ts +43 -43
- package/src/backend.ts +368 -369
- package/src/drag.ts +280 -280
- package/src/events.ts +237 -237
- package/src/hotkeys.ts +212 -212
- package/src/renderer.ts +50 -50
- package/stories/Blink.stories.tsx +20 -0
- package/stories/BlockQuote.stories.tsx +23 -0
- package/stories/Box.stories.tsx +27 -0
- package/stories/Button.stories.tsx +68 -0
- package/stories/ByondUi.stories.tsx +45 -0
- package/stories/Collapsible.stories.tsx +23 -0
- package/stories/Flex.stories.tsx +68 -0
- package/stories/Input.stories.tsx +124 -0
- package/stories/LabeledList.stories.tsx +73 -0
- package/stories/Popper.stories.tsx +58 -0
- package/stories/ProgressBar.stories.tsx +58 -0
- package/stories/Stack.stories.tsx +55 -0
- package/stories/Storage.stories.tsx +46 -0
- package/stories/Themes.stories.tsx +30 -0
- package/stories/Tooltip.stories.tsx +48 -0
- package/stories/common.tsx +19 -0
- package/tsconfig.json +0 -21
- package/src/components/Grid.tsx +0 -44
- /package/{src/common → common}/collections.ts +0 -0
- /package/{src/common → common}/color.ts +0 -0
- /package/{src/common → common}/events.ts +0 -0
- /package/{src/common → common}/exhaustive.ts +0 -0
- /package/{src/common → common}/fp.ts +0 -0
- /package/{src/common → common}/keycodes.ts +0 -0
- /package/{src/common → common}/keys.ts +0 -0
- /package/{src/common → common}/math.ts +0 -0
- /package/{src/common → common}/perf.ts +0 -0
- /package/{src/common → common}/random.ts +0 -0
- /package/{src/common → common}/react.ts +0 -0
- /package/{src/common → common}/redux.ts +0 -0
- /package/{src/common → common}/storage.js +0 -0
- /package/{src/common → common}/string.ts +0 -0
- /package/{src/common → common}/timer.ts +0 -0
- /package/{src/common → common}/type-utils.ts +0 -0
- /package/{src/common → common}/types.ts +0 -0
- /package/{src/common → common}/uuid.ts +0 -0
- /package/{src/common → common}/vector.ts +0 -0
- /package/{src/components → components}/Autofocus.tsx +0 -0
- /package/{src/components → components}/Blink.jsx +0 -0
- /package/{src/components → components}/Collapsible.tsx +0 -0
- /package/{src/components → components}/Dialog.tsx +0 -0
- /package/{src/components → components}/FakeTerminal.jsx +0 -0
- /package/{src/components → components}/FitText.tsx +0 -0
- /package/{src/components → components}/Image.tsx +0 -0
- /package/{src/components → components}/InfinitePlane.jsx +0 -0
- /package/{src/components → components}/LabeledControls.tsx +0 -0
- /package/{src/components → components}/Popper.tsx +0 -0
- /package/{src/components → components}/StyleableSection.tsx +0 -0
- /package/{src/components → components}/Tooltip.tsx +0 -0
- /package/{src/components → components}/TrackOutsideClicks.tsx +0 -0
- /package/{src/components → components}/VirtualList.tsx +0 -0
- /package/{src/debug → debug}/index.ts +0 -0
- /package/{src/styles → styles}/base.scss +0 -0
- /package/{src/styles → styles}/colors.scss +0 -0
- /package/{src/styles → styles}/components/BlockQuote.scss +0 -0
- /package/{src/styles → styles}/components/Button.scss +0 -0
- /package/{src/styles → styles}/components/ColorBox.scss +0 -0
- /package/{src/styles → styles}/components/Dialog.scss +0 -0
- /package/{src/styles → styles}/components/Dimmer.scss +0 -0
- /package/{src/styles → styles}/components/Divider.scss +0 -0
- /package/{src/styles → styles}/components/Dropdown.scss +0 -0
- /package/{src/styles → styles}/components/Flex.scss +0 -0
- /package/{src/styles → styles}/components/Icon.scss +0 -0
- /package/{src/styles → styles}/components/Input.scss +0 -0
- /package/{src/styles → styles}/components/Knob.scss +0 -0
- /package/{src/styles → styles}/components/LabeledList.scss +0 -0
- /package/{src/styles → styles}/components/MenuBar.scss +0 -0
- /package/{src/styles → styles}/components/Modal.scss +0 -0
- /package/{src/styles → styles}/components/NoticeBox.scss +0 -0
- /package/{src/styles → styles}/components/NumberInput.scss +0 -0
- /package/{src/styles → styles}/components/ProgressBar.scss +0 -0
- /package/{src/styles → styles}/components/RoundGauge.scss +0 -0
- /package/{src/styles → styles}/components/Section.scss +0 -0
- /package/{src/styles → styles}/components/Slider.scss +0 -0
- /package/{src/styles → styles}/components/Stack.scss +0 -0
- /package/{src/styles → styles}/components/Table.scss +0 -0
- /package/{src/styles → styles}/components/Tabs.scss +0 -0
- /package/{src/styles → styles}/components/TextArea.scss +0 -0
- /package/{src/styles → styles}/components/Tooltip.scss +0 -0
- /package/{src/styles → styles}/functions.scss +0 -0
- /package/{src/styles → styles}/layouts/Layout.scss +0 -0
- /package/{src/styles → styles}/layouts/NtosHeader.scss +0 -0
- /package/{src/styles → styles}/layouts/NtosWindow.scss +0 -0
- /package/{src/styles → styles}/layouts/TitleBar.scss +0 -0
- /package/{src/styles → styles}/layouts/Window.scss +0 -0
- /package/{src/styles → styles}/main.scss +0 -0
- /package/{src/styles → styles}/reset.scss +0 -0
- /package/{src/styles → styles}/themes/abductor.scss +0 -0
- /package/{src/styles → styles}/themes/admin.scss +0 -0
- /package/{src/styles → styles}/themes/cardtable.scss +0 -0
- /package/{src/styles → styles}/themes/hackerman.scss +0 -0
- /package/{src/styles → styles}/themes/malfunction.scss +0 -0
- /package/{src/styles → styles}/themes/neutral.scss +0 -0
- /package/{src/styles → styles}/themes/ntOS95.scss +0 -0
- /package/{src/styles → styles}/themes/ntos.scss +0 -0
- /package/{src/styles → styles}/themes/ntos_cat.scss +0 -0
- /package/{src/styles → styles}/themes/ntos_darkmode.scss +0 -0
- /package/{src/styles → styles}/themes/ntos_lightmode.scss +0 -0
- /package/{src/styles → styles}/themes/ntos_spooky.scss +0 -0
- /package/{src/styles → styles}/themes/ntos_synth.scss +0 -0
- /package/{src/styles → styles}/themes/ntos_terminal.scss +0 -0
- /package/{src/styles → styles}/themes/paper.scss +0 -0
- /package/{src/styles → styles}/themes/retro.scss +0 -0
- /package/{src/styles → styles}/themes/spookyconsole.scss +0 -0
- /package/{src/styles → styles}/themes/syndicate.scss +0 -0
- /package/{src/styles → styles}/themes/wizard.scss +0 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file
|
|
3
|
+
* @copyright 2021 Aleksej Komarov
|
|
4
|
+
* @license MIT
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { useState } from 'react';
|
|
8
|
+
|
|
9
|
+
import { Button, ByondUi, Section, TextArea } from '../components';
|
|
10
|
+
|
|
11
|
+
export const meta = {
|
|
12
|
+
title: 'ByondUi',
|
|
13
|
+
render: () => <Story />,
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const Story = (props) => {
|
|
17
|
+
const [code, setCode] = useState(
|
|
18
|
+
`Byond.winset('${Byond.windowId}', {\n 'is-visible': true,\n})`
|
|
19
|
+
);
|
|
20
|
+
return (
|
|
21
|
+
<>
|
|
22
|
+
<Section title="Button">
|
|
23
|
+
<ByondUi
|
|
24
|
+
params={{
|
|
25
|
+
type: 'button',
|
|
26
|
+
text: 'Button',
|
|
27
|
+
}}
|
|
28
|
+
/>
|
|
29
|
+
</Section>
|
|
30
|
+
<Section
|
|
31
|
+
title="Make BYOND calls"
|
|
32
|
+
buttons={<Button icon="chevron-right">Evaluate</Button>}
|
|
33
|
+
>
|
|
34
|
+
<TextArea
|
|
35
|
+
as="textarea"
|
|
36
|
+
width="100%"
|
|
37
|
+
height="10em"
|
|
38
|
+
onChange={(e, value) => setCode(value)}
|
|
39
|
+
>
|
|
40
|
+
{code}
|
|
41
|
+
</TextArea>
|
|
42
|
+
</Section>
|
|
43
|
+
</>
|
|
44
|
+
);
|
|
45
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file
|
|
3
|
+
* @copyright 2021 Aleksej Komarov
|
|
4
|
+
* @license MIT
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { Button, Collapsible, Section } from '../components';
|
|
8
|
+
import { BoxWithSampleText } from './common';
|
|
9
|
+
|
|
10
|
+
export const meta = {
|
|
11
|
+
title: 'Collapsible',
|
|
12
|
+
render: () => <Story />,
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const Story = (props) => {
|
|
16
|
+
return (
|
|
17
|
+
<Section>
|
|
18
|
+
<Collapsible title="Collapsible Demo" buttons={<Button icon="cog" />}>
|
|
19
|
+
<BoxWithSampleText />
|
|
20
|
+
</Collapsible>
|
|
21
|
+
</Section>
|
|
22
|
+
);
|
|
23
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file
|
|
3
|
+
* @copyright 2021 Aleksej Komarov
|
|
4
|
+
* @license MIT
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { useState } from 'react';
|
|
8
|
+
|
|
9
|
+
import { Button, Flex, Section } from '../components';
|
|
10
|
+
|
|
11
|
+
export const meta = {
|
|
12
|
+
title: 'Flex & Sections',
|
|
13
|
+
render: () => <Story />,
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const Story = (props) => {
|
|
17
|
+
const [grow, setGrow] = useState(1);
|
|
18
|
+
const [direction, setDirection] = useState('column');
|
|
19
|
+
const [fill, setFill] = useState(true);
|
|
20
|
+
const [hasTitle, setHasTitle] = useState(true);
|
|
21
|
+
return (
|
|
22
|
+
<Flex height="100%" direction="column">
|
|
23
|
+
<Flex.Item mb={1}>
|
|
24
|
+
<Section>
|
|
25
|
+
<Button
|
|
26
|
+
fluid
|
|
27
|
+
onClick={() =>
|
|
28
|
+
setDirection(direction === 'column' ? 'row' : 'column')
|
|
29
|
+
}
|
|
30
|
+
>
|
|
31
|
+
{`Flex direction="${direction}"`}
|
|
32
|
+
</Button>
|
|
33
|
+
<Button fluid onClick={() => setGrow(Number(!grow))}>
|
|
34
|
+
{`Flex.Item grow={${grow}}`}
|
|
35
|
+
</Button>
|
|
36
|
+
<Button fluid onClick={() => setFill(!fill)}>
|
|
37
|
+
{`Section fill={${String(fill)}}`}
|
|
38
|
+
</Button>
|
|
39
|
+
<Button
|
|
40
|
+
fluid
|
|
41
|
+
selected={hasTitle}
|
|
42
|
+
onClick={() => setHasTitle(!hasTitle)}
|
|
43
|
+
>
|
|
44
|
+
{`Section title`}
|
|
45
|
+
</Button>
|
|
46
|
+
</Section>
|
|
47
|
+
</Flex.Item>
|
|
48
|
+
<Flex.Item grow={1}>
|
|
49
|
+
<Flex height="100%" direction={direction}>
|
|
50
|
+
<Flex.Item
|
|
51
|
+
mr={direction === 'row' && 1}
|
|
52
|
+
mb={direction === 'column' && 1}
|
|
53
|
+
grow={grow}
|
|
54
|
+
>
|
|
55
|
+
<Section title={hasTitle && 'Section 1'} fill={fill}>
|
|
56
|
+
Content
|
|
57
|
+
</Section>
|
|
58
|
+
</Flex.Item>
|
|
59
|
+
<Flex.Item grow={grow}>
|
|
60
|
+
<Section title={hasTitle && 'Section 2'} fill={fill}>
|
|
61
|
+
Content
|
|
62
|
+
</Section>
|
|
63
|
+
</Flex.Item>
|
|
64
|
+
</Flex>
|
|
65
|
+
</Flex.Item>
|
|
66
|
+
</Flex>
|
|
67
|
+
);
|
|
68
|
+
};
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file
|
|
3
|
+
* @copyright 2021 Aleksej Komarov
|
|
4
|
+
* @license MIT
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { useState } from 'react';
|
|
8
|
+
|
|
9
|
+
import {
|
|
10
|
+
Box,
|
|
11
|
+
DraggableControl,
|
|
12
|
+
Icon,
|
|
13
|
+
Input,
|
|
14
|
+
Knob,
|
|
15
|
+
LabeledList,
|
|
16
|
+
NumberInput,
|
|
17
|
+
Section,
|
|
18
|
+
Slider,
|
|
19
|
+
} from '../components';
|
|
20
|
+
|
|
21
|
+
export const meta = {
|
|
22
|
+
title: 'Input',
|
|
23
|
+
render: () => <Story />,
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const Story = (props) => {
|
|
27
|
+
const [number, setNumber] = useState(0);
|
|
28
|
+
const [text, setText] = useState('Sample text');
|
|
29
|
+
return (
|
|
30
|
+
<Section>
|
|
31
|
+
<LabeledList>
|
|
32
|
+
<LabeledList.Item label="Input (onChange)">
|
|
33
|
+
<Input value={text} onChange={(e, value) => setText(value)} />
|
|
34
|
+
</LabeledList.Item>
|
|
35
|
+
<LabeledList.Item label="Input (onInput)">
|
|
36
|
+
<Input value={text} onInput={(e, value) => setText(value)} />
|
|
37
|
+
</LabeledList.Item>
|
|
38
|
+
<LabeledList.Item label="NumberInput (onChange)">
|
|
39
|
+
<NumberInput
|
|
40
|
+
animated
|
|
41
|
+
width="40px"
|
|
42
|
+
step={1}
|
|
43
|
+
stepPixelSize={5}
|
|
44
|
+
value={number}
|
|
45
|
+
minValue={-100}
|
|
46
|
+
maxValue={100}
|
|
47
|
+
onChange={(value) => setNumber(value)}
|
|
48
|
+
/>
|
|
49
|
+
</LabeledList.Item>
|
|
50
|
+
<LabeledList.Item label="NumberInput (onDrag)">
|
|
51
|
+
<NumberInput
|
|
52
|
+
animated
|
|
53
|
+
width="40px"
|
|
54
|
+
step={1}
|
|
55
|
+
stepPixelSize={5}
|
|
56
|
+
value={number}
|
|
57
|
+
minValue={-100}
|
|
58
|
+
maxValue={100}
|
|
59
|
+
onDrag={(value) => setNumber(value)}
|
|
60
|
+
/>
|
|
61
|
+
</LabeledList.Item>
|
|
62
|
+
<LabeledList.Item label="Slider (onDrag)">
|
|
63
|
+
<Slider
|
|
64
|
+
step={1}
|
|
65
|
+
stepPixelSize={5}
|
|
66
|
+
value={number}
|
|
67
|
+
minValue={-100}
|
|
68
|
+
maxValue={100}
|
|
69
|
+
onDrag={(e, value) => setNumber(value)}
|
|
70
|
+
/>
|
|
71
|
+
</LabeledList.Item>
|
|
72
|
+
<LabeledList.Item label="Knob (onDrag)">
|
|
73
|
+
<Knob
|
|
74
|
+
inline
|
|
75
|
+
size={1}
|
|
76
|
+
step={1}
|
|
77
|
+
stepPixelSize={2}
|
|
78
|
+
value={number}
|
|
79
|
+
minValue={-100}
|
|
80
|
+
maxValue={100}
|
|
81
|
+
onDrag={(e, value) => setNumber(value)}
|
|
82
|
+
/>
|
|
83
|
+
<Knob
|
|
84
|
+
ml={1}
|
|
85
|
+
inline
|
|
86
|
+
bipolar
|
|
87
|
+
size={1}
|
|
88
|
+
step={1}
|
|
89
|
+
stepPixelSize={2}
|
|
90
|
+
value={number}
|
|
91
|
+
minValue={-100}
|
|
92
|
+
maxValue={100}
|
|
93
|
+
onDrag={(e, value) => setNumber(value)}
|
|
94
|
+
/>
|
|
95
|
+
</LabeledList.Item>
|
|
96
|
+
<LabeledList.Item label="Rotating Icon">
|
|
97
|
+
<Box inline position="relative">
|
|
98
|
+
<DraggableControl
|
|
99
|
+
value={number}
|
|
100
|
+
minValue={-100}
|
|
101
|
+
maxValue={100}
|
|
102
|
+
dragMatrix={[0, -1]}
|
|
103
|
+
step={1}
|
|
104
|
+
stepPixelSize={5}
|
|
105
|
+
onDrag={(e, value) => setNumber(value)}
|
|
106
|
+
>
|
|
107
|
+
{(control) => (
|
|
108
|
+
<Box onMouseDown={control.handleDragStart}>
|
|
109
|
+
<Icon
|
|
110
|
+
size={4}
|
|
111
|
+
color="yellow"
|
|
112
|
+
name="times"
|
|
113
|
+
rotation={control.displayValue * 4}
|
|
114
|
+
/>
|
|
115
|
+
{control.inputElement}
|
|
116
|
+
</Box>
|
|
117
|
+
)}
|
|
118
|
+
</DraggableControl>
|
|
119
|
+
</Box>
|
|
120
|
+
</LabeledList.Item>
|
|
121
|
+
</LabeledList>
|
|
122
|
+
</Section>
|
|
123
|
+
);
|
|
124
|
+
};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file
|
|
3
|
+
* @copyright 2021 Aleksej Komarov
|
|
4
|
+
* @license MIT
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { Button, LabeledList } from '../components';
|
|
8
|
+
|
|
9
|
+
export const meta = {
|
|
10
|
+
title: 'LabeledList',
|
|
11
|
+
render: () => <Story />,
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const Story = (props) => {
|
|
15
|
+
return (
|
|
16
|
+
<>
|
|
17
|
+
<LabeledList>
|
|
18
|
+
<LabeledList.Item label="Label 1">Entry 1</LabeledList.Item>
|
|
19
|
+
<LabeledList.Item label={<Button>Nodes as labels:</Button>}>
|
|
20
|
+
Entry 2
|
|
21
|
+
</LabeledList.Item>
|
|
22
|
+
<LabeledList.Item labelColor="green" label="labelColor=green">
|
|
23
|
+
Entry 3
|
|
24
|
+
</LabeledList.Item>
|
|
25
|
+
<LabeledList.Item color="green" label="color=green">
|
|
26
|
+
Entry 4
|
|
27
|
+
</LabeledList.Item>
|
|
28
|
+
<LabeledList.Item buttons={<Button>Test</Button>} label="Buttons prop">
|
|
29
|
+
Entry 5
|
|
30
|
+
</LabeledList.Item>
|
|
31
|
+
<LabeledList.Divider />
|
|
32
|
+
<LabeledList.Item label="LabeledList.Divider right above us">
|
|
33
|
+
Entry 6
|
|
34
|
+
</LabeledList.Item>
|
|
35
|
+
<LabeledList.Item
|
|
36
|
+
labelWrap
|
|
37
|
+
label="Very very very very very very very very very very very very very long label with labelWrap"
|
|
38
|
+
>
|
|
39
|
+
Entry 7
|
|
40
|
+
</LabeledList.Item>
|
|
41
|
+
<LabeledList.Item
|
|
42
|
+
labelWrap
|
|
43
|
+
verticalAlign="middle"
|
|
44
|
+
label="Very very very very very very very very very very very very very long label with labelWrap and verticalAlign"
|
|
45
|
+
>
|
|
46
|
+
Entry 8
|
|
47
|
+
</LabeledList.Item>
|
|
48
|
+
</LabeledList>
|
|
49
|
+
<br />
|
|
50
|
+
<br />
|
|
51
|
+
<br />
|
|
52
|
+
<LabeledList>
|
|
53
|
+
<LabeledList.Item labelWrap label="List with all labelWrap=true">
|
|
54
|
+
Entry 1
|
|
55
|
+
</LabeledList.Item>
|
|
56
|
+
<LabeledList.Item labelWrap label="List with all labelWrap=true">
|
|
57
|
+
Entry 2
|
|
58
|
+
</LabeledList.Item>
|
|
59
|
+
<LabeledList.Item labelWrap label="List with all labelWrap=true">
|
|
60
|
+
Entry 3
|
|
61
|
+
</LabeledList.Item>
|
|
62
|
+
</LabeledList>
|
|
63
|
+
<br />
|
|
64
|
+
<br />
|
|
65
|
+
<br />
|
|
66
|
+
<LabeledList>
|
|
67
|
+
<LabeledList.Item label="Very very very very very very very very very very very very very long label without labelWrap">
|
|
68
|
+
Entry 1
|
|
69
|
+
</LabeledList.Item>
|
|
70
|
+
</LabeledList>
|
|
71
|
+
</>
|
|
72
|
+
);
|
|
73
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { Box, Popper } from '../components';
|
|
2
|
+
|
|
3
|
+
export const meta = {
|
|
4
|
+
title: 'Popper',
|
|
5
|
+
render: () => <Story />,
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
const Story = () => {
|
|
9
|
+
return (
|
|
10
|
+
<>
|
|
11
|
+
<Popper
|
|
12
|
+
isOpen
|
|
13
|
+
content={
|
|
14
|
+
<Box
|
|
15
|
+
style={{
|
|
16
|
+
background: 'white',
|
|
17
|
+
border: '2px solid blue',
|
|
18
|
+
}}
|
|
19
|
+
>
|
|
20
|
+
Loogatme!
|
|
21
|
+
</Box>
|
|
22
|
+
}
|
|
23
|
+
placement="bottom"
|
|
24
|
+
>
|
|
25
|
+
<Box
|
|
26
|
+
style={{
|
|
27
|
+
border: '5px solid white',
|
|
28
|
+
height: '300px',
|
|
29
|
+
width: '200px',
|
|
30
|
+
}}
|
|
31
|
+
/>
|
|
32
|
+
</Popper>
|
|
33
|
+
|
|
34
|
+
<Popper
|
|
35
|
+
isOpen
|
|
36
|
+
content={
|
|
37
|
+
<Box
|
|
38
|
+
style={{
|
|
39
|
+
background: 'white',
|
|
40
|
+
border: '2px solid blue',
|
|
41
|
+
}}
|
|
42
|
+
>
|
|
43
|
+
I am on the right!
|
|
44
|
+
</Box>
|
|
45
|
+
}
|
|
46
|
+
placement="right"
|
|
47
|
+
>
|
|
48
|
+
<Box
|
|
49
|
+
style={{
|
|
50
|
+
border: '5px solid white',
|
|
51
|
+
height: '500px',
|
|
52
|
+
width: '100px',
|
|
53
|
+
}}
|
|
54
|
+
/>
|
|
55
|
+
</Popper>
|
|
56
|
+
</>
|
|
57
|
+
);
|
|
58
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file
|
|
3
|
+
* @copyright 2021 Aleksej Komarov
|
|
4
|
+
* @license MIT
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { useState } from 'react';
|
|
8
|
+
import {
|
|
9
|
+
Box,
|
|
10
|
+
Button,
|
|
11
|
+
Input,
|
|
12
|
+
LabeledList,
|
|
13
|
+
ProgressBar,
|
|
14
|
+
Section,
|
|
15
|
+
} from '../components';
|
|
16
|
+
|
|
17
|
+
export const meta = {
|
|
18
|
+
title: 'ProgressBar',
|
|
19
|
+
render: () => <Story />,
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const Story = (props) => {
|
|
23
|
+
const [progress, setProgress] = useState(0.5);
|
|
24
|
+
const [color, setColor] = useState('');
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<Section>
|
|
28
|
+
<ProgressBar
|
|
29
|
+
value={progress}
|
|
30
|
+
color={color}
|
|
31
|
+
ranges={{
|
|
32
|
+
good: [0.5, Infinity],
|
|
33
|
+
bad: [-Infinity, 0.1],
|
|
34
|
+
average: [0, 0.5],
|
|
35
|
+
}}
|
|
36
|
+
>
|
|
37
|
+
Value: {Number(progress).toFixed(1)}
|
|
38
|
+
</ProgressBar>
|
|
39
|
+
<Box mt={1}>
|
|
40
|
+
<LabeledList>
|
|
41
|
+
<LabeledList.Item label="Adjust value">
|
|
42
|
+
<Button
|
|
43
|
+
content="-0.1"
|
|
44
|
+
onClick={() => setProgress(progress - 0.1)}
|
|
45
|
+
/>
|
|
46
|
+
<Button
|
|
47
|
+
content="+0.1"
|
|
48
|
+
onClick={() => setProgress(progress + 0.1)}
|
|
49
|
+
/>
|
|
50
|
+
</LabeledList.Item>
|
|
51
|
+
<LabeledList.Item label="Override color">
|
|
52
|
+
<Input value={color} onChange={(e, value) => setColor(value)} />
|
|
53
|
+
</LabeledList.Item>
|
|
54
|
+
</LabeledList>
|
|
55
|
+
</Box>
|
|
56
|
+
</Section>
|
|
57
|
+
);
|
|
58
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file
|
|
3
|
+
* @copyright 2021 Aleksej Komarov
|
|
4
|
+
* @license MIT
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { Box, Section, Stack } from '../components';
|
|
8
|
+
|
|
9
|
+
export const meta = {
|
|
10
|
+
title: 'Stack',
|
|
11
|
+
render: () => <Story />,
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const Filler = () => (
|
|
15
|
+
<Box inline width={1} height={1}>
|
|
16
|
+
A
|
|
17
|
+
</Box>
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
const SmallStackItems = () => (
|
|
21
|
+
<>
|
|
22
|
+
<Stack.Item>
|
|
23
|
+
<Filler />
|
|
24
|
+
</Stack.Item>
|
|
25
|
+
<Stack.Divider />
|
|
26
|
+
<Stack.Item>
|
|
27
|
+
<Filler />
|
|
28
|
+
</Stack.Item>
|
|
29
|
+
</>
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
const Story = (props) => {
|
|
33
|
+
return (
|
|
34
|
+
<Section fill>
|
|
35
|
+
<Stack fill className="debug-layout">
|
|
36
|
+
<SmallStackItems />
|
|
37
|
+
<Stack.Item grow={1}>
|
|
38
|
+
<Stack fill vertical zebra>
|
|
39
|
+
<SmallStackItems />
|
|
40
|
+
<Stack.Item>
|
|
41
|
+
<Stack fill>
|
|
42
|
+
<SmallStackItems />
|
|
43
|
+
<Stack.Item grow={1} />
|
|
44
|
+
<SmallStackItems />
|
|
45
|
+
<SmallStackItems />
|
|
46
|
+
</Stack>
|
|
47
|
+
</Stack.Item>
|
|
48
|
+
<Stack.Item grow={1} />
|
|
49
|
+
<SmallStackItems />
|
|
50
|
+
</Stack>
|
|
51
|
+
</Stack.Item>
|
|
52
|
+
</Stack>
|
|
53
|
+
</Section>
|
|
54
|
+
);
|
|
55
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file
|
|
3
|
+
* @copyright 2021 Aleksej Komarov
|
|
4
|
+
* @license MIT
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { storage } from '../common/storage';
|
|
8
|
+
|
|
9
|
+
import { Button, LabeledList, NoticeBox, Section } from '../components';
|
|
10
|
+
import { formatSiUnit } from '../src/format';
|
|
11
|
+
|
|
12
|
+
export const meta = {
|
|
13
|
+
title: 'Storage',
|
|
14
|
+
render: () => <Story />,
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const Story = (props) => {
|
|
18
|
+
if (!window.localStorage) {
|
|
19
|
+
return <NoticeBox>Local storage is not available.</NoticeBox>;
|
|
20
|
+
}
|
|
21
|
+
return (
|
|
22
|
+
<Section
|
|
23
|
+
title="Local Storage"
|
|
24
|
+
buttons={
|
|
25
|
+
<Button
|
|
26
|
+
icon="recycle"
|
|
27
|
+
onClick={() => {
|
|
28
|
+
localStorage.clear();
|
|
29
|
+
storage.clear();
|
|
30
|
+
}}
|
|
31
|
+
>
|
|
32
|
+
Clear
|
|
33
|
+
</Button>
|
|
34
|
+
}
|
|
35
|
+
>
|
|
36
|
+
<LabeledList>
|
|
37
|
+
<LabeledList.Item label="Keys in use">
|
|
38
|
+
{localStorage.length}
|
|
39
|
+
</LabeledList.Item>
|
|
40
|
+
<LabeledList.Item label="Remaining space">
|
|
41
|
+
{formatSiUnit(localStorage.remainingSpace, 0, 'B')}
|
|
42
|
+
</LabeledList.Item>
|
|
43
|
+
</LabeledList>
|
|
44
|
+
</Section>
|
|
45
|
+
);
|
|
46
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file
|
|
3
|
+
* @copyright 2021 Aleksej Komarov
|
|
4
|
+
* @license MIT
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { Input, LabeledList, Section } from '../components';
|
|
8
|
+
import { useState } from 'react';
|
|
9
|
+
|
|
10
|
+
export const meta = {
|
|
11
|
+
title: 'Themes',
|
|
12
|
+
render: () => <Story />,
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const Story = (props) => {
|
|
16
|
+
const [theme, setTheme] = useState('');
|
|
17
|
+
return (
|
|
18
|
+
<Section>
|
|
19
|
+
<LabeledList>
|
|
20
|
+
<LabeledList.Item label="Use theme">
|
|
21
|
+
<Input
|
|
22
|
+
placeholder="theme_name"
|
|
23
|
+
value={theme}
|
|
24
|
+
onInput={(e, value) => setTheme(value)}
|
|
25
|
+
/>
|
|
26
|
+
</LabeledList.Item>
|
|
27
|
+
</LabeledList>
|
|
28
|
+
</Section>
|
|
29
|
+
);
|
|
30
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file
|
|
3
|
+
* @copyright 2021 Aleksej Komarov
|
|
4
|
+
* @license MIT
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { Placement } from '@popperjs/core';
|
|
8
|
+
import { Box, Button, Section, Tooltip } from '../components';
|
|
9
|
+
|
|
10
|
+
export const meta = {
|
|
11
|
+
title: 'Tooltip',
|
|
12
|
+
render: () => <Story />,
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const Story = () => {
|
|
16
|
+
const positions: Placement[] = [
|
|
17
|
+
'top',
|
|
18
|
+
'left',
|
|
19
|
+
'right',
|
|
20
|
+
'bottom',
|
|
21
|
+
'bottom-start',
|
|
22
|
+
'bottom-end',
|
|
23
|
+
];
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<Section>
|
|
27
|
+
<Box>
|
|
28
|
+
<Tooltip content="Tooltip text.">
|
|
29
|
+
<Box inline position="relative" mr={1}>
|
|
30
|
+
Box (hover me).
|
|
31
|
+
</Box>
|
|
32
|
+
</Tooltip>
|
|
33
|
+
<Button tooltip="Tooltip text." content="Button" />
|
|
34
|
+
</Box>
|
|
35
|
+
<Box mt={1}>
|
|
36
|
+
{positions.map((position) => (
|
|
37
|
+
<Button
|
|
38
|
+
key={position}
|
|
39
|
+
color="transparent"
|
|
40
|
+
tooltip="Tooltip text."
|
|
41
|
+
tooltipPosition={position}
|
|
42
|
+
content={position}
|
|
43
|
+
/>
|
|
44
|
+
))}
|
|
45
|
+
</Box>
|
|
46
|
+
</Section>
|
|
47
|
+
);
|
|
48
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file
|
|
3
|
+
* @copyright 2021 Aleksej Komarov
|
|
4
|
+
* @license MIT
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { Box } from '../components';
|
|
8
|
+
|
|
9
|
+
export const BoxWithSampleText = (props) => {
|
|
10
|
+
return (
|
|
11
|
+
<Box {...props}>
|
|
12
|
+
<Box italic>Jackdaws love my big sphinx of quartz.</Box>
|
|
13
|
+
<Box mt={1} bold>
|
|
14
|
+
The wide electrification of the southern provinces will give a powerful
|
|
15
|
+
impetus to the growth of agriculture.
|
|
16
|
+
</Box>
|
|
17
|
+
</Box>
|
|
18
|
+
);
|
|
19
|
+
};
|
package/tsconfig.json
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
"compilerOptions": {
|
|
3
3
|
"allowJs": true,
|
|
4
4
|
"allowSyntheticDefaultImports": true,
|
|
5
|
-
"baseUrl": ".",
|
|
6
5
|
"checkJs": false,
|
|
7
6
|
"esModuleInterop": true,
|
|
8
7
|
"forceConsistentCasingInFileNames": true,
|
|
@@ -17,26 +16,6 @@
|
|
|
17
16
|
"module": "ESNext",
|
|
18
17
|
"moduleResolution": "Node",
|
|
19
18
|
"noEmit": true,
|
|
20
|
-
"paths": {
|
|
21
|
-
"components/*": [
|
|
22
|
-
"src/components/*"
|
|
23
|
-
],
|
|
24
|
-
"common/*": [
|
|
25
|
-
"src/common/*"
|
|
26
|
-
],
|
|
27
|
-
"debug/*": [
|
|
28
|
-
"src/debug/*"
|
|
29
|
-
],
|
|
30
|
-
"layouts/*": [
|
|
31
|
-
"src/layouts/*"
|
|
32
|
-
],
|
|
33
|
-
"interfaces/*": [
|
|
34
|
-
"src/interfaces/*"
|
|
35
|
-
],
|
|
36
|
-
"styles/*": [
|
|
37
|
-
"src/styles/*"
|
|
38
|
-
]
|
|
39
|
-
},
|
|
40
19
|
"resolveJsonModule": true,
|
|
41
20
|
"skipLibCheck": true,
|
|
42
21
|
"strict": false,
|