@rbxts/uiblox 0.2.0-alpha.37 → 0.2.0-alpha.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/README.md +1 -18
- package/out/theme/constants/NumberConstants.d.ts +10 -0
- package/out/theme/constants/NumberConstants.luau +12 -0
- package/out/theme/interfaces/density/controlMetrics.luau +2 -2
- package/out/theme/interfaces/palette/Palette.d.ts +7 -0
- package/out/theme/interfaces/spacing/Shape.d.ts +6 -0
- package/out/theme/interfaces/theme/Theme.d.ts +6 -0
- package/out/theme/interfaces/typography/FontFamilies.luau +1 -0
- package/out/theme/interfaces/typography/FontFamilyOptions.d.ts +1 -1
- package/out/theme/interfaces/typography/FontSizeOptions.d.ts +1 -1
- package/out/theme/interfaces/typography/FontSizes.luau +2 -0
- package/out/theme/interfaces/typography/Variants.d.ts +3 -1
- package/out/theme/interfaces/typography/Variants.luau +25 -1
- package/out/theme/styles/utilities/focusRing.d.ts +2 -0
- package/out/theme/styles/utilities/focusRing.luau +3 -0
- package/out/theme/styles/utilities/index.d.ts +1 -1
- package/out/theme/styles/utilities/init.luau +3 -1
- package/out/theme/themes/DarkTheme.luau +4 -0
- package/out/theme/themes/LightTheme.luau +4 -0
- package/out/theme/themes/createPalette.luau +15 -0
- package/out/ui/packages/accordion/components/Accordion.luau +84 -40
- package/out/ui/packages/accordion/components/Accordion.styles.luau +35 -17
- package/out/ui/packages/alert/components/Alert.luau +15 -11
- package/out/ui/packages/alert/components/Alert.styles.luau +37 -26
- package/out/ui/packages/appBar/components/AppBar.luau +35 -13
- package/out/ui/packages/appBar/components/AppBar.styles.luau +41 -35
- package/out/ui/packages/autocomplete/components/Autocomplete.luau +4 -0
- package/out/ui/packages/avatar/components/Avatar.d.ts +2 -0
- package/out/ui/packages/avatar/components/Avatar.luau +9 -2
- package/out/ui/packages/avatar/components/Avatar.styles.luau +7 -0
- package/out/ui/packages/avatarGroup/components/AvatarGroup.luau +9 -4
- package/out/ui/packages/avatarGroup/components/AvatarGroup.styles.luau +6 -1
- package/out/ui/packages/badge/components/Badge.luau +14 -11
- package/out/ui/packages/badge/components/Badge.styles.luau +5 -1
- package/out/ui/packages/bottomNavigation/components/BottomNavigation.styles.luau +4 -3
- package/out/ui/packages/breadcrumbs/components/Breadcrumbs.luau +6 -2
- package/out/ui/packages/breadcrumbs/components/Breadcrumbs.styles.luau +4 -0
- package/out/ui/packages/brickColorPicker/components/BrickColorPicker.luau +20 -2
- package/out/ui/packages/brickColorPicker/components/BrickColorPicker.styles.luau +72 -66
- package/out/ui/packages/button/components/Button.luau +61 -34
- package/out/ui/packages/button/components/buttonPaint.d.ts +16 -0
- package/out/ui/packages/button/components/buttonPaint.luau +70 -0
- package/out/ui/packages/buttonGroup/components/ButtonGroup.d.ts +1 -0
- package/out/ui/packages/buttonGroup/components/ButtonGroup.luau +17 -2
- package/out/ui/packages/card/components/Card.styles.luau +4 -2
- package/out/ui/packages/cframeEditor/components/CFrameEditor.luau +9 -1
- package/out/ui/packages/cframeEditor/components/CFrameEditor.styles.luau +50 -41
- package/out/ui/packages/checkbox/components/Checkbox.luau +5 -4
- package/out/ui/packages/checkbox/components/checkboxLook.d.ts +2 -2
- package/out/ui/packages/checkbox/components/checkboxLook.luau +2 -2
- package/out/ui/packages/chip/components/Chip.luau +16 -14
- package/out/ui/packages/chip/components/Chip.styles.luau +7 -4
- package/out/ui/packages/circularProgress/components/CircularProgress.luau +10 -3
- package/out/ui/packages/codeEditor/components/CodeEditor.d.ts +12 -0
- package/out/ui/packages/codeEditor/components/CodeEditor.luau +262 -0
- package/out/ui/packages/codeEditor/components/CodeEditor.styles.d.ts +6 -0
- package/out/ui/packages/codeEditor/components/CodeEditor.styles.luau +124 -0
- package/out/ui/packages/codeEditor/highlightCode.d.ts +11 -0
- package/out/ui/packages/codeEditor/highlightCode.luau +503 -0
- package/out/ui/packages/codeEditor/index.d.ts +2 -0
- package/out/ui/packages/codeEditor/init.luau +5 -0
- package/out/ui/packages/colorPicker/components/ColorPicker.luau +9 -1
- package/out/ui/packages/colorPicker/components/ColorPicker.styles.luau +74 -67
- package/out/ui/packages/colorPicker/components/ColorSequenceEditor.luau +12 -4
- package/out/ui/packages/colorPicker/components/NumberSequenceEditor.luau +12 -4
- package/out/ui/packages/dateRange/components/DateRangePicker.luau +31 -19
- package/out/ui/packages/dialog/components/Dialog.styles.luau +4 -2
- package/out/ui/packages/divider/components/Divider.luau +3 -1
- package/out/ui/packages/divider/components/Divider.styles.luau +1 -0
- package/out/ui/packages/drawer/components/Drawer.d.ts +1 -0
- package/out/ui/packages/drawer/components/Drawer.luau +43 -14
- package/out/ui/packages/drawer/components/Drawer.styles.luau +13 -5
- package/out/ui/packages/drawer/components/drawerPlacement.d.ts +2 -0
- package/out/ui/packages/drawer/components/drawerPlacement.luau +18 -0
- package/out/ui/packages/editorFace.d.ts +22 -0
- package/out/ui/packages/editorFace.luau +49 -0
- package/out/ui/packages/fab/components/Fab.luau +19 -6
- package/out/ui/packages/fab/components/Fab.styles.luau +4 -3
- package/out/ui/packages/fab/components/fabSize.d.ts +1 -1
- package/out/ui/packages/fontEditor/components/FontEditor.luau +13 -3
- package/out/ui/packages/fontEditor/components/FontEditor.styles.luau +36 -27
- package/out/ui/packages/gradientEditor/components/GradientEditor.luau +21 -13
- package/out/ui/packages/gradientEditor/components/GradientEditor.styles.luau +52 -44
- package/out/ui/packages/icon/components/DrawnGlyph.d.ts +11 -0
- package/out/ui/packages/icon/components/DrawnGlyph.luau +87 -0
- package/out/ui/packages/icon/components/Icon.d.ts +6 -2
- package/out/ui/packages/icon/components/Icon.luau +23 -3
- package/out/ui/packages/icon/components/Icon.styles.luau +3 -0
- package/out/ui/packages/icon/components/glyphs.d.ts +28 -0
- package/out/ui/packages/icon/components/glyphs.luau +64 -0
- package/out/ui/packages/icon/index.d.ts +1 -0
- package/out/ui/packages/iconButton/components/IconButton.d.ts +5 -2
- package/out/ui/packages/iconButton/components/IconButton.luau +83 -16
- package/out/ui/packages/iconButton/components/IconButton.styles.luau +4 -27
- package/out/ui/packages/iconButton/components/iconButtonBox.d.ts +11 -0
- package/out/ui/packages/iconButton/components/iconButtonBox.luau +48 -0
- package/out/ui/packages/iconButton/components/transportGlyph.d.ts +1 -0
- package/out/ui/packages/iconButton/components/transportGlyph.luau +4 -0
- package/out/ui/packages/imageList/components/ImageList.luau +11 -36
- package/out/ui/packages/imageList/components/ImageList.styles.luau +1 -0
- package/out/ui/packages/imageList/components/imageListLayout.d.ts +0 -2
- package/out/ui/packages/imageList/components/imageListLayout.luau +0 -8
- package/out/ui/packages/index.d.ts +1 -0
- package/out/ui/packages/init.luau +3 -0
- package/out/ui/packages/input/components/Input.luau +46 -29
- package/out/ui/packages/input/components/Input.styles.luau +8 -11
- package/out/ui/packages/input/components/fieldChrome.d.ts +5 -0
- package/out/ui/packages/input/components/fieldChrome.luau +11 -0
- package/out/ui/packages/layout/components/Box.luau +92 -13
- package/out/ui/packages/layout/components/Box.styles.d.ts +0 -2
- package/out/ui/packages/layout/components/Box.styles.luau +0 -9
- package/out/ui/packages/layout/components/Grid.luau +81 -16
- package/out/ui/packages/layout/components/Pad.d.ts +24 -0
- package/out/ui/packages/layout/components/Pad.luau +88 -0
- package/out/ui/packages/layout/components/Stack.luau +79 -13
- package/out/ui/packages/link/components/Link.luau +19 -13
- package/out/ui/packages/link/components/Link.styles.luau +10 -1
- package/out/ui/packages/listItem/components/ListItem.luau +61 -4
- package/out/ui/packages/listItem/components/ListItem.styles.d.ts +1 -0
- package/out/ui/packages/listItem/components/ListItem.styles.luau +28 -11
- package/out/ui/packages/listItem/components/listItemInk.d.ts +1 -1
- package/out/ui/packages/listItem/components/listItemLayout.d.ts +12 -2
- package/out/ui/packages/listItem/components/listItemLayout.luau +29 -2
- package/out/ui/packages/markdown/components/Markdown.luau +163 -50
- package/out/ui/packages/markdown/components/Markdown.styles.luau +125 -76
- package/out/ui/packages/markdown/components/MarkdownEditor.luau +215 -146
- package/out/ui/packages/markdown/components/MarkdownEditor.styles.d.ts +1 -0
- package/out/ui/packages/markdown/components/MarkdownEditor.styles.luau +153 -83
- package/out/ui/packages/markdown/index.d.ts +1 -1
- package/out/ui/packages/markdown/parseMarkdown.d.ts +9 -1
- package/out/ui/packages/markdown/parseMarkdown.luau +350 -29
- package/out/ui/packages/menu/components/Menu.d.ts +1 -1
- package/out/ui/packages/menu/components/Menu.luau +12 -11
- package/out/ui/packages/menu/components/Menu.styles.luau +6 -1
- package/out/ui/packages/menu/components/menuIcon.d.ts +1 -1
- package/out/ui/packages/numberInput/components/NumberInput.luau +19 -4
- package/out/ui/packages/numberRangeEditor/components/NumberRangeEditor.luau +9 -1
- package/out/ui/packages/numberRangeEditor/components/NumberRangeEditor.styles.luau +23 -16
- package/out/ui/packages/pager/components/Pager.luau +15 -13
- package/out/ui/packages/pager/components/Pager.styles.luau +5 -0
- package/out/ui/packages/pagination/components/Pagination.styles.luau +4 -1
- package/out/ui/packages/paper/components/Paper.luau +17 -11
- package/out/ui/packages/paper/components/Paper.styles.luau +12 -5
- package/out/ui/packages/physicalPropertiesEditor/components/PhysicalPropertiesEditor.luau +9 -1
- package/out/ui/packages/physicalPropertiesEditor/components/PhysicalPropertiesEditor.styles.luau +24 -19
- package/out/ui/packages/popover/components/Popover.d.ts +1 -1
- package/out/ui/packages/popover/components/Popover.luau +6 -4
- package/out/ui/packages/popover/components/Popover.styles.luau +6 -0
- package/out/ui/packages/popup/components/Popup.d.ts +2 -0
- package/out/ui/packages/popup/components/Popup.luau +64 -2
- package/out/ui/packages/popup/components/placement.luau +6 -4
- package/out/ui/packages/progressBar/components/ProgressBar.luau +1 -1
- package/out/ui/packages/progressBar/components/ProgressBar.styles.luau +3 -2
- package/out/ui/packages/radioGroup/components/RadioGroup.luau +2 -1
- package/out/ui/packages/rating/components/Rating.luau +45 -3
- package/out/ui/packages/rating/components/Rating.styles.luau +1 -1
- package/out/ui/packages/rayEditor/components/RayEditor.luau +9 -1
- package/out/ui/packages/rayEditor/components/RayEditor.styles.luau +17 -11
- package/out/ui/packages/rectEditor/components/RectEditor.luau +9 -1
- package/out/ui/packages/rectEditor/components/RectEditor.styles.luau +49 -42
- package/out/ui/packages/select/components/Select.d.ts +2 -0
- package/out/ui/packages/select/components/Select.luau +148 -106
- package/out/ui/packages/select/components/Select.styles.d.ts +2 -0
- package/out/ui/packages/select/components/Select.styles.luau +29 -5
- package/out/ui/packages/shadow/components/Shadow.luau +188 -19
- package/out/ui/packages/sidebar/components/Sidebar.styles.luau +1 -0
- package/out/ui/packages/skeleton/components/Skeleton.luau +4 -0
- package/out/ui/packages/slider/components/RangeSlider.luau +6 -5
- package/out/ui/packages/slider/components/Slider.luau +11 -16
- package/out/ui/packages/sparkline/components/Sparkline.luau +7 -5
- package/out/ui/packages/speedDial/components/SpeedDial.luau +4 -1
- package/out/ui/packages/speedDial/components/SpeedDial.styles.luau +5 -0
- package/out/ui/packages/speedDial/components/speedDialLabel.d.ts +1 -1
- package/out/ui/packages/splitPane/components/splitLook.d.ts +1 -1
- package/out/ui/packages/stepper/components/Stepper.styles.luau +9 -6
- package/out/ui/packages/switch/components/Switch.luau +2 -2
- package/out/ui/packages/switch/components/switchLook.d.ts +3 -3
- package/out/ui/packages/switch/components/switchLook.luau +4 -10
- package/out/ui/packages/table/components/Table.d.ts +1 -0
- package/out/ui/packages/table/components/Table.luau +92 -53
- package/out/ui/packages/table/components/Table.styles.luau +23 -6
- package/out/ui/packages/table/components/tableColumns.d.ts +2 -0
- package/out/ui/packages/table/components/tableColumns.luau +2 -0
- package/out/ui/packages/tabs/components/Tabs.luau +7 -4
- package/out/ui/packages/tabs/components/Tabs.styles.luau +12 -11
- package/out/ui/packages/tabs/components/tabIndicator.d.ts +7 -0
- package/out/ui/packages/tabs/components/tabIndicator.luau +21 -0
- package/out/ui/packages/text/components/Text.d.ts +2 -0
- package/out/ui/packages/text/components/Text.luau +12 -2
- package/out/ui/packages/timeField/components/TimeField.luau +11 -7
- package/out/ui/packages/timeline/components/Timeline.luau +35 -32
- package/out/ui/packages/timeline/components/Timeline.styles.luau +19 -10
- package/out/ui/packages/toast/components/Toast.luau +168 -72
- package/out/ui/packages/toast/components/Toast.styles.luau +36 -19
- package/out/ui/packages/toast/components/toastPlace.d.ts +4 -0
- package/out/ui/packages/toast/components/toastPlace.luau +13 -0
- package/out/ui/packages/toast/enums/ToastVariants.d.ts +2 -1
- package/out/ui/packages/toast/enums/ToastVariants.luau +1 -0
- package/out/ui/packages/toggleButton/components/ToggleButton.luau +43 -4
- package/out/ui/packages/toggleButton/components/ToggleButton.styles.luau +1 -1
- package/out/ui/packages/tooltip/components/Tooltip.styles.luau +2 -2
- package/out/ui/packages/treeView/components/TreeView.luau +12 -13
- package/out/ui/packages/treeView/components/TreeView.styles.luau +6 -0
- package/out/ui/packages/typography/components/Typography.d.ts +2 -0
- package/out/ui/packages/typography/components/Typography.luau +8 -0
- package/out/ui/packages/typography/components/Typography.styles.luau +3 -1
- package/out/ui/packages/udimEditor/components/UDimEditor.luau +9 -1
- package/out/ui/packages/udimEditor/components/UDimEditor.styles.luau +25 -18
- package/out/ui/packages/vectorEditor/components/VectorEditor.luau +17 -3
- package/out/ui/packages/vectorEditor/components/VectorEditor.styles.luau +30 -16
- package/out/ui/packages/virtualList/components/VirtualList.styles.luau +1 -0
- package/package.json +69 -67
|
@@ -5,9 +5,11 @@ local React = _react
|
|
|
5
5
|
local useEffect = _react.useEffect
|
|
6
6
|
local useRef = _react.useRef
|
|
7
7
|
local useState = _react.useState
|
|
8
|
+
local useReducedMotion = TS.import(script, script.Parent.Parent.Parent.Parent.Parent, "hooks").useReducedMotion
|
|
8
9
|
local _theme = TS.import(script, script.Parent.Parent.Parent.Parent.Parent, "theme")
|
|
9
10
|
local cx = _theme.cx
|
|
10
11
|
local useTheme = _theme.useTheme
|
|
12
|
+
local playProperty = TS.import(script, script.Parent.Parent.Parent, "motion", "play").playProperty
|
|
11
13
|
local canActivate = TS.import(script, script.Parent.Parent.Parent, "button", "components", "activation").canActivate
|
|
12
14
|
local spinnerPixels = TS.import(script, script.Parent.Parent.Parent, "button", "components", "buttonLook").spinnerPixels
|
|
13
15
|
local CircularProgress = TS.import(script, script.Parent.Parent.Parent, "circularProgress").CircularProgress
|
|
@@ -73,6 +75,8 @@ local function Input(props)
|
|
|
73
75
|
local id = _binding.id
|
|
74
76
|
local ref = _binding.ref
|
|
75
77
|
local focusedRef = useRef(false)
|
|
78
|
+
local strokeRef = useRef()
|
|
79
|
+
local motion = useReducedMotion(reducedMotion)
|
|
76
80
|
local entered = useRef(false)
|
|
77
81
|
local _condition = text
|
|
78
82
|
if _condition == nil then
|
|
@@ -103,7 +107,6 @@ local function Input(props)
|
|
|
103
107
|
local errorColorText = _binding_2.errorColorText
|
|
104
108
|
local divider = _binding_2.divider
|
|
105
109
|
local corner = _binding_2.corner
|
|
106
|
-
local stroke = _binding_2.stroke
|
|
107
110
|
useEffect(function()
|
|
108
111
|
setDraft(function(current)
|
|
109
112
|
return clampText(syncInputDraft(focusedRef.current, text, current), maxLength)
|
|
@@ -111,6 +114,21 @@ local function Input(props)
|
|
|
111
114
|
end, { text, maxLength })
|
|
112
115
|
local showStroke = variant == "outlined" or variant == "filled"
|
|
113
116
|
local showCorner = rounded
|
|
117
|
+
local ink = if hasError then theme.palette.status.error.main elseif focused then theme.palette.focus else theme.palette.border
|
|
118
|
+
local weight = if focused then 2 else 1
|
|
119
|
+
useEffect(function()
|
|
120
|
+
if not showStroke then
|
|
121
|
+
return nil
|
|
122
|
+
end
|
|
123
|
+
local line = strokeRef.current
|
|
124
|
+
if not line then
|
|
125
|
+
return nil
|
|
126
|
+
end
|
|
127
|
+
return playProperty(line, {
|
|
128
|
+
Color = ink,
|
|
129
|
+
Thickness = weight,
|
|
130
|
+
}, theme.motion.fast, motion)
|
|
131
|
+
end, { showStroke, ink, weight, motion, theme })
|
|
114
132
|
local _attributes = {
|
|
115
133
|
tag = "frame",
|
|
116
134
|
}
|
|
@@ -140,27 +158,26 @@ local function Input(props)
|
|
|
140
158
|
for _k, _v in shell do
|
|
141
159
|
_attributes_2[_k] = _v
|
|
142
160
|
end
|
|
143
|
-
local
|
|
161
|
+
local _exp = showStroke and React.createElement("uistroke", {
|
|
162
|
+
ref = strokeRef,
|
|
163
|
+
ApplyStrokeMode = Enum.ApplyStrokeMode.Border,
|
|
164
|
+
Transparency = 0,
|
|
165
|
+
})
|
|
166
|
+
local _condition_2 = showCorner
|
|
144
167
|
if _condition_2 then
|
|
145
|
-
local _attributes_3 = table.clone(stroke)
|
|
146
|
-
setmetatable(_attributes_3, nil)
|
|
147
|
-
_condition_2 = React.createElement("uistroke", _attributes_3)
|
|
148
|
-
end
|
|
149
|
-
local _condition_3 = showCorner
|
|
150
|
-
if _condition_3 then
|
|
151
168
|
local _attributes_3 = table.clone(corner)
|
|
152
169
|
setmetatable(_attributes_3, nil)
|
|
153
|
-
|
|
170
|
+
_condition_2 = React.createElement("uicorner", _attributes_3)
|
|
154
171
|
end
|
|
155
|
-
local
|
|
156
|
-
if
|
|
172
|
+
local _condition_3 = startAdornment ~= nil
|
|
173
|
+
if _condition_3 then
|
|
157
174
|
local _attributes_3 = {
|
|
158
175
|
key = "Start",
|
|
159
176
|
}
|
|
160
177
|
for _k, _v in startSlot do
|
|
161
178
|
_attributes_3[_k] = _v
|
|
162
179
|
end
|
|
163
|
-
|
|
180
|
+
_condition_3 = (React.createElement("frame", _attributes_3, adornmentAlign(), startAdornment))
|
|
164
181
|
end
|
|
165
182
|
local _attributes_3 = {
|
|
166
183
|
key = "Field",
|
|
@@ -233,48 +250,48 @@ local function Input(props)
|
|
|
233
250
|
if onBlur then
|
|
234
251
|
onBlur()
|
|
235
252
|
end
|
|
236
|
-
local
|
|
237
|
-
if
|
|
238
|
-
|
|
253
|
+
local _condition_4 = text
|
|
254
|
+
if _condition_4 == nil then
|
|
255
|
+
_condition_4 = ""
|
|
239
256
|
end
|
|
240
|
-
setDraft(clampText(
|
|
257
|
+
setDraft(clampText(_condition_4, maxLength))
|
|
241
258
|
end,
|
|
242
259
|
}
|
|
243
|
-
local
|
|
244
|
-
local
|
|
245
|
-
if
|
|
260
|
+
local _exp_1 = React.createElement("textbox", _attributes_3)
|
|
261
|
+
local _condition_4 = loading
|
|
262
|
+
if _condition_4 then
|
|
246
263
|
local _attributes_4 = {
|
|
247
264
|
key = "End",
|
|
248
265
|
}
|
|
249
266
|
for _k, _v in endSlot do
|
|
250
267
|
_attributes_4[_k] = _v
|
|
251
268
|
end
|
|
252
|
-
|
|
269
|
+
_condition_4 = (React.createElement("frame", _attributes_4, adornmentAlign(), React.createElement(CircularProgress, {
|
|
253
270
|
size = spinnerPixels(size),
|
|
254
271
|
thickness = 2,
|
|
255
272
|
color = theme.palette.text.secondary,
|
|
256
273
|
reducedMotion = reducedMotion,
|
|
257
274
|
})))
|
|
258
275
|
end
|
|
259
|
-
local
|
|
260
|
-
if
|
|
276
|
+
local _condition_5 = endSlotContent ~= nil
|
|
277
|
+
if _condition_5 then
|
|
261
278
|
local _attributes_4 = {
|
|
262
279
|
key = "End",
|
|
263
280
|
}
|
|
264
281
|
for _k, _v in endSlot do
|
|
265
282
|
_attributes_4[_k] = _v
|
|
266
283
|
end
|
|
267
|
-
|
|
284
|
+
_condition_5 = (React.createElement("frame", _attributes_4, adornmentAlign(), endSlotContent))
|
|
268
285
|
end
|
|
269
|
-
local
|
|
270
|
-
local
|
|
286
|
+
local _exp_2 = React.createElement("frame", _attributes_2, _exp, _condition_2, _condition_3, _exp_1, _condition_4, _condition_5)
|
|
287
|
+
local _exp_3 = variant == "standard" and (React.createElement(Divider, {
|
|
271
288
|
padding = 0,
|
|
272
289
|
weight = if focused then 2 else nil,
|
|
273
290
|
orientation = Orientations.Horizontal,
|
|
274
291
|
className = cx(divider, hasError and errorColorFrame),
|
|
275
292
|
}))
|
|
276
|
-
local
|
|
277
|
-
if
|
|
293
|
+
local _condition_6 = helperText ~= nil
|
|
294
|
+
if _condition_6 then
|
|
278
295
|
local _attributes_4 = {
|
|
279
296
|
key = "HelperText",
|
|
280
297
|
}
|
|
@@ -288,9 +305,9 @@ local function Input(props)
|
|
|
288
305
|
_attributes_4[_k] = _v
|
|
289
306
|
end
|
|
290
307
|
_attributes_4.Text = helperText
|
|
291
|
-
|
|
308
|
+
_condition_6 = (React.createElement("textlabel", _attributes_4))
|
|
292
309
|
end
|
|
293
|
-
return React.createElement(SxHost, _attributes, React.createElement("frame", _attributes_1,
|
|
310
|
+
return React.createElement(SxHost, _attributes, React.createElement("frame", _attributes_1, _exp_2, _exp_3, _condition_6))
|
|
294
311
|
end
|
|
295
312
|
local default = Input
|
|
296
313
|
return {
|
|
@@ -5,13 +5,10 @@ local controlMetrics = _theme.controlMetrics
|
|
|
5
5
|
local createStyles = _theme.createStyles
|
|
6
6
|
local componentStyles = _theme.componentStyles
|
|
7
7
|
local focusRing = _theme.focusRing
|
|
8
|
+
local fieldChrome = TS.import(script, script.Parent, "fieldChrome").fieldChrome
|
|
8
9
|
local inputInsets = TS.import(script, script.Parent, "inputInsets").inputInsets
|
|
9
10
|
local multilineHeight = TS.import(script, script.Parent, "multilineHeight").multilineHeight
|
|
10
11
|
local useInputStyles = componentStyles("Input", function(theme, _param)
|
|
11
|
-
local color = _param.color
|
|
12
|
-
if color == nil then
|
|
13
|
-
color = "primary"
|
|
14
|
-
end
|
|
15
12
|
local margin = _param.margin
|
|
16
13
|
if margin == nil then
|
|
17
14
|
margin = "none"
|
|
@@ -61,14 +58,14 @@ local useInputStyles = componentStyles("Input", function(theme, _param)
|
|
|
61
58
|
contentHeight = 0
|
|
62
59
|
end
|
|
63
60
|
local metrics = controlMetrics(theme.density, size)
|
|
61
|
+
local chrome = fieldChrome(metrics.height, theme.padding.calc(1))
|
|
64
62
|
local hasStart = startAdornment ~= nil
|
|
65
63
|
local hasEnd = endAdornment ~= nil or loading
|
|
66
64
|
local icon = metrics.icon
|
|
67
|
-
local gap =
|
|
65
|
+
local gap = chrome.padX
|
|
68
66
|
local insets = inputInsets(hasStart, hasEnd, icon, gap)
|
|
69
|
-
local verticalPad =
|
|
70
|
-
local fieldHeight = if multiline then multilineHeight(contentHeight, metrics.font, minRows, maxRows, verticalPad) else
|
|
71
|
-
local accent = if color == "primary" then theme.palette.primary.main else theme.palette.text.primary
|
|
67
|
+
local verticalPad = chrome.padX
|
|
68
|
+
local fieldHeight = if multiline then multilineHeight(contentHeight, metrics.font, minRows, maxRows, verticalPad) else chrome.height
|
|
72
69
|
local makeRootStyles = function()
|
|
73
70
|
local defaultStyles = {}
|
|
74
71
|
defaultStyles.BackgroundTransparency = 1
|
|
@@ -186,7 +183,7 @@ local useInputStyles = componentStyles("Input", function(theme, _param)
|
|
|
186
183
|
},
|
|
187
184
|
divider = {
|
|
188
185
|
Position = UDim2.new(0, 0, 0, fieldHeight),
|
|
189
|
-
BackgroundColor3 = if focused then theme.palette.focus else
|
|
186
|
+
BackgroundColor3 = if focused then theme.palette.focus else theme.palette.border,
|
|
190
187
|
ZIndex = 11000,
|
|
191
188
|
},
|
|
192
189
|
corner = {
|
|
@@ -195,8 +192,8 @@ local useInputStyles = componentStyles("Input", function(theme, _param)
|
|
|
195
192
|
}
|
|
196
193
|
local _left = "stroke"
|
|
197
194
|
local _object_1 = {
|
|
198
|
-
Color = if hasError then theme.palette.status.error.main else
|
|
199
|
-
Transparency =
|
|
195
|
+
Color = if hasError then theme.palette.status.error.main elseif focused then theme.palette.focus else theme.palette.border,
|
|
196
|
+
Transparency = 0,
|
|
200
197
|
Thickness = 1,
|
|
201
198
|
ApplyStrokeMode = Enum.ApplyStrokeMode.Border,
|
|
202
199
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
--* Shared single-line field size. Height is the control metric. Inset is one padding step.
|
|
3
|
+
local function fieldChrome(controlHeight, padUnit)
|
|
4
|
+
return {
|
|
5
|
+
height = controlHeight,
|
|
6
|
+
padX = padUnit,
|
|
7
|
+
}
|
|
8
|
+
end
|
|
9
|
+
return {
|
|
10
|
+
fieldChrome = fieldChrome,
|
|
11
|
+
}
|
|
@@ -1,8 +1,71 @@
|
|
|
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 _theme = TS.import(script, script.Parent.Parent.Parent.Parent.Parent, "theme")
|
|
5
|
+
local resolveSx = _theme.resolveSx
|
|
6
|
+
local useTheme = _theme.useTheme
|
|
4
7
|
local SxHost = TS.import(script, script.Parent.Parent.Parent, "host").SxHost
|
|
8
|
+
local boxPadSides = TS.import(script, script.Parent, "boxPad").boxPadSides
|
|
5
9
|
local useBoxStyles = TS.import(script, script.Parent, "Box.styles").default
|
|
10
|
+
local _Pad = TS.import(script, script.Parent, "Pad")
|
|
11
|
+
local automaticAxes = _Pad.automaticAxes
|
|
12
|
+
local Pad = _Pad.Pad
|
|
13
|
+
local padActive = _Pad.padActive
|
|
14
|
+
local styleAutomaticSize = _Pad.styleAutomaticSize
|
|
15
|
+
local withoutPad = _Pad.withoutPad
|
|
16
|
+
local function padPixels(themePad, padding, resolved)
|
|
17
|
+
local sides = boxPadSides(padding)
|
|
18
|
+
if sides.top + sides.right + sides.bottom + sides.left > 0 then
|
|
19
|
+
return {
|
|
20
|
+
left = themePad(sides.left),
|
|
21
|
+
right = themePad(sides.right),
|
|
22
|
+
top = themePad(sides.top),
|
|
23
|
+
bottom = themePad(sides.bottom),
|
|
24
|
+
}
|
|
25
|
+
end
|
|
26
|
+
local _object = {}
|
|
27
|
+
local _left = "left"
|
|
28
|
+
local _result = resolved
|
|
29
|
+
if _result ~= nil then
|
|
30
|
+
_result = _result.PaddingLeft.Offset
|
|
31
|
+
end
|
|
32
|
+
local _condition = _result
|
|
33
|
+
if _condition == nil then
|
|
34
|
+
_condition = 0
|
|
35
|
+
end
|
|
36
|
+
_object[_left] = _condition
|
|
37
|
+
local _left_1 = "right"
|
|
38
|
+
local _result_1 = resolved
|
|
39
|
+
if _result_1 ~= nil then
|
|
40
|
+
_result_1 = _result_1.PaddingRight.Offset
|
|
41
|
+
end
|
|
42
|
+
local _condition_1 = _result_1
|
|
43
|
+
if _condition_1 == nil then
|
|
44
|
+
_condition_1 = 0
|
|
45
|
+
end
|
|
46
|
+
_object[_left_1] = _condition_1
|
|
47
|
+
local _left_2 = "top"
|
|
48
|
+
local _result_2 = resolved
|
|
49
|
+
if _result_2 ~= nil then
|
|
50
|
+
_result_2 = _result_2.PaddingTop.Offset
|
|
51
|
+
end
|
|
52
|
+
local _condition_2 = _result_2
|
|
53
|
+
if _condition_2 == nil then
|
|
54
|
+
_condition_2 = 0
|
|
55
|
+
end
|
|
56
|
+
_object[_left_2] = _condition_2
|
|
57
|
+
local _left_3 = "bottom"
|
|
58
|
+
local _result_3 = resolved
|
|
59
|
+
if _result_3 ~= nil then
|
|
60
|
+
_result_3 = _result_3.PaddingBottom.Offset
|
|
61
|
+
end
|
|
62
|
+
local _condition_3 = _result_3
|
|
63
|
+
if _condition_3 == nil then
|
|
64
|
+
_condition_3 = 0
|
|
65
|
+
end
|
|
66
|
+
_object[_left_3] = _condition_3
|
|
67
|
+
return _object
|
|
68
|
+
end
|
|
6
69
|
local function Box(props)
|
|
7
70
|
local _binding = props
|
|
8
71
|
local padding = _binding.padding
|
|
@@ -12,27 +75,43 @@ local function Box(props)
|
|
|
12
75
|
local sx = _binding.sx
|
|
13
76
|
local id = _binding.id
|
|
14
77
|
local ref = _binding.ref
|
|
78
|
+
local _binding_1 = useTheme()
|
|
79
|
+
local theme = _binding_1.theme
|
|
15
80
|
local styles = useBoxStyles({
|
|
16
|
-
padding = padding,
|
|
17
81
|
bgcolor = bgcolor,
|
|
18
82
|
})
|
|
83
|
+
local resolved = resolveSx(theme, sx).padding
|
|
84
|
+
local edges = padPixels(function(step)
|
|
85
|
+
return theme.spacing.calc(step)
|
|
86
|
+
end, padding, resolved)
|
|
87
|
+
local inset = padActive(edges.left, edges.right, edges.top, edges.bottom)
|
|
88
|
+
local _result = sx
|
|
89
|
+
if _result ~= nil then
|
|
90
|
+
_result = _result.AutomaticSize
|
|
91
|
+
end
|
|
92
|
+
local _condition = _result
|
|
93
|
+
if _condition == nil then
|
|
94
|
+
_condition = styleAutomaticSize(styles.root)
|
|
95
|
+
end
|
|
96
|
+
local auto = automaticAxes(_condition)
|
|
19
97
|
local _attributes = {}
|
|
20
|
-
local
|
|
21
|
-
if not (
|
|
22
|
-
|
|
98
|
+
local _condition_1 = id
|
|
99
|
+
if not (_condition_1 ~= 0 and _condition_1 == _condition_1 and _condition_1 ~= "" and _condition_1) then
|
|
100
|
+
_condition_1 = "Box"
|
|
23
101
|
end
|
|
24
|
-
_attributes.key =
|
|
102
|
+
_attributes.key = _condition_1
|
|
25
103
|
_attributes.hostRef = ref
|
|
26
104
|
_attributes.base = styles.root
|
|
27
105
|
_attributes.className = className
|
|
28
|
-
_attributes.sx = sx
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
106
|
+
_attributes.sx = if inset then withoutPad(sx) else sx
|
|
107
|
+
return React.createElement(SxHost, _attributes, if inset then (React.createElement(Pad, {
|
|
108
|
+
left = edges.left,
|
|
109
|
+
right = edges.right,
|
|
110
|
+
top = edges.top,
|
|
111
|
+
bottom = edges.bottom,
|
|
112
|
+
autoX = auto.x,
|
|
113
|
+
autoY = auto.y,
|
|
114
|
+
}, children)) else children)
|
|
36
115
|
end
|
|
37
116
|
local default = Box
|
|
38
117
|
return {
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { BoxPad } from "./boxPad";
|
|
2
1
|
export type BoxBg = "transparent" | "paper" | "elevated" | "input";
|
|
3
2
|
declare const useBoxStyles: (props: {
|
|
4
|
-
padding?: BoxPad;
|
|
5
3
|
bgcolor?: BoxBg;
|
|
6
4
|
}) => import("../../../../theme/index").ClassNameMap<string>;
|
|
7
5
|
export default useBoxStyles;
|
|
@@ -3,14 +3,11 @@ local TS = _G[script]
|
|
|
3
3
|
local _theme = TS.import(script, script.Parent.Parent.Parent.Parent.Parent, "theme")
|
|
4
4
|
local componentStyles = _theme.componentStyles
|
|
5
5
|
local createStyles = _theme.createStyles
|
|
6
|
-
local boxPadSides = TS.import(script, script.Parent, "boxPad").boxPadSides
|
|
7
6
|
local useBoxStyles = componentStyles("Box", function(theme, _param)
|
|
8
|
-
local padding = _param.padding
|
|
9
7
|
local bgcolor = _param.bgcolor
|
|
10
8
|
if bgcolor == nil then
|
|
11
9
|
bgcolor = "transparent"
|
|
12
10
|
end
|
|
13
|
-
local sides = boxPadSides(padding)
|
|
14
11
|
local fill = if bgcolor == "paper" then theme.palette.surface.paper elseif bgcolor == "elevated" then theme.palette.surface.elevated elseif bgcolor == "input" then theme.palette.surface.input else theme.palette.surface.paper
|
|
15
12
|
return createStyles({
|
|
16
13
|
root = {
|
|
@@ -20,12 +17,6 @@ local useBoxStyles = componentStyles("Box", function(theme, _param)
|
|
|
20
17
|
BackgroundTransparency = if bgcolor == "transparent" then 1 else 0,
|
|
21
18
|
BorderSizePixel = 0,
|
|
22
19
|
},
|
|
23
|
-
padding = {
|
|
24
|
-
PaddingTop = UDim.new(0, theme.spacing.calc(sides.top)),
|
|
25
|
-
PaddingRight = UDim.new(0, theme.spacing.calc(sides.right)),
|
|
26
|
-
PaddingBottom = UDim.new(0, theme.spacing.calc(sides.bottom)),
|
|
27
|
-
PaddingLeft = UDim.new(0, theme.spacing.calc(sides.left)),
|
|
28
|
-
},
|
|
29
20
|
})
|
|
30
21
|
end)
|
|
31
22
|
local default = useBoxStyles
|
|
@@ -4,7 +4,15 @@ local React = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
|
4
4
|
local _theme = TS.import(script, script.Parent.Parent.Parent.Parent.Parent, "theme")
|
|
5
5
|
local componentStyles = _theme.componentStyles
|
|
6
6
|
local createStyles = _theme.createStyles
|
|
7
|
+
local resolveSx = _theme.resolveSx
|
|
8
|
+
local useTheme = _theme.useTheme
|
|
7
9
|
local SxHost = TS.import(script, script.Parent.Parent.Parent, "host").SxHost
|
|
10
|
+
local _Pad = TS.import(script, script.Parent, "Pad")
|
|
11
|
+
local automaticAxes = _Pad.automaticAxes
|
|
12
|
+
local Pad = _Pad.Pad
|
|
13
|
+
local padActive = _Pad.padActive
|
|
14
|
+
local styleAutomaticSize = _Pad.styleAutomaticSize
|
|
15
|
+
local withoutPad = _Pad.withoutPad
|
|
8
16
|
local _gridProps = TS.import(script, script.Parent, "gridProps")
|
|
9
17
|
local gridCornerKey = _gridProps.gridCornerKey
|
|
10
18
|
local gridMaxCells = _gridProps.gridMaxCells
|
|
@@ -92,7 +100,9 @@ local function Grid(props)
|
|
|
92
100
|
local children = _binding.children
|
|
93
101
|
local id = _binding.id
|
|
94
102
|
local ref = _binding.ref
|
|
95
|
-
local _binding_1 =
|
|
103
|
+
local _binding_1 = useTheme()
|
|
104
|
+
local theme = _binding_1.theme
|
|
105
|
+
local _binding_2 = useGridStyles({
|
|
96
106
|
cellPadding = cellPadding,
|
|
97
107
|
cellSize = cellSize,
|
|
98
108
|
gap = gap,
|
|
@@ -105,25 +115,80 @@ local function Grid(props)
|
|
|
105
115
|
horizontalAlignment = horizontalAlignment,
|
|
106
116
|
verticalAlignment = verticalAlignment,
|
|
107
117
|
})
|
|
108
|
-
local baseGrid =
|
|
109
|
-
local baseLayout =
|
|
110
|
-
local
|
|
111
|
-
local
|
|
112
|
-
if
|
|
113
|
-
|
|
114
|
-
end
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
local
|
|
118
|
+
local baseGrid = _binding_2.baseGrid
|
|
119
|
+
local baseLayout = _binding_2.baseLayout
|
|
120
|
+
local pad = resolveSx(theme, sx).padding
|
|
121
|
+
local _result = pad
|
|
122
|
+
if _result ~= nil then
|
|
123
|
+
_result = _result.PaddingLeft.Offset
|
|
124
|
+
end
|
|
125
|
+
local _condition = _result
|
|
126
|
+
if _condition == nil then
|
|
127
|
+
_condition = 0
|
|
128
|
+
end
|
|
129
|
+
local left = _condition
|
|
130
|
+
local _result_1 = pad
|
|
131
|
+
if _result_1 ~= nil then
|
|
132
|
+
_result_1 = _result_1.PaddingRight.Offset
|
|
133
|
+
end
|
|
134
|
+
local _condition_1 = _result_1
|
|
135
|
+
if _condition_1 == nil then
|
|
136
|
+
_condition_1 = 0
|
|
137
|
+
end
|
|
138
|
+
local right = _condition_1
|
|
139
|
+
local _result_2 = pad
|
|
140
|
+
if _result_2 ~= nil then
|
|
141
|
+
_result_2 = _result_2.PaddingTop.Offset
|
|
142
|
+
end
|
|
143
|
+
local _condition_2 = _result_2
|
|
144
|
+
if _condition_2 == nil then
|
|
145
|
+
_condition_2 = 0
|
|
146
|
+
end
|
|
147
|
+
local top = _condition_2
|
|
148
|
+
local _result_3 = pad
|
|
149
|
+
if _result_3 ~= nil then
|
|
150
|
+
_result_3 = _result_3.PaddingBottom.Offset
|
|
151
|
+
end
|
|
152
|
+
local _condition_3 = _result_3
|
|
153
|
+
if _condition_3 == nil then
|
|
154
|
+
_condition_3 = 0
|
|
155
|
+
end
|
|
156
|
+
local bottom = _condition_3
|
|
157
|
+
local inset = padActive(left, right, top, bottom)
|
|
158
|
+
local _result_4 = sx
|
|
159
|
+
if _result_4 ~= nil then
|
|
160
|
+
_result_4 = _result_4.AutomaticSize
|
|
161
|
+
end
|
|
162
|
+
local _condition_4 = _result_4
|
|
163
|
+
if _condition_4 == nil then
|
|
164
|
+
_condition_4 = styleAutomaticSize(baseGrid)
|
|
165
|
+
end
|
|
166
|
+
local auto = automaticAxes(_condition_4)
|
|
167
|
+
local _attributes = {
|
|
121
168
|
key = "GridLayout",
|
|
122
169
|
}
|
|
123
170
|
for _k, _v in baseLayout do
|
|
124
|
-
|
|
171
|
+
_attributes[_k] = _v
|
|
172
|
+
end
|
|
173
|
+
local body = (React.createElement(React.Fragment, nil, React.createElement("uigridlayout", _attributes), children))
|
|
174
|
+
local _attributes_1 = {}
|
|
175
|
+
local _condition_5 = id
|
|
176
|
+
if not (_condition_5 ~= 0 and _condition_5 == _condition_5 and _condition_5 ~= "" and _condition_5) then
|
|
177
|
+
_condition_5 = "Grid"
|
|
125
178
|
end
|
|
126
|
-
|
|
179
|
+
_attributes_1.key = _condition_5
|
|
180
|
+
_attributes_1.hostRef = ref
|
|
181
|
+
_attributes_1.base = baseGrid
|
|
182
|
+
_attributes_1.className = className
|
|
183
|
+
_attributes_1.sx = if inset then withoutPad(sx) else sx
|
|
184
|
+
return React.createElement(SxHost, _attributes_1, if inset then (React.createElement(Pad, {
|
|
185
|
+
left = left,
|
|
186
|
+
right = right,
|
|
187
|
+
top = top,
|
|
188
|
+
bottom = bottom,
|
|
189
|
+
autoX = auto.x,
|
|
190
|
+
autoY = auto.y,
|
|
191
|
+
}, body)) else body)
|
|
127
192
|
end
|
|
128
193
|
local default = Grid
|
|
129
194
|
return {
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from "@rbxts/react";
|
|
2
|
+
/** Padding on the host offsets scale-sized children without shrinking them. */
|
|
3
|
+
export declare function withoutPad(sx: object | undefined): {
|
|
4
|
+
[key: string]: unknown;
|
|
5
|
+
} | undefined;
|
|
6
|
+
export declare function styleAutomaticSize(style: object): Enum.AutomaticSize | undefined;
|
|
7
|
+
export declare function automaticAxes(value: Enum.AutomaticSize | undefined): {
|
|
8
|
+
x: boolean;
|
|
9
|
+
y: boolean;
|
|
10
|
+
};
|
|
11
|
+
export declare function padActive(left: number, right: number, top: number, bottom: number): boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Fixed axes use a shrunk size so scale children stop at the padding.
|
|
14
|
+
* Automatic axes keep trailing padding on the content instead.
|
|
15
|
+
*/
|
|
16
|
+
export declare function Pad(props: {
|
|
17
|
+
left: number;
|
|
18
|
+
right: number;
|
|
19
|
+
top: number;
|
|
20
|
+
bottom: number;
|
|
21
|
+
autoX: boolean;
|
|
22
|
+
autoY: boolean;
|
|
23
|
+
children?: React.ReactNode;
|
|
24
|
+
}): JSX.Element;
|
|
@@ -0,0 +1,88 @@
|
|
|
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 function isPadKey(key)
|
|
5
|
+
return key == "p" or key == "px" or key == "py" or key == "pt" or key == "pr" or key == "pb" or key == "pl" or key == "padding"
|
|
6
|
+
end
|
|
7
|
+
--* Padding on the host offsets scale-sized children without shrinking them.
|
|
8
|
+
local function withoutPad(sx)
|
|
9
|
+
if sx == nil then
|
|
10
|
+
return nil
|
|
11
|
+
end
|
|
12
|
+
local rest = {}
|
|
13
|
+
local kept = false
|
|
14
|
+
for key, value in pairs(sx) do
|
|
15
|
+
local name = tostring(key)
|
|
16
|
+
if isPadKey(name) then
|
|
17
|
+
continue
|
|
18
|
+
end
|
|
19
|
+
rest[name] = value
|
|
20
|
+
kept = true
|
|
21
|
+
end
|
|
22
|
+
return if kept then rest else nil
|
|
23
|
+
end
|
|
24
|
+
local function styleAutomaticSize(style)
|
|
25
|
+
return style.AutomaticSize
|
|
26
|
+
end
|
|
27
|
+
local function automaticAxes(value)
|
|
28
|
+
if value == Enum.AutomaticSize.X then
|
|
29
|
+
return {
|
|
30
|
+
x = true,
|
|
31
|
+
y = false,
|
|
32
|
+
}
|
|
33
|
+
end
|
|
34
|
+
if value == Enum.AutomaticSize.Y then
|
|
35
|
+
return {
|
|
36
|
+
x = false,
|
|
37
|
+
y = true,
|
|
38
|
+
}
|
|
39
|
+
end
|
|
40
|
+
if value == Enum.AutomaticSize.XY then
|
|
41
|
+
return {
|
|
42
|
+
x = true,
|
|
43
|
+
y = true,
|
|
44
|
+
}
|
|
45
|
+
end
|
|
46
|
+
return {
|
|
47
|
+
x = false,
|
|
48
|
+
y = false,
|
|
49
|
+
}
|
|
50
|
+
end
|
|
51
|
+
local function padActive(left, right, top, bottom)
|
|
52
|
+
return left + right + top + bottom > 0
|
|
53
|
+
end
|
|
54
|
+
--[[
|
|
55
|
+
*
|
|
56
|
+
* Fixed axes use a shrunk size so scale children stop at the padding.
|
|
57
|
+
* Automatic axes keep trailing padding on the content instead.
|
|
58
|
+
|
|
59
|
+
]]
|
|
60
|
+
local function Pad(props)
|
|
61
|
+
local _binding = props
|
|
62
|
+
local left = _binding.left
|
|
63
|
+
local right = _binding.right
|
|
64
|
+
local top = _binding.top
|
|
65
|
+
local bottom = _binding.bottom
|
|
66
|
+
local autoX = _binding.autoX
|
|
67
|
+
local autoY = _binding.autoY
|
|
68
|
+
local children = _binding.children
|
|
69
|
+
local auto = if autoX and autoY then Enum.AutomaticSize.XY elseif autoY then Enum.AutomaticSize.Y elseif autoX then Enum.AutomaticSize.X else Enum.AutomaticSize.None
|
|
70
|
+
return React.createElement("frame", {
|
|
71
|
+
key = "Pad",
|
|
72
|
+
Position = UDim2.new(0, left, 0, top),
|
|
73
|
+
Size = UDim2.new(if autoX then 0 else 1, if autoX then 0 else -(left + right), if autoY then 0 else 1, if autoY then 0 else -(top + bottom)),
|
|
74
|
+
AutomaticSize = auto,
|
|
75
|
+
BackgroundTransparency = 1,
|
|
76
|
+
BorderSizePixel = 0,
|
|
77
|
+
}, if autoX or autoY then (React.createElement("uipadding", {
|
|
78
|
+
PaddingRight = UDim.new(0, if autoX then right else 0),
|
|
79
|
+
PaddingBottom = UDim.new(0, if autoY then bottom else 0),
|
|
80
|
+
})) else nil, children)
|
|
81
|
+
end
|
|
82
|
+
return {
|
|
83
|
+
withoutPad = withoutPad,
|
|
84
|
+
styleAutomaticSize = styleAutomaticSize,
|
|
85
|
+
automaticAxes = automaticAxes,
|
|
86
|
+
padActive = padActive,
|
|
87
|
+
Pad = Pad,
|
|
88
|
+
}
|