react-miui 0.19.0 → 0.20.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.storybook/main.ts +17 -0
- package/.storybook/preview.tsx +28 -0
- package/CHANGELOG.md +21 -0
- package/README.md +2 -0
- package/dist/components/form/input/Input.css.d.ts +47 -0
- package/dist/components/form/input/Input.css.d.ts.map +1 -0
- package/dist/components/form/input/Input.css.js +52 -0
- package/dist/components/form/input/Input.css.js.map +1 -0
- package/dist/components/form/input/Input.d.ts.map +1 -1
- package/dist/components/form/input/Input.js +4 -10
- package/dist/components/form/input/Input.js.map +1 -1
- package/dist/components/form/input/Input.module.scss +0 -62
- package/dist/components/form/input/Input.stories.d.ts +9 -0
- package/dist/components/form/input/Input.stories.d.ts.map +1 -0
- package/dist/components/form/input/Input.stories.js +46 -0
- package/dist/components/form/input/Input.stories.js.map +1 -0
- package/dist/components/form/input/Input.styled.d.ts +279 -3
- package/dist/components/form/input/Input.styled.d.ts.map +1 -1
- package/dist/components/form/input/Input.styled.js +15 -16
- package/dist/components/form/input/Input.styled.js.map +1 -1
- package/dist/components/form/textarea/TextArea.d.ts.map +1 -0
- package/dist/components/form/{TextArea.js → textarea/TextArea.js} +3 -10
- package/dist/components/form/textarea/TextArea.js.map +1 -0
- package/dist/components/form/textarea/TextArea.stories.d.ts +8 -0
- package/dist/components/form/textarea/TextArea.stories.d.ts.map +1 -0
- package/dist/components/form/textarea/TextArea.stories.js +15 -0
- package/dist/components/form/textarea/TextArea.stories.js.map +1 -0
- package/dist/components/form/textarea/TextArea.styled.d.ts +78 -0
- package/dist/components/form/textarea/TextArea.styled.d.ts.map +1 -0
- package/dist/components/form/textarea/TextArea.styled.js +9 -0
- package/dist/components/form/textarea/TextArea.styled.js.map +1 -0
- package/dist/components/layout/list/Value.styled.d.ts +57 -1
- package/dist/components/layout/list/Value.styled.d.ts.map +1 -1
- package/dist/components/ui/loader/CoveringLoader.d.ts +8 -0
- package/dist/components/ui/loader/CoveringLoader.d.ts.map +1 -0
- package/dist/components/ui/loader/CoveringLoader.js +45 -0
- package/dist/components/ui/loader/CoveringLoader.js.map +1 -0
- package/dist/components/ui/loader/CoveringLoader.stories.d.ts +8 -0
- package/dist/components/ui/loader/CoveringLoader.stories.d.ts.map +1 -0
- package/dist/components/ui/loader/CoveringLoader.stories.js +31 -0
- package/dist/components/ui/loader/CoveringLoader.stories.js.map +1 -0
- package/dist/components/ui/loader/FullLoader.d.ts +6 -0
- package/dist/components/ui/loader/FullLoader.d.ts.map +1 -0
- package/dist/components/ui/loader/FullLoader.js +22 -0
- package/dist/components/ui/loader/FullLoader.js.map +1 -0
- package/dist/components/ui/loader/FullLoader.stories.d.ts +8 -0
- package/dist/components/ui/loader/FullLoader.stories.d.ts.map +1 -0
- package/dist/components/ui/loader/FullLoader.stories.js +25 -0
- package/dist/components/ui/loader/FullLoader.stories.js.map +1 -0
- package/dist/components/ui/loader/Loader.d.ts +11 -0
- package/dist/components/ui/loader/Loader.d.ts.map +1 -0
- package/dist/components/ui/loader/Loader.js +61 -0
- package/dist/components/ui/loader/Loader.js.map +1 -0
- package/dist/components/ui/loader/Loader.stories.d.ts +8 -0
- package/dist/components/ui/loader/Loader.stories.d.ts.map +1 -0
- package/dist/components/ui/loader/Loader.stories.js +26 -0
- package/dist/components/ui/loader/Loader.stories.js.map +1 -0
- package/dist/components/ui/loader/Loading.d.ts +9 -0
- package/dist/components/ui/loader/Loading.d.ts.map +1 -0
- package/dist/components/ui/loader/Loading.js +20 -0
- package/dist/components/ui/loader/Loading.js.map +1 -0
- package/dist/components/ui/loader/Loading.stories.d.ts +8 -0
- package/dist/components/ui/loader/Loading.stories.d.ts.map +1 -0
- package/dist/components/ui/loader/Loading.stories.js +38 -0
- package/dist/components/ui/loader/Loading.stories.js.map +1 -0
- package/dist/components/ui/loader/PopLoader.d.ts +6 -0
- package/dist/components/ui/loader/PopLoader.d.ts.map +1 -0
- package/dist/components/ui/loader/PopLoader.js +39 -0
- package/dist/components/ui/loader/PopLoader.js.map +1 -0
- package/dist/components/ui/loader/PopLoader.stories.d.ts +8 -0
- package/dist/components/ui/loader/PopLoader.stories.d.ts.map +1 -0
- package/dist/components/ui/loader/PopLoader.stories.js +30 -0
- package/dist/components/ui/loader/PopLoader.stories.js.map +1 -0
- package/dist/components/ui/message/Message.d.ts +83 -5
- package/dist/components/ui/message/Message.d.ts.map +1 -1
- package/dist/components/ui/message/Message.js +2 -15
- package/dist/components/ui/message/Message.js.map +1 -1
- package/dist/components/ui/message/Message.stories.d.ts +9 -0
- package/dist/components/ui/message/Message.stories.d.ts.map +1 -0
- package/dist/components/ui/message/Message.stories.js +50 -0
- package/dist/components/ui/message/Message.stories.js.map +1 -0
- package/dist/components/ui/message/Message.styled.d.ts +77 -0
- package/dist/components/ui/message/Message.styled.d.ts.map +1 -0
- package/dist/components/ui/message/Message.styled.js +44 -0
- package/dist/components/ui/message/Message.styled.js.map +1 -0
- package/dist/index.d.ts +9 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -2
- package/dist/index.js.map +1 -1
- package/dist/scrollbars.css.d.ts +4 -0
- package/dist/scrollbars.css.d.ts.map +1 -0
- package/dist/scrollbars.css.js +34 -0
- package/dist/scrollbars.css.js.map +1 -0
- package/dist/theme.css-reset.d.ts +3 -0
- package/dist/theme.css-reset.d.ts.map +1 -0
- package/dist/theme.css-reset.js +121 -0
- package/dist/theme.css-reset.js.map +1 -0
- package/dist/theme.d.ts +583 -13
- package/dist/theme.d.ts.map +1 -1
- package/dist/theme.js +81 -5
- package/dist/theme.js.map +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/classes/Drawer.html +14 -14
- package/docs/classes/Pop.html +14 -14
- package/docs/classes/ToasterProvider.html +10 -10
- package/docs/enums/ICON.html +14 -14
- package/docs/functions/Action.html +12 -4
- package/docs/functions/Button.html +12 -4
- package/docs/functions/Card.html +12 -4
- package/docs/functions/Checkbox.html +12 -4
- package/docs/functions/Choice.html +13 -5
- package/docs/functions/CoveringLoader.html +113 -0
- package/docs/functions/DirectionPad.html +12 -4
- package/docs/functions/EqualActions.html +12 -4
- package/docs/functions/FullLoader.html +112 -0
- package/docs/functions/HandleEsc.html +12 -4
- package/docs/functions/Header.html +12 -4
- package/docs/functions/HeaderIconAction.html +12 -4
- package/docs/functions/Icon-1.html +12 -4
- package/docs/functions/If.html +12 -4
- package/docs/functions/Input.html +15 -5
- package/docs/functions/Item-1.html +12 -4
- package/docs/functions/KeyValue.html +12 -4
- package/docs/functions/Label.html +12 -4
- package/docs/functions/List-1.html +12 -4
- package/docs/functions/Loader.html +114 -0
- package/docs/functions/Loading.html +116 -0
- package/docs/functions/Message.html +50 -9
- package/docs/functions/Modal-1.html +12 -4
- package/docs/functions/ModalButtons-1.html +12 -4
- package/docs/functions/PopLoader.html +114 -0
- package/docs/functions/PopOption.html +12 -4
- package/docs/functions/SearchContainer.html +12 -4
- package/docs/functions/Section-1.html +12 -4
- package/docs/functions/Select.html +12 -4
- package/docs/functions/Selector.html +13 -5
- package/docs/functions/Spacer.html +12 -4
- package/docs/functions/Stats.html +12 -4
- package/docs/functions/StickyHeader-1.html +12 -4
- package/docs/functions/StickyHeader.Content.html +5 -5
- package/docs/functions/Table.html +12 -4
- package/docs/functions/TextArea.html +12 -4
- package/docs/functions/Toggle.html +12 -4
- package/docs/functions/getCssText.html +12 -4
- package/docs/functions/styled.html +12 -4
- package/docs/functions/useToaster.html +13 -5
- package/docs/index.html +14 -4
- package/docs/modules/Item.html +7 -7
- package/docs/modules/List.html +6 -6
- package/docs/modules/Modal.html +6 -6
- package/docs/modules/ModalButtons.html +6 -6
- package/docs/modules/Section.html +6 -6
- package/docs/modules/StickyHeader.html +6 -6
- package/docs/modules.html +26 -4
- package/docs/pages/tutorials/Test.html +12 -4
- package/docs/types/ThemeCSS.html +99 -0
- package/docs/variables/Item.Label.html +5 -5
- package/docs/variables/Item.Value.html +5 -5
- package/docs/variables/List.Header.html +5 -5
- package/docs/variables/Modal.NegateMargin.html +5 -5
- package/docs/variables/ModalButtons.Button.html +5 -5
- package/docs/variables/Section.Container.html +5 -5
- package/docs/variables/cssReset.html +101 -0
- package/docs/variables/miuiScrollbars.html +99 -0
- package/esm/components/form/input/Input.css.d.ts +47 -0
- package/esm/components/form/input/Input.css.d.ts.map +1 -0
- package/esm/components/form/input/Input.css.js +48 -0
- package/esm/components/form/input/Input.css.js.map +1 -0
- package/esm/components/form/input/Input.d.ts.map +1 -1
- package/esm/components/form/input/Input.js +5 -11
- package/esm/components/form/input/Input.js.map +1 -1
- package/esm/components/form/input/Input.module.scss +0 -62
- package/esm/components/form/input/Input.stories.d.ts +9 -0
- package/esm/components/form/input/Input.stories.d.ts.map +1 -0
- package/esm/components/form/input/Input.stories.js +39 -0
- package/esm/components/form/input/Input.stories.js.map +1 -0
- package/esm/components/form/input/Input.styled.d.ts +279 -3
- package/esm/components/form/input/Input.styled.d.ts.map +1 -1
- package/esm/components/form/input/Input.styled.js +12 -16
- package/esm/components/form/input/Input.styled.js.map +1 -1
- package/esm/components/form/textarea/TextArea.d.ts.map +1 -0
- package/esm/components/form/textarea/TextArea.js +16 -0
- package/esm/components/form/textarea/TextArea.js.map +1 -0
- package/esm/components/form/textarea/TextArea.stories.d.ts +8 -0
- package/esm/components/form/textarea/TextArea.stories.d.ts.map +1 -0
- package/esm/components/form/textarea/TextArea.stories.js +12 -0
- package/esm/components/form/textarea/TextArea.stories.js.map +1 -0
- package/esm/components/form/textarea/TextArea.styled.d.ts +78 -0
- package/esm/components/form/textarea/TextArea.styled.d.ts.map +1 -0
- package/esm/components/form/textarea/TextArea.styled.js +14 -0
- package/esm/components/form/textarea/TextArea.styled.js.map +1 -0
- package/esm/components/layout/list/Value.styled.d.ts +57 -1
- package/esm/components/layout/list/Value.styled.d.ts.map +1 -1
- package/esm/components/ui/loader/CoveringLoader.d.ts +8 -0
- package/esm/components/ui/loader/CoveringLoader.d.ts.map +1 -0
- package/esm/components/ui/loader/CoveringLoader.js +27 -0
- package/esm/components/ui/loader/CoveringLoader.js.map +1 -0
- package/esm/components/ui/loader/CoveringLoader.stories.d.ts +8 -0
- package/esm/components/ui/loader/CoveringLoader.stories.d.ts.map +1 -0
- package/esm/components/ui/loader/CoveringLoader.stories.js +25 -0
- package/esm/components/ui/loader/CoveringLoader.stories.js.map +1 -0
- package/esm/components/ui/loader/FullLoader.d.ts +6 -0
- package/esm/components/ui/loader/FullLoader.d.ts.map +1 -0
- package/esm/components/ui/loader/FullLoader.js +16 -0
- package/esm/components/ui/loader/FullLoader.js.map +1 -0
- package/esm/components/ui/loader/FullLoader.stories.d.ts +8 -0
- package/esm/components/ui/loader/FullLoader.stories.d.ts.map +1 -0
- package/esm/components/ui/loader/FullLoader.stories.js +19 -0
- package/esm/components/ui/loader/FullLoader.stories.js.map +1 -0
- package/esm/components/ui/loader/Loader.d.ts +11 -0
- package/esm/components/ui/loader/Loader.d.ts.map +1 -0
- package/esm/components/ui/loader/Loader.js +23 -0
- package/esm/components/ui/loader/Loader.js.map +1 -0
- package/esm/components/ui/loader/Loader.stories.d.ts +8 -0
- package/esm/components/ui/loader/Loader.stories.d.ts.map +1 -0
- package/esm/components/ui/loader/Loader.stories.js +23 -0
- package/esm/components/ui/loader/Loader.stories.js.map +1 -0
- package/esm/components/ui/loader/Loading.d.ts +9 -0
- package/esm/components/ui/loader/Loading.d.ts.map +1 -0
- package/esm/components/ui/loader/Loading.js +14 -0
- package/esm/components/ui/loader/Loading.js.map +1 -0
- package/esm/components/ui/loader/Loading.stories.d.ts +8 -0
- package/esm/components/ui/loader/Loading.stories.d.ts.map +1 -0
- package/esm/components/ui/loader/Loading.stories.js +32 -0
- package/esm/components/ui/loader/Loading.stories.js.map +1 -0
- package/esm/components/ui/loader/PopLoader.d.ts +6 -0
- package/esm/components/ui/loader/PopLoader.d.ts.map +1 -0
- package/esm/components/ui/loader/PopLoader.js +21 -0
- package/esm/components/ui/loader/PopLoader.js.map +1 -0
- package/esm/components/ui/loader/PopLoader.stories.d.ts +8 -0
- package/esm/components/ui/loader/PopLoader.stories.d.ts.map +1 -0
- package/esm/components/ui/loader/PopLoader.stories.js +24 -0
- package/esm/components/ui/loader/PopLoader.stories.js.map +1 -0
- package/esm/components/ui/message/Message.d.ts +83 -5
- package/esm/components/ui/message/Message.d.ts.map +1 -1
- package/esm/components/ui/message/Message.js +2 -12
- package/esm/components/ui/message/Message.js.map +1 -1
- package/esm/components/ui/message/Message.stories.d.ts +9 -0
- package/esm/components/ui/message/Message.stories.d.ts.map +1 -0
- package/esm/components/ui/message/Message.stories.js +43 -0
- package/esm/components/ui/message/Message.stories.js.map +1 -0
- package/esm/components/ui/message/Message.styled.d.ts +77 -0
- package/esm/components/ui/message/Message.styled.d.ts.map +1 -0
- package/esm/components/ui/message/Message.styled.js +41 -0
- package/esm/components/ui/message/Message.styled.js.map +1 -0
- package/esm/index.d.ts +9 -1
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +8 -1
- package/esm/index.js.map +1 -1
- package/esm/scrollbars.css.d.ts +4 -0
- package/esm/scrollbars.css.d.ts.map +1 -0
- package/esm/scrollbars.css.js +49 -0
- package/esm/scrollbars.css.js.map +1 -0
- package/esm/theme.css-reset.d.ts +3 -0
- package/esm/theme.css-reset.d.ts.map +1 -0
- package/esm/theme.css-reset.js +118 -0
- package/esm/theme.css-reset.js.map +1 -0
- package/esm/theme.d.ts +583 -13
- package/esm/theme.d.ts.map +1 -1
- package/esm/theme.js +68 -2
- package/esm/theme.js.map +1 -1
- package/package.json +15 -4
- package/src/components/form/input/Input.css.ts +58 -0
- package/src/components/form/input/Input.module.scss +0 -62
- package/src/components/form/input/Input.stories.tsx +59 -0
- package/src/components/form/input/Input.styled.ts +18 -16
- package/src/components/form/input/Input.tsx +15 -16
- package/src/components/form/textarea/TextArea.stories.tsx +21 -0
- package/src/components/form/textarea/TextArea.styled.ts +19 -0
- package/src/components/form/{TextArea.tsx → textarea/TextArea.tsx} +10 -9
- package/src/components/ui/loader/CoveringLoader.stories.tsx +37 -0
- package/src/components/ui/loader/CoveringLoader.tsx +53 -0
- package/src/components/ui/loader/FullLoader.stories.tsx +34 -0
- package/src/components/ui/loader/FullLoader.tsx +24 -0
- package/src/components/ui/loader/Loader.stories.tsx +32 -0
- package/src/components/ui/loader/Loader.tsx +92 -0
- package/src/components/ui/loader/Loading.stories.tsx +49 -0
- package/src/components/ui/loader/Loading.tsx +29 -0
- package/src/components/ui/loader/PopLoader.stories.tsx +38 -0
- package/src/components/ui/loader/PopLoader.tsx +33 -0
- package/src/components/ui/message/Message.stories.tsx +61 -0
- package/src/components/ui/message/Message.styled.ts +45 -0
- package/src/components/ui/message/Message.tsx +26 -15
- package/src/index.ts +11 -1
- package/src/scrollbars.css.ts +56 -0
- package/src/theme.css-reset.ts +132 -0
- package/src/theme.ts +109 -2
- package/dist/components/form/TextArea.d.ts.map +0 -1
- package/dist/components/form/TextArea.js.map +0 -1
- package/esm/components/form/TextArea.d.ts.map +0 -1
- package/esm/components/form/TextArea.js +0 -20
- package/esm/components/form/TextArea.js.map +0 -1
- /package/dist/components/form/{TextArea.d.ts → textarea/TextArea.d.ts} +0 -0
- /package/esm/components/form/{TextArea.d.ts → textarea/TextArea.d.ts} +0 -0
package/esm/theme.js
CHANGED
|
@@ -1,7 +1,72 @@
|
|
|
1
1
|
import { createStitches } from "@stitches/react";
|
|
2
|
-
|
|
2
|
+
const RATIOS = {
|
|
3
|
+
dimensions: 3,
|
|
4
|
+
border: 2.666666,
|
|
5
|
+
font: 1.666666,
|
|
6
|
+
};
|
|
7
|
+
const pxToRem = (px) => `${px / 16}rem`;
|
|
8
|
+
const dimensionsPxToRem = (px) => pxToRem(px / RATIOS.dimensions);
|
|
9
|
+
const borderPxToRem = (px) => pxToRem(px / RATIOS.border);
|
|
10
|
+
const fontPxToRem = (px) => pxToRem(px / RATIOS.font);
|
|
11
|
+
const { styled, css, globalCss, keyframes, getCssText, theme, createTheme, config, } = createStitches({
|
|
3
12
|
theme: {
|
|
4
|
-
colors: {
|
|
13
|
+
colors: {
|
|
14
|
+
background: "white",
|
|
15
|
+
mainColor: "#008ad2",
|
|
16
|
+
mainColorAlt: "#006AA9",
|
|
17
|
+
activeBg: "#e7e7e7",
|
|
18
|
+
inactiveBg: "#d3d3de",
|
|
19
|
+
inactiveDarkBg: "#999",
|
|
20
|
+
toggleHandleBg: "#e0e0e0",
|
|
21
|
+
toggleHandleBorder: "#cdcdcd",
|
|
22
|
+
toggleBgDisabled: "#f0f0f0",
|
|
23
|
+
toggleHandleBorderDisabled: "#c29f7d",
|
|
24
|
+
toggleHandleBgDisabled: "#deae84",
|
|
25
|
+
icon: "#636363",
|
|
26
|
+
border: "#d5d5d5",
|
|
27
|
+
buttonBorder: "#bababa",
|
|
28
|
+
headerBorder: "#c8c8c9",
|
|
29
|
+
headerBg: "#efeff0",
|
|
30
|
+
headerText: "#484848",
|
|
31
|
+
text: "#323232",
|
|
32
|
+
sub: "#959595",
|
|
33
|
+
popText: "#666",
|
|
34
|
+
toolbarBorder: "#ababab",
|
|
35
|
+
toolbarBg: "#f8f8f8",
|
|
36
|
+
modalBg: "#f7f7f7",
|
|
37
|
+
modalButtonBg: "#f8f8f8",
|
|
38
|
+
modalButtonBorder: "#c2c2c2",
|
|
39
|
+
inputDisabledBg: "#f3f3f3",
|
|
40
|
+
inputDisabledText: "#959595",
|
|
41
|
+
choiceBg: "#ffffff",
|
|
42
|
+
choiceText: "#999999",
|
|
43
|
+
choiceActiveBg: "#f3f3f3",
|
|
44
|
+
choiceActiveText: "#313131",
|
|
45
|
+
choiceBorder: "#cfcfcf",
|
|
46
|
+
selectorText: "#606060",
|
|
47
|
+
selectorActive: "#008ad2",
|
|
48
|
+
blue1: "#038bf4",
|
|
49
|
+
blue2: "#b7d6f5",
|
|
50
|
+
blue3: "#dbe6ff",
|
|
51
|
+
orange1: "#ff7200",
|
|
52
|
+
orange1Darker: "#cc5b00",
|
|
53
|
+
purple1: "#7357e8",
|
|
54
|
+
green1: "#3ec234",
|
|
55
|
+
green1Darker: "#38af2f",
|
|
56
|
+
pink1: "#ff388f",
|
|
57
|
+
red1: "#ea2700",
|
|
58
|
+
yellow1: "#ffde9d",
|
|
59
|
+
yellow2: "#e4a429",
|
|
60
|
+
yellow3: "#fff5db",
|
|
61
|
+
pinky1: "#f5c0b7",
|
|
62
|
+
pinky2: "#e07b67",
|
|
63
|
+
pinky3: "#ffe1db",
|
|
64
|
+
grey1: "#737373",
|
|
65
|
+
focusColor: "#dcaf00",
|
|
66
|
+
scrollbarsThumb: "#737373",
|
|
67
|
+
scrollbarsBg: "transparent",
|
|
68
|
+
tableStripedBg: "#fafafa",
|
|
69
|
+
},
|
|
5
70
|
},
|
|
6
71
|
utils: {
|
|
7
72
|
mx: (value) => ({ marginLeft: value, marginRight: value }),
|
|
@@ -9,4 +74,5 @@ export const { styled, css, globalCss, keyframes, getCssText, theme, createTheme
|
|
|
9
74
|
size: (value) => ({ width: value, height: value }),
|
|
10
75
|
},
|
|
11
76
|
});
|
|
77
|
+
export { styled, css, globalCss, keyframes, getCssText, theme, createTheme, config, pxToRem, dimensionsPxToRem, borderPxToRem, fontPxToRem, };
|
|
12
78
|
//# sourceMappingURL=theme.js.map
|
package/esm/theme.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.js","sourceRoot":"","sources":["../src/theme.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"theme.js","sourceRoot":"","sources":["../src/theme.ts"],"names":[],"mappings":"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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-miui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.20.1",
|
|
4
4
|
"author": "Jacek Nowacki",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"scripts": {
|
|
@@ -14,11 +14,13 @@
|
|
|
14
14
|
"lint:fix": "yarn lint --fix",
|
|
15
15
|
"prepack": "yarn compile",
|
|
16
16
|
"prepublishOnly": "yarn audit && yarn lint && yarn test && yarn docs",
|
|
17
|
-
"start:dev": "
|
|
17
|
+
"start:dev": "yarn storybook",
|
|
18
18
|
"deploy:dev": "next build && next export && netlify deploy --dir out",
|
|
19
19
|
"updates": "npx --yes npm-check-updates --dep prod",
|
|
20
20
|
"updates:dev": "npx --yes npm-check-updates --dep dev",
|
|
21
|
-
"updates:all": "npx --yes npm-check-updates"
|
|
21
|
+
"updates:all": "npx --yes npm-check-updates",
|
|
22
|
+
"storybook": "storybook dev -p 6006",
|
|
23
|
+
"build:storybook": "storybook build"
|
|
22
24
|
},
|
|
23
25
|
"exports": {
|
|
24
26
|
"./global.scss": "./src/global.scss",
|
|
@@ -34,7 +36,6 @@
|
|
|
34
36
|
"dependencies": {
|
|
35
37
|
"@stitches/react": "^1.2.8",
|
|
36
38
|
"classnames": "^2.3.2",
|
|
37
|
-
"nodemon": "^2.0.22",
|
|
38
39
|
"oop-timers": "^5.0.0"
|
|
39
40
|
},
|
|
40
41
|
"devDependencies": {
|
|
@@ -48,6 +49,13 @@
|
|
|
48
49
|
"@dzek69/eslint-config-typescript": "^1.1.0",
|
|
49
50
|
"@icon-park/react": "^1.4.2",
|
|
50
51
|
"@knodes/typedoc-plugin-pages": "^0.23.4",
|
|
52
|
+
"@storybook/addon-essentials": "^7.0.11",
|
|
53
|
+
"@storybook/addon-interactions": "^7.0.11",
|
|
54
|
+
"@storybook/addon-links": "^7.0.11",
|
|
55
|
+
"@storybook/blocks": "^7.0.11",
|
|
56
|
+
"@storybook/nextjs": "^7.0.11",
|
|
57
|
+
"@storybook/react": "^7.0.11",
|
|
58
|
+
"@storybook/testing-library": "^0.0.14-next.2",
|
|
51
59
|
"@types/jest": "^29.5.0",
|
|
52
60
|
"@types/react": "^18.0.27",
|
|
53
61
|
"@types/react-dom": "^18.0.10",
|
|
@@ -58,16 +66,19 @@
|
|
|
58
66
|
"eslint": "^8.38.0",
|
|
59
67
|
"eslint-plugin-import": "^2.27.5",
|
|
60
68
|
"eslint-plugin-react": "^7.24.0",
|
|
69
|
+
"eslint-plugin-storybook": "^0.6.12",
|
|
61
70
|
"fast-glob": "^3.2.7",
|
|
62
71
|
"fs-extra": "^11.1.1",
|
|
63
72
|
"jest": "^29.5.0",
|
|
64
73
|
"must": "^0.13.4",
|
|
65
74
|
"next": "^13.1.6",
|
|
75
|
+
"nodemon": "^2.0.22",
|
|
66
76
|
"prettier": "^2.8.7",
|
|
67
77
|
"react": "^18.2.0",
|
|
68
78
|
"react-dom": "^18.2.0",
|
|
69
79
|
"react-use": "^17.4.0",
|
|
70
80
|
"sass": "^1.35.2",
|
|
81
|
+
"storybook": "^7.0.11",
|
|
71
82
|
"ts-node": "^10.9.1",
|
|
72
83
|
"typedoc": "^0.23.28",
|
|
73
84
|
"typescript": "^5.0.4"
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { ThemeCSS } from "../../../theme";
|
|
2
|
+
|
|
3
|
+
import { dimensionsPxToRem, fontPxToRem, borderPxToRem } from "../../../theme.js";
|
|
4
|
+
|
|
5
|
+
const input = {
|
|
6
|
+
"height": dimensionsPxToRem(103),
|
|
7
|
+
"fontSize": fontPxToRem(25),
|
|
8
|
+
"color": "$text",
|
|
9
|
+
"border": "none",
|
|
10
|
+
"display": "block",
|
|
11
|
+
"width": "100%",
|
|
12
|
+
"background": "none",
|
|
13
|
+
"fontFamily": "inherit",
|
|
14
|
+
"padding": "1.2em 0",
|
|
15
|
+
"flex": 1,
|
|
16
|
+
|
|
17
|
+
"&::placeholder": {
|
|
18
|
+
color: "$sub",
|
|
19
|
+
},
|
|
20
|
+
|
|
21
|
+
"&:read-only, &:disabled": {
|
|
22
|
+
color: "inherit",
|
|
23
|
+
},
|
|
24
|
+
} satisfies ThemeCSS;
|
|
25
|
+
|
|
26
|
+
const wrapper = {
|
|
27
|
+
background: "white",
|
|
28
|
+
display: "inline-flex",
|
|
29
|
+
width: "100%",
|
|
30
|
+
borderRadius: "2px",
|
|
31
|
+
padding: `0 ${dimensionsPxToRem(36)}`,
|
|
32
|
+
border: `${borderPxToRem(1)} solid $border`,
|
|
33
|
+
alignItems: "center",
|
|
34
|
+
|
|
35
|
+
variants: {
|
|
36
|
+
disabled: {
|
|
37
|
+
true: {
|
|
38
|
+
background: "$inputDisabledBg",
|
|
39
|
+
color: "$inputDisabledText",
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
readOnly: {
|
|
43
|
+
true: {
|
|
44
|
+
color: "$inputDisabledText",
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
focused: {
|
|
48
|
+
true: {
|
|
49
|
+
borderColor: "$focusColor",
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
} satisfies ThemeCSS;
|
|
54
|
+
|
|
55
|
+
export {
|
|
56
|
+
input,
|
|
57
|
+
wrapper,
|
|
58
|
+
};
|
|
@@ -1,52 +1,3 @@
|
|
|
1
|
-
.input {
|
|
2
|
-
box-sizing: border-box;
|
|
3
|
-
height: calc(103px / var(--ratio-dimensions));
|
|
4
|
-
font-size: calc(34 / var(--ratio-font));
|
|
5
|
-
color: var(--text);
|
|
6
|
-
border: none;
|
|
7
|
-
display: block;
|
|
8
|
-
width: 100%;
|
|
9
|
-
background: none;
|
|
10
|
-
font-family: inherit;
|
|
11
|
-
padding: 1.2em 0;
|
|
12
|
-
|
|
13
|
-
&::placeholder {
|
|
14
|
-
color: var(--sub);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
.wrapper {
|
|
19
|
-
background: white;
|
|
20
|
-
display: inline-flex;
|
|
21
|
-
width: 100%;
|
|
22
|
-
box-sizing: border-box;
|
|
23
|
-
border-radius: 2px;
|
|
24
|
-
padding: 0 calc(36px / var(--ratio-dimensions));
|
|
25
|
-
border: calc(1px / var(--ratio-border)) solid var(--border);
|
|
26
|
-
align-items: center;
|
|
27
|
-
|
|
28
|
-
.input {
|
|
29
|
-
flex: 1;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
&.disabled {
|
|
33
|
-
background: var(--input-disabled-bg);
|
|
34
|
-
color: var(--input-disabled-text);
|
|
35
|
-
|
|
36
|
-
.input {
|
|
37
|
-
color: var(--input-disabled-text);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
&.readOnly {
|
|
42
|
-
color: var(--input-disabled-text);
|
|
43
|
-
|
|
44
|
-
.input {
|
|
45
|
-
color: var(--input-disabled-text);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
1
|
.textarea {
|
|
51
2
|
padding: 1.2em calc(36px / var(--ratio-dimensions));
|
|
52
3
|
height: unset;
|
|
@@ -54,16 +5,3 @@
|
|
|
54
5
|
min-height: calc(103px * 3 / var(--ratio-dimensions))
|
|
55
6
|
}
|
|
56
7
|
|
|
57
|
-
.prefix {
|
|
58
|
-
margin-right: calc(36px / var(--ratio-dimensions));
|
|
59
|
-
display: flex;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
.suffix {
|
|
63
|
-
margin-left: calc(36px / var(--ratio-dimensions));
|
|
64
|
-
display: flex;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
.wrapperFocused {
|
|
68
|
-
border-color: var(--focus-color);
|
|
69
|
-
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
import type { StoryObj, Meta } from "@storybook/react";
|
|
4
|
+
|
|
5
|
+
import { Icon, ICON } from "../../icons/Icon.js";
|
|
6
|
+
import { countries } from "../../../demo/components/form/countries.const";
|
|
7
|
+
|
|
8
|
+
import { Input } from "./Input.js";
|
|
9
|
+
|
|
10
|
+
const meta: Meta<typeof Input> = {
|
|
11
|
+
title: "Components/Form/Input",
|
|
12
|
+
component: Input,
|
|
13
|
+
tags: ["autodocs", "form"],
|
|
14
|
+
argTypes: {
|
|
15
|
+
prefix: {
|
|
16
|
+
type: "string",
|
|
17
|
+
},
|
|
18
|
+
suffix: {
|
|
19
|
+
type: "string",
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
type Story = StoryObj<typeof Input>;
|
|
25
|
+
|
|
26
|
+
const Primary: Story = {
|
|
27
|
+
args: {
|
|
28
|
+
placeholder: "Capacity",
|
|
29
|
+
prefix: <Icon name={ICON.battery} />,
|
|
30
|
+
suffix: "kWh",
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const handleSuggestionMatch = (s: string, picked: boolean) => {
|
|
35
|
+
alert("Suggestion " + (picked ? "picked" : "matched") + " : " + s);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const Mixed: Story = {
|
|
39
|
+
render: () => (
|
|
40
|
+
<>
|
|
41
|
+
<Input placeholder={"Capacity"} prefix={<Icon name={ICON.battery} />} suffix={"kWh"} />
|
|
42
|
+
<Input value={"William J. Welter"} />
|
|
43
|
+
<Input prefix={"Text prefix"} value={"Polly W. Wilson"} />
|
|
44
|
+
<Input prefix={"Disabled"} value={"Clayton J. Foster"} disabled={true} />
|
|
45
|
+
<Input prefix={"Read only"} value={"Norma J. Gomez"} readOnly={true} />
|
|
46
|
+
<Input
|
|
47
|
+
placeholder={"With suggestions, try country name"}
|
|
48
|
+
suggestions={countries}
|
|
49
|
+
onSuggestionMatch={handleSuggestionMatch}
|
|
50
|
+
/>
|
|
51
|
+
</>
|
|
52
|
+
),
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export {
|
|
56
|
+
Primary, Mixed,
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export default meta;
|
|
@@ -1,22 +1,24 @@
|
|
|
1
|
-
import { styled } from "../../../theme.js";
|
|
1
|
+
import { dimensionsPxToRem, styled } from "../../../theme.js";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
"boxSizing": "border-box",
|
|
5
|
-
"height": "calc(103px / var(--ratio-dimensions))",
|
|
6
|
-
"fontSize": "calc(34 / var(--ratio-font))",
|
|
7
|
-
"color": "var(--text)",
|
|
8
|
-
"border": "none",
|
|
9
|
-
"display": "block",
|
|
10
|
-
"width": "100%",
|
|
11
|
-
"background": "none",
|
|
12
|
-
"fontFamily": "inherit",
|
|
13
|
-
"padding": "1.2em 0",
|
|
3
|
+
import { input, wrapper } from "./Input.css.js";
|
|
14
4
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
5
|
+
const StyledInput = styled("input", input);
|
|
6
|
+
|
|
7
|
+
const StyledWrapper = styled("div", wrapper);
|
|
8
|
+
|
|
9
|
+
const StyledPrefix = styled("div", {
|
|
10
|
+
marginRight: dimensionsPxToRem(36),
|
|
11
|
+
display: "flex",
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
const StyledSuffix = styled("div", {
|
|
15
|
+
marginLeft: dimensionsPxToRem(36),
|
|
16
|
+
display: "flex",
|
|
18
17
|
});
|
|
19
18
|
|
|
20
19
|
export {
|
|
21
|
-
|
|
20
|
+
StyledInput,
|
|
21
|
+
StyledWrapper,
|
|
22
|
+
StyledPrefix,
|
|
23
|
+
StyledSuffix,
|
|
22
24
|
};
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import React, { useCallback, useId, useState } from "react";
|
|
2
2
|
|
|
3
|
-
import classnames from "classnames";
|
|
4
|
-
|
|
5
3
|
import type { ObjectValue, Value } from "../../../types/form";
|
|
6
4
|
|
|
7
5
|
import { Suggestions } from "../Suggestions.js";
|
|
8
6
|
|
|
9
7
|
import styles from "./Input.module.scss";
|
|
10
|
-
import {
|
|
8
|
+
import { StyledInput, StyledWrapper, StyledPrefix, StyledSuffix } from "./Input.styled";
|
|
11
9
|
|
|
12
10
|
interface CustomProps<T extends string> {
|
|
13
11
|
children?: never;
|
|
@@ -19,8 +17,10 @@ interface CustomProps<T extends string> {
|
|
|
19
17
|
|
|
20
18
|
type Props<T extends string> = Omit<React.InputHTMLAttributes<HTMLInputElement>, "prefix"> & CustomProps<T>;
|
|
21
19
|
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
/**
|
|
21
|
+
* Input component.
|
|
22
|
+
*/
|
|
23
|
+
const Input = <T extends string>({ // eslint-disable-line max-lines-per-function
|
|
24
24
|
className, children,
|
|
25
25
|
prefix, suffix,
|
|
26
26
|
onFocus, onBlur, onKeyDown, onChange,
|
|
@@ -69,14 +69,8 @@ const Input = <T extends string>({
|
|
|
69
69
|
onChange?.(e);
|
|
70
70
|
}, [suggestions]);
|
|
71
71
|
|
|
72
|
-
const
|
|
73
|
-
|
|
74
|
-
[styles.disabled]: props.disabled,
|
|
75
|
-
[styles.readOnly]: props.readOnly,
|
|
76
|
-
}, className);
|
|
77
|
-
|
|
78
|
-
const prefixElem = prefix ? <div className={styles.prefix}>{prefix}</div> : null;
|
|
79
|
-
const suffixElem = suffix ? <div className={styles.suffix}>{suffix}</div> : null;
|
|
72
|
+
const prefixElem = prefix ? <StyledPrefix>{prefix}</StyledPrefix> : null;
|
|
73
|
+
const suffixElem = suffix ? <StyledSuffix>{suffix}</StyledSuffix> : null;
|
|
80
74
|
|
|
81
75
|
const extraProps: { list?: string } = {};
|
|
82
76
|
if (suggestions) {
|
|
@@ -84,9 +78,14 @@ const Input = <T extends string>({
|
|
|
84
78
|
}
|
|
85
79
|
|
|
86
80
|
return (
|
|
87
|
-
<
|
|
81
|
+
<StyledWrapper
|
|
82
|
+
className={className}
|
|
83
|
+
focused={Boolean(focused)}
|
|
84
|
+
disabled={Boolean(props.disabled)}
|
|
85
|
+
readOnly={Boolean(props.readOnly)}
|
|
86
|
+
>
|
|
88
87
|
{prefixElem}
|
|
89
|
-
<
|
|
88
|
+
<StyledInput
|
|
90
89
|
{...props}
|
|
91
90
|
{...extraProps}
|
|
92
91
|
onChange={handleChange}
|
|
@@ -97,7 +96,7 @@ const Input = <T extends string>({
|
|
|
97
96
|
/>
|
|
98
97
|
<Suggestions id={suggestionsId} suggestions={suggestions} />
|
|
99
98
|
{suffixElem}
|
|
100
|
-
</
|
|
99
|
+
</StyledWrapper>
|
|
101
100
|
);
|
|
102
101
|
};
|
|
103
102
|
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { StoryObj, Meta } from "@storybook/react";
|
|
2
|
+
|
|
3
|
+
import { TextArea } from "./TextArea.js";
|
|
4
|
+
|
|
5
|
+
const meta: Meta = {
|
|
6
|
+
title: "Components/Form/TextArea",
|
|
7
|
+
component: TextArea,
|
|
8
|
+
tags: ["autodocs", "form"],
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
type Story = StoryObj<typeof TextArea>;
|
|
12
|
+
|
|
13
|
+
const Primary: Story = {
|
|
14
|
+
args: {},
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export {
|
|
18
|
+
Primary,
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export default meta;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { dimensionsPxToRem, styled } from "../../../theme.js";
|
|
2
|
+
import { input, wrapper } from "../input/Input.css";
|
|
3
|
+
import { miuiScrollbars } from "../../../scrollbars.css";
|
|
4
|
+
|
|
5
|
+
const StyledTextArea = styled("textarea", {
|
|
6
|
+
...miuiScrollbars,
|
|
7
|
+
...input,
|
|
8
|
+
...wrapper,
|
|
9
|
+
|
|
10
|
+
padding: `1.2em ${dimensionsPxToRem(36)}`,
|
|
11
|
+
height: "unset",
|
|
12
|
+
resize: "vertical",
|
|
13
|
+
minHeight: dimensionsPxToRem(103),
|
|
14
|
+
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export {
|
|
18
|
+
StyledTextArea,
|
|
19
|
+
};
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import React, { useCallback, useState } from "react";
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
import styles from "./input/Input.module.scss";
|
|
3
|
+
import { StyledTextArea } from "./TextArea.styled";
|
|
6
4
|
|
|
7
5
|
interface Props {
|
|
8
6
|
children?: never;
|
|
9
7
|
}
|
|
10
8
|
|
|
11
9
|
const TextArea: React.FC<React.TextareaHTMLAttributes<HTMLTextAreaElement> & Props> = ({
|
|
12
|
-
|
|
10
|
+
children,
|
|
13
11
|
onFocus, onBlur,
|
|
14
12
|
...props
|
|
15
13
|
}) => {
|
|
@@ -25,12 +23,15 @@ const TextArea: React.FC<React.TextareaHTMLAttributes<HTMLTextAreaElement> & Pro
|
|
|
25
23
|
onBlur?.(e);
|
|
26
24
|
}, [onBlur]);
|
|
27
25
|
|
|
28
|
-
const cls = classnames(styles.wrapper, {
|
|
29
|
-
[styles.wrapperFocused]: focused,
|
|
30
|
-
}, styles.input, styles.textarea, className);
|
|
31
|
-
|
|
32
26
|
return (
|
|
33
|
-
<
|
|
27
|
+
<StyledTextArea
|
|
28
|
+
{...props}
|
|
29
|
+
disabled={Boolean(props.disabled)}
|
|
30
|
+
readOnly={Boolean(props.readOnly)}
|
|
31
|
+
focused={focused}
|
|
32
|
+
onFocus={handleFocus}
|
|
33
|
+
onBlur={handleBlur}
|
|
34
|
+
/>
|
|
34
35
|
);
|
|
35
36
|
};
|
|
36
37
|
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
import type { StoryObj, Meta } from "@storybook/react";
|
|
4
|
+
|
|
5
|
+
import { CoveringLoader } from "./CoveringLoader.js";
|
|
6
|
+
|
|
7
|
+
const meta: Meta = {
|
|
8
|
+
title: "Components/UI/Loader/CoveringLoader",
|
|
9
|
+
component: CoveringLoader,
|
|
10
|
+
tags: ["autodocs", "ui"],
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
type Story = StoryObj<typeof CoveringLoader>;
|
|
14
|
+
|
|
15
|
+
const Primary: Story = {
|
|
16
|
+
args: {},
|
|
17
|
+
render: () => {
|
|
18
|
+
return (
|
|
19
|
+
<CoveringLoader show={true}>
|
|
20
|
+
<div style={{ background: "#f0f0f0" }}>
|
|
21
|
+
some contents<br />
|
|
22
|
+
some contents Lorem ipsum etc
|
|
23
|
+
Lorem ipsum dolor sit amet consectetur adipisicing elit. Quisquam, quibusdam.
|
|
24
|
+
some contents<br />
|
|
25
|
+
some contents<br />
|
|
26
|
+
some contents<br />
|
|
27
|
+
</div>
|
|
28
|
+
</CoveringLoader>
|
|
29
|
+
);
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export {
|
|
34
|
+
Primary,
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export default meta;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
import type { Loader } from "./Loader";
|
|
4
|
+
|
|
5
|
+
import { styled } from "../../../theme.js";
|
|
6
|
+
|
|
7
|
+
import { FullLoader } from "./FullLoader.js";
|
|
8
|
+
|
|
9
|
+
interface Props extends React.ComponentProps<typeof Loader> {
|
|
10
|
+
/**
|
|
11
|
+
* Contents to render underneath the loader
|
|
12
|
+
*/
|
|
13
|
+
children: React.ReactNode;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const Container = styled("div", {
|
|
17
|
+
position: "relative",
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
const TailSpin = styled("div", {
|
|
21
|
+
position: "absolute",
|
|
22
|
+
left: 0,
|
|
23
|
+
right: 0,
|
|
24
|
+
top: 0,
|
|
25
|
+
bottom: 0,
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
const Content = styled("div", {
|
|
29
|
+
opacity: 0.3,
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* A loader that renders in the middle of available space, but also covers the contents.
|
|
34
|
+
* Contents opacity is lowered.
|
|
35
|
+
*/
|
|
36
|
+
const CoveringLoader: React.FC<Props> = ({ show, children, ...props }) => {
|
|
37
|
+
if (!show) {
|
|
38
|
+
return <>{children}</>;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return (
|
|
42
|
+
<Container>
|
|
43
|
+
<TailSpin>
|
|
44
|
+
<FullLoader {...props} />
|
|
45
|
+
</TailSpin>
|
|
46
|
+
<Content>
|
|
47
|
+
{children}
|
|
48
|
+
</Content>
|
|
49
|
+
</Container>
|
|
50
|
+
);
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export { CoveringLoader };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
import type { StoryObj, Meta } from "@storybook/react";
|
|
4
|
+
|
|
5
|
+
import { FullLoader } from "./FullLoader.js";
|
|
6
|
+
|
|
7
|
+
const meta: Meta = {
|
|
8
|
+
title: "Components/UI/Loader/FullLoader",
|
|
9
|
+
component: FullLoader,
|
|
10
|
+
tags: ["autodocs", "ui"],
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
type Story = StoryObj<typeof FullLoader>;
|
|
14
|
+
|
|
15
|
+
const Primary: Story = {
|
|
16
|
+
args: {},
|
|
17
|
+
render: () => {
|
|
18
|
+
return (
|
|
19
|
+
<>
|
|
20
|
+
Container:
|
|
21
|
+
<div style={{ border: "1px solid black", width: 300, height: 300 }}>
|
|
22
|
+
<FullLoader />
|
|
23
|
+
</div>
|
|
24
|
+
</>
|
|
25
|
+
);
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export {
|
|
30
|
+
Primary,
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export default meta;
|
|
34
|
+
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
import { styled } from "../../../theme.js";
|
|
4
|
+
|
|
5
|
+
import { Loader } from "./Loader.js";
|
|
6
|
+
|
|
7
|
+
type Props = React.ComponentProps<typeof Loader>;
|
|
8
|
+
|
|
9
|
+
const Container = styled("div", {
|
|
10
|
+
height: "100%",
|
|
11
|
+
flex: 1,
|
|
12
|
+
display: "flex",
|
|
13
|
+
alignItems: "center",
|
|
14
|
+
justifyContent: "center",
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* A loader that renders in the middle of available space
|
|
19
|
+
*/
|
|
20
|
+
const FullLoader: React.FC<Props> = (props) => {
|
|
21
|
+
return <Container><Loader {...props} /></Container>;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export { FullLoader };
|