@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,21 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
--* Shrink-wrap by default. Wrap uses the parent width and grows with the text.
|
|
3
|
+
local function textBox(wrap)
|
|
4
|
+
if wrap == true then
|
|
5
|
+
return {
|
|
6
|
+
widthScale = 1,
|
|
7
|
+
heightScale = 0,
|
|
8
|
+
automatic = "Y",
|
|
9
|
+
wrapped = true,
|
|
10
|
+
}
|
|
11
|
+
end
|
|
12
|
+
return {
|
|
13
|
+
widthScale = 0,
|
|
14
|
+
heightScale = 0,
|
|
15
|
+
automatic = "XY",
|
|
16
|
+
wrapped = false,
|
|
17
|
+
}
|
|
18
|
+
end
|
|
19
|
+
return {
|
|
20
|
+
textBox = textBox,
|
|
21
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { CustomizedProps } from "../../../../theme/index";
|
|
2
|
+
import { TimeOfDay } from "../timeValue";
|
|
3
|
+
export interface TimeFieldProps {
|
|
4
|
+
value: TimeOfDay;
|
|
5
|
+
onChange: (value: TimeOfDay) => void;
|
|
6
|
+
step?: number;
|
|
7
|
+
wrap?: boolean;
|
|
8
|
+
min?: number;
|
|
9
|
+
max?: number;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
}
|
|
12
|
+
declare function TimeField(props: CustomizedProps<Frame, TimeFieldProps>): JSX.Element;
|
|
13
|
+
export default TimeField;
|
|
@@ -0,0 +1,102 @@
|
|
|
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 useTheme = TS.import(script, script.Parent.Parent.Parent.Parent.Parent, "theme").useTheme
|
|
5
|
+
local NumberInput = TS.import(script, script.Parent.Parent.Parent, "numberInput").NumberInput
|
|
6
|
+
local SxHost = TS.import(script, script.Parent.Parent.Parent, "host").SxHost
|
|
7
|
+
local resolveTime = TS.import(script, script.Parent.Parent, "timeValue").resolveTime
|
|
8
|
+
local function TimeField(props)
|
|
9
|
+
local _binding = props
|
|
10
|
+
local value = _binding.value
|
|
11
|
+
local onChange = _binding.onChange
|
|
12
|
+
local step = _binding.step
|
|
13
|
+
if step == nil then
|
|
14
|
+
step = 1
|
|
15
|
+
end
|
|
16
|
+
local wrap = _binding.wrap
|
|
17
|
+
if wrap == nil then
|
|
18
|
+
wrap = true
|
|
19
|
+
end
|
|
20
|
+
local min = _binding.min
|
|
21
|
+
local max = _binding.max
|
|
22
|
+
local disabled = _binding.disabled
|
|
23
|
+
local className = _binding.className
|
|
24
|
+
local sx = _binding.sx
|
|
25
|
+
local id = _binding.id
|
|
26
|
+
local ref = _binding.ref
|
|
27
|
+
local _binding_1 = useTheme()
|
|
28
|
+
local theme = _binding_1.theme
|
|
29
|
+
local commit = function(hour, minute)
|
|
30
|
+
local resolved = resolveTime({
|
|
31
|
+
hour = hour,
|
|
32
|
+
minute = minute,
|
|
33
|
+
}, step, wrap, min, max)
|
|
34
|
+
if resolved == nil then
|
|
35
|
+
return nil
|
|
36
|
+
end
|
|
37
|
+
if resolved.hour == value.hour and resolved.minute == value.minute then
|
|
38
|
+
return nil
|
|
39
|
+
end
|
|
40
|
+
onChange(resolved)
|
|
41
|
+
end
|
|
42
|
+
local _attributes = {
|
|
43
|
+
tag = "frame",
|
|
44
|
+
}
|
|
45
|
+
local _condition = id
|
|
46
|
+
if not (_condition ~= 0 and _condition == _condition and _condition ~= "" and _condition) then
|
|
47
|
+
_condition = "TimeField"
|
|
48
|
+
end
|
|
49
|
+
_attributes.key = _condition
|
|
50
|
+
_attributes.hostRef = ref
|
|
51
|
+
_attributes.base = {
|
|
52
|
+
AutomaticSize = Enum.AutomaticSize.XY,
|
|
53
|
+
Size = UDim2.fromScale(0, 0),
|
|
54
|
+
BackgroundTransparency = 1,
|
|
55
|
+
BorderSizePixel = 0,
|
|
56
|
+
}
|
|
57
|
+
_attributes.className = className
|
|
58
|
+
_attributes.sx = sx
|
|
59
|
+
return React.createElement(SxHost, _attributes, React.createElement("uilistlayout", {
|
|
60
|
+
FillDirection = Enum.FillDirection.Horizontal,
|
|
61
|
+
Padding = UDim.new(0, 4),
|
|
62
|
+
VerticalAlignment = Enum.VerticalAlignment.Center,
|
|
63
|
+
SortOrder = Enum.SortOrder.LayoutOrder,
|
|
64
|
+
}), React.createElement(NumberInput, {
|
|
65
|
+
value = value.hour,
|
|
66
|
+
step = 1,
|
|
67
|
+
disabled = disabled,
|
|
68
|
+
size = "small",
|
|
69
|
+
width = UDim.new(0, 56),
|
|
70
|
+
sx = {
|
|
71
|
+
LayoutOrder = 0,
|
|
72
|
+
},
|
|
73
|
+
onChange = function(hour)
|
|
74
|
+
return commit(hour, value.minute)
|
|
75
|
+
end,
|
|
76
|
+
}), React.createElement("textlabel", {
|
|
77
|
+
Text = ":",
|
|
78
|
+
LayoutOrder = 1,
|
|
79
|
+
BackgroundTransparency = 1,
|
|
80
|
+
BorderSizePixel = 0,
|
|
81
|
+
Size = UDim2.fromOffset(8, 24),
|
|
82
|
+
Font = theme.typography.fontFamilies.default,
|
|
83
|
+
TextSize = theme.typography.fontSizes.body,
|
|
84
|
+
TextColor3 = theme.palette.text.secondary,
|
|
85
|
+
}), React.createElement(NumberInput, {
|
|
86
|
+
value = value.minute,
|
|
87
|
+
step = step,
|
|
88
|
+
disabled = disabled,
|
|
89
|
+
size = "small",
|
|
90
|
+
width = UDim.new(0, 56),
|
|
91
|
+
sx = {
|
|
92
|
+
LayoutOrder = 2,
|
|
93
|
+
},
|
|
94
|
+
onChange = function(minute)
|
|
95
|
+
return commit(value.hour, minute)
|
|
96
|
+
end,
|
|
97
|
+
}))
|
|
98
|
+
end
|
|
99
|
+
local default = TimeField
|
|
100
|
+
return {
|
|
101
|
+
default = default,
|
|
102
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
local exports = {}
|
|
4
|
+
exports.TimeField = TS.import(script, script, "components", "TimeField").default
|
|
5
|
+
local _timeValue = TS.import(script, script, "timeValue")
|
|
6
|
+
exports.resolveTime = _timeValue.resolveTime
|
|
7
|
+
exports.timeRangeOk = _timeValue.timeRangeOk
|
|
8
|
+
exports.timeToMinutes = _timeValue.timeToMinutes
|
|
9
|
+
return exports
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface TimeOfDay {
|
|
2
|
+
hour: number;
|
|
3
|
+
minute: number;
|
|
4
|
+
}
|
|
5
|
+
export declare function timeToMinutes(value: TimeOfDay): number;
|
|
6
|
+
/** Snap to a minute step. Wrap into the day, or reject an invalid range. */
|
|
7
|
+
export declare function resolveTime(value: TimeOfDay, step?: number, wrap?: boolean, min?: number, max?: number): TimeOfDay | undefined;
|
|
8
|
+
export declare function timeRangeOk(start: TimeOfDay, finish: TimeOfDay): boolean;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local DAY = 1440
|
|
3
|
+
local function modDay(total)
|
|
4
|
+
local remainder = total % DAY
|
|
5
|
+
return if remainder < 0 then remainder + DAY else remainder
|
|
6
|
+
end
|
|
7
|
+
local function timeToMinutes(value)
|
|
8
|
+
return value.hour * 60 + value.minute
|
|
9
|
+
end
|
|
10
|
+
--* Snap to a minute step. Wrap into the day, or reject an invalid range.
|
|
11
|
+
local function resolveTime(value, step, wrap, min, max)
|
|
12
|
+
if step == nil then
|
|
13
|
+
step = 1
|
|
14
|
+
end
|
|
15
|
+
if wrap == nil then
|
|
16
|
+
wrap = true
|
|
17
|
+
end
|
|
18
|
+
if step <= 0 then
|
|
19
|
+
return nil
|
|
20
|
+
end
|
|
21
|
+
if min ~= nil and max ~= nil and min > max then
|
|
22
|
+
return nil
|
|
23
|
+
end
|
|
24
|
+
local size = math.max(1, math.floor(step))
|
|
25
|
+
local total = math.floor((value.hour * 60 + value.minute) / size + 0.5) * size
|
|
26
|
+
if wrap then
|
|
27
|
+
total = modDay(total)
|
|
28
|
+
elseif total < 0 or total >= DAY then
|
|
29
|
+
return nil
|
|
30
|
+
end
|
|
31
|
+
if min ~= nil and total < min then
|
|
32
|
+
return nil
|
|
33
|
+
end
|
|
34
|
+
if max ~= nil and total > max then
|
|
35
|
+
return nil
|
|
36
|
+
end
|
|
37
|
+
return {
|
|
38
|
+
hour = math.floor(total / 60),
|
|
39
|
+
minute = total % 60,
|
|
40
|
+
}
|
|
41
|
+
end
|
|
42
|
+
local function timeRangeOk(start, finish)
|
|
43
|
+
return timeToMinutes(finish) > timeToMinutes(start)
|
|
44
|
+
end
|
|
45
|
+
return {
|
|
46
|
+
timeToMinutes = timeToMinutes,
|
|
47
|
+
resolveTime = resolveTime,
|
|
48
|
+
timeRangeOk = timeRangeOk,
|
|
49
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CustomizedProps } from "../../../../theme/index";
|
|
2
|
+
import { TimelineTone } from "./timelineRail";
|
|
3
|
+
export interface TimelineItem {
|
|
4
|
+
title: string;
|
|
5
|
+
caption?: string;
|
|
6
|
+
tone?: TimelineTone;
|
|
7
|
+
}
|
|
8
|
+
export interface TimelineProps {
|
|
9
|
+
items: TimelineItem[];
|
|
10
|
+
}
|
|
11
|
+
declare function Timeline(props: CustomizedProps<Frame, TimelineProps>): JSX.Element;
|
|
12
|
+
export default Timeline;
|
|
@@ -0,0 +1,99 @@
|
|
|
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 cx = TS.import(script, script.Parent.Parent.Parent.Parent.Parent, "theme").cx
|
|
5
|
+
local SxHost = TS.import(script, script.Parent.Parent.Parent, "host").SxHost
|
|
6
|
+
local useTimelineStyles = TS.import(script, script.Parent, "Timeline.styles").default
|
|
7
|
+
local _timelineRail = TS.import(script, script.Parent, "timelineRail")
|
|
8
|
+
local timelineRail = _timelineRail.timelineRail
|
|
9
|
+
local timelineTone = _timelineRail.timelineTone
|
|
10
|
+
local function Timeline(props)
|
|
11
|
+
local _binding = props
|
|
12
|
+
local items = _binding.items
|
|
13
|
+
local className = _binding.className
|
|
14
|
+
local sx = _binding.sx
|
|
15
|
+
local id = _binding.id
|
|
16
|
+
local ref = _binding.ref
|
|
17
|
+
local styles = useTimelineStyles()
|
|
18
|
+
local count = #items
|
|
19
|
+
local _attributes = {
|
|
20
|
+
tag = "frame",
|
|
21
|
+
}
|
|
22
|
+
local _condition = id
|
|
23
|
+
if not (_condition ~= 0 and _condition == _condition and _condition ~= "" and _condition) then
|
|
24
|
+
_condition = "Timeline"
|
|
25
|
+
end
|
|
26
|
+
_attributes.key = _condition
|
|
27
|
+
_attributes.hostRef = ref
|
|
28
|
+
_attributes.base = styles.root
|
|
29
|
+
_attributes.className = className
|
|
30
|
+
_attributes.sx = sx
|
|
31
|
+
local _attributes_1 = table.clone(styles.list)
|
|
32
|
+
setmetatable(_attributes_1, nil)
|
|
33
|
+
local _exp = React.createElement("uilistlayout", _attributes_1)
|
|
34
|
+
-- ▼ ReadonlyArray.map ▼
|
|
35
|
+
local _newValue = table.create(#items)
|
|
36
|
+
local _callback = function(item, index)
|
|
37
|
+
local tone = timelineTone(item.tone)
|
|
38
|
+
local mark = if tone == "done" then styles.done elseif tone == "active" then styles.active elseif tone == "error" then styles.error else styles.pending
|
|
39
|
+
local caption = item.caption
|
|
40
|
+
local _attributes_2 = {
|
|
41
|
+
key = `{item.title}-{index}`,
|
|
42
|
+
}
|
|
43
|
+
for _k, _v in styles.item do
|
|
44
|
+
_attributes_2[_k] = _v
|
|
45
|
+
end
|
|
46
|
+
_attributes_2.LayoutOrder = index
|
|
47
|
+
local _attributes_3 = table.clone(styles.row)
|
|
48
|
+
setmetatable(_attributes_3, nil)
|
|
49
|
+
local _exp_1 = React.createElement("uilistlayout", _attributes_3)
|
|
50
|
+
local _attributes_4 = table.clone(styles.rail)
|
|
51
|
+
setmetatable(_attributes_4, nil)
|
|
52
|
+
local _result
|
|
53
|
+
if timelineRail(index, count) then
|
|
54
|
+
local _attributes_5 = table.clone(styles.line)
|
|
55
|
+
setmetatable(_attributes_5, nil)
|
|
56
|
+
_result = React.createElement("frame", _attributes_5)
|
|
57
|
+
else
|
|
58
|
+
_result = nil
|
|
59
|
+
end
|
|
60
|
+
local _attributes_5 = table.clone(cx(styles.dot, mark))
|
|
61
|
+
setmetatable(_attributes_5, nil)
|
|
62
|
+
local _exp_2 = React.createElement("frame", _attributes_4, _result, React.createElement("frame", _attributes_5, React.createElement("uicorner", {
|
|
63
|
+
CornerRadius = UDim.new(1, 0),
|
|
64
|
+
})))
|
|
65
|
+
local _attributes_6 = table.clone(styles.body)
|
|
66
|
+
setmetatable(_attributes_6, nil)
|
|
67
|
+
local _attributes_7 = table.clone(styles.bodyPad)
|
|
68
|
+
setmetatable(_attributes_7, nil)
|
|
69
|
+
local _exp_3 = React.createElement("uipadding", _attributes_7)
|
|
70
|
+
local _attributes_8 = table.clone(styles.bodyList)
|
|
71
|
+
setmetatable(_attributes_8, nil)
|
|
72
|
+
local _exp_4 = React.createElement("uilistlayout", _attributes_8)
|
|
73
|
+
local _attributes_9 = table.clone(styles.title)
|
|
74
|
+
setmetatable(_attributes_9, nil)
|
|
75
|
+
_attributes_9.Text = item.title
|
|
76
|
+
_attributes_9.LayoutOrder = 0
|
|
77
|
+
local _exp_5 = React.createElement("textlabel", _attributes_9)
|
|
78
|
+
local _result_1
|
|
79
|
+
if caption ~= nil and #caption > 0 then
|
|
80
|
+
local _attributes_10 = table.clone(styles.caption)
|
|
81
|
+
setmetatable(_attributes_10, nil)
|
|
82
|
+
_attributes_10.Text = caption
|
|
83
|
+
_attributes_10.LayoutOrder = 1
|
|
84
|
+
_result_1 = (React.createElement("textlabel", _attributes_10))
|
|
85
|
+
else
|
|
86
|
+
_result_1 = nil
|
|
87
|
+
end
|
|
88
|
+
return React.createElement("frame", _attributes_2, _exp_1, _exp_2, React.createElement("frame", _attributes_6, _exp_3, _exp_4, _exp_5, _result_1))
|
|
89
|
+
end
|
|
90
|
+
for _k, _v in items do
|
|
91
|
+
_newValue[_k] = _callback(_v, _k - 1, items)
|
|
92
|
+
end
|
|
93
|
+
-- ▲ ReadonlyArray.map ▲
|
|
94
|
+
return React.createElement(SxHost, _attributes, _exp, React.createElement(React.Fragment, nil, _newValue))
|
|
95
|
+
end
|
|
96
|
+
local default = Timeline
|
|
97
|
+
return {
|
|
98
|
+
default = default,
|
|
99
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
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 createStyles = _theme.createStyles
|
|
6
|
+
local useTimelineStyles = componentStyles("Timeline", function(theme)
|
|
7
|
+
local dot = theme.spacing.calc(1.5)
|
|
8
|
+
local rail = theme.spacing.calc(2)
|
|
9
|
+
return createStyles({
|
|
10
|
+
root = {
|
|
11
|
+
AutomaticSize = Enum.AutomaticSize.XY,
|
|
12
|
+
Size = UDim2.fromScale(0, 0),
|
|
13
|
+
BackgroundTransparency = 1,
|
|
14
|
+
BorderSizePixel = 0,
|
|
15
|
+
},
|
|
16
|
+
list = {
|
|
17
|
+
FillDirection = Enum.FillDirection.Vertical,
|
|
18
|
+
SortOrder = Enum.SortOrder.LayoutOrder,
|
|
19
|
+
Padding = UDim.new(0, 0),
|
|
20
|
+
},
|
|
21
|
+
item = {
|
|
22
|
+
AutomaticSize = Enum.AutomaticSize.XY,
|
|
23
|
+
Size = UDim2.fromScale(0, 0),
|
|
24
|
+
BackgroundTransparency = 1,
|
|
25
|
+
BorderSizePixel = 0,
|
|
26
|
+
},
|
|
27
|
+
row = {
|
|
28
|
+
FillDirection = Enum.FillDirection.Horizontal,
|
|
29
|
+
SortOrder = Enum.SortOrder.LayoutOrder,
|
|
30
|
+
ItemLineAlignment = Enum.ItemLineAlignment.Stretch,
|
|
31
|
+
Padding = UDim.new(0, theme.spacing.calc(1)),
|
|
32
|
+
},
|
|
33
|
+
rail = {
|
|
34
|
+
Size = UDim2.fromOffset(rail, 0),
|
|
35
|
+
LayoutOrder = 0,
|
|
36
|
+
BackgroundTransparency = 1,
|
|
37
|
+
BorderSizePixel = 0,
|
|
38
|
+
},
|
|
39
|
+
dot = {
|
|
40
|
+
AnchorPoint = Vector2.new(0.5, 0),
|
|
41
|
+
Position = UDim2.new(0.5, 0, 0, 2),
|
|
42
|
+
Size = UDim2.fromOffset(dot, dot),
|
|
43
|
+
BorderSizePixel = 0,
|
|
44
|
+
ZIndex = 2,
|
|
45
|
+
},
|
|
46
|
+
done = {
|
|
47
|
+
BackgroundColor3 = theme.palette.status.success.main,
|
|
48
|
+
},
|
|
49
|
+
active = {
|
|
50
|
+
BackgroundColor3 = theme.palette.primary.main,
|
|
51
|
+
},
|
|
52
|
+
pending = {
|
|
53
|
+
BackgroundColor3 = theme.palette.text.disabled,
|
|
54
|
+
},
|
|
55
|
+
error = {
|
|
56
|
+
BackgroundColor3 = theme.palette.status.error.main,
|
|
57
|
+
},
|
|
58
|
+
line = {
|
|
59
|
+
AnchorPoint = Vector2.new(0.5, 0),
|
|
60
|
+
Position = UDim2.new(0.5, 0, 0, dot + 2),
|
|
61
|
+
Size = UDim2.new(0, 2, 1, -(dot + 2)),
|
|
62
|
+
BackgroundColor3 = theme.palette.divider,
|
|
63
|
+
BorderSizePixel = 0,
|
|
64
|
+
ZIndex = 1,
|
|
65
|
+
},
|
|
66
|
+
body = {
|
|
67
|
+
LayoutOrder = 1,
|
|
68
|
+
AutomaticSize = Enum.AutomaticSize.XY,
|
|
69
|
+
Size = UDim2.fromScale(0, 0),
|
|
70
|
+
BackgroundTransparency = 1,
|
|
71
|
+
BorderSizePixel = 0,
|
|
72
|
+
},
|
|
73
|
+
bodyPad = {
|
|
74
|
+
PaddingBottom = UDim.new(0, theme.padding.calc(2)),
|
|
75
|
+
},
|
|
76
|
+
bodyList = {
|
|
77
|
+
FillDirection = Enum.FillDirection.Vertical,
|
|
78
|
+
SortOrder = Enum.SortOrder.LayoutOrder,
|
|
79
|
+
Padding = UDim.new(0, theme.padding.calc(0.5)),
|
|
80
|
+
},
|
|
81
|
+
title = {
|
|
82
|
+
AutomaticSize = Enum.AutomaticSize.XY,
|
|
83
|
+
Size = UDim2.fromScale(0, 0),
|
|
84
|
+
BackgroundTransparency = 1,
|
|
85
|
+
BorderSizePixel = 0,
|
|
86
|
+
Font = theme.typography.fontFamilies.default,
|
|
87
|
+
TextSize = theme.typography.fontSizes.body,
|
|
88
|
+
TextColor3 = theme.palette.text.primary,
|
|
89
|
+
TextXAlignment = Enum.TextXAlignment.Left,
|
|
90
|
+
},
|
|
91
|
+
caption = {
|
|
92
|
+
AutomaticSize = Enum.AutomaticSize.XY,
|
|
93
|
+
Size = UDim2.fromScale(0, 0),
|
|
94
|
+
BackgroundTransparency = 1,
|
|
95
|
+
BorderSizePixel = 0,
|
|
96
|
+
Font = theme.typography.fontFamilies.default,
|
|
97
|
+
TextSize = theme.typography.fontSizes.caption,
|
|
98
|
+
TextColor3 = theme.palette.text.secondary,
|
|
99
|
+
TextXAlignment = Enum.TextXAlignment.Left,
|
|
100
|
+
},
|
|
101
|
+
})
|
|
102
|
+
end)
|
|
103
|
+
local default = useTimelineStyles
|
|
104
|
+
return {
|
|
105
|
+
default = default,
|
|
106
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export type TimelineTone = "done" | "active" | "pending" | "error";
|
|
2
|
+
export declare function timelineTone(tone?: string): TimelineTone;
|
|
3
|
+
/** Connector under an item. The last item, and a list shorter than two, has none. */
|
|
4
|
+
export declare function timelineRail(index: number, count: number): boolean;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local function timelineTone(tone)
|
|
3
|
+
if tone == "done" or tone == "active" or tone == "error" or tone == "pending" then
|
|
4
|
+
return tone
|
|
5
|
+
end
|
|
6
|
+
return "pending"
|
|
7
|
+
end
|
|
8
|
+
--* Connector under an item. The last item, and a list shorter than two, has none.
|
|
9
|
+
local function timelineRail(index, count)
|
|
10
|
+
return index >= 0 and count > 1 and index < count - 1
|
|
11
|
+
end
|
|
12
|
+
return {
|
|
13
|
+
timelineTone = timelineTone,
|
|
14
|
+
timelineRail = timelineRail,
|
|
15
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
local exports = {}
|
|
4
|
+
exports.Timeline = TS.import(script, script, "components", "Timeline").default
|
|
5
|
+
local _timelineRail = TS.import(script, script, "components", "timelineRail")
|
|
6
|
+
exports.timelineRail = _timelineRail.timelineRail
|
|
7
|
+
exports.timelineTone = _timelineRail.timelineTone
|
|
8
|
+
return exports
|
|
@@ -5,11 +5,15 @@ local _react = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
|
5
5
|
local React = _react
|
|
6
6
|
local useEffect = _react.useEffect
|
|
7
7
|
local useRef = _react.useRef
|
|
8
|
-
local
|
|
8
|
+
local TextService = TS.import(script, TS.getModule(script, "@rbxts", "services")).TextService
|
|
9
|
+
local _theme = TS.import(script, script.Parent.Parent.Parent.Parent.Parent, "theme")
|
|
10
|
+
local DEFAULT_THEME = _theme.DEFAULT_THEME
|
|
11
|
+
local useTheme = _theme.useTheme
|
|
9
12
|
local Directions = TS.import(script, script.Parent.Parent.Parent.Parent, "enums").Directions
|
|
10
13
|
local SxHost = TS.import(script, script.Parent.Parent.Parent, "host").SxHost
|
|
11
14
|
local Shadow = TS.import(script, script.Parent.Parent.Parent, "shadow").Shadow
|
|
12
15
|
local useToastStyles = TS.import(script, script.Parent, "Toast.styles").default
|
|
16
|
+
local toastWrap = TS.import(script, script.Parent, "toastPlace").toastWrap
|
|
13
17
|
local TWEEN_DURATION = 0.5
|
|
14
18
|
local function Toast(props)
|
|
15
19
|
local _binding = props
|
|
@@ -32,7 +36,47 @@ local function Toast(props)
|
|
|
32
36
|
local actionStyle = _binding_1.action
|
|
33
37
|
local activePosition = _binding_1.activePosition
|
|
34
38
|
local inActivePosition = _binding_1.inActivePosition
|
|
39
|
+
local _binding_2 = useTheme()
|
|
40
|
+
local theme = _binding_2.theme
|
|
35
41
|
local frameRef = useRef()
|
|
42
|
+
local font = theme.typography.fontFamilies.default or Enum.Font.SourceSans
|
|
43
|
+
local _condition = theme.typography.fontSizes.body
|
|
44
|
+
if _condition == nil then
|
|
45
|
+
_condition = 14
|
|
46
|
+
end
|
|
47
|
+
local textSize = _condition
|
|
48
|
+
local actionSlot = if action ~= nil and #action > 0 then theme.spacing.calc(8) else 0
|
|
49
|
+
local box = theme.spacing.calc(20) - theme.padding.calc(4) - actionSlot
|
|
50
|
+
local bounds = TextService:GetTextSize(text, textSize, font, Vector2.new(10000, 100))
|
|
51
|
+
local wrap = toastWrap(bounds.X, box)
|
|
52
|
+
local pad = theme.padding.calc(2)
|
|
53
|
+
local _result
|
|
54
|
+
if wrap then
|
|
55
|
+
local _object = table.clone(container)
|
|
56
|
+
setmetatable(_object, nil)
|
|
57
|
+
_object.AutomaticSize = Enum.AutomaticSize.Y
|
|
58
|
+
_result = _object
|
|
59
|
+
else
|
|
60
|
+
_result = container
|
|
61
|
+
end
|
|
62
|
+
local boxStyle = _result
|
|
63
|
+
local _result_1
|
|
64
|
+
if wrap then
|
|
65
|
+
local _object = table.clone(label)
|
|
66
|
+
setmetatable(_object, nil)
|
|
67
|
+
_object.TextWrapped = true
|
|
68
|
+
_object.TextTruncate = Enum.TextTruncate.None
|
|
69
|
+
_object.AutomaticSize = Enum.AutomaticSize.Y
|
|
70
|
+
_object.Size = UDim2.new(1, -(theme.padding.calc(4) + actionSlot), 0, 0)
|
|
71
|
+
_object.AnchorPoint = Vector2.new(0, 0)
|
|
72
|
+
_object.Position = UDim2.new(0, pad, 0, pad)
|
|
73
|
+
_object.TextXAlignment = Enum.TextXAlignment.Left
|
|
74
|
+
_object.TextYAlignment = Enum.TextYAlignment.Top
|
|
75
|
+
_result_1 = _object
|
|
76
|
+
else
|
|
77
|
+
_result_1 = label
|
|
78
|
+
end
|
|
79
|
+
local labelStyle = _result_1
|
|
36
80
|
local tween = function(direction)
|
|
37
81
|
local frame = frameRef.current
|
|
38
82
|
if not frame then
|
|
@@ -64,11 +108,11 @@ local function Toast(props)
|
|
|
64
108
|
local _attributes = {
|
|
65
109
|
tag = "frame",
|
|
66
110
|
}
|
|
67
|
-
local
|
|
68
|
-
if not (
|
|
69
|
-
|
|
111
|
+
local _condition_1 = id
|
|
112
|
+
if not (_condition_1 ~= 0 and _condition_1 == _condition_1 and _condition_1 ~= "" and _condition_1) then
|
|
113
|
+
_condition_1 = "Toast"
|
|
70
114
|
end
|
|
71
|
-
_attributes.key =
|
|
115
|
+
_attributes.key = _condition_1
|
|
72
116
|
_attributes.hostRef = function(instance)
|
|
73
117
|
frameRef.current = instance
|
|
74
118
|
if ref == nil then
|
|
@@ -80,7 +124,7 @@ local function Toast(props)
|
|
|
80
124
|
end
|
|
81
125
|
ref.current = instance
|
|
82
126
|
end
|
|
83
|
-
_attributes.base =
|
|
127
|
+
_attributes.base = boxStyle
|
|
84
128
|
_attributes.className = className
|
|
85
129
|
_attributes.sx = sx
|
|
86
130
|
local _exp = React.createElement("uicorner", {
|
|
@@ -88,16 +132,19 @@ local function Toast(props)
|
|
|
88
132
|
CornerRadius = UDim.new(0, DEFAULT_THEME.shape.borderRadius),
|
|
89
133
|
})
|
|
90
134
|
local _exp_1 = React.createElement(Shadow)
|
|
135
|
+
local _exp_2 = wrap and React.createElement("uipadding", {
|
|
136
|
+
PaddingBottom = UDim.new(0, pad),
|
|
137
|
+
})
|
|
91
138
|
local _attributes_1 = {
|
|
92
139
|
key = "Label",
|
|
93
140
|
}
|
|
94
|
-
for _k, _v in
|
|
141
|
+
for _k, _v in labelStyle do
|
|
95
142
|
_attributes_1[_k] = _v
|
|
96
143
|
end
|
|
97
144
|
_attributes_1.Text = text
|
|
98
|
-
local
|
|
99
|
-
local
|
|
100
|
-
if
|
|
145
|
+
local _exp_3 = React.createElement("textlabel", _attributes_1)
|
|
146
|
+
local _condition_2 = action ~= nil and #action > 0
|
|
147
|
+
if _condition_2 then
|
|
101
148
|
local _attributes_2 = {
|
|
102
149
|
key = "Action",
|
|
103
150
|
}
|
|
@@ -116,7 +163,7 @@ local function Toast(props)
|
|
|
116
163
|
end
|
|
117
164
|
end,
|
|
118
165
|
}
|
|
119
|
-
|
|
166
|
+
_condition_2 = (React.createElement("textbutton", _attributes_2))
|
|
120
167
|
end
|
|
121
168
|
local _attributes_2 = {
|
|
122
169
|
key = "Close",
|
|
@@ -132,7 +179,7 @@ local function Toast(props)
|
|
|
132
179
|
end
|
|
133
180
|
end,
|
|
134
181
|
}
|
|
135
|
-
return React.createElement(SxHost, _attributes, _exp, _exp_1, _exp_2,
|
|
182
|
+
return React.createElement(SxHost, _attributes, _exp, _exp_1, _exp_2, _exp_3, _condition_2, React.createElement("imagebutton", _attributes_2))
|
|
136
183
|
end
|
|
137
184
|
local default = Toast
|
|
138
185
|
return {
|
|
@@ -6,12 +6,14 @@ local componentStyles = _theme.componentStyles
|
|
|
6
6
|
local DEFAULT_THEME = _theme.DEFAULT_THEME
|
|
7
7
|
local Icons = TS.import(script, script.Parent.Parent.Parent.Parent, "enums").Icons
|
|
8
8
|
local ToastVariants = TS.import(script, script.Parent.Parent, "enums", "ToastVariants").default
|
|
9
|
+
local toastPlace = TS.import(script, script.Parent, "toastPlace").toastPlace
|
|
9
10
|
local useToastStyles = componentStyles("Toast", function(theme, _param)
|
|
10
11
|
local variant = _param.variant
|
|
11
12
|
if variant == nil then
|
|
12
13
|
variant = ToastVariants.default
|
|
13
14
|
end
|
|
14
15
|
local action = _param.action
|
|
16
|
+
local edge = _param.edge
|
|
15
17
|
local getToastColors = function()
|
|
16
18
|
repeat
|
|
17
19
|
if variant == (ToastVariants.success) then
|
|
@@ -41,14 +43,15 @@ local useToastStyles = componentStyles("Toast", function(theme, _param)
|
|
|
41
43
|
local toastColors = getToastColors()
|
|
42
44
|
local hasAction = action ~= nil and #action > 0
|
|
43
45
|
local actionSlot = if hasAction then theme.spacing.calc(8) else 0
|
|
44
|
-
local
|
|
45
|
-
local
|
|
46
|
+
local place = toastPlace(edge, DEFAULT_THEME.padding.calc(2), DEFAULT_THEME.spacing.calc(20) + DEFAULT_THEME.padding.calc(2))
|
|
47
|
+
local ACTIVE_POSITION = UDim2.new(0.5, 0, place.activeY, place.activeOffset)
|
|
48
|
+
local INACTIVE_POSITION = UDim2.new(0.5, 0, place.idleY, place.idleOffset)
|
|
46
49
|
return createStyles({
|
|
47
50
|
container = {
|
|
48
51
|
Size = UDim2.new(0, theme.spacing.calc(20), 0, theme.spacing.calc(4)),
|
|
49
52
|
Position = ACTIVE_POSITION,
|
|
50
53
|
BackgroundColor3 = toastColors.background,
|
|
51
|
-
AnchorPoint = Vector2.new(0.5,
|
|
54
|
+
AnchorPoint = Vector2.new(0.5, place.anchorY),
|
|
52
55
|
BorderSizePixel = 0,
|
|
53
56
|
ZIndex = 50000,
|
|
54
57
|
},
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type ToastEdge = "top" | "bottom";
|
|
2
|
+
export interface ToastPlace {
|
|
3
|
+
anchorY: number;
|
|
4
|
+
activeY: number;
|
|
5
|
+
activeOffset: number;
|
|
6
|
+
idleY: number;
|
|
7
|
+
idleOffset: number;
|
|
8
|
+
}
|
|
9
|
+
/** Bottom stays the default. Top sits on the upper edge and hides above the frame. */
|
|
10
|
+
export declare function toastPlace(edge: ToastEdge | undefined, inset: number, hidden: number): ToastPlace;
|
|
11
|
+
/** A line wider than the toast wraps. A short line stays one row. */
|
|
12
|
+
export declare function toastWrap(textWidth: number, box: number): boolean;
|