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
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { NumberFormatter, NumberFormatterProps } from "@mantine/core";
|
|
2
|
+
import { create_component } from "../modules/component";
|
|
3
|
+
|
|
4
|
+
type Props = NumberFormatterProps;
|
|
5
|
+
const Component = create_component({
|
|
6
|
+
name: "NumberFormatter",
|
|
7
|
+
description: "The numberformatter UI element",
|
|
8
|
+
props: {} as Props,
|
|
9
|
+
render() {
|
|
10
|
+
delete this.props["mount_animation"];
|
|
11
|
+
const { children, ...other } = this.props;
|
|
12
|
+
return <NumberFormatter {...other}>{children}</NumberFormatter>;
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
export default Component;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { NumberInput, NumberInputProps } from "@mantine/core";
|
|
2
|
+
import { create_component } from "../modules/component";
|
|
3
|
+
import { spacingPropsDef } from "./propsDef";
|
|
4
|
+
|
|
5
|
+
type Props = NumberInputProps;
|
|
6
|
+
const Component = create_component({
|
|
7
|
+
name: "NumberInput",
|
|
8
|
+
description: "The numberinput UI element",
|
|
9
|
+
props: {
|
|
10
|
+
placeholder: "Placeholder...",
|
|
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
|
+
min: { type: "number", label: "Min" },
|
|
26
|
+
max: { type: "number", label: "Max" },
|
|
27
|
+
step: { type: "number", label: "Step" },
|
|
28
|
+
hideControls: { type: "switch", label: "Hide Controls" },
|
|
29
|
+
...spacingPropsDef,
|
|
30
|
+
},
|
|
31
|
+
render() {
|
|
32
|
+
delete this.props["mount_animation"];
|
|
33
|
+
const { children, ...other } = this.props;
|
|
34
|
+
return <NumberInput {...other} />;
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
export default Component;
|
package/ui/overlay.tsx
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Overlay, OverlayProps } from "@mantine/core";
|
|
2
|
+
import { create_component } from "../modules/component";
|
|
3
|
+
|
|
4
|
+
type Props = OverlayProps;
|
|
5
|
+
const Component = create_component({
|
|
6
|
+
name: "Overlay",
|
|
7
|
+
description: "The overlay UI element",
|
|
8
|
+
props: {} as Props,
|
|
9
|
+
render() {
|
|
10
|
+
delete this.props["mount_animation"];
|
|
11
|
+
const { children, ...other } = this.props;
|
|
12
|
+
return <Overlay {...other}>{children}</Overlay>;
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
export default Component;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Pagination, PaginationProps } from "@mantine/core";
|
|
2
|
+
import { create_component } from "../modules/component";
|
|
3
|
+
|
|
4
|
+
type Props = Partial<PaginationProps>;
|
|
5
|
+
const Component = create_component({
|
|
6
|
+
name: "Pagination",
|
|
7
|
+
description: "The pagination UI element",
|
|
8
|
+
props: {
|
|
9
|
+
total: 5,
|
|
10
|
+
} as Props,
|
|
11
|
+
render() {
|
|
12
|
+
delete this.props["mount_animation"];
|
|
13
|
+
const { children, total, ...other } = this.props;
|
|
14
|
+
return (
|
|
15
|
+
<Pagination total={total!} {...other}>
|
|
16
|
+
{children}
|
|
17
|
+
</Pagination>
|
|
18
|
+
);
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
export default Component;
|
package/ui/paper.tsx
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Paper, PaperProps } from "@mantine/core";
|
|
2
|
+
import { create_component } from "../modules/component";
|
|
3
|
+
import { spacingPropsDef } from "./propsDef";
|
|
4
|
+
import { PropsWithChildren } from "react";
|
|
5
|
+
|
|
6
|
+
type Props = PropsWithChildren<PaperProps>;
|
|
7
|
+
const Component = create_component({
|
|
8
|
+
name: "Paper",
|
|
9
|
+
description: "The paper UI element",
|
|
10
|
+
props: {} as Props,
|
|
11
|
+
propsDef: {
|
|
12
|
+
shadow: {
|
|
13
|
+
type: "select",
|
|
14
|
+
options: ["xs", "sm", "md", "lg", "xl"],
|
|
15
|
+
label: "Shadow",
|
|
16
|
+
},
|
|
17
|
+
radius: {
|
|
18
|
+
type: "size",
|
|
19
|
+
label: "Radius",
|
|
20
|
+
},
|
|
21
|
+
withBorder: {
|
|
22
|
+
type: "switch",
|
|
23
|
+
label: "With Border",
|
|
24
|
+
},
|
|
25
|
+
...spacingPropsDef,
|
|
26
|
+
},
|
|
27
|
+
render() {
|
|
28
|
+
delete this.props["mount_animation"];
|
|
29
|
+
const { children, ...other } = this.props;
|
|
30
|
+
return <Paper {...other}>{children}</Paper>;
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
export default Component;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { PasswordInput, PasswordInputProps } from "@mantine/core";
|
|
2
|
+
import { create_component } from "../modules/component";
|
|
3
|
+
import { spacingPropsDef } from "./propsDef";
|
|
4
|
+
|
|
5
|
+
type Props = PasswordInputProps;
|
|
6
|
+
const Component = create_component({
|
|
7
|
+
name: "PasswordInput",
|
|
8
|
+
description: "The passwordinput UI element",
|
|
9
|
+
props: {
|
|
10
|
+
placeholder: "Placeholder...",
|
|
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
|
+
visible: { type: "switch", label: "Visible" },
|
|
26
|
+
...spacingPropsDef,
|
|
27
|
+
},
|
|
28
|
+
render() {
|
|
29
|
+
delete this.props["mount_animation"];
|
|
30
|
+
const { children, ...other } = this.props;
|
|
31
|
+
return (
|
|
32
|
+
<PasswordInput miw={150} {...other} />
|
|
33
|
+
);
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
export default Component;
|
package/ui/pill.tsx
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Pill, PillProps, Text } from "@mantine/core";
|
|
2
|
+
import { create_component } from "../modules/component";
|
|
3
|
+
|
|
4
|
+
type Props = PillProps;
|
|
5
|
+
const Component = create_component({
|
|
6
|
+
name: "Pill",
|
|
7
|
+
description: "The pill UI element",
|
|
8
|
+
props: {
|
|
9
|
+
children: <Text>Pill</Text>,
|
|
10
|
+
} as Props,
|
|
11
|
+
render() {
|
|
12
|
+
delete this.props["mount_animation"];
|
|
13
|
+
const { children, ...other } = this.props;
|
|
14
|
+
return <Pill {...other}>{children}</Pill>;
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
export default Component;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Pill,
|
|
3
|
+
PillsInput,
|
|
4
|
+
PillsInputFieldProps,
|
|
5
|
+
PillsInputProps,
|
|
6
|
+
} from "@mantine/core";
|
|
7
|
+
import { create_component } from "../modules/component";
|
|
8
|
+
|
|
9
|
+
type Props = Omit<PillsInputProps, "children" | "placeholder"> & {
|
|
10
|
+
value: string[];
|
|
11
|
+
inputProps: PillsInputFieldProps;
|
|
12
|
+
};
|
|
13
|
+
const Component = create_component({
|
|
14
|
+
name: "PillsInput",
|
|
15
|
+
description: "The pillsinput UI element",
|
|
16
|
+
props: {
|
|
17
|
+
value: [],
|
|
18
|
+
inputProps: {
|
|
19
|
+
placeholder: "Add a pill",
|
|
20
|
+
},
|
|
21
|
+
} as Props,
|
|
22
|
+
render() {
|
|
23
|
+
delete this.props["mount_animation"];
|
|
24
|
+
const { inputProps, value, ...other } = this.props;
|
|
25
|
+
return (
|
|
26
|
+
<PillsInput maw="100%" {...other}>
|
|
27
|
+
<Pill.Group>
|
|
28
|
+
{value.map((v, i) => {
|
|
29
|
+
return <Pill key={i}>{v}</Pill>;
|
|
30
|
+
})}
|
|
31
|
+
<PillsInput.Field {...inputProps} />
|
|
32
|
+
</Pill.Group>
|
|
33
|
+
</PillsInput>
|
|
34
|
+
);
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
export default Component;
|
package/ui/pininput.tsx
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { PinInput, PinInputProps } from "@mantine/core";
|
|
2
|
+
import { create_component } from "../modules/component";
|
|
3
|
+
import { spacingPropsDef } from "./propsDef";
|
|
4
|
+
|
|
5
|
+
type Props = PinInputProps;
|
|
6
|
+
const Component = create_component({
|
|
7
|
+
name: "PinInput",
|
|
8
|
+
description: "The pininput UI element",
|
|
9
|
+
props: {} as Props,
|
|
10
|
+
propsDef: {
|
|
11
|
+
size: { type: "size", label: "Size" },
|
|
12
|
+
radius: { type: "size", label: "Radius" },
|
|
13
|
+
length: { type: "number", label: "Length" },
|
|
14
|
+
disabled: { type: "switch", label: "Disabled" },
|
|
15
|
+
error: { type: "switch", label: "Error" },
|
|
16
|
+
type: {
|
|
17
|
+
type: "select",
|
|
18
|
+
options: ["alphanumeric", "number", "regexp"],
|
|
19
|
+
label: "Type",
|
|
20
|
+
},
|
|
21
|
+
mask: { type: "switch", label: "Mask" },
|
|
22
|
+
...spacingPropsDef,
|
|
23
|
+
},
|
|
24
|
+
render() {
|
|
25
|
+
delete this.props["mount_animation"];
|
|
26
|
+
const { children, ...other } = this.props;
|
|
27
|
+
return <PinInput {...other} />;
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
export default Component;
|
package/ui/popover.tsx
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Button, ButtonProps, Popover, PopoverProps } from "@mantine/core";
|
|
2
|
+
import { create_component } from "../modules/component";
|
|
3
|
+
import { spacingPropsDef } from "./propsDef";
|
|
4
|
+
|
|
5
|
+
type Props = PopoverProps & {
|
|
6
|
+
label: string;
|
|
7
|
+
buttonProps: ButtonProps;
|
|
8
|
+
};
|
|
9
|
+
const Component = create_component({
|
|
10
|
+
name: "Popover",
|
|
11
|
+
description: "The popover UI element",
|
|
12
|
+
props: {
|
|
13
|
+
label: "",
|
|
14
|
+
buttonProps: {
|
|
15
|
+
color: "primary",
|
|
16
|
+
},
|
|
17
|
+
} as Props,
|
|
18
|
+
propsDef: {
|
|
19
|
+
opened: { type: "switch", label: "Opened" },
|
|
20
|
+
width: { type: "number", label: "Width" },
|
|
21
|
+
position: {
|
|
22
|
+
type: "select",
|
|
23
|
+
options: ["bottom", "top", "left", "right"],
|
|
24
|
+
label: "Position",
|
|
25
|
+
},
|
|
26
|
+
withArrow: { type: "switch", label: "With Arrow" },
|
|
27
|
+
shadow: { type: "size", label: "Shadow" },
|
|
28
|
+
...spacingPropsDef,
|
|
29
|
+
},
|
|
30
|
+
render() {
|
|
31
|
+
delete this.props["mount_animation"];
|
|
32
|
+
const { children, label, buttonProps, ...other } = this.props;
|
|
33
|
+
return (
|
|
34
|
+
<Popover {...other}>
|
|
35
|
+
<Popover.Target>
|
|
36
|
+
<Button {...buttonProps}>{label}</Button>
|
|
37
|
+
</Popover.Target>
|
|
38
|
+
<Popover.Dropdown>{children}</Popover.Dropdown>
|
|
39
|
+
</Popover>
|
|
40
|
+
);
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
export default Component;
|
package/ui/portal.tsx
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Portal, PortalProps } from "@mantine/core";
|
|
2
|
+
import { create_component } from "../modules/component";
|
|
3
|
+
|
|
4
|
+
type Props = PortalProps;
|
|
5
|
+
const Component = create_component({
|
|
6
|
+
name: "Portal",
|
|
7
|
+
description: "The portal UI element",
|
|
8
|
+
props: {} as Props,
|
|
9
|
+
render() {
|
|
10
|
+
delete this.props["mount_animation"];
|
|
11
|
+
const { children, ...other } = this.props;
|
|
12
|
+
return <Portal {...other}>{children}</Portal>;
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
export default Component;
|
package/ui/progress.tsx
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Progress,
|
|
3
|
+
ProgressProps,
|
|
4
|
+
ProgressRootProps,
|
|
5
|
+
ProgressSectionProps,
|
|
6
|
+
} from "@mantine/core";
|
|
7
|
+
import { create_component } from "../modules/component";
|
|
8
|
+
import { spacingPropsDef, colorPropsDef } from "./propsDef";
|
|
9
|
+
|
|
10
|
+
type Props = ProgressProps &
|
|
11
|
+
ProgressRootProps & {
|
|
12
|
+
sections?: ({ label: string } & ProgressSectionProps)[];
|
|
13
|
+
};
|
|
14
|
+
const Component = create_component({
|
|
15
|
+
name: "Progress",
|
|
16
|
+
description: "The progress UI element",
|
|
17
|
+
props: {
|
|
18
|
+
value: 0,
|
|
19
|
+
sections: [],
|
|
20
|
+
} as Props,
|
|
21
|
+
propsDef: {
|
|
22
|
+
value: { type: "number", label: "Value" },
|
|
23
|
+
striped: { type: "switch", label: "Striped" },
|
|
24
|
+
animated: { type: "switch", label: "Animated" },
|
|
25
|
+
size: { type: "size", label: "Size" },
|
|
26
|
+
radius: { type: "size", label: "Radius" },
|
|
27
|
+
...spacingPropsDef,
|
|
28
|
+
...colorPropsDef,
|
|
29
|
+
},
|
|
30
|
+
render() {
|
|
31
|
+
delete this.props["mount_animation"];
|
|
32
|
+
const { children, sections, ...other } = this.props;
|
|
33
|
+
if (Array.isArray(sections) && sections.length) {
|
|
34
|
+
return (
|
|
35
|
+
<Progress.Root {...(other as ProgressRootProps)}>
|
|
36
|
+
{sections.map((section, i) => {
|
|
37
|
+
return (
|
|
38
|
+
<Progress.Section key={i} {...section}>
|
|
39
|
+
<Progress.Label>{section.label}</Progress.Label>
|
|
40
|
+
</Progress.Section>
|
|
41
|
+
);
|
|
42
|
+
})}
|
|
43
|
+
</Progress.Root>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
return <Progress {...(other as ProgressProps)} />;
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
export default Component;
|
package/ui/props.ts
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
type ExtendedProps<Props = {}, OverrideProps = {}> = OverrideProps &
|
|
2
|
+
Omit<Props, keyof OverrideProps>;
|
|
3
|
+
type ElementType =
|
|
4
|
+
| keyof JSX.IntrinsicElements
|
|
5
|
+
| React.JSXElementConstructor<any>;
|
|
6
|
+
type PropsOf<C extends ElementType> = JSX.LibraryManagedAttributes<
|
|
7
|
+
C,
|
|
8
|
+
React.ComponentPropsWithoutRef<C>
|
|
9
|
+
>;
|
|
10
|
+
type ComponentProp<C> = {
|
|
11
|
+
component?: C;
|
|
12
|
+
};
|
|
13
|
+
type InheritedProps<C extends ElementType, Props = {}> = ExtendedProps<
|
|
14
|
+
PropsOf<C>,
|
|
15
|
+
Props
|
|
16
|
+
>;
|
|
17
|
+
export type PolymorphicRef<C> = C extends React.ElementType
|
|
18
|
+
? React.ComponentPropsWithRef<C>["ref"]
|
|
19
|
+
: never;
|
|
20
|
+
export type PolymorphicComponentProps<
|
|
21
|
+
C,
|
|
22
|
+
Props = {},
|
|
23
|
+
> = C extends React.ElementType
|
|
24
|
+
? InheritedProps<C, Props & ComponentProp<C>> & {
|
|
25
|
+
ref?: PolymorphicRef<C>;
|
|
26
|
+
renderRoot?: (props: any) => any;
|
|
27
|
+
}
|
|
28
|
+
: Props & {
|
|
29
|
+
component: React.ElementType;
|
|
30
|
+
renderRoot?: (props: Record<string, any>) => any;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export const MOUNT_ANIMATIONS = {
|
|
34
|
+
fade: {
|
|
35
|
+
keyframes: {
|
|
36
|
+
opacity: [0, 1],
|
|
37
|
+
},
|
|
38
|
+
options: {
|
|
39
|
+
easing: "ease-out",
|
|
40
|
+
duration: 400,
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
fadeRight: {
|
|
44
|
+
keyframes: {
|
|
45
|
+
opacity: [0, 1],
|
|
46
|
+
transform: ["translateX(-50%)", "translateX(0%)"],
|
|
47
|
+
},
|
|
48
|
+
options: {
|
|
49
|
+
easing: "ease-out",
|
|
50
|
+
duration: 400,
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
fadeLeft: {
|
|
54
|
+
keyframes: {
|
|
55
|
+
opacity: [0, 1],
|
|
56
|
+
transform: ["translateX(50%)", "translateX(0%)"],
|
|
57
|
+
},
|
|
58
|
+
options: {
|
|
59
|
+
easing: "ease-out",
|
|
60
|
+
duration: 400,
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
fadeUp: {
|
|
64
|
+
keyframes: {
|
|
65
|
+
opacity: [0, 1],
|
|
66
|
+
transform: ["translateY(-50%)", "translateY(0%)"],
|
|
67
|
+
},
|
|
68
|
+
options: {
|
|
69
|
+
easing: "ease-out",
|
|
70
|
+
duration: 400,
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
fadeDown: {
|
|
74
|
+
keyframes: {
|
|
75
|
+
opacity: [0, 1],
|
|
76
|
+
transform: ["translateY(50%)", "translateY(0%)"],
|
|
77
|
+
},
|
|
78
|
+
options: {
|
|
79
|
+
easing: "ease-out",
|
|
80
|
+
duration: 400,
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
} as const;
|
|
84
|
+
export type CommonProps = {
|
|
85
|
+
mount_animation?:
|
|
86
|
+
| keyof typeof MOUNT_ANIMATIONS
|
|
87
|
+
| {
|
|
88
|
+
keyframes: Keyframe[];
|
|
89
|
+
options?: KeyframeAnimationOptions;
|
|
90
|
+
};
|
|
91
|
+
};
|
package/ui/propsDef.ts
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { PropsDef } from "../modules/component";
|
|
2
|
+
|
|
3
|
+
export const colorPropsDef: PropsDef = {
|
|
4
|
+
bg: {
|
|
5
|
+
type: "color",
|
|
6
|
+
label: "Background",
|
|
7
|
+
},
|
|
8
|
+
c: {
|
|
9
|
+
type: "color",
|
|
10
|
+
label: "Color",
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
export const spacingPropsDef: PropsDef = {
|
|
14
|
+
w: {
|
|
15
|
+
type: "number",
|
|
16
|
+
label: "Width",
|
|
17
|
+
},
|
|
18
|
+
h: {
|
|
19
|
+
type: "number",
|
|
20
|
+
label: "Height",
|
|
21
|
+
},
|
|
22
|
+
py: {
|
|
23
|
+
type: "number",
|
|
24
|
+
label: "Vertical padding",
|
|
25
|
+
},
|
|
26
|
+
px: {
|
|
27
|
+
type: "number",
|
|
28
|
+
label: "Horizontal padding",
|
|
29
|
+
},
|
|
30
|
+
my: {
|
|
31
|
+
type: "number",
|
|
32
|
+
label: "Vertical margin",
|
|
33
|
+
},
|
|
34
|
+
mx: {
|
|
35
|
+
type: "number",
|
|
36
|
+
label: "Horizontal margin",
|
|
37
|
+
},
|
|
38
|
+
};
|
package/ui/radio.tsx
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Radio, RadioProps } from "@mantine/core";
|
|
2
|
+
import { create_component } from "../modules/component";
|
|
3
|
+
import { spacingPropsDef } from "./propsDef";
|
|
4
|
+
|
|
5
|
+
type Props = RadioProps;
|
|
6
|
+
const Component = create_component({
|
|
7
|
+
name: "Radio",
|
|
8
|
+
description: "The radio 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
|
+
size: { type: "size", label: "Size" },
|
|
16
|
+
color: { type: "color", label: "Color" },
|
|
17
|
+
labelPosition: {
|
|
18
|
+
type: "select",
|
|
19
|
+
options: ["left", "right"],
|
|
20
|
+
label: "Label Position",
|
|
21
|
+
},
|
|
22
|
+
...spacingPropsDef,
|
|
23
|
+
},
|
|
24
|
+
render() {
|
|
25
|
+
delete this.props["mount_animation"];
|
|
26
|
+
const { ...other } = this.props;
|
|
27
|
+
return <Radio {...other} />;
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
export default Component;
|
package/ui/rating.tsx
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Rating, RatingProps } from "@mantine/core";
|
|
2
|
+
import { create_component } from "../modules/component";
|
|
3
|
+
import { spacingPropsDef } from "./propsDef";
|
|
4
|
+
|
|
5
|
+
type Props = RatingProps;
|
|
6
|
+
const Component = create_component({
|
|
7
|
+
name: "Rating",
|
|
8
|
+
description: "The rating UI element",
|
|
9
|
+
props: {} as Props,
|
|
10
|
+
propsDef: {
|
|
11
|
+
size: { type: "size", label: "Size" },
|
|
12
|
+
color: { type: "color", label: "Color" },
|
|
13
|
+
count: { type: "number", label: "Count" },
|
|
14
|
+
fractions: { type: "number", label: "Fractions" },
|
|
15
|
+
readOnly: { type: "switch", label: "Read Only" },
|
|
16
|
+
highlightSelectedOnly: { type: "switch", label: "Highlight Selected Only" },
|
|
17
|
+
...spacingPropsDef,
|
|
18
|
+
},
|
|
19
|
+
render() {
|
|
20
|
+
delete this.props["mount_animation"];
|
|
21
|
+
const { children, ...other } = this.props;
|
|
22
|
+
return <Rating {...other}>{children}</Rating>;
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
export default Component;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { RingProgress, RingProgressProps } from "@mantine/core";
|
|
2
|
+
import { create_component } from "../modules/component";
|
|
3
|
+
|
|
4
|
+
type Props = RingProgressProps;
|
|
5
|
+
const Component = create_component({
|
|
6
|
+
name: "RingProgress",
|
|
7
|
+
description: "The ringprogress UI element",
|
|
8
|
+
props: {
|
|
9
|
+
sections: [],
|
|
10
|
+
} as Props,
|
|
11
|
+
render() {
|
|
12
|
+
delete this.props["mount_animation"];
|
|
13
|
+
const { children, ...other } = this.props;
|
|
14
|
+
return <RingProgress {...other}>{children}</RingProgress>;
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
export default Component;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ScrollArea, ScrollAreaProps } from "@mantine/core";
|
|
2
|
+
import { create_component } from "../modules/component";
|
|
3
|
+
import { spacingPropsDef } from "./propsDef";
|
|
4
|
+
|
|
5
|
+
type Props = ScrollAreaProps;
|
|
6
|
+
const Component = create_component({
|
|
7
|
+
name: "ScrollArea",
|
|
8
|
+
description: "The scrollarea UI element",
|
|
9
|
+
props: {} as Props,
|
|
10
|
+
propsDef: {
|
|
11
|
+
offsetScrollbars: { type: "switch", label: "Offset Scrollbars" },
|
|
12
|
+
type: {
|
|
13
|
+
type: "select",
|
|
14
|
+
options: ["auto", "always", "scroll", "hover", "never"],
|
|
15
|
+
label: "Type",
|
|
16
|
+
},
|
|
17
|
+
scrollbarSize: { type: "number", label: "Scrollbar Size" },
|
|
18
|
+
scrollHideDelay: { type: "number", label: "Hide Delay" },
|
|
19
|
+
...spacingPropsDef,
|
|
20
|
+
},
|
|
21
|
+
render() {
|
|
22
|
+
delete this.props["mount_animation"];
|
|
23
|
+
const { children, ...other } = this.props;
|
|
24
|
+
return <ScrollArea {...other}>{children}</ScrollArea>;
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
export default Component;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { SegmentedControl, SegmentedControlProps } from "@mantine/core";
|
|
2
|
+
import { create_component } from "../modules/component";
|
|
3
|
+
import { spacingPropsDef } from "./propsDef";
|
|
4
|
+
|
|
5
|
+
type Props = SegmentedControlProps;
|
|
6
|
+
const Component = create_component({
|
|
7
|
+
name: "SegmentedControl",
|
|
8
|
+
description: "The segmentedcontrol UI element",
|
|
9
|
+
props: {
|
|
10
|
+
data: ["Item 1", "Item 2", "Item 3"],
|
|
11
|
+
} as Props,
|
|
12
|
+
propsDef: {
|
|
13
|
+
size: { type: "size", label: "Size" },
|
|
14
|
+
color: { type: "color", label: "Color" },
|
|
15
|
+
radius: { type: "size", label: "Radius" },
|
|
16
|
+
fullWidth: { type: "switch", label: "Full Width" },
|
|
17
|
+
orientation: {
|
|
18
|
+
type: "select",
|
|
19
|
+
options: ["horizontal", "vertical"],
|
|
20
|
+
label: "Orientation",
|
|
21
|
+
},
|
|
22
|
+
...spacingPropsDef,
|
|
23
|
+
},
|
|
24
|
+
render() {
|
|
25
|
+
delete this.props["mount_animation"];
|
|
26
|
+
const { children, fullWidth, ...other } = this.props;
|
|
27
|
+
return (
|
|
28
|
+
<SegmentedControl
|
|
29
|
+
{...other}
|
|
30
|
+
fullWidth={fullWidth}
|
|
31
|
+
w={fullWidth ? "100%" : undefined}
|
|
32
|
+
>
|
|
33
|
+
{children}
|
|
34
|
+
</SegmentedControl>
|
|
35
|
+
);
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
export default Component;
|
package/ui/select.tsx
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Select, SelectProps } from "@mantine/core";
|
|
2
|
+
import { create_component } from "../modules/component";
|
|
3
|
+
import { spacingPropsDef } from "./propsDef";
|
|
4
|
+
|
|
5
|
+
type Props = SelectProps;
|
|
6
|
+
const Component = create_component({
|
|
7
|
+
name: "Select",
|
|
8
|
+
description: "The select UI element",
|
|
9
|
+
props: {
|
|
10
|
+
placeholder: "Select an option",
|
|
11
|
+
} as Props,
|
|
12
|
+
propsDef: {
|
|
13
|
+
size: { type: "size", label: "Size" },
|
|
14
|
+
label: { type: "text", label: "Label" },
|
|
15
|
+
description: { type: "text", label: "Description" },
|
|
16
|
+
error: { type: "text", label: "Error" },
|
|
17
|
+
placeholder: { type: "text", label: "Placeholder" },
|
|
18
|
+
disabled: { type: "switch", label: "Disabled" },
|
|
19
|
+
radius: { type: "size", label: "Radius" },
|
|
20
|
+
searchable: { type: "switch", label: "Searchable" },
|
|
21
|
+
clearable: { type: "switch", label: "Clearable" },
|
|
22
|
+
checkIconPosition: {
|
|
23
|
+
type: "segmented",
|
|
24
|
+
options: [
|
|
25
|
+
{ label: "Left", value: "left" },
|
|
26
|
+
{ label: "Right", value: "right" },
|
|
27
|
+
],
|
|
28
|
+
label: "Check Icon Position",
|
|
29
|
+
},
|
|
30
|
+
variant: {
|
|
31
|
+
type: "select",
|
|
32
|
+
options: ["default", "filled", "unstyled"],
|
|
33
|
+
label: "Variant",
|
|
34
|
+
},
|
|
35
|
+
...spacingPropsDef,
|
|
36
|
+
},
|
|
37
|
+
render() {
|
|
38
|
+
delete this.props["mount_animation"];
|
|
39
|
+
const { children, ...other } = this.props;
|
|
40
|
+
return <Select {...other}>{children}</Select>;
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
export default Component;
|