@rbxts/react-clean-ui 1.0.36 → 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/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/Layout/Accordion.d.ts +1 -1
- package/out/Components/Layout/Accordion.luau +7 -6
- package/out/Components/Layout/Container.d.ts +4 -2
- package/out/Components/Layout/Container.luau +12 -3
- 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/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/Navigation/Menu.d.ts +1 -1
- package/out/Components/Surface/Box.d.ts +4 -2
- package/out/Components/Surface/Box.luau +12 -3
- package/out/Components/Surface/Card.d.ts +8 -6
- package/out/Components/Surface/Card.luau +416 -24
- package/out/Components/Surface/Icon.luau +42 -4
- package/out/Components/Typography/Text.d.ts +1 -0
- package/out/Components/Typography/Text.luau +119 -10
- 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 +2 -2
- package/out/Helpers/create-ui-story.luau +33 -1
- 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 +23 -26
- package/out/Theme/themes/dark.theme.d.ts +1 -1
- package/out/Theme/themes/dark.theme.luau +28 -0
- package/out/Theme/themes/default.theme.d.ts +2 -2
- package/out/Theme/themes/default.theme.luau +11 -1
- 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 +25 -0
- 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 +18 -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
|
@@ -5,11 +5,14 @@ local React = _react
|
|
|
5
5
|
local useRef = _react.useRef
|
|
6
6
|
local useState = _react.useState
|
|
7
7
|
local CleanThemeContext = TS.import(script, script.Parent.Parent.Parent, "Contexts").CleanThemeContext
|
|
8
|
-
local
|
|
8
|
+
local _Helpers = TS.import(script, script.Parent.Parent.Parent, "Helpers")
|
|
9
|
+
local CssHelper = _Helpers.CssHelper
|
|
10
|
+
local TypographyHelper = _Helpers.TypographyHelper
|
|
9
11
|
local _Decorator = TS.import(script, script.Parent.Parent, "Decorator")
|
|
10
12
|
local Corners = _Decorator.Corners
|
|
11
13
|
local Padding = _Decorator.Padding
|
|
12
14
|
local FieldsetContext = TS.import(script, script.Parent.Parent, "Layout").FieldsetContext
|
|
15
|
+
local resolveValidatedText = TS.import(script, script.Parent, "Input.validation").resolveValidatedText
|
|
13
16
|
local function Input(props)
|
|
14
17
|
local theme = React.useContext(CleanThemeContext)
|
|
15
18
|
local fieldset = React.useContext(FieldsetContext)
|
|
@@ -20,7 +23,12 @@ local function Input(props)
|
|
|
20
23
|
local labelActivated = _labelActivated
|
|
21
24
|
local ref = useRef()
|
|
22
25
|
local value, setValue = useState(props.value)
|
|
26
|
+
local lastValidText = useRef(props.value)
|
|
23
27
|
local typography = TypographyHelper:getTypography(theme, props.scale, theme.components.input.typography)
|
|
28
|
+
-- Roblox's TextBox has no PlaceholderTransparency and shares font/size/weight/lineHeight
|
|
29
|
+
-- between Text and PlaceholderText, so only `.color` from this resolution is actually used below.
|
|
30
|
+
local placeholderTypography = TypographyHelper:getTypography(theme, props.scale, theme.components.input.placeholder)
|
|
31
|
+
local backgroundImage = CssHelper:resolveBackgroundImage(theme.components.input.backgroundImage)
|
|
24
32
|
React.useEffect(function()
|
|
25
33
|
if not labelActivated then
|
|
26
34
|
return nil
|
|
@@ -60,31 +68,130 @@ local function Input(props)
|
|
|
60
68
|
_condition = props.placeholder
|
|
61
69
|
end
|
|
62
70
|
_attributes_1.PlaceholderText = _condition
|
|
63
|
-
_attributes_1.PlaceholderColor3 = props.PlaceholderColor3
|
|
71
|
+
_attributes_1.PlaceholderColor3 = props.PlaceholderColor3 or placeholderTypography.color
|
|
64
72
|
_attributes_1.TextScaled = props.TextScaled
|
|
65
73
|
_attributes_1.LineHeight = typography.lineHeight
|
|
66
74
|
_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
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
75
|
+
_attributes_1.TextColor3 = props.TextColor3 or typography.color or theme.colors.intents.primary.default.textColor
|
|
76
|
+
local _condition_1 = props.TextTransparency
|
|
77
|
+
if _condition_1 == nil then
|
|
78
|
+
_condition_1 = typography.transparency
|
|
79
|
+
end
|
|
80
|
+
_attributes_1.TextTransparency = _condition_1
|
|
81
|
+
_attributes_1.Active = props.Active
|
|
82
|
+
_attributes_1.Archivable = props.Archivable
|
|
83
|
+
_attributes_1.BorderColor3 = props.BorderColor3
|
|
84
|
+
_attributes_1.BorderMode = props.BorderMode
|
|
85
|
+
_attributes_1.BorderSizePixel = props.BorderSizePixel
|
|
86
|
+
_attributes_1.ClipsDescendants = props.ClipsDescendants
|
|
87
|
+
_attributes_1.Rotation = props.Rotation
|
|
88
|
+
_attributes_1.Selectable = props.Selectable
|
|
89
|
+
_attributes_1.SelectionImageObject = props.SelectionImageObject
|
|
90
|
+
_attributes_1.SizeConstraint = props.SizeConstraint
|
|
91
|
+
_attributes_1.Tag = props.Tag
|
|
92
|
+
_attributes_1.AutoLocalize = props.AutoLocalize
|
|
93
|
+
_attributes_1.RootLocalizationTable = props.RootLocalizationTable
|
|
94
|
+
_attributes_1.NextSelectionDown = props.NextSelectionDown
|
|
95
|
+
_attributes_1.NextSelectionLeft = props.NextSelectionLeft
|
|
96
|
+
_attributes_1.NextSelectionRight = props.NextSelectionRight
|
|
97
|
+
_attributes_1.NextSelectionUp = props.NextSelectionUp
|
|
98
|
+
_attributes_1.SelectionGroup = props.SelectionGroup
|
|
99
|
+
_attributes_1.SelectionOrder = props.SelectionOrder
|
|
100
|
+
local _condition_2 = props.ClearTextOnFocus
|
|
101
|
+
if _condition_2 == nil then
|
|
102
|
+
_condition_2 = false
|
|
103
|
+
end
|
|
104
|
+
_attributes_1.ClearTextOnFocus = _condition_2
|
|
105
|
+
_attributes_1.CursorPosition = props.CursorPosition
|
|
106
|
+
_attributes_1.MultiLine = props.MultiLine
|
|
107
|
+
_attributes_1.SelectionStart = props.SelectionStart
|
|
108
|
+
_attributes_1.ShowNativeInput = props.ShowNativeInput
|
|
109
|
+
_attributes_1.TextEditable = props.TextEditable
|
|
110
|
+
_attributes_1.TextTruncate = props.TextTruncate
|
|
111
|
+
_attributes_1.RichText = props.RichText
|
|
112
|
+
local _object = {}
|
|
113
|
+
local _spread = props.Event
|
|
114
|
+
if _spread then
|
|
115
|
+
for _k, _v in _spread do
|
|
116
|
+
_object[_k] = _v
|
|
117
|
+
end
|
|
118
|
+
end
|
|
119
|
+
_object.FocusLost = function(rbx, enterPressed, inputThatCausedFocusLoss)
|
|
120
|
+
if props.validation == "Number" or props.validation == "Int" then
|
|
72
121
|
local number = tonumber(rbx.Text)
|
|
73
|
-
if
|
|
74
|
-
|
|
75
|
-
|
|
122
|
+
if number ~= nil then
|
|
123
|
+
local clamped = number
|
|
124
|
+
if props.min ~= nil and clamped < props.min then
|
|
125
|
+
clamped = props.min
|
|
126
|
+
end
|
|
127
|
+
if props.max ~= nil and clamped > props.max then
|
|
128
|
+
clamped = props.max
|
|
129
|
+
end
|
|
130
|
+
if clamped ~= number then
|
|
131
|
+
local clampedText = tostring(clamped)
|
|
132
|
+
ref.current.Text = clampedText
|
|
133
|
+
lastValidText.current = clampedText
|
|
134
|
+
setValue(clampedText)
|
|
135
|
+
local _result = props.onChange
|
|
136
|
+
if _result ~= nil then
|
|
137
|
+
_result(clampedText)
|
|
138
|
+
end
|
|
139
|
+
end
|
|
76
140
|
end
|
|
77
|
-
|
|
78
|
-
|
|
141
|
+
end
|
|
142
|
+
local _result = props.Event
|
|
143
|
+
if _result ~= nil then
|
|
144
|
+
_result = _result.FocusLost
|
|
79
145
|
if _result ~= nil then
|
|
80
|
-
_result(rbx
|
|
146
|
+
_result(rbx, enterPressed, inputThatCausedFocusLoss)
|
|
81
147
|
end
|
|
82
|
-
end
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
148
|
+
end
|
|
149
|
+
end
|
|
150
|
+
_attributes_1.Event = _object
|
|
151
|
+
local _object_1 = {}
|
|
152
|
+
local _spread_1 = props.Change
|
|
153
|
+
if _spread_1 then
|
|
154
|
+
for _k, _v in _spread_1 do
|
|
155
|
+
_object_1[_k] = _v
|
|
156
|
+
end
|
|
157
|
+
end
|
|
158
|
+
_object_1.Text = function(rbx)
|
|
159
|
+
local resolved = resolveValidatedText(props.validation, rbx.Text, lastValidText.current)
|
|
160
|
+
if resolved ~= rbx.Text then
|
|
161
|
+
ref.current.Text = resolved
|
|
162
|
+
return nil
|
|
163
|
+
end
|
|
164
|
+
lastValidText.current = rbx.Text
|
|
165
|
+
setValue(rbx.Text)
|
|
166
|
+
local _result = props.onChange
|
|
167
|
+
if _result ~= nil then
|
|
168
|
+
_result(rbx.Text)
|
|
169
|
+
end
|
|
170
|
+
local _result_1 = props.Change
|
|
171
|
+
if _result_1 ~= nil then
|
|
172
|
+
_result_1 = _result_1.Text
|
|
173
|
+
if _result_1 ~= nil then
|
|
174
|
+
_result_1(rbx)
|
|
175
|
+
end
|
|
176
|
+
end
|
|
177
|
+
end
|
|
178
|
+
_attributes_1.Change = _object_1
|
|
179
|
+
return React.createElement("imagelabel", {
|
|
180
|
+
Size = props.Size or UDim2.fromScale(1, 0),
|
|
86
181
|
AutomaticSize = Enum.AutomaticSize.Y,
|
|
87
182
|
BackgroundTransparency = 1,
|
|
183
|
+
AnchorPoint = props.AnchorPoint,
|
|
184
|
+
Position = props.Position,
|
|
185
|
+
LayoutOrder = props.LayoutOrder,
|
|
186
|
+
Visible = props.Visible,
|
|
187
|
+
ZIndex = props.ZIndex,
|
|
188
|
+
Image = backgroundImage.Image,
|
|
189
|
+
ImageColor3 = backgroundImage.ImageColor3,
|
|
190
|
+
ImageTransparency = backgroundImage.ImageTransparency,
|
|
191
|
+
ScaleType = backgroundImage.ScaleType,
|
|
192
|
+
SliceCenter = backgroundImage.SliceCenter,
|
|
193
|
+
SliceScale = backgroundImage.SliceScale,
|
|
194
|
+
TileSize = backgroundImage.TileSize,
|
|
88
195
|
}, _exp, _exp_1, _exp_2, React.createElement("textbox", _attributes_1))
|
|
89
196
|
end
|
|
90
197
|
return {
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { InputProps } from "./Input";
|
|
2
|
+
export declare const CHARACTER_ALLOW_LIST_PATTERNS: Partial<Record<NonNullable<InputProps["validation"]>, string>>;
|
|
3
|
+
export declare function resolveValidatedText(validation: InputProps["validation"], candidateText: string, lastValidText: string): string;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local CHARACTER_ALLOW_LIST_PATTERNS = {
|
|
3
|
+
Telephone = "^[%d%+%-%s%(%)]*$",
|
|
4
|
+
Alphanumeric = "^[%w]*$",
|
|
5
|
+
Email = "^[%w@%._%-+]*$",
|
|
6
|
+
}
|
|
7
|
+
local function resolveValidatedText(validation, candidateText, lastValidText)
|
|
8
|
+
local number = tonumber(candidateText)
|
|
9
|
+
if (validation == "Number" or validation == "Int") and number == nil and candidateText ~= "" and candidateText ~= "-" then
|
|
10
|
+
return lastValidText
|
|
11
|
+
end
|
|
12
|
+
local allowedPattern = CHARACTER_ALLOW_LIST_PATTERNS[validation or "None"]
|
|
13
|
+
if allowedPattern ~= nil and (string.match(candidateText, allowedPattern)) == nil then
|
|
14
|
+
return lastValidText
|
|
15
|
+
end
|
|
16
|
+
return candidateText
|
|
17
|
+
end
|
|
18
|
+
return {
|
|
19
|
+
resolveValidatedText = resolveValidatedText,
|
|
20
|
+
CHARACTER_ALLOW_LIST_PATTERNS = CHARACTER_ALLOW_LIST_PATTERNS,
|
|
21
|
+
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import React from "@rbxts/react";
|
|
2
2
|
import { CssSize, ScalableElementProps, SpacedElementProps } from "../../Interfaces";
|
|
3
|
-
|
|
3
|
+
import { CssBackgroundImage } from "../../Theme";
|
|
4
|
+
export interface SelectProps extends ScalableElementProps, SpacedElementProps, React.InstanceProps<ImageLabel> {
|
|
4
5
|
selected?: number;
|
|
5
6
|
'max-height'?: CssSize;
|
|
7
|
+
backgroundImage?: CssBackgroundImage;
|
|
6
8
|
onChange?: (selected: number, value?: string) => void;
|
|
7
|
-
Event?: React.InstanceEvent<TextBox>;
|
|
8
9
|
}
|
|
9
10
|
interface SelectOptionProps {
|
|
10
11
|
text?: string;
|
|
@@ -15,7 +16,7 @@ interface SelectOptionProps {
|
|
|
15
16
|
BackgroundColor3?: Color3;
|
|
16
17
|
}
|
|
17
18
|
declare function SelectOption(props: SelectOptionProps): React.JSX.Element;
|
|
18
|
-
type SelectComponent = React.ForwardRefExoticComponent<SelectProps & React.RefAttributes<
|
|
19
|
+
type SelectComponent = React.ForwardRefExoticComponent<SelectProps & React.RefAttributes<ImageLabel>> & {
|
|
19
20
|
Option: typeof SelectOption;
|
|
20
21
|
};
|
|
21
22
|
declare const Select: SelectComponent;
|
|
@@ -161,6 +161,15 @@ local Select = React.forwardRef(function(props, ref)
|
|
|
161
161
|
if open and overlay.overlay == nil then
|
|
162
162
|
warn("You have used a Select component without using the Overlay Provider")
|
|
163
163
|
end
|
|
164
|
+
local _attributes = {
|
|
165
|
+
ref = ref,
|
|
166
|
+
}
|
|
167
|
+
for _k, _v in props do
|
|
168
|
+
_attributes[_k] = _v
|
|
169
|
+
end
|
|
170
|
+
_attributes.Size = UDim2.fromScale(1, 0)
|
|
171
|
+
_attributes.AutomaticSize = Enum.AutomaticSize.Y
|
|
172
|
+
_attributes.backgroundImage = props.backgroundImage or theme.components.select.backgroundImage
|
|
164
173
|
local _exp_1 = React.createElement("uistroke", {
|
|
165
174
|
Thickness = theme.components.select.borderThickness,
|
|
166
175
|
BorderStrokePosition = Enum.BorderStrokePosition.Inner,
|
|
@@ -169,10 +178,10 @@ local Select = React.forwardRef(function(props, ref)
|
|
|
169
178
|
local _exp_2 = React.createElement(Corners, {
|
|
170
179
|
radius = theme.components.select.cornerRadius,
|
|
171
180
|
})
|
|
172
|
-
local
|
|
173
|
-
setmetatable(
|
|
174
|
-
local _exp_3 = React.createElement(Padding,
|
|
175
|
-
local
|
|
181
|
+
local _attributes_1 = table.clone(props)
|
|
182
|
+
setmetatable(_attributes_1, nil)
|
|
183
|
+
local _exp_3 = React.createElement(Padding, _attributes_1)
|
|
184
|
+
local _attributes_2 = {}
|
|
176
185
|
local _result_1 = selectedOption
|
|
177
186
|
if _result_1 ~= nil then
|
|
178
187
|
_result_1 = _result_1.props.text
|
|
@@ -181,25 +190,25 @@ local Select = React.forwardRef(function(props, ref)
|
|
|
181
190
|
if _condition_1 == nil then
|
|
182
191
|
_condition_1 = "No Options"
|
|
183
192
|
end
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
local _exp_4 = React.createElement(HStack, nil, React.createElement(FlexItem, nil, React.createElement(Text,
|
|
193
|
+
_attributes_2.text = _condition_1
|
|
194
|
+
_attributes_2.typography = typography
|
|
195
|
+
local _exp_4 = React.createElement(HStack, nil, React.createElement(FlexItem, nil, React.createElement(Text, _attributes_2)), React.createElement(Icon, {
|
|
187
196
|
icon = "caret-down",
|
|
188
197
|
color = theme.colors.intents.primary.default.textColor,
|
|
189
198
|
}))
|
|
190
199
|
local _condition_2 = open and overlay.overlay ~= nil
|
|
191
200
|
if _condition_2 then
|
|
192
|
-
local
|
|
201
|
+
local _attributes_3 = {
|
|
193
202
|
BackgroundTransparency = 0,
|
|
194
203
|
BackgroundColor3 = theme.components.select.dropDownBackgroundColor,
|
|
195
204
|
AnchorPoint = Vector2.zero,
|
|
196
205
|
}
|
|
197
206
|
local _uDim2 = UDim2.new(0, 0, 0, dropdownSize.Y.Offset)
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
_condition_2 = ReactRoblox.createPortal(React.createElement("frame",
|
|
207
|
+
_attributes_3.Position = dropdownPosition + _uDim2
|
|
208
|
+
_attributes_3.Size = UDim2.fromOffset(dropdownSize.X.Offset, 0)
|
|
209
|
+
_attributes_3.AutomaticSize = Enum.AutomaticSize.Y
|
|
210
|
+
_attributes_3.ClipsDescendants = true
|
|
211
|
+
_condition_2 = ReactRoblox.createPortal(React.createElement("frame", _attributes_3, React.createElement("uistroke", {
|
|
203
212
|
Thickness = theme.components.select.borderThickness,
|
|
204
213
|
BorderStrokePosition = Enum.BorderStrokePosition.Outer,
|
|
205
214
|
Color = theme.components.select.borderColor,
|
|
@@ -226,11 +235,7 @@ local Select = React.forwardRef(function(props, ref)
|
|
|
226
235
|
})
|
|
227
236
|
end)))), overlay.overlay)
|
|
228
237
|
end
|
|
229
|
-
return React.createElement(Container, {
|
|
230
|
-
ref = ref,
|
|
231
|
-
Size = UDim2.fromScale(1, 0),
|
|
232
|
-
AutomaticSize = Enum.AutomaticSize.Y,
|
|
233
|
-
}, React.createElement(SelectContext.Provider, {
|
|
238
|
+
return React.createElement(Container, _attributes, React.createElement(SelectContext.Provider, {
|
|
234
239
|
value = context,
|
|
235
240
|
}, React.createElement("imagebutton", {
|
|
236
241
|
ref = buttonRef,
|
|
@@ -2,7 +2,7 @@ import React from "@rbxts/react";
|
|
|
2
2
|
import { ContainerProps } from "../Layout";
|
|
3
3
|
type SliderValue = number | Vector2;
|
|
4
4
|
type HighlightOption = "start" | "end" | "middle";
|
|
5
|
-
export interface SliderProps extends ContainerProps {
|
|
5
|
+
export interface SliderProps extends Omit<ContainerProps, keyof React.InstanceProps<ImageLabel>>, React.InstanceProps<Frame> {
|
|
6
6
|
"max-value": number;
|
|
7
7
|
"min-value"?: number;
|
|
8
8
|
value?: SliderValue;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
-- Compiled with roblox-ts v3.0.0
|
|
2
2
|
local TS = _G[script]
|
|
3
3
|
local React = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
4
|
-
local CustomInputService = TS.import(script, script.Parent.Parent.Parent, "
|
|
4
|
+
local CustomInputService = TS.import(script, script.Parent.Parent.Parent, "Helpers").CustomInputService
|
|
5
5
|
local CleanThemeContext = TS.import(script, script.Parent.Parent.Parent, "Contexts").CleanThemeContext
|
|
6
6
|
local SizeHelper = TS.import(script, script.Parent.Parent.Parent, "Helpers").SizeHelper
|
|
7
7
|
local BoxShadow = TS.import(script, script.Parent.Parent, "Decorator").BoxShadow
|
|
@@ -248,6 +248,44 @@ local Slider = React.forwardRef(function(props, ref)
|
|
|
248
248
|
}
|
|
249
249
|
table.insert(handles, _arg0)
|
|
250
250
|
end
|
|
251
|
+
local _attributes = {
|
|
252
|
+
ref = ref,
|
|
253
|
+
Archivable = props.Archivable,
|
|
254
|
+
Tag = props.Tag,
|
|
255
|
+
Active = props.Active,
|
|
256
|
+
AnchorPoint = SizeHelper:GetAnchor(props),
|
|
257
|
+
BackgroundColor3 = props.BackgroundColor3,
|
|
258
|
+
}
|
|
259
|
+
local _condition_1 = props.BackgroundTransparency
|
|
260
|
+
if _condition_1 == nil then
|
|
261
|
+
_condition_1 = 1
|
|
262
|
+
end
|
|
263
|
+
_attributes.BackgroundTransparency = _condition_1
|
|
264
|
+
_attributes.BorderColor3 = props.BorderColor3
|
|
265
|
+
_attributes.BorderMode = props.BorderMode
|
|
266
|
+
_attributes.BorderSizePixel = props.BorderSizePixel
|
|
267
|
+
_attributes.ClipsDescendants = props.ClipsDescendants
|
|
268
|
+
_attributes.Interactable = props.Interactable
|
|
269
|
+
_attributes.LayoutOrder = props.LayoutOrder
|
|
270
|
+
_attributes.NextSelectionDown = props.NextSelectionDown
|
|
271
|
+
_attributes.NextSelectionLeft = props.NextSelectionLeft
|
|
272
|
+
_attributes.NextSelectionRight = props.NextSelectionRight
|
|
273
|
+
_attributes.NextSelectionUp = props.NextSelectionUp
|
|
274
|
+
_attributes.Position = SizeHelper:GetPosition(props)
|
|
275
|
+
_attributes.Rotation = props.Rotation
|
|
276
|
+
_attributes.Selectable = props.Selectable
|
|
277
|
+
_attributes.SelectionGroup = props.SelectionGroup
|
|
278
|
+
_attributes.SelectionImageObject = props.SelectionImageObject
|
|
279
|
+
_attributes.SelectionOrder = props.SelectionOrder
|
|
280
|
+
_attributes.Size = SizeHelper:GetSize(props, UDim2.new(UDim.new(1, 0), height))
|
|
281
|
+
_attributes.SizeConstraint = props.SizeConstraint
|
|
282
|
+
_attributes.Visible = props.Visible
|
|
283
|
+
_attributes.ZIndex = props.ZIndex
|
|
284
|
+
_attributes.AutoLocalize = props.AutoLocalize
|
|
285
|
+
_attributes.RootLocalizationTable = props.RootLocalizationTable
|
|
286
|
+
_attributes.Style = props.Style
|
|
287
|
+
_attributes.Change = props.Change
|
|
288
|
+
_attributes.Event = props.Event
|
|
251
289
|
local _exp = React.createElement("frame", {
|
|
252
290
|
Size = UDim2.new(UDim.new(1, 0), SizeHelper:toUDim(theme.bar.height)),
|
|
253
291
|
Position = UDim2.fromScale(0.5, 0.5),
|
|
@@ -260,18 +298,18 @@ local Slider = React.forwardRef(function(props, ref)
|
|
|
260
298
|
}), React.createElement("uicorner", {
|
|
261
299
|
CornerRadius = SizeHelper:toUDim(theme.bar.cornerRadius),
|
|
262
300
|
}))
|
|
263
|
-
local
|
|
301
|
+
local _attributes_1 = {
|
|
264
302
|
ref = containerRef,
|
|
265
303
|
}
|
|
266
304
|
local _exp_1 = UDim2.fromScale(1, 1)
|
|
267
305
|
local _uDim2 = UDim2.new(padding + padding, UDim.new(0, 0))
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
local
|
|
273
|
-
if
|
|
274
|
-
local
|
|
306
|
+
_attributes_1.Size = _exp_1 - _uDim2
|
|
307
|
+
_attributes_1.BackgroundTransparency = 1
|
|
308
|
+
_attributes_1.Position = UDim2.fromScale(0.5, 0.5)
|
|
309
|
+
_attributes_1.AnchorPoint = Vector2.new(0.5, 0.5)
|
|
310
|
+
local _condition_2 = props.highlight ~= nil
|
|
311
|
+
if _condition_2 then
|
|
312
|
+
local _attributes_2 = {
|
|
275
313
|
BackgroundColor3 = theme.bar.highlight.backgroundColor,
|
|
276
314
|
BackgroundTransparency = theme.bar.highlight.backgroundTransparency,
|
|
277
315
|
}
|
|
@@ -291,8 +329,8 @@ local Slider = React.forwardRef(function(props, ref)
|
|
|
291
329
|
end
|
|
292
330
|
_result = _result_1
|
|
293
331
|
end
|
|
294
|
-
|
|
295
|
-
|
|
332
|
+
_attributes_2.Position = _result
|
|
333
|
+
_attributes_2.AnchorPoint = if props.highlight == "end" then Vector2.new(1, 0.5) else Vector2.new(0, 0.5)
|
|
296
334
|
local _result_1
|
|
297
335
|
if props.highlight == "start" then
|
|
298
336
|
local _uDim2_1 = UDim2.new(UDim.new(firstPosition, 0), SizeHelper:toUDim(theme.bar.height))
|
|
@@ -301,24 +339,24 @@ local Slider = React.forwardRef(function(props, ref)
|
|
|
301
339
|
else
|
|
302
340
|
local _result_2
|
|
303
341
|
if props.highlight == "end" then
|
|
304
|
-
local
|
|
305
|
-
if
|
|
306
|
-
|
|
342
|
+
local _condition_3 = secondPosition
|
|
343
|
+
if _condition_3 == nil then
|
|
344
|
+
_condition_3 = firstPosition
|
|
307
345
|
end
|
|
308
|
-
local _uDim2_1 = UDim2.new(UDim.new(1 -
|
|
346
|
+
local _uDim2_1 = UDim2.new(UDim.new(1 - _condition_3, 0), SizeHelper:toUDim(theme.bar.height))
|
|
309
347
|
local _uDim2_2 = UDim2.new(padding, UDim.new(0, 0))
|
|
310
348
|
_result_2 = _uDim2_1 + _uDim2_2
|
|
311
349
|
else
|
|
312
|
-
local
|
|
313
|
-
if
|
|
314
|
-
|
|
350
|
+
local _condition_3 = secondPosition
|
|
351
|
+
if _condition_3 == nil then
|
|
352
|
+
_condition_3 = 0
|
|
315
353
|
end
|
|
316
|
-
_result_2 = UDim2.new(UDim.new(
|
|
354
|
+
_result_2 = UDim2.new(UDim.new(_condition_3 - firstPosition, 0), SizeHelper:toUDim(theme.bar.height))
|
|
317
355
|
end
|
|
318
356
|
_result_1 = _result_2
|
|
319
357
|
end
|
|
320
|
-
|
|
321
|
-
|
|
358
|
+
_attributes_2.Size = _result_1
|
|
359
|
+
_condition_2 = (React.createElement("frame", _attributes_2, React.createElement("uistroke", {
|
|
322
360
|
Thickness = theme.bar.borderThickness,
|
|
323
361
|
Color = theme.bar.highlight.borderColor,
|
|
324
362
|
}), React.createElement("uicorner", {
|
|
@@ -340,14 +378,14 @@ local Slider = React.forwardRef(function(props, ref)
|
|
|
340
378
|
local _exp_4 = (hoveredHandle == index or (dragging and activeHandleRef.current == index)) and (React.createElement(BoxShadow, {
|
|
341
379
|
["box-shadow"] = theme.handle.boxShadow,
|
|
342
380
|
}))
|
|
343
|
-
local
|
|
344
|
-
local
|
|
345
|
-
if
|
|
346
|
-
|
|
381
|
+
local _attributes_2 = {}
|
|
382
|
+
local _condition_3 = theme.handle.aspectRatio
|
|
383
|
+
if _condition_3 == nil then
|
|
384
|
+
_condition_3 = 1
|
|
347
385
|
end
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
386
|
+
_attributes_2.AspectRatio = _condition_3
|
|
387
|
+
_attributes_2.DominantAxis = Enum.DominantAxis.Height
|
|
388
|
+
_attributes_2.AspectType = Enum.AspectType.ScaleWithParentSize
|
|
351
389
|
return React.createElement("frame", {
|
|
352
390
|
key = index,
|
|
353
391
|
Position = UDim2.fromScale(position, 0.5),
|
|
@@ -369,17 +407,13 @@ local Slider = React.forwardRef(function(props, ref)
|
|
|
369
407
|
end)
|
|
370
408
|
end,
|
|
371
409
|
},
|
|
372
|
-
}, _exp_2, _exp_3, _exp_4, React.createElement("uiaspectratioconstraint",
|
|
410
|
+
}, _exp_2, _exp_3, _exp_4, React.createElement("uiaspectratioconstraint", _attributes_2))
|
|
373
411
|
end
|
|
374
412
|
for _k, _v in handles do
|
|
375
413
|
_newValue[_k] = _callback(_v, _k - 1, handles)
|
|
376
414
|
end
|
|
377
415
|
-- ▲ ReadonlyArray.map ▲
|
|
378
|
-
return React.createElement("frame",
|
|
379
|
-
ref = ref,
|
|
380
|
-
Size = UDim2.new(UDim.new(1, 0), height),
|
|
381
|
-
BackgroundTransparency = 1,
|
|
382
|
-
}, _exp, React.createElement("frame", _attributes, _condition_1, _newValue))
|
|
416
|
+
return React.createElement("frame", _attributes, _exp, React.createElement("frame", _attributes_1, _condition_2, _newValue))
|
|
383
417
|
end)
|
|
384
418
|
return {
|
|
385
419
|
Slider = Slider,
|
|
@@ -10,6 +10,9 @@ end
|
|
|
10
10
|
for _k, _v in TS.import(script, script, "HoverButton") or {} do
|
|
11
11
|
exports[_k] = _v
|
|
12
12
|
end
|
|
13
|
+
for _k, _v in TS.import(script, script, "Increment") or {} do
|
|
14
|
+
exports[_k] = _v
|
|
15
|
+
end
|
|
13
16
|
for _k, _v in TS.import(script, script, "Input") or {} do
|
|
14
17
|
exports[_k] = _v
|
|
15
18
|
end
|
|
@@ -25,7 +25,7 @@ export interface AccordionProps extends ScalableElementProps {
|
|
|
25
25
|
value?: string;
|
|
26
26
|
onValueChange?: (value: string | undefined) => void;
|
|
27
27
|
}
|
|
28
|
-
type AccordionComponent = React.ForwardRefExoticComponent<AccordionProps & React.RefAttributes<
|
|
28
|
+
type AccordionComponent = React.ForwardRefExoticComponent<AccordionProps & React.RefAttributes<ImageLabel>> & {
|
|
29
29
|
Item: typeof AccordionItem;
|
|
30
30
|
Header: typeof AccordionHeader;
|
|
31
31
|
Content: typeof AccordionContent;
|
|
@@ -53,11 +53,11 @@ local function AccordionHeaderVisual(props)
|
|
|
53
53
|
end
|
|
54
54
|
local state = _result
|
|
55
55
|
local colors = ColorHelper:getIntentColors(theme, "primary", state, theme.components.accordion.header.intents)
|
|
56
|
-
local rotation, rotationTween = useTween(if props.open then
|
|
56
|
+
local rotation, rotationTween = useTween(if props.open then 180 else 0, {
|
|
57
57
|
duration = props.duration,
|
|
58
58
|
})
|
|
59
59
|
React.useEffect(function()
|
|
60
|
-
local goal = if props.open then
|
|
60
|
+
local goal = if props.open then 180 else 0
|
|
61
61
|
rotationTween:setGoal(goal, {
|
|
62
62
|
duration = props.duration,
|
|
63
63
|
})
|
|
@@ -103,12 +103,13 @@ local function AccordionHeaderVisual(props)
|
|
|
103
103
|
}, _exp_1, React.createElement(Container, {
|
|
104
104
|
Size = UDim2.new(1, theme.components.accordion.header.indicatorSize, 0, 0),
|
|
105
105
|
AutomaticSize = Enum.AutomaticSize.Y,
|
|
106
|
-
}, _result_1), React.createElement(Icon, {
|
|
106
|
+
}, _result_1), React.createElement(Container, nil, React.createElement(Icon, {
|
|
107
107
|
icon = "chevron-down",
|
|
108
108
|
color = if props.disabled then colors.textColor else theme.components.accordion.header.indicatorColor,
|
|
109
109
|
Size = UDim2.fromOffset(theme.components.accordion.header.indicatorSize, theme.components.accordion.header.indicatorSize),
|
|
110
|
+
AnchorPoint = Vector2.new(0.5, 0.5),
|
|
110
111
|
Rotation = rotation,
|
|
111
|
-
})))
|
|
112
|
+
}))))
|
|
112
113
|
end
|
|
113
114
|
local function RenderedAccordionItem(props)
|
|
114
115
|
local theme = React.useContext(CleanThemeContext)
|
|
@@ -163,8 +164,8 @@ local function RenderedAccordionItem(props)
|
|
|
163
164
|
isSelected = props.open,
|
|
164
165
|
}
|
|
165
166
|
local _object = {
|
|
166
|
-
Active = not props.disabled and props.content ~= nil,
|
|
167
|
-
Selectable = not props.disabled and props.content ~= nil,
|
|
167
|
+
Active = not props.disabled and (props.content ~= nil or props.contentText ~= nil),
|
|
168
|
+
Selectable = not props.disabled and (props.content ~= nil or props.contentText ~= nil),
|
|
168
169
|
AutoButtonColor = false,
|
|
169
170
|
AutomaticSize = Enum.AutomaticSize.Y,
|
|
170
171
|
Size = UDim2.fromScale(1, 0),
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import React from "@rbxts/react";
|
|
2
2
|
import { PositionElementProps, SizeElementProps, ZIndexElementProps } from "../../Interfaces/";
|
|
3
|
-
|
|
3
|
+
import { CssBackgroundImage } from "../../Theme";
|
|
4
|
+
export interface ContainerProps extends SizeElementProps, PositionElementProps, ZIndexElementProps, React.InstanceProps<ImageLabel> {
|
|
4
5
|
group?: boolean;
|
|
6
|
+
backgroundImage?: Partial<CssBackgroundImage>;
|
|
5
7
|
}
|
|
6
|
-
export declare const Container: React.ForwardRefExoticComponent<Omit<ContainerProps, "ref"> & React.RefAttributes<
|
|
8
|
+
export declare const Container: React.ForwardRefExoticComponent<Omit<ContainerProps, "ref"> & React.RefAttributes<ImageLabel>>;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
-- Compiled with roblox-ts v3.0.0
|
|
2
2
|
local TS = _G[script]
|
|
3
3
|
local React = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
4
|
-
local
|
|
4
|
+
local _ = TS.import(script, script.Parent.Parent.Parent, "Helpers")
|
|
5
|
+
local SizeHelper = _.SizeHelper
|
|
6
|
+
local CssHelper = _.CssHelper
|
|
5
7
|
local _Group = TS.import(script, script.Parent, "Group")
|
|
6
8
|
local Group = _Group.Group
|
|
7
9
|
local GroupContext = _Group.GroupContext
|
|
@@ -10,6 +12,7 @@ local Container = React.forwardRef(function(props, ref)
|
|
|
10
12
|
local autoSize = SizeHelper:GetAutoSize(props)
|
|
11
13
|
local isAutoSizeActive = autoSize ~= Enum.AutomaticSize.None and autoSize ~= "None"
|
|
12
14
|
local centerViaLayout = props.center == true and props.Position == nil and props.AnchorPoint == nil and isAutoSizeActive
|
|
15
|
+
local backgroundImage = CssHelper:resolveBackgroundImage(props.backgroundImage)
|
|
13
16
|
local _attributes = {
|
|
14
17
|
ref = ref,
|
|
15
18
|
Archivable = props.Archivable,
|
|
@@ -64,10 +67,16 @@ local Container = React.forwardRef(function(props, ref)
|
|
|
64
67
|
_attributes.ZIndex = props.ZIndex
|
|
65
68
|
_attributes.AutoLocalize = props.AutoLocalize
|
|
66
69
|
_attributes.RootLocalizationTable = props.RootLocalizationTable
|
|
67
|
-
_attributes.
|
|
70
|
+
_attributes.Image = backgroundImage.Image
|
|
71
|
+
_attributes.ImageColor3 = backgroundImage.ImageColor3
|
|
72
|
+
_attributes.ImageTransparency = backgroundImage.ImageTransparency
|
|
73
|
+
_attributes.ScaleType = backgroundImage.ScaleType
|
|
74
|
+
_attributes.SliceCenter = backgroundImage.SliceCenter
|
|
75
|
+
_attributes.SliceScale = backgroundImage.SliceScale
|
|
76
|
+
_attributes.TileSize = backgroundImage.TileSize
|
|
68
77
|
_attributes.Change = props.Change
|
|
69
78
|
_attributes.Event = props.Event
|
|
70
|
-
local content = (React.createElement("
|
|
79
|
+
local content = (React.createElement("imagelabel", _attributes, React.createElement(Group.Element, {
|
|
71
80
|
enabled = props.group,
|
|
72
81
|
}, props.children)))
|
|
73
82
|
if not centerViaLayout then
|
|
@@ -12,7 +12,7 @@ local DraggableContext = _Contexts.DraggableContext
|
|
|
12
12
|
local OverlayConsumer = _Contexts.OverlayConsumer
|
|
13
13
|
local createPortal = TS.import(script, TS.getModule(script, "@rbxts", "react-roblox")).createPortal
|
|
14
14
|
local Corners = TS.import(script, script.Parent.Parent, "Decorator").Corners
|
|
15
|
-
local CustomInputService = TS.import(script, script.Parent.Parent.Parent, "
|
|
15
|
+
local CustomInputService = TS.import(script, script.Parent.Parent.Parent, "Helpers").CustomInputService
|
|
16
16
|
local function DragHandle(_param)
|
|
17
17
|
local children = _param.children
|
|
18
18
|
local draggable = React.useContext(DraggableContext)
|
|
@@ -16,7 +16,7 @@ interface FieldsetSlotProps {
|
|
|
16
16
|
}
|
|
17
17
|
declare function FieldsetLabel(props: FieldsetSlotProps): React.JSX.Element;
|
|
18
18
|
declare function FieldsetControl(props: FieldsetSlotProps): React.JSX.Element;
|
|
19
|
-
type FieldsetComponent = React.ForwardRefExoticComponent<FieldsetProps & React.RefAttributes<
|
|
19
|
+
type FieldsetComponent = React.ForwardRefExoticComponent<FieldsetProps & React.RefAttributes<ImageLabel>> & {
|
|
20
20
|
Label: typeof FieldsetLabel;
|
|
21
21
|
Control: typeof FieldsetControl;
|
|
22
22
|
};
|
|
@@ -6,6 +6,7 @@ interface FlexItemProps extends ContainerProps {
|
|
|
6
6
|
mode?: Enum.UIFlexMode | "Grow" | "None" | "Shrink" | "Fill" | "Custom" | Binding<Enum.UIFlexMode>;
|
|
7
7
|
GrowRatio?: number;
|
|
8
8
|
ShrinkRatio?: number;
|
|
9
|
+
HorizontalFlex?: Enum.UIFlexAlignment | "None" | "SpaceAround" | "Fill" | Binding<Enum.UIFlexAlignment>;
|
|
9
10
|
}
|
|
10
|
-
export declare const FlexItem: React.ForwardRefExoticComponent<Omit<FlexItemProps, "ref"> & React.RefAttributes<
|
|
11
|
+
export declare const FlexItem: React.ForwardRefExoticComponent<Omit<FlexItemProps, "ref"> & React.RefAttributes<ImageLabel>>;
|
|
11
12
|
export {};
|
|
@@ -11,6 +11,7 @@ local FlexItem = React.forwardRef(function(props, ref)
|
|
|
11
11
|
GrowRatio = props.GrowRatio,
|
|
12
12
|
ShrinkRatio = props.ShrinkRatio,
|
|
13
13
|
}), React.createElement("uilistlayout", {
|
|
14
|
+
HorizontalFlex = props.HorizontalFlex,
|
|
14
15
|
FillDirection = Enum.FillDirection.Horizontal,
|
|
15
16
|
HorizontalAlignment = props.align,
|
|
16
17
|
}), props.children)
|
|
@@ -2,6 +2,7 @@ import React from "@rbxts/react";
|
|
|
2
2
|
import { PositionElementProps, SizeElementProps, SpacedElementProps } from "../../Interfaces";
|
|
3
3
|
interface ScrollerProps extends SizeElementProps, SpacedElementProps, PositionElementProps {
|
|
4
4
|
children?: React.ReactNode;
|
|
5
|
+
AutomaticSizeParent?: boolean;
|
|
5
6
|
}
|
|
6
7
|
export declare function Scroller(props: ScrollerProps): React.JSX.Element;
|
|
7
8
|
export {};
|