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/indicator.tsx
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Indicator, IndicatorProps } from "@mantine/core";
|
|
2
|
+
import { create_component } from "../modules/component";
|
|
3
|
+
import { spacingPropsDef } from "./propsDef";
|
|
4
|
+
|
|
5
|
+
type Props = IndicatorProps;
|
|
6
|
+
const Component = create_component({
|
|
7
|
+
name: "Indicator",
|
|
8
|
+
description: "The indicator UI element",
|
|
9
|
+
props: {} as Props,
|
|
10
|
+
propsDef: {
|
|
11
|
+
label: { type: "text", label: "Label" },
|
|
12
|
+
position: {
|
|
13
|
+
type: "select",
|
|
14
|
+
options: [
|
|
15
|
+
"top-start",
|
|
16
|
+
"top-center",
|
|
17
|
+
"top-end",
|
|
18
|
+
"middle-start",
|
|
19
|
+
"middle-center",
|
|
20
|
+
"middle-end",
|
|
21
|
+
"bottom-start",
|
|
22
|
+
"bottom-center",
|
|
23
|
+
"bottom-end",
|
|
24
|
+
],
|
|
25
|
+
label: "Position",
|
|
26
|
+
},
|
|
27
|
+
inline: { type: "switch", label: "Inline" },
|
|
28
|
+
size: { type: "number", label: "Size" },
|
|
29
|
+
color: { type: "color", label: "Color" },
|
|
30
|
+
radius: { type: "size", label: "Radius" },
|
|
31
|
+
processing: { type: "switch", label: "Processing" },
|
|
32
|
+
disabled: { type: "switch", label: "Disabled" },
|
|
33
|
+
withBorder: { type: "switch", label: "With Border" },
|
|
34
|
+
...spacingPropsDef,
|
|
35
|
+
},
|
|
36
|
+
render() {
|
|
37
|
+
delete this.props["mount_animation"];
|
|
38
|
+
const { children, ...other } = this.props;
|
|
39
|
+
return <Indicator {...other}>{children}</Indicator>;
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
export default Component;
|
package/ui/infobox.tsx
ADDED
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import { CSSProperties, PropsWithChildren } from "react";
|
|
2
|
+
import { create_component } from "../modules/component";
|
|
3
|
+
import { Text } from "@mantine/core";
|
|
4
|
+
|
|
5
|
+
type Props = PropsWithChildren<{
|
|
6
|
+
toId: string;
|
|
7
|
+
color?: string;
|
|
8
|
+
strokeWidth?: number;
|
|
9
|
+
offsetFrom?: { x: number; y: number };
|
|
10
|
+
offsetTo?: { x: number; y: number };
|
|
11
|
+
linePositionFrom?:
|
|
12
|
+
| "top-left"
|
|
13
|
+
| "top-center"
|
|
14
|
+
| "top-right"
|
|
15
|
+
| "bottom-left"
|
|
16
|
+
| "bottom-center"
|
|
17
|
+
| "bottom-right";
|
|
18
|
+
linePositionTo?:
|
|
19
|
+
| "top-left"
|
|
20
|
+
| "top-center"
|
|
21
|
+
| "top-right"
|
|
22
|
+
| "bottom-left"
|
|
23
|
+
| "bottom-center"
|
|
24
|
+
| "bottom-right";
|
|
25
|
+
style?: CSSProperties;
|
|
26
|
+
}>;
|
|
27
|
+
const Component = create_component({
|
|
28
|
+
name: "Infobox",
|
|
29
|
+
description: "The infobox UI element",
|
|
30
|
+
props: {
|
|
31
|
+
color: "black",
|
|
32
|
+
strokeWidth: 1,
|
|
33
|
+
linePositionFrom: "top-left",
|
|
34
|
+
linePositionTo: "top-left",
|
|
35
|
+
offsetFrom: { x: 0, y: 0 },
|
|
36
|
+
offsetTo: { x: 0, y: 0 },
|
|
37
|
+
children: <Text>Infobox element</Text>,
|
|
38
|
+
} as Props,
|
|
39
|
+
state: {
|
|
40
|
+
points: null as { x1: number; y1: number; x2: number; y2: number } | null,
|
|
41
|
+
},
|
|
42
|
+
refs: {
|
|
43
|
+
fromEl: undefined as unknown as HTMLDivElement,
|
|
44
|
+
},
|
|
45
|
+
methods: {
|
|
46
|
+
updatePosition() {
|
|
47
|
+
const fromEl = this.refs.fromEl.current;
|
|
48
|
+
const toEl = document.getElementById(this.props.toId);
|
|
49
|
+
if (!fromEl || !toEl) return;
|
|
50
|
+
const fromRect = fromEl.getBoundingClientRect();
|
|
51
|
+
const toRect = toEl.getBoundingClientRect();
|
|
52
|
+
|
|
53
|
+
const toPos = {
|
|
54
|
+
"top-left": { x2: toRect.left, y2: toRect.top },
|
|
55
|
+
"top-center": { x2: toRect.left + toRect.width / 2, y2: toRect.top },
|
|
56
|
+
"top-right": { x2: toRect.left + toRect.width, y2: toRect.top },
|
|
57
|
+
"bottom-left": {
|
|
58
|
+
x2: toRect.left,
|
|
59
|
+
y2: toRect.top + toRect.height,
|
|
60
|
+
},
|
|
61
|
+
"bottom-center": {
|
|
62
|
+
x2: toRect.left + toRect.width / 2,
|
|
63
|
+
y2: toRect.top + toRect.height,
|
|
64
|
+
},
|
|
65
|
+
"bottom-right": {
|
|
66
|
+
x2: toRect.left + toRect.width,
|
|
67
|
+
y2: toRect.top + toRect.height,
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
const x2y2 = toPos[this.props.linePositionTo!];
|
|
71
|
+
x2y2.x2 += this.props.offsetTo?.x ?? 0;
|
|
72
|
+
x2y2.y2 += this.props.offsetTo?.y ?? 0;
|
|
73
|
+
switch (this.props.linePositionFrom) {
|
|
74
|
+
case "top-left":
|
|
75
|
+
this.state.points = {
|
|
76
|
+
x1: fromRect.left,
|
|
77
|
+
y1: fromRect.top,
|
|
78
|
+
...x2y2,
|
|
79
|
+
};
|
|
80
|
+
break;
|
|
81
|
+
case "top-center":
|
|
82
|
+
this.state.points = {
|
|
83
|
+
x1: fromRect.left + fromRect.width / 2,
|
|
84
|
+
y1: fromRect.top,
|
|
85
|
+
...x2y2,
|
|
86
|
+
};
|
|
87
|
+
break;
|
|
88
|
+
case "top-right":
|
|
89
|
+
this.state.points = {
|
|
90
|
+
x1: fromRect.left + fromRect.width,
|
|
91
|
+
y1: fromRect.top,
|
|
92
|
+
...x2y2,
|
|
93
|
+
};
|
|
94
|
+
break;
|
|
95
|
+
case "bottom-left":
|
|
96
|
+
this.state.points = {
|
|
97
|
+
x1: fromRect.left,
|
|
98
|
+
y1: fromRect.top + fromRect.height,
|
|
99
|
+
...x2y2,
|
|
100
|
+
};
|
|
101
|
+
break;
|
|
102
|
+
case "bottom-center":
|
|
103
|
+
this.state.points = {
|
|
104
|
+
x1: fromRect.left + fromRect.width / 2,
|
|
105
|
+
y1: fromRect.top + fromRect.height,
|
|
106
|
+
...x2y2,
|
|
107
|
+
};
|
|
108
|
+
break;
|
|
109
|
+
case "bottom-right":
|
|
110
|
+
this.state.points = {
|
|
111
|
+
x1: fromRect.left + fromRect.width,
|
|
112
|
+
y1: fromRect.top + fromRect.height,
|
|
113
|
+
...x2y2,
|
|
114
|
+
};
|
|
115
|
+
break;
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
lifecycle: {
|
|
120
|
+
onMount() {
|
|
121
|
+
window.addEventListener("resize", this.methods.updatePosition);
|
|
122
|
+
window.addEventListener("scroll", this.methods.updatePosition);
|
|
123
|
+
},
|
|
124
|
+
onRender() {
|
|
125
|
+
this.methods.updatePosition();
|
|
126
|
+
},
|
|
127
|
+
onMountAnimationEnd() {
|
|
128
|
+
this.methods.updatePosition();
|
|
129
|
+
},
|
|
130
|
+
onUnmount() {
|
|
131
|
+
window.removeEventListener("resize", this.methods.updatePosition);
|
|
132
|
+
window.removeEventListener("scroll", this.methods.updatePosition);
|
|
133
|
+
},
|
|
134
|
+
onPropChange(propName, previousProp, currentProp) {
|
|
135
|
+
if (["toId"].includes(propName) && currentProp) {
|
|
136
|
+
this.methods.updatePosition();
|
|
137
|
+
this.methods.updatePosition();
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
render() {
|
|
142
|
+
const { points } = this.state;
|
|
143
|
+
const { color, strokeWidth, style, children } = this.props;
|
|
144
|
+
|
|
145
|
+
return (
|
|
146
|
+
<>
|
|
147
|
+
<b
|
|
148
|
+
ref={this.refs.fromEl}
|
|
149
|
+
style={{
|
|
150
|
+
position: "absolute",
|
|
151
|
+
zIndex: 10,
|
|
152
|
+
outline: "1px solid black",
|
|
153
|
+
padding: 10,
|
|
154
|
+
...style,
|
|
155
|
+
}}
|
|
156
|
+
>
|
|
157
|
+
{children}
|
|
158
|
+
</b>
|
|
159
|
+
<svg
|
|
160
|
+
style={{
|
|
161
|
+
position: "fixed",
|
|
162
|
+
top: 0,
|
|
163
|
+
left: 0,
|
|
164
|
+
width: "100%",
|
|
165
|
+
height: "100%",
|
|
166
|
+
pointerEvents: "none",
|
|
167
|
+
zIndex: 10,
|
|
168
|
+
}}
|
|
169
|
+
>
|
|
170
|
+
<defs>
|
|
171
|
+
<marker
|
|
172
|
+
id="arrowhead"
|
|
173
|
+
viewBox="0 0 10 10"
|
|
174
|
+
refX="5"
|
|
175
|
+
refY="5"
|
|
176
|
+
markerWidth="5"
|
|
177
|
+
markerHeight="5"
|
|
178
|
+
>
|
|
179
|
+
<circle cx="5" cy="5" r="5" fill={color} />
|
|
180
|
+
</marker>
|
|
181
|
+
</defs>
|
|
182
|
+
|
|
183
|
+
{points && (
|
|
184
|
+
<line
|
|
185
|
+
x1={points.x1}
|
|
186
|
+
y1={points.y1}
|
|
187
|
+
x2={points.x2}
|
|
188
|
+
y2={points.y2}
|
|
189
|
+
stroke={color}
|
|
190
|
+
strokeWidth={strokeWidth}
|
|
191
|
+
// strokeDasharray={3}
|
|
192
|
+
markerEnd="url(#arrowhead)"
|
|
193
|
+
/>
|
|
194
|
+
)}
|
|
195
|
+
</svg>
|
|
196
|
+
</>
|
|
197
|
+
);
|
|
198
|
+
},
|
|
199
|
+
});
|
|
200
|
+
export default Component;
|
package/ui/input.tsx
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Input, InputProps } from "@mantine/core";
|
|
2
|
+
import { create_component } from "../modules/component";
|
|
3
|
+
import { InputHTMLAttributes } from "react";
|
|
4
|
+
|
|
5
|
+
type Props = InputProps & InputHTMLAttributes<HTMLInputElement>;
|
|
6
|
+
const Component = create_component({
|
|
7
|
+
name: "Input",
|
|
8
|
+
description: "The input UI element",
|
|
9
|
+
props: {
|
|
10
|
+
placeholder: "Placeholder...",
|
|
11
|
+
} as Props,
|
|
12
|
+
render() {
|
|
13
|
+
delete this.props["mount_animation"];
|
|
14
|
+
const { ...other } = this.props;
|
|
15
|
+
return <Input {...other} />;
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
export default Component;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { VisuallyHidden } from "@mantine/core";
|
|
2
|
+
import { create_component } from "../modules/component";
|
|
3
|
+
import { ReactNode } from "react";
|
|
4
|
+
import { useInViewport } from "@mantine/hooks";
|
|
5
|
+
|
|
6
|
+
type Props = {
|
|
7
|
+
children: (inViewport: boolean, ref: any) => ReactNode;
|
|
8
|
+
};
|
|
9
|
+
const Component = create_component({
|
|
10
|
+
name: "InViewport",
|
|
11
|
+
description: "The inviewport UI element",
|
|
12
|
+
props: {} as Props,
|
|
13
|
+
render() {
|
|
14
|
+
delete this.props["mount_animation"];
|
|
15
|
+
const { children, ...other } = this.props;
|
|
16
|
+
const { ref, inViewport } = useInViewport();
|
|
17
|
+
if (typeof children === "function") {
|
|
18
|
+
return <>{children(inViewport, ref)}</>;
|
|
19
|
+
}
|
|
20
|
+
return children;
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
export default Component;
|
package/ui/jsoninput.tsx
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { JsonInput, JsonInputProps } from "@mantine/core";
|
|
2
|
+
import { create_component } from "../modules/component";
|
|
3
|
+
import { spacingPropsDef } from "./propsDef";
|
|
4
|
+
|
|
5
|
+
type Props = JsonInputProps;
|
|
6
|
+
const Component = create_component({
|
|
7
|
+
name: "JsonInput",
|
|
8
|
+
description: "The jsoninput 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
|
+
validationError: { type: "text", label: "Validation Error" },
|
|
26
|
+
formatOnBlur: { type: "switch", label: "Format on blur" },
|
|
27
|
+
...spacingPropsDef,
|
|
28
|
+
},
|
|
29
|
+
render() {
|
|
30
|
+
delete this.props["mount_animation"];
|
|
31
|
+
const { children, ...other } = this.props;
|
|
32
|
+
return <JsonInput {...other} />;
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
export default Component;
|
package/ui/kbd.tsx
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Kbd, KbdProps } from "@mantine/core";
|
|
2
|
+
import { create_component } from "../modules/component";
|
|
3
|
+
import { spacingPropsDef } from "./propsDef";
|
|
4
|
+
|
|
5
|
+
type Props = KbdProps;
|
|
6
|
+
const Component = create_component({
|
|
7
|
+
name: "Kbd",
|
|
8
|
+
description: "The kbd UI element",
|
|
9
|
+
props: {} as Props,
|
|
10
|
+
propsDef: {
|
|
11
|
+
size: { type: "size", label: "Size" },
|
|
12
|
+
...spacingPropsDef,
|
|
13
|
+
},
|
|
14
|
+
render() {
|
|
15
|
+
delete this.props["mount_animation"];
|
|
16
|
+
const { children, ...other } = this.props;
|
|
17
|
+
return <Kbd {...other}>{children}</Kbd>;
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
export default Component;
|
package/ui/list.tsx
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { List, ListItemProps, ListProps } from "@mantine/core";
|
|
2
|
+
import { create_component } from "../modules/component";
|
|
3
|
+
|
|
4
|
+
type Props = Omit<ListProps, "children"> & { items: ListItemProps[] };
|
|
5
|
+
const Component = create_component({
|
|
6
|
+
name: "List",
|
|
7
|
+
description: "The list UI element",
|
|
8
|
+
props: {
|
|
9
|
+
items: [
|
|
10
|
+
{
|
|
11
|
+
children: "Item 1",
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
children: "Item 2",
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
children: "Item 3",
|
|
18
|
+
},
|
|
19
|
+
],
|
|
20
|
+
} as Props,
|
|
21
|
+
render() {
|
|
22
|
+
delete this.props["mount_animation"];
|
|
23
|
+
const { items, ...other } = this.props;
|
|
24
|
+
return (
|
|
25
|
+
<List {...other}>
|
|
26
|
+
{items.map((item, i) => {
|
|
27
|
+
return <List.Item key={i} {...item} />;
|
|
28
|
+
})}
|
|
29
|
+
</List>
|
|
30
|
+
);
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
export default Component;
|
package/ui/loader.tsx
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Loader, LoaderProps } from "@mantine/core";
|
|
2
|
+
import { create_component } from "../modules/component";
|
|
3
|
+
import { spacingPropsDef, colorPropsDef } from "./propsDef";
|
|
4
|
+
|
|
5
|
+
type Props = LoaderProps;
|
|
6
|
+
const Component = create_component({
|
|
7
|
+
name: "Loader",
|
|
8
|
+
description: "The loader UI element",
|
|
9
|
+
props: {} as Props,
|
|
10
|
+
propsDef: {
|
|
11
|
+
size: { type: "size", label: "Size" },
|
|
12
|
+
type: {
|
|
13
|
+
type: "select",
|
|
14
|
+
options: ["bars", "oval", "dots"],
|
|
15
|
+
label: "Type",
|
|
16
|
+
},
|
|
17
|
+
...spacingPropsDef,
|
|
18
|
+
...colorPropsDef,
|
|
19
|
+
},
|
|
20
|
+
render() {
|
|
21
|
+
delete this.props["mount_animation"];
|
|
22
|
+
const { children, ...other } = this.props;
|
|
23
|
+
return <Loader {...other}>{children}</Loader>;
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
export default Component;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { LoadingOverlay, LoadingOverlayProps } from "@mantine/core";
|
|
2
|
+
import { create_component } from "../modules/component";
|
|
3
|
+
import { spacingPropsDef } from "./propsDef";
|
|
4
|
+
|
|
5
|
+
type Props = LoadingOverlayProps;
|
|
6
|
+
const Component = create_component({
|
|
7
|
+
name: "LoadingOverlay",
|
|
8
|
+
description: "The loadingoverlay UI element",
|
|
9
|
+
props: {} as Props,
|
|
10
|
+
propsDef: {
|
|
11
|
+
visible: { type: "switch", label: "Visible" },
|
|
12
|
+
zIndex: { type: "number", label: "Z-Index" },
|
|
13
|
+
overlayBlur: { type: "number", label: "Blur" },
|
|
14
|
+
...spacingPropsDef,
|
|
15
|
+
},
|
|
16
|
+
render() {
|
|
17
|
+
delete this.props["mount_animation"];
|
|
18
|
+
const { children, ...other } = this.props;
|
|
19
|
+
return <LoadingOverlay {...other}>{children}</LoadingOverlay>;
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
export default Component;
|
package/ui/mark.tsx
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Mark, MarkProps } from "@mantine/core";
|
|
2
|
+
import { create_component } from "../modules/component";
|
|
3
|
+
|
|
4
|
+
type Props = MarkProps;
|
|
5
|
+
const Component = create_component({
|
|
6
|
+
name: "Mark",
|
|
7
|
+
description: "The mark UI element",
|
|
8
|
+
props: {} as Props,
|
|
9
|
+
render() {
|
|
10
|
+
delete this.props["mount_animation"];
|
|
11
|
+
const { children, ...other } = this.props;
|
|
12
|
+
return <Mark {...other}>{children}</Mark>;
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
export default Component;
|
package/ui/menu.tsx
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { Button, ButtonProps, Menu, MenuProps } from "@mantine/core";
|
|
2
|
+
import { create_component } from "../modules/component";
|
|
3
|
+
import { spacingPropsDef } from "./propsDef";
|
|
4
|
+
|
|
5
|
+
type Props = Omit<MenuProps, "children"> & {
|
|
6
|
+
labelProps: ButtonProps;
|
|
7
|
+
label: string;
|
|
8
|
+
items: (
|
|
9
|
+
| { type: "divider" }
|
|
10
|
+
| { type: "label"; text: string }
|
|
11
|
+
| {
|
|
12
|
+
type: "item";
|
|
13
|
+
text: string;
|
|
14
|
+
leftSection?: JSX.Element;
|
|
15
|
+
rightSection?: JSX.Element;
|
|
16
|
+
onClick?: () => void;
|
|
17
|
+
}
|
|
18
|
+
)[];
|
|
19
|
+
};
|
|
20
|
+
const Component = create_component({
|
|
21
|
+
name: "Menu",
|
|
22
|
+
description: "The menu UI element",
|
|
23
|
+
props: {
|
|
24
|
+
labelProps: {
|
|
25
|
+
color: "primary",
|
|
26
|
+
},
|
|
27
|
+
items: [],
|
|
28
|
+
label: "",
|
|
29
|
+
} as Props,
|
|
30
|
+
propsDef: {
|
|
31
|
+
label: { type: "text", label: "Label" },
|
|
32
|
+
shadow: { type: "size", label: "Shadow" },
|
|
33
|
+
width: { type: "number", label: "Width" },
|
|
34
|
+
opened: { type: "switch", label: "Opened" },
|
|
35
|
+
withArrow: { type: "switch", label: "With Arrow" },
|
|
36
|
+
position: {
|
|
37
|
+
type: "select",
|
|
38
|
+
options: [
|
|
39
|
+
"bottom",
|
|
40
|
+
"top",
|
|
41
|
+
"left",
|
|
42
|
+
"right",
|
|
43
|
+
"bottom-start",
|
|
44
|
+
"bottom-end",
|
|
45
|
+
"top-start",
|
|
46
|
+
"top-end",
|
|
47
|
+
"left-start",
|
|
48
|
+
"left-end",
|
|
49
|
+
"right-start",
|
|
50
|
+
"right-end",
|
|
51
|
+
],
|
|
52
|
+
label: "Position",
|
|
53
|
+
},
|
|
54
|
+
...spacingPropsDef,
|
|
55
|
+
},
|
|
56
|
+
render() {
|
|
57
|
+
delete this.props["mount_animation"];
|
|
58
|
+
const { label, labelProps, items, ...other } = this.props;
|
|
59
|
+
return (
|
|
60
|
+
<Menu {...other}>
|
|
61
|
+
<Menu.Target>
|
|
62
|
+
<Button {...labelProps}>{label}</Button>
|
|
63
|
+
</Menu.Target>
|
|
64
|
+
|
|
65
|
+
<Menu.Dropdown>
|
|
66
|
+
{items.map((item, i) => {
|
|
67
|
+
if (item.type === "divider") {
|
|
68
|
+
return <Menu.Divider key={i} />;
|
|
69
|
+
}
|
|
70
|
+
if (item.type === "label") {
|
|
71
|
+
return <Menu.Label key={i}>{item.text}</Menu.Label>;
|
|
72
|
+
}
|
|
73
|
+
return (
|
|
74
|
+
<Menu.Item
|
|
75
|
+
key={i}
|
|
76
|
+
leftSection={item.leftSection}
|
|
77
|
+
rightSection={item.rightSection}
|
|
78
|
+
onClick={item.onClick}
|
|
79
|
+
>
|
|
80
|
+
{item.text}
|
|
81
|
+
</Menu.Item>
|
|
82
|
+
);
|
|
83
|
+
})}
|
|
84
|
+
</Menu.Dropdown>
|
|
85
|
+
</Menu>
|
|
86
|
+
);
|
|
87
|
+
},
|
|
88
|
+
});
|
|
89
|
+
export default Component;
|
package/ui/modal.tsx
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Modal, ModalProps } from "@mantine/core";
|
|
2
|
+
import { create_component } from "../modules/component";
|
|
3
|
+
import { spacingPropsDef } from "./propsDef";
|
|
4
|
+
|
|
5
|
+
type Props = ModalProps;
|
|
6
|
+
const Component = create_component({
|
|
7
|
+
name: "Modal",
|
|
8
|
+
description: "The modal UI element",
|
|
9
|
+
props: {} as Props,
|
|
10
|
+
propsDef: {
|
|
11
|
+
title: { type: "text", label: "Title" },
|
|
12
|
+
opened: { type: "switch", label: "Opened" },
|
|
13
|
+
centered: { type: "switch", label: "Centered" },
|
|
14
|
+
withCloseButton: { type: "switch", label: "Close Button" },
|
|
15
|
+
size: { type: "size", label: "Size" },
|
|
16
|
+
padding: { type: "size", label: "Padding" },
|
|
17
|
+
radius: { type: "size", label: "Radius" },
|
|
18
|
+
shadow: { type: "size", label: "Shadow" },
|
|
19
|
+
...spacingPropsDef,
|
|
20
|
+
},
|
|
21
|
+
render() {
|
|
22
|
+
delete this.props["mount_animation"];
|
|
23
|
+
const { children, ...other } = this.props;
|
|
24
|
+
return <Modal {...other}>{children}</Modal>;
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
export default Component;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { MultiSelect, MultiSelectProps } from "@mantine/core";
|
|
2
|
+
import { create_component } from "../modules/component";
|
|
3
|
+
import { spacingPropsDef } from "./propsDef";
|
|
4
|
+
|
|
5
|
+
type Props = MultiSelectProps;
|
|
6
|
+
const Component = create_component({
|
|
7
|
+
name: "MultiSelect",
|
|
8
|
+
description: "The multiselect UI element",
|
|
9
|
+
props: {
|
|
10
|
+
placeholder: "Placeholder...",
|
|
11
|
+
} as Props,
|
|
12
|
+
propsDef: {
|
|
13
|
+
data: { type: "list-text", label: "Data" },
|
|
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
|
+
searchable: { type: "switch", label: "Searchable" },
|
|
19
|
+
clearable: { type: "switch", label: "Clearable" },
|
|
20
|
+
disabled: { type: "switch", label: "Disabled" },
|
|
21
|
+
withAsterisk: { type: "switch", label: "With Asterisk" },
|
|
22
|
+
maxValues: { type: "number", label: "Max Values" },
|
|
23
|
+
variant: {
|
|
24
|
+
type: "select",
|
|
25
|
+
options: ["default", "filled", "unstyled"],
|
|
26
|
+
label: "Variant",
|
|
27
|
+
},
|
|
28
|
+
size: { type: "size", label: "Size" },
|
|
29
|
+
radius: { type: "size", label: "Radius" },
|
|
30
|
+
...spacingPropsDef,
|
|
31
|
+
},
|
|
32
|
+
render() {
|
|
33
|
+
delete this.props["mount_animation"];
|
|
34
|
+
const { children, ...other } = this.props;
|
|
35
|
+
return (
|
|
36
|
+
<MultiSelect maw="100%" {...other}>
|
|
37
|
+
{children}
|
|
38
|
+
</MultiSelect>
|
|
39
|
+
);
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
export default Component;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { NativeSelect, NativeSelectProps } from "@mantine/core";
|
|
2
|
+
import { create_component } from "../modules/component";
|
|
3
|
+
|
|
4
|
+
type Props = NativeSelectProps;
|
|
5
|
+
const Component = create_component({
|
|
6
|
+
name: "NativeSelect",
|
|
7
|
+
description: "The nativeselect UI element",
|
|
8
|
+
props: {
|
|
9
|
+
data: ["Item 1", "Item 2", "Item 3"],
|
|
10
|
+
} as Props,
|
|
11
|
+
render() {
|
|
12
|
+
delete this.props["mount_animation"];
|
|
13
|
+
const { children, ...other } = this.props;
|
|
14
|
+
return <NativeSelect {...other}>{children}</NativeSelect>;
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
export default Component;
|
package/ui/navlink.tsx
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { NavLink, NavLinkProps } from "@mantine/core";
|
|
2
|
+
import { create_component } from "../modules/component";
|
|
3
|
+
import { spacingPropsDef } from "./propsDef";
|
|
4
|
+
import Link from "next/link";
|
|
5
|
+
|
|
6
|
+
type Props = NavLinkProps & { href?: string };
|
|
7
|
+
const Component = create_component({
|
|
8
|
+
name: "NavLink",
|
|
9
|
+
description: "The navlink UI element",
|
|
10
|
+
props: {} as Props,
|
|
11
|
+
propsDef: {
|
|
12
|
+
label: { type: "text", label: "Label" },
|
|
13
|
+
description: { type: "text", label: "Description" },
|
|
14
|
+
href: { type: "text", label: "Href" },
|
|
15
|
+
active: { type: "switch", label: "Active" },
|
|
16
|
+
disabled: { type: "switch", label: "Disabled" },
|
|
17
|
+
color: { type: "color", label: "Color" },
|
|
18
|
+
variant: {
|
|
19
|
+
type: "select",
|
|
20
|
+
options: ["filled", "light", "subtle"],
|
|
21
|
+
label: "Variant",
|
|
22
|
+
},
|
|
23
|
+
...spacingPropsDef,
|
|
24
|
+
},
|
|
25
|
+
render() {
|
|
26
|
+
delete this.props["mount_animation"];
|
|
27
|
+
const { children, href, ...other } = this.props;
|
|
28
|
+
if (href) {
|
|
29
|
+
return (
|
|
30
|
+
<Link href={href} passHref>
|
|
31
|
+
<NavLink component="a" {...other}>
|
|
32
|
+
{children}
|
|
33
|
+
</NavLink>
|
|
34
|
+
</Link>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
return <NavLink {...other}>{children}</NavLink>;
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
export default Component;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Notification, NotificationProps } from "@mantine/core";
|
|
2
|
+
import { create_component } from "../modules/component";
|
|
3
|
+
import { spacingPropsDef, colorPropsDef } from "./propsDef";
|
|
4
|
+
|
|
5
|
+
type Props = NotificationProps;
|
|
6
|
+
const Component = create_component({
|
|
7
|
+
name: "Notification",
|
|
8
|
+
description: "The notification UI element",
|
|
9
|
+
props: {} as Props,
|
|
10
|
+
propsDef: {
|
|
11
|
+
title: { type: "text", label: "Title" },
|
|
12
|
+
loading: { type: "switch", label: "Loading" },
|
|
13
|
+
withCloseButton: { type: "switch", label: "Close Button" },
|
|
14
|
+
withBorder: { type: "switch", label: "With Border" },
|
|
15
|
+
radius: { type: "size", label: "Radius" },
|
|
16
|
+
...spacingPropsDef,
|
|
17
|
+
...colorPropsDef,
|
|
18
|
+
},
|
|
19
|
+
render() {
|
|
20
|
+
delete this.props["mount_animation"];
|
|
21
|
+
const { children, ...other } = this.props;
|
|
22
|
+
return <Notification {...other}>{children}</Notification>;
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
export default Component;
|