@rbxts/uiblox 0.2.0-alpha.36 → 0.2.0-alpha.37
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/theme/styles/utilities/focusRing.d.ts +5 -0
- package/out/theme/styles/utilities/focusRing.luau +11 -0
- package/out/theme/styles/utilities/index.d.ts +1 -0
- package/out/theme/styles/utilities/init.luau +1 -0
- package/out/theme/styles/utilities/resolveSx.d.ts +6 -1
- package/out/theme/styles/utilities/resolveSx.luau +53 -12
- package/out/ui/packages/accordion/components/Accordion.d.ts +1 -0
- package/out/ui/packages/accordion/components/Accordion.luau +55 -19
- package/out/ui/packages/accordion/components/Accordion.styles.luau +49 -29
- package/out/ui/packages/accordion/components/accordionNote.d.ts +2 -0
- package/out/ui/packages/accordion/components/accordionNote.luau +11 -0
- package/out/ui/packages/alert/components/Alert.d.ts +2 -0
- package/out/ui/packages/alert/components/Alert.luau +24 -1
- package/out/ui/packages/alert/components/Alert.styles.luau +11 -0
- package/out/ui/packages/alert/components/alertAction.d.ts +2 -0
- package/out/ui/packages/alert/components/alertAction.luau +11 -0
- package/out/ui/packages/appBar/components/AppBar.d.ts +1 -0
- package/out/ui/packages/appBar/components/AppBar.luau +59 -15
- package/out/ui/packages/appBar/components/AppBar.styles.luau +24 -0
- package/out/ui/packages/appBar/components/appBarSubtitle.d.ts +2 -0
- package/out/ui/packages/appBar/components/appBarSubtitle.luau +11 -0
- package/out/ui/packages/avatarGroup/components/AvatarGroup.d.ts +14 -0
- package/out/ui/packages/avatarGroup/components/AvatarGroup.luau +102 -0
- package/out/ui/packages/avatarGroup/components/AvatarGroup.styles.d.ts +6 -0
- package/out/ui/packages/avatarGroup/components/AvatarGroup.styles.luau +50 -0
- package/out/ui/packages/avatarGroup/components/avatarGroupCut.d.ts +2 -0
- package/out/ui/packages/avatarGroup/components/avatarGroupCut.luau +11 -0
- package/out/ui/packages/avatarGroup/index.d.ts +3 -0
- package/out/ui/packages/avatarGroup/init.luau +6 -0
- package/out/ui/packages/bottomNavigation/components/BottomNavigation.d.ts +4 -1
- package/out/ui/packages/bottomNavigation/components/BottomNavigation.luau +19 -1
- package/out/ui/packages/bottomNavigation/components/BottomNavigation.styles.luau +20 -0
- package/out/ui/packages/bottomNavigation/components/navBadge.d.ts +2 -0
- package/out/ui/packages/bottomNavigation/components/navBadge.luau +14 -0
- package/out/ui/packages/bottomNavigation/index.d.ts +1 -1
- package/out/ui/packages/breadcrumbs/components/Breadcrumbs.luau +16 -5
- package/out/ui/packages/breadcrumbs/components/Breadcrumbs.styles.luau +6 -0
- package/out/ui/packages/breadcrumbs/components/breadcrumbItems.d.ts +2 -0
- package/out/ui/packages/breadcrumbs/components/breadcrumbItems.luau +8 -0
- package/out/ui/packages/button/components/Button.d.ts +2 -0
- package/out/ui/packages/button/components/Button.luau +59 -10
- package/out/ui/packages/button/components/Button.styles.luau +2 -0
- package/out/ui/packages/button/components/buttonLook.d.ts +2 -0
- package/out/ui/packages/button/components/buttonLook.luau +11 -0
- package/out/ui/packages/buttonGroup/components/ButtonGroup.d.ts +13 -0
- package/out/ui/packages/buttonGroup/components/ButtonGroup.luau +102 -0
- package/out/ui/packages/buttonGroup/components/ButtonGroup.styles.d.ts +5 -0
- package/out/ui/packages/buttonGroup/components/ButtonGroup.styles.luau +57 -0
- package/out/ui/packages/buttonGroup/components/buttonGroupEdge.d.ts +2 -0
- package/out/ui/packages/buttonGroup/components/buttonGroupEdge.luau +16 -0
- package/out/ui/packages/buttonGroup/index.d.ts +3 -0
- package/out/ui/packages/buttonGroup/init.luau +6 -0
- package/out/ui/packages/card/components/Card.d.ts +1 -0
- package/out/ui/packages/card/components/Card.luau +21 -2
- package/out/ui/packages/card/components/Card.styles.d.ts +3 -1
- package/out/ui/packages/card/components/Card.styles.luau +16 -7
- package/out/ui/packages/card/components/cardWidth.d.ts +10 -0
- package/out/ui/packages/card/components/cardWidth.luau +36 -0
- package/out/ui/packages/cframeEditor/components/CFrameEditor.luau +9 -4
- package/out/ui/packages/cframeEditor/components/CFrameEditor.styles.luau +10 -1
- package/out/ui/packages/cframeEditor/components/cframeValue.d.ts +1 -0
- package/out/ui/packages/cframeEditor/components/cframeValue.luau +13 -0
- package/out/ui/packages/checkbox/components/Checkbox.luau +2 -1
- package/out/ui/packages/checkbox/components/Checkbox.styles.luau +2 -0
- package/out/ui/packages/chip/components/Chip.styles.d.ts +2 -1
- package/out/ui/packages/chip/components/Chip.styles.luau +9 -6
- package/out/ui/packages/chip/components/chipTone.d.ts +3 -0
- package/out/ui/packages/chip/components/chipTone.luau +11 -0
- package/out/ui/packages/collapse/components/Collapse.d.ts +8 -0
- package/out/ui/packages/collapse/components/Collapse.luau +34 -0
- package/out/ui/packages/collapse/components/Collapse.styles.d.ts +2 -0
- package/out/ui/packages/collapse/components/Collapse.styles.luau +20 -0
- package/out/ui/packages/collapse/components/collapseOpen.d.ts +1 -0
- package/out/ui/packages/collapse/components/collapseOpen.luau +7 -0
- package/out/ui/packages/collapse/index.d.ts +3 -0
- package/out/ui/packages/collapse/init.luau +6 -0
- package/out/ui/packages/colorPicker/components/ColorSequenceEditor.luau +4 -2
- package/out/ui/packages/colorPicker/components/NumberSequenceEditor.luau +4 -2
- package/out/ui/packages/colorPicker/components/sequenceValue.d.ts +2 -0
- package/out/ui/packages/colorPicker/components/sequenceValue.luau +8 -0
- package/out/ui/packages/colorPicker/index.d.ts +1 -1
- package/out/ui/packages/colorPicker/init.luau +2 -0
- package/out/ui/packages/copyButton/components/CopyButton.d.ts +8 -0
- package/out/ui/packages/copyButton/components/CopyButton.luau +32 -0
- package/out/ui/packages/copyButton/components/copyInvoke.d.ts +2 -0
- package/out/ui/packages/copyButton/components/copyInvoke.luau +12 -0
- package/out/ui/packages/copyButton/index.d.ts +3 -0
- package/out/ui/packages/copyButton/init.luau +6 -0
- package/out/ui/packages/cover/components/Cover.d.ts +8 -0
- package/out/ui/packages/cover/components/Cover.luau +47 -0
- package/out/ui/packages/cover/components/coverFill.d.ts +2 -0
- package/out/ui/packages/cover/components/coverFill.luau +14 -0
- package/out/ui/packages/cover/index.d.ts +3 -0
- package/out/ui/packages/cover/init.luau +6 -0
- package/out/ui/packages/dateRange/components/DateRangePicker.d.ts +3 -0
- package/out/ui/packages/dateRange/components/DateRangePicker.luau +167 -88
- package/out/ui/packages/dateRange/dateRangeValue.d.ts +5 -0
- package/out/ui/packages/dateRange/dateRangeValue.luau +34 -0
- package/out/ui/packages/dateRange/index.d.ts +1 -1
- package/out/ui/packages/dateRange/init.luau +3 -0
- package/out/ui/packages/dialog/components/Dialog.d.ts +1 -0
- package/out/ui/packages/dialog/components/Dialog.luau +55 -6
- package/out/ui/packages/dialog/components/Dialog.styles.luau +5 -3
- package/out/ui/packages/dialog/components/dialogWidth.d.ts +7 -0
- package/out/ui/packages/dialog/components/dialogWidth.luau +35 -0
- package/out/ui/packages/divider/components/Divider.luau +57 -12
- package/out/ui/packages/divider/components/dividerLabel.d.ts +2 -0
- package/out/ui/packages/divider/components/dividerLabel.luau +11 -0
- package/out/ui/packages/drawer/components/Drawer.d.ts +1 -0
- package/out/ui/packages/drawer/components/Drawer.luau +18 -3
- package/out/ui/packages/drawer/components/drawerPlacement.d.ts +13 -1
- package/out/ui/packages/drawer/components/drawerPlacement.luau +28 -0
- package/out/ui/packages/fab/components/fabSize.d.ts +1 -1
- package/out/ui/packages/iconButton/components/IconButton.d.ts +2 -0
- package/out/ui/packages/iconButton/components/IconButton.luau +37 -3
- package/out/ui/packages/iconButton/components/transportGlyph.d.ts +9 -0
- package/out/ui/packages/iconButton/components/transportGlyph.luau +73 -0
- package/out/ui/packages/imageList/components/ImageList.d.ts +4 -0
- package/out/ui/packages/imageList/components/ImageList.luau +57 -11
- package/out/ui/packages/imageList/components/ImageList.styles.d.ts +1 -0
- package/out/ui/packages/imageList/components/ImageList.styles.luau +16 -10
- package/out/ui/packages/imageList/components/imageListLayout.d.ts +10 -0
- package/out/ui/packages/imageList/components/imageListLayout.luau +44 -0
- package/out/ui/packages/index.d.ts +11 -0
- package/out/ui/packages/init.luau +33 -0
- package/out/ui/packages/input/components/Input.d.ts +4 -0
- package/out/ui/packages/input/components/Input.luau +29 -9
- package/out/ui/packages/input/components/Input.styles.d.ts +1 -0
- package/out/ui/packages/input/components/Input.styles.luau +42 -12
- package/out/ui/packages/input/components/clampText.d.ts +2 -0
- package/out/ui/packages/input/components/clampText.luau +16 -0
- package/out/ui/packages/input/components/multilineHeight.d.ts +1 -0
- package/out/ui/packages/input/components/multilineHeight.luau +11 -0
- package/out/ui/packages/link/components/Link.luau +13 -9
- package/out/ui/packages/link/components/Link.styles.d.ts +0 -1
- package/out/ui/packages/link/components/Link.styles.luau +1 -12
- package/out/ui/packages/listItem/components/ListItem.d.ts +6 -0
- package/out/ui/packages/listItem/components/ListItem.luau +97 -39
- package/out/ui/packages/listItem/components/ListItem.styles.d.ts +3 -0
- package/out/ui/packages/listItem/components/ListItem.styles.luau +52 -30
- package/out/ui/packages/listItem/components/listItemInk.d.ts +3 -0
- package/out/ui/packages/listItem/components/listItemInk.luau +14 -0
- package/out/ui/packages/listItem/components/listItemLayout.d.ts +12 -0
- package/out/ui/packages/listItem/components/listItemLayout.luau +41 -0
- package/out/ui/packages/markdown/components/Markdown.d.ts +2 -0
- package/out/ui/packages/markdown/components/Markdown.luau +91 -6
- package/out/ui/packages/markdown/components/Markdown.styles.luau +25 -0
- package/out/ui/packages/markdown/index.d.ts +2 -2
- package/out/ui/packages/markdown/init.luau +2 -0
- package/out/ui/packages/markdown/parseMarkdown.d.ts +21 -1
- package/out/ui/packages/markdown/parseMarkdown.luau +109 -2
- package/out/ui/packages/menu/components/Menu.d.ts +3 -0
- package/out/ui/packages/menu/components/Menu.luau +68 -21
- package/out/ui/packages/menu/components/menuIcon.d.ts +6 -0
- package/out/ui/packages/menu/components/menuIcon.luau +32 -0
- package/out/ui/packages/numberInput/components/NumberInput.d.ts +1 -0
- package/out/ui/packages/numberInput/components/NumberInput.luau +67 -1
- package/out/ui/packages/numberInput/components/numberValue.d.ts +2 -0
- package/out/ui/packages/numberInput/components/numberValue.luau +10 -0
- package/out/ui/packages/pager/components/Pager.d.ts +11 -0
- package/out/ui/packages/pager/components/Pager.luau +112 -0
- package/out/ui/packages/pager/components/Pager.styles.d.ts +2 -0
- package/out/ui/packages/pager/components/Pager.styles.luau +61 -0
- package/out/ui/packages/pager/components/pagerStep.d.ts +3 -0
- package/out/ui/packages/pager/components/pagerStep.luau +24 -0
- package/out/ui/packages/pager/index.d.ts +3 -0
- package/out/ui/packages/pager/init.luau +9 -0
- package/out/ui/packages/physicalPropertiesEditor/components/PhysicalPropertiesEditor.luau +5 -0
- package/out/ui/packages/physicalPropertiesEditor/components/physicalParts.d.ts +5 -0
- package/out/ui/packages/physicalPropertiesEditor/components/physicalParts.luau +22 -0
- package/out/ui/packages/popover/components/Popover.d.ts +12 -0
- package/out/ui/packages/popover/components/Popover.luau +50 -0
- package/out/ui/packages/popover/components/Popover.styles.d.ts +2 -0
- package/out/ui/packages/popover/components/Popover.styles.luau +26 -0
- package/out/ui/packages/popover/index.d.ts +2 -0
- package/out/ui/packages/popover/init.luau +5 -0
- package/out/ui/packages/radioGroup/components/RadioGroup.d.ts +4 -1
- package/out/ui/packages/radioGroup/components/RadioGroup.luau +51 -8
- package/out/ui/packages/radioGroup/components/RadioGroup.styles.luau +26 -2
- package/out/ui/packages/radioGroup/components/radioHint.d.ts +2 -0
- package/out/ui/packages/radioGroup/components/radioHint.luau +11 -0
- package/out/ui/packages/radioGroup/index.d.ts +1 -1
- package/out/ui/packages/rating/components/Rating.d.ts +1 -1
- package/out/ui/packages/rating/components/Rating.luau +4 -2
- package/out/ui/packages/rating/components/ratingCommit.d.ts +2 -0
- package/out/ui/packages/rating/components/ratingCommit.luau +11 -0
- package/out/ui/packages/scroll/components/ScrollView.luau +76 -7
- package/out/ui/packages/select/components/Select.luau +18 -1
- package/out/ui/packages/select/components/Select.styles.luau +2 -5
- package/out/ui/packages/select/components/selectWidth.d.ts +2 -0
- package/out/ui/packages/select/components/selectWidth.luau +15 -0
- package/out/ui/packages/shadow/components/Shadow.luau +14 -2
- package/out/ui/packages/slider/components/RangeSlider.d.ts +16 -0
- package/out/ui/packages/slider/components/RangeSlider.luau +231 -0
- package/out/ui/packages/slider/components/RangeSlider.styles.d.ts +7 -0
- package/out/ui/packages/slider/components/RangeSlider.styles.luau +48 -0
- package/out/ui/packages/slider/components/Slider.d.ts +1 -0
- package/out/ui/packages/slider/components/Slider.luau +44 -11
- package/out/ui/packages/slider/components/Slider.styles.d.ts +1 -0
- package/out/ui/packages/slider/components/Slider.styles.luau +19 -5
- package/out/ui/packages/slider/components/rangeValue.d.ts +21 -0
- package/out/ui/packages/slider/components/rangeValue.luau +77 -0
- package/out/ui/packages/slider/components/sliderLabel.d.ts +4 -0
- package/out/ui/packages/slider/components/sliderLabel.luau +30 -0
- package/out/ui/packages/slider/index.d.ts +3 -0
- package/out/ui/packages/slider/init.luau +6 -0
- package/out/ui/packages/snackbar/components/Snackbar.d.ts +1 -0
- package/out/ui/packages/snackbar/components/Snackbar.luau +2 -0
- package/out/ui/packages/sparkline/components/Sparkline.d.ts +3 -0
- package/out/ui/packages/sparkline/components/Sparkline.luau +69 -7
- package/out/ui/packages/sparkline/index.d.ts +1 -1
- package/out/ui/packages/sparkline/init.luau +6 -1
- package/out/ui/packages/sparkline/sparklineLayout.d.ts +17 -0
- package/out/ui/packages/sparkline/sparklineLayout.luau +132 -8
- package/out/ui/packages/speedDial/components/SpeedDial.d.ts +1 -0
- package/out/ui/packages/speedDial/components/SpeedDial.luau +56 -9
- package/out/ui/packages/speedDial/components/SpeedDial.styles.d.ts +1 -0
- package/out/ui/packages/speedDial/components/SpeedDial.styles.luau +45 -3
- package/out/ui/packages/speedDial/components/speedDialLabel.d.ts +4 -0
- package/out/ui/packages/speedDial/components/speedDialLabel.luau +16 -0
- package/out/ui/packages/stateMatrix.d.ts +1 -0
- package/out/ui/packages/stateMatrix.luau +9 -0
- package/out/ui/packages/stepper/components/Stepper.d.ts +2 -0
- package/out/ui/packages/stepper/components/Stepper.luau +35 -7
- package/out/ui/packages/stepper/components/Stepper.styles.luau +3 -0
- package/out/ui/packages/stepper/components/stepState.d.ts +4 -2
- package/out/ui/packages/stepper/components/stepState.luau +12 -1
- package/out/ui/packages/stepper/index.d.ts +1 -1
- package/out/ui/packages/stepper/init.luau +3 -1
- package/out/ui/packages/switch/components/Switch.styles.luau +2 -5
- package/out/ui/packages/table/components/Table.luau +8 -5
- package/out/ui/packages/table/components/tableSort.d.ts +2 -0
- package/out/ui/packages/table/components/tableSort.luau +95 -0
- package/out/ui/packages/table/index.d.ts +1 -0
- package/out/ui/packages/table/init.luau +1 -0
- package/out/ui/packages/tabs/components/Tabs.luau +70 -2
- package/out/ui/packages/tabs/components/tabScroll.d.ts +2 -0
- package/out/ui/packages/tabs/components/tabScroll.luau +18 -0
- package/out/ui/packages/text/components/Text.d.ts +7 -0
- package/out/ui/packages/text/components/Text.luau +54 -0
- package/out/ui/packages/text/components/textBox.d.ts +12 -0
- package/out/ui/packages/text/components/textBox.luau +21 -0
- package/out/ui/packages/text/index.d.ts +2 -0
- package/out/ui/packages/text/init.luau +5 -0
- package/out/ui/packages/timeField/components/TimeField.d.ts +13 -0
- package/out/ui/packages/timeField/components/TimeField.luau +102 -0
- package/out/ui/packages/timeField/index.d.ts +4 -0
- package/out/ui/packages/timeField/init.luau +9 -0
- package/out/ui/packages/timeField/timeValue.d.ts +8 -0
- package/out/ui/packages/timeField/timeValue.luau +49 -0
- package/out/ui/packages/timeline/components/Timeline.d.ts +12 -0
- package/out/ui/packages/timeline/components/Timeline.luau +99 -0
- package/out/ui/packages/timeline/components/Timeline.styles.d.ts +2 -0
- package/out/ui/packages/timeline/components/Timeline.styles.luau +106 -0
- package/out/ui/packages/timeline/components/timelineRail.d.ts +4 -0
- package/out/ui/packages/timeline/components/timelineRail.luau +15 -0
- package/out/ui/packages/timeline/index.d.ts +3 -0
- package/out/ui/packages/timeline/init.luau +8 -0
- package/out/ui/packages/toast/components/Toast.d.ts +1 -0
- package/out/ui/packages/toast/components/Toast.luau +59 -12
- package/out/ui/packages/toast/components/Toast.styles.luau +6 -3
- package/out/ui/packages/toast/components/toastPlace.d.ts +12 -0
- package/out/ui/packages/toast/components/toastPlace.luau +31 -0
- package/out/ui/packages/tooltip/components/Tooltip.d.ts +1 -0
- package/out/ui/packages/tooltip/components/Tooltip.luau +109 -31
- package/out/ui/packages/tooltip/components/Tooltip.styles.luau +30 -0
- package/out/ui/packages/tooltip/components/tooltipBox.d.ts +4 -0
- package/out/ui/packages/tooltip/components/tooltipBox.luau +12 -0
- package/out/ui/packages/tooltip/components/tooltipPointer.d.ts +2 -0
- package/out/ui/packages/tooltip/components/tooltipPointer.luau +11 -0
- package/out/ui/packages/vectorEditor/components/VectorEditor.luau +1 -0
- package/out/ui/packages/weekGrid/components/WeekGrid.d.ts +24 -0
- package/out/ui/packages/weekGrid/components/WeekGrid.luau +187 -0
- package/out/ui/packages/weekGrid/components/weekColumns.d.ts +9 -0
- package/out/ui/packages/weekGrid/components/weekColumns.luau +25 -0
- package/out/ui/packages/weekGrid/index.d.ts +3 -0
- package/out/ui/packages/weekGrid/init.luau +8 -0
- package/package.json +67 -69
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
--* Clicks commit only when the rating is editable and a handler was passed.
|
|
3
|
+
local function ratingCommit(readOnly, onChange, landed)
|
|
4
|
+
if readOnly == true or onChange == nil then
|
|
5
|
+
return nil
|
|
6
|
+
end
|
|
7
|
+
return landed
|
|
8
|
+
end
|
|
9
|
+
return {
|
|
10
|
+
ratingCommit = ratingCommit,
|
|
11
|
+
}
|
|
@@ -1,8 +1,30 @@
|
|
|
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 _theme = TS.import(script, script.Parent.Parent.Parent.Parent.Parent, "theme")
|
|
5
|
+
local resolveSx = _theme.resolveSx
|
|
6
|
+
local useTheme = _theme.useTheme
|
|
5
7
|
local SxHost = TS.import(script, script.Parent.Parent.Parent, "host").SxHost
|
|
8
|
+
local function isPadKey(key)
|
|
9
|
+
return key == "p" or key == "px" or key == "py" or key == "pt" or key == "pr" or key == "pb" or key == "pl" or key == "padding"
|
|
10
|
+
end
|
|
11
|
+
--* Padding on a scrolling frame offsets scale-sized children without shrinking them.
|
|
12
|
+
local function withoutPad(sx)
|
|
13
|
+
if sx == nil then
|
|
14
|
+
return nil
|
|
15
|
+
end
|
|
16
|
+
local rest = {}
|
|
17
|
+
local kept = false
|
|
18
|
+
for key, value in pairs(sx) do
|
|
19
|
+
local name = tostring(key)
|
|
20
|
+
if isPadKey(name) then
|
|
21
|
+
continue
|
|
22
|
+
end
|
|
23
|
+
rest[name] = value
|
|
24
|
+
kept = true
|
|
25
|
+
end
|
|
26
|
+
return if kept then rest else nil
|
|
27
|
+
end
|
|
6
28
|
local function ScrollView(props)
|
|
7
29
|
local _binding = props
|
|
8
30
|
local children = _binding.children
|
|
@@ -22,19 +44,66 @@ local function ScrollView(props)
|
|
|
22
44
|
ScrollBarThickness = theme.spacing.calc(0.5),
|
|
23
45
|
ScrollBarImageColor3 = theme.palette.text.secondary,
|
|
24
46
|
}
|
|
47
|
+
local pad = resolveSx(theme, sx).padding
|
|
48
|
+
local _result = pad
|
|
49
|
+
if _result ~= nil then
|
|
50
|
+
_result = _result.PaddingLeft.Offset
|
|
51
|
+
end
|
|
52
|
+
local _condition = _result
|
|
53
|
+
if _condition == nil then
|
|
54
|
+
_condition = 0
|
|
55
|
+
end
|
|
56
|
+
local left = _condition
|
|
57
|
+
local _result_1 = pad
|
|
58
|
+
if _result_1 ~= nil then
|
|
59
|
+
_result_1 = _result_1.PaddingRight.Offset
|
|
60
|
+
end
|
|
61
|
+
local _condition_1 = _result_1
|
|
62
|
+
if _condition_1 == nil then
|
|
63
|
+
_condition_1 = 0
|
|
64
|
+
end
|
|
65
|
+
local right = _condition_1
|
|
66
|
+
local _result_2 = pad
|
|
67
|
+
if _result_2 ~= nil then
|
|
68
|
+
_result_2 = _result_2.PaddingTop.Offset
|
|
69
|
+
end
|
|
70
|
+
local _condition_2 = _result_2
|
|
71
|
+
if _condition_2 == nil then
|
|
72
|
+
_condition_2 = 0
|
|
73
|
+
end
|
|
74
|
+
local top = _condition_2
|
|
75
|
+
local _result_3 = pad
|
|
76
|
+
if _result_3 ~= nil then
|
|
77
|
+
_result_3 = _result_3.PaddingBottom.Offset
|
|
78
|
+
end
|
|
79
|
+
local _condition_3 = _result_3
|
|
80
|
+
if _condition_3 == nil then
|
|
81
|
+
_condition_3 = 0
|
|
82
|
+
end
|
|
83
|
+
local bottom = _condition_3
|
|
84
|
+
local inset = left + right + top + bottom > 0
|
|
25
85
|
local _attributes = {
|
|
26
86
|
tag = "scrollingframe",
|
|
27
87
|
}
|
|
28
|
-
local
|
|
29
|
-
if not (
|
|
30
|
-
|
|
88
|
+
local _condition_4 = id
|
|
89
|
+
if not (_condition_4 ~= 0 and _condition_4 == _condition_4 and _condition_4 ~= "" and _condition_4) then
|
|
90
|
+
_condition_4 = "ScrollView"
|
|
31
91
|
end
|
|
32
|
-
_attributes.key =
|
|
92
|
+
_attributes.key = _condition_4
|
|
33
93
|
_attributes.hostRef = ref
|
|
34
94
|
_attributes.base = root
|
|
35
95
|
_attributes.className = className
|
|
36
|
-
_attributes.sx = sx
|
|
37
|
-
return React.createElement(SxHost, _attributes,
|
|
96
|
+
_attributes.sx = withoutPad(sx)
|
|
97
|
+
return React.createElement(SxHost, _attributes, if inset then (React.createElement("frame", {
|
|
98
|
+
key = "Pad",
|
|
99
|
+
Size = UDim2.new(1, -(left + right), 0, 0),
|
|
100
|
+
Position = UDim2.new(0, left, 0, top),
|
|
101
|
+
AutomaticSize = Enum.AutomaticSize.Y,
|
|
102
|
+
BackgroundTransparency = 1,
|
|
103
|
+
BorderSizePixel = 0,
|
|
104
|
+
}, React.createElement("uipadding", {
|
|
105
|
+
PaddingBottom = UDim.new(0, bottom),
|
|
106
|
+
}), children)) else children)
|
|
38
107
|
end
|
|
39
108
|
local default = ScrollView
|
|
40
109
|
return {
|
|
@@ -7,6 +7,7 @@ local useRef = _react.useRef
|
|
|
7
7
|
local useState = _react.useState
|
|
8
8
|
local _services = TS.import(script, TS.getModule(script, "@rbxts", "services"))
|
|
9
9
|
local GuiService = _services.GuiService
|
|
10
|
+
local TextService = _services.TextService
|
|
10
11
|
local UserInputService = _services.UserInputService
|
|
11
12
|
local useReducedMotion = TS.import(script, script.Parent.Parent.Parent.Parent.Parent, "hooks").useReducedMotion
|
|
12
13
|
local _theme = TS.import(script, script.Parent.Parent.Parent.Parent.Parent, "theme")
|
|
@@ -37,6 +38,7 @@ local _selectMulti = TS.import(script, script.Parent, "selectMulti")
|
|
|
37
38
|
local includesChoice = _selectMulti.includesChoice
|
|
38
39
|
local selectionLabel = _selectMulti.selectionLabel
|
|
39
40
|
local typeaheadChoice = TS.import(script, script.Parent, "selectTypeahead").typeaheadChoice
|
|
41
|
+
local selectWidth = TS.import(script, script.Parent, "selectWidth").selectWidth
|
|
40
42
|
local stepChoice = TS.import(script, script.Parent, "stepChoice").stepChoice
|
|
41
43
|
local function Select(props)
|
|
42
44
|
local _binding = props
|
|
@@ -70,7 +72,8 @@ local function Select(props)
|
|
|
70
72
|
})
|
|
71
73
|
local _binding_1 = useTheme()
|
|
72
74
|
local theme = _binding_1.theme
|
|
73
|
-
local
|
|
75
|
+
local metrics = controlMetrics(theme.density, size)
|
|
76
|
+
local row = metrics.height
|
|
74
77
|
local active = canActivate(disabled, loading)
|
|
75
78
|
local anchor, setAnchor = useState()
|
|
76
79
|
local open, setOpen = useState(defaultOpen == true and not loading)
|
|
@@ -104,6 +107,19 @@ local function Select(props)
|
|
|
104
107
|
local rows = groupRows(filtered)
|
|
105
108
|
local listHeight = if #rows == 0 then row else math.min(#rows * row, theme.spacing.calc(16))
|
|
106
109
|
local menuHeight = listHeight + (if search then row else 0)
|
|
110
|
+
local font = theme.typography.fontFamilies.default or Enum.Font.SourceSans
|
|
111
|
+
local textSize = metrics.font
|
|
112
|
+
local widest = 0
|
|
113
|
+
for _, line in rows do
|
|
114
|
+
local shown = if line.kind == "header" then line.label else optionLabel(line.label, if values ~= nil then includesChoice(values, filtered[line.optionIndex + 1].value) else filtered[line.optionIndex + 1].value == value)
|
|
115
|
+
local bounds = TextService:GetTextSize(shown, textSize, font, Vector2.new(10000, 100))
|
|
116
|
+
if bounds.X > widest then
|
|
117
|
+
widest = bounds.X
|
|
118
|
+
end
|
|
119
|
+
end
|
|
120
|
+
local pad = theme.padding.calc(1.5) * 2
|
|
121
|
+
local floor = if anchor ~= nil then anchor.AbsoluteSize.X else 0
|
|
122
|
+
local popupWidth = if #rows == 0 then 0 else selectWidth(widest, pad, floor)
|
|
107
123
|
local _condition_1 = empty
|
|
108
124
|
if _condition_1 == nil then
|
|
109
125
|
local _attributes = {}
|
|
@@ -366,6 +382,7 @@ local function Select(props)
|
|
|
366
382
|
_condition_3 = (React.createElement(Popup, {
|
|
367
383
|
anchor = anchor,
|
|
368
384
|
preferredHeight = menuHeight,
|
|
385
|
+
preferredWidth = popupWidth,
|
|
369
386
|
onDismiss = close,
|
|
370
387
|
onInput = function(input)
|
|
371
388
|
return onKey(input, true)
|
|
@@ -4,6 +4,7 @@ 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 focusRing = _theme.focusRing
|
|
7
8
|
local useSelectStyles = componentStyles("Select", function(theme, _param)
|
|
8
9
|
local size = _param.size
|
|
9
10
|
local metrics = controlMetrics(theme.density, size)
|
|
@@ -91,11 +92,7 @@ local useSelectStyles = componentStyles("Select", function(theme, _param)
|
|
|
91
92
|
Color = theme.palette.border,
|
|
92
93
|
ApplyStrokeMode = Enum.ApplyStrokeMode.Border,
|
|
93
94
|
},
|
|
94
|
-
focusStroke =
|
|
95
|
-
Color = theme.palette.focus,
|
|
96
|
-
Thickness = 2,
|
|
97
|
-
ApplyStrokeMode = Enum.ApplyStrokeMode.Border,
|
|
98
|
-
},
|
|
95
|
+
focusStroke = focusRing(theme.palette.focus),
|
|
99
96
|
})
|
|
100
97
|
end)
|
|
101
98
|
local default = useSelectStyles
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
--* Grow past a narrow field so the option fits. Stay at least as wide as the field.
|
|
3
|
+
local function selectWidth(text, pad, floor)
|
|
4
|
+
local need = text + pad
|
|
5
|
+
if need < 0 then
|
|
6
|
+
need = 0
|
|
7
|
+
end
|
|
8
|
+
if floor > need then
|
|
9
|
+
return floor
|
|
10
|
+
end
|
|
11
|
+
return need
|
|
12
|
+
end
|
|
13
|
+
return {
|
|
14
|
+
selectWidth = selectWidth,
|
|
15
|
+
}
|
|
@@ -77,10 +77,22 @@ local function Shadow(props)
|
|
|
77
77
|
end
|
|
78
78
|
_attributes_1.Size = blobSize
|
|
79
79
|
_attributes_1.ZIndex = zIndex
|
|
80
|
-
return React.createElement(SxHost, _attributes, React.createElement("
|
|
80
|
+
return React.createElement(SxHost, _attributes, React.createElement("scrollingframe", {
|
|
81
|
+
key = "Bounds",
|
|
82
|
+
Size = UDim2.fromOffset(0, 0),
|
|
83
|
+
BackgroundTransparency = 1,
|
|
84
|
+
BorderSizePixel = 0,
|
|
85
|
+
ScrollBarThickness = 0,
|
|
86
|
+
ScrollingEnabled = false,
|
|
87
|
+
AutomaticCanvasSize = Enum.AutomaticSize.None,
|
|
88
|
+
CanvasSize = UDim2.fromOffset(0, 0),
|
|
89
|
+
ClipsDescendants = false,
|
|
90
|
+
Active = false,
|
|
91
|
+
Selectable = false,
|
|
92
|
+
}, React.createElement("frame", _attributes_1, cornerRadius ~= nil and React.createElement("uicorner", {
|
|
81
93
|
key = "Corner",
|
|
82
94
|
CornerRadius = cornerRadius,
|
|
83
|
-
})))
|
|
95
|
+
}))))
|
|
84
96
|
end
|
|
85
97
|
local default = Shadow
|
|
86
98
|
return {
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ControlSize, CustomizedProps } from "../../../../theme/index";
|
|
2
|
+
import { SliderColor } from "./Slider.styles";
|
|
3
|
+
import { RangeValue } from "./rangeValue";
|
|
4
|
+
export interface RangeSliderProps {
|
|
5
|
+
value: RangeValue;
|
|
6
|
+
onChange: (value: RangeValue) => void;
|
|
7
|
+
onCommit?: (value: RangeValue) => void;
|
|
8
|
+
min: number;
|
|
9
|
+
max: number;
|
|
10
|
+
step?: number;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
size?: ControlSize;
|
|
13
|
+
color?: SliderColor;
|
|
14
|
+
}
|
|
15
|
+
declare function RangeSlider(props: CustomizedProps<Frame, RangeSliderProps>): JSX.Element;
|
|
16
|
+
export default RangeSlider;
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
local _react = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
4
|
+
local React = _react
|
|
5
|
+
local useRef = _react.useRef
|
|
6
|
+
local useState = _react.useState
|
|
7
|
+
local cx = TS.import(script, script.Parent.Parent.Parent.Parent.Parent, "theme").cx
|
|
8
|
+
local canActivate = TS.import(script, script.Parent.Parent.Parent, "button", "components", "activation").canActivate
|
|
9
|
+
local SxHost = TS.import(script, script.Parent.Parent.Parent, "host").SxHost
|
|
10
|
+
local commitNumber = TS.import(script, script.Parent.Parent.Parent, "numberInput", "components", "numberValue").commitNumber
|
|
11
|
+
local _sliderNudge = TS.import(script, script.Parent, "sliderNudge")
|
|
12
|
+
local isSliderDrag = _sliderNudge.isSliderDrag
|
|
13
|
+
local isSliderMove = _sliderNudge.isSliderMove
|
|
14
|
+
local nudgeDelta = _sliderNudge.nudgeDelta
|
|
15
|
+
local nudgeValue = _sliderNudge.nudgeValue
|
|
16
|
+
local useRangeSliderStyles = TS.import(script, script.Parent, "RangeSlider.styles").default
|
|
17
|
+
local _rangeValue = TS.import(script, script.Parent, "rangeValue")
|
|
18
|
+
local orderRange = _rangeValue.orderRange
|
|
19
|
+
local rangeMove = _rangeValue.rangeMove
|
|
20
|
+
local rangeRatios = _rangeValue.rangeRatios
|
|
21
|
+
local rangeThumb = _rangeValue.rangeThumb
|
|
22
|
+
local function RangeSlider(props)
|
|
23
|
+
local _binding = props
|
|
24
|
+
local value = _binding.value
|
|
25
|
+
local onChange = _binding.onChange
|
|
26
|
+
local onCommit = _binding.onCommit
|
|
27
|
+
local min = _binding.min
|
|
28
|
+
local max = _binding.max
|
|
29
|
+
local step = _binding.step
|
|
30
|
+
local disabled = _binding.disabled
|
|
31
|
+
local size = _binding.size
|
|
32
|
+
local color = _binding.color
|
|
33
|
+
if color == nil then
|
|
34
|
+
color = "primary"
|
|
35
|
+
end
|
|
36
|
+
local className = _binding.className
|
|
37
|
+
local sx = _binding.sx
|
|
38
|
+
local id = _binding.id
|
|
39
|
+
local ref = _binding.ref
|
|
40
|
+
local styles = useRangeSliderStyles({
|
|
41
|
+
size = size,
|
|
42
|
+
color = color,
|
|
43
|
+
})
|
|
44
|
+
local ordered = orderRange(value.start, value.finish)
|
|
45
|
+
local ratios = rangeRatios(ordered.start, ordered.finish, min, max)
|
|
46
|
+
local active = canActivate(disabled)
|
|
47
|
+
local focused, setFocused = useState(false)
|
|
48
|
+
local pressed, setPressed = useState(false)
|
|
49
|
+
local dragging = useRef(false)
|
|
50
|
+
local thumb = useRef("low")
|
|
51
|
+
local latest = useRef(ordered)
|
|
52
|
+
latest.current = ordered
|
|
53
|
+
local faded = disabled == true
|
|
54
|
+
local showFocus = focused and active
|
|
55
|
+
local pointerValue = function(rbx, x)
|
|
56
|
+
local width = rbx.AbsoluteSize.X
|
|
57
|
+
if width <= 0 then
|
|
58
|
+
return nil
|
|
59
|
+
end
|
|
60
|
+
return commitNumber(min + ((x - rbx.AbsolutePosition.X) / width) * (max - min), min, max, step)
|
|
61
|
+
end
|
|
62
|
+
local publish = function(landed, commit)
|
|
63
|
+
thumb.current = landed.thumb
|
|
64
|
+
if landed.start == latest.current.start and landed.finish == latest.current.finish then
|
|
65
|
+
return nil
|
|
66
|
+
end
|
|
67
|
+
latest.current = {
|
|
68
|
+
start = landed.start,
|
|
69
|
+
finish = landed.finish,
|
|
70
|
+
}
|
|
71
|
+
onChange(latest.current)
|
|
72
|
+
if commit and onCommit then
|
|
73
|
+
onCommit(latest.current)
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
local update = function(rbx, x)
|
|
77
|
+
local landed = pointerValue(rbx, x)
|
|
78
|
+
if landed == nil then
|
|
79
|
+
return nil
|
|
80
|
+
end
|
|
81
|
+
publish(rangeMove(thumb.current, landed, latest.current.start, latest.current.finish), false)
|
|
82
|
+
end
|
|
83
|
+
local finish = function()
|
|
84
|
+
if not dragging.current then
|
|
85
|
+
return nil
|
|
86
|
+
end
|
|
87
|
+
dragging.current = false
|
|
88
|
+
setPressed(false)
|
|
89
|
+
if onCommit then
|
|
90
|
+
onCommit(latest.current)
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
local nudge = function(direction)
|
|
94
|
+
if not active then
|
|
95
|
+
return nil
|
|
96
|
+
end
|
|
97
|
+
local current = if thumb.current == "low" then latest.current.start else latest.current.finish
|
|
98
|
+
local nudged = nudgeValue(current, min, max, step, direction)
|
|
99
|
+
if nudged == nil then
|
|
100
|
+
return nil
|
|
101
|
+
end
|
|
102
|
+
publish(rangeMove(thumb.current, nudged, latest.current.start, latest.current.finish), true)
|
|
103
|
+
end
|
|
104
|
+
local knobLook = function(ratio, which)
|
|
105
|
+
return cx(styles.knob, {
|
|
106
|
+
Position = UDim2.fromScale(ratio, 0.5),
|
|
107
|
+
BackgroundTransparency = if faded then 0.45 else 0,
|
|
108
|
+
ZIndex = if which == thumb.current then 3 else 2,
|
|
109
|
+
})
|
|
110
|
+
end
|
|
111
|
+
local _attributes = {
|
|
112
|
+
tag = "frame",
|
|
113
|
+
}
|
|
114
|
+
local _condition = id
|
|
115
|
+
if not (_condition ~= 0 and _condition == _condition and _condition ~= "" and _condition) then
|
|
116
|
+
_condition = "RangeSlider"
|
|
117
|
+
end
|
|
118
|
+
_attributes.key = _condition
|
|
119
|
+
_attributes.hostRef = ref
|
|
120
|
+
_attributes.base = styles.root
|
|
121
|
+
_attributes.className = className
|
|
122
|
+
_attributes.sx = sx
|
|
123
|
+
_attributes.state = {
|
|
124
|
+
disabled = disabled,
|
|
125
|
+
pressed = pressed,
|
|
126
|
+
focused = focused,
|
|
127
|
+
}
|
|
128
|
+
_attributes.Active = active
|
|
129
|
+
_attributes.Selectable = active
|
|
130
|
+
_attributes.BackgroundTransparency = if showFocus then 0.85 else 1
|
|
131
|
+
_attributes.Event = {
|
|
132
|
+
InputBegan = function(rbx, input)
|
|
133
|
+
if not active then
|
|
134
|
+
return nil
|
|
135
|
+
end
|
|
136
|
+
local direction = nudgeDelta(input.KeyCode.Name)
|
|
137
|
+
if direction ~= nil then
|
|
138
|
+
nudge(direction)
|
|
139
|
+
return nil
|
|
140
|
+
end
|
|
141
|
+
if not isSliderDrag(input.UserInputType.Name) then
|
|
142
|
+
return nil
|
|
143
|
+
end
|
|
144
|
+
local landed = pointerValue(rbx, input.Position.X)
|
|
145
|
+
if landed ~= nil then
|
|
146
|
+
thumb.current = rangeThumb(landed, latest.current.start, latest.current.finish)
|
|
147
|
+
end
|
|
148
|
+
dragging.current = true
|
|
149
|
+
setPressed(true)
|
|
150
|
+
update(rbx, input.Position.X)
|
|
151
|
+
end,
|
|
152
|
+
InputChanged = function(rbx, input)
|
|
153
|
+
if dragging.current and isSliderMove(input.UserInputType.Name) then
|
|
154
|
+
update(rbx, input.Position.X)
|
|
155
|
+
end
|
|
156
|
+
end,
|
|
157
|
+
InputEnded = function(_rbx, input)
|
|
158
|
+
if isSliderDrag(input.UserInputType.Name) then
|
|
159
|
+
finish()
|
|
160
|
+
end
|
|
161
|
+
end,
|
|
162
|
+
MouseLeave = function()
|
|
163
|
+
return finish()
|
|
164
|
+
end,
|
|
165
|
+
SelectionGained = function()
|
|
166
|
+
return setFocused(true)
|
|
167
|
+
end,
|
|
168
|
+
SelectionLost = function()
|
|
169
|
+
return setFocused(false)
|
|
170
|
+
end,
|
|
171
|
+
}
|
|
172
|
+
local _attributes_1 = {
|
|
173
|
+
key = "Track",
|
|
174
|
+
}
|
|
175
|
+
for _k, _v in styles.track do
|
|
176
|
+
_attributes_1[_k] = _v
|
|
177
|
+
end
|
|
178
|
+
_attributes_1.BackgroundTransparency = if faded then 0.55 else 0.35
|
|
179
|
+
local _attributes_2 = table.clone(styles.corner)
|
|
180
|
+
setmetatable(_attributes_2, nil)
|
|
181
|
+
local _exp = React.createElement("uicorner", _attributes_2)
|
|
182
|
+
local _attributes_3 = {
|
|
183
|
+
key = "Fill",
|
|
184
|
+
}
|
|
185
|
+
for _k, _v in cx(styles.fill, {
|
|
186
|
+
Position = UDim2.fromScale(ratios.low, 0),
|
|
187
|
+
Size = UDim2.fromScale(ratios.high - ratios.low, 1),
|
|
188
|
+
BackgroundTransparency = if faded then 0.55 elseif pressed then 0.1 else 0,
|
|
189
|
+
}) do
|
|
190
|
+
_attributes_3[_k] = _v
|
|
191
|
+
end
|
|
192
|
+
local _attributes_4 = table.clone(styles.corner)
|
|
193
|
+
setmetatable(_attributes_4, nil)
|
|
194
|
+
local _exp_1 = React.createElement("frame", _attributes_3, React.createElement("uicorner", _attributes_4))
|
|
195
|
+
local _attributes_5 = {
|
|
196
|
+
key = "Low",
|
|
197
|
+
}
|
|
198
|
+
for _k, _v in knobLook(ratios.low, "low") do
|
|
199
|
+
_attributes_5[_k] = _v
|
|
200
|
+
end
|
|
201
|
+
local _attributes_6 = table.clone(styles.corner)
|
|
202
|
+
setmetatable(_attributes_6, nil)
|
|
203
|
+
local _exp_2 = React.createElement("uicorner", _attributes_6)
|
|
204
|
+
local _condition_1 = showFocus and thumb.current == "low"
|
|
205
|
+
if _condition_1 then
|
|
206
|
+
local _attributes_7 = table.clone(styles.stroke)
|
|
207
|
+
setmetatable(_attributes_7, nil)
|
|
208
|
+
_condition_1 = React.createElement("uistroke", _attributes_7)
|
|
209
|
+
end
|
|
210
|
+
local _exp_3 = React.createElement("frame", _attributes_5, _exp_2, _condition_1)
|
|
211
|
+
local _attributes_7 = {
|
|
212
|
+
key = "High",
|
|
213
|
+
}
|
|
214
|
+
for _k, _v in knobLook(ratios.high, "high") do
|
|
215
|
+
_attributes_7[_k] = _v
|
|
216
|
+
end
|
|
217
|
+
local _attributes_8 = table.clone(styles.corner)
|
|
218
|
+
setmetatable(_attributes_8, nil)
|
|
219
|
+
local _exp_4 = React.createElement("uicorner", _attributes_8)
|
|
220
|
+
local _condition_2 = showFocus and thumb.current == "high"
|
|
221
|
+
if _condition_2 then
|
|
222
|
+
local _attributes_9 = table.clone(styles.stroke)
|
|
223
|
+
setmetatable(_attributes_9, nil)
|
|
224
|
+
_condition_2 = React.createElement("uistroke", _attributes_9)
|
|
225
|
+
end
|
|
226
|
+
return React.createElement(SxHost, _attributes, React.createElement("frame", _attributes_1, _exp, _exp_1, _exp_3, React.createElement("frame", _attributes_7, _exp_4, _condition_2)))
|
|
227
|
+
end
|
|
228
|
+
local default = RangeSlider
|
|
229
|
+
return {
|
|
230
|
+
default = default,
|
|
231
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ControlSize } from "../../../../theme/index";
|
|
2
|
+
import { SliderColor } from "./Slider.styles";
|
|
3
|
+
declare const useRangeSliderStyles: (props: {
|
|
4
|
+
size?: ControlSize;
|
|
5
|
+
color?: SliderColor;
|
|
6
|
+
}) => import("../../../../theme/index").ClassNameMap<string>;
|
|
7
|
+
export default useRangeSliderStyles;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
local _theme = TS.import(script, script.Parent.Parent.Parent.Parent.Parent, "theme")
|
|
4
|
+
local componentStyles = _theme.componentStyles
|
|
5
|
+
local controlMetrics = _theme.controlMetrics
|
|
6
|
+
local createStyles = _theme.createStyles
|
|
7
|
+
local focusRing = _theme.focusRing
|
|
8
|
+
local useRangeSliderStyles = componentStyles("RangeSlider", function(theme, _param)
|
|
9
|
+
local size = _param.size
|
|
10
|
+
local color = _param.color
|
|
11
|
+
if color == nil then
|
|
12
|
+
color = "primary"
|
|
13
|
+
end
|
|
14
|
+
local metrics = controlMetrics(theme.density, size)
|
|
15
|
+
local tone = if color == "accent" then theme.palette.accent.main else theme.palette.primary.main
|
|
16
|
+
return createStyles({
|
|
17
|
+
root = {
|
|
18
|
+
Size = UDim2.new(1, 0, 0, metrics.sliderHeight),
|
|
19
|
+
BackgroundTransparency = 1,
|
|
20
|
+
BorderSizePixel = 0,
|
|
21
|
+
},
|
|
22
|
+
track = {
|
|
23
|
+
Size = UDim2.new(1, 0, 0, metrics.sliderTrack),
|
|
24
|
+
Position = UDim2.fromScale(0, 0.5),
|
|
25
|
+
AnchorPoint = Vector2.new(0, 0.5),
|
|
26
|
+
BackgroundColor3 = theme.palette.action.disabled,
|
|
27
|
+
BorderSizePixel = 0,
|
|
28
|
+
},
|
|
29
|
+
fill = {
|
|
30
|
+
BackgroundColor3 = tone,
|
|
31
|
+
BorderSizePixel = 0,
|
|
32
|
+
},
|
|
33
|
+
knob = {
|
|
34
|
+
Size = UDim2.fromOffset(metrics.sliderKnob, metrics.sliderKnob),
|
|
35
|
+
AnchorPoint = Vector2.new(0.5, 0.5),
|
|
36
|
+
BackgroundColor3 = theme.palette.text.primary,
|
|
37
|
+
BorderSizePixel = 0,
|
|
38
|
+
},
|
|
39
|
+
corner = {
|
|
40
|
+
CornerRadius = UDim.new(1, 0),
|
|
41
|
+
},
|
|
42
|
+
stroke = focusRing(theme.palette.focus),
|
|
43
|
+
})
|
|
44
|
+
end)
|
|
45
|
+
local default = useRangeSliderStyles
|
|
46
|
+
return {
|
|
47
|
+
default = default,
|
|
48
|
+
}
|
|
@@ -10,6 +10,7 @@ export interface SliderProps {
|
|
|
10
10
|
disabled?: boolean;
|
|
11
11
|
size?: ControlSize;
|
|
12
12
|
marks?: boolean | ReadonlyArray<number>;
|
|
13
|
+
format?: (value: number) => string;
|
|
13
14
|
color?: SliderColor;
|
|
14
15
|
}
|
|
15
16
|
declare function Slider(props: CustomizedProps<Frame, SliderProps>): JSX.Element;
|
|
@@ -4,11 +4,18 @@ local _react = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
|
4
4
|
local React = _react
|
|
5
5
|
local useRef = _react.useRef
|
|
6
6
|
local useState = _react.useState
|
|
7
|
-
local
|
|
7
|
+
local TextService = TS.import(script, TS.getModule(script, "@rbxts", "services")).TextService
|
|
8
|
+
local _theme = TS.import(script, script.Parent.Parent.Parent.Parent.Parent, "theme")
|
|
9
|
+
local controlMetrics = _theme.controlMetrics
|
|
10
|
+
local cx = _theme.cx
|
|
11
|
+
local useTheme = _theme.useTheme
|
|
8
12
|
local canActivate = TS.import(script, script.Parent.Parent.Parent, "button", "components", "activation").canActivate
|
|
9
13
|
local SxHost = TS.import(script, script.Parent.Parent.Parent, "host").SxHost
|
|
10
14
|
local commitNumber = TS.import(script, script.Parent.Parent.Parent, "numberInput", "components", "numberValue").commitNumber
|
|
11
15
|
local useSliderStyles = TS.import(script, script.Parent, "Slider.styles").default
|
|
16
|
+
local _sliderLabel = TS.import(script, script.Parent, "sliderLabel")
|
|
17
|
+
local sliderLabel = _sliderLabel.sliderLabel
|
|
18
|
+
local sliderSlot = _sliderLabel.sliderSlot
|
|
12
19
|
local sliderMarkValues = TS.import(script, script.Parent, "sliderMarks").sliderMarkValues
|
|
13
20
|
local _sliderNudge = TS.import(script, script.Parent, "sliderNudge")
|
|
14
21
|
local isSliderDrag = _sliderNudge.isSliderDrag
|
|
@@ -26,6 +33,7 @@ local function Slider(props)
|
|
|
26
33
|
local disabled = _binding.disabled
|
|
27
34
|
local size = _binding.size
|
|
28
35
|
local marks = _binding.marks
|
|
36
|
+
local format = _binding.format
|
|
29
37
|
local color = _binding.color
|
|
30
38
|
if color == nil then
|
|
31
39
|
color = "primary"
|
|
@@ -34,17 +42,26 @@ local function Slider(props)
|
|
|
34
42
|
local sx = _binding.sx
|
|
35
43
|
local id = _binding.id
|
|
36
44
|
local ref = _binding.ref
|
|
37
|
-
local
|
|
45
|
+
local labelText = sliderLabel(format, value)
|
|
46
|
+
local _binding_1 = useTheme()
|
|
47
|
+
local theme = _binding_1.theme
|
|
48
|
+
local metrics = controlMetrics(theme.density, size)
|
|
49
|
+
local caption = theme.typography.variants.caption
|
|
50
|
+
local font = theme.typography.fontFamilies[caption.family] or Enum.Font.SourceSans
|
|
51
|
+
local slot = if labelText == nil then 0 else sliderSlot(TextService:GetTextSize(labelText, caption.size, font, Vector2.new(10000, 100)).X, 52, 4)
|
|
52
|
+
local _binding_2 = useSliderStyles({
|
|
38
53
|
size = size,
|
|
39
54
|
color = color,
|
|
55
|
+
labeled = labelText ~= nil,
|
|
40
56
|
})
|
|
41
|
-
local root =
|
|
42
|
-
local track =
|
|
43
|
-
local fill =
|
|
44
|
-
local knob =
|
|
45
|
-
local corner =
|
|
46
|
-
local stroke =
|
|
47
|
-
local mark =
|
|
57
|
+
local root = _binding_2.root
|
|
58
|
+
local track = _binding_2.track
|
|
59
|
+
local fill = _binding_2.fill
|
|
60
|
+
local knob = _binding_2.knob
|
|
61
|
+
local corner = _binding_2.corner
|
|
62
|
+
local stroke = _binding_2.stroke
|
|
63
|
+
local mark = _binding_2.mark
|
|
64
|
+
local label = _binding_2.label
|
|
48
65
|
local active = canActivate(disabled)
|
|
49
66
|
local focused, setFocused = useState(false)
|
|
50
67
|
local hovering, setHovering = useState(false)
|
|
@@ -162,6 +179,8 @@ local function Slider(props)
|
|
|
162
179
|
}
|
|
163
180
|
for _k, _v in cx(track, {
|
|
164
181
|
BackgroundTransparency = if faded then 0.55 elseif hovering and active then 0.2 else 0.35,
|
|
182
|
+
}, labelText ~= nil and {
|
|
183
|
+
Size = UDim2.new(1, -(slot + 4), 0, metrics.sliderTrack),
|
|
165
184
|
}) do
|
|
166
185
|
_attributes_1[_k] = _v
|
|
167
186
|
end
|
|
@@ -221,10 +240,24 @@ local function Slider(props)
|
|
|
221
240
|
if _condition_2 then
|
|
222
241
|
local _attributes_7 = table.clone(stroke)
|
|
223
242
|
setmetatable(_attributes_7, nil)
|
|
224
|
-
_attributes_7.Thickness = 1
|
|
225
243
|
_condition_2 = React.createElement("uistroke", _attributes_7)
|
|
226
244
|
end
|
|
227
|
-
|
|
245
|
+
local _exp_4 = React.createElement("frame", _attributes_1, _exp, _condition_1, _exp_1, _exp_2, React.createElement("frame", _attributes_5, _exp_3, _condition_2))
|
|
246
|
+
local _result
|
|
247
|
+
if labelText ~= nil then
|
|
248
|
+
local _attributes_7 = {
|
|
249
|
+
key = "Value",
|
|
250
|
+
}
|
|
251
|
+
for _k, _v in label do
|
|
252
|
+
_attributes_7[_k] = _v
|
|
253
|
+
end
|
|
254
|
+
_attributes_7.Size = UDim2.new(0, slot, 1, 0)
|
|
255
|
+
_attributes_7.Text = labelText
|
|
256
|
+
_result = React.createElement("textlabel", _attributes_7)
|
|
257
|
+
else
|
|
258
|
+
_result = nil
|
|
259
|
+
end
|
|
260
|
+
return React.createElement(SxHost, _attributes, _exp_4, _result)
|
|
228
261
|
end
|
|
229
262
|
local default = Slider
|
|
230
263
|
return {
|
|
@@ -3,6 +3,7 @@ export type SliderColor = "primary" | "accent";
|
|
|
3
3
|
export interface SliderStyleProps {
|
|
4
4
|
size?: ControlSize;
|
|
5
5
|
color?: SliderColor;
|
|
6
|
+
labeled?: boolean;
|
|
6
7
|
}
|
|
7
8
|
declare const useSliderStyles: (props: SliderStyleProps) => import("../../../../theme/index").ClassNameMap<string>;
|
|
8
9
|
export default useSliderStyles;
|