@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
|
@@ -3,8 +3,12 @@ local TS = _G[script]
|
|
|
3
3
|
local _theme = TS.import(script, script.Parent.Parent.Parent.Parent.Parent, "theme")
|
|
4
4
|
local createStyles = _theme.createStyles
|
|
5
5
|
local componentStyles = _theme.componentStyles
|
|
6
|
+
local _editorFace = TS.import(script, script.Parent.Parent.Parent, "editorFace")
|
|
7
|
+
local editorPad = _editorFace.editorPad
|
|
8
|
+
local editorRowHeight = _editorFace.editorRowHeight
|
|
9
|
+
local editorText = _editorFace.editorText
|
|
6
10
|
local useNumberRangeEditorStyles = componentStyles("NumberRangeEditor", function(theme)
|
|
7
|
-
|
|
11
|
+
local _object = {
|
|
8
12
|
root = {
|
|
9
13
|
Size = UDim2.new(1, 0, 0, 0),
|
|
10
14
|
AutomaticSize = Enum.AutomaticSize.Y,
|
|
@@ -13,27 +17,30 @@ local useNumberRangeEditorStyles = componentStyles("NumberRangeEditor", function
|
|
|
13
17
|
},
|
|
14
18
|
row = {
|
|
15
19
|
FillDirection = Enum.FillDirection.Horizontal,
|
|
16
|
-
Padding = UDim.new(0, theme
|
|
20
|
+
Padding = UDim.new(0, editorPad(theme)),
|
|
17
21
|
VerticalAlignment = Enum.VerticalAlignment.Center,
|
|
18
22
|
SortOrder = Enum.SortOrder.LayoutOrder,
|
|
19
23
|
},
|
|
20
24
|
axis = {
|
|
21
|
-
Size = UDim2.new(0.5, 0, 0, theme
|
|
25
|
+
Size = UDim2.new(0.5, 0, 0, editorRowHeight(theme)),
|
|
22
26
|
BackgroundTransparency = 1,
|
|
23
27
|
},
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
28
|
+
}
|
|
29
|
+
local _left = "label"
|
|
30
|
+
local _object_1 = {
|
|
31
|
+
Size = UDim2.new(0, theme.spacing.calc(2.5), 1, 0),
|
|
32
|
+
BackgroundTransparency = 1,
|
|
33
|
+
TextColor3 = theme.palette.text.secondary,
|
|
34
|
+
}
|
|
35
|
+
for _k, _v in editorText(theme) do
|
|
36
|
+
_object_1[_k] = _v
|
|
37
|
+
end
|
|
38
|
+
_object[_left] = _object_1
|
|
39
|
+
_object.field = {
|
|
40
|
+
Size = UDim2.new(1, -theme.spacing.calc(2.5), 1, 0),
|
|
41
|
+
BackgroundTransparency = 1,
|
|
42
|
+
}
|
|
43
|
+
return createStyles(_object)
|
|
37
44
|
end)
|
|
38
45
|
local default = useNumberRangeEditorStyles
|
|
39
46
|
return {
|
|
@@ -78,33 +78,35 @@ local function Pager(props)
|
|
|
78
78
|
end
|
|
79
79
|
_attributes_5.Text = pagerLabel(index, count)
|
|
80
80
|
_attributes_5.LayoutOrder = 1
|
|
81
|
-
local
|
|
82
|
-
|
|
81
|
+
local _attributes_6 = table.clone(styles.labelCap)
|
|
82
|
+
setmetatable(_attributes_6, nil)
|
|
83
|
+
local _exp_3 = React.createElement("textlabel", _attributes_5, React.createElement("uisizeconstraint", _attributes_6))
|
|
84
|
+
local _attributes_7 = {
|
|
83
85
|
key = "Next",
|
|
84
86
|
}
|
|
85
87
|
for _k, _v in styles.button do
|
|
86
|
-
|
|
88
|
+
_attributes_7[_k] = _v
|
|
87
89
|
end
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
90
|
+
_attributes_7.Text = "Next"
|
|
91
|
+
_attributes_7.TextTransparency = if groupOff or forward == place then 0.5 else 0
|
|
92
|
+
_attributes_7.Active = canActivate(groupOff or forward == place)
|
|
93
|
+
_attributes_7.LayoutOrder = 2
|
|
94
|
+
_attributes_7.Event = {
|
|
93
95
|
Activated = function()
|
|
94
96
|
if not groupOff and forward ~= place then
|
|
95
97
|
onChange(forward)
|
|
96
98
|
end
|
|
97
99
|
end,
|
|
98
100
|
}
|
|
99
|
-
local _exp_4 = React.createElement("frame", _attributes_2, _exp_1, _exp_2, _exp_3, React.createElement("textbutton",
|
|
100
|
-
local
|
|
101
|
+
local _exp_4 = React.createElement("frame", _attributes_2, _exp_1, _exp_2, _exp_3, React.createElement("textbutton", _attributes_7))
|
|
102
|
+
local _attributes_8 = {
|
|
101
103
|
key = "Body",
|
|
102
104
|
}
|
|
103
105
|
for _k, _v in styles.body do
|
|
104
|
-
|
|
106
|
+
_attributes_8[_k] = _v
|
|
105
107
|
end
|
|
106
|
-
|
|
107
|
-
return React.createElement(SxHost, _attributes, _exp, _exp_4, React.createElement("frame",
|
|
108
|
+
_attributes_8.LayoutOrder = 1
|
|
109
|
+
return React.createElement(SxHost, _attributes, _exp, _exp_4, React.createElement("frame", _attributes_8, children))
|
|
108
110
|
end
|
|
109
111
|
local default = Pager
|
|
110
112
|
return {
|
|
@@ -46,6 +46,11 @@ local usePagerStyles = componentStyles("Pager", function(theme)
|
|
|
46
46
|
TextColor3 = theme.palette.text.secondary,
|
|
47
47
|
Font = theme.typography.fontFamilies.default,
|
|
48
48
|
TextSize = theme.typography.fontSizes.caption,
|
|
49
|
+
TextTruncate = Enum.TextTruncate.AtEnd,
|
|
50
|
+
TextWrapped = false,
|
|
51
|
+
},
|
|
52
|
+
labelCap = {
|
|
53
|
+
MaxSize = Vector2.new(theme.spacing.calc(10), math.huge),
|
|
49
54
|
},
|
|
50
55
|
body = {
|
|
51
56
|
AutomaticSize = Enum.AutomaticSize.XY,
|
|
@@ -24,7 +24,7 @@ local usePaginationStyles = componentStyles("Pagination", function(theme, _param
|
|
|
24
24
|
},
|
|
25
25
|
list = {
|
|
26
26
|
FillDirection = Enum.FillDirection.Horizontal,
|
|
27
|
-
Padding = UDim.new(0, theme.padding.calc(if size == "small" then 0.
|
|
27
|
+
Padding = UDim.new(0, theme.padding.calc(if size == "small" then 0.5 else 1)),
|
|
28
28
|
SortOrder = Enum.SortOrder.LayoutOrder,
|
|
29
29
|
},
|
|
30
30
|
page = {
|
|
@@ -36,10 +36,13 @@ local usePaginationStyles = componentStyles("Pagination", function(theme, _param
|
|
|
36
36
|
Font = theme.typography.fontFamilies.default,
|
|
37
37
|
TextSize = text,
|
|
38
38
|
TextColor3 = theme.palette.text.primary,
|
|
39
|
+
TextTruncate = Enum.TextTruncate.AtEnd,
|
|
40
|
+
TextXAlignment = Enum.TextXAlignment.Center,
|
|
39
41
|
},
|
|
40
42
|
selected = {
|
|
41
43
|
BackgroundColor3 = theme.palette.action.selected,
|
|
42
44
|
BackgroundTransparency = 0,
|
|
45
|
+
TextColor3 = theme.palette.text.primary,
|
|
43
46
|
},
|
|
44
47
|
stroke = {
|
|
45
48
|
Color = theme.palette.border,
|
|
@@ -30,22 +30,28 @@ local function Paper(props)
|
|
|
30
30
|
_attributes.className = className
|
|
31
31
|
_attributes.sx = sx
|
|
32
32
|
local _exp = elevation == "raised" and React.createElement(Shadow)
|
|
33
|
-
local _attributes_1 =
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
local _attributes_1 = {
|
|
34
|
+
key = "Content",
|
|
35
|
+
}
|
|
36
|
+
for _k, _v in styles.content do
|
|
37
|
+
_attributes_1[_k] = _v
|
|
38
|
+
end
|
|
39
|
+
local _attributes_2 = table.clone(styles.padding)
|
|
40
|
+
setmetatable(_attributes_2, nil)
|
|
41
|
+
local _exp_1 = React.createElement("frame", _attributes_1, React.createElement("uipadding", _attributes_2), children)
|
|
36
42
|
local _condition_1 = square ~= true
|
|
37
43
|
if _condition_1 then
|
|
38
|
-
local
|
|
39
|
-
setmetatable(
|
|
40
|
-
_condition_1 = React.createElement("uicorner",
|
|
44
|
+
local _attributes_3 = table.clone(styles.corner)
|
|
45
|
+
setmetatable(_attributes_3, nil)
|
|
46
|
+
_condition_1 = React.createElement("uicorner", _attributes_3)
|
|
41
47
|
end
|
|
42
|
-
local _condition_2 = elevation
|
|
48
|
+
local _condition_2 = elevation ~= "raised"
|
|
43
49
|
if _condition_2 then
|
|
44
|
-
local
|
|
45
|
-
setmetatable(
|
|
46
|
-
_condition_2 = React.createElement("uistroke",
|
|
50
|
+
local _attributes_3 = table.clone(styles.stroke)
|
|
51
|
+
setmetatable(_attributes_3, nil)
|
|
52
|
+
_condition_2 = React.createElement("uistroke", _attributes_3)
|
|
47
53
|
end
|
|
48
|
-
return React.createElement(SxHost, _attributes, _exp, _exp_1, _condition_1, _condition_2
|
|
54
|
+
return React.createElement(SxHost, _attributes, _exp, _exp_1, _condition_1, _condition_2)
|
|
49
55
|
end
|
|
50
56
|
local default = Paper
|
|
51
57
|
return {
|
|
@@ -8,6 +8,7 @@ local usePaperStyles = componentStyles("Paper", function(theme, _param)
|
|
|
8
8
|
if elevation == nil then
|
|
9
9
|
elevation = "flat"
|
|
10
10
|
end
|
|
11
|
+
local pad = theme.spacing.calc(2)
|
|
11
12
|
return createStyles({
|
|
12
13
|
root = {
|
|
13
14
|
AutomaticSize = Enum.AutomaticSize.XY,
|
|
@@ -16,16 +17,22 @@ local usePaperStyles = componentStyles("Paper", function(theme, _param)
|
|
|
16
17
|
BorderSizePixel = 0,
|
|
17
18
|
},
|
|
18
19
|
stroke = {
|
|
19
|
-
Color = theme.palette.border,
|
|
20
|
+
Color = if elevation == "outlined" then theme.palette.border else theme.palette.divider,
|
|
20
21
|
ApplyStrokeMode = Enum.ApplyStrokeMode.Border,
|
|
21
22
|
Thickness = 1,
|
|
22
23
|
Transparency = 0,
|
|
23
24
|
},
|
|
25
|
+
content = {
|
|
26
|
+
AutomaticSize = Enum.AutomaticSize.XY,
|
|
27
|
+
Size = UDim2.fromScale(0, 0),
|
|
28
|
+
BackgroundTransparency = 1,
|
|
29
|
+
BorderSizePixel = 0,
|
|
30
|
+
},
|
|
24
31
|
padding = {
|
|
25
|
-
PaddingTop = UDim.new(0,
|
|
26
|
-
PaddingBottom = UDim.new(0,
|
|
27
|
-
PaddingLeft = UDim.new(0,
|
|
28
|
-
PaddingRight = UDim.new(0,
|
|
32
|
+
PaddingTop = UDim.new(0, pad),
|
|
33
|
+
PaddingBottom = UDim.new(0, pad),
|
|
34
|
+
PaddingLeft = UDim.new(0, pad),
|
|
35
|
+
PaddingRight = UDim.new(0, pad),
|
|
29
36
|
},
|
|
30
37
|
corner = {
|
|
31
38
|
CornerRadius = UDim.new(0, theme.shape.borderRadius),
|
|
@@ -1,6 +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 useEditorHover = TS.import(script, script.Parent.Parent.Parent, "editorFace").useEditorHover
|
|
4
5
|
local SxHost = TS.import(script, script.Parent.Parent.Parent, "host").SxHost
|
|
5
6
|
local NumberInput = TS.import(script, script.Parent.Parent.Parent, "numberInput").NumberInput
|
|
6
7
|
local usePhysicalPropertiesEditorStyles = TS.import(script, script.Parent, "PhysicalPropertiesEditor.styles").default
|
|
@@ -19,6 +20,7 @@ local function PhysicalPropertiesEditor(props)
|
|
|
19
20
|
local id = _binding.id
|
|
20
21
|
local ref = _binding.ref
|
|
21
22
|
local styles = usePhysicalPropertiesEditorStyles()
|
|
23
|
+
local hover = useEditorHover(disabled)
|
|
22
24
|
local amounts = {
|
|
23
25
|
Density = value.Density,
|
|
24
26
|
Friction = value.Friction,
|
|
@@ -39,12 +41,18 @@ local function PhysicalPropertiesEditor(props)
|
|
|
39
41
|
end
|
|
40
42
|
_attributes.key = _condition
|
|
41
43
|
_attributes.hostRef = ref
|
|
42
|
-
|
|
44
|
+
local _object = table.clone(styles.root)
|
|
45
|
+
setmetatable(_object, nil)
|
|
46
|
+
for _k, _v in hover.face do
|
|
47
|
+
_object[_k] = _v
|
|
48
|
+
end
|
|
49
|
+
_attributes.base = _object
|
|
43
50
|
_attributes.className = className
|
|
44
51
|
_attributes.sx = sx
|
|
45
52
|
_attributes.state = {
|
|
46
53
|
disabled = disabled,
|
|
47
54
|
}
|
|
55
|
+
_attributes.Event = hover.event
|
|
48
56
|
local _attributes_1 = table.clone(styles.wrap)
|
|
49
57
|
setmetatable(_attributes_1, nil)
|
|
50
58
|
local _exp = React.createElement("uilistlayout", _attributes_1)
|
package/out/ui/packages/physicalPropertiesEditor/components/PhysicalPropertiesEditor.styles.luau
CHANGED
|
@@ -4,9 +4,12 @@ local _theme = TS.import(script, script.Parent.Parent.Parent.Parent.Parent, "the
|
|
|
4
4
|
local controlMetrics = _theme.controlMetrics
|
|
5
5
|
local createStyles = _theme.createStyles
|
|
6
6
|
local componentStyles = _theme.componentStyles
|
|
7
|
+
local _editorFace = TS.import(script, script.Parent.Parent.Parent, "editorFace")
|
|
8
|
+
local editorPad = _editorFace.editorPad
|
|
9
|
+
local editorText = _editorFace.editorText
|
|
7
10
|
local usePhysicalPropertiesEditorStyles = componentStyles("PhysicalPropertiesEditor", function(theme)
|
|
8
|
-
local gap = theme
|
|
9
|
-
|
|
11
|
+
local gap = editorPad(theme)
|
|
12
|
+
local _object = {
|
|
10
13
|
root = {
|
|
11
14
|
Size = UDim2.new(1, 0, 0, 0),
|
|
12
15
|
AutomaticSize = Enum.AutomaticSize.Y,
|
|
@@ -15,7 +18,7 @@ local usePhysicalPropertiesEditorStyles = componentStyles("PhysicalPropertiesEdi
|
|
|
15
18
|
},
|
|
16
19
|
wrap = {
|
|
17
20
|
FillDirection = Enum.FillDirection.Vertical,
|
|
18
|
-
Padding = UDim.new(0,
|
|
21
|
+
Padding = UDim.new(0, gap),
|
|
19
22
|
SortOrder = Enum.SortOrder.LayoutOrder,
|
|
20
23
|
},
|
|
21
24
|
pair = {
|
|
@@ -35,24 +38,26 @@ local usePhysicalPropertiesEditorStyles = componentStyles("PhysicalPropertiesEdi
|
|
|
35
38
|
},
|
|
36
39
|
stack = {
|
|
37
40
|
FillDirection = Enum.FillDirection.Vertical,
|
|
38
|
-
Padding = UDim.new(0,
|
|
41
|
+
Padding = UDim.new(0, gap),
|
|
39
42
|
SortOrder = Enum.SortOrder.LayoutOrder,
|
|
40
43
|
},
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
44
|
+
}
|
|
45
|
+
local _left = "label"
|
|
46
|
+
local _object_1 = {
|
|
47
|
+
Size = UDim2.new(1, 0, 0, 0),
|
|
48
|
+
AutomaticSize = Enum.AutomaticSize.Y,
|
|
49
|
+
BackgroundTransparency = 1,
|
|
50
|
+
TextColor3 = theme.palette.text.secondary,
|
|
51
|
+
}
|
|
52
|
+
for _k, _v in editorText(theme) do
|
|
53
|
+
_object_1[_k] = _v
|
|
54
|
+
end
|
|
55
|
+
_object[_left] = _object_1
|
|
56
|
+
_object.field = {
|
|
57
|
+
Size = UDim2.new(1, 0, 0, controlMetrics(theme.density).height),
|
|
58
|
+
BackgroundTransparency = 1,
|
|
59
|
+
}
|
|
60
|
+
return createStyles(_object)
|
|
56
61
|
end)
|
|
57
62
|
local default = usePhysicalPropertiesEditorStyles
|
|
58
63
|
return {
|
|
@@ -8,5 +8,5 @@ export interface PopoverProps {
|
|
|
8
8
|
onDismiss?: () => void;
|
|
9
9
|
children?: React.ReactNode;
|
|
10
10
|
}
|
|
11
|
-
declare function Popover(props: CustomizedProps<Frame, PopoverProps>): JSX.Element
|
|
11
|
+
declare function Popover(props: CustomizedProps<Frame, PopoverProps>): JSX.Element;
|
|
12
12
|
export default Popover;
|
|
@@ -17,9 +17,7 @@ local function Popover(props)
|
|
|
17
17
|
local id = _binding.id
|
|
18
18
|
local ref = _binding.ref
|
|
19
19
|
local styles = usePopoverStyles()
|
|
20
|
-
|
|
21
|
-
return nil
|
|
22
|
-
end
|
|
20
|
+
local closed = open ~= true
|
|
23
21
|
local _attributes = {
|
|
24
22
|
tag = "frame",
|
|
25
23
|
}
|
|
@@ -37,12 +35,16 @@ local function Popover(props)
|
|
|
37
35
|
local _exp = React.createElement("uicorner", _attributes_1)
|
|
38
36
|
local _attributes_2 = table.clone(styles.stroke)
|
|
39
37
|
setmetatable(_attributes_2, nil)
|
|
38
|
+
local _exp_1 = React.createElement("uistroke", _attributes_2)
|
|
39
|
+
local _attributes_3 = table.clone(styles.padding)
|
|
40
|
+
setmetatable(_attributes_3, nil)
|
|
40
41
|
return React.createElement(Popup, {
|
|
42
|
+
open = not closed,
|
|
41
43
|
anchor = anchor,
|
|
42
44
|
preferredHeight = preferredHeight,
|
|
43
45
|
preferredWidth = preferredWidth,
|
|
44
46
|
onDismiss = onDismiss,
|
|
45
|
-
}, React.createElement(SxHost, _attributes, _exp, React.createElement("
|
|
47
|
+
}, React.createElement(SxHost, _attributes, _exp, _exp_1, React.createElement("uipadding", _attributes_3), children))
|
|
46
48
|
end
|
|
47
49
|
local default = Popover
|
|
48
50
|
return {
|
|
@@ -18,6 +18,12 @@ local usePopoverStyles = componentStyles("Popover", function(theme)
|
|
|
18
18
|
Color = theme.palette.border,
|
|
19
19
|
ApplyStrokeMode = Enum.ApplyStrokeMode.Border,
|
|
20
20
|
},
|
|
21
|
+
padding = {
|
|
22
|
+
PaddingTop = UDim.new(0, theme.spacing.calc(2)),
|
|
23
|
+
PaddingBottom = UDim.new(0, theme.spacing.calc(2)),
|
|
24
|
+
PaddingLeft = UDim.new(0, theme.spacing.calc(2)),
|
|
25
|
+
PaddingRight = UDim.new(0, theme.spacing.calc(2)),
|
|
26
|
+
},
|
|
21
27
|
})
|
|
22
28
|
end)
|
|
23
29
|
local default = usePopoverStyles
|
|
@@ -6,6 +6,8 @@ export interface PopupProps {
|
|
|
6
6
|
preferredHeight?: number;
|
|
7
7
|
/** Content width. Falls back to the anchor width. Clamped to the layer. */
|
|
8
8
|
preferredWidth?: number;
|
|
9
|
+
/** Stays mounted through the close tween. Omit to show while the parent renders it. */
|
|
10
|
+
open?: boolean;
|
|
9
11
|
onDismiss?: () => void;
|
|
10
12
|
onInput?: (input: InputObject) => void;
|
|
11
13
|
children?: React.ReactNode;
|
|
@@ -5,15 +5,45 @@ 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
|
|
9
|
+
local useTheme = TS.import(script, script.Parent.Parent.Parent.Parent.Parent, "theme").useTheme
|
|
8
10
|
local SxHost = TS.import(script, script.Parent.Parent.Parent, "host").SxHost
|
|
11
|
+
local motionDuration = TS.import(script, script.Parent.Parent.Parent, "motion", "duration").motionDuration
|
|
12
|
+
local playProperty = TS.import(script, script.Parent.Parent.Parent, "motion", "play").playProperty
|
|
9
13
|
local popupPlacement = TS.import(script, script.Parent, "placement").popupPlacement
|
|
10
14
|
local Portal = TS.import(script, script.Parent, "Portal").default
|
|
11
15
|
local portalTarget = TS.import(script, script.Parent, "portalTarget").portalTarget
|
|
16
|
+
local function MotionScale(props)
|
|
17
|
+
local ref = useRef()
|
|
18
|
+
local reduced = useReducedMotion()
|
|
19
|
+
local _binding = useTheme()
|
|
20
|
+
local theme = _binding.theme
|
|
21
|
+
local open = props.open
|
|
22
|
+
useEffect(function()
|
|
23
|
+
local scale = ref.current
|
|
24
|
+
if not scale then
|
|
25
|
+
return nil
|
|
26
|
+
end
|
|
27
|
+
if open and not reduced then
|
|
28
|
+
scale.Scale = 0.96
|
|
29
|
+
end
|
|
30
|
+
local seconds = if open then theme.motion.default else theme.motion.fast
|
|
31
|
+
local stop = playProperty(scale, {
|
|
32
|
+
Scale = if open then 1 else 0.96,
|
|
33
|
+
}, seconds, reduced)
|
|
34
|
+
return stop
|
|
35
|
+
end, { open, reduced, theme })
|
|
36
|
+
return React.createElement("uiscale", {
|
|
37
|
+
key = "Motion",
|
|
38
|
+
ref = ref,
|
|
39
|
+
})
|
|
40
|
+
end
|
|
12
41
|
local function Popup(props)
|
|
13
42
|
local _binding = props
|
|
14
43
|
local anchor = _binding.anchor
|
|
15
44
|
local preferredHeight = _binding.preferredHeight
|
|
16
45
|
local preferredWidth = _binding.preferredWidth
|
|
46
|
+
local open = _binding.open
|
|
17
47
|
local onDismiss = _binding.onDismiss
|
|
18
48
|
local onInput = _binding.onInput
|
|
19
49
|
local children = _binding.children
|
|
@@ -21,6 +51,36 @@ local function Popup(props)
|
|
|
21
51
|
local sx = _binding.sx
|
|
22
52
|
local id = _binding.id
|
|
23
53
|
local ref = _binding.ref
|
|
54
|
+
local visible = open ~= false
|
|
55
|
+
local held, setHeld = useState(visible)
|
|
56
|
+
local reduced = useReducedMotion()
|
|
57
|
+
local _binding_1 = useTheme()
|
|
58
|
+
local theme = _binding_1.theme
|
|
59
|
+
useEffect(function()
|
|
60
|
+
if visible then
|
|
61
|
+
setHeld(true)
|
|
62
|
+
end
|
|
63
|
+
end, { visible })
|
|
64
|
+
useEffect(function()
|
|
65
|
+
if not held or visible then
|
|
66
|
+
return nil
|
|
67
|
+
end
|
|
68
|
+
local delay = motionDuration(theme.motion.fast, reduced)
|
|
69
|
+
if delay == 0 then
|
|
70
|
+
setHeld(false)
|
|
71
|
+
return nil
|
|
72
|
+
end
|
|
73
|
+
local alive = true
|
|
74
|
+
local thread = task.delay(delay, function()
|
|
75
|
+
if alive then
|
|
76
|
+
setHeld(false)
|
|
77
|
+
end
|
|
78
|
+
end)
|
|
79
|
+
return function()
|
|
80
|
+
alive = false
|
|
81
|
+
task.cancel(thread)
|
|
82
|
+
end
|
|
83
|
+
end, { visible, held, reduced, theme })
|
|
24
84
|
local dismiss = useRef(onDismiss)
|
|
25
85
|
dismiss.current = onDismiss
|
|
26
86
|
local _, bump = useState(0)
|
|
@@ -72,7 +132,7 @@ local function Popup(props)
|
|
|
72
132
|
return nil
|
|
73
133
|
end
|
|
74
134
|
end, { anchor, layer })
|
|
75
|
-
if not anchor or not layer then
|
|
135
|
+
if not held or not anchor or not layer then
|
|
76
136
|
return nil
|
|
77
137
|
end
|
|
78
138
|
local _exp = anchor.AbsolutePosition.X
|
|
@@ -140,7 +200,9 @@ local function Popup(props)
|
|
|
140
200
|
Size = UDim2.fromScale(1, 1),
|
|
141
201
|
BackgroundTransparency = 1,
|
|
142
202
|
ZIndex = 20000,
|
|
143
|
-
}, _exp_8, React.createElement(SxHost, _attributes,
|
|
203
|
+
}, _exp_8, React.createElement(SxHost, _attributes, React.createElement(MotionScale, {
|
|
204
|
+
open = visible,
|
|
205
|
+
}), children)))
|
|
144
206
|
end
|
|
145
207
|
local default = Popup
|
|
146
208
|
return {
|
|
@@ -11,9 +11,11 @@ local function popupPlacement(anchorX, anchorY, anchorW, anchorH, layerX, layerY
|
|
|
11
11
|
end
|
|
12
12
|
local localX = anchorX - layerX
|
|
13
13
|
local localY = anchorY - layerY
|
|
14
|
-
local
|
|
15
|
-
local
|
|
16
|
-
local
|
|
14
|
+
local top = math.clamp(localY, 0, layerH)
|
|
15
|
+
local bottom = math.clamp(localY + anchorH, 0, layerH)
|
|
16
|
+
local spaceAbove = top
|
|
17
|
+
local spaceBelow = math.max(0, layerH - bottom)
|
|
18
|
+
local above = spaceAbove > spaceBelow and (contentH == 0 or contentH > spaceBelow)
|
|
17
19
|
local maxHeight = if above then spaceAbove else spaceBelow
|
|
18
20
|
local width = if contentW > 0 then contentW else anchorW
|
|
19
21
|
if width > layerW then
|
|
@@ -29,7 +31,7 @@ local function popupPlacement(anchorX, anchorY, anchorW, anchorH, layerX, layerY
|
|
|
29
31
|
local height = if contentH > 0 then math.min(contentH, maxHeight) else 0
|
|
30
32
|
return {
|
|
31
33
|
x = x,
|
|
32
|
-
y = if above then
|
|
34
|
+
y = if above then top else bottom,
|
|
33
35
|
width = width,
|
|
34
36
|
height = height,
|
|
35
37
|
maxHeight = maxHeight,
|
|
@@ -101,7 +101,7 @@ local function ProgressBar(props)
|
|
|
101
101
|
_attributes_6[_k] = _v
|
|
102
102
|
end
|
|
103
103
|
_attributes_6.Size = UDim2.new(unit, 0, 1, 0)
|
|
104
|
-
_attributes_6.BackgroundColor3 = color or theme.palette.
|
|
104
|
+
_attributes_6.BackgroundColor3 = color or theme.palette.primary.main
|
|
105
105
|
_attributes_6.BackgroundTransparency = if disabled then 0.55 else 0
|
|
106
106
|
local _attributes_7 = {
|
|
107
107
|
key = "Corner",
|
|
@@ -24,7 +24,8 @@ local useProgressBarStyles = componentStyles("ProgressBar", function(theme)
|
|
|
24
24
|
Size = UDim2.new(1, -theme.options.constants.borders.divider * 2, 1, -theme.options.constants.borders.divider * 2),
|
|
25
25
|
Position = UDim2.new(0.5, 0, 0.5, 0),
|
|
26
26
|
AnchorPoint = Vector2.new(0.5, 0.5),
|
|
27
|
-
|
|
27
|
+
BackgroundColor3 = theme.palette.surface.input,
|
|
28
|
+
BackgroundTransparency = 0,
|
|
28
29
|
BorderSizePixel = 0,
|
|
29
30
|
ClipsDescendants = true,
|
|
30
31
|
ZIndex = 110001,
|
|
@@ -32,7 +33,7 @@ local useProgressBarStyles = componentStyles("ProgressBar", function(theme)
|
|
|
32
33
|
fill = {
|
|
33
34
|
Position = UDim2.new(0, 0, 0.5, 0),
|
|
34
35
|
AnchorPoint = Vector2.new(0, 0.5),
|
|
35
|
-
BackgroundColor3 = theme.palette.
|
|
36
|
+
BackgroundColor3 = theme.palette.primary.main,
|
|
36
37
|
BorderSizePixel = 0,
|
|
37
38
|
ZIndex = 110001,
|
|
38
39
|
},
|
|
@@ -3,6 +3,7 @@ local TS = _G[script]
|
|
|
3
3
|
local _react = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
4
4
|
local React = _react
|
|
5
5
|
local useState = _react.useState
|
|
6
|
+
local controlFade = TS.import(script, script.Parent.Parent.Parent.Parent.Parent, "theme").controlFade
|
|
6
7
|
local canActivate = TS.import(script, script.Parent.Parent.Parent, "button", "components", "activation").canActivate
|
|
7
8
|
local SxHost = TS.import(script, script.Parent.Parent.Parent, "host").SxHost
|
|
8
9
|
local radioHint = TS.import(script, script.Parent, "radioHint").radioHint
|
|
@@ -58,7 +59,7 @@ local function RadioGroup(props)
|
|
|
58
59
|
local _newValue = table.create(#options)
|
|
59
60
|
local _callback = function(choice, index)
|
|
60
61
|
local active = canActivate(disabled or choice.disabled)
|
|
61
|
-
local fade = if active then 0 else
|
|
62
|
+
local fade = if active then 0 else controlFade
|
|
62
63
|
local note = radioHint(choice.hint)
|
|
63
64
|
local _attributes_2 = {
|
|
64
65
|
key = `{choice.label}-{index}`,
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
-- Compiled with roblox-ts v3.0.0
|
|
2
2
|
local TS = _G[script]
|
|
3
|
-
local
|
|
3
|
+
local _react = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
4
|
+
local React = _react
|
|
5
|
+
local useState = _react.useState
|
|
6
|
+
local _theme = TS.import(script, script.Parent.Parent.Parent.Parent.Parent, "theme")
|
|
7
|
+
local controlFade = _theme.controlFade
|
|
8
|
+
local focusRing = _theme.focusRing
|
|
9
|
+
local useTheme = _theme.useTheme
|
|
4
10
|
local Icons = TS.import(script, script.Parent.Parent.Parent.Parent, "enums").Icons
|
|
5
11
|
local canActivate = TS.import(script, script.Parent.Parent.Parent, "button", "components", "activation").canActivate
|
|
6
12
|
local SxHost = TS.import(script, script.Parent.Parent.Parent, "host").SxHost
|
|
@@ -28,7 +34,11 @@ local function Rating(props)
|
|
|
28
34
|
disabled = disabled,
|
|
29
35
|
size = size,
|
|
30
36
|
})
|
|
37
|
+
local _binding_1 = useTheme()
|
|
38
|
+
local theme = _binding_1.theme
|
|
31
39
|
local active = canActivate(disabled) and readOnly ~= true
|
|
40
|
+
local hover, setHover = useState(0)
|
|
41
|
+
local focused, setFocused = useState(0)
|
|
32
42
|
local stars = {}
|
|
33
43
|
do
|
|
34
44
|
local i = 1
|
|
@@ -60,6 +70,13 @@ local function Rating(props)
|
|
|
60
70
|
_attributes.sx = sx
|
|
61
71
|
_attributes.state = {
|
|
62
72
|
disabled = disabled,
|
|
73
|
+
hover = hover > 0,
|
|
74
|
+
focused = focused > 0,
|
|
75
|
+
}
|
|
76
|
+
_attributes.Event = {
|
|
77
|
+
MouseLeave = function()
|
|
78
|
+
return setHover(0)
|
|
79
|
+
end,
|
|
63
80
|
}
|
|
64
81
|
local _attributes_1 = table.clone(styles.list)
|
|
65
82
|
setmetatable(_attributes_1, nil)
|
|
@@ -67,13 +84,17 @@ local function Rating(props)
|
|
|
67
84
|
-- ▼ ReadonlyArray.map ▼
|
|
68
85
|
local _newValue = table.create(#stars)
|
|
69
86
|
local _callback = function(n)
|
|
87
|
+
local filled = n <= value
|
|
88
|
+
local preview = active and hover > 0 and n <= hover and not filled
|
|
70
89
|
local _attributes_2 = {
|
|
71
90
|
key = `Star-{n}`,
|
|
72
91
|
}
|
|
73
92
|
for _k, _v in styles.star do
|
|
74
93
|
_attributes_2[_k] = _v
|
|
75
94
|
end
|
|
76
|
-
_attributes_2.Image = tostring(if
|
|
95
|
+
_attributes_2.Image = tostring(if filled or (active and hover >= n) then Icons.StarFilled else Icons.Star)
|
|
96
|
+
_attributes_2.ImageColor3 = if filled then theme.palette.primary.main elseif preview then theme.palette.primary.hover else theme.palette.text.secondary
|
|
97
|
+
_attributes_2.ImageTransparency = if disabled == true then controlFade else 0
|
|
77
98
|
_attributes_2.LayoutOrder = n
|
|
78
99
|
_attributes_2.Active = active
|
|
79
100
|
_attributes_2.Selectable = active
|
|
@@ -84,8 +105,29 @@ local function Rating(props)
|
|
|
84
105
|
onChange(landed)
|
|
85
106
|
end
|
|
86
107
|
end,
|
|
108
|
+
MouseEnter = function()
|
|
109
|
+
if active then
|
|
110
|
+
setHover(n)
|
|
111
|
+
end
|
|
112
|
+
end,
|
|
113
|
+
SelectionGained = function()
|
|
114
|
+
if active then
|
|
115
|
+
setFocused(n)
|
|
116
|
+
end
|
|
117
|
+
end,
|
|
118
|
+
SelectionLost = function()
|
|
119
|
+
return setFocused(0)
|
|
120
|
+
end,
|
|
87
121
|
}
|
|
88
|
-
|
|
122
|
+
local _result
|
|
123
|
+
if focused == n and active then
|
|
124
|
+
local _attributes_3 = table.clone(focusRing(theme.palette.focus))
|
|
125
|
+
setmetatable(_attributes_3, nil)
|
|
126
|
+
_result = React.createElement("uistroke", _attributes_3)
|
|
127
|
+
else
|
|
128
|
+
_result = nil
|
|
129
|
+
end
|
|
130
|
+
return React.createElement("imagebutton", _attributes_2, _result)
|
|
89
131
|
end
|
|
90
132
|
for _k, _v in stars do
|
|
91
133
|
_newValue[_k] = _callback(_v, _k - 1, stars)
|
|
@@ -34,7 +34,7 @@ local useRatingStyles = componentStyles("Rating", function(theme, _param)
|
|
|
34
34
|
AutoButtonColor = false,
|
|
35
35
|
Active = not disabled,
|
|
36
36
|
Selectable = not disabled,
|
|
37
|
-
ImageColor3 =
|
|
37
|
+
ImageColor3 = theme.palette.primary.main,
|
|
38
38
|
},
|
|
39
39
|
})
|
|
40
40
|
end)
|