@rbxts/uiblox 0.2.0-alpha.35 → 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 +12 -0
- package/out/ui/packages/init.luau +36 -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/reorder/index.d.ts +2 -0
- package/out/ui/packages/reorder/init.luau +14 -0
- package/out/ui/packages/reorder/reorder.d.ts +24 -0
- package/out/ui/packages/reorder/reorder.luau +178 -0
- package/out/ui/packages/reorder/useReorderDrag.d.ts +15 -0
- package/out/ui/packages/reorder/useReorderDrag.luau +129 -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,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;
|
|
@@ -4,14 +4,20 @@ 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 useSliderStyles = componentStyles("Slider", function(theme, _param)
|
|
8
9
|
local size = _param.size
|
|
9
10
|
local color = _param.color
|
|
10
11
|
if color == nil then
|
|
11
12
|
color = "primary"
|
|
12
13
|
end
|
|
14
|
+
local labeled = _param.labeled
|
|
15
|
+
if labeled == nil then
|
|
16
|
+
labeled = false
|
|
17
|
+
end
|
|
13
18
|
local metrics = controlMetrics(theme.density, size)
|
|
14
19
|
local tone = if color == "accent" then theme.palette.accent.main else theme.palette.primary.main
|
|
20
|
+
local caption = theme.typography.variants.caption
|
|
15
21
|
return createStyles({
|
|
16
22
|
root = {
|
|
17
23
|
Size = UDim2.new(1, 0, 0, metrics.sliderHeight),
|
|
@@ -19,7 +25,7 @@ local useSliderStyles = componentStyles("Slider", function(theme, _param)
|
|
|
19
25
|
BorderSizePixel = 0,
|
|
20
26
|
},
|
|
21
27
|
track = {
|
|
22
|
-
Size = UDim2.new(1, 0, 0, metrics.sliderTrack),
|
|
28
|
+
Size = UDim2.new(1, if labeled then -56 else 0, 0, metrics.sliderTrack),
|
|
23
29
|
Position = UDim2.fromScale(0, 0.5),
|
|
24
30
|
AnchorPoint = Vector2.new(0, 0.5),
|
|
25
31
|
BackgroundColor3 = theme.palette.action.disabled,
|
|
@@ -39,10 +45,18 @@ local useSliderStyles = componentStyles("Slider", function(theme, _param)
|
|
|
39
45
|
corner = {
|
|
40
46
|
CornerRadius = UDim.new(1, 0),
|
|
41
47
|
},
|
|
42
|
-
stroke =
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
48
|
+
stroke = focusRing(theme.palette.focus),
|
|
49
|
+
label = {
|
|
50
|
+
Size = UDim2.new(0, 52, 1, 0),
|
|
51
|
+
Position = UDim2.fromScale(1, 0.5),
|
|
52
|
+
AnchorPoint = Vector2.new(1, 0.5),
|
|
53
|
+
BackgroundTransparency = 1,
|
|
54
|
+
BorderSizePixel = 0,
|
|
55
|
+
Font = theme.typography.fontFamilies[caption.family],
|
|
56
|
+
TextSize = caption.size,
|
|
57
|
+
TextColor3 = theme.palette.text.secondary,
|
|
58
|
+
TextXAlignment = Enum.TextXAlignment.Right,
|
|
59
|
+
TextYAlignment = Enum.TextYAlignment.Center,
|
|
46
60
|
},
|
|
47
61
|
mark = {
|
|
48
62
|
Size = UDim2.new(0, 2, 0, metrics.sliderTrack + 4),
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export type RangeThumb = "low" | "high";
|
|
2
|
+
export interface RangeValue {
|
|
3
|
+
start: number;
|
|
4
|
+
finish: number;
|
|
5
|
+
}
|
|
6
|
+
export declare function orderRange(start: number, finish: number): RangeValue;
|
|
7
|
+
export declare function rangeRatios(start: number, finish: number, min: number, max: number): {
|
|
8
|
+
low: number;
|
|
9
|
+
high: number;
|
|
10
|
+
};
|
|
11
|
+
/** Ties belong to the high thumb. */
|
|
12
|
+
export declare function rangeThumb(pointer: number, start: number, finish: number): RangeThumb;
|
|
13
|
+
export declare function rangeMove(thumb: RangeThumb, value: number, start: number, finish: number): {
|
|
14
|
+
thumb: "high";
|
|
15
|
+
start: number;
|
|
16
|
+
finish: number;
|
|
17
|
+
} | {
|
|
18
|
+
thumb: "low";
|
|
19
|
+
start: number;
|
|
20
|
+
finish: number;
|
|
21
|
+
};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local function orderRange(start, finish)
|
|
3
|
+
if start <= finish then
|
|
4
|
+
return {
|
|
5
|
+
start = start,
|
|
6
|
+
finish = finish,
|
|
7
|
+
}
|
|
8
|
+
end
|
|
9
|
+
return {
|
|
10
|
+
start = finish,
|
|
11
|
+
finish = start,
|
|
12
|
+
}
|
|
13
|
+
end
|
|
14
|
+
local function unit(value, min, span)
|
|
15
|
+
local ratio = (value - min) / span
|
|
16
|
+
if ratio < 0 then
|
|
17
|
+
ratio = 0
|
|
18
|
+
end
|
|
19
|
+
if ratio > 1 then
|
|
20
|
+
ratio = 1
|
|
21
|
+
end
|
|
22
|
+
return ratio
|
|
23
|
+
end
|
|
24
|
+
local function rangeRatios(start, finish, min, max)
|
|
25
|
+
local span = max - min
|
|
26
|
+
local ordered = orderRange(start, finish)
|
|
27
|
+
if not (span > 0) then
|
|
28
|
+
return {
|
|
29
|
+
low = 0,
|
|
30
|
+
high = 0,
|
|
31
|
+
}
|
|
32
|
+
end
|
|
33
|
+
return {
|
|
34
|
+
low = unit(ordered.start, min, span),
|
|
35
|
+
high = unit(ordered.finish, min, span),
|
|
36
|
+
}
|
|
37
|
+
end
|
|
38
|
+
--* Ties belong to the high thumb.
|
|
39
|
+
local function rangeThumb(pointer, start, finish)
|
|
40
|
+
local ordered = orderRange(start, finish)
|
|
41
|
+
return if pointer < (ordered.start + ordered.finish) / 2 then "low" else "high"
|
|
42
|
+
end
|
|
43
|
+
local function rangeMove(thumb, value, start, finish)
|
|
44
|
+
local ordered = orderRange(start, finish)
|
|
45
|
+
if thumb == "low" then
|
|
46
|
+
if value > ordered.finish then
|
|
47
|
+
return {
|
|
48
|
+
thumb = "high",
|
|
49
|
+
start = ordered.finish,
|
|
50
|
+
finish = value,
|
|
51
|
+
}
|
|
52
|
+
end
|
|
53
|
+
return {
|
|
54
|
+
thumb = "low",
|
|
55
|
+
start = value,
|
|
56
|
+
finish = ordered.finish,
|
|
57
|
+
}
|
|
58
|
+
end
|
|
59
|
+
if value < ordered.start then
|
|
60
|
+
return {
|
|
61
|
+
thumb = "low",
|
|
62
|
+
start = value,
|
|
63
|
+
finish = ordered.start,
|
|
64
|
+
}
|
|
65
|
+
end
|
|
66
|
+
return {
|
|
67
|
+
thumb = "high",
|
|
68
|
+
start = ordered.start,
|
|
69
|
+
finish = value,
|
|
70
|
+
}
|
|
71
|
+
end
|
|
72
|
+
return {
|
|
73
|
+
orderRange = orderRange,
|
|
74
|
+
rangeRatios = rangeRatios,
|
|
75
|
+
rangeThumb = rangeThumb,
|
|
76
|
+
rangeMove = rangeMove,
|
|
77
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** Caption for the current value. Missing or blank format leaves the track full width. */
|
|
2
|
+
export declare function sliderLabel(format: ((value: number) => string) | undefined, value: number): string | undefined;
|
|
3
|
+
/** A long caption grows past the short slot. A short caption keeps that slot. */
|
|
4
|
+
export declare function sliderSlot(textWidth: number, floor: number, pad?: number): number;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
--* Caption for the current value. Missing or blank format leaves the track full width.
|
|
3
|
+
local function sliderLabel(format, value)
|
|
4
|
+
if format == nil then
|
|
5
|
+
return nil
|
|
6
|
+
end
|
|
7
|
+
local text = format(value)
|
|
8
|
+
if text == "" then
|
|
9
|
+
return nil
|
|
10
|
+
end
|
|
11
|
+
return text
|
|
12
|
+
end
|
|
13
|
+
--* A long caption grows past the short slot. A short caption keeps that slot.
|
|
14
|
+
local function sliderSlot(textWidth, floor, pad)
|
|
15
|
+
if pad == nil then
|
|
16
|
+
pad = 0
|
|
17
|
+
end
|
|
18
|
+
local need = textWidth + pad
|
|
19
|
+
if need < 0 then
|
|
20
|
+
need = 0
|
|
21
|
+
end
|
|
22
|
+
if floor > need then
|
|
23
|
+
return floor
|
|
24
|
+
end
|
|
25
|
+
return need
|
|
26
|
+
end
|
|
27
|
+
return {
|
|
28
|
+
sliderLabel = sliderLabel,
|
|
29
|
+
sliderSlot = sliderSlot,
|
|
30
|
+
}
|
|
@@ -1,2 +1,5 @@
|
|
|
1
1
|
export { default as Slider } from "./components/Slider";
|
|
2
2
|
export { SliderProps } from "./components/Slider";
|
|
3
|
+
export { default as RangeSlider } from "./components/RangeSlider";
|
|
4
|
+
export { RangeSliderProps } from "./components/RangeSlider";
|
|
5
|
+
export { orderRange, rangeMove, rangeRatios, rangeThumb, RangeValue } from "./components/rangeValue";
|
|
@@ -2,4 +2,10 @@
|
|
|
2
2
|
local TS = _G[script]
|
|
3
3
|
local exports = {}
|
|
4
4
|
exports.Slider = TS.import(script, script, "components", "Slider").default
|
|
5
|
+
exports.RangeSlider = TS.import(script, script, "components", "RangeSlider").default
|
|
6
|
+
local _rangeValue = TS.import(script, script, "components", "rangeValue")
|
|
7
|
+
exports.orderRange = _rangeValue.orderRange
|
|
8
|
+
exports.rangeMove = _rangeValue.rangeMove
|
|
9
|
+
exports.rangeRatios = _rangeValue.rangeRatios
|
|
10
|
+
exports.rangeThumb = _rangeValue.rangeThumb
|
|
5
11
|
return exports
|
|
@@ -15,6 +15,7 @@ local function Snackbar(props)
|
|
|
15
15
|
end
|
|
16
16
|
local action = _binding.action
|
|
17
17
|
local onAction = _binding.onAction
|
|
18
|
+
local edge = _binding.edge
|
|
18
19
|
local className = _binding.className
|
|
19
20
|
local sx = _binding.sx
|
|
20
21
|
local id = _binding.id
|
|
@@ -29,6 +30,7 @@ local function Snackbar(props)
|
|
|
29
30
|
variant = variant,
|
|
30
31
|
action = snackbarActionLabel(action),
|
|
31
32
|
onAction = onAction,
|
|
33
|
+
edge = edge,
|
|
32
34
|
className = className,
|
|
33
35
|
sx = sx,
|
|
34
36
|
}
|
|
@@ -4,6 +4,9 @@ export interface SparklineProps {
|
|
|
4
4
|
width?: number;
|
|
5
5
|
height?: number;
|
|
6
6
|
color?: Color3;
|
|
7
|
+
area?: boolean;
|
|
8
|
+
mark?: number;
|
|
9
|
+
onPick?: (index: number) => void;
|
|
7
10
|
}
|
|
8
11
|
declare function Sparkline(props: CustomizedProps<Frame, SparklineProps>): JSX.Element;
|
|
9
12
|
export default Sparkline;
|