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/box.tsx
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Box, BoxProps, Paper } from "@mantine/core";
|
|
2
|
+
import { create_component } from "../modules/component";
|
|
3
|
+
import { spacingPropsDef } from "./propsDef";
|
|
4
|
+
import { HtmlHTMLAttributes, PropsWithChildren } from "react";
|
|
5
|
+
|
|
6
|
+
type Props = PropsWithChildren<BoxProps & HtmlHTMLAttributes<HTMLDivElement>>;
|
|
7
|
+
const Component = create_component({
|
|
8
|
+
name: "Box",
|
|
9
|
+
description: "The box UI element",
|
|
10
|
+
props: {
|
|
11
|
+
mount_animation: "fade",
|
|
12
|
+
children: (
|
|
13
|
+
<Paper m="sm" p="xs" withBorder opacity={0.5}>
|
|
14
|
+
Add box children here
|
|
15
|
+
</Paper>
|
|
16
|
+
),
|
|
17
|
+
} as Props,
|
|
18
|
+
propsDef: {
|
|
19
|
+
...spacingPropsDef,
|
|
20
|
+
},
|
|
21
|
+
render() {
|
|
22
|
+
delete this.props["mount_animation"];
|
|
23
|
+
const { children, ...other } = this.props;
|
|
24
|
+
return <Box {...other}>{children}</Box>;
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
export default Component;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Anchor, Breadcrumbs, BreadcrumbsProps } from "@mantine/core";
|
|
2
|
+
import { create_component } from "../modules/component";
|
|
3
|
+
import { spacingPropsDef } from "./propsDef";
|
|
4
|
+
|
|
5
|
+
type Props = BreadcrumbsProps;
|
|
6
|
+
const Component = create_component({
|
|
7
|
+
name: "Breadcrumbs",
|
|
8
|
+
description: "The breadcrumbs UI element",
|
|
9
|
+
props: {
|
|
10
|
+
separator: "/",
|
|
11
|
+
children: [
|
|
12
|
+
<Anchor key={0} href="#">
|
|
13
|
+
Home
|
|
14
|
+
</Anchor>,
|
|
15
|
+
<Anchor key={1} href="/about">
|
|
16
|
+
About
|
|
17
|
+
</Anchor>,
|
|
18
|
+
<Anchor key={2} href="/contact">
|
|
19
|
+
Contact
|
|
20
|
+
</Anchor>,
|
|
21
|
+
],
|
|
22
|
+
} as Props,
|
|
23
|
+
propsDef: {
|
|
24
|
+
separator: { type: "text", label: "Separator" },
|
|
25
|
+
...spacingPropsDef,
|
|
26
|
+
},
|
|
27
|
+
render() {
|
|
28
|
+
delete this.props["mount_animation"];
|
|
29
|
+
const { children, ...other } = this.props;
|
|
30
|
+
return <Breadcrumbs {...other}>{children}</Breadcrumbs>;
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
export default Component;
|
package/ui/burger.tsx
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Burger, BurgerProps } from "@mantine/core";
|
|
2
|
+
import { create_component } from "../modules/component";
|
|
3
|
+
import { spacingPropsDef } from "./propsDef";
|
|
4
|
+
|
|
5
|
+
type Props = BurgerProps;
|
|
6
|
+
const Component = create_component({
|
|
7
|
+
name: "Burger",
|
|
8
|
+
description: "The burger UI element",
|
|
9
|
+
props: {} as Props,
|
|
10
|
+
propsDef: {
|
|
11
|
+
opened: { type: "switch", label: "Opened" },
|
|
12
|
+
size: { type: "size", label: "Size" },
|
|
13
|
+
color: { type: "color", label: "Color" },
|
|
14
|
+
transitionDuration: { type: "number", label: "Duration" },
|
|
15
|
+
...spacingPropsDef,
|
|
16
|
+
},
|
|
17
|
+
render() {
|
|
18
|
+
delete this.props["mount_animation"];
|
|
19
|
+
const { children, ...other } = this.props;
|
|
20
|
+
return <Burger {...other}>{children}</Burger>;
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
export default Component;
|
package/ui/button.tsx
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { Button, ButtonProps } from "@mantine/core";
|
|
2
|
+
import { create_component } from "../modules/component";
|
|
3
|
+
import { CommonProps } from "./props";
|
|
4
|
+
import { spacingPropsDef } from "./propsDef";
|
|
5
|
+
import Text from "./text";
|
|
6
|
+
|
|
7
|
+
type Props = CommonProps &
|
|
8
|
+
ButtonProps & {
|
|
9
|
+
onClick?: (...args: any[]) => void;
|
|
10
|
+
component?: any;
|
|
11
|
+
href?: string;
|
|
12
|
+
};
|
|
13
|
+
const Component = create_component({
|
|
14
|
+
name: "Button",
|
|
15
|
+
description: "The button UI element",
|
|
16
|
+
props: {
|
|
17
|
+
children: <Text text="Button" />,
|
|
18
|
+
fullWidth: false,
|
|
19
|
+
} as Props,
|
|
20
|
+
propsDef: {
|
|
21
|
+
onClick: {
|
|
22
|
+
type: "action",
|
|
23
|
+
label: "On click",
|
|
24
|
+
},
|
|
25
|
+
color: {
|
|
26
|
+
type: "color",
|
|
27
|
+
label: "Background",
|
|
28
|
+
},
|
|
29
|
+
variant: {
|
|
30
|
+
label: "Variant",
|
|
31
|
+
type: "select",
|
|
32
|
+
options: [
|
|
33
|
+
{
|
|
34
|
+
label: "Default",
|
|
35
|
+
value: "default",
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
label: "Filled",
|
|
39
|
+
value: "filled",
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
label: "Light",
|
|
43
|
+
value: "light",
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
label: "Outline",
|
|
47
|
+
value: "outline",
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
label: "Subtle",
|
|
51
|
+
value: "subtle",
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
label: "Transparent",
|
|
55
|
+
value: "transparent",
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
label: "White",
|
|
59
|
+
value: "white",
|
|
60
|
+
},
|
|
61
|
+
],
|
|
62
|
+
},
|
|
63
|
+
size: {
|
|
64
|
+
type: "size",
|
|
65
|
+
label: "Size",
|
|
66
|
+
},
|
|
67
|
+
radius: {
|
|
68
|
+
type: "size",
|
|
69
|
+
label: "Radius",
|
|
70
|
+
},
|
|
71
|
+
fullWidth: {
|
|
72
|
+
type: "switch",
|
|
73
|
+
label: "Full width",
|
|
74
|
+
},
|
|
75
|
+
|
|
76
|
+
...spacingPropsDef,
|
|
77
|
+
},
|
|
78
|
+
render() {
|
|
79
|
+
delete this.props["mount_animation"];
|
|
80
|
+
const { children, ...other } = this.props;
|
|
81
|
+
// Cast to any to avoid fighting Mantine's complex polymorphic types
|
|
82
|
+
return <Button {...(other as any)}>{children}</Button>;
|
|
83
|
+
},
|
|
84
|
+
});
|
|
85
|
+
export default Component;
|
package/ui/card.tsx
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Card, CardProps } from "@mantine/core";
|
|
2
|
+
import { create_component } from "../modules/component";
|
|
3
|
+
import { colorPropsDef, spacingPropsDef } from "./propsDef";
|
|
4
|
+
|
|
5
|
+
type Props = CardProps;
|
|
6
|
+
const Component = create_component({
|
|
7
|
+
name: "Card",
|
|
8
|
+
description: "The card UI element",
|
|
9
|
+
props: {} as Props,
|
|
10
|
+
propsDef: {
|
|
11
|
+
withBorder: {
|
|
12
|
+
type: "switch",
|
|
13
|
+
label: "Border",
|
|
14
|
+
},
|
|
15
|
+
shadow: {
|
|
16
|
+
type: "size",
|
|
17
|
+
label: "Shadow",
|
|
18
|
+
},
|
|
19
|
+
...spacingPropsDef,
|
|
20
|
+
...colorPropsDef,
|
|
21
|
+
},
|
|
22
|
+
render() {
|
|
23
|
+
delete this.props["mount_animation"];
|
|
24
|
+
const { children, ...other } = this.props;
|
|
25
|
+
return <Card {...other}>{children}</Card>;
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
export default Component;
|
package/ui/center.tsx
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Center, CenterProps, Paper } from "@mantine/core";
|
|
2
|
+
import { create_component } from "../modules/component";
|
|
3
|
+
import { spacingPropsDef } from "./propsDef";
|
|
4
|
+
|
|
5
|
+
type Props = CenterProps;
|
|
6
|
+
const Component = create_component({
|
|
7
|
+
name: "Center",
|
|
8
|
+
description: "The center UI element",
|
|
9
|
+
props: {
|
|
10
|
+
children: (
|
|
11
|
+
<Paper m="sm" p="xs" withBorder opacity={0.5}>
|
|
12
|
+
Add center children here
|
|
13
|
+
</Paper>
|
|
14
|
+
),
|
|
15
|
+
} as Props,
|
|
16
|
+
propsDef: {
|
|
17
|
+
inline: { type: "switch", label: "Inline" },
|
|
18
|
+
...spacingPropsDef,
|
|
19
|
+
},
|
|
20
|
+
render() {
|
|
21
|
+
delete this.props["mount_animation"];
|
|
22
|
+
const { children, ...other } = this.props;
|
|
23
|
+
return <Center {...other}>{children}</Center>;
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
export default Component;
|
package/ui/checkbox.tsx
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Checkbox, CheckboxProps } from "@mantine/core";
|
|
2
|
+
import { create_component } from "../modules/component";
|
|
3
|
+
import { spacingPropsDef } from "./propsDef";
|
|
4
|
+
|
|
5
|
+
type Props = CheckboxProps;
|
|
6
|
+
const Component = create_component({
|
|
7
|
+
name: "Checkbox",
|
|
8
|
+
description: "The checkbox UI element",
|
|
9
|
+
props: {} as Props,
|
|
10
|
+
propsDef: {
|
|
11
|
+
label: { type: "text", label: "Label" },
|
|
12
|
+
description: { type: "text", label: "Description" },
|
|
13
|
+
error: { type: "text", label: "Error" },
|
|
14
|
+
disabled: { type: "switch", label: "Disabled" },
|
|
15
|
+
indeterminate: { type: "switch", label: "Indeterminate" },
|
|
16
|
+
size: { type: "size", label: "Size" },
|
|
17
|
+
color: { type: "color", label: "Color" },
|
|
18
|
+
radius: { type: "size", label: "Radius" },
|
|
19
|
+
labelPosition: {
|
|
20
|
+
type: "segmented",
|
|
21
|
+
options: [
|
|
22
|
+
{ label: "Left", value: "left" },
|
|
23
|
+
{ label: "Right", value: "right" },
|
|
24
|
+
],
|
|
25
|
+
label: "Label Position",
|
|
26
|
+
},
|
|
27
|
+
...spacingPropsDef,
|
|
28
|
+
},
|
|
29
|
+
render() {
|
|
30
|
+
delete this.props["mount_animation"];
|
|
31
|
+
const { ...other } = this.props;
|
|
32
|
+
return <Checkbox {...other} />;
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
export default Component;
|
package/ui/chip.tsx
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Chip, ChipProps, Text } from "@mantine/core";
|
|
2
|
+
import { create_component } from "../modules/component";
|
|
3
|
+
import { spacingPropsDef } from "./propsDef";
|
|
4
|
+
|
|
5
|
+
type Props = ChipProps;
|
|
6
|
+
const Component = create_component({
|
|
7
|
+
name: "Chip",
|
|
8
|
+
description: "The chip UI element",
|
|
9
|
+
props: {
|
|
10
|
+
children: <Text>Label</Text>,
|
|
11
|
+
} as Props,
|
|
12
|
+
propsDef: {
|
|
13
|
+
checked: { type: "switch", label: "Checked" },
|
|
14
|
+
defaultChecked: { type: "switch", label: "Default Checked" },
|
|
15
|
+
disabled: { type: "switch", label: "Disabled" },
|
|
16
|
+
size: { type: "size", label: "Size" },
|
|
17
|
+
color: { type: "color", label: "Color" },
|
|
18
|
+
variant: {
|
|
19
|
+
type: "select",
|
|
20
|
+
options: ["outline", "filled", "light"],
|
|
21
|
+
label: "Variant",
|
|
22
|
+
},
|
|
23
|
+
radius: { type: "size", label: "Radius" },
|
|
24
|
+
...spacingPropsDef,
|
|
25
|
+
},
|
|
26
|
+
render() {
|
|
27
|
+
delete this.props["mount_animation"];
|
|
28
|
+
const { children, ...other } = this.props;
|
|
29
|
+
return <Chip {...other}>{children}</Chip>;
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
export default Component;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { CloseButton, CloseButtonProps } from "@mantine/core";
|
|
2
|
+
import { create_component } from "../modules/component";
|
|
3
|
+
|
|
4
|
+
type Props = CloseButtonProps;
|
|
5
|
+
const Component = create_component({
|
|
6
|
+
name: "CloseButton",
|
|
7
|
+
description: "The closebutton UI element",
|
|
8
|
+
props: {} as Props,
|
|
9
|
+
render() {
|
|
10
|
+
delete this.props["mount_animation"];
|
|
11
|
+
const { children, ...other } = this.props;
|
|
12
|
+
return <CloseButton {...other}>{children}</CloseButton>;
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
export default Component;
|
package/ui/code.tsx
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { Code, CodeProps } from "@mantine/core";
|
|
2
|
+
import { BuiltinLanguage, codeToHtml, BuiltinTheme } from "shiki";
|
|
3
|
+
|
|
4
|
+
import { create_component } from "../modules/component";
|
|
5
|
+
import { spacingPropsDef } from "./propsDef";
|
|
6
|
+
|
|
7
|
+
type Props = CodeProps & {
|
|
8
|
+
code: string;
|
|
9
|
+
colorScheme?: "light" | "dark";
|
|
10
|
+
codeLang?: BuiltinLanguage;
|
|
11
|
+
themes?: {
|
|
12
|
+
dark: BuiltinTheme;
|
|
13
|
+
light: BuiltinTheme;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
const Component = create_component({
|
|
17
|
+
name: "Code",
|
|
18
|
+
description: "The code UI element",
|
|
19
|
+
state: {
|
|
20
|
+
code: "",
|
|
21
|
+
},
|
|
22
|
+
props: {
|
|
23
|
+
codeLang: "tsx",
|
|
24
|
+
themes: {
|
|
25
|
+
dark: "dark-plus",
|
|
26
|
+
light: "light-plus",
|
|
27
|
+
},
|
|
28
|
+
colorScheme: "light",
|
|
29
|
+
fz: "sm",
|
|
30
|
+
fw: 500,
|
|
31
|
+
code: "alert('Hello')",
|
|
32
|
+
} as Props,
|
|
33
|
+
propsDef: {
|
|
34
|
+
code: {
|
|
35
|
+
type: "text",
|
|
36
|
+
multiline: true,
|
|
37
|
+
label: "Code",
|
|
38
|
+
},
|
|
39
|
+
codeLang: {
|
|
40
|
+
type: "text",
|
|
41
|
+
label: "Language",
|
|
42
|
+
},
|
|
43
|
+
colorScheme: {
|
|
44
|
+
type: "segmented",
|
|
45
|
+
options: [
|
|
46
|
+
{ label: "Light", value: "light" },
|
|
47
|
+
{ label: "Dark", value: "dark" },
|
|
48
|
+
],
|
|
49
|
+
label: "Color Scheme",
|
|
50
|
+
},
|
|
51
|
+
block: {
|
|
52
|
+
type: "switch",
|
|
53
|
+
label: "Block",
|
|
54
|
+
},
|
|
55
|
+
...spacingPropsDef,
|
|
56
|
+
},
|
|
57
|
+
methods: {
|
|
58
|
+
async refreshCode() {
|
|
59
|
+
if (!this.props.code) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
try {
|
|
63
|
+
const code = await codeToHtml(this.props.code, {
|
|
64
|
+
lang: this.props.codeLang!,
|
|
65
|
+
themes: this.props.themes!,
|
|
66
|
+
defaultColor: this.props.colorScheme!,
|
|
67
|
+
});
|
|
68
|
+
this.state.code = code;
|
|
69
|
+
} catch (err) {
|
|
70
|
+
throw new Error(
|
|
71
|
+
`Error while converting code to html: ${(err as Error).message}`,
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
lifecycle: {
|
|
77
|
+
async onPropChange(propName) {
|
|
78
|
+
if (["code", "codeLang", "colorScheme"].includes(propName)) {
|
|
79
|
+
await this.methods.refreshCode();
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
async onMount() {
|
|
83
|
+
await this.methods.refreshCode();
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
render() {
|
|
87
|
+
delete this.props["mount_animation"];
|
|
88
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
89
|
+
const { code, codeLang, colorScheme, style = {}, ...other } = this.props;
|
|
90
|
+
return (
|
|
91
|
+
<Code
|
|
92
|
+
{...other}
|
|
93
|
+
dangerouslySetInnerHTML={{ __html: this.state.code }}
|
|
94
|
+
style={{
|
|
95
|
+
overflow: "auto",
|
|
96
|
+
display: "inline-flex",
|
|
97
|
+
...style,
|
|
98
|
+
// alignItems: "center",
|
|
99
|
+
}}
|
|
100
|
+
/>
|
|
101
|
+
);
|
|
102
|
+
},
|
|
103
|
+
});
|
|
104
|
+
export default Component;
|
package/ui/collapse.tsx
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Collapse, CollapseProps } from "@mantine/core";
|
|
2
|
+
import { create_component } from "../modules/component";
|
|
3
|
+
import { PropsWithChildren } from "react";
|
|
4
|
+
|
|
5
|
+
type Props = PropsWithChildren<CollapseProps>;
|
|
6
|
+
const Component = create_component({
|
|
7
|
+
name: "Collapse",
|
|
8
|
+
description: "The collapse UI element",
|
|
9
|
+
props: {} as Props,
|
|
10
|
+
render() {
|
|
11
|
+
delete this.props["mount_animation"];
|
|
12
|
+
const { children, ...other } = this.props;
|
|
13
|
+
return <Collapse {...other}>{children}</Collapse>;
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
export default Component;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { ColorInput, ColorInputProps } from "@mantine/core";
|
|
2
|
+
import { create_component } from "../modules/component";
|
|
3
|
+
import { spacingPropsDef } from "./propsDef";
|
|
4
|
+
|
|
5
|
+
type Props = ColorInputProps;
|
|
6
|
+
const Component = create_component({
|
|
7
|
+
name: "ColorInput",
|
|
8
|
+
description: "The colorinput UI element",
|
|
9
|
+
props: {} as Props,
|
|
10
|
+
propsDef: {
|
|
11
|
+
size: { type: "size", label: "Size" },
|
|
12
|
+
label: { type: "text", label: "Label" },
|
|
13
|
+
description: { type: "text", label: "Description" },
|
|
14
|
+
error: { type: "text", label: "Error" },
|
|
15
|
+
placeholder: { type: "text", label: "Placeholder" },
|
|
16
|
+
disabled: { type: "switch", label: "Disabled" },
|
|
17
|
+
radius: { type: "size", label: "Radius" },
|
|
18
|
+
withEyeDropper: { type: "switch", label: "With Eye Dropper" },
|
|
19
|
+
format: {
|
|
20
|
+
type: "select",
|
|
21
|
+
options: ["hex", "rgb", "rgba", "hsl", "hsla"],
|
|
22
|
+
label: "Format",
|
|
23
|
+
},
|
|
24
|
+
...spacingPropsDef,
|
|
25
|
+
},
|
|
26
|
+
render() {
|
|
27
|
+
delete this.props["mount_animation"];
|
|
28
|
+
const { children, ...other } = this.props;
|
|
29
|
+
return <ColorInput {...other} />;
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
export default Component;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ColorPicker, ColorPickerProps } from "@mantine/core";
|
|
2
|
+
import { create_component } from "../modules/component";
|
|
3
|
+
import { spacingPropsDef } from "./propsDef";
|
|
4
|
+
|
|
5
|
+
type Props = ColorPickerProps;
|
|
6
|
+
const Component = create_component({
|
|
7
|
+
name: "ColorPicker",
|
|
8
|
+
description: "The colorpicker UI element",
|
|
9
|
+
props: {} as Props,
|
|
10
|
+
propsDef: {
|
|
11
|
+
format: {
|
|
12
|
+
type: "select",
|
|
13
|
+
options: ["hex", "rgb", "rgba", "hsl", "hsla"],
|
|
14
|
+
label: "Format",
|
|
15
|
+
},
|
|
16
|
+
size: { type: "size", label: "Size" },
|
|
17
|
+
fullWidth: { type: "switch", label: "Full Width" },
|
|
18
|
+
...spacingPropsDef,
|
|
19
|
+
},
|
|
20
|
+
render() {
|
|
21
|
+
delete this.props["mount_animation"];
|
|
22
|
+
const { children, ...other } = this.props;
|
|
23
|
+
return <ColorPicker {...other}>{children}</ColorPicker>;
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
export default Component;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ColorSwatch, ColorSwatchProps } from "@mantine/core";
|
|
2
|
+
import { create_component } from "../modules/component";
|
|
3
|
+
|
|
4
|
+
type Props = ColorSwatchProps & {
|
|
5
|
+
onClick?: () => void;
|
|
6
|
+
};
|
|
7
|
+
const Component = create_component({
|
|
8
|
+
name: "ColorSwatch",
|
|
9
|
+
description: "The colorswatch UI element",
|
|
10
|
+
props: {} as Props,
|
|
11
|
+
render() {
|
|
12
|
+
delete this.props["mount_animation"];
|
|
13
|
+
const { children, ...other } = this.props;
|
|
14
|
+
return <ColorSwatch {...other}>{children}</ColorSwatch>;
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
export default Component;
|
package/ui/combobox.tsx
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { Combobox, ComboboxProps, TextInput, useCombobox } from "@mantine/core";
|
|
2
|
+
import { create_component } from "../modules/component";
|
|
3
|
+
|
|
4
|
+
type Props = ComboboxProps & {
|
|
5
|
+
options: string[];
|
|
6
|
+
label?: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
placeholder?: string;
|
|
9
|
+
};
|
|
10
|
+
const Component = create_component({
|
|
11
|
+
name: "Combobox",
|
|
12
|
+
description: "The combobox UI element",
|
|
13
|
+
props: {
|
|
14
|
+
placeholder: "Placeholder...",
|
|
15
|
+
options: [],
|
|
16
|
+
} as Props,
|
|
17
|
+
state: {
|
|
18
|
+
value: "",
|
|
19
|
+
},
|
|
20
|
+
computed: {
|
|
21
|
+
options() {
|
|
22
|
+
const shouldFilterOptions = !this.props.options.some(
|
|
23
|
+
(item) => item === this.state.value,
|
|
24
|
+
);
|
|
25
|
+
const filteredOptions = shouldFilterOptions
|
|
26
|
+
? this.props.options.filter((item) =>
|
|
27
|
+
item.toLowerCase().includes(this.state.value.toLowerCase().trim()),
|
|
28
|
+
)
|
|
29
|
+
: this.props.options;
|
|
30
|
+
|
|
31
|
+
const options = filteredOptions.map((item) => (
|
|
32
|
+
<Combobox.Option value={item} key={item}>
|
|
33
|
+
{item}
|
|
34
|
+
</Combobox.Option>
|
|
35
|
+
));
|
|
36
|
+
return options;
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
render() {
|
|
40
|
+
const combobox = useCombobox();
|
|
41
|
+
return (
|
|
42
|
+
<Combobox
|
|
43
|
+
onOptionSubmit={(optionValue) => {
|
|
44
|
+
this.state.value = optionValue;
|
|
45
|
+
combobox.closeDropdown();
|
|
46
|
+
}}
|
|
47
|
+
store={combobox}
|
|
48
|
+
>
|
|
49
|
+
<Combobox.Target>
|
|
50
|
+
<TextInput
|
|
51
|
+
label={this.props.label}
|
|
52
|
+
description={this.props.description}
|
|
53
|
+
placeholder={this.props.placeholder}
|
|
54
|
+
value={this.state.value}
|
|
55
|
+
onChange={(event) => {
|
|
56
|
+
this.state.value = event.currentTarget.value;
|
|
57
|
+
combobox.openDropdown();
|
|
58
|
+
combobox.updateSelectedOptionIndex();
|
|
59
|
+
}}
|
|
60
|
+
onClick={() => combobox.openDropdown()}
|
|
61
|
+
onFocus={() => combobox.openDropdown()}
|
|
62
|
+
onBlur={() => combobox.closeDropdown()}
|
|
63
|
+
/>
|
|
64
|
+
</Combobox.Target>
|
|
65
|
+
|
|
66
|
+
<Combobox.Dropdown>
|
|
67
|
+
<Combobox.Options>
|
|
68
|
+
{this.computed.options.length === 0 ? (
|
|
69
|
+
<Combobox.Empty>Nothing found</Combobox.Empty>
|
|
70
|
+
) : (
|
|
71
|
+
this.computed.options
|
|
72
|
+
)}
|
|
73
|
+
</Combobox.Options>
|
|
74
|
+
</Combobox.Dropdown>
|
|
75
|
+
</Combobox>
|
|
76
|
+
);
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
export default Component;
|
package/ui/container.tsx
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Container, ContainerProps, Paper } from "@mantine/core";
|
|
2
|
+
import { create_component } from "../modules/component";
|
|
3
|
+
import { spacingPropsDef } from "./propsDef";
|
|
4
|
+
|
|
5
|
+
type Props = ContainerProps;
|
|
6
|
+
const Component = create_component({
|
|
7
|
+
name: "Container",
|
|
8
|
+
description: "The container UI element",
|
|
9
|
+
props: {
|
|
10
|
+
children: (
|
|
11
|
+
<Paper m="sm" p="xs" withBorder opacity={0.5}>
|
|
12
|
+
Add container children here
|
|
13
|
+
</Paper>
|
|
14
|
+
),
|
|
15
|
+
} as Props,
|
|
16
|
+
propsDef: {
|
|
17
|
+
size: { type: "size", label: "Size" },
|
|
18
|
+
fluid: { type: "switch", label: "Fluid" },
|
|
19
|
+
...spacingPropsDef,
|
|
20
|
+
},
|
|
21
|
+
render() {
|
|
22
|
+
delete this.props["mount_animation"];
|
|
23
|
+
const { children, ...other } = this.props;
|
|
24
|
+
return <Container {...other}>{children}</Container>;
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
export default Component;
|
package/ui/dialog.tsx
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Dialog, DialogProps } from "@mantine/core";
|
|
2
|
+
import { create_component } from "../modules/component";
|
|
3
|
+
|
|
4
|
+
type Props = DialogProps;
|
|
5
|
+
const Component = create_component({
|
|
6
|
+
name: "Dialog",
|
|
7
|
+
description: "The dialog UI element",
|
|
8
|
+
props: {} as Props,
|
|
9
|
+
render() {
|
|
10
|
+
delete this.props["mount_animation"];
|
|
11
|
+
const { children, ...other } = this.props;
|
|
12
|
+
return <Dialog {...other}>{children}</Dialog>;
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
export default Component;
|