@rbxts/react-clean-ui 1.0.5
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 +3 -0
- package/out/Components/Decorator/BoxShadow.d.ts +10 -0
- package/out/Components/Decorator/BoxShadow.luau +41 -0
- package/out/Components/Decorator/Corners.d.ts +7 -0
- package/out/Components/Decorator/Corners.luau +15 -0
- package/out/Components/Decorator/Padding.d.ts +3 -0
- package/out/Components/Decorator/Padding.luau +18 -0
- package/out/Components/Decorator/index.d.ts +3 -0
- package/out/Components/Decorator/init.luau +13 -0
- package/out/Components/Input/Button.d.ts +24 -0
- package/out/Components/Input/Button.luau +159 -0
- package/out/Components/Input/Checkbox.d.ts +12 -0
- package/out/Components/Input/Checkbox.luau +79 -0
- package/out/Components/Input/HoverButton.d.ts +16 -0
- package/out/Components/Input/HoverButton.luau +127 -0
- package/out/Components/Input/Input.d.ts +12 -0
- package/out/Components/Input/Input.luau +92 -0
- package/out/Components/Input/Select.d.ts +30 -0
- package/out/Components/Input/Select.luau +288 -0
- package/out/Components/Input/Slider.d.ts +51 -0
- package/out/Components/Input/Slider.luau +415 -0
- package/out/Components/Input/index.d.ts +6 -0
- package/out/Components/Input/init.luau +22 -0
- package/out/Components/Layout/Column.d.ts +13 -0
- package/out/Components/Layout/Column.luau +60 -0
- package/out/Components/Layout/Container.d.ts +6 -0
- package/out/Components/Layout/Container.luau +73 -0
- package/out/Components/Layout/Draggable.d.ts +46 -0
- package/out/Components/Layout/Draggable.luau +315 -0
- package/out/Components/Layout/Droppable.d.ts +10 -0
- package/out/Components/Layout/Droppable.luau +34 -0
- package/out/Components/Layout/Fieldset.d.ts +34 -0
- package/out/Components/Layout/Fieldset.luau +130 -0
- package/out/Components/Layout/FlexItem.d.ts +11 -0
- package/out/Components/Layout/FlexItem.luau +20 -0
- package/out/Components/Layout/Group.d.ts +34 -0
- package/out/Components/Layout/Group.luau +168 -0
- package/out/Components/Layout/HStack.d.ts +12 -0
- package/out/Components/Layout/HStack.luau +21 -0
- package/out/Components/Layout/Row.d.ts +15 -0
- package/out/Components/Layout/Row.luau +87 -0
- package/out/Components/Layout/Scroller.d.ts +7 -0
- package/out/Components/Layout/Scroller.luau +54 -0
- package/out/Components/Layout/Tabs.d.ts +31 -0
- package/out/Components/Layout/Tabs.luau +189 -0
- package/out/Components/Layout/VStack.d.ts +11 -0
- package/out/Components/Layout/VStack.luau +21 -0
- package/out/Components/Layout/index.d.ts +12 -0
- package/out/Components/Layout/init.luau +40 -0
- package/out/Components/Navigation/Menu.d.ts +19 -0
- package/out/Components/Navigation/Menu.luau +91 -0
- package/out/Components/Navigation/index.d.ts +1 -0
- package/out/Components/Navigation/init.luau +7 -0
- package/out/Components/Surface/Box.d.ts +7 -0
- package/out/Components/Surface/Box.luau +50 -0
- package/out/Components/Surface/Card.d.ts +25 -0
- package/out/Components/Surface/Card.luau +138 -0
- package/out/Components/Surface/Icon.d.ts +10 -0
- package/out/Components/Surface/Icon.luau +64 -0
- package/out/Components/Surface/Panel.d.ts +4 -0
- package/out/Components/Surface/Panel.luau +33 -0
- package/out/Components/Surface/index.d.ts +4 -0
- package/out/Components/Surface/init.luau +16 -0
- package/out/Components/Typography/Text.d.ts +18 -0
- package/out/Components/Typography/Text.luau +48 -0
- package/out/Components/Typography/index.d.ts +1 -0
- package/out/Components/Typography/init.luau +7 -0
- package/out/Components/index.d.ts +8 -0
- package/out/Components/init.luau +28 -0
- package/out/Contexts/draggable.context.d.ts +8 -0
- package/out/Contexts/draggable.context.luau +7 -0
- package/out/Contexts/droppable.context.d.ts +6 -0
- package/out/Contexts/droppable.context.luau +7 -0
- package/out/Contexts/index.d.ts +6 -0
- package/out/Contexts/init.luau +22 -0
- package/out/Contexts/navigation.context.d.ts +5 -0
- package/out/Contexts/navigation.context.luau +9 -0
- package/out/Contexts/overlay.context.d.ts +13 -0
- package/out/Contexts/overlay.context.luau +17 -0
- package/out/Contexts/row.context.d.ts +9 -0
- package/out/Contexts/row.context.luau +12 -0
- package/out/Contexts/theme.context.d.ts +3 -0
- package/out/Contexts/theme.context.luau +8 -0
- package/out/Helpers/breakpoint.helper.d.ts +7 -0
- package/out/Helpers/breakpoint.helper.luau +124 -0
- package/out/Helpers/color.helper.d.ts +5 -0
- package/out/Helpers/color.helper.luau +101 -0
- package/out/Helpers/create-ui-story.d.ts +16 -0
- package/out/Helpers/create-ui-story.luau +38 -0
- package/out/Helpers/css.helper.d.ts +12 -0
- package/out/Helpers/css.helper.luau +114 -0
- package/out/Helpers/gui.helper.d.ts +10 -0
- package/out/Helpers/gui.helper.luau +134 -0
- package/out/Helpers/index.d.ts +8 -0
- package/out/Helpers/init.luau +28 -0
- package/out/Helpers/size.helper.d.ts +14 -0
- package/out/Helpers/size.helper.luau +162 -0
- package/out/Helpers/spacing.helper.d.ts +7 -0
- package/out/Helpers/spacing.helper.luau +57 -0
- package/out/Helpers/typography.helper.d.ts +7 -0
- package/out/Helpers/typography.helper.luau +91 -0
- package/out/Interfaces/clean.element.props.d.ts +109 -0
- package/out/Interfaces/clean.element.props.luau +5 -0
- package/out/Interfaces/icon.d.ts +2 -0
- package/out/Interfaces/icon.luau +2 -0
- package/out/Interfaces/index.d.ts +3 -0
- package/out/Interfaces/init.luau +13 -0
- package/out/Interfaces/userinput.d.ts +22 -0
- package/out/Interfaces/userinput.luau +8 -0
- package/out/Providers/index.d.ts +3 -0
- package/out/Providers/init.luau +13 -0
- package/out/Providers/overlay.provider.d.ts +3 -0
- package/out/Providers/overlay.provider.luau +25 -0
- package/out/Providers/registry.provider.d.ts +33 -0
- package/out/Providers/registry.provider.luau +119 -0
- package/out/Providers/theme.provider.d.ts +8 -0
- package/out/Providers/theme.provider.luau +12 -0
- package/out/Theme/CleanTheme.d.ts +169 -0
- package/out/Theme/CleanTheme.luau +2 -0
- package/out/Theme/DefaultIcons.d.ts +2 -0
- package/out/Theme/DefaultIcons.luau +791 -0
- package/out/Theme/index.d.ts +3 -0
- package/out/Theme/init.luau +13 -0
- package/out/Theme/themes/dark.theme.d.ts +2 -0
- package/out/Theme/themes/dark.theme.luau +345 -0
- package/out/Theme/themes/default.theme.d.ts +2 -0
- package/out/Theme/themes/default.theme.luau +403 -0
- package/out/Theme/themes/index.d.ts +3 -0
- package/out/Theme/themes/init.luau +13 -0
- package/out/Theme/themes/sandstone.theme.d.ts +2 -0
- package/out/Theme/themes/sandstone.theme.luau +345 -0
- package/out/index.d.ts +6 -0
- package/out/init.luau +22 -0
- package/package.json +43 -0
package/README.md
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from "@rbxts/react";
|
|
2
|
+
import { CssShadow, ShadowElementProps } from "../../Interfaces/";
|
|
3
|
+
interface BoxShadowProps extends ShadowElementProps {
|
|
4
|
+
value?: CssShadow;
|
|
5
|
+
color?: Color3;
|
|
6
|
+
transparency?: number;
|
|
7
|
+
zindex?: number;
|
|
8
|
+
}
|
|
9
|
+
export declare function BoxShadow(props: BoxShadowProps): React.JSX.Element | undefined;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
local React = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
4
|
+
local CssHelper = TS.import(script, script.Parent.Parent.Parent, "Helpers").CssHelper
|
|
5
|
+
local CleanThemeContext = TS.import(script, script.Parent.Parent.Parent, "Contexts").CleanThemeContext
|
|
6
|
+
local function BoxShadow(props)
|
|
7
|
+
local theme = React.useContext(CleanThemeContext)
|
|
8
|
+
local shadowTheme = theme.components.boxShadow
|
|
9
|
+
local _condition = props["box-shadow"]
|
|
10
|
+
if _condition == nil then
|
|
11
|
+
_condition = props.value
|
|
12
|
+
end
|
|
13
|
+
local shadowValue = _condition
|
|
14
|
+
if shadowValue == nil then
|
|
15
|
+
return nil
|
|
16
|
+
end
|
|
17
|
+
local shadow = CssHelper:parseCssShadow(shadowValue)
|
|
18
|
+
if shadow == nil then
|
|
19
|
+
return nil
|
|
20
|
+
end
|
|
21
|
+
local _attributes = {
|
|
22
|
+
Offset = shadow.offset,
|
|
23
|
+
BlurRadius = shadow.blurRadius,
|
|
24
|
+
Spread = shadow.spread,
|
|
25
|
+
Color = props.color or shadowTheme.color,
|
|
26
|
+
}
|
|
27
|
+
local _condition_1 = props.transparency
|
|
28
|
+
if _condition_1 == nil then
|
|
29
|
+
_condition_1 = shadowTheme.transparency
|
|
30
|
+
end
|
|
31
|
+
_attributes.Transparency = _condition_1
|
|
32
|
+
local _condition_2 = props.zindex
|
|
33
|
+
if _condition_2 == nil then
|
|
34
|
+
_condition_2 = -1
|
|
35
|
+
end
|
|
36
|
+
_attributes.ZIndex = _condition_2
|
|
37
|
+
return React.createElement("uishadow", _attributes)
|
|
38
|
+
end
|
|
39
|
+
return {
|
|
40
|
+
BoxShadow = BoxShadow,
|
|
41
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
local React = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
4
|
+
local SizeHelper = TS.import(script, script.Parent.Parent.Parent, "Helpers").SizeHelper
|
|
5
|
+
local function Corners(props)
|
|
6
|
+
if props.radius == nil then
|
|
7
|
+
return nil
|
|
8
|
+
end
|
|
9
|
+
return React.createElement("uicorner", {
|
|
10
|
+
CornerRadius = SizeHelper:toUDim(props.radius),
|
|
11
|
+
})
|
|
12
|
+
end
|
|
13
|
+
return {
|
|
14
|
+
Corners = Corners,
|
|
15
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
local React = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
4
|
+
local CleanThemeContext = TS.import(script, script.Parent.Parent.Parent, "Contexts").CleanThemeContext
|
|
5
|
+
local SpacingHelper = TS.import(script, script.Parent.Parent.Parent, "Helpers").SpacingHelper
|
|
6
|
+
local function Padding(props)
|
|
7
|
+
local theme = React.useContext(CleanThemeContext)
|
|
8
|
+
local padding = if props.resolvedPadding ~= nil then props.resolvedPadding else SpacingHelper:GetResolvedPadding(theme, props)
|
|
9
|
+
return React.createElement("uipadding", {
|
|
10
|
+
PaddingTop = UDim.new(0, padding.top),
|
|
11
|
+
PaddingBottom = UDim.new(0, padding.bottom),
|
|
12
|
+
PaddingLeft = UDim.new(0, padding.left),
|
|
13
|
+
PaddingRight = UDim.new(0, padding.right),
|
|
14
|
+
})
|
|
15
|
+
end
|
|
16
|
+
return {
|
|
17
|
+
Padding = Padding,
|
|
18
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
local exports = {}
|
|
4
|
+
for _k, _v in TS.import(script, script, "BoxShadow") or {} do
|
|
5
|
+
exports[_k] = _v
|
|
6
|
+
end
|
|
7
|
+
for _k, _v in TS.import(script, script, "Corners") or {} do
|
|
8
|
+
exports[_k] = _v
|
|
9
|
+
end
|
|
10
|
+
for _k, _v in TS.import(script, script, "Padding") or {} do
|
|
11
|
+
exports[_k] = _v
|
|
12
|
+
end
|
|
13
|
+
return exports
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React, { Component } from "@rbxts/react";
|
|
2
|
+
import { BackgroundElementProps, IconElementProps, IntentElementProps, ScalableElementProps, ShadowElementProps, SpacedElementProps, ZIndexElementProps } from "../../Interfaces/";
|
|
3
|
+
import { IconProps } from "../Surface";
|
|
4
|
+
export interface ButtonProps extends SpacedElementProps, ShadowElementProps, ZIndexElementProps, BackgroundElementProps, IntentElementProps, ScalableElementProps, IconElementProps {
|
|
5
|
+
text?: string;
|
|
6
|
+
fontWeight?: Enum.FontWeight;
|
|
7
|
+
Event?: React.InstanceEvent<ImageButton>;
|
|
8
|
+
children?: React.ReactNode;
|
|
9
|
+
group?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface ButtonTextProps extends ScalableElementProps, IntentElementProps {
|
|
12
|
+
children?: string;
|
|
13
|
+
text: string;
|
|
14
|
+
}
|
|
15
|
+
declare function ButtonText(props: ButtonTextProps): React.JSX.Element;
|
|
16
|
+
export interface ButtonIconProps extends IconProps, IntentElementProps {
|
|
17
|
+
}
|
|
18
|
+
declare function ButtonIcon(props: ButtonIconProps): React.JSX.Element;
|
|
19
|
+
export declare class Button extends Component<ButtonProps> {
|
|
20
|
+
static Text: typeof ButtonText;
|
|
21
|
+
static Icon: typeof ButtonIcon;
|
|
22
|
+
render(): React.ReactNode;
|
|
23
|
+
}
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
local _react = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
4
|
+
local React = _react
|
|
5
|
+
local Component = _react.Component
|
|
6
|
+
local ReactComponent = _react.ReactComponent
|
|
7
|
+
local CleanThemeContext = TS.import(script, script.Parent.Parent.Parent, "Contexts").CleanThemeContext
|
|
8
|
+
local _Decorator = TS.import(script, script.Parent.Parent, "Decorator")
|
|
9
|
+
local BoxShadow = _Decorator.BoxShadow
|
|
10
|
+
local Corners = _Decorator.Corners
|
|
11
|
+
local Padding = _Decorator.Padding
|
|
12
|
+
local Text = TS.import(script, script.Parent.Parent, "Typography").Text
|
|
13
|
+
local _Helpers = TS.import(script, script.Parent.Parent.Parent, "Helpers")
|
|
14
|
+
local ColorHelper = _Helpers.ColorHelper
|
|
15
|
+
local SpacingHelper = _Helpers.SpacingHelper
|
|
16
|
+
local TypographyHelper = _Helpers.TypographyHelper
|
|
17
|
+
local Icon = TS.import(script, script.Parent.Parent, "Surface").Icon
|
|
18
|
+
local HStack = TS.import(script, script.Parent.Parent, "Layout").HStack
|
|
19
|
+
local _ = TS.import(script, script.Parent.Parent, "Layout")
|
|
20
|
+
local Group = _.Group
|
|
21
|
+
local GroupContext = _.GroupContext
|
|
22
|
+
local function ButtonText(props)
|
|
23
|
+
local theme = React.useContext(CleanThemeContext)
|
|
24
|
+
return React.createElement(Text, {
|
|
25
|
+
text = props.text,
|
|
26
|
+
typography = TypographyHelper:getTypography(theme, props.scale, theme.components.button.typography),
|
|
27
|
+
TextColor3 = ColorHelper:getIntentColors(theme, props.intent, "default", theme.components.button.intents).textColor,
|
|
28
|
+
})
|
|
29
|
+
end
|
|
30
|
+
local function ButtonIcon(props)
|
|
31
|
+
local theme = React.useContext(CleanThemeContext)
|
|
32
|
+
return React.createElement(Icon, {
|
|
33
|
+
scale = props.scale,
|
|
34
|
+
icon = props.icon,
|
|
35
|
+
spinning = props.spinning,
|
|
36
|
+
speed = props.speed,
|
|
37
|
+
color = ColorHelper:getIntentColors(theme, props.intent, "default", theme.components.button.intents).textColor,
|
|
38
|
+
})
|
|
39
|
+
end
|
|
40
|
+
local function ButtonRender(props)
|
|
41
|
+
local theme = React.useContext(CleanThemeContext)
|
|
42
|
+
local hover, setHover = React.useState(false)
|
|
43
|
+
local group = React.useContext(GroupContext)
|
|
44
|
+
local padding = SpacingHelper:GetResolvedPadding(theme, props)
|
|
45
|
+
local _attributes = {}
|
|
46
|
+
local _object = {}
|
|
47
|
+
local _spread = props.Event
|
|
48
|
+
if _spread then
|
|
49
|
+
for _k, _v in _spread do
|
|
50
|
+
_object[_k] = _v
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
_object.MouseEnter = function(button, x, y)
|
|
54
|
+
setHover(true)
|
|
55
|
+
local _result = props.Event
|
|
56
|
+
if _result ~= nil then
|
|
57
|
+
_result = _result.MouseEnter
|
|
58
|
+
if _result ~= nil then
|
|
59
|
+
_result(button, x, y)
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
_object.MouseLeave = function(button, x, y)
|
|
64
|
+
setHover(false)
|
|
65
|
+
local _result = props.Event
|
|
66
|
+
if _result ~= nil then
|
|
67
|
+
_result = _result.MouseLeave
|
|
68
|
+
if _result ~= nil then
|
|
69
|
+
_result(button, x, y)
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
_attributes.Event = _object
|
|
74
|
+
local _result
|
|
75
|
+
if props.group then
|
|
76
|
+
local _result_1 = group
|
|
77
|
+
if _result_1 ~= nil then
|
|
78
|
+
_result_1 = _result_1.size
|
|
79
|
+
if _result_1 ~= nil then
|
|
80
|
+
_result_1 = _result_1.X
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
local _condition = _result_1
|
|
84
|
+
if _condition == nil then
|
|
85
|
+
_condition = 0
|
|
86
|
+
end
|
|
87
|
+
_result = _condition
|
|
88
|
+
else
|
|
89
|
+
_result = 0
|
|
90
|
+
end
|
|
91
|
+
_attributes.Size = UDim2.fromOffset(_result, 0)
|
|
92
|
+
_attributes.AutomaticSize = Enum.AutomaticSize.XY
|
|
93
|
+
local _condition = props.BackgroundTransparency
|
|
94
|
+
if _condition == nil then
|
|
95
|
+
_condition = theme.components.button.backgroundTransparency
|
|
96
|
+
end
|
|
97
|
+
_attributes.BackgroundTransparency = _condition
|
|
98
|
+
_attributes.BackgroundColor3 = ColorHelper:getIntentColors(theme, props.intent, if hover then "hover" else "default", theme.components.button.intents).backgroundColor
|
|
99
|
+
_attributes.AutoButtonColor = false
|
|
100
|
+
_attributes.ZIndex = props.ZIndex
|
|
101
|
+
local _exp = React.createElement(Corners, {
|
|
102
|
+
radius = theme.components.button.cornerRadius,
|
|
103
|
+
})
|
|
104
|
+
local _exp_1 = React.createElement("uistroke", {
|
|
105
|
+
Thickness = theme.components.button.borderThickness,
|
|
106
|
+
BorderStrokePosition = Enum.BorderStrokePosition.Inner,
|
|
107
|
+
Color = ColorHelper:getIntentColors(theme, props.intent, "default", theme.components.button.intents).borderColor,
|
|
108
|
+
})
|
|
109
|
+
local _attributes_1 = table.clone(props)
|
|
110
|
+
setmetatable(_attributes_1, nil)
|
|
111
|
+
_attributes_1.value = theme.components.button.boxShadow
|
|
112
|
+
local _exp_2 = React.createElement(BoxShadow, _attributes_1)
|
|
113
|
+
local _attributes_2 = table.clone(props)
|
|
114
|
+
setmetatable(_attributes_2, nil)
|
|
115
|
+
return React.createElement("imagebutton", _attributes, _exp, _exp_1, _exp_2, React.createElement(Padding, _attributes_2), React.createElement(Group.Element, {
|
|
116
|
+
enabled = props.group,
|
|
117
|
+
padding = padding,
|
|
118
|
+
}, (props.icon ~= nil or props.text ~= nil) and React.createElement(HStack, {
|
|
119
|
+
valign = "Center",
|
|
120
|
+
spacing = props.spacing,
|
|
121
|
+
}, props.icon ~= nil and React.createElement(ButtonIcon, {
|
|
122
|
+
scale = props.scale,
|
|
123
|
+
intent = props.intent,
|
|
124
|
+
icon = props.icon,
|
|
125
|
+
}), props.text ~= nil and React.createElement(ButtonText, {
|
|
126
|
+
text = props.text,
|
|
127
|
+
intent = props.intent,
|
|
128
|
+
scale = props.scale,
|
|
129
|
+
})), props.children))
|
|
130
|
+
end
|
|
131
|
+
local Button
|
|
132
|
+
do
|
|
133
|
+
local super = Component
|
|
134
|
+
Button = setmetatable({}, {
|
|
135
|
+
__tostring = function()
|
|
136
|
+
return "Button"
|
|
137
|
+
end,
|
|
138
|
+
__index = super,
|
|
139
|
+
})
|
|
140
|
+
Button.__index = Button
|
|
141
|
+
function Button.new(...)
|
|
142
|
+
local self = setmetatable({}, Button)
|
|
143
|
+
return self:constructor(...) or self
|
|
144
|
+
end
|
|
145
|
+
function Button:constructor(...)
|
|
146
|
+
super.constructor(self, ...)
|
|
147
|
+
end
|
|
148
|
+
function Button:render()
|
|
149
|
+
local _attributes = table.clone(self.props)
|
|
150
|
+
setmetatable(_attributes, nil)
|
|
151
|
+
return React.createElement(ButtonRender, _attributes)
|
|
152
|
+
end
|
|
153
|
+
Button.Text = ButtonText
|
|
154
|
+
Button.Icon = ButtonIcon
|
|
155
|
+
Button = ReactComponent(Button) or Button
|
|
156
|
+
end
|
|
157
|
+
return {
|
|
158
|
+
Button = Button,
|
|
159
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from "@rbxts/react";
|
|
2
|
+
import { BackgroundElementProps, IconName, Intent, IntentElementProps, PaddingProps, ScalableElementProps, SpacedElementProps } from "../../Interfaces";
|
|
3
|
+
interface CheckboxProps extends IntentElementProps, PaddingProps, BackgroundElementProps, SpacedElementProps, ScalableElementProps {
|
|
4
|
+
checked?: boolean;
|
|
5
|
+
onChange?: (value: boolean) => void;
|
|
6
|
+
'icon-checked'?: IconName;
|
|
7
|
+
'icon-unchecked'?: IconName;
|
|
8
|
+
'intent-checked'?: Intent;
|
|
9
|
+
'intent-unchecked'?: Intent;
|
|
10
|
+
}
|
|
11
|
+
export declare function Checkbox(props: CheckboxProps): React.JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
local React = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
4
|
+
local Icon = TS.import(script, script.Parent.Parent, "Surface").Icon
|
|
5
|
+
local CleanThemeContext = TS.import(script, script.Parent.Parent.Parent, "Contexts").CleanThemeContext
|
|
6
|
+
local FieldsetContext = TS.import(script, script.Parent.Parent, "Layout").FieldsetContext
|
|
7
|
+
local _Decorator = TS.import(script, script.Parent.Parent, "Decorator")
|
|
8
|
+
local Corners = _Decorator.Corners
|
|
9
|
+
local Padding = _Decorator.Padding
|
|
10
|
+
local _Helpers = TS.import(script, script.Parent.Parent.Parent, "Helpers")
|
|
11
|
+
local ColorHelper = _Helpers.ColorHelper
|
|
12
|
+
local SpacingHelper = _Helpers.SpacingHelper
|
|
13
|
+
local function Checkbox(props)
|
|
14
|
+
local theme = React.useContext(CleanThemeContext)
|
|
15
|
+
local fieldset = React.useContext(FieldsetContext)
|
|
16
|
+
local _condition = props.checked
|
|
17
|
+
if _condition == nil then
|
|
18
|
+
_condition = false
|
|
19
|
+
end
|
|
20
|
+
local checked, setChecked = React.useState(_condition)
|
|
21
|
+
React.useEffect(function()
|
|
22
|
+
if not fieldset then
|
|
23
|
+
return nil
|
|
24
|
+
end
|
|
25
|
+
local _connection = fieldset.labelActivated
|
|
26
|
+
if _connection ~= nil then
|
|
27
|
+
_connection = _connection.Event:Connect(function()
|
|
28
|
+
setChecked(function(current)
|
|
29
|
+
return not current
|
|
30
|
+
end)
|
|
31
|
+
end)
|
|
32
|
+
end
|
|
33
|
+
local connection = _connection
|
|
34
|
+
return function()
|
|
35
|
+
local _result = connection
|
|
36
|
+
if _result ~= nil then
|
|
37
|
+
_result:Disconnect()
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end, { fieldset })
|
|
41
|
+
React.useEffect(function()
|
|
42
|
+
local _result = props.onChange
|
|
43
|
+
if _result ~= nil then
|
|
44
|
+
_result(checked)
|
|
45
|
+
end
|
|
46
|
+
end, { checked })
|
|
47
|
+
local _attributes = {
|
|
48
|
+
Size = UDim2.fromOffset(0, 0),
|
|
49
|
+
AutomaticSize = Enum.AutomaticSize.XY,
|
|
50
|
+
Event = {
|
|
51
|
+
Activated = function()
|
|
52
|
+
setChecked(not checked)
|
|
53
|
+
end,
|
|
54
|
+
},
|
|
55
|
+
}
|
|
56
|
+
local _condition_1 = props.BackgroundTransparency
|
|
57
|
+
if _condition_1 == nil then
|
|
58
|
+
_condition_1 = theme.components.button.backgroundTransparency
|
|
59
|
+
end
|
|
60
|
+
_attributes.BackgroundTransparency = _condition_1
|
|
61
|
+
_attributes.BackgroundColor3 = ColorHelper:getIntentColors(theme, props.intent, "default", theme.components.button.intents).backgroundColor
|
|
62
|
+
_attributes.AutoButtonColor = false
|
|
63
|
+
return React.createElement("imagebutton", _attributes, React.createElement(Corners, {
|
|
64
|
+
radius = theme.components.checkbox.cornerRadius,
|
|
65
|
+
}), React.createElement("uistroke", {
|
|
66
|
+
Thickness = theme.components.button.borderThickness,
|
|
67
|
+
BorderStrokePosition = Enum.BorderStrokePosition.Inner,
|
|
68
|
+
Color = ColorHelper:getIntentColors(theme, if checked then props["intent-checked"] or "success" else props["intent-unchecked"] or "primary", "default", theme.components.checkbox.intents).borderColor,
|
|
69
|
+
}), React.createElement(Padding, {
|
|
70
|
+
resolvedPadding = SpacingHelper:GetResolvedPadding(theme, props, theme.components.checkbox.spacing),
|
|
71
|
+
}), React.createElement(Icon, {
|
|
72
|
+
scale = props.scale,
|
|
73
|
+
icon = if checked then props["icon-checked"] or "check" else props["icon-unchecked"],
|
|
74
|
+
color = ColorHelper:getIntentColors(theme, if checked then props["intent-checked"] or "success" else props["intent-unchecked"] or "primary", "default", theme.components.checkbox.intents).textColor,
|
|
75
|
+
}))
|
|
76
|
+
end
|
|
77
|
+
return {
|
|
78
|
+
Checkbox = Checkbox,
|
|
79
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from "@rbxts/react";
|
|
2
|
+
export interface HoverButtonContextValue {
|
|
3
|
+
hover: boolean;
|
|
4
|
+
isSelected: boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare const HoverButtonContext: React.Context<HoverButtonContextValue | undefined>;
|
|
7
|
+
type ImageButtonProps = React.InstanceProps<ImageButton>;
|
|
8
|
+
interface HoverButtonProps {
|
|
9
|
+
default: ImageButtonProps;
|
|
10
|
+
hover?: ImageButtonProps;
|
|
11
|
+
focus?: ImageButtonProps;
|
|
12
|
+
isSelected?: boolean;
|
|
13
|
+
children?: React.ReactNode;
|
|
14
|
+
}
|
|
15
|
+
export declare function HoverButton(propSet: HoverButtonProps): React.JSX.Element;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
local React = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
4
|
+
local HoverButtonContext = React.createContext(nil)
|
|
5
|
+
local function HoverButton(propSet)
|
|
6
|
+
local hovering, setHovering = React.useState(false)
|
|
7
|
+
local state = if propSet.isSelected then "focus" elseif hovering then "hover" else "default"
|
|
8
|
+
local stateProps = propSet[state]
|
|
9
|
+
-- Object spreading into a new object is supported.
|
|
10
|
+
-- It is object rest destructuring that roblox-ts does not support.
|
|
11
|
+
local _object = table.clone(propSet.default)
|
|
12
|
+
setmetatable(_object, nil)
|
|
13
|
+
if stateProps then
|
|
14
|
+
for _k, _v in stateProps do
|
|
15
|
+
_object[_k] = _v
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
local props = _object
|
|
19
|
+
local defaultEvents = propSet.default.Event
|
|
20
|
+
local _stateEvents = stateProps
|
|
21
|
+
if _stateEvents ~= nil then
|
|
22
|
+
_stateEvents = _stateEvents.Event
|
|
23
|
+
end
|
|
24
|
+
local stateEvents = _stateEvents
|
|
25
|
+
local _attributes = {
|
|
26
|
+
Active = props.Active,
|
|
27
|
+
AnchorPoint = props.AnchorPoint,
|
|
28
|
+
Archivable = props.Archivable,
|
|
29
|
+
AutoButtonColor = props.AutoButtonColor,
|
|
30
|
+
AutomaticSize = props.AutomaticSize,
|
|
31
|
+
BackgroundColor3 = props.BackgroundColor3,
|
|
32
|
+
BackgroundTransparency = props.BackgroundTransparency,
|
|
33
|
+
BorderColor3 = props.BorderColor3,
|
|
34
|
+
BorderMode = props.BorderMode,
|
|
35
|
+
BorderSizePixel = props.BorderSizePixel,
|
|
36
|
+
ClipsDescendants = props.ClipsDescendants,
|
|
37
|
+
LayoutOrder = props.LayoutOrder,
|
|
38
|
+
NextSelectionDown = props.NextSelectionDown,
|
|
39
|
+
NextSelectionLeft = props.NextSelectionLeft,
|
|
40
|
+
NextSelectionRight = props.NextSelectionRight,
|
|
41
|
+
NextSelectionUp = props.NextSelectionUp,
|
|
42
|
+
Position = props.Position,
|
|
43
|
+
Rotation = props.Rotation,
|
|
44
|
+
Selectable = props.Selectable,
|
|
45
|
+
SelectionBehaviorDown = props.SelectionBehaviorDown,
|
|
46
|
+
SelectionBehaviorLeft = props.SelectionBehaviorLeft,
|
|
47
|
+
SelectionBehaviorRight = props.SelectionBehaviorRight,
|
|
48
|
+
SelectionBehaviorUp = props.SelectionBehaviorUp,
|
|
49
|
+
SelectionGroup = props.SelectionGroup,
|
|
50
|
+
Size = props.Size,
|
|
51
|
+
SizeConstraint = props.SizeConstraint,
|
|
52
|
+
Visible = props.Visible,
|
|
53
|
+
ZIndex = props.ZIndex,
|
|
54
|
+
Image = props.Image,
|
|
55
|
+
ImageColor3 = props.ImageColor3,
|
|
56
|
+
ImageRectOffset = props.ImageRectOffset,
|
|
57
|
+
ImageRectSize = props.ImageRectSize,
|
|
58
|
+
ImageTransparency = props.ImageTransparency,
|
|
59
|
+
ResampleMode = props.ResampleMode,
|
|
60
|
+
ScaleType = props.ScaleType,
|
|
61
|
+
SliceCenter = props.SliceCenter,
|
|
62
|
+
SliceScale = props.SliceScale,
|
|
63
|
+
TileSize = props.TileSize,
|
|
64
|
+
}
|
|
65
|
+
local _object_1 = {}
|
|
66
|
+
if defaultEvents then
|
|
67
|
+
for _k, _v in defaultEvents do
|
|
68
|
+
_object_1[_k] = _v
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
if stateEvents then
|
|
72
|
+
for _k, _v in stateEvents do
|
|
73
|
+
_object_1[_k] = _v
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
_object_1.MouseEnter = function(button, x, y)
|
|
77
|
+
setHovering(true)
|
|
78
|
+
local _result = stateEvents
|
|
79
|
+
if _result ~= nil then
|
|
80
|
+
_result = _result.MouseEnter
|
|
81
|
+
if _result ~= nil then
|
|
82
|
+
_result(button, x, y)
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
if stateEvents ~= defaultEvents then
|
|
86
|
+
local _result_1 = defaultEvents
|
|
87
|
+
if _result_1 ~= nil then
|
|
88
|
+
_result_1 = _result_1.MouseEnter
|
|
89
|
+
if _result_1 ~= nil then
|
|
90
|
+
_result_1(button, x, y)
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
_object_1.MouseLeave = function(button, x, y)
|
|
96
|
+
setHovering(false)
|
|
97
|
+
local _result = stateEvents
|
|
98
|
+
if _result ~= nil then
|
|
99
|
+
_result = _result.MouseLeave
|
|
100
|
+
if _result ~= nil then
|
|
101
|
+
_result(button, x, y)
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
if stateEvents ~= defaultEvents then
|
|
105
|
+
local _result_1 = defaultEvents
|
|
106
|
+
if _result_1 ~= nil then
|
|
107
|
+
_result_1 = _result_1.MouseLeave
|
|
108
|
+
if _result_1 ~= nil then
|
|
109
|
+
_result_1(button, x, y)
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
end
|
|
113
|
+
end
|
|
114
|
+
_attributes.Event = _object_1
|
|
115
|
+
_attributes.Change = props.Change
|
|
116
|
+
_attributes.Tag = props.Tag
|
|
117
|
+
return React.createElement(HoverButtonContext.Provider, {
|
|
118
|
+
value = {
|
|
119
|
+
hover = hovering,
|
|
120
|
+
isSelected = propSet.isSelected == true,
|
|
121
|
+
},
|
|
122
|
+
}, React.createElement("imagebutton", _attributes, propSet.children))
|
|
123
|
+
end
|
|
124
|
+
return {
|
|
125
|
+
HoverButton = HoverButton,
|
|
126
|
+
HoverButtonContext = HoverButtonContext,
|
|
127
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from "@rbxts/react";
|
|
2
|
+
import { ScalableElementProps, SpacedElementProps } from "../../Interfaces";
|
|
3
|
+
interface InputProps extends ScalableElementProps, SpacedElementProps, React.InstanceProps<TextBox> {
|
|
4
|
+
value: string;
|
|
5
|
+
placeholder?: string;
|
|
6
|
+
validation?: "Number" | "String" | "None" | "Int";
|
|
7
|
+
onChange?: (value: string) => void;
|
|
8
|
+
Event?: React.InstanceEvent<TextBox>;
|
|
9
|
+
controlled?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare function Input(props: InputProps): React.JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
local _react = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
4
|
+
local React = _react
|
|
5
|
+
local useRef = _react.useRef
|
|
6
|
+
local useState = _react.useState
|
|
7
|
+
local CleanThemeContext = TS.import(script, script.Parent.Parent.Parent, "Contexts").CleanThemeContext
|
|
8
|
+
local TypographyHelper = TS.import(script, script.Parent.Parent.Parent, "Helpers").TypographyHelper
|
|
9
|
+
local _Decorator = TS.import(script, script.Parent.Parent, "Decorator")
|
|
10
|
+
local Corners = _Decorator.Corners
|
|
11
|
+
local Padding = _Decorator.Padding
|
|
12
|
+
local FieldsetContext = TS.import(script, script.Parent.Parent, "Layout").FieldsetContext
|
|
13
|
+
local function Input(props)
|
|
14
|
+
local theme = React.useContext(CleanThemeContext)
|
|
15
|
+
local fieldset = React.useContext(FieldsetContext)
|
|
16
|
+
local _labelActivated = fieldset
|
|
17
|
+
if _labelActivated ~= nil then
|
|
18
|
+
_labelActivated = _labelActivated.labelActivated
|
|
19
|
+
end
|
|
20
|
+
local labelActivated = _labelActivated
|
|
21
|
+
local ref = useRef()
|
|
22
|
+
local value, setValue = useState(props.value)
|
|
23
|
+
local typography = TypographyHelper:getTypography(theme, props.scale, theme.components.input.typography)
|
|
24
|
+
React.useEffect(function()
|
|
25
|
+
if not labelActivated then
|
|
26
|
+
return nil
|
|
27
|
+
end
|
|
28
|
+
local connection = labelActivated.Event:Connect(function()
|
|
29
|
+
local _result = ref.current
|
|
30
|
+
if _result ~= nil then
|
|
31
|
+
_result:CaptureFocus()
|
|
32
|
+
end
|
|
33
|
+
end)
|
|
34
|
+
return function()
|
|
35
|
+
return connection:Disconnect()
|
|
36
|
+
end
|
|
37
|
+
end, { labelActivated, ref })
|
|
38
|
+
local _exp = React.createElement("uistroke", {
|
|
39
|
+
Thickness = theme.components.input.borderThickness,
|
|
40
|
+
BorderStrokePosition = Enum.BorderStrokePosition.Inner,
|
|
41
|
+
Color = theme.components.input.borderColor,
|
|
42
|
+
})
|
|
43
|
+
local _exp_1 = React.createElement(Corners, {
|
|
44
|
+
radius = theme.components.input.cornerRadius,
|
|
45
|
+
})
|
|
46
|
+
local _attributes = table.clone(props)
|
|
47
|
+
setmetatable(_attributes, nil)
|
|
48
|
+
local _exp_2 = React.createElement(Padding, _attributes)
|
|
49
|
+
local _attributes_1 = {
|
|
50
|
+
ref = ref,
|
|
51
|
+
Size = UDim2.fromScale(1, 0),
|
|
52
|
+
BackgroundTransparency = 1,
|
|
53
|
+
AutomaticSize = Enum.AutomaticSize.Y,
|
|
54
|
+
TextXAlignment = props.TextXAlignment or Enum.TextXAlignment.Left,
|
|
55
|
+
FontFace = Font.fromName(typography.font.Name, typography.weight or Enum.FontWeight.Regular),
|
|
56
|
+
FontSize = typography.size,
|
|
57
|
+
}
|
|
58
|
+
local _condition = props.PlaceholderText
|
|
59
|
+
if _condition == nil then
|
|
60
|
+
_condition = props.placeholder
|
|
61
|
+
end
|
|
62
|
+
_attributes_1.PlaceholderText = _condition
|
|
63
|
+
_attributes_1.PlaceholderColor3 = props.PlaceholderColor3
|
|
64
|
+
_attributes_1.TextScaled = props.TextScaled
|
|
65
|
+
_attributes_1.LineHeight = typography.lineHeight
|
|
66
|
+
_attributes_1.Text = if props.controlled then props.value else value
|
|
67
|
+
_attributes_1.TextColor3 = props.TextColor3 or theme.colors.intents.primary.default.textColor
|
|
68
|
+
_attributes_1.ClearTextOnFocus = false
|
|
69
|
+
_attributes_1.Event = props.Event
|
|
70
|
+
_attributes_1.Change = {
|
|
71
|
+
Text = function(rbx)
|
|
72
|
+
local number = tonumber(rbx.Text)
|
|
73
|
+
if (props.validation == "Number" or props.validation == "Int") and number == nil and rbx.Text ~= "" and rbx.Text ~= "-" then
|
|
74
|
+
ref.current.Text = props.value
|
|
75
|
+
return nil
|
|
76
|
+
end
|
|
77
|
+
setValue(rbx.Text)
|
|
78
|
+
local _result = props.onChange
|
|
79
|
+
if _result ~= nil then
|
|
80
|
+
_result(rbx.Text)
|
|
81
|
+
end
|
|
82
|
+
end,
|
|
83
|
+
}
|
|
84
|
+
return React.createElement("frame", {
|
|
85
|
+
Size = UDim2.fromScale(1, 0),
|
|
86
|
+
AutomaticSize = Enum.AutomaticSize.Y,
|
|
87
|
+
BackgroundTransparency = 1,
|
|
88
|
+
}, _exp, _exp_1, _exp_2, React.createElement("textbox", _attributes_1))
|
|
89
|
+
end
|
|
90
|
+
return {
|
|
91
|
+
Input = Input,
|
|
92
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React, { Component } from "@rbxts/react";
|
|
2
|
+
import { CssSize, ScalableElementProps, SpacedElementProps } from "../../Interfaces";
|
|
3
|
+
interface SelectProps extends ScalableElementProps, SpacedElementProps, React.InstanceProps<TextBox> {
|
|
4
|
+
selected?: number;
|
|
5
|
+
'max-height'?: CssSize;
|
|
6
|
+
onChange?: (selected: number, value?: string) => void;
|
|
7
|
+
Event?: React.InstanceEvent<TextBox>;
|
|
8
|
+
}
|
|
9
|
+
interface SelectState {
|
|
10
|
+
selected: number;
|
|
11
|
+
open: boolean;
|
|
12
|
+
dropdownSize: UDim2;
|
|
13
|
+
dropdownPosition: UDim2;
|
|
14
|
+
}
|
|
15
|
+
interface SelectOptionProps {
|
|
16
|
+
text?: string;
|
|
17
|
+
children?: React.ReactNode;
|
|
18
|
+
Event?: React.InstanceEvent<ImageButton>;
|
|
19
|
+
index?: number;
|
|
20
|
+
value?: string;
|
|
21
|
+
BackgroundColor3?: Color3;
|
|
22
|
+
}
|
|
23
|
+
declare function SelectOption(props: SelectOptionProps): React.JSX.Element;
|
|
24
|
+
export declare class Select extends Component<SelectProps, SelectState> {
|
|
25
|
+
static Option: typeof SelectOption;
|
|
26
|
+
state: SelectState;
|
|
27
|
+
private buttonRef;
|
|
28
|
+
render(): React.JSX.Element;
|
|
29
|
+
}
|
|
30
|
+
export {};
|