@rbxts/react-clean-ui 1.0.19 → 1.0.38
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/out/Components/Chart/BarChart.d.ts +47 -0
- package/out/Components/Chart/BarChart.luau +880 -0
- package/out/Components/Chart/Pie.luau +12 -12
- package/out/Components/Chart/index.d.ts +1 -0
- package/out/Components/Chart/init.luau +3 -0
- package/out/Components/Input/Button.d.ts +9 -0
- package/out/Components/Input/Button.luau +155 -46
- package/out/Components/Input/Checkbox.luau +21 -5
- package/out/Components/Input/Increment.d.ts +11 -0
- package/out/Components/Input/Increment.luau +107 -0
- package/out/Components/Input/Increment.step.d.ts +1 -0
- package/out/Components/Input/Increment.step.luau +25 -0
- package/out/Components/Input/Input.d.ts +4 -3
- package/out/Components/Input/Input.luau +124 -17
- package/out/Components/Input/Input.validation.d.ts +3 -0
- package/out/Components/Input/Input.validation.luau +21 -0
- package/out/Components/Input/Select.d.ts +4 -3
- package/out/Components/Input/Select.luau +23 -18
- package/out/Components/Input/Slider.d.ts +1 -1
- package/out/Components/Input/Slider.luau +68 -34
- package/out/Components/Input/index.d.ts +1 -0
- package/out/Components/Input/init.luau +3 -0
- package/out/Components/Interaction/Toast.d.ts +1 -1
- package/out/Components/Interaction/Toast.luau +4 -4
- package/out/Components/Interaction/Tooltip.d.ts +1 -1
- package/out/Components/Interaction/Tooltip.luau +8 -1
- package/out/Components/Layout/Accordion.d.ts +34 -0
- package/out/Components/Layout/Accordion.luau +431 -0
- package/out/Components/Layout/Container.d.ts +4 -2
- package/out/Components/Layout/Container.luau +32 -7
- package/out/Components/Layout/Draggable.luau +1 -1
- package/out/Components/Layout/Fieldset.d.ts +1 -1
- package/out/Components/Layout/FlexItem.d.ts +2 -1
- package/out/Components/Layout/FlexItem.luau +1 -0
- package/out/Components/Layout/HStack.d.ts +2 -1
- package/out/Components/Layout/HStack.luau +1 -2
- package/out/Components/Layout/Scroller.d.ts +1 -0
- package/out/Components/Layout/Scroller.luau +1 -1
- package/out/Components/Layout/Tabs.d.ts +1 -1
- package/out/Components/Layout/Tabs.luau +37 -7
- package/out/Components/Layout/VStack.d.ts +4 -1
- package/out/Components/Layout/VStack.luau +2 -2
- package/out/Components/Layout/index.d.ts +1 -0
- package/out/Components/Layout/init.luau +3 -0
- package/out/Components/Navigation/Menu.d.ts +1 -1
- package/out/Components/Surface/Box.d.ts +5 -3
- package/out/Components/Surface/Box.luau +12 -3
- package/out/Components/Surface/Card.d.ts +8 -6
- package/out/Components/Surface/Card.luau +430 -26
- package/out/Components/Surface/Icon.d.ts +1 -1
- package/out/Components/Surface/Icon.luau +43 -4
- package/out/Components/Typography/Text.d.ts +1 -0
- package/out/Components/Typography/Text.luau +135 -13
- package/out/Contexts/row.context.d.ts +1 -1
- package/out/Contexts/theme.context.d.ts +2 -2
- package/out/Helpers/color.helper.d.ts +5 -3
- package/out/Helpers/color.helper.luau +62 -34
- package/out/Helpers/create-ui-story.d.ts +8 -6
- package/out/Helpers/create-ui-story.luau +48 -5
- package/out/Helpers/css.helper.d.ts +28 -2
- package/out/Helpers/css.helper.luau +208 -0
- package/out/Helpers/index.d.ts +1 -0
- package/out/Helpers/init.luau +3 -0
- package/out/Helpers/size.helper.d.ts +3 -1
- package/out/Helpers/size.helper.luau +10 -9
- package/out/Helpers/spacing.helper.d.ts +3 -3
- package/out/Helpers/typography.helper.d.ts +2 -2
- package/out/Interfaces/css.types.d.ts +28 -0
- package/out/Interfaces/css.types.luau +17 -0
- package/out/Interfaces/element.props.d.ts +61 -0
- package/out/Interfaces/element.props.luau +1 -0
- package/out/Interfaces/index.d.ts +4 -2
- package/out/Interfaces/init.luau +9 -3
- package/out/Interfaces/responsive.types.d.ts +26 -0
- package/out/Interfaces/semantics.d.ts +3 -0
- package/out/Interfaces/semantics.luau +2 -0
- package/out/Providers/app.provider.d.ts +2 -2
- package/out/Providers/theme.provider.d.ts +2 -2
- package/out/Theme/index.d.ts +1 -0
- package/out/Theme/theme.factory.d.ts +3 -3
- package/out/Theme/theme.style.d.ts +48 -0
- package/out/Theme/theme.style.luau +1 -0
- package/out/Theme/theme.template.d.ts +90 -36
- package/out/Theme/themes/dark.theme.d.ts +1 -1
- package/out/Theme/themes/dark.theme.luau +73 -1
- package/out/Theme/themes/default.theme.d.ts +2 -2
- package/out/Theme/themes/default.theme.luau +122 -12
- package/out/Theme/themes/index.d.ts +1 -0
- package/out/Theme/themes/init.luau +3 -0
- package/out/Theme/themes/sandstone.theme.d.ts +1 -1
- package/out/Theme/themes/sandstone.theme.luau +81 -10
- package/out/Theme/themes/wooden.theme.d.ts +1 -0
- package/out/Theme/themes/wooden.theme.luau +443 -0
- package/out/index.d.ts +8 -8
- package/package.json +20 -6
- package/out/Interfaces/clean.element.props.d.ts +0 -114
- /package/out/{Interfaces/userinput.d.ts → Helpers/input.helper.d.ts} +0 -0
- /package/out/{Interfaces/userinput.luau → Helpers/input.helper.luau} +0 -0
- /package/out/Interfaces/{clean.element.props.luau → responsive.types.luau} +0 -0
|
@@ -101,7 +101,7 @@ local function Pie(props)
|
|
|
101
101
|
local percent = v.value / totalValue
|
|
102
102
|
totalPercent += (percent / 2)
|
|
103
103
|
local fill = percent * 2
|
|
104
|
-
local color = v.color or theme.components.
|
|
104
|
+
local color = v.color or theme.components.charts.colors[index % #theme.components.charts.colors + 1]
|
|
105
105
|
if index == state.hover then
|
|
106
106
|
local _condition = props["hover-darken"]
|
|
107
107
|
if _condition == nil then
|
|
@@ -143,8 +143,8 @@ local function Pie(props)
|
|
|
143
143
|
if isTextLabel then
|
|
144
144
|
local text = if type(label) == "string" then label else (label.text)
|
|
145
145
|
local spacing = if type(label) == "string" then props["label-spacing"] else label.spacing
|
|
146
|
-
local background = if not (type(label) == "string") and label.BackgroundColor3 ~= nil then label.BackgroundColor3 else theme.components.pie.labels.backgroundColor or theme.components.box.backgroundColor
|
|
147
|
-
local border = if not (type(label) == "string") and label.BorderColor3 ~= nil then label.BorderColor3 else theme.components.pie.labels.borderColor or theme.components.box.borderColor
|
|
146
|
+
local background = if not (type(label) == "string") and label.BackgroundColor3 ~= nil then label.BackgroundColor3 else theme.components.charts.pie.labels.backgroundColor or theme.components.box.backgroundColor
|
|
147
|
+
local border = if not (type(label) == "string") and label.BorderColor3 ~= nil then label.BorderColor3 else theme.components.charts.pie.labels.borderColor or theme.components.box.borderColor
|
|
148
148
|
local _attributes = {
|
|
149
149
|
Size = UDim2.fromScale(0, 0),
|
|
150
150
|
AutomaticSize = Enum.AutomaticSize.XY,
|
|
@@ -152,24 +152,24 @@ local function Pie(props)
|
|
|
152
152
|
Position = position,
|
|
153
153
|
BackgroundColor3 = background,
|
|
154
154
|
}
|
|
155
|
-
local _condition_1 = theme.components.pie.labels.backgroundTransparency
|
|
155
|
+
local _condition_1 = theme.components.charts.pie.labels.backgroundTransparency
|
|
156
156
|
if _condition_1 == nil then
|
|
157
157
|
_condition_1 = theme.components.box.backgroundTransparency
|
|
158
158
|
end
|
|
159
159
|
_attributes.BackgroundTransparency = _condition_1
|
|
160
160
|
local _exp_2 = React.createElement(Text, {
|
|
161
161
|
text = text,
|
|
162
|
-
typography = TypographyHelper:getTypography(theme, "md", theme.components.pie.labels.typography),
|
|
162
|
+
typography = TypographyHelper:getTypography(theme, "md", theme.components.charts.pie.labels.typography),
|
|
163
163
|
})
|
|
164
164
|
local _attributes_1 = {}
|
|
165
|
-
local _condition_2 = theme.components.pie.labels.cornerRadius
|
|
165
|
+
local _condition_2 = theme.components.charts.pie.labels.cornerRadius
|
|
166
166
|
if _condition_2 == nil then
|
|
167
167
|
_condition_2 = theme.components.box.cornerRadius
|
|
168
168
|
end
|
|
169
169
|
_attributes_1.radius = _condition_2
|
|
170
170
|
local _exp_3 = React.createElement(Corners, _attributes_1)
|
|
171
171
|
local _attributes_2 = {}
|
|
172
|
-
local _condition_3 = theme.components.pie.labels.borderThickness
|
|
172
|
+
local _condition_3 = theme.components.charts.pie.labels.borderThickness
|
|
173
173
|
if _condition_3 == nil then
|
|
174
174
|
_condition_3 = theme.components.box.borderThickness
|
|
175
175
|
end
|
|
@@ -177,7 +177,7 @@ local function Pie(props)
|
|
|
177
177
|
_attributes_2.BorderStrokePosition = Enum.BorderStrokePosition.Inner
|
|
178
178
|
_attributes_2.Color = border
|
|
179
179
|
local _arg0_1 = React.createElement("frame", _attributes, _exp_2, _exp_3, React.createElement("uistroke", _attributes_2), React.createElement(Padding, {
|
|
180
|
-
resolvedPadding = SpacingHelper:ResolveNumberPadding(SpacingHelper:GetPadding(theme, spacing, theme.components.pie.labels.spacing)),
|
|
180
|
+
resolvedPadding = SpacingHelper:ResolveNumberPadding(SpacingHelper:GetPadding(theme, spacing, theme.components.charts.pie.labels.spacing)),
|
|
181
181
|
}), React.createElement(BoxShadow))
|
|
182
182
|
table.insert(labels, _arg0_1)
|
|
183
183
|
elseif label.content ~= nil then
|
|
@@ -198,8 +198,8 @@ local function Pie(props)
|
|
|
198
198
|
end
|
|
199
199
|
-- ▲ ReadonlyArray.forEach ▲
|
|
200
200
|
local shadowPadding
|
|
201
|
-
if theme.components.pie.boxShadow ~= nil then
|
|
202
|
-
local shadowParsed = CssHelper:parseCssShadow(theme.components.pie.boxShadow.shadow)
|
|
201
|
+
if theme.components.charts.pie.boxShadow ~= nil then
|
|
202
|
+
local shadowParsed = CssHelper:parseCssShadow(theme.components.charts.pie.boxShadow.shadow)
|
|
203
203
|
if shadowParsed ~= nil then
|
|
204
204
|
local shadowValue = shadowParsed.spread.X.Offset + shadowParsed.blurRadius.Offset
|
|
205
205
|
if shadowValue > 0 then
|
|
@@ -270,8 +270,8 @@ local function Pie(props)
|
|
|
270
270
|
changeHover(-1)
|
|
271
271
|
end,
|
|
272
272
|
},
|
|
273
|
-
}, segments, labels, theme.components.pie.boxShadow ~= nil and React.createElement(BoxShadow, {
|
|
274
|
-
completeShadow = theme.components.pie.boxShadow,
|
|
273
|
+
}, segments, labels, theme.components.charts.pie.boxShadow ~= nil and React.createElement(BoxShadow, {
|
|
274
|
+
completeShadow = theme.components.charts.pie.boxShadow,
|
|
275
275
|
}), React.createElement("uicorner", {
|
|
276
276
|
CornerRadius = UDim.new(1, 0),
|
|
277
277
|
})))
|
|
@@ -1,19 +1,28 @@
|
|
|
1
1
|
import React from "@rbxts/react";
|
|
2
2
|
import { BackgroundElementProps, IconElementProps, IntentElementProps, ScalableElementProps, ShadowElementProps, SpacedElementProps, ZIndexElementProps } from "../../Interfaces/";
|
|
3
3
|
import { IconProps } from "../Surface";
|
|
4
|
+
import { ThemeTemplate } from "../../Theme/theme.template";
|
|
5
|
+
export type ButtonStyleOverride = Partial<ThemeTemplate["components"]["button"]>;
|
|
4
6
|
export interface ButtonProps extends SpacedElementProps, ShadowElementProps, ZIndexElementProps, BackgroundElementProps, IntentElementProps, ScalableElementProps, IconElementProps {
|
|
5
7
|
text?: string;
|
|
6
8
|
fontWeight?: Enum.FontWeight;
|
|
7
9
|
Event?: React.InstanceEvent<ImageButton>;
|
|
8
10
|
children?: React.ReactNode;
|
|
9
11
|
group?: boolean;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
LayoutOrder?: number;
|
|
14
|
+
styleOverride?: ButtonStyleOverride;
|
|
10
15
|
}
|
|
11
16
|
export interface ButtonTextProps extends ScalableElementProps, IntentElementProps {
|
|
12
17
|
children?: string;
|
|
13
18
|
text: string;
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
styleOverride?: ButtonStyleOverride;
|
|
14
21
|
}
|
|
15
22
|
declare function ButtonText(props: ButtonTextProps): React.JSX.Element;
|
|
16
23
|
export interface ButtonIconProps extends IconProps, IntentElementProps {
|
|
24
|
+
disabled?: boolean;
|
|
25
|
+
styleOverride?: ButtonStyleOverride;
|
|
17
26
|
}
|
|
18
27
|
declare function ButtonIcon(props: ButtonIconProps): React.JSX.Element;
|
|
19
28
|
type ButtonComponent = React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<ImageButton>> & {
|
|
@@ -9,6 +9,7 @@ local Padding = _Decorator.Padding
|
|
|
9
9
|
local Text = TS.import(script, script.Parent.Parent, "Typography").Text
|
|
10
10
|
local _Helpers = TS.import(script, script.Parent.Parent.Parent, "Helpers")
|
|
11
11
|
local ColorHelper = _Helpers.ColorHelper
|
|
12
|
+
local CssHelper = _Helpers.CssHelper
|
|
12
13
|
local SpacingHelper = _Helpers.SpacingHelper
|
|
13
14
|
local TypographyHelper = _Helpers.TypographyHelper
|
|
14
15
|
local Icon = TS.import(script, script.Parent.Parent, "Surface").Icon
|
|
@@ -18,29 +19,77 @@ local Group = _.Group
|
|
|
18
19
|
local GroupContext = _.GroupContext
|
|
19
20
|
local function ButtonText(props)
|
|
20
21
|
local theme = React.useContext(CleanThemeContext)
|
|
21
|
-
|
|
22
|
+
local _attributes = {
|
|
22
23
|
text = props.text,
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
24
|
+
}
|
|
25
|
+
local _exp = props.scale
|
|
26
|
+
local _object = {}
|
|
27
|
+
local _spread = theme.components.button.typography
|
|
28
|
+
if _spread then
|
|
29
|
+
for _k, _v in _spread do
|
|
30
|
+
_object[_k] = _v
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
local _result = props.styleOverride
|
|
34
|
+
if _result ~= nil then
|
|
35
|
+
_result = _result.typography
|
|
36
|
+
end
|
|
37
|
+
if _result then
|
|
38
|
+
for _k, _v in _result do
|
|
39
|
+
_object[_k] = _v
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
_attributes.typography = TypographyHelper:getTypography(theme, _exp, _object)
|
|
43
|
+
local _exp_1 = props.intent
|
|
44
|
+
local _exp_2 = if props.disabled then "disabled" else "default"
|
|
45
|
+
local _exp_3 = theme.components.button.intents
|
|
46
|
+
local _result_1 = props.styleOverride
|
|
47
|
+
if _result_1 ~= nil then
|
|
48
|
+
_result_1 = _result_1.intents
|
|
49
|
+
end
|
|
50
|
+
_attributes.TextColor3 = ColorHelper:getIntentColors(theme, _exp_1, _exp_2, _exp_3, _result_1).textColor
|
|
51
|
+
return React.createElement(Text, _attributes)
|
|
26
52
|
end
|
|
27
53
|
local function ButtonIcon(props)
|
|
28
54
|
local theme = React.useContext(CleanThemeContext)
|
|
29
|
-
|
|
55
|
+
local _attributes = {
|
|
30
56
|
scale = props.scale,
|
|
31
57
|
icon = props.icon,
|
|
32
58
|
spinning = props.spinning,
|
|
33
59
|
speed = props.speed,
|
|
34
|
-
|
|
35
|
-
|
|
60
|
+
}
|
|
61
|
+
local _exp = props.intent
|
|
62
|
+
local _exp_1 = if props.disabled then "disabled" else "default"
|
|
63
|
+
local _exp_2 = theme.components.button.intents
|
|
64
|
+
local _result = props.styleOverride
|
|
65
|
+
if _result ~= nil then
|
|
66
|
+
_result = _result.intents
|
|
67
|
+
end
|
|
68
|
+
_attributes.color = ColorHelper:getIntentColors(theme, _exp, _exp_1, _exp_2, _result).textColor
|
|
69
|
+
return React.createElement(Icon, _attributes)
|
|
36
70
|
end
|
|
37
71
|
local Button = React.forwardRef(function(props, ref)
|
|
38
72
|
local theme = React.useContext(CleanThemeContext)
|
|
39
73
|
local hover, setHover = React.useState(false)
|
|
74
|
+
React.useEffect(function()
|
|
75
|
+
if props.disabled then
|
|
76
|
+
setHover(false)
|
|
77
|
+
end
|
|
78
|
+
end, { props.disabled })
|
|
40
79
|
local group = React.useContext(GroupContext)
|
|
41
80
|
local padding = SpacingHelper:GetResolvedPadding(theme, props)
|
|
81
|
+
local state = if props.disabled then "disabled" elseif hover then "hover" else "default"
|
|
82
|
+
local _exp = props.intent
|
|
83
|
+
local _exp_1 = theme.components.button.intents
|
|
84
|
+
local _result = props.styleOverride
|
|
85
|
+
if _result ~= nil then
|
|
86
|
+
_result = _result.intents
|
|
87
|
+
end
|
|
88
|
+
local intentColors = ColorHelper:getIntentColors(theme, _exp, state, _exp_1, _result)
|
|
89
|
+
local backgroundImage = CssHelper:resolveBackgroundImage(intentColors.backgroundImage)
|
|
42
90
|
local _attributes = {
|
|
43
91
|
ref = ref,
|
|
92
|
+
Active = not props.disabled,
|
|
44
93
|
}
|
|
45
94
|
local _object = {}
|
|
46
95
|
local _spread = props.Event
|
|
@@ -50,81 +99,141 @@ local Button = React.forwardRef(function(props, ref)
|
|
|
50
99
|
end
|
|
51
100
|
end
|
|
52
101
|
_object.MouseEnter = function(button, x, y)
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
102
|
+
if not props.disabled then
|
|
103
|
+
setHover(true)
|
|
104
|
+
end
|
|
105
|
+
local _result_1 = props.Event
|
|
106
|
+
if _result_1 ~= nil then
|
|
107
|
+
_result_1 = _result_1.MouseEnter
|
|
108
|
+
if _result_1 ~= nil then
|
|
109
|
+
_result_1(button, x, y)
|
|
59
110
|
end
|
|
60
111
|
end
|
|
61
112
|
end
|
|
62
113
|
_object.MouseLeave = function(button, x, y)
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
114
|
+
if not props.disabled then
|
|
115
|
+
setHover(false)
|
|
116
|
+
end
|
|
117
|
+
local _result_1 = props.Event
|
|
118
|
+
if _result_1 ~= nil then
|
|
119
|
+
_result_1 = _result_1.MouseLeave
|
|
120
|
+
if _result_1 ~= nil then
|
|
121
|
+
_result_1(button, x, y)
|
|
69
122
|
end
|
|
70
123
|
end
|
|
71
124
|
end
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
125
|
+
_object.Activated = function(button, inputObject, clickCount)
|
|
126
|
+
if props.disabled then
|
|
127
|
+
return nil
|
|
128
|
+
end
|
|
129
|
+
local _result_1 = props.Event
|
|
76
130
|
if _result_1 ~= nil then
|
|
77
|
-
_result_1 = _result_1.
|
|
131
|
+
_result_1 = _result_1.Activated
|
|
78
132
|
if _result_1 ~= nil then
|
|
79
|
-
_result_1
|
|
133
|
+
_result_1(button, inputObject, clickCount)
|
|
134
|
+
end
|
|
135
|
+
end
|
|
136
|
+
end
|
|
137
|
+
_attributes.Event = _object
|
|
138
|
+
local _result_1
|
|
139
|
+
if props.group then
|
|
140
|
+
local _result_2 = group
|
|
141
|
+
if _result_2 ~= nil then
|
|
142
|
+
_result_2 = _result_2.size
|
|
143
|
+
if _result_2 ~= nil then
|
|
144
|
+
_result_2 = _result_2.X
|
|
80
145
|
end
|
|
81
146
|
end
|
|
82
|
-
local _condition =
|
|
147
|
+
local _condition = _result_2
|
|
83
148
|
if _condition == nil then
|
|
84
149
|
_condition = 0
|
|
85
150
|
end
|
|
86
|
-
|
|
151
|
+
_result_1 = _condition
|
|
87
152
|
else
|
|
88
|
-
|
|
153
|
+
_result_1 = 0
|
|
89
154
|
end
|
|
90
|
-
_attributes.Size = UDim2.fromOffset(
|
|
155
|
+
_attributes.Size = UDim2.fromOffset(_result_1, 0)
|
|
91
156
|
_attributes.AutomaticSize = Enum.AutomaticSize.XY
|
|
92
157
|
local _condition = props.BackgroundTransparency
|
|
93
158
|
if _condition == nil then
|
|
94
|
-
|
|
159
|
+
local _result_2 = props.styleOverride
|
|
160
|
+
if _result_2 ~= nil then
|
|
161
|
+
_result_2 = _result_2.backgroundTransparency
|
|
162
|
+
end
|
|
163
|
+
_condition = _result_2
|
|
164
|
+
if _condition == nil then
|
|
165
|
+
_condition = theme.components.button.backgroundTransparency
|
|
166
|
+
end
|
|
95
167
|
end
|
|
96
168
|
_attributes.BackgroundTransparency = _condition
|
|
97
|
-
_attributes.BackgroundColor3 =
|
|
169
|
+
_attributes.BackgroundColor3 = intentColors.backgroundColor
|
|
98
170
|
_attributes.AutoButtonColor = false
|
|
171
|
+
_attributes.LayoutOrder = props.LayoutOrder
|
|
99
172
|
_attributes.ZIndex = props.ZIndex
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
}
|
|
108
|
-
local
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
local
|
|
113
|
-
|
|
114
|
-
|
|
173
|
+
_attributes.Image = backgroundImage.Image
|
|
174
|
+
_attributes.ImageColor3 = backgroundImage.ImageColor3
|
|
175
|
+
_attributes.ImageTransparency = backgroundImage.ImageTransparency
|
|
176
|
+
_attributes.ScaleType = backgroundImage.ScaleType
|
|
177
|
+
_attributes.SliceCenter = backgroundImage.SliceCenter
|
|
178
|
+
_attributes.SliceScale = backgroundImage.SliceScale
|
|
179
|
+
_attributes.TileSize = backgroundImage.TileSize
|
|
180
|
+
local _attributes_1 = {}
|
|
181
|
+
local _result_2 = props.styleOverride
|
|
182
|
+
if _result_2 ~= nil then
|
|
183
|
+
_result_2 = _result_2.cornerRadius
|
|
184
|
+
end
|
|
185
|
+
local _condition_1 = _result_2
|
|
186
|
+
if _condition_1 == nil then
|
|
187
|
+
_condition_1 = theme.components.button.cornerRadius
|
|
188
|
+
end
|
|
189
|
+
_attributes_1.radius = _condition_1
|
|
190
|
+
local _exp_2 = React.createElement(Corners, _attributes_1)
|
|
191
|
+
local _attributes_2 = {}
|
|
192
|
+
local _result_3 = props.styleOverride
|
|
193
|
+
if _result_3 ~= nil then
|
|
194
|
+
_result_3 = _result_3.borderThickness
|
|
195
|
+
end
|
|
196
|
+
local _condition_2 = _result_3
|
|
197
|
+
if _condition_2 == nil then
|
|
198
|
+
_condition_2 = theme.components.button.borderThickness
|
|
199
|
+
end
|
|
200
|
+
_attributes_2.Thickness = _condition_2
|
|
201
|
+
_attributes_2.BorderStrokePosition = Enum.BorderStrokePosition.Inner
|
|
202
|
+
_attributes_2.Color = intentColors.borderColor
|
|
203
|
+
local _exp_3 = React.createElement("uistroke", _attributes_2)
|
|
204
|
+
local _attributes_3 = table.clone(props)
|
|
205
|
+
setmetatable(_attributes_3, nil)
|
|
206
|
+
local _result_4 = props.styleOverride
|
|
207
|
+
if _result_4 ~= nil then
|
|
208
|
+
_result_4 = _result_4.boxShadow
|
|
209
|
+
end
|
|
210
|
+
local _condition_3 = _result_4
|
|
211
|
+
if _condition_3 == nil then
|
|
212
|
+
_condition_3 = theme.components.button.boxShadow
|
|
213
|
+
end
|
|
214
|
+
_attributes_3.value = _condition_3
|
|
215
|
+
local _exp_4 = React.createElement(BoxShadow, _attributes_3)
|
|
216
|
+
local _attributes_4 = table.clone(props)
|
|
217
|
+
setmetatable(_attributes_4, nil)
|
|
218
|
+
return React.createElement("imagebutton", _attributes, _exp_2, _exp_3, _exp_4, React.createElement(Padding, _attributes_4), React.createElement(Group.Element, {
|
|
115
219
|
enabled = props.group,
|
|
116
220
|
padding = padding,
|
|
117
221
|
}, (props.icon ~= nil or props.text ~= nil) and React.createElement(HStack, {
|
|
118
222
|
valign = "Center",
|
|
119
223
|
spacing = props.spacing,
|
|
224
|
+
Wraps = false,
|
|
120
225
|
}, props.icon ~= nil and React.createElement(ButtonIcon, {
|
|
121
226
|
scale = props.scale,
|
|
122
227
|
intent = props.intent,
|
|
228
|
+
disabled = props.disabled,
|
|
123
229
|
icon = props.icon,
|
|
230
|
+
styleOverride = props.styleOverride,
|
|
124
231
|
}), props.text ~= nil and React.createElement(ButtonText, {
|
|
125
232
|
text = props.text,
|
|
126
233
|
intent = props.intent,
|
|
234
|
+
disabled = props.disabled,
|
|
127
235
|
scale = props.scale,
|
|
236
|
+
styleOverride = props.styleOverride,
|
|
128
237
|
})), props.children))
|
|
129
238
|
end)
|
|
130
239
|
Button.Text = ButtonText
|
|
@@ -9,6 +9,7 @@ local Corners = _Decorator.Corners
|
|
|
9
9
|
local Padding = _Decorator.Padding
|
|
10
10
|
local _Helpers = TS.import(script, script.Parent.Parent.Parent, "Helpers")
|
|
11
11
|
local ColorHelper = _Helpers.ColorHelper
|
|
12
|
+
local CssHelper = _Helpers.CssHelper
|
|
12
13
|
local SpacingHelper = _Helpers.SpacingHelper
|
|
13
14
|
local function Checkbox(props)
|
|
14
15
|
local theme = React.useContext(CleanThemeContext)
|
|
@@ -44,6 +45,7 @@ local function Checkbox(props)
|
|
|
44
45
|
_result(checked)
|
|
45
46
|
end
|
|
46
47
|
end, { checked })
|
|
48
|
+
local backgroundImage = CssHelper:resolveBackgroundImage(theme.components.checkbox.backgroundImage)
|
|
47
49
|
local _attributes = {
|
|
48
50
|
Size = UDim2.fromOffset(0, 0),
|
|
49
51
|
AutomaticSize = Enum.AutomaticSize.XY,
|
|
@@ -60,13 +62,27 @@ local function Checkbox(props)
|
|
|
60
62
|
_attributes.BackgroundTransparency = _condition_1
|
|
61
63
|
_attributes.BackgroundColor3 = ColorHelper:getIntentColors(theme, props.intent, "default", theme.components.button.intents).backgroundColor
|
|
62
64
|
_attributes.AutoButtonColor = false
|
|
63
|
-
|
|
65
|
+
_attributes.Image = backgroundImage.Image
|
|
66
|
+
_attributes.ImageColor3 = backgroundImage.ImageColor3
|
|
67
|
+
_attributes.ImageTransparency = backgroundImage.ImageTransparency
|
|
68
|
+
_attributes.ScaleType = backgroundImage.ScaleType
|
|
69
|
+
_attributes.SliceCenter = backgroundImage.SliceCenter
|
|
70
|
+
_attributes.SliceScale = backgroundImage.SliceScale
|
|
71
|
+
_attributes.TileSize = backgroundImage.TileSize
|
|
72
|
+
local _exp = React.createElement(Corners, {
|
|
64
73
|
radius = theme.components.checkbox.cornerRadius,
|
|
65
|
-
})
|
|
66
|
-
|
|
74
|
+
})
|
|
75
|
+
local _attributes_1 = {
|
|
76
|
+
Thickness = theme.components.checkbox.borderThickness,
|
|
67
77
|
BorderStrokePosition = Enum.BorderStrokePosition.Inner,
|
|
68
|
-
|
|
69
|
-
|
|
78
|
+
}
|
|
79
|
+
local _condition_2 = theme.components.checkbox.borderTransparency
|
|
80
|
+
if _condition_2 == nil then
|
|
81
|
+
_condition_2 = 0
|
|
82
|
+
end
|
|
83
|
+
_attributes_1.Transparency = _condition_2
|
|
84
|
+
_attributes_1.Color = ColorHelper:getIntentColors(theme, if checked then props["intent-checked"] or "success" else props["intent-unchecked"] or "primary", "default", theme.components.checkbox.intents).borderColor
|
|
85
|
+
return React.createElement("imagebutton", _attributes, _exp, React.createElement("uistroke", _attributes_1), React.createElement(Padding, {
|
|
70
86
|
resolvedPadding = SpacingHelper:GetResolvedPadding(theme, props, theme.components.checkbox.spacing),
|
|
71
87
|
}), React.createElement(Icon, {
|
|
72
88
|
scale = props.scale,
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from "@rbxts/react";
|
|
2
|
+
import { IntentElementProps, ScalableElementProps, SpacedElementProps } from "../../Interfaces";
|
|
3
|
+
export interface IncrementProps extends ScalableElementProps, SpacedElementProps, IntentElementProps, React.InstanceProps<ImageLabel> {
|
|
4
|
+
value: number;
|
|
5
|
+
onChange?: (value: number) => void;
|
|
6
|
+
step?: number;
|
|
7
|
+
min?: number;
|
|
8
|
+
max?: number;
|
|
9
|
+
controlled?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare const Increment: React.ForwardRefExoticComponent<Omit<IncrementProps, "ref"> & React.RefAttributes<ImageLabel>>;
|
|
@@ -0,0 +1,107 @@
|
|
|
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 _Layout = TS.import(script, script.Parent.Parent, "Layout")
|
|
6
|
+
local Container = _Layout.Container
|
|
7
|
+
local FlexItem = _Layout.FlexItem
|
|
8
|
+
local HStack = _Layout.HStack
|
|
9
|
+
local Button = TS.import(script, script.Parent, "Button").Button
|
|
10
|
+
local resolveSteppedValue = TS.import(script, script.Parent, "Increment.step").resolveSteppedValue
|
|
11
|
+
local Input = TS.import(script, script.Parent, "Input").Input
|
|
12
|
+
local Increment = React.forwardRef(function(props, ref)
|
|
13
|
+
local theme = React.useContext(CleanThemeContext)
|
|
14
|
+
local _buttonStyleOverride = theme.components.increment
|
|
15
|
+
if _buttonStyleOverride ~= nil then
|
|
16
|
+
_buttonStyleOverride = _buttonStyleOverride.button
|
|
17
|
+
end
|
|
18
|
+
local buttonStyleOverride = _buttonStyleOverride
|
|
19
|
+
local value, setValue = React.useState(props.value)
|
|
20
|
+
local current = if props.controlled then props.value else value
|
|
21
|
+
local _condition = props.step
|
|
22
|
+
if _condition == nil then
|
|
23
|
+
_condition = 1
|
|
24
|
+
end
|
|
25
|
+
local step = _condition
|
|
26
|
+
local decrementDisabled = resolveSteppedValue(current, "decrement", step, props.min, props.max) == nil
|
|
27
|
+
local incrementDisabled = resolveSteppedValue(current, "increment", step, props.min, props.max) == nil
|
|
28
|
+
local applyValue = function(nextValue)
|
|
29
|
+
if not props.controlled then
|
|
30
|
+
setValue(nextValue)
|
|
31
|
+
end
|
|
32
|
+
local _result = props.onChange
|
|
33
|
+
if _result ~= nil then
|
|
34
|
+
_result(nextValue)
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
local _attributes = {
|
|
38
|
+
ref = ref,
|
|
39
|
+
}
|
|
40
|
+
for _k, _v in props do
|
|
41
|
+
_attributes[_k] = _v
|
|
42
|
+
end
|
|
43
|
+
_attributes.Size = UDim2.fromScale(1, 0)
|
|
44
|
+
_attributes.AutomaticSize = Enum.AutomaticSize.Y
|
|
45
|
+
return React.createElement(Container, _attributes, React.createElement(HStack, {
|
|
46
|
+
Wraps = false,
|
|
47
|
+
valign = "Center",
|
|
48
|
+
spacing = props.spacing,
|
|
49
|
+
}, React.createElement(Button, {
|
|
50
|
+
icon = "minus",
|
|
51
|
+
intent = props.intent,
|
|
52
|
+
scale = props.scale,
|
|
53
|
+
spacing = props.spacing,
|
|
54
|
+
disabled = decrementDisabled,
|
|
55
|
+
styleOverride = buttonStyleOverride,
|
|
56
|
+
LayoutOrder = 0,
|
|
57
|
+
Event = {
|
|
58
|
+
Activated = function()
|
|
59
|
+
local nextValue = resolveSteppedValue(current, "decrement", step, props.min, props.max)
|
|
60
|
+
if nextValue == nil then
|
|
61
|
+
return nil
|
|
62
|
+
end
|
|
63
|
+
applyValue(nextValue)
|
|
64
|
+
end,
|
|
65
|
+
},
|
|
66
|
+
}), React.createElement(FlexItem, {
|
|
67
|
+
HorizontalFlex = "Fill",
|
|
68
|
+
LayoutOrder = 1,
|
|
69
|
+
}, React.createElement(Input, {
|
|
70
|
+
Size = UDim2.fromScale(0, 0),
|
|
71
|
+
scale = props.scale,
|
|
72
|
+
spacing = props.spacing,
|
|
73
|
+
controlled = true,
|
|
74
|
+
validation = "Number",
|
|
75
|
+
min = props.min,
|
|
76
|
+
max = props.max,
|
|
77
|
+
value = tostring(current),
|
|
78
|
+
TextXAlignment = Enum.TextXAlignment.Center,
|
|
79
|
+
onChange = function(text)
|
|
80
|
+
local parsed = tonumber(text)
|
|
81
|
+
if parsed == nil then
|
|
82
|
+
return nil
|
|
83
|
+
end
|
|
84
|
+
applyValue(parsed)
|
|
85
|
+
end,
|
|
86
|
+
})), React.createElement(Button, {
|
|
87
|
+
icon = "plus",
|
|
88
|
+
intent = props.intent,
|
|
89
|
+
scale = props.scale,
|
|
90
|
+
spacing = props.spacing,
|
|
91
|
+
disabled = incrementDisabled,
|
|
92
|
+
styleOverride = buttonStyleOverride,
|
|
93
|
+
LayoutOrder = 2,
|
|
94
|
+
Event = {
|
|
95
|
+
Activated = function()
|
|
96
|
+
local nextValue = resolveSteppedValue(current, "increment", step, props.min, props.max)
|
|
97
|
+
if nextValue == nil then
|
|
98
|
+
return nil
|
|
99
|
+
end
|
|
100
|
+
applyValue(nextValue)
|
|
101
|
+
end,
|
|
102
|
+
},
|
|
103
|
+
})))
|
|
104
|
+
end)
|
|
105
|
+
return {
|
|
106
|
+
Increment = Increment,
|
|
107
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function resolveSteppedValue(current: number, direction: "increment" | "decrement", step: number, min?: number, max?: number): number | undefined;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local ROUNDING_PRECISION = 1e9
|
|
3
|
+
local function roundToPrecision(value)
|
|
4
|
+
return if value >= 0 then math.floor(value * ROUNDING_PRECISION + 0.5) / ROUNDING_PRECISION else math.ceil(value * ROUNDING_PRECISION - 0.5) / ROUNDING_PRECISION
|
|
5
|
+
end
|
|
6
|
+
local function resolveSteppedValue(current, direction, step, min, max)
|
|
7
|
+
if direction == "decrement" and min ~= nil and current <= min then
|
|
8
|
+
return nil
|
|
9
|
+
end
|
|
10
|
+
if direction == "increment" and max ~= nil and current >= max then
|
|
11
|
+
return nil
|
|
12
|
+
end
|
|
13
|
+
local candidate = if direction == "increment" then current + step else current - step
|
|
14
|
+
candidate = roundToPrecision(candidate)
|
|
15
|
+
if min ~= nil and candidate < min then
|
|
16
|
+
candidate = min
|
|
17
|
+
end
|
|
18
|
+
if max ~= nil and candidate > max then
|
|
19
|
+
candidate = max
|
|
20
|
+
end
|
|
21
|
+
return candidate
|
|
22
|
+
end
|
|
23
|
+
return {
|
|
24
|
+
resolveSteppedValue = resolveSteppedValue,
|
|
25
|
+
}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import React from "@rbxts/react";
|
|
2
2
|
import { ScalableElementProps, SpacedElementProps } from "../../Interfaces";
|
|
3
|
-
interface InputProps extends ScalableElementProps, SpacedElementProps, React.InstanceProps<TextBox> {
|
|
3
|
+
export interface InputProps extends ScalableElementProps, SpacedElementProps, React.InstanceProps<TextBox> {
|
|
4
4
|
value: string;
|
|
5
5
|
placeholder?: string;
|
|
6
|
-
validation?: "Number" | "String" | "None" | "Int";
|
|
6
|
+
validation?: "Number" | "String" | "None" | "Int" | "Telephone" | "Alphanumeric" | "Email";
|
|
7
|
+
min?: number;
|
|
8
|
+
max?: number;
|
|
7
9
|
onChange?: (value: string) => void;
|
|
8
10
|
Event?: React.InstanceEvent<TextBox>;
|
|
9
11
|
controlled?: boolean;
|
|
10
12
|
}
|
|
11
13
|
export declare function Input(props: InputProps): React.JSX.Element;
|
|
12
|
-
export {};
|