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.
Files changed (169) hide show
  1. package/README.md +51 -0
  2. package/api/client.ts +83 -0
  3. package/api/helpers/fs.ts +98 -0
  4. package/api/helpers/stream.ts +6 -0
  5. package/api/index.ts +50 -0
  6. package/api/server.ts +566 -0
  7. package/constants/fonts.ts +1583 -0
  8. package/constants/icons.ts +2124 -0
  9. package/constants/langs.ts +2592 -0
  10. package/constants/ssr-loading.tsx +17 -0
  11. package/contexts/dev.tsx +124 -0
  12. package/hooks/useDebounceCb.ts +21 -0
  13. package/modules/app.tsx +102 -0
  14. package/modules/behaviors.ts +161 -0
  15. package/modules/component.tsx +483 -0
  16. package/modules/config/index.ts +8 -0
  17. package/modules/database.ts +25 -0
  18. package/modules/document.tsx +23 -0
  19. package/modules/error.tsx +16 -0
  20. package/modules/page/autozoom.tsx +92 -0
  21. package/modules/page/browser.tsx +166 -0
  22. package/modules/page/index.tsx +327 -0
  23. package/modules/page/insert-modal.tsx +225 -0
  24. package/modules/page/inspect/index.tsx +237 -0
  25. package/modules/page/inspect/wrapper.tsx +88 -0
  26. package/modules/page/knobs/action.tsx +58 -0
  27. package/modules/page/knobs/color.tsx +78 -0
  28. package/modules/page/knobs/helpers.ts +71 -0
  29. package/modules/page/knobs/icon.tsx +85 -0
  30. package/modules/page/knobs/linker.tsx +188 -0
  31. package/modules/page/knobs/list-json.tsx +149 -0
  32. package/modules/page/knobs/list-text.tsx +129 -0
  33. package/modules/page/knobs/number.tsx +84 -0
  34. package/modules/page/knobs/segmented.tsx +81 -0
  35. package/modules/page/knobs/select.tsx +89 -0
  36. package/modules/page/knobs/size.tsx +106 -0
  37. package/modules/page/knobs/switch.tsx +75 -0
  38. package/modules/page/knobs/text.tsx +93 -0
  39. package/modules/page/left-tabs.tsx +36 -0
  40. package/modules/page/right-tabs.tsx +31 -0
  41. package/modules/page/seo.tsx +69 -0
  42. package/modules/page/tree.tsx +860 -0
  43. package/modules/state.ts +787 -0
  44. package/modules/store.ts +37 -0
  45. package/modules/theme.ts +105 -0
  46. package/modules/translations.ts +15 -0
  47. package/package.json +68 -0
  48. package/scripts/bin.js +607 -0
  49. package/scripts/test.js +145 -0
  50. package/themes/base.tsx +8962 -0
  51. package/themes/index.ts +4 -0
  52. package/themes/m2.ts +39 -0
  53. package/themes/newspaper.ts +39 -0
  54. package/types/api.ts +57 -0
  55. package/types/fiber_node.ts +69 -0
  56. package/types/react_element.ts +14 -0
  57. package/ui/accordion.tsx +70 -0
  58. package/ui/actionicon.tsx +41 -0
  59. package/ui/affix.tsx +14 -0
  60. package/ui/alert.tsx +37 -0
  61. package/ui/anchor.tsx +52 -0
  62. package/ui/arrow.tsx +116 -0
  63. package/ui/aspectratio.tsx +21 -0
  64. package/ui/autocomplete.tsx +34 -0
  65. package/ui/avatar.tsx +36 -0
  66. package/ui/backgroundimage.tsx +16 -0
  67. package/ui/badge.tsx +28 -0
  68. package/ui/blockquote.tsx +15 -0
  69. package/ui/blocks/faq.tsx +145 -0
  70. package/ui/blocks/features.tsx +167 -0
  71. package/ui/blocks/footer.tsx +182 -0
  72. package/ui/blocks/herobanner.tsx +391 -0
  73. package/ui/blocks/index.ts +44 -0
  74. package/ui/blocks/leftnav.tsx +141 -0
  75. package/ui/blocks/pricing.tsx +210 -0
  76. package/ui/blocks/testimonials.tsx +149 -0
  77. package/ui/blocks/uidocs.tsx +1429 -0
  78. package/ui/box.tsx +27 -0
  79. package/ui/breadcrumbs.tsx +33 -0
  80. package/ui/burger.tsx +23 -0
  81. package/ui/button.tsx +85 -0
  82. package/ui/card.tsx +28 -0
  83. package/ui/center.tsx +26 -0
  84. package/ui/checkbox.tsx +35 -0
  85. package/ui/chip.tsx +32 -0
  86. package/ui/closebutton.tsx +15 -0
  87. package/ui/code.tsx +104 -0
  88. package/ui/collapse.tsx +16 -0
  89. package/ui/colorinput.tsx +32 -0
  90. package/ui/colorpicker.tsx +26 -0
  91. package/ui/colorswatch.tsx +17 -0
  92. package/ui/combobox.tsx +80 -0
  93. package/ui/container.tsx +27 -0
  94. package/ui/dialog.tsx +15 -0
  95. package/ui/divider.tsx +58 -0
  96. package/ui/drawer.tsx +28 -0
  97. package/ui/fieldset.tsx +15 -0
  98. package/ui/filebutton.tsx +23 -0
  99. package/ui/fileinput.tsx +36 -0
  100. package/ui/flex.tsx +139 -0
  101. package/ui/focustrap.tsx +15 -0
  102. package/ui/form.tsx +26 -0
  103. package/ui/grid.tsx +69 -0
  104. package/ui/highlight.tsx +15 -0
  105. package/ui/hoverable.tsx +66 -0
  106. package/ui/hovercard.tsx +45 -0
  107. package/ui/icon.tsx +76 -0
  108. package/ui/image.tsx +32 -0
  109. package/ui/index.ts +1355 -0
  110. package/ui/indicator.tsx +42 -0
  111. package/ui/infobox.tsx +200 -0
  112. package/ui/input.tsx +18 -0
  113. package/ui/inviewport.tsx +23 -0
  114. package/ui/jsoninput.tsx +35 -0
  115. package/ui/kbd.tsx +20 -0
  116. package/ui/list.tsx +33 -0
  117. package/ui/loader.tsx +26 -0
  118. package/ui/loadingoverlay.tsx +22 -0
  119. package/ui/mark.tsx +15 -0
  120. package/ui/menu.tsx +89 -0
  121. package/ui/modal.tsx +27 -0
  122. package/ui/multiselect.tsx +42 -0
  123. package/ui/nativeselect.tsx +17 -0
  124. package/ui/navlink.tsx +40 -0
  125. package/ui/notification.tsx +25 -0
  126. package/ui/numberformatter.tsx +15 -0
  127. package/ui/numberinput.tsx +37 -0
  128. package/ui/overlay.tsx +15 -0
  129. package/ui/pagination.tsx +21 -0
  130. package/ui/paper.tsx +33 -0
  131. package/ui/passwordinput.tsx +36 -0
  132. package/ui/pill.tsx +17 -0
  133. package/ui/pillsinput.tsx +37 -0
  134. package/ui/pininput.tsx +30 -0
  135. package/ui/popover.tsx +43 -0
  136. package/ui/portal.tsx +15 -0
  137. package/ui/progress.tsx +49 -0
  138. package/ui/props.ts +91 -0
  139. package/ui/propsDef.ts +38 -0
  140. package/ui/radio.tsx +30 -0
  141. package/ui/rating.tsx +25 -0
  142. package/ui/ringprogress.tsx +17 -0
  143. package/ui/scrollarea.tsx +27 -0
  144. package/ui/segmentedcontrol.tsx +38 -0
  145. package/ui/select.tsx +43 -0
  146. package/ui/simplegrid.tsx +23 -0
  147. package/ui/skeleton.tsx +15 -0
  148. package/ui/slider.tsx +31 -0
  149. package/ui/space.tsx +19 -0
  150. package/ui/spoiler.tsx +23 -0
  151. package/ui/stepper.tsx +63 -0
  152. package/ui/switch.tsx +29 -0
  153. package/ui/table.tsx +93 -0
  154. package/ui/tabs.tsx +80 -0
  155. package/ui/tagsinput.tsx +19 -0
  156. package/ui/terminal.tsx +44 -0
  157. package/ui/text.tsx +168 -0
  158. package/ui/textarea.tsx +36 -0
  159. package/ui/textinput.tsx +34 -0
  160. package/ui/timeline.tsx +30 -0
  161. package/ui/title.tsx +42 -0
  162. package/ui/tooltip.tsx +32 -0
  163. package/ui/transition.tsx +21 -0
  164. package/ui/tree.tsx +42 -0
  165. package/ui/typographystylesprovider.tsx +20 -0
  166. package/ui/unstyledbutton.tsx +18 -0
  167. package/ui/video.tsx +16 -0
  168. package/ui/visuallyhidden.tsx +15 -0
  169. package/utils/index.ts +76 -0
@@ -0,0 +1,23 @@
1
+ import { SimpleGrid, SimpleGridProps, Text } from "@mantine/core";
2
+ import { create_component } from "../modules/component";
3
+
4
+ type Props = SimpleGridProps;
5
+ const Component = create_component({
6
+ name: "SimpleGrid",
7
+ description: "The simplegrid UI element",
8
+ props: {
9
+ children: [
10
+ <Text key={0}>Cell 1</Text>,
11
+ <Text key={1}>Cell 2</Text>,
12
+ <Text key={2}>Cell 3</Text>,
13
+ <Text key={3}>Cell 4</Text>,
14
+ ],
15
+ cols: 2,
16
+ } as Props,
17
+ render() {
18
+ delete this.props["mount_animation"];
19
+ const { children, ...other } = this.props;
20
+ return <SimpleGrid {...other}>{children}</SimpleGrid>;
21
+ },
22
+ });
23
+ export default Component;
@@ -0,0 +1,15 @@
1
+ import { Skeleton, SkeletonProps } from "@mantine/core";
2
+ import { create_component } from "../modules/component";
3
+
4
+ type Props = SkeletonProps;
5
+ const Component = create_component({
6
+ name: "Skeleton",
7
+ description: "The skeleton UI element",
8
+ props: {} as Props,
9
+ render() {
10
+ delete this.props["mount_animation"];
11
+ const { children, ...other } = this.props;
12
+ return <Skeleton {...other}>{children}</Skeleton>;
13
+ },
14
+ });
15
+ export default Component;
package/ui/slider.tsx ADDED
@@ -0,0 +1,31 @@
1
+ import { Slider, SliderProps } from "@mantine/core";
2
+ import { create_component } from "../modules/component";
3
+ import { spacingPropsDef } from "./propsDef";
4
+
5
+ type Props = SliderProps;
6
+ const Component = create_component({
7
+ name: "Slider",
8
+ description: "The slider UI element",
9
+ props: {
10
+ w: 100,
11
+ } as Props,
12
+ propsDef: {
13
+ size: { type: "size", label: "Size" },
14
+ color: { type: "color", label: "Color" },
15
+ radius: { type: "size", label: "Radius" },
16
+ min: { type: "number", label: "Min" },
17
+ max: { type: "number", label: "Max" },
18
+ step: { type: "number", label: "Step" },
19
+ label: { type: "text", label: "Label" },
20
+ inverted: { type: "switch", label: "Inverted" },
21
+ disabled: { type: "switch", label: "Disabled" },
22
+ thumbSize: { type: "number", label: "Thumb Size" },
23
+ ...spacingPropsDef,
24
+ },
25
+ render() {
26
+ delete this.props["mount_animation"];
27
+ const { children, ...other } = this.props;
28
+ return <Slider {...other}>{children}</Slider>;
29
+ },
30
+ });
31
+ export default Component;
package/ui/space.tsx ADDED
@@ -0,0 +1,19 @@
1
+ import { Space, SpaceProps } from "@mantine/core";
2
+ import { create_component } from "../modules/component";
3
+
4
+ type Props = SpaceProps;
5
+ const Component = create_component({
6
+ name: "Space",
7
+ description: "The space UI element",
8
+ props: {} as Props,
9
+ propsDef: {
10
+ w: { type: "size", label: "Width" },
11
+ h: { type: "size", label: "Height" },
12
+ },
13
+ render() {
14
+ delete this.props["mount_animation"];
15
+ const { children, ...other } = this.props;
16
+ return <Space {...other}>{children}</Space>;
17
+ },
18
+ });
19
+ export default Component;
package/ui/spoiler.tsx ADDED
@@ -0,0 +1,23 @@
1
+ import { Spoiler, SpoilerProps } from "@mantine/core";
2
+ import { create_component } from "../modules/component";
3
+ import { spacingPropsDef } from "./propsDef";
4
+
5
+ type Props = SpoilerProps;
6
+ const Component = create_component({
7
+ name: "Spoiler",
8
+ description: "The spoiler UI element",
9
+ props: {} as Props,
10
+ propsDef: {
11
+ maxHeight: { type: "number", label: "Max Height" },
12
+ showLabel: { type: "text", label: "Show Label" },
13
+ hideLabel: { type: "text", label: "Hide Label" },
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 <Spoiler {...other}>{children}</Spoiler>;
21
+ },
22
+ });
23
+ export default Component;
package/ui/stepper.tsx ADDED
@@ -0,0 +1,63 @@
1
+ import { Stepper, StepperProps, StepperStepProps } from "@mantine/core";
2
+ import { create_component } from "../modules/component";
3
+ import { spacingPropsDef } from "./propsDef";
4
+ import { ReactNode } from "react";
5
+
6
+ type Props = Omit<StepperProps, "children"> & {
7
+ steps: StepperStepProps[];
8
+ completed: ReactNode;
9
+ };
10
+ const Component = create_component({
11
+ name: "Stepper",
12
+ description: "The stepper UI element",
13
+ props: {
14
+ active: 0,
15
+ steps: [
16
+ {
17
+ title: "Step 1",
18
+ },
19
+ {
20
+ title: "Step 2",
21
+ },
22
+ {
23
+ title: "Step 3",
24
+ },
25
+ ],
26
+ completed: "Completed",
27
+ } as Props,
28
+ propsDef: {
29
+ active: { type: "number", label: "Active Step" },
30
+ orientation: {
31
+ type: "select",
32
+ options: ["horizontal", "vertical"],
33
+ label: "Orientation",
34
+ },
35
+ iconSize: { type: "number", label: "Icon Size" },
36
+ size: { type: "size", label: "Size" },
37
+ color: { type: "color", label: "Color" },
38
+ radius: { type: "size", label: "Radius" },
39
+ allowNextStepsSelect: { type: "switch", label: "Allow Next Select" },
40
+ ...spacingPropsDef,
41
+ },
42
+ computed: {
43
+ steps() {
44
+ return this.props.steps.map((step, i) => {
45
+ return <Stepper.Step {...step} key={i} />;
46
+ });
47
+ },
48
+ },
49
+ render() {
50
+ delete this.props["mount_animation"];
51
+ const { steps, completed, ...other } = this.props;
52
+ if (!this.computed.steps.length) {
53
+ return null;
54
+ }
55
+ return (
56
+ <Stepper {...other}>
57
+ {this.computed.steps}
58
+ {completed && <Stepper.Completed>{completed}</Stepper.Completed>}
59
+ </Stepper>
60
+ );
61
+ },
62
+ });
63
+ export default Component;
package/ui/switch.tsx ADDED
@@ -0,0 +1,29 @@
1
+ import { Switch, SwitchProps } from "@mantine/core";
2
+ import { create_component } from "../modules/component";
3
+ import { spacingPropsDef } from "./propsDef";
4
+
5
+ type Props = SwitchProps;
6
+ const Component = create_component({
7
+ name: "Switch",
8
+ description: "The switch 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
+ radius: { type: "size", label: "Radius" },
18
+ onLabel: { type: "text", label: "On Label" },
19
+ offLabel: { type: "text", label: "Off Label" },
20
+ checked: { type: "switch", label: "Checked" },
21
+ ...spacingPropsDef,
22
+ },
23
+ render() {
24
+ delete this.props["mount_animation"];
25
+ const { ...other } = this.props;
26
+ return <Switch {...other} />;
27
+ },
28
+ });
29
+ export default Component;
package/ui/table.tsx ADDED
@@ -0,0 +1,93 @@
1
+ import { Table, TableProps } from "@mantine/core";
2
+ import { create_component } from "../modules/component";
3
+ import { spacingPropsDef } from "./propsDef";
4
+ import { ChangeEventHandler, ReactNode } from "react";
5
+ import { UI } from ".";
6
+
7
+ type Props = TableProps & {
8
+ columns: ReactNode[];
9
+ rows: ReactNode[][];
10
+ selectableRows?: boolean;
11
+ selectedRows?: number[];
12
+ onRowSelect?: (rowIndex: number) => void;
13
+ onRowUnselect?: (rowIndex: number) => void;
14
+ };
15
+ const Component = create_component({
16
+ name: "Table",
17
+ description: "The table UI element",
18
+ props: {
19
+ selectableRows: false,
20
+ selectedRows: [],
21
+ onRowSelect: () => {},
22
+ onRowUnselect: () => {},
23
+ columns: ["Col 1", "Col 2", "Col 3"],
24
+ rows: [
25
+ ["Row 1", "Row 1", "Row 1"],
26
+ ["Row 2", "Row 2", "Row 2"],
27
+ ],
28
+ } as Props,
29
+ propsDef: {
30
+ striped: { type: "switch", label: "Striped" },
31
+ highlightOnHover: { type: "switch", label: "Highlight on Hover" },
32
+ withTableBorder: { type: "switch", label: "Table Border" },
33
+ withColumnBorders: { type: "switch", label: "Column Borders" },
34
+ horizontalSpacing: { type: "size", label: "Horizontal Spacing" },
35
+ verticalSpacing: { type: "size", label: "Vertical Spacing" },
36
+ layout: {
37
+ type: "select",
38
+ options: ["fixed", "auto"],
39
+ label: "Layout",
40
+ },
41
+ ...spacingPropsDef,
42
+ },
43
+ render() {
44
+ const {
45
+ columns,
46
+ rows,
47
+ selectableRows,
48
+ selectedRows,
49
+ onRowSelect,
50
+ onRowUnselect,
51
+ ...other
52
+ } = this.props;
53
+ return (
54
+ <Table {...other}>
55
+ <Table.Thead>
56
+ <Table.Tr>
57
+ {selectableRows && <Table.Th />}
58
+ {columns.map((column, i) => {
59
+ return <Table.Th key={i}>{column}</Table.Th>;
60
+ })}
61
+ </Table.Tr>
62
+ </Table.Thead>
63
+ <Table.Tbody>
64
+ {rows.map((row, i) => {
65
+ const onChange: ChangeEventHandler<HTMLInputElement> = (event) => {
66
+ if (event.currentTarget.checked) {
67
+ onRowSelect!(i);
68
+ } else {
69
+ onRowUnselect!(i);
70
+ }
71
+ };
72
+ return (
73
+ <Table.Tr key={i}>
74
+ {selectableRows && (
75
+ <Table.Td>
76
+ <UI.checkbox
77
+ checked={selectedRows!.includes(i)}
78
+ onChange={onChange}
79
+ />
80
+ </Table.Td>
81
+ )}
82
+ {columns.map((_, x) => {
83
+ return <Table.Td key={x}>{row[x]}</Table.Td>;
84
+ })}
85
+ </Table.Tr>
86
+ );
87
+ })}
88
+ </Table.Tbody>
89
+ </Table>
90
+ );
91
+ },
92
+ });
93
+ export default Component;
package/ui/tabs.tsx ADDED
@@ -0,0 +1,80 @@
1
+ import { Tabs, TabsProps } from "@mantine/core";
2
+ import { create_component } from "../modules/component";
3
+ import { spacingPropsDef } from "./propsDef";
4
+ import { ReactNode } from "react";
5
+
6
+ type Props = Omit<TabsProps, "children"> & {
7
+ tabs: {
8
+ header: ReactNode | string;
9
+ icon?: ReactNode;
10
+ content: ReactNode | string;
11
+ value: string;
12
+ }[];
13
+ };
14
+ const Component = create_component({
15
+ name: "Tabs",
16
+ description: "The tabs UI element",
17
+ props: {
18
+ tabs: [
19
+ {
20
+ header: "Tab 1",
21
+ content: "Content for Tab 1",
22
+ value: "tab1",
23
+ },
24
+ {
25
+ header: "Tab 2",
26
+ content: "Content for Tab 2",
27
+ value: "tab2",
28
+ },
29
+ ],
30
+ } as Props,
31
+ propsDef: {
32
+ variant: {
33
+ type: "select",
34
+ options: ["default", "outline", "pills"],
35
+ label: "Variant",
36
+ },
37
+ color: { type: "color", label: "Color" },
38
+ radius: { type: "size", label: "Radius" },
39
+ orientation: {
40
+ type: "select",
41
+ options: ["horizontal", "vertical"],
42
+ label: "Orientation",
43
+ },
44
+ placement: {
45
+ type: "select",
46
+ options: ["left", "right"],
47
+ label: "Placement",
48
+ },
49
+ ...spacingPropsDef,
50
+ },
51
+ render() {
52
+ delete this.props["mount_animation"];
53
+ const { tabs, ...other } = this.props;
54
+ return (
55
+ <Tabs {...other}>
56
+ <Tabs.List>
57
+ {tabs.map((tab) => {
58
+ return (
59
+ <Tabs.Tab
60
+ key={tab.value}
61
+ value={tab.value}
62
+ leftSection={tab.icon}
63
+ >
64
+ {tab.header}
65
+ </Tabs.Tab>
66
+ );
67
+ })}
68
+ </Tabs.List>
69
+ {tabs.map((tab) => {
70
+ return (
71
+ <Tabs.Panel key={tab.value} value={tab.value}>
72
+ {tab.content}
73
+ </Tabs.Panel>
74
+ );
75
+ })}
76
+ </Tabs>
77
+ );
78
+ },
79
+ });
80
+ export default Component;
@@ -0,0 +1,19 @@
1
+ import { TagsInput, TagsInputProps } from "@mantine/core";
2
+ import { create_component } from "../modules/component";
3
+
4
+ type Props = TagsInputProps;
5
+ const Component = create_component({
6
+ name: "TagsInput",
7
+ description: "The tagsinput UI element",
8
+ props: {
9
+ placeholder: "Add a tag",
10
+ } as Props,
11
+ render() {
12
+ delete this.props["mount_animation"];
13
+ const { children, ...other } = this.props;
14
+ return (
15
+ <TagsInput maw="100%" {...other} />
16
+ );
17
+ },
18
+ });
19
+ export default Component;
@@ -0,0 +1,44 @@
1
+ import { CodeProps } from "@mantine/core";
2
+
3
+ import { create_component } from "../modules/component";
4
+ import { CommonProps } from "./props";
5
+ import { UI } from ".";
6
+
7
+ type Props = CommonProps &
8
+ CodeProps & {
9
+ codes: string[];
10
+ colorScheme?: "light" | "dark";
11
+ };
12
+ const Component = create_component({
13
+ name: "Terminal",
14
+ description: "The terminal UI element",
15
+ props: {
16
+ codes: ["mkdir folder"],
17
+ colorScheme: "light",
18
+ } as Props,
19
+ render() {
20
+ delete this.props["mount_animation"];
21
+ const { codes, colorScheme, ...other } = this.props;
22
+ return (
23
+ <UI.flex direction="column" p="xs" bg="dark.5">
24
+ {codes.map((code) => (
25
+ <UI.flex key={code} align="center">
26
+ <UI.text text="$" c="dark.0" />
27
+ <UI.code
28
+ key={code}
29
+ code={code}
30
+ themes={{
31
+ dark: "houston",
32
+ light: "houston",
33
+ }}
34
+ colorScheme={colorScheme}
35
+ codeLang="bash"
36
+ {...other}
37
+ />
38
+ </UI.flex>
39
+ ))}
40
+ </UI.flex>
41
+ );
42
+ },
43
+ });
44
+ export default Component;
package/ui/text.tsx ADDED
@@ -0,0 +1,168 @@
1
+ import { Text, TextProps } from "@mantine/core";
2
+ import { create_component } from "../modules/component";
3
+ import {
4
+ IconItalic,
5
+ IconLetterCase,
6
+ IconLetterCaseLower,
7
+ IconLetterCaseUpper,
8
+ IconOverline,
9
+ IconStrikethrough,
10
+ IconLetterA,
11
+ IconAlignCenter,
12
+ IconAlignJustified,
13
+ IconAlignLeft,
14
+ IconAlignRight,
15
+ } from "@tabler/icons-react";
16
+ import { colorPropsDef, spacingPropsDef } from "./propsDef";
17
+ import { CommonProps } from "./props";
18
+
19
+ type Props = CommonProps & TextProps & { text: string };
20
+ const Component = create_component({
21
+ name: "Text",
22
+ description: "The text UI element",
23
+ props: {
24
+ mount_animation: "fade",
25
+ text: "A text",
26
+ } as Props,
27
+ propsDef: {
28
+ text: {
29
+ label: "Text",
30
+ multiline: true,
31
+ type: "text",
32
+ },
33
+ fz: {
34
+ label: "Font size",
35
+ type: "number",
36
+ },
37
+ fw: {
38
+ label: "Font weight",
39
+ type: "select",
40
+ options: [
41
+ {
42
+ label: "100",
43
+ value: "100",
44
+ },
45
+ {
46
+ label: "200",
47
+ value: "200",
48
+ },
49
+ {
50
+ label: "300",
51
+ value: "300",
52
+ },
53
+ {
54
+ label: "400",
55
+ value: "400",
56
+ },
57
+ {
58
+ label: "500",
59
+ value: "500",
60
+ },
61
+ {
62
+ label: "600",
63
+ value: "600",
64
+ },
65
+ {
66
+ label: "700",
67
+ value: "700",
68
+ },
69
+ {
70
+ label: "800",
71
+ value: "800",
72
+ },
73
+ {
74
+ label: "900",
75
+ value: "900",
76
+ },
77
+ ],
78
+ },
79
+ tt: {
80
+ type: "segmented",
81
+ label: "Text transform",
82
+ options: [
83
+ {
84
+ label: <IconLetterCase size={20} />,
85
+ value: "capitalize",
86
+ },
87
+ {
88
+ label: <IconLetterCaseLower size={20} />,
89
+ value: "lowercase",
90
+ },
91
+ {
92
+ label: <IconLetterCaseUpper size={20} />,
93
+ value: "uppercase",
94
+ },
95
+ ],
96
+ },
97
+ fs: {
98
+ type: "segmented",
99
+ label: "Font style",
100
+ options: [
101
+ {
102
+ label: <IconLetterA size={20} />,
103
+ value: "normal",
104
+ },
105
+ {
106
+ label: <IconItalic size={20} />,
107
+ value: "italic",
108
+ },
109
+ ],
110
+ },
111
+ td: {
112
+ type: "segmented",
113
+ label: "Text decoration",
114
+ options: [
115
+ {
116
+ label: <IconLetterA size={20} />,
117
+ value: "none",
118
+ },
119
+ {
120
+ label: <IconOverline size={20} />,
121
+ value: "overline",
122
+ },
123
+ {
124
+ label: <IconStrikethrough size={20} />,
125
+ value: "line-through",
126
+ },
127
+ ],
128
+ },
129
+ ta: {
130
+ type: "segmented",
131
+ label: "Text align",
132
+ options: [
133
+ {
134
+ label: <IconAlignLeft size={20} />,
135
+ value: "left",
136
+ },
137
+ {
138
+ label: <IconAlignCenter size={20} />,
139
+ value: "center",
140
+ },
141
+ {
142
+ label: <IconAlignRight size={20} />,
143
+ value: "right",
144
+ },
145
+ {
146
+ label: <IconAlignJustified size={20} />,
147
+ value: "justify",
148
+ },
149
+ ],
150
+ },
151
+ lts: {
152
+ type: "number",
153
+ label: "Letter spacing",
154
+ },
155
+ ...spacingPropsDef,
156
+ ...colorPropsDef,
157
+ },
158
+ render() {
159
+ delete this.props["mount_animation"];
160
+ const { text, ...other } = this.props;
161
+ return (
162
+ <Text display="inline" {...other}>
163
+ {text}
164
+ </Text>
165
+ );
166
+ },
167
+ });
168
+ export default Component;
@@ -0,0 +1,36 @@
1
+ import { Textarea, TextareaProps } from "@mantine/core";
2
+ import { create_component } from "../modules/component";
3
+ import { spacingPropsDef } from "./propsDef";
4
+
5
+ type Props = TextareaProps;
6
+ const Component = create_component({
7
+ name: "Textarea",
8
+ description: "The textarea 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
+ autosize: { type: "switch", label: "Autosize" },
26
+ minRows: { type: "number", label: "Min Rows" },
27
+ maxRows: { type: "number", label: "Max Rows" },
28
+ ...spacingPropsDef,
29
+ },
30
+ render() {
31
+ delete this.props["mount_animation"];
32
+ const { children, ...other } = this.props;
33
+ return <Textarea {...other} />;
34
+ },
35
+ });
36
+ export default Component;
@@ -0,0 +1,34 @@
1
+ import { TextInput, TextInputProps } from "@mantine/core";
2
+ import { create_component } from "../modules/component";
3
+ import { spacingPropsDef } from "./propsDef";
4
+
5
+ type Props = TextInputProps;
6
+ const Component = create_component({
7
+ name: "TextInput",
8
+ description: "The textinput UI element",
9
+ props: {
10
+ placeholder: "Textinput...",
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
+ withAsterisk: { type: "switch", label: "With Asterisk" },
20
+ radius: { type: "size", label: "Radius" },
21
+ variant: {
22
+ type: "select",
23
+ options: ["default", "filled", "unstyled"],
24
+ label: "Variant",
25
+ },
26
+ ...spacingPropsDef,
27
+ },
28
+ render() {
29
+ delete this.props["mount_animation"];
30
+ const { children, ...other } = this.props;
31
+ return <TextInput {...other} />;
32
+ },
33
+ });
34
+ export default Component;