@rbxts/uiblox 0.2.0-alpha.36 → 0.2.0-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +109 -27
- package/out/hooks/index.d.ts +0 -1
- package/out/hooks/init.luau +0 -3
- package/out/hooks/useBreakpoints.luau +11 -2
- package/out/theme/interfaces/theme/Theme.d.ts +0 -15
- package/out/theme/styles/utilities/componentStyles.luau +3 -45
- package/out/theme/styles/utilities/componentTheme.d.ts +0 -15
- package/out/theme/styles/utilities/index.d.ts +0 -2
- package/out/theme/styles/utilities/init.luau +0 -7
- package/out/theme/styles/utilities/resolveStyle.d.ts +2 -10
- package/out/theme/styles/utilities/resolveStyle.luau +3 -7
- package/out/theme/styles/utilities/styleCache.d.ts +0 -2
- package/out/theme/styles/utilities/styleCache.luau +0 -9
- package/out/theme/types/types.d.ts +1 -2
- package/out/ui/packages/accordion/components/Accordion.d.ts +0 -2
- package/out/ui/packages/accordion/components/Accordion.luau +30 -46
- package/out/ui/packages/accordion/components/Accordion.styles.d.ts +0 -1
- package/out/ui/packages/accordion/components/Accordion.styles.luau +4 -16
- package/out/ui/packages/accordion/components/accordionOpen.d.ts +0 -1
- package/out/ui/packages/accordion/components/accordionOpen.luau +0 -4
- package/out/ui/packages/alert/components/Alert.d.ts +0 -2
- package/out/ui/packages/alert/components/Alert.luau +42 -48
- package/out/ui/packages/alert/components/Alert.styles.d.ts +0 -2
- package/out/ui/packages/alert/components/Alert.styles.luau +8 -17
- package/out/ui/packages/appBar/components/AppBar.d.ts +1 -2
- package/out/ui/packages/appBar/components/AppBar.luau +36 -47
- package/out/ui/packages/appBar/components/AppBar.styles.d.ts +0 -2
- package/out/ui/packages/appBar/components/AppBar.styles.luau +5 -16
- package/out/ui/packages/assetField/components/AssetField.luau +16 -12
- package/out/ui/packages/avatar/components/Avatar.d.ts +0 -2
- package/out/ui/packages/avatar/components/Avatar.luau +26 -27
- package/out/ui/packages/avatar/components/Avatar.styles.d.ts +0 -2
- package/out/ui/packages/avatar/components/Avatar.styles.luau +1 -5
- package/out/ui/packages/badge/components/Badge.d.ts +0 -3
- package/out/ui/packages/badge/components/Badge.luau +24 -32
- package/out/ui/packages/badge/components/Badge.styles.d.ts +1 -5
- package/out/ui/packages/badge/components/Badge.styles.luau +8 -20
- package/out/ui/packages/bottomNavigation/components/BottomNavigation.d.ts +0 -1
- package/out/ui/packages/bottomNavigation/components/BottomNavigation.luau +18 -20
- package/out/ui/packages/bottomNavigation/components/BottomNavigation.styles.d.ts +1 -3
- package/out/ui/packages/bottomNavigation/components/BottomNavigation.styles.luau +2 -6
- package/out/ui/packages/breadcrumbs/components/Breadcrumbs.d.ts +0 -1
- package/out/ui/packages/breadcrumbs/components/Breadcrumbs.luau +40 -67
- package/out/ui/packages/breadcrumbs/components/breadcrumbItems.d.ts +0 -9
- package/out/ui/packages/breadcrumbs/components/breadcrumbItems.luau +0 -68
- package/out/ui/packages/breadcrumbs/index.d.ts +0 -1
- package/out/ui/packages/breadcrumbs/init.luau +0 -3
- package/out/ui/packages/brickColorPicker/components/BrickColorPicker.luau +16 -12
- package/out/ui/packages/button/components/Button.luau +18 -20
- package/out/ui/packages/card/components/Card.d.ts +1 -3
- package/out/ui/packages/card/components/Card.luau +0 -10
- package/out/ui/packages/cframeEditor/components/CFrameEditor.luau +53 -75
- package/out/ui/packages/cframeEditor/components/CFrameEditor.styles.luau +9 -26
- package/out/ui/packages/checkbox/components/Checkbox.luau +16 -16
- package/out/ui/packages/checkbox/components/checkboxLook.d.ts +1 -1
- package/out/ui/packages/chip/components/Chip.d.ts +1 -5
- package/out/ui/packages/chip/components/Chip.luau +16 -25
- package/out/ui/packages/chip/components/Chip.styles.d.ts +0 -5
- package/out/ui/packages/chip/components/Chip.styles.luau +13 -30
- package/out/ui/packages/circularProgress/components/CircularProgress.luau +18 -29
- package/out/ui/packages/colorPicker/components/ColorPicker.luau +20 -16
- package/out/ui/packages/colorPicker/components/ColorPicker.styles.luau +20 -34
- package/out/ui/packages/colorPicker/components/ColorSequenceEditor.luau +35 -34
- package/out/ui/packages/colorPicker/components/NumberSequenceEditor.luau +62 -65
- package/out/ui/packages/dialog/components/Dialog.d.ts +2 -3
- package/out/ui/packages/dialog/components/Dialog.luau +21 -41
- package/out/ui/packages/divider/components/Divider.d.ts +0 -1
- package/out/ui/packages/divider/components/Divider.luau +17 -52
- package/out/ui/packages/divider/components/Divider.styles.luau +0 -32
- package/out/ui/packages/drawer/components/Drawer.d.ts +1 -3
- package/out/ui/packages/drawer/components/Drawer.luau +37 -71
- package/out/ui/packages/drawer/components/Drawer.styles.d.ts +1 -3
- package/out/ui/packages/drawer/components/Drawer.styles.luau +2 -3
- package/out/ui/packages/fab/components/Fab.d.ts +0 -3
- package/out/ui/packages/fab/components/Fab.luau +37 -79
- package/out/ui/packages/fab/components/Fab.styles.d.ts +0 -3
- package/out/ui/packages/fab/components/Fab.styles.luau +3 -39
- package/out/ui/packages/fab/components/fabSize.d.ts +0 -1
- package/out/ui/packages/fab/components/fabSize.luau +0 -4
- package/out/ui/packages/fab/index.d.ts +1 -1
- package/out/ui/packages/fab/init.luau +0 -1
- package/out/ui/packages/fontEditor/components/FontEditor.luau +16 -12
- package/out/ui/packages/formText/components/FormHelperText.luau +16 -12
- package/out/ui/packages/formText/components/FormLabel.luau +16 -12
- package/out/ui/packages/gradientEditor/components/GradientEditor.luau +42 -56
- package/out/ui/packages/gradientEditor/components/GradientEditor.styles.luau +4 -37
- package/out/ui/packages/icon/components/Icon.luau +16 -9
- package/out/ui/packages/iconButton/components/IconButton.luau +16 -16
- package/out/ui/packages/index.d.ts +0 -6
- package/out/ui/packages/init.luau +0 -18
- package/out/ui/packages/input/components/Input.d.ts +0 -1
- package/out/ui/packages/input/components/Input.luau +18 -21
- package/out/ui/packages/layout/components/Grid.d.ts +1 -5
- package/out/ui/packages/layout/components/Grid.luau +19 -41
- package/out/ui/packages/layout/components/List.luau +16 -9
- package/out/ui/packages/layout/components/Stack.d.ts +0 -2
- package/out/ui/packages/layout/components/Stack.luau +15 -10
- package/out/ui/packages/layout/components/Stack.styles.d.ts +0 -2
- package/out/ui/packages/layout/components/Stack.styles.luau +5 -34
- package/out/ui/packages/layout/components/stackAlign.d.ts +2 -4
- package/out/ui/packages/layout/components/stackAlign.luau +2 -16
- package/out/ui/packages/layout/index.d.ts +0 -11
- package/out/ui/packages/layout/init.luau +0 -4
- package/out/ui/packages/link/components/Link.luau +16 -13
- package/out/ui/packages/listItem/components/ListItem.d.ts +1 -4
- package/out/ui/packages/listItem/components/ListItem.luau +4 -44
- package/out/ui/packages/listItem/components/ListItem.styles.d.ts +0 -1
- package/out/ui/packages/listItem/components/ListItem.styles.luau +5 -16
- package/out/ui/packages/loadingStroke/components/LoadingStroke.d.ts +1 -5
- package/out/ui/packages/menu/components/Menu.d.ts +1 -4
- package/out/ui/packages/menu/components/Menu.luau +15 -32
- package/out/ui/packages/modal/components/Modal.d.ts +1 -2
- package/out/ui/packages/modal/components/Modal.luau +37 -79
- package/out/ui/packages/motion/index.d.ts +1 -1
- package/out/ui/packages/motion/init.luau +0 -1
- package/out/ui/packages/motion/unit.d.ts +0 -5
- package/out/ui/packages/motion/unit.luau +0 -23
- package/out/ui/packages/numberInput/components/NumberInput.d.ts +0 -2
- package/out/ui/packages/numberInput/components/NumberInput.luau +3 -16
- package/out/ui/packages/numberInput/components/numberValue.d.ts +0 -1
- package/out/ui/packages/numberInput/components/numberValue.luau +0 -45
- package/out/ui/packages/numberRangeEditor/components/NumberRangeEditor.luau +16 -12
- package/out/ui/packages/pagination/components/Pagination.d.ts +1 -6
- package/out/ui/packages/pagination/components/Pagination.luau +38 -62
- package/out/ui/packages/pagination/components/Pagination.styles.d.ts +1 -6
- package/out/ui/packages/pagination/components/Pagination.styles.luau +4 -36
- package/out/ui/packages/pagination/components/pageRange.d.ts +1 -2
- package/out/ui/packages/pagination/components/pageRange.luau +8 -91
- package/out/ui/packages/pagination/index.d.ts +0 -1
- package/out/ui/packages/pagination/init.luau +0 -1
- package/out/ui/packages/paper/components/Paper.d.ts +2 -4
- package/out/ui/packages/paper/components/Paper.luau +9 -31
- package/out/ui/packages/paper/components/Paper.styles.d.ts +1 -1
- package/out/ui/packages/paper/components/Paper.styles.luau +0 -6
- package/out/ui/packages/physicalPropertiesEditor/components/PhysicalPropertiesEditor.luau +38 -63
- package/out/ui/packages/physicalPropertiesEditor/components/PhysicalPropertiesEditor.styles.luau +7 -21
- package/out/ui/packages/physicalPropertiesEditor/components/physicalParts.d.ts +0 -2
- package/out/ui/packages/physicalPropertiesEditor/components/physicalParts.luau +0 -14
- package/out/ui/packages/popup/components/Popup.d.ts +1 -2
- package/out/ui/packages/popup/components/Popup.luau +18 -35
- package/out/ui/packages/popup/index.d.ts +0 -1
- package/out/ui/packages/popup/init.luau +0 -1
- package/out/ui/packages/preloader/components/Preloader.luau +16 -9
- package/out/ui/packages/progressBar/components/ProgressBar.luau +16 -12
- package/out/ui/packages/radioGroup/components/RadioGroup.d.ts +0 -1
- package/out/ui/packages/radioGroup/components/RadioGroup.luau +18 -16
- package/out/ui/packages/radioGroup/components/RadioGroup.styles.d.ts +0 -1
- package/out/ui/packages/radioGroup/components/RadioGroup.styles.luau +1 -4
- package/out/ui/packages/rating/components/Rating.d.ts +1 -3
- package/out/ui/packages/rating/components/Rating.luau +17 -19
- package/out/ui/packages/rating/components/Rating.styles.d.ts +0 -2
- package/out/ui/packages/rating/components/Rating.styles.luau +2 -7
- package/out/ui/packages/rayEditor/components/RayEditor.luau +16 -12
- package/out/ui/packages/rectEditor/components/RectEditor.luau +43 -86
- package/out/ui/packages/rectEditor/components/RectEditor.styles.luau +7 -30
- package/out/ui/packages/scroll/index.d.ts +0 -2
- package/out/ui/packages/scroll/init.luau +0 -1
- package/out/ui/packages/select/components/Select.luau +55 -15
- package/out/ui/packages/select/components/selectMotion.d.ts +2 -0
- package/out/ui/packages/select/components/selectMotion.luau +12 -0
- package/out/ui/packages/shadow/components/Shadow.d.ts +1 -2
- package/out/ui/packages/shadow/components/Shadow.luau +17 -39
- package/out/ui/packages/shadow/components/Shadow.styles.luau +2 -7
- package/out/ui/packages/sidebar/components/Sidebar.luau +16 -9
- package/out/ui/packages/skeleton/components/Skeleton.luau +28 -19
- package/out/ui/packages/skeleton/components/Skeleton.styles.luau +3 -7
- package/out/ui/packages/slider/components/Slider.d.ts +0 -3
- package/out/ui/packages/slider/components/Slider.luau +19 -47
- package/out/ui/packages/slider/components/Slider.styles.d.ts +0 -2
- package/out/ui/packages/slider/components/Slider.styles.luau +1 -14
- package/out/ui/packages/snackbar/components/Snackbar.d.ts +0 -2
- package/out/ui/packages/snackbar/components/Snackbar.luau +0 -5
- package/out/ui/packages/speedDial/components/SpeedDial.d.ts +0 -2
- package/out/ui/packages/speedDial/components/SpeedDial.luau +20 -25
- package/out/ui/packages/speedDial/components/SpeedDial.styles.d.ts +1 -4
- package/out/ui/packages/speedDial/components/SpeedDial.styles.luau +4 -9
- package/out/ui/packages/speedDial/index.d.ts +0 -1
- package/out/ui/packages/splitPane/components/SplitPane.luau +17 -13
- package/out/ui/packages/splitPane/components/splitLook.d.ts +1 -1
- package/out/ui/packages/stateMatrix.d.ts +0 -2
- package/out/ui/packages/stateMatrix.luau +997 -793
- package/out/ui/packages/stepper/components/Stepper.d.ts +0 -1
- package/out/ui/packages/stepper/components/Stepper.luau +17 -16
- package/out/ui/packages/stepper/components/Stepper.styles.d.ts +1 -3
- package/out/ui/packages/stepper/components/Stepper.styles.luau +2 -6
- package/out/ui/packages/switch/components/Switch.d.ts +0 -2
- package/out/ui/packages/switch/components/Switch.luau +16 -21
- package/out/ui/packages/switch/components/Switch.styles.d.ts +0 -2
- package/out/ui/packages/switch/components/Switch.styles.luau +1 -6
- package/out/ui/packages/switch/components/switchLook.d.ts +1 -1
- package/out/ui/packages/table/components/Table.d.ts +2 -16
- package/out/ui/packages/table/components/Table.luau +53 -136
- package/out/ui/packages/table/components/Table.styles.d.ts +1 -3
- package/out/ui/packages/table/components/Table.styles.luau +6 -10
- package/out/ui/packages/table/index.d.ts +1 -2
- package/out/ui/packages/tabs/components/Tabs.d.ts +0 -3
- package/out/ui/packages/tabs/components/Tabs.luau +19 -24
- package/out/ui/packages/tabs/components/Tabs.styles.d.ts +1 -5
- package/out/ui/packages/tabs/components/Tabs.styles.luau +10 -26
- package/out/ui/packages/tabs/index.d.ts +0 -1
- package/out/ui/packages/tabs/init.luau +0 -1
- package/out/ui/packages/toast/components/Toast.d.ts +0 -2
- package/out/ui/packages/toast/components/Toast.luau +13 -41
- package/out/ui/packages/toast/components/Toast.styles.luau +5 -23
- package/out/ui/packages/toggleButton/components/ToggleButton.d.ts +1 -5
- package/out/ui/packages/toggleButton/components/ToggleButton.luau +33 -36
- package/out/ui/packages/toggleButton/components/ToggleButton.styles.d.ts +0 -4
- package/out/ui/packages/toggleButton/components/ToggleButton.styles.luau +5 -16
- package/out/ui/packages/tooltip/components/Tooltip.luau +16 -9
- package/out/ui/packages/treeView/components/TreeView.luau +16 -9
- package/out/ui/packages/typography/components/Typography.luau +14 -13
- package/out/ui/packages/udimEditor/components/UDimEditor.luau +16 -12
- package/out/ui/packages/vectorEditor/components/VectorEditor.luau +16 -12
- package/out/ui/packages/virtualList/components/EmptyListHint.d.ts +1 -2
- package/out/ui/packages/virtualList/components/EmptyListHint.luau +4 -15
- package/out/ui/packages/virtualList/components/VirtualList.luau +16 -9
- package/package.json +2 -2
- package/out/hooks/viewportObserver.d.ts +0 -10
- package/out/hooks/viewportObserver.luau +0 -75
- package/out/theme/styles/utilities/resolveSx.d.ts +0 -120
- package/out/theme/styles/utilities/resolveSx.luau +0 -524
- package/out/ui/packages/backdrop/components/Backdrop.d.ts +0 -10
- package/out/ui/packages/backdrop/components/Backdrop.luau +0 -51
- package/out/ui/packages/backdrop/components/Backdrop.styles.d.ts +0 -4
- package/out/ui/packages/backdrop/components/Backdrop.styles.luau +0 -24
- package/out/ui/packages/backdrop/index.d.ts +0 -2
- package/out/ui/packages/backdrop/init.luau +0 -5
- package/out/ui/packages/dateRange/components/DateRangePicker.d.ts +0 -11
- package/out/ui/packages/dateRange/components/DateRangePicker.luau +0 -253
- package/out/ui/packages/dateRange/dateRangeValue.d.ts +0 -18
- package/out/ui/packages/dateRange/dateRangeValue.luau +0 -121
- package/out/ui/packages/dateRange/index.d.ts +0 -3
- package/out/ui/packages/dateRange/init.luau +0 -16
- package/out/ui/packages/divider/components/dividerLabel.d.ts +0 -1
- package/out/ui/packages/divider/components/dividerLabel.luau +0 -10
- package/out/ui/packages/host/components/SxHost.d.ts +0 -18
- package/out/ui/packages/host/components/SxHost.luau +0 -210
- package/out/ui/packages/host/hostPaint.d.ts +0 -12
- package/out/ui/packages/host/hostPaint.luau +0 -34
- package/out/ui/packages/host/hostRules.d.ts +0 -15
- package/out/ui/packages/host/hostRules.luau +0 -92
- package/out/ui/packages/host/index.d.ts +0 -3
- package/out/ui/packages/host/init.luau +0 -13
- package/out/ui/packages/imageList/components/ImageList.d.ts +0 -14
- package/out/ui/packages/imageList/components/ImageList.luau +0 -93
- package/out/ui/packages/imageList/components/ImageList.styles.d.ts +0 -6
- package/out/ui/packages/imageList/components/ImageList.styles.luau +0 -73
- package/out/ui/packages/imageList/components/imageListLayout.d.ts +0 -4
- package/out/ui/packages/imageList/components/imageListLayout.luau +0 -31
- package/out/ui/packages/imageList/index.d.ts +0 -2
- package/out/ui/packages/imageList/init.luau +0 -5
- package/out/ui/packages/layout/components/Box.d.ts +0 -11
- package/out/ui/packages/layout/components/Box.luau +0 -40
- package/out/ui/packages/layout/components/Box.styles.d.ts +0 -7
- package/out/ui/packages/layout/components/Box.styles.luau +0 -34
- package/out/ui/packages/layout/components/Container.d.ts +0 -10
- package/out/ui/packages/layout/components/Container.luau +0 -45
- package/out/ui/packages/layout/components/Container.styles.d.ts +0 -6
- package/out/ui/packages/layout/components/Container.styles.luau +0 -41
- package/out/ui/packages/layout/components/FlexItem.d.ts +0 -12
- package/out/ui/packages/layout/components/FlexItem.luau +0 -40
- package/out/ui/packages/layout/components/FlexItem.styles.d.ts +0 -8
- package/out/ui/packages/layout/components/FlexItem.styles.luau +0 -66
- package/out/ui/packages/layout/components/boxPad.d.ts +0 -14
- package/out/ui/packages/layout/components/boxPad.luau +0 -59
- package/out/ui/packages/layout/components/containerWidth.d.ts +0 -2
- package/out/ui/packages/layout/components/containerWidth.luau +0 -17
- package/out/ui/packages/layout/components/flexItemMode.d.ts +0 -6
- package/out/ui/packages/layout/components/flexItemMode.luau +0 -36
- package/out/ui/packages/layout/components/gridProps.d.ts +0 -3
- package/out/ui/packages/layout/components/gridProps.luau +0 -20
- package/out/ui/packages/loadingStroke/components/loadingStrokeSx.d.ts +0 -11
- package/out/ui/packages/loadingStroke/components/loadingStrokeSx.luau +0 -2
- package/out/ui/packages/markdown/components/Markdown.d.ts +0 -6
- package/out/ui/packages/markdown/components/Markdown.luau +0 -221
- package/out/ui/packages/markdown/components/Markdown.styles.d.ts +0 -2
- package/out/ui/packages/markdown/components/Markdown.styles.luau +0 -101
- package/out/ui/packages/markdown/components/MarkdownEditor.d.ts +0 -22
- package/out/ui/packages/markdown/components/MarkdownEditor.luau +0 -433
- package/out/ui/packages/markdown/components/MarkdownEditor.styles.d.ts +0 -6
- package/out/ui/packages/markdown/components/MarkdownEditor.styles.luau +0 -161
- package/out/ui/packages/markdown/components/markdownEditorHeight.d.ts +0 -1
- package/out/ui/packages/markdown/components/markdownEditorHeight.luau +0 -13
- package/out/ui/packages/markdown/htmlToMarkdown.d.ts +0 -2
- package/out/ui/packages/markdown/htmlToMarkdown.luau +0 -350
- package/out/ui/packages/markdown/index.d.ts +0 -8
- package/out/ui/packages/markdown/init.luau +0 -11
- package/out/ui/packages/markdown/parseMarkdown.d.ts +0 -42
- package/out/ui/packages/markdown/parseMarkdown.luau +0 -459
- package/out/ui/packages/reorder/index.d.ts +0 -2
- package/out/ui/packages/reorder/init.luau +0 -14
- package/out/ui/packages/reorder/reorder.d.ts +0 -24
- package/out/ui/packages/reorder/reorder.luau +0 -178
- package/out/ui/packages/reorder/useReorderDrag.d.ts +0 -15
- package/out/ui/packages/reorder/useReorderDrag.luau +0 -129
- package/out/ui/packages/scroll/components/ScrollView.d.ts +0 -7
- package/out/ui/packages/scroll/components/ScrollView.luau +0 -42
- package/out/ui/packages/skeleton/components/skeletonTone.d.ts +0 -20
- package/out/ui/packages/skeleton/components/skeletonTone.luau +0 -14
- package/out/ui/packages/slider/components/sliderMarks.d.ts +0 -1
- package/out/ui/packages/slider/components/sliderMarks.luau +0 -37
- package/out/ui/packages/snackbar/components/snackbarAction.d.ts +0 -1
- package/out/ui/packages/snackbar/components/snackbarAction.luau +0 -10
- package/out/ui/packages/sparkline/components/Sparkline.d.ts +0 -9
- package/out/ui/packages/sparkline/components/Sparkline.luau +0 -66
- package/out/ui/packages/sparkline/index.d.ts +0 -3
- package/out/ui/packages/sparkline/init.luau +0 -6
- package/out/ui/packages/sparkline/sparklineLayout.d.ts +0 -8
- package/out/ui/packages/sparkline/sparklineLayout.luau +0 -75
- package/out/ui/packages/table/components/tableColumns.d.ts +0 -26
- package/out/ui/packages/table/components/tableColumns.luau +0 -92
- package/out/ui/packages/tabs/components/tabsOrientation.d.ts +0 -2
- package/out/ui/packages/tabs/components/tabsOrientation.luau +0 -7
|
@@ -1,253 +0,0 @@
|
|
|
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 SxHost = TS.import(script, script.Parent.Parent.Parent, "host").SxHost
|
|
6
|
-
local _dateRangeValue = TS.import(script, script.Parent.Parent, "dateRangeValue")
|
|
7
|
-
local dateStamp = _dateRangeValue.dateStamp
|
|
8
|
-
local daysInMonth = _dateRangeValue.daysInMonth
|
|
9
|
-
local formatStamp = _dateRangeValue.formatStamp
|
|
10
|
-
local orderSpan = _dateRangeValue.orderSpan
|
|
11
|
-
local shiftMonth = _dateRangeValue.shiftMonth
|
|
12
|
-
local weekday = _dateRangeValue.weekday
|
|
13
|
-
local MONTHS = { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" }
|
|
14
|
-
local WEEKDAYS = { "S", "M", "T", "W", "T", "F", "S" }
|
|
15
|
-
local function covers(stamp, value)
|
|
16
|
-
if value.start == nil then
|
|
17
|
-
return false
|
|
18
|
-
end
|
|
19
|
-
if value.finish == nil then
|
|
20
|
-
return stamp == value.start
|
|
21
|
-
end
|
|
22
|
-
local first = math.min(value.start, value.finish)
|
|
23
|
-
local last = math.max(value.start, value.finish)
|
|
24
|
-
return stamp >= first and stamp <= last
|
|
25
|
-
end
|
|
26
|
-
local function DateRangePicker(props)
|
|
27
|
-
local _binding = props
|
|
28
|
-
local year = _binding.year
|
|
29
|
-
local month = _binding.month
|
|
30
|
-
local value = _binding.value
|
|
31
|
-
local onChange = _binding.onChange
|
|
32
|
-
local onMonthChange = _binding.onMonthChange
|
|
33
|
-
local className = _binding.className
|
|
34
|
-
local sx = _binding.sx
|
|
35
|
-
local id = _binding.id
|
|
36
|
-
local ref = _binding.ref
|
|
37
|
-
local _binding_1 = useTheme()
|
|
38
|
-
local theme = _binding_1.theme
|
|
39
|
-
local lead = weekday(year, month, 1)
|
|
40
|
-
local count = daysInMonth(year, month)
|
|
41
|
-
local cells = {}
|
|
42
|
-
do
|
|
43
|
-
local index = 0
|
|
44
|
-
local _shouldIncrement = false
|
|
45
|
-
while true do
|
|
46
|
-
if _shouldIncrement then
|
|
47
|
-
index += 1
|
|
48
|
-
else
|
|
49
|
-
_shouldIncrement = true
|
|
50
|
-
end
|
|
51
|
-
if not (index < lead) then
|
|
52
|
-
break
|
|
53
|
-
end
|
|
54
|
-
local _arg0 = {
|
|
55
|
-
order = index,
|
|
56
|
-
}
|
|
57
|
-
table.insert(cells, _arg0)
|
|
58
|
-
end
|
|
59
|
-
end
|
|
60
|
-
do
|
|
61
|
-
local day = 1
|
|
62
|
-
local _shouldIncrement = false
|
|
63
|
-
while true do
|
|
64
|
-
if _shouldIncrement then
|
|
65
|
-
day += 1
|
|
66
|
-
else
|
|
67
|
-
_shouldIncrement = true
|
|
68
|
-
end
|
|
69
|
-
if not (day <= count) then
|
|
70
|
-
break
|
|
71
|
-
end
|
|
72
|
-
local _arg0 = {
|
|
73
|
-
day = day,
|
|
74
|
-
stamp = dateStamp(year, month, day),
|
|
75
|
-
order = lead + day - 1,
|
|
76
|
-
}
|
|
77
|
-
table.insert(cells, _arg0)
|
|
78
|
-
end
|
|
79
|
-
end
|
|
80
|
-
local pick = function(stamp)
|
|
81
|
-
if value.start == nil or value.finish ~= nil then
|
|
82
|
-
onChange({
|
|
83
|
-
start = stamp,
|
|
84
|
-
})
|
|
85
|
-
else
|
|
86
|
-
onChange(orderSpan(value.start, stamp))
|
|
87
|
-
end
|
|
88
|
-
end
|
|
89
|
-
local move = function(delta)
|
|
90
|
-
local shifted = shiftMonth(year, month, delta)
|
|
91
|
-
onMonthChange(shifted.year, shifted.month)
|
|
92
|
-
end
|
|
93
|
-
local _attributes = {
|
|
94
|
-
tag = "frame",
|
|
95
|
-
}
|
|
96
|
-
local _condition = id
|
|
97
|
-
if not (_condition ~= 0 and _condition == _condition and _condition ~= "" and _condition) then
|
|
98
|
-
_condition = "DateRangePicker"
|
|
99
|
-
end
|
|
100
|
-
_attributes.key = _condition
|
|
101
|
-
_attributes.hostRef = ref
|
|
102
|
-
_attributes.base = {
|
|
103
|
-
Size = UDim2.new(1, 0, 0, 0),
|
|
104
|
-
AutomaticSize = Enum.AutomaticSize.Y,
|
|
105
|
-
BackgroundColor3 = theme.palette.surface.paper,
|
|
106
|
-
BorderSizePixel = 0,
|
|
107
|
-
}
|
|
108
|
-
_attributes.className = className
|
|
109
|
-
_attributes.sx = sx
|
|
110
|
-
local _exp = React.createElement("uipadding", {
|
|
111
|
-
PaddingTop = UDim.new(0, 8),
|
|
112
|
-
PaddingBottom = UDim.new(0, 8),
|
|
113
|
-
PaddingLeft = UDim.new(0, 8),
|
|
114
|
-
PaddingRight = UDim.new(0, 8),
|
|
115
|
-
})
|
|
116
|
-
local _exp_1 = React.createElement("uilistlayout", {
|
|
117
|
-
FillDirection = Enum.FillDirection.Vertical,
|
|
118
|
-
Padding = UDim.new(0, 8),
|
|
119
|
-
SortOrder = Enum.SortOrder.LayoutOrder,
|
|
120
|
-
})
|
|
121
|
-
local _exp_2 = React.createElement("textbutton", {
|
|
122
|
-
Text = "Prev",
|
|
123
|
-
Size = UDim2.fromOffset(56, 28),
|
|
124
|
-
BackgroundTransparency = 1,
|
|
125
|
-
BorderSizePixel = 0,
|
|
126
|
-
TextColor3 = theme.palette.text.secondary,
|
|
127
|
-
Font = theme.typography.fontFamilies.default,
|
|
128
|
-
TextSize = theme.typography.fontSizes.caption,
|
|
129
|
-
Event = {
|
|
130
|
-
Activated = function()
|
|
131
|
-
return move(-1)
|
|
132
|
-
end,
|
|
133
|
-
},
|
|
134
|
-
})
|
|
135
|
-
local _attributes_1 = {}
|
|
136
|
-
local _condition_1 = MONTHS[month]
|
|
137
|
-
if _condition_1 == nil then
|
|
138
|
-
_condition_1 = ""
|
|
139
|
-
end
|
|
140
|
-
_attributes_1.Text = `{_condition_1} {year}`
|
|
141
|
-
_attributes_1.AnchorPoint = Vector2.new(0.5, 0)
|
|
142
|
-
_attributes_1.Position = UDim2.fromScale(0.5, 0)
|
|
143
|
-
_attributes_1.Size = UDim2.fromOffset(140, 28)
|
|
144
|
-
_attributes_1.BackgroundTransparency = 1
|
|
145
|
-
_attributes_1.BorderSizePixel = 0
|
|
146
|
-
_attributes_1.TextColor3 = theme.palette.text.primary
|
|
147
|
-
_attributes_1.Font = theme.typography.fontFamilies.semibold
|
|
148
|
-
_attributes_1.TextSize = theme.typography.fontSizes.body
|
|
149
|
-
local _exp_3 = React.createElement("frame", {
|
|
150
|
-
Size = UDim2.new(1, 0, 0, 28),
|
|
151
|
-
BackgroundTransparency = 1,
|
|
152
|
-
BorderSizePixel = 0,
|
|
153
|
-
LayoutOrder = 0,
|
|
154
|
-
}, _exp_2, React.createElement("textlabel", _attributes_1), React.createElement("textbutton", {
|
|
155
|
-
Text = "Next",
|
|
156
|
-
AnchorPoint = Vector2.new(1, 0),
|
|
157
|
-
Position = UDim2.fromScale(1, 0),
|
|
158
|
-
Size = UDim2.fromOffset(56, 28),
|
|
159
|
-
BackgroundTransparency = 1,
|
|
160
|
-
BorderSizePixel = 0,
|
|
161
|
-
TextColor3 = theme.palette.text.secondary,
|
|
162
|
-
Font = theme.typography.fontFamilies.default,
|
|
163
|
-
TextSize = theme.typography.fontSizes.caption,
|
|
164
|
-
Event = {
|
|
165
|
-
Activated = function()
|
|
166
|
-
return move(1)
|
|
167
|
-
end,
|
|
168
|
-
},
|
|
169
|
-
}))
|
|
170
|
-
local _exp_4 = React.createElement("textlabel", {
|
|
171
|
-
Text = if value.start == nil then "Choose a start and finish" elseif value.finish == nil then formatStamp(value.start) else `{formatStamp(value.start)} – {formatStamp(value.finish)}`,
|
|
172
|
-
Size = UDim2.new(1, 0, 0, 16),
|
|
173
|
-
BackgroundTransparency = 1,
|
|
174
|
-
BorderSizePixel = 0,
|
|
175
|
-
TextXAlignment = Enum.TextXAlignment.Left,
|
|
176
|
-
TextColor3 = theme.palette.text.secondary,
|
|
177
|
-
Font = theme.typography.fontFamilies.default,
|
|
178
|
-
TextSize = theme.typography.fontSizes.caption,
|
|
179
|
-
LayoutOrder = 1,
|
|
180
|
-
})
|
|
181
|
-
local _exp_5 = React.createElement("uigridlayout", {
|
|
182
|
-
CellSize = UDim2.fromOffset(36, 28),
|
|
183
|
-
CellPadding = UDim2.fromOffset(4, 4),
|
|
184
|
-
FillDirectionMaxCells = 7,
|
|
185
|
-
SortOrder = Enum.SortOrder.LayoutOrder,
|
|
186
|
-
})
|
|
187
|
-
-- ▼ ReadonlyArray.map ▼
|
|
188
|
-
local _newValue = table.create(#WEEKDAYS)
|
|
189
|
-
local _callback = function(label, index)
|
|
190
|
-
return React.createElement("textlabel", {
|
|
191
|
-
key = `week-{index}`,
|
|
192
|
-
Text = label,
|
|
193
|
-
LayoutOrder = index,
|
|
194
|
-
BackgroundTransparency = 1,
|
|
195
|
-
BorderSizePixel = 0,
|
|
196
|
-
TextColor3 = theme.palette.text.secondary,
|
|
197
|
-
Font = theme.typography.fontFamilies.default,
|
|
198
|
-
TextSize = theme.typography.fontSizes.caption,
|
|
199
|
-
})
|
|
200
|
-
end
|
|
201
|
-
for _k, _v in WEEKDAYS do
|
|
202
|
-
_newValue[_k] = _callback(_v, _k - 1, WEEKDAYS)
|
|
203
|
-
end
|
|
204
|
-
-- ▲ ReadonlyArray.map ▲
|
|
205
|
-
-- ▼ ReadonlyArray.map ▼
|
|
206
|
-
local _newValue_1 = table.create(#cells)
|
|
207
|
-
local _callback_1 = function(cell)
|
|
208
|
-
local stamp = cell.stamp
|
|
209
|
-
local chosen = stamp ~= nil and covers(stamp, value)
|
|
210
|
-
local endpoint = stamp ~= nil and (stamp == value.start or stamp == value.finish)
|
|
211
|
-
if stamp == nil or cell.day == nil then
|
|
212
|
-
return React.createElement("frame", {
|
|
213
|
-
key = `blank-{cell.order}`,
|
|
214
|
-
LayoutOrder = 10 + cell.order,
|
|
215
|
-
BackgroundTransparency = 1,
|
|
216
|
-
BorderSizePixel = 0,
|
|
217
|
-
})
|
|
218
|
-
end
|
|
219
|
-
return React.createElement("textbutton", {
|
|
220
|
-
key = `day-{stamp}`,
|
|
221
|
-
Text = tostring(cell.day),
|
|
222
|
-
LayoutOrder = 10 + cell.order,
|
|
223
|
-
BackgroundColor3 = if chosen then theme.palette.primary.main else theme.palette.surface.input,
|
|
224
|
-
BackgroundTransparency = if chosen and not endpoint then 0.55 else 0,
|
|
225
|
-
BorderSizePixel = 0,
|
|
226
|
-
TextColor3 = if endpoint then theme.palette.primary.on else theme.palette.text.primary,
|
|
227
|
-
Font = theme.typography.fontFamilies.default,
|
|
228
|
-
TextSize = theme.typography.fontSizes.body,
|
|
229
|
-
AutoButtonColor = false,
|
|
230
|
-
Event = {
|
|
231
|
-
Activated = function()
|
|
232
|
-
return pick(stamp)
|
|
233
|
-
end,
|
|
234
|
-
},
|
|
235
|
-
}, React.createElement("uicorner", {
|
|
236
|
-
CornerRadius = UDim.new(0, 4),
|
|
237
|
-
}))
|
|
238
|
-
end
|
|
239
|
-
for _k, _v in cells do
|
|
240
|
-
_newValue_1[_k] = _callback_1(_v, _k - 1, cells)
|
|
241
|
-
end
|
|
242
|
-
-- ▲ ReadonlyArray.map ▲
|
|
243
|
-
return React.createElement(SxHost, _attributes, _exp, _exp_1, _exp_3, _exp_4, React.createElement("frame", {
|
|
244
|
-
Size = UDim2.new(1, 0, 0, 248),
|
|
245
|
-
BackgroundTransparency = 1,
|
|
246
|
-
BorderSizePixel = 0,
|
|
247
|
-
LayoutOrder = 2,
|
|
248
|
-
}, _exp_5, _newValue, _newValue_1))
|
|
249
|
-
end
|
|
250
|
-
local default = DateRangePicker
|
|
251
|
-
return {
|
|
252
|
-
default = default,
|
|
253
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export interface DateSpan {
|
|
2
|
-
start?: number;
|
|
3
|
-
finish?: number;
|
|
4
|
-
}
|
|
5
|
-
export declare function isLeapYear(year: number): boolean;
|
|
6
|
-
export declare function daysInMonth(year: number, month: number): number;
|
|
7
|
-
/** Sunday is 0. */
|
|
8
|
-
export declare function weekday(year: number, month: number, day: number): number;
|
|
9
|
-
export declare function dateStamp(year: number, month: number, day: number): number;
|
|
10
|
-
export declare function shiftMonth(year: number, month: number, delta: number): {
|
|
11
|
-
year: number;
|
|
12
|
-
month: number;
|
|
13
|
-
};
|
|
14
|
-
export declare function orderSpan(first: number, second: number): DateSpan;
|
|
15
|
-
export declare function dayIndex(stamp: number): number;
|
|
16
|
-
export declare function nightsBetween(start: number, finish: number): number;
|
|
17
|
-
export declare function formatStamp(stamp: number): string;
|
|
18
|
-
export declare function formatSpan(value: DateSpan): string;
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
-- Compiled with roblox-ts v3.0.0
|
|
2
|
-
local MONTHS = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }
|
|
3
|
-
local MONTH_LENGTHS = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }
|
|
4
|
-
local WEEKDAY_OFFSET = { 0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4 }
|
|
5
|
-
local function isLeapYear(year)
|
|
6
|
-
return year % 4 == 0 and (year % 100 ~= 0 or year % 400 == 0)
|
|
7
|
-
end
|
|
8
|
-
local function daysInMonth(year, month)
|
|
9
|
-
if month == 2 and isLeapYear(year) then
|
|
10
|
-
return 29
|
|
11
|
-
end
|
|
12
|
-
local _condition = MONTH_LENGTHS[month]
|
|
13
|
-
if _condition == nil then
|
|
14
|
-
_condition = 30
|
|
15
|
-
end
|
|
16
|
-
return _condition
|
|
17
|
-
end
|
|
18
|
-
--* Sunday is 0.
|
|
19
|
-
local function weekday(year, month, day)
|
|
20
|
-
local adjusted = year
|
|
21
|
-
if month < 3 then
|
|
22
|
-
adjusted -= 1
|
|
23
|
-
end
|
|
24
|
-
local sum = adjusted + math.floor(adjusted / 4) - math.floor(adjusted / 100) + math.floor(adjusted / 400) + WEEKDAY_OFFSET[month] + day
|
|
25
|
-
return sum % 7
|
|
26
|
-
end
|
|
27
|
-
local function dateStamp(year, month, day)
|
|
28
|
-
return year * 10000 + month * 100 + day
|
|
29
|
-
end
|
|
30
|
-
local function shiftMonth(year, month, delta)
|
|
31
|
-
local index = year * 12 + (month - 1) + delta
|
|
32
|
-
local nextYear = math.floor(index / 12)
|
|
33
|
-
local remainder = index % 12
|
|
34
|
-
if remainder < 0 then
|
|
35
|
-
remainder += 12
|
|
36
|
-
nextYear -= 1
|
|
37
|
-
end
|
|
38
|
-
return {
|
|
39
|
-
year = nextYear,
|
|
40
|
-
month = remainder + 1,
|
|
41
|
-
}
|
|
42
|
-
end
|
|
43
|
-
local function orderSpan(first, second)
|
|
44
|
-
return if first <= second then {
|
|
45
|
-
start = first,
|
|
46
|
-
finish = second,
|
|
47
|
-
} else {
|
|
48
|
-
start = second,
|
|
49
|
-
finish = first,
|
|
50
|
-
}
|
|
51
|
-
end
|
|
52
|
-
local function dayIndex(stamp)
|
|
53
|
-
local year = math.floor(stamp / 10000)
|
|
54
|
-
local month = math.floor(stamp / 100) % 100
|
|
55
|
-
local day = stamp % 100
|
|
56
|
-
local index = day
|
|
57
|
-
do
|
|
58
|
-
local cursor = 1
|
|
59
|
-
local _shouldIncrement = false
|
|
60
|
-
while true do
|
|
61
|
-
if _shouldIncrement then
|
|
62
|
-
cursor += 1
|
|
63
|
-
else
|
|
64
|
-
_shouldIncrement = true
|
|
65
|
-
end
|
|
66
|
-
if not (cursor < year) then
|
|
67
|
-
break
|
|
68
|
-
end
|
|
69
|
-
index += if isLeapYear(cursor) then 366 else 365
|
|
70
|
-
end
|
|
71
|
-
end
|
|
72
|
-
do
|
|
73
|
-
local cursor = 1
|
|
74
|
-
local _shouldIncrement = false
|
|
75
|
-
while true do
|
|
76
|
-
if _shouldIncrement then
|
|
77
|
-
cursor += 1
|
|
78
|
-
else
|
|
79
|
-
_shouldIncrement = true
|
|
80
|
-
end
|
|
81
|
-
if not (cursor < month) then
|
|
82
|
-
break
|
|
83
|
-
end
|
|
84
|
-
index += daysInMonth(year, cursor)
|
|
85
|
-
end
|
|
86
|
-
end
|
|
87
|
-
return index
|
|
88
|
-
end
|
|
89
|
-
local function nightsBetween(start, finish)
|
|
90
|
-
return math.abs(dayIndex(finish) - dayIndex(start))
|
|
91
|
-
end
|
|
92
|
-
local function formatStamp(stamp)
|
|
93
|
-
local month = math.floor(stamp / 100) % 100
|
|
94
|
-
local day = stamp % 100
|
|
95
|
-
local _condition = MONTHS[month]
|
|
96
|
-
if _condition == nil then
|
|
97
|
-
_condition = "Day"
|
|
98
|
-
end
|
|
99
|
-
return `{_condition} {day}`
|
|
100
|
-
end
|
|
101
|
-
local function formatSpan(value)
|
|
102
|
-
if value.start == nil then
|
|
103
|
-
return "Choose dates"
|
|
104
|
-
end
|
|
105
|
-
if value.finish == nil then
|
|
106
|
-
return formatStamp(value.start)
|
|
107
|
-
end
|
|
108
|
-
return `{formatStamp(value.start)} – {formatStamp(value.finish)}`
|
|
109
|
-
end
|
|
110
|
-
return {
|
|
111
|
-
isLeapYear = isLeapYear,
|
|
112
|
-
daysInMonth = daysInMonth,
|
|
113
|
-
weekday = weekday,
|
|
114
|
-
dateStamp = dateStamp,
|
|
115
|
-
shiftMonth = shiftMonth,
|
|
116
|
-
orderSpan = orderSpan,
|
|
117
|
-
dayIndex = dayIndex,
|
|
118
|
-
nightsBetween = nightsBetween,
|
|
119
|
-
formatStamp = formatStamp,
|
|
120
|
-
formatSpan = formatSpan,
|
|
121
|
-
}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
export { default as DateRangePicker } from "./components/DateRangePicker";
|
|
2
|
-
export { DateRangePickerProps } from "./components/DateRangePicker";
|
|
3
|
-
export { DateSpan, dateStamp, dayIndex, daysInMonth, formatSpan, formatStamp, isLeapYear, nightsBetween, orderSpan, shiftMonth, weekday, } from "./dateRangeValue";
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
-- Compiled with roblox-ts v3.0.0
|
|
2
|
-
local TS = _G[script]
|
|
3
|
-
local exports = {}
|
|
4
|
-
exports.DateRangePicker = TS.import(script, script, "components", "DateRangePicker").default
|
|
5
|
-
local _dateRangeValue = TS.import(script, script, "dateRangeValue")
|
|
6
|
-
exports.dateStamp = _dateRangeValue.dateStamp
|
|
7
|
-
exports.dayIndex = _dateRangeValue.dayIndex
|
|
8
|
-
exports.daysInMonth = _dateRangeValue.daysInMonth
|
|
9
|
-
exports.formatSpan = _dateRangeValue.formatSpan
|
|
10
|
-
exports.formatStamp = _dateRangeValue.formatStamp
|
|
11
|
-
exports.isLeapYear = _dateRangeValue.isLeapYear
|
|
12
|
-
exports.nightsBetween = _dateRangeValue.nightsBetween
|
|
13
|
-
exports.orderSpan = _dateRangeValue.orderSpan
|
|
14
|
-
exports.shiftMonth = _dateRangeValue.shiftMonth
|
|
15
|
-
exports.weekday = _dateRangeValue.weekday
|
|
16
|
-
return exports
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function dividerLabel(text?: string): string | undefined;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import React from "@rbxts/react";
|
|
2
|
-
import { StyleState } from "../../../../theme/styles/utilities/resolveStyle";
|
|
3
|
-
import { SxInput } from "../../../../theme/styles/utilities/resolveSx";
|
|
4
|
-
export interface SxHostProps {
|
|
5
|
-
tag?: string;
|
|
6
|
-
base?: object;
|
|
7
|
-
className?: object;
|
|
8
|
-
sx?: SxInput | object;
|
|
9
|
-
state?: StyleState;
|
|
10
|
-
hostRef?: React.Ref<any>;
|
|
11
|
-
children?: React.ReactNode;
|
|
12
|
-
[key: string]: unknown;
|
|
13
|
-
}
|
|
14
|
-
declare function SxHost(props: SxHostProps): React.ReactElement<{
|
|
15
|
-
ref: (instance: GuiObject) => void;
|
|
16
|
-
children: React.Element<any, string | React.JSXElementConstructor<any>>[];
|
|
17
|
-
}, string | React.JSXElementConstructor<any>>;
|
|
18
|
-
export default SxHost;
|
|
@@ -1,210 +0,0 @@
|
|
|
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 useEffect = _react.useEffect
|
|
6
|
-
local useRef = _react.useRef
|
|
7
|
-
local useState = _react.useState
|
|
8
|
-
local observeViewport = TS.import(script, script.Parent.Parent.Parent.Parent.Parent, "hooks", "viewportObserver").observeViewport
|
|
9
|
-
local useTheme = TS.import(script, script.Parent.Parent.Parent.Parent.Parent, "theme").useTheme
|
|
10
|
-
local _hostRules = TS.import(script, script.Parent.Parent, "hostRules")
|
|
11
|
-
local elementProps = _hostRules.elementProps
|
|
12
|
-
local elementType = _hostRules.elementType
|
|
13
|
-
local hostKind = _hostRules.hostKind
|
|
14
|
-
local hostRest = _hostRules.hostRest
|
|
15
|
-
local layoutGapPatch = _hostRules.layoutGapPatch
|
|
16
|
-
local sxUsesBreakpoints = _hostRules.sxUsesBreakpoints
|
|
17
|
-
local paintHostStyle = TS.import(script, script.Parent.Parent, "hostPaint").paintHostStyle
|
|
18
|
-
local function setRef(hostRef, instance)
|
|
19
|
-
if hostRef == nil then
|
|
20
|
-
return nil
|
|
21
|
-
end
|
|
22
|
-
local _hostRef = hostRef
|
|
23
|
-
if type(_hostRef) == "function" then
|
|
24
|
-
hostRef(instance)
|
|
25
|
-
return nil
|
|
26
|
-
end
|
|
27
|
-
hostRef.current = instance
|
|
28
|
-
end
|
|
29
|
-
local function SxHost(props)
|
|
30
|
-
local _condition = props.tag
|
|
31
|
-
if _condition == nil then
|
|
32
|
-
_condition = "frame"
|
|
33
|
-
end
|
|
34
|
-
local tag = _condition
|
|
35
|
-
local sx = props.sx
|
|
36
|
-
local _binding = useTheme()
|
|
37
|
-
local theme = _binding.theme
|
|
38
|
-
local bound = useRef()
|
|
39
|
-
local width, setWidth = useState(nil)
|
|
40
|
-
local hover, setHover = useState(false)
|
|
41
|
-
local pressed, setPressed = useState(false)
|
|
42
|
-
local focused, setFocused = useState(false)
|
|
43
|
-
useEffect(function()
|
|
44
|
-
local host = bound.current
|
|
45
|
-
if host == nil or not sxUsesBreakpoints(sx) then
|
|
46
|
-
return nil
|
|
47
|
-
end
|
|
48
|
-
return observeViewport(host, function(size)
|
|
49
|
-
setWidth(function(prev)
|
|
50
|
-
return if prev == size.width then prev else size.width
|
|
51
|
-
end)
|
|
52
|
-
end)
|
|
53
|
-
end, { sx })
|
|
54
|
-
local passed = props.state
|
|
55
|
-
local _result = passed
|
|
56
|
-
if _result ~= nil then
|
|
57
|
-
_result = _result.disabled
|
|
58
|
-
end
|
|
59
|
-
local locked = _result == true
|
|
60
|
-
local _exp = props.base
|
|
61
|
-
local _exp_1 = props.className
|
|
62
|
-
local _object = {
|
|
63
|
-
hover = hover,
|
|
64
|
-
pressed = pressed,
|
|
65
|
-
focused = focused,
|
|
66
|
-
}
|
|
67
|
-
if passed then
|
|
68
|
-
for _k, _v in passed do
|
|
69
|
-
_object[_k] = _v
|
|
70
|
-
end
|
|
71
|
-
end
|
|
72
|
-
local paint = paintHostStyle(theme, _exp, _exp_1, sx, width, _object)
|
|
73
|
-
local rest = hostRest(props)
|
|
74
|
-
local caller = rest.Event
|
|
75
|
-
local pressable = tag == "textbutton" or tag == "imagebutton"
|
|
76
|
-
local _object_1 = {}
|
|
77
|
-
if caller then
|
|
78
|
-
for _k, _v in caller do
|
|
79
|
-
_object_1[_k] = _v
|
|
80
|
-
end
|
|
81
|
-
end
|
|
82
|
-
_object_1.MouseEnter = function(...)
|
|
83
|
-
local args = { ... }
|
|
84
|
-
if not locked then
|
|
85
|
-
setHover(true)
|
|
86
|
-
end
|
|
87
|
-
local _result_1 = caller
|
|
88
|
-
if _result_1 ~= nil then
|
|
89
|
-
_result_1 = _result_1.MouseEnter
|
|
90
|
-
if _result_1 ~= nil then
|
|
91
|
-
_result_1(unpack(args))
|
|
92
|
-
end
|
|
93
|
-
end
|
|
94
|
-
end
|
|
95
|
-
_object_1.MouseLeave = function(...)
|
|
96
|
-
local args = { ... }
|
|
97
|
-
setHover(false)
|
|
98
|
-
setPressed(false)
|
|
99
|
-
local _result_1 = caller
|
|
100
|
-
if _result_1 ~= nil then
|
|
101
|
-
_result_1 = _result_1.MouseLeave
|
|
102
|
-
if _result_1 ~= nil then
|
|
103
|
-
_result_1(unpack(args))
|
|
104
|
-
end
|
|
105
|
-
end
|
|
106
|
-
end
|
|
107
|
-
_object_1.SelectionGained = function(...)
|
|
108
|
-
local args = { ... }
|
|
109
|
-
if not locked then
|
|
110
|
-
setFocused(true)
|
|
111
|
-
end
|
|
112
|
-
local _result_1 = caller
|
|
113
|
-
if _result_1 ~= nil then
|
|
114
|
-
_result_1 = _result_1.SelectionGained
|
|
115
|
-
if _result_1 ~= nil then
|
|
116
|
-
_result_1(unpack(args))
|
|
117
|
-
end
|
|
118
|
-
end
|
|
119
|
-
end
|
|
120
|
-
_object_1.SelectionLost = function(...)
|
|
121
|
-
local args = { ... }
|
|
122
|
-
setFocused(false)
|
|
123
|
-
local _result_1 = caller
|
|
124
|
-
if _result_1 ~= nil then
|
|
125
|
-
_result_1 = _result_1.SelectionLost
|
|
126
|
-
if _result_1 ~= nil then
|
|
127
|
-
_result_1(unpack(args))
|
|
128
|
-
end
|
|
129
|
-
end
|
|
130
|
-
end
|
|
131
|
-
rest.Event = _object_1
|
|
132
|
-
-- GuiButton-only; Frames reject MouseButton1* and crash Select/Menu hosts.
|
|
133
|
-
if pressable then
|
|
134
|
-
local events = rest.Event
|
|
135
|
-
events.MouseButton1Down = function(...)
|
|
136
|
-
local args = { ... }
|
|
137
|
-
if not locked then
|
|
138
|
-
setPressed(true)
|
|
139
|
-
end
|
|
140
|
-
local _result_1 = caller
|
|
141
|
-
if _result_1 ~= nil then
|
|
142
|
-
_result_1 = _result_1.MouseButton1Down
|
|
143
|
-
if _result_1 ~= nil then
|
|
144
|
-
_result_1(unpack(args))
|
|
145
|
-
end
|
|
146
|
-
end
|
|
147
|
-
end
|
|
148
|
-
events.MouseButton1Up = function(...)
|
|
149
|
-
local args = { ... }
|
|
150
|
-
setPressed(false)
|
|
151
|
-
local _result_1 = caller
|
|
152
|
-
if _result_1 ~= nil then
|
|
153
|
-
_result_1 = _result_1.MouseButton1Up
|
|
154
|
-
if _result_1 ~= nil then
|
|
155
|
-
_result_1(unpack(args))
|
|
156
|
-
end
|
|
157
|
-
end
|
|
158
|
-
end
|
|
159
|
-
end
|
|
160
|
-
local nodes = React.Children.toArray(props.children)
|
|
161
|
-
local painted = {}
|
|
162
|
-
local hasPad = false
|
|
163
|
-
local hasCorner = false
|
|
164
|
-
local hasGradient = false
|
|
165
|
-
for _, node in nodes do
|
|
166
|
-
if not React.isValidElement(node) then
|
|
167
|
-
continue
|
|
168
|
-
end
|
|
169
|
-
local kind = hostKind(elementType(node))
|
|
170
|
-
if kind == "uipadding" then
|
|
171
|
-
hasPad = true
|
|
172
|
-
end
|
|
173
|
-
if kind == "uicorner" then
|
|
174
|
-
hasCorner = true
|
|
175
|
-
end
|
|
176
|
-
if kind == "uigradient" then
|
|
177
|
-
hasGradient = true
|
|
178
|
-
end
|
|
179
|
-
local patch = if kind ~= nil then layoutGapPatch(kind, elementProps(node), paint.gap) else nil
|
|
180
|
-
local _arg0 = if patch ~= nil then React.cloneElement(node, patch) else node
|
|
181
|
-
table.insert(painted, _arg0)
|
|
182
|
-
end
|
|
183
|
-
if not hasPad and paint.padding ~= nil then
|
|
184
|
-
local _arg0 = React.createElement("uipadding", paint.padding)
|
|
185
|
-
table.insert(painted, _arg0)
|
|
186
|
-
end
|
|
187
|
-
if not hasCorner and paint.corner ~= nil then
|
|
188
|
-
local _arg0 = React.createElement("uicorner", paint.corner)
|
|
189
|
-
table.insert(painted, _arg0)
|
|
190
|
-
end
|
|
191
|
-
if not hasGradient and paint.gradient ~= nil then
|
|
192
|
-
local _arg0 = React.createElement("uigradient", paint.gradient)
|
|
193
|
-
table.insert(painted, _arg0)
|
|
194
|
-
end
|
|
195
|
-
local _object_2 = table.clone(paint.props)
|
|
196
|
-
setmetatable(_object_2, nil)
|
|
197
|
-
for _k, _v in rest do
|
|
198
|
-
_object_2[_k] = _v
|
|
199
|
-
end
|
|
200
|
-
_object_2.ref = function(instance)
|
|
201
|
-
bound.current = instance
|
|
202
|
-
setRef(props.hostRef, instance)
|
|
203
|
-
end
|
|
204
|
-
_object_2.children = painted
|
|
205
|
-
return React.createElement(tag, _object_2)
|
|
206
|
-
end
|
|
207
|
-
local default = SxHost
|
|
208
|
-
return {
|
|
209
|
-
default = default,
|
|
210
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { resolveSx, ResolvedSx, SxInput } from "../../../theme/styles/utilities/resolveSx";
|
|
2
|
-
import { StyleState } from "../../../theme/styles/utilities/resolveStyle";
|
|
3
|
-
export interface HostPaint {
|
|
4
|
-
props: {
|
|
5
|
-
[key: string]: unknown;
|
|
6
|
-
};
|
|
7
|
-
padding?: ResolvedSx["padding"];
|
|
8
|
-
corner?: ResolvedSx["corner"];
|
|
9
|
-
gradient?: ResolvedSx["gradient"];
|
|
10
|
-
gap?: number;
|
|
11
|
-
}
|
|
12
|
-
export declare function paintHostStyle(theme: Parameters<typeof resolveSx>[0], base: object | undefined, className: object | undefined, sx: SxInput | undefined, width: number | undefined, state: StyleState | undefined): HostPaint;
|