southpaw 0.2.7
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 +51 -0
- package/api/client.ts +83 -0
- package/api/helpers/fs.ts +98 -0
- package/api/helpers/stream.ts +6 -0
- package/api/index.ts +50 -0
- package/api/server.ts +566 -0
- package/constants/fonts.ts +1583 -0
- package/constants/icons.ts +2124 -0
- package/constants/langs.ts +2592 -0
- package/constants/ssr-loading.tsx +17 -0
- package/contexts/dev.tsx +124 -0
- package/hooks/useDebounceCb.ts +21 -0
- package/modules/app.tsx +102 -0
- package/modules/behaviors.ts +161 -0
- package/modules/component.tsx +483 -0
- package/modules/config/index.ts +8 -0
- package/modules/database.ts +25 -0
- package/modules/document.tsx +23 -0
- package/modules/error.tsx +16 -0
- package/modules/page/autozoom.tsx +92 -0
- package/modules/page/browser.tsx +166 -0
- package/modules/page/index.tsx +327 -0
- package/modules/page/insert-modal.tsx +225 -0
- package/modules/page/inspect/index.tsx +237 -0
- package/modules/page/inspect/wrapper.tsx +88 -0
- package/modules/page/knobs/action.tsx +58 -0
- package/modules/page/knobs/color.tsx +78 -0
- package/modules/page/knobs/helpers.ts +71 -0
- package/modules/page/knobs/icon.tsx +85 -0
- package/modules/page/knobs/linker.tsx +188 -0
- package/modules/page/knobs/list-json.tsx +149 -0
- package/modules/page/knobs/list-text.tsx +129 -0
- package/modules/page/knobs/number.tsx +84 -0
- package/modules/page/knobs/segmented.tsx +81 -0
- package/modules/page/knobs/select.tsx +89 -0
- package/modules/page/knobs/size.tsx +106 -0
- package/modules/page/knobs/switch.tsx +75 -0
- package/modules/page/knobs/text.tsx +93 -0
- package/modules/page/left-tabs.tsx +36 -0
- package/modules/page/right-tabs.tsx +31 -0
- package/modules/page/seo.tsx +69 -0
- package/modules/page/tree.tsx +860 -0
- package/modules/state.ts +787 -0
- package/modules/store.ts +37 -0
- package/modules/theme.ts +105 -0
- package/modules/translations.ts +15 -0
- package/package.json +68 -0
- package/scripts/bin.js +607 -0
- package/scripts/test.js +145 -0
- package/themes/base.tsx +8962 -0
- package/themes/index.ts +4 -0
- package/themes/m2.ts +39 -0
- package/themes/newspaper.ts +39 -0
- package/types/api.ts +57 -0
- package/types/fiber_node.ts +69 -0
- package/types/react_element.ts +14 -0
- package/ui/accordion.tsx +70 -0
- package/ui/actionicon.tsx +41 -0
- package/ui/affix.tsx +14 -0
- package/ui/alert.tsx +37 -0
- package/ui/anchor.tsx +52 -0
- package/ui/arrow.tsx +116 -0
- package/ui/aspectratio.tsx +21 -0
- package/ui/autocomplete.tsx +34 -0
- package/ui/avatar.tsx +36 -0
- package/ui/backgroundimage.tsx +16 -0
- package/ui/badge.tsx +28 -0
- package/ui/blockquote.tsx +15 -0
- package/ui/blocks/faq.tsx +145 -0
- package/ui/blocks/features.tsx +167 -0
- package/ui/blocks/footer.tsx +182 -0
- package/ui/blocks/herobanner.tsx +391 -0
- package/ui/blocks/index.ts +44 -0
- package/ui/blocks/leftnav.tsx +141 -0
- package/ui/blocks/pricing.tsx +210 -0
- package/ui/blocks/testimonials.tsx +149 -0
- package/ui/blocks/uidocs.tsx +1429 -0
- package/ui/box.tsx +27 -0
- package/ui/breadcrumbs.tsx +33 -0
- package/ui/burger.tsx +23 -0
- package/ui/button.tsx +85 -0
- package/ui/card.tsx +28 -0
- package/ui/center.tsx +26 -0
- package/ui/checkbox.tsx +35 -0
- package/ui/chip.tsx +32 -0
- package/ui/closebutton.tsx +15 -0
- package/ui/code.tsx +104 -0
- package/ui/collapse.tsx +16 -0
- package/ui/colorinput.tsx +32 -0
- package/ui/colorpicker.tsx +26 -0
- package/ui/colorswatch.tsx +17 -0
- package/ui/combobox.tsx +80 -0
- package/ui/container.tsx +27 -0
- package/ui/dialog.tsx +15 -0
- package/ui/divider.tsx +58 -0
- package/ui/drawer.tsx +28 -0
- package/ui/fieldset.tsx +15 -0
- package/ui/filebutton.tsx +23 -0
- package/ui/fileinput.tsx +36 -0
- package/ui/flex.tsx +139 -0
- package/ui/focustrap.tsx +15 -0
- package/ui/form.tsx +26 -0
- package/ui/grid.tsx +69 -0
- package/ui/highlight.tsx +15 -0
- package/ui/hoverable.tsx +66 -0
- package/ui/hovercard.tsx +45 -0
- package/ui/icon.tsx +76 -0
- package/ui/image.tsx +32 -0
- package/ui/index.ts +1355 -0
- package/ui/indicator.tsx +42 -0
- package/ui/infobox.tsx +200 -0
- package/ui/input.tsx +18 -0
- package/ui/inviewport.tsx +23 -0
- package/ui/jsoninput.tsx +35 -0
- package/ui/kbd.tsx +20 -0
- package/ui/list.tsx +33 -0
- package/ui/loader.tsx +26 -0
- package/ui/loadingoverlay.tsx +22 -0
- package/ui/mark.tsx +15 -0
- package/ui/menu.tsx +89 -0
- package/ui/modal.tsx +27 -0
- package/ui/multiselect.tsx +42 -0
- package/ui/nativeselect.tsx +17 -0
- package/ui/navlink.tsx +40 -0
- package/ui/notification.tsx +25 -0
- package/ui/numberformatter.tsx +15 -0
- package/ui/numberinput.tsx +37 -0
- package/ui/overlay.tsx +15 -0
- package/ui/pagination.tsx +21 -0
- package/ui/paper.tsx +33 -0
- package/ui/passwordinput.tsx +36 -0
- package/ui/pill.tsx +17 -0
- package/ui/pillsinput.tsx +37 -0
- package/ui/pininput.tsx +30 -0
- package/ui/popover.tsx +43 -0
- package/ui/portal.tsx +15 -0
- package/ui/progress.tsx +49 -0
- package/ui/props.ts +91 -0
- package/ui/propsDef.ts +38 -0
- package/ui/radio.tsx +30 -0
- package/ui/rating.tsx +25 -0
- package/ui/ringprogress.tsx +17 -0
- package/ui/scrollarea.tsx +27 -0
- package/ui/segmentedcontrol.tsx +38 -0
- package/ui/select.tsx +43 -0
- package/ui/simplegrid.tsx +23 -0
- package/ui/skeleton.tsx +15 -0
- package/ui/slider.tsx +31 -0
- package/ui/space.tsx +19 -0
- package/ui/spoiler.tsx +23 -0
- package/ui/stepper.tsx +63 -0
- package/ui/switch.tsx +29 -0
- package/ui/table.tsx +93 -0
- package/ui/tabs.tsx +80 -0
- package/ui/tagsinput.tsx +19 -0
- package/ui/terminal.tsx +44 -0
- package/ui/text.tsx +168 -0
- package/ui/textarea.tsx +36 -0
- package/ui/textinput.tsx +34 -0
- package/ui/timeline.tsx +30 -0
- package/ui/title.tsx +42 -0
- package/ui/tooltip.tsx +32 -0
- package/ui/transition.tsx +21 -0
- package/ui/tree.tsx +42 -0
- package/ui/typographystylesprovider.tsx +20 -0
- package/ui/unstyledbutton.tsx +18 -0
- package/ui/video.tsx +16 -0
- package/ui/visuallyhidden.tsx +15 -0
- package/utils/index.ts +76 -0
package/ui/divider.tsx
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { Divider, DividerProps } from "@mantine/core";
|
|
2
|
+
import { create_component } from "../modules/component";
|
|
3
|
+
import { spacingPropsDef, colorPropsDef } from "./propsDef";
|
|
4
|
+
|
|
5
|
+
type Props = DividerProps;
|
|
6
|
+
const Component = create_component({
|
|
7
|
+
name: "Divider",
|
|
8
|
+
description: "The divider UI element",
|
|
9
|
+
props: {
|
|
10
|
+
// children: "Divider label",
|
|
11
|
+
} as Props,
|
|
12
|
+
propsDef: {
|
|
13
|
+
size: {
|
|
14
|
+
type: "size",
|
|
15
|
+
label: "Size",
|
|
16
|
+
},
|
|
17
|
+
orientation: {
|
|
18
|
+
type: "select",
|
|
19
|
+
label: "Orientation",
|
|
20
|
+
options: [
|
|
21
|
+
{
|
|
22
|
+
label: "Horizontal",
|
|
23
|
+
value: "horizontal",
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
label: "Vertical",
|
|
27
|
+
value: "vertical",
|
|
28
|
+
},
|
|
29
|
+
],
|
|
30
|
+
},
|
|
31
|
+
labelPosition: {
|
|
32
|
+
type: "select",
|
|
33
|
+
label: "Label position",
|
|
34
|
+
options: [
|
|
35
|
+
{
|
|
36
|
+
label: "Left",
|
|
37
|
+
value: "left",
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
label: "Center",
|
|
41
|
+
value: "center",
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
label: "Right",
|
|
45
|
+
value: "right",
|
|
46
|
+
},
|
|
47
|
+
],
|
|
48
|
+
},
|
|
49
|
+
...spacingPropsDef,
|
|
50
|
+
...colorPropsDef,
|
|
51
|
+
},
|
|
52
|
+
render() {
|
|
53
|
+
delete this.props["mount_animation"];
|
|
54
|
+
const { children, ...other } = this.props;
|
|
55
|
+
return <Divider {...other} label={children} />;
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
export default Component;
|
package/ui/drawer.tsx
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Drawer, DrawerProps } from "@mantine/core";
|
|
2
|
+
import { create_component } from "../modules/component";
|
|
3
|
+
import { spacingPropsDef } from "./propsDef";
|
|
4
|
+
|
|
5
|
+
type Props = DrawerProps;
|
|
6
|
+
const Component = create_component({
|
|
7
|
+
name: "Drawer",
|
|
8
|
+
description: "The drawer UI element",
|
|
9
|
+
props: {} as Props,
|
|
10
|
+
propsDef: {
|
|
11
|
+
title: { type: "text", label: "Title" },
|
|
12
|
+
opened: { type: "switch", label: "Opened" },
|
|
13
|
+
position: {
|
|
14
|
+
type: "select",
|
|
15
|
+
options: ["left", "right", "top", "bottom"],
|
|
16
|
+
label: "Position",
|
|
17
|
+
},
|
|
18
|
+
size: { type: "size", label: "Size" },
|
|
19
|
+
padding: { type: "size", label: "Padding" },
|
|
20
|
+
...spacingPropsDef,
|
|
21
|
+
},
|
|
22
|
+
render() {
|
|
23
|
+
delete this.props["mount_animation"];
|
|
24
|
+
const { children, ...other } = this.props;
|
|
25
|
+
return <Drawer {...other}>{children}</Drawer>;
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
export default Component;
|
package/ui/fieldset.tsx
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Fieldset, FieldsetProps } from "@mantine/core";
|
|
2
|
+
import { create_component } from "../modules/component";
|
|
3
|
+
|
|
4
|
+
type Props = FieldsetProps;
|
|
5
|
+
const Component = create_component({
|
|
6
|
+
name: "Fieldset",
|
|
7
|
+
description: "The fieldset UI element",
|
|
8
|
+
props: {} as Props,
|
|
9
|
+
render() {
|
|
10
|
+
delete this.props["mount_animation"];
|
|
11
|
+
const { children, ...other } = this.props;
|
|
12
|
+
return <Fieldset {...other}>{children}</Fieldset>;
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
export default Component;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ButtonProps, FileButton, FileButtonProps, Text } from "@mantine/core";
|
|
2
|
+
import { create_component } from "../modules/component";
|
|
3
|
+
import { UI } from ".";
|
|
4
|
+
|
|
5
|
+
type Props = FileButtonProps & ButtonProps;
|
|
6
|
+
const Component = create_component({
|
|
7
|
+
name: "FileButton",
|
|
8
|
+
description: "The filebutton UI element",
|
|
9
|
+
props: {
|
|
10
|
+
color: "primary",
|
|
11
|
+
children: <Text>Upload file</Text>,
|
|
12
|
+
} as Props,
|
|
13
|
+
render() {
|
|
14
|
+
delete this.props["mount_animation"];
|
|
15
|
+
const { children, ...other } = this.props;
|
|
16
|
+
return (
|
|
17
|
+
<FileButton {...other}>
|
|
18
|
+
{(props) => <UI.button {...props}>{children}</UI.button>}
|
|
19
|
+
</FileButton>
|
|
20
|
+
);
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
export default Component;
|
package/ui/fileinput.tsx
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { FileInput, FileInputProps } from "@mantine/core";
|
|
2
|
+
import { create_component } from "../modules/component";
|
|
3
|
+
import { spacingPropsDef } from "./propsDef";
|
|
4
|
+
|
|
5
|
+
type Props = FileInputProps;
|
|
6
|
+
const Component = create_component({
|
|
7
|
+
name: "FileInput",
|
|
8
|
+
description: "The fileinput UI element",
|
|
9
|
+
props: {
|
|
10
|
+
placeholder: "Choose file",
|
|
11
|
+
} as Props,
|
|
12
|
+
propsDef: {
|
|
13
|
+
placeholder: { type: "text", label: "Placeholder" },
|
|
14
|
+
label: { type: "text", label: "Label" },
|
|
15
|
+
description: { type: "text", label: "Description" },
|
|
16
|
+
error: { type: "text", label: "Error" },
|
|
17
|
+
disabled: { type: "switch", label: "Disabled" },
|
|
18
|
+
size: { type: "size", label: "Size" },
|
|
19
|
+
radius: { type: "size", label: "Radius" },
|
|
20
|
+
variant: {
|
|
21
|
+
type: "select",
|
|
22
|
+
options: ["default", "filled", "unstyled"],
|
|
23
|
+
label: "Variant",
|
|
24
|
+
},
|
|
25
|
+
clearable: { type: "switch", label: "Clearable" },
|
|
26
|
+
multiple: { type: "switch", label: "Multiple" },
|
|
27
|
+
accept: { type: "text", label: "Accept" },
|
|
28
|
+
...spacingPropsDef,
|
|
29
|
+
},
|
|
30
|
+
render() {
|
|
31
|
+
delete this.props["mount_animation"];
|
|
32
|
+
const { children, ...other } = this.props;
|
|
33
|
+
return <FileInput {...other} />;
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
export default Component;
|
package/ui/flex.tsx
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { Flex, FlexProps, Paper } from "@mantine/core";
|
|
2
|
+
import { create_component } from "../modules/component";
|
|
3
|
+
import {
|
|
4
|
+
IconAlignBoxRightMiddle,
|
|
5
|
+
IconAlignBoxLeftMiddle,
|
|
6
|
+
IconAlignBoxCenterMiddle,
|
|
7
|
+
IconAlignBoxBottomCenter,
|
|
8
|
+
IconAlignBoxCenterTop,
|
|
9
|
+
IconAlignBoxCenterStretch,
|
|
10
|
+
} from "@tabler/icons-react";
|
|
11
|
+
import { spacingPropsDef, colorPropsDef } from "./propsDef";
|
|
12
|
+
import { CommonProps } from "./props";
|
|
13
|
+
|
|
14
|
+
type Props = CommonProps &
|
|
15
|
+
FlexProps & {
|
|
16
|
+
tag?: keyof HTMLElementTagNameMap;
|
|
17
|
+
};
|
|
18
|
+
const Component = create_component({
|
|
19
|
+
name: "Flex",
|
|
20
|
+
description: "The flex UI element",
|
|
21
|
+
props: {
|
|
22
|
+
mount_animation: "fade",
|
|
23
|
+
p: 0,
|
|
24
|
+
tag: "div",
|
|
25
|
+
direction: "row",
|
|
26
|
+
children: (
|
|
27
|
+
<Paper m="sm" p="xs" withBorder opacity={0.5}>
|
|
28
|
+
Add flex children here
|
|
29
|
+
</Paper>
|
|
30
|
+
),
|
|
31
|
+
} as Props,
|
|
32
|
+
propsDef: {
|
|
33
|
+
direction: {
|
|
34
|
+
label: "Direction",
|
|
35
|
+
type: "select",
|
|
36
|
+
options: [
|
|
37
|
+
{
|
|
38
|
+
label: "Column",
|
|
39
|
+
value: "column",
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
label: "Row",
|
|
43
|
+
value: "row",
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
},
|
|
47
|
+
p: {
|
|
48
|
+
label: "Padding",
|
|
49
|
+
type: "number",
|
|
50
|
+
},
|
|
51
|
+
gap: {
|
|
52
|
+
label: "Gap",
|
|
53
|
+
type: "number",
|
|
54
|
+
},
|
|
55
|
+
justify: {
|
|
56
|
+
label: "Justify content",
|
|
57
|
+
type: "segmented",
|
|
58
|
+
options: [
|
|
59
|
+
{
|
|
60
|
+
label: <IconAlignBoxLeftMiddle size={20} />,
|
|
61
|
+
value: "flex-start",
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
label: <IconAlignBoxCenterMiddle size={20} />,
|
|
65
|
+
value: "center",
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
label: <IconAlignBoxRightMiddle size={20} />,
|
|
69
|
+
value: "flex-end",
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
label: <IconAlignBoxCenterStretch size={20} />,
|
|
73
|
+
value: "space-around",
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
label: <IconAlignBoxCenterStretch size={20} />,
|
|
77
|
+
value: "space-between",
|
|
78
|
+
},
|
|
79
|
+
],
|
|
80
|
+
},
|
|
81
|
+
align: {
|
|
82
|
+
label: "Align items",
|
|
83
|
+
type: "segmented",
|
|
84
|
+
options: [
|
|
85
|
+
{
|
|
86
|
+
label: <IconAlignBoxCenterTop title="flex-start" size={20} />,
|
|
87
|
+
value: "flex-start",
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
label: <IconAlignBoxCenterMiddle title="center" size={20} />,
|
|
91
|
+
value: "center",
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
label: <IconAlignBoxBottomCenter title="flex-end" size={20} />,
|
|
95
|
+
value: "flex-end",
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
label: <IconAlignBoxCenterStretch title="space-around" size={20} />,
|
|
99
|
+
value: "space-around",
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
label: <IconAlignBoxCenterStretch title="space-between" size={20} />,
|
|
103
|
+
value: "space-between",
|
|
104
|
+
},
|
|
105
|
+
],
|
|
106
|
+
},
|
|
107
|
+
wrap: {
|
|
108
|
+
label: "Wrap",
|
|
109
|
+
type: "select",
|
|
110
|
+
options: [
|
|
111
|
+
{
|
|
112
|
+
label: "Wrap",
|
|
113
|
+
value: "wrap",
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
label: "Wrap reverse",
|
|
117
|
+
value: "wrap-reverse",
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
label: "Nowrap",
|
|
121
|
+
value: "nowrap",
|
|
122
|
+
},
|
|
123
|
+
],
|
|
124
|
+
},
|
|
125
|
+
...spacingPropsDef,
|
|
126
|
+
...colorPropsDef,
|
|
127
|
+
},
|
|
128
|
+
render() {
|
|
129
|
+
delete this.props["mount_animation"];
|
|
130
|
+
delete this.props["mount_animation"];
|
|
131
|
+
const { children, tag, ...other } = this.props;
|
|
132
|
+
return (
|
|
133
|
+
<Flex {...other} component={tag as any}>
|
|
134
|
+
{children}
|
|
135
|
+
</Flex>
|
|
136
|
+
);
|
|
137
|
+
},
|
|
138
|
+
});
|
|
139
|
+
export default Component;
|
package/ui/focustrap.tsx
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { FocusTrap, FocusTrapProps } from "@mantine/core";
|
|
2
|
+
import { create_component } from "../modules/component";
|
|
3
|
+
|
|
4
|
+
type Props = FocusTrapProps;
|
|
5
|
+
const Component = create_component({
|
|
6
|
+
name: "FocusTrap",
|
|
7
|
+
description: "The focustrap UI element",
|
|
8
|
+
props: {} as Props,
|
|
9
|
+
render() {
|
|
10
|
+
delete this.props["mount_animation"];
|
|
11
|
+
const { children, ...other } = this.props;
|
|
12
|
+
return <FocusTrap {...other}>{children}</FocusTrap>;
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
export default Component;
|
package/ui/form.tsx
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Box, BoxProps, Paper } from "@mantine/core";
|
|
2
|
+
import { create_component } from "../modules/component";
|
|
3
|
+
import { FormHTMLAttributes, PropsWithChildren } from "react";
|
|
4
|
+
|
|
5
|
+
type Props = PropsWithChildren<BoxProps> & FormHTMLAttributes<HTMLFormElement>;
|
|
6
|
+
const Component = create_component({
|
|
7
|
+
name: "Form",
|
|
8
|
+
description: "The form UI element",
|
|
9
|
+
props: {
|
|
10
|
+
children: (
|
|
11
|
+
<Paper m="sm" p="xs" withBorder opacity={0.5}>
|
|
12
|
+
Add form children here
|
|
13
|
+
</Paper>
|
|
14
|
+
),
|
|
15
|
+
} as Props,
|
|
16
|
+
render() {
|
|
17
|
+
delete this.props["mount_animation"];
|
|
18
|
+
const { children, ...other } = this.props;
|
|
19
|
+
return (
|
|
20
|
+
<Box component="form" {...other}>
|
|
21
|
+
{children}
|
|
22
|
+
</Box>
|
|
23
|
+
);
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
export default Component;
|
package/ui/grid.tsx
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { Grid, GridProps, GridColProps, Text } from "@mantine/core";
|
|
2
|
+
import { create_component } from "../modules/component";
|
|
3
|
+
import { spacingPropsDef } from "./propsDef";
|
|
4
|
+
|
|
5
|
+
type Props = Omit<GridProps, "children"> & {
|
|
6
|
+
children: Array<JSX.Element>;
|
|
7
|
+
cells: {
|
|
8
|
+
offset?: GridColProps["offset"];
|
|
9
|
+
order?: GridColProps["order"];
|
|
10
|
+
span: GridColProps["span"];
|
|
11
|
+
}[];
|
|
12
|
+
};
|
|
13
|
+
const Component = create_component({
|
|
14
|
+
name: "Grid",
|
|
15
|
+
description: "The grid UI element",
|
|
16
|
+
props: {
|
|
17
|
+
children: [
|
|
18
|
+
<Text key={0}>Grid cell 1</Text>,
|
|
19
|
+
<Text key={1}>Grid cell 2</Text>,
|
|
20
|
+
<Text key={2}>Grid cell 3</Text>,
|
|
21
|
+
<Text key={3}>Grid cell 4</Text>,
|
|
22
|
+
],
|
|
23
|
+
cells: [
|
|
24
|
+
{ offset: 0, order: 0, span: 6 },
|
|
25
|
+
{ offset: 0, order: 0, span: 6 },
|
|
26
|
+
{ offset: 0, order: 0, span: 6 },
|
|
27
|
+
{ offset: 0, order: 0, span: 6 },
|
|
28
|
+
],
|
|
29
|
+
} as Props,
|
|
30
|
+
propsDef: {
|
|
31
|
+
grow: { type: "switch", label: "Grow" },
|
|
32
|
+
gutter: { type: "size", label: "Gutter" },
|
|
33
|
+
columns: { type: "number", label: "Columns" },
|
|
34
|
+
align: {
|
|
35
|
+
type: "select",
|
|
36
|
+
options: ["stretch", "center", "flex-start", "flex-end"],
|
|
37
|
+
label: "Align",
|
|
38
|
+
},
|
|
39
|
+
justify: {
|
|
40
|
+
type: "select",
|
|
41
|
+
options: [
|
|
42
|
+
"space-between",
|
|
43
|
+
"space-around",
|
|
44
|
+
"center",
|
|
45
|
+
"flex-start",
|
|
46
|
+
"flex-end",
|
|
47
|
+
],
|
|
48
|
+
label: "Justify",
|
|
49
|
+
},
|
|
50
|
+
...spacingPropsDef,
|
|
51
|
+
},
|
|
52
|
+
render() {
|
|
53
|
+
delete this.props["mount_animation"];
|
|
54
|
+
const { children, cells, ...other } = this.props;
|
|
55
|
+
return (
|
|
56
|
+
<Grid {...other}>
|
|
57
|
+
{children.map((child, i) => {
|
|
58
|
+
const colProps = cells[i] || {};
|
|
59
|
+
return (
|
|
60
|
+
<Grid.Col key={i} {...colProps}>
|
|
61
|
+
{child}
|
|
62
|
+
</Grid.Col>
|
|
63
|
+
);
|
|
64
|
+
})}
|
|
65
|
+
</Grid>
|
|
66
|
+
);
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
export default Component;
|
package/ui/highlight.tsx
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Highlight, HighlightProps } from "@mantine/core";
|
|
2
|
+
import { create_component } from "../modules/component";
|
|
3
|
+
|
|
4
|
+
type Props = HighlightProps;
|
|
5
|
+
const Component = create_component({
|
|
6
|
+
name: "Highlight",
|
|
7
|
+
description: "The highlight UI element",
|
|
8
|
+
props: {} as Props,
|
|
9
|
+
render() {
|
|
10
|
+
delete this.props["mount_animation"];
|
|
11
|
+
const { children, ...other } = this.props;
|
|
12
|
+
return <Highlight {...other}>{children}</Highlight>;
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
export default Component;
|
package/ui/hoverable.tsx
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { BoxProps } from "@mantine/core";
|
|
2
|
+
import { create_component } from "../modules/component";
|
|
3
|
+
import {
|
|
4
|
+
cloneElement,
|
|
5
|
+
MouseEvent,
|
|
6
|
+
PropsWithChildren,
|
|
7
|
+
ReactElement,
|
|
8
|
+
} from "react";
|
|
9
|
+
|
|
10
|
+
type Props = PropsWithChildren<
|
|
11
|
+
BoxProps & {
|
|
12
|
+
inAnimation: {
|
|
13
|
+
keyframes: Keyframe[];
|
|
14
|
+
options: KeyframeAnimationOptions;
|
|
15
|
+
};
|
|
16
|
+
outAnimation: {
|
|
17
|
+
keyframes: Keyframe[];
|
|
18
|
+
options: KeyframeAnimationOptions;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
>;
|
|
22
|
+
const Component = create_component({
|
|
23
|
+
name: "Hoverable",
|
|
24
|
+
description: "The hoverable UI element",
|
|
25
|
+
props: {} as Props,
|
|
26
|
+
methods: {
|
|
27
|
+
onMouseEnter(event: MouseEvent<HTMLDivElement>) {
|
|
28
|
+
const el = event.currentTarget as HTMLDivElement;
|
|
29
|
+
this.methods.inAnim(el);
|
|
30
|
+
},
|
|
31
|
+
onMouseLeave(event: MouseEvent<HTMLDivElement>) {
|
|
32
|
+
const el = event.currentTarget as HTMLDivElement;
|
|
33
|
+
this.methods.outAnim(el);
|
|
34
|
+
},
|
|
35
|
+
inAnim(el: HTMLDivElement) {
|
|
36
|
+
el.animate(
|
|
37
|
+
this.props.inAnimation.keyframes,
|
|
38
|
+
this.props.inAnimation.options,
|
|
39
|
+
);
|
|
40
|
+
},
|
|
41
|
+
outAnim(el: HTMLDivElement) {
|
|
42
|
+
const animation = el.animate(
|
|
43
|
+
this.props.outAnimation.keyframes,
|
|
44
|
+
this.props.outAnimation.options,
|
|
45
|
+
);
|
|
46
|
+
animation.onfinish = () => {
|
|
47
|
+
animation.cancel();
|
|
48
|
+
};
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
render() {
|
|
52
|
+
delete this.props["mount_animation"];
|
|
53
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
54
|
+
const { children, inAnimation, outAnimation, ...other } = this.props;
|
|
55
|
+
const { onMouseEnter, onMouseLeave } = this.methods;
|
|
56
|
+
if (!children) {
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
return cloneElement(children as ReactElement, {
|
|
60
|
+
...other,
|
|
61
|
+
onMouseEnter,
|
|
62
|
+
onMouseLeave,
|
|
63
|
+
});
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
export default Component;
|
package/ui/hovercard.tsx
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Button, ButtonProps, HoverCard, HoverCardProps } from "@mantine/core";
|
|
2
|
+
import { create_component } from "../modules/component";
|
|
3
|
+
import { spacingPropsDef } from "./propsDef";
|
|
4
|
+
import { ReactNode } from "react";
|
|
5
|
+
|
|
6
|
+
type Props = HoverCardProps & {
|
|
7
|
+
content: ReactNode;
|
|
8
|
+
label: string;
|
|
9
|
+
buttonProps: ButtonProps;
|
|
10
|
+
};
|
|
11
|
+
const Component = create_component({
|
|
12
|
+
name: "HoverCard",
|
|
13
|
+
description: "The hovercard UI element",
|
|
14
|
+
props: {
|
|
15
|
+
buttonProps: {
|
|
16
|
+
color: "primary",
|
|
17
|
+
},
|
|
18
|
+
} as Props,
|
|
19
|
+
propsDef: {
|
|
20
|
+
width: { type: "number", label: "Width" },
|
|
21
|
+
shadow: { type: "size", label: "Shadow" },
|
|
22
|
+
openDelay: { type: "number", label: "Open Delay" },
|
|
23
|
+
closeDelay: { type: "number", label: "Close Delay" },
|
|
24
|
+
position: {
|
|
25
|
+
type: "select",
|
|
26
|
+
options: ["bottom", "top", "left", "right"],
|
|
27
|
+
label: "Position",
|
|
28
|
+
},
|
|
29
|
+
withArrow: { type: "switch", label: "With Arrow" },
|
|
30
|
+
...spacingPropsDef,
|
|
31
|
+
},
|
|
32
|
+
render() {
|
|
33
|
+
delete this.props["mount_animation"];
|
|
34
|
+
const { content, label, buttonProps, ...other } = this.props;
|
|
35
|
+
return (
|
|
36
|
+
<HoverCard {...other}>
|
|
37
|
+
<HoverCard.Target>
|
|
38
|
+
<Button {...buttonProps}>{label}</Button>
|
|
39
|
+
</HoverCard.Target>
|
|
40
|
+
<HoverCard.Dropdown>{content}</HoverCard.Dropdown>
|
|
41
|
+
</HoverCard>
|
|
42
|
+
);
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
export default Component;
|
package/ui/icon.tsx
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { create_component } from "../modules/component";
|
|
2
|
+
import { ICONS } from "../constants/icons";
|
|
3
|
+
import { Box, BoxProps } from "@mantine/core";
|
|
4
|
+
|
|
5
|
+
type Props = BoxProps & {
|
|
6
|
+
ariaLabel?: string;
|
|
7
|
+
fill?: boolean;
|
|
8
|
+
weight?: number;
|
|
9
|
+
opticalSize?: number;
|
|
10
|
+
icon: (typeof ICONS)[number];
|
|
11
|
+
};
|
|
12
|
+
const Component = create_component({
|
|
13
|
+
name: "Icon",
|
|
14
|
+
description: "The icon UI element",
|
|
15
|
+
props: {
|
|
16
|
+
fill: false,
|
|
17
|
+
weight: 500,
|
|
18
|
+
opticalSize: 46,
|
|
19
|
+
icon: "favorite",
|
|
20
|
+
fz: 20,
|
|
21
|
+
} as Props,
|
|
22
|
+
propsDef: {
|
|
23
|
+
icon: {
|
|
24
|
+
type: "icon",
|
|
25
|
+
label: "Icon",
|
|
26
|
+
},
|
|
27
|
+
fz: {
|
|
28
|
+
type: "number",
|
|
29
|
+
label: "Size",
|
|
30
|
+
},
|
|
31
|
+
fill: {
|
|
32
|
+
type: "switch",
|
|
33
|
+
label: "Fill",
|
|
34
|
+
},
|
|
35
|
+
weight: {
|
|
36
|
+
type: "number",
|
|
37
|
+
label: "Weight",
|
|
38
|
+
},
|
|
39
|
+
opticalSize: {
|
|
40
|
+
type: "number",
|
|
41
|
+
label: "Optical size",
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
lifecycle: {
|
|
45
|
+
onMount() {
|
|
46
|
+
const iconsEl = document.head.querySelector("#icons-stylesheet");
|
|
47
|
+
if (!iconsEl) {
|
|
48
|
+
const link = document.createElement("link");
|
|
49
|
+
link.rel = "stylesheet";
|
|
50
|
+
link.id = "icons-stylesheet";
|
|
51
|
+
link.href =
|
|
52
|
+
"https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200";
|
|
53
|
+
document.head.appendChild(link);
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
render() {
|
|
58
|
+
const { icon, ariaLabel, weight, fill, opticalSize, ...other } = this.props;
|
|
59
|
+
return (
|
|
60
|
+
<Box
|
|
61
|
+
{...other}
|
|
62
|
+
aria-label={ariaLabel}
|
|
63
|
+
className="ui-icon material-symbols-outlined"
|
|
64
|
+
style={{
|
|
65
|
+
userSelect: "none",
|
|
66
|
+
fontVariationSettings: `'FILL' ${Number(
|
|
67
|
+
fill,
|
|
68
|
+
)}, 'wght' ${weight}, 'GRAD' 0, 'opsz' ${opticalSize}`,
|
|
69
|
+
}}
|
|
70
|
+
>
|
|
71
|
+
{icon}
|
|
72
|
+
</Box>
|
|
73
|
+
);
|
|
74
|
+
},
|
|
75
|
+
});
|
|
76
|
+
export default Component;
|
package/ui/image.tsx
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Image, ImageProps } from "@mantine/core";
|
|
2
|
+
import { create_component } from "../modules/component";
|
|
3
|
+
import { spacingPropsDef } from "./propsDef";
|
|
4
|
+
|
|
5
|
+
type Props = ImageProps & {
|
|
6
|
+
alt: string;
|
|
7
|
+
};
|
|
8
|
+
const Component = create_component({
|
|
9
|
+
name: "Image",
|
|
10
|
+
description: "The image UI element",
|
|
11
|
+
props: {
|
|
12
|
+
src: "https://placehold.co/600x400",
|
|
13
|
+
} as Props,
|
|
14
|
+
propsDef: {
|
|
15
|
+
src: { type: "text", label: "Source" },
|
|
16
|
+
alt: { type: "text", label: "Alt Text" },
|
|
17
|
+
radius: { type: "size", label: "Radius" },
|
|
18
|
+
fit: {
|
|
19
|
+
type: "select",
|
|
20
|
+
options: ["contain", "cover", "fill", "none", "scale-down"],
|
|
21
|
+
label: "Fit",
|
|
22
|
+
},
|
|
23
|
+
fallbackSrc: { type: "text", label: "Fallback Source" },
|
|
24
|
+
...spacingPropsDef,
|
|
25
|
+
},
|
|
26
|
+
render() {
|
|
27
|
+
delete this.props["mount_animation"];
|
|
28
|
+
const { ...other } = this.props;
|
|
29
|
+
return <Image {...other} />;
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
export default Component;
|