@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
|
@@ -107,6 +107,37 @@ local function formatSpan(value)
|
|
|
107
107
|
end
|
|
108
108
|
return `{formatStamp(value.start)} – {formatStamp(value.finish)}`
|
|
109
109
|
end
|
|
110
|
+
--* Inverse of dayIndex. Day 1 is 1 Jan of year 1.
|
|
111
|
+
local function stampFromIndex(index)
|
|
112
|
+
local left = index
|
|
113
|
+
local year = 1
|
|
114
|
+
while left > (if isLeapYear(year) then 366 else 365) do
|
|
115
|
+
left -= if isLeapYear(year) then 366 else 365
|
|
116
|
+
year += 1
|
|
117
|
+
end
|
|
118
|
+
local month = 1
|
|
119
|
+
while month < 12 and left > daysInMonth(year, month) do
|
|
120
|
+
left -= daysInMonth(year, month)
|
|
121
|
+
month += 1
|
|
122
|
+
end
|
|
123
|
+
return dateStamp(year, month, left)
|
|
124
|
+
end
|
|
125
|
+
local function shiftDay(stamp, delta)
|
|
126
|
+
return stampFromIndex(dayIndex(stamp) + delta)
|
|
127
|
+
end
|
|
128
|
+
--* Seven stamps, Sunday through Saturday, containing the day.
|
|
129
|
+
local function weekStamps(stamp)
|
|
130
|
+
local year = math.floor(stamp / 10000)
|
|
131
|
+
local month = math.floor(stamp / 100) % 100
|
|
132
|
+
local day = stamp % 100
|
|
133
|
+
local origin = dayIndex(stamp) - weekday(year, month, day)
|
|
134
|
+
local week = {}
|
|
135
|
+
for offset = 0, 6 do
|
|
136
|
+
local _arg0 = stampFromIndex(origin + offset)
|
|
137
|
+
table.insert(week, _arg0)
|
|
138
|
+
end
|
|
139
|
+
return week
|
|
140
|
+
end
|
|
110
141
|
return {
|
|
111
142
|
isLeapYear = isLeapYear,
|
|
112
143
|
daysInMonth = daysInMonth,
|
|
@@ -118,4 +149,7 @@ return {
|
|
|
118
149
|
nightsBetween = nightsBetween,
|
|
119
150
|
formatStamp = formatStamp,
|
|
120
151
|
formatSpan = formatSpan,
|
|
152
|
+
stampFromIndex = stampFromIndex,
|
|
153
|
+
shiftDay = shiftDay,
|
|
154
|
+
weekStamps = weekStamps,
|
|
121
155
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { default as DateRangePicker } from "./components/DateRangePicker";
|
|
2
2
|
export { DateRangePickerProps } from "./components/DateRangePicker";
|
|
3
|
-
export { DateSpan, dateStamp, dayIndex, daysInMonth, formatSpan, formatStamp, isLeapYear, nightsBetween, orderSpan, shiftMonth, weekday, } from "./dateRangeValue";
|
|
3
|
+
export { DateSpan, dateStamp, dayIndex, daysInMonth, formatSpan, formatStamp, isLeapYear, nightsBetween, orderSpan, shiftDay, shiftMonth, stampFromIndex, weekday, weekStamps, } from "./dateRangeValue";
|
|
@@ -11,6 +11,9 @@ exports.formatStamp = _dateRangeValue.formatStamp
|
|
|
11
11
|
exports.isLeapYear = _dateRangeValue.isLeapYear
|
|
12
12
|
exports.nightsBetween = _dateRangeValue.nightsBetween
|
|
13
13
|
exports.orderSpan = _dateRangeValue.orderSpan
|
|
14
|
+
exports.shiftDay = _dateRangeValue.shiftDay
|
|
14
15
|
exports.shiftMonth = _dateRangeValue.shiftMonth
|
|
16
|
+
exports.stampFromIndex = _dateRangeValue.stampFromIndex
|
|
15
17
|
exports.weekday = _dateRangeValue.weekday
|
|
18
|
+
exports.weekStamps = _dateRangeValue.weekStamps
|
|
16
19
|
return exports
|
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
-- Compiled with roblox-ts v3.0.0
|
|
2
2
|
local TS = _G[script]
|
|
3
|
-
local
|
|
3
|
+
local _react = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
4
|
+
local React = _react
|
|
5
|
+
local useEffect = _react.useEffect
|
|
6
|
+
local useRef = _react.useRef
|
|
7
|
+
local useState = _react.useState
|
|
8
|
+
local useTheme = TS.import(script, script.Parent.Parent.Parent.Parent.Parent, "theme").useTheme
|
|
4
9
|
local SxHost = TS.import(script, script.Parent.Parent.Parent, "host").SxHost
|
|
5
10
|
local Modal = TS.import(script, script.Parent.Parent.Parent, "modal").Modal
|
|
11
|
+
local portalTarget = TS.import(script, script.Parent.Parent.Parent, "popup").portalTarget
|
|
12
|
+
local dialogWidth = TS.import(script, script.Parent, "dialogWidth").dialogWidth
|
|
6
13
|
local useDialogStyles = TS.import(script, script.Parent, "Dialog.styles").default
|
|
7
14
|
local function Dialog(props)
|
|
8
15
|
local _binding = props
|
|
@@ -10,15 +17,57 @@ local function Dialog(props)
|
|
|
10
17
|
local open = _binding.open
|
|
11
18
|
local title = _binding.title
|
|
12
19
|
local onClose = _binding.onClose
|
|
20
|
+
local fullWidth = _binding.fullWidth
|
|
13
21
|
local children = _binding.children
|
|
14
22
|
local actions = _binding.actions
|
|
15
23
|
local className = _binding.className
|
|
16
24
|
local sx = _binding.sx
|
|
17
25
|
local id = _binding.id
|
|
18
26
|
local ref = _binding.ref
|
|
27
|
+
local _binding_1 = useTheme()
|
|
28
|
+
local theme = _binding_1.theme
|
|
19
29
|
local styles = useDialogStyles()
|
|
30
|
+
local probe = useRef()
|
|
31
|
+
local room, setRoom = useState(0)
|
|
20
32
|
local hasTitle = title ~= nil and title ~= ""
|
|
21
33
|
local hasActions = actions ~= nil
|
|
34
|
+
local fill = fullWidth == true
|
|
35
|
+
useEffect(function()
|
|
36
|
+
if not fill then
|
|
37
|
+
return nil
|
|
38
|
+
end
|
|
39
|
+
local layer = portalTarget(host or probe.current)
|
|
40
|
+
if layer == nil or not layer:IsA("GuiBase2d") then
|
|
41
|
+
return nil
|
|
42
|
+
end
|
|
43
|
+
local read = function()
|
|
44
|
+
return setRoom(layer.AbsoluteSize.X)
|
|
45
|
+
end
|
|
46
|
+
read()
|
|
47
|
+
local connection = layer:GetPropertyChangedSignal("AbsoluteSize"):Connect(read)
|
|
48
|
+
return function()
|
|
49
|
+
return connection:Disconnect()
|
|
50
|
+
end
|
|
51
|
+
end, { fill, host, open })
|
|
52
|
+
local width = dialogWidth(fullWidth, room - theme.padding.calc(2) * 2, theme.padding.calc(36))
|
|
53
|
+
local _result
|
|
54
|
+
if fill then
|
|
55
|
+
local _object = table.clone(styles.column)
|
|
56
|
+
setmetatable(_object, nil)
|
|
57
|
+
_object.AutomaticSize = Enum.AutomaticSize.Y
|
|
58
|
+
_object.Size = UDim2.fromOffset(width, 0)
|
|
59
|
+
_result = _object
|
|
60
|
+
else
|
|
61
|
+
_result = styles.column
|
|
62
|
+
end
|
|
63
|
+
local column = _result
|
|
64
|
+
local _exp = React.createElement("frame", {
|
|
65
|
+
key = "Probe",
|
|
66
|
+
ref = probe,
|
|
67
|
+
Size = UDim2.fromOffset(0, 0),
|
|
68
|
+
BackgroundTransparency = 1,
|
|
69
|
+
BorderSizePixel = 0,
|
|
70
|
+
})
|
|
22
71
|
local _attributes = {
|
|
23
72
|
tag = "frame",
|
|
24
73
|
}
|
|
@@ -28,12 +77,12 @@ local function Dialog(props)
|
|
|
28
77
|
end
|
|
29
78
|
_attributes.key = _condition
|
|
30
79
|
_attributes.hostRef = ref
|
|
31
|
-
_attributes.base =
|
|
80
|
+
_attributes.base = column
|
|
32
81
|
_attributes.className = className
|
|
33
82
|
_attributes.sx = sx
|
|
34
83
|
local _attributes_1 = table.clone(styles.columnList)
|
|
35
84
|
setmetatable(_attributes_1, nil)
|
|
36
|
-
local
|
|
85
|
+
local _exp_1 = React.createElement("uilistlayout", _attributes_1)
|
|
37
86
|
local _condition_1 = hasTitle
|
|
38
87
|
if _condition_1 then
|
|
39
88
|
local _attributes_2 = {
|
|
@@ -51,7 +100,7 @@ local function Dialog(props)
|
|
|
51
100
|
for _k, _v in styles.body do
|
|
52
101
|
_attributes_2[_k] = _v
|
|
53
102
|
end
|
|
54
|
-
local
|
|
103
|
+
local _exp_2 = React.createElement("frame", _attributes_2, children)
|
|
55
104
|
local _condition_2 = hasActions
|
|
56
105
|
if _condition_2 then
|
|
57
106
|
local _attributes_3 = {
|
|
@@ -64,11 +113,11 @@ local function Dialog(props)
|
|
|
64
113
|
setmetatable(_attributes_4, nil)
|
|
65
114
|
_condition_2 = (React.createElement("frame", _attributes_3, React.createElement("uilistlayout", _attributes_4), actions))
|
|
66
115
|
end
|
|
67
|
-
return React.createElement(Modal, {
|
|
116
|
+
return React.createElement(React.Fragment, nil, _exp, React.createElement(Modal, {
|
|
68
117
|
host = host,
|
|
69
118
|
open = open,
|
|
70
119
|
onClose = onClose,
|
|
71
|
-
}, React.createElement(SxHost, _attributes,
|
|
120
|
+
}, React.createElement(SxHost, _attributes, _exp_1, _condition_1, _exp_2, _condition_2)))
|
|
72
121
|
end
|
|
73
122
|
local default = Dialog
|
|
74
123
|
return {
|
|
@@ -6,7 +6,7 @@ local componentStyles = _theme.componentStyles
|
|
|
6
6
|
local useDialogStyles = componentStyles("Dialog", function(theme)
|
|
7
7
|
return createStyles({
|
|
8
8
|
column = {
|
|
9
|
-
AutomaticSize = Enum.AutomaticSize.
|
|
9
|
+
AutomaticSize = Enum.AutomaticSize.Y,
|
|
10
10
|
Size = UDim2.fromOffset(theme.padding.calc(36), 0),
|
|
11
11
|
BackgroundTransparency = 1,
|
|
12
12
|
BorderSizePixel = 0,
|
|
@@ -18,14 +18,15 @@ local useDialogStyles = componentStyles("Dialog", function(theme)
|
|
|
18
18
|
},
|
|
19
19
|
title = {
|
|
20
20
|
LayoutOrder = 1,
|
|
21
|
-
AutomaticSize = Enum.AutomaticSize.
|
|
22
|
-
Size = UDim2.
|
|
21
|
+
AutomaticSize = Enum.AutomaticSize.Y,
|
|
22
|
+
Size = UDim2.new(1, 0, 0, 0),
|
|
23
23
|
BackgroundTransparency = 1,
|
|
24
24
|
BorderSizePixel = 0,
|
|
25
25
|
Font = theme.typography.fontFamilies.default,
|
|
26
26
|
TextSize = theme.typography.fontSizes.h6,
|
|
27
27
|
TextColor3 = theme.palette.text.primary,
|
|
28
28
|
TextXAlignment = Enum.TextXAlignment.Left,
|
|
29
|
+
TextWrapped = true,
|
|
29
30
|
},
|
|
30
31
|
body = {
|
|
31
32
|
LayoutOrder = 2,
|
|
@@ -46,6 +47,7 @@ local useDialogStyles = componentStyles("Dialog", function(theme)
|
|
|
46
47
|
HorizontalAlignment = Enum.HorizontalAlignment.Right,
|
|
47
48
|
Padding = UDim.new(0, theme.padding.calc(1)),
|
|
48
49
|
SortOrder = Enum.SortOrder.LayoutOrder,
|
|
50
|
+
Wraps = true,
|
|
49
51
|
},
|
|
50
52
|
})
|
|
51
53
|
end)
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Desktop forms stay a column. Phone uses the room instead of the fixed width. */
|
|
2
|
+
export declare const DIALOG_FILL_MAX = 480;
|
|
3
|
+
export declare function dialogWidth(fill: boolean | undefined, available: number, fixed: number, max?: number): number;
|
|
4
|
+
/** Two small actions are wider than the fixed column, so the row wraps at every width. */
|
|
5
|
+
export declare function dialogActionWrap(fixed: number, button: number, count: number, gap?: number): boolean;
|
|
6
|
+
/** A title wider than the column wraps. A short title stays one line. */
|
|
7
|
+
export declare function dialogTitleWrap(textWidth: number, column: number): boolean;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
--* Desktop forms stay a column. Phone uses the room instead of the fixed width.
|
|
3
|
+
local DIALOG_FILL_MAX = 480
|
|
4
|
+
local function dialogWidth(fill, available, fixed, max)
|
|
5
|
+
if max == nil then
|
|
6
|
+
max = DIALOG_FILL_MAX
|
|
7
|
+
end
|
|
8
|
+
if fill ~= true or available <= 0 then
|
|
9
|
+
return fixed
|
|
10
|
+
end
|
|
11
|
+
return if available < max then available else max
|
|
12
|
+
end
|
|
13
|
+
--* Two small actions are wider than the fixed column, so the row wraps at every width.
|
|
14
|
+
local function dialogActionWrap(fixed, button, count, gap)
|
|
15
|
+
if gap == nil then
|
|
16
|
+
gap = 0
|
|
17
|
+
end
|
|
18
|
+
if count < 2 or fixed <= 0 then
|
|
19
|
+
return false
|
|
20
|
+
end
|
|
21
|
+
return button * count + gap * (count - 1) > fixed
|
|
22
|
+
end
|
|
23
|
+
--* A title wider than the column wraps. A short title stays one line.
|
|
24
|
+
local function dialogTitleWrap(textWidth, column)
|
|
25
|
+
if column <= 0 then
|
|
26
|
+
return false
|
|
27
|
+
end
|
|
28
|
+
return textWidth > column
|
|
29
|
+
end
|
|
30
|
+
return {
|
|
31
|
+
dialogWidth = dialogWidth,
|
|
32
|
+
dialogActionWrap = dialogActionWrap,
|
|
33
|
+
dialogTitleWrap = dialogTitleWrap,
|
|
34
|
+
DIALOG_FILL_MAX = DIALOG_FILL_MAX,
|
|
35
|
+
}
|
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
-- Compiled with roblox-ts v3.0.0
|
|
2
2
|
local TS = _G[script]
|
|
3
|
-
local
|
|
3
|
+
local _react = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
4
|
+
local React = _react
|
|
5
|
+
local useEffect = _react.useEffect
|
|
6
|
+
local useRef = _react.useRef
|
|
7
|
+
local useState = _react.useState
|
|
8
|
+
local TextService = TS.import(script, TS.getModule(script, "@rbxts", "services")).TextService
|
|
9
|
+
local useTheme = TS.import(script, script.Parent.Parent.Parent.Parent.Parent, "theme").useTheme
|
|
4
10
|
local Orientations = TS.import(script, script.Parent.Parent.Parent.Parent, "enums").Orientations
|
|
5
11
|
local SxHost = TS.import(script, script.Parent.Parent.Parent, "host").SxHost
|
|
6
|
-
local
|
|
12
|
+
local _dividerLabel = TS.import(script, script.Parent, "dividerLabel")
|
|
13
|
+
local dividerFit = _dividerLabel.dividerFit
|
|
14
|
+
local dividerLabel = _dividerLabel.dividerLabel
|
|
7
15
|
local useDividerStyles = TS.import(script, script.Parent, "Divider.styles").default
|
|
8
16
|
local function Divider(props)
|
|
9
17
|
local _binding = props
|
|
@@ -19,17 +27,52 @@ local function Divider(props)
|
|
|
19
27
|
local line = _binding_1.line
|
|
20
28
|
local caption = _binding_1.caption
|
|
21
29
|
local captionPad = _binding_1.captionPad
|
|
30
|
+
local _binding_2 = useTheme()
|
|
31
|
+
local theme = _binding_2.theme
|
|
22
32
|
local label = dividerLabel(text)
|
|
23
|
-
|
|
33
|
+
local labeled = label ~= nil and orientation ~= Orientations.Vertical
|
|
34
|
+
local shellRef = useRef()
|
|
35
|
+
local box, setBox = useState(0)
|
|
36
|
+
local _condition = theme.typography.fontSizes.caption
|
|
37
|
+
if _condition == nil then
|
|
38
|
+
_condition = 12
|
|
39
|
+
end
|
|
40
|
+
local textSize = _condition
|
|
41
|
+
local font = theme.typography.fontFamilies.default or Enum.Font.SourceSans
|
|
42
|
+
local measured = if labeled then TextService:GetTextSize(label, textSize, font, Vector2.new(10000, 100)).X else 0
|
|
43
|
+
local room = math.max(0, box - theme.padding.calc(2) * 2)
|
|
44
|
+
local fit = if labeled then dividerFit(measured + theme.padding.calc(1) * 2, room) else 0
|
|
45
|
+
useEffect(function()
|
|
46
|
+
local rbx = shellRef.current
|
|
47
|
+
if not rbx then
|
|
48
|
+
return nil
|
|
49
|
+
end
|
|
50
|
+
local update = function()
|
|
51
|
+
return setBox(rbx.AbsoluteSize.X)
|
|
52
|
+
end
|
|
53
|
+
update()
|
|
54
|
+
local connection = rbx:GetPropertyChangedSignal("AbsoluteSize"):Connect(update)
|
|
55
|
+
return function()
|
|
56
|
+
return connection:Disconnect()
|
|
57
|
+
end
|
|
58
|
+
end)
|
|
59
|
+
if labeled then
|
|
24
60
|
local _attributes = {
|
|
25
61
|
tag = "frame",
|
|
26
62
|
}
|
|
27
|
-
local
|
|
28
|
-
if not (
|
|
29
|
-
|
|
63
|
+
local _condition_1 = id
|
|
64
|
+
if not (_condition_1 ~= 0 and _condition_1 == _condition_1 and _condition_1 ~= "" and _condition_1) then
|
|
65
|
+
_condition_1 = "Divider"
|
|
66
|
+
end
|
|
67
|
+
_attributes.key = _condition_1
|
|
68
|
+
_attributes.hostRef = function(instance)
|
|
69
|
+
shellRef.current = instance
|
|
70
|
+
if type(ref) == "function" then
|
|
71
|
+
ref(instance)
|
|
72
|
+
elseif ref ~= nil then
|
|
73
|
+
ref.current = instance
|
|
74
|
+
end
|
|
30
75
|
end
|
|
31
|
-
_attributes.key = _condition
|
|
32
|
-
_attributes.hostRef = ref
|
|
33
76
|
_attributes.base = shell
|
|
34
77
|
_attributes.className = className
|
|
35
78
|
_attributes.sx = sx
|
|
@@ -47,6 +90,8 @@ local function Divider(props)
|
|
|
47
90
|
_attributes_2[_k] = _v
|
|
48
91
|
end
|
|
49
92
|
_attributes_2.Text = label
|
|
93
|
+
_attributes_2.Size = if fit > 0 then UDim2.new(0, fit, 1, 0) else UDim2.new(0, 0, 1, 0)
|
|
94
|
+
_attributes_2.AutomaticSize = if fit > 0 then Enum.AutomaticSize.None else Enum.AutomaticSize.X
|
|
50
95
|
local _attributes_3 = table.clone(captionPad)
|
|
51
96
|
setmetatable(_attributes_3, nil)
|
|
52
97
|
return React.createElement(SxHost, _attributes, _exp, React.createElement("textlabel", _attributes_2, React.createElement("uipadding", _attributes_3)))
|
|
@@ -54,11 +99,11 @@ local function Divider(props)
|
|
|
54
99
|
local _attributes = {
|
|
55
100
|
tag = "frame",
|
|
56
101
|
}
|
|
57
|
-
local
|
|
58
|
-
if not (
|
|
59
|
-
|
|
102
|
+
local _condition_1 = id
|
|
103
|
+
if not (_condition_1 ~= 0 and _condition_1 == _condition_1 and _condition_1 ~= "" and _condition_1) then
|
|
104
|
+
_condition_1 = "Divider"
|
|
60
105
|
end
|
|
61
|
-
_attributes.key =
|
|
106
|
+
_attributes.key = _condition_1
|
|
62
107
|
_attributes.hostRef = ref
|
|
63
108
|
local _object = table.clone(root)
|
|
64
109
|
setmetatable(_object, nil)
|
|
@@ -5,6 +5,17 @@ local function dividerLabel(text)
|
|
|
5
5
|
end
|
|
6
6
|
return text
|
|
7
7
|
end
|
|
8
|
+
--* A caption wider than the row caps. A short caption stays on the line.
|
|
9
|
+
local function dividerFit(textWidth, box)
|
|
10
|
+
if box <= 0 then
|
|
11
|
+
return 0
|
|
12
|
+
end
|
|
13
|
+
if textWidth <= box then
|
|
14
|
+
return 0
|
|
15
|
+
end
|
|
16
|
+
return box
|
|
17
|
+
end
|
|
8
18
|
return {
|
|
9
19
|
dividerLabel = dividerLabel,
|
|
20
|
+
dividerFit = dividerFit,
|
|
10
21
|
}
|
|
@@ -11,7 +11,9 @@ local isDismissInput = TS.import(script, script.Parent.Parent.Parent, "modal", "
|
|
|
11
11
|
local _popup = TS.import(script, script.Parent.Parent.Parent, "popup")
|
|
12
12
|
local Portal = _popup.Portal
|
|
13
13
|
local portalTarget = _popup.portalTarget
|
|
14
|
-
local
|
|
14
|
+
local _drawerPlacement = TS.import(script, script.Parent, "drawerPlacement")
|
|
15
|
+
local drawerAnchor = _drawerPlacement.drawerAnchor
|
|
16
|
+
local drawerBox = _drawerPlacement.drawerBox
|
|
15
17
|
local useDrawerStyles = TS.import(script, script.Parent, "Drawer.styles").default
|
|
16
18
|
local function Drawer(props)
|
|
17
19
|
local _binding = props
|
|
@@ -22,6 +24,7 @@ local function Drawer(props)
|
|
|
22
24
|
edge = "left"
|
|
23
25
|
end
|
|
24
26
|
local width = _binding.width
|
|
27
|
+
local height = _binding.height
|
|
25
28
|
local onClose = _binding.onClose
|
|
26
29
|
local children = _binding.children
|
|
27
30
|
local className = _binding.className
|
|
@@ -54,6 +57,17 @@ local function Drawer(props)
|
|
|
54
57
|
end
|
|
55
58
|
end, { open, layer })
|
|
56
59
|
local placement = drawerAnchor(edge)
|
|
60
|
+
local _result
|
|
61
|
+
if edge == "bottom" then
|
|
62
|
+
local _condition = height
|
|
63
|
+
if _condition == nil then
|
|
64
|
+
_condition = 0
|
|
65
|
+
end
|
|
66
|
+
_result = drawerBox(edge, _condition)
|
|
67
|
+
else
|
|
68
|
+
_result = nil
|
|
69
|
+
end
|
|
70
|
+
local sheet = _result
|
|
57
71
|
local panelStyle = styles.panel
|
|
58
72
|
local _exp = React.createElement("frame", {
|
|
59
73
|
key = "DrawerAnchor",
|
|
@@ -94,8 +108,9 @@ local function Drawer(props)
|
|
|
94
108
|
_attributes_2.base = panelStyle
|
|
95
109
|
_attributes_2.className = className
|
|
96
110
|
_attributes_2.sx = sx
|
|
97
|
-
_attributes_2.AnchorPoint = Vector2.new(placement, 0)
|
|
98
|
-
_attributes_2.Position = UDim2.fromScale(placement, 0)
|
|
111
|
+
_attributes_2.AnchorPoint = Vector2.new(if sheet ~= nil then sheet.anchorX else placement, if sheet ~= nil then sheet.anchorY else 0)
|
|
112
|
+
_attributes_2.Position = UDim2.fromScale(if sheet ~= nil then sheet.posX else placement, if sheet ~= nil then sheet.posY else 0)
|
|
113
|
+
_attributes_2.Size = if sheet ~= nil then UDim2.new(sheet.sizeX, sheet.sizeXO, sheet.sizeY, sheet.sizeYO) else nil
|
|
99
114
|
_attributes_2.ZIndex = panelStyle.ZIndex
|
|
100
115
|
local _attributes_3 = table.clone(styles.padding)
|
|
101
116
|
setmetatable(_attributes_3, nil)
|
|
@@ -1,2 +1,14 @@
|
|
|
1
|
-
export type DrawerEdge = "left" | "right";
|
|
1
|
+
export type DrawerEdge = "left" | "right" | "bottom";
|
|
2
2
|
export declare function drawerAnchor(edge: DrawerEdge): 1 | 0;
|
|
3
|
+
export interface DrawerBox {
|
|
4
|
+
anchorX: number;
|
|
5
|
+
anchorY: number;
|
|
6
|
+
posX: number;
|
|
7
|
+
posY: number;
|
|
8
|
+
sizeX: number;
|
|
9
|
+
sizeXO: number;
|
|
10
|
+
sizeY: number;
|
|
11
|
+
sizeYO: number;
|
|
12
|
+
}
|
|
13
|
+
/** Side drawers keep a column. A bottom sheet spans the width and sits on the lower edge. */
|
|
14
|
+
export declare function drawerBox(edge: DrawerEdge, span: number): DrawerBox;
|
|
@@ -2,6 +2,34 @@
|
|
|
2
2
|
local function drawerAnchor(edge)
|
|
3
3
|
return if edge == "left" then 0 else 1
|
|
4
4
|
end
|
|
5
|
+
--* Side drawers keep a column. A bottom sheet spans the width and sits on the lower edge.
|
|
6
|
+
local function drawerBox(edge, span)
|
|
7
|
+
local size = if span > 0 then span else 160
|
|
8
|
+
if edge == "bottom" then
|
|
9
|
+
return {
|
|
10
|
+
anchorX = 0,
|
|
11
|
+
anchorY = 1,
|
|
12
|
+
posX = 0,
|
|
13
|
+
posY = 1,
|
|
14
|
+
sizeX = 1,
|
|
15
|
+
sizeXO = 0,
|
|
16
|
+
sizeY = 0,
|
|
17
|
+
sizeYO = size,
|
|
18
|
+
}
|
|
19
|
+
end
|
|
20
|
+
local side = drawerAnchor(edge)
|
|
21
|
+
return {
|
|
22
|
+
anchorX = side,
|
|
23
|
+
anchorY = 0,
|
|
24
|
+
posX = side,
|
|
25
|
+
posY = 0,
|
|
26
|
+
sizeX = 0,
|
|
27
|
+
sizeXO = size,
|
|
28
|
+
sizeY = 1,
|
|
29
|
+
sizeYO = 0,
|
|
30
|
+
}
|
|
31
|
+
end
|
|
5
32
|
return {
|
|
6
33
|
drawerAnchor = drawerAnchor,
|
|
34
|
+
drawerBox = drawerBox,
|
|
7
35
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export type FabSize = "small" | "medium" | "large";
|
|
2
|
-
export declare function fabPixels(size?: FabSize): 40 |
|
|
2
|
+
export declare function fabPixels(size?: FabSize): 40 | 56 | 64;
|
|
3
3
|
export declare function fabIconPixels(size?: FabSize): 18 | 24 | 28;
|
|
4
4
|
export declare function fabExtended(label?: string): boolean;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { Icons } from "../../../enums/index";
|
|
2
2
|
import { CustomizedProps } from "../../../../theme/index";
|
|
3
|
+
import { TransportGlyph } from "./transportGlyph";
|
|
3
4
|
export interface IconButtonProps {
|
|
4
5
|
icon: Icons;
|
|
6
|
+
glyph?: TransportGlyph;
|
|
5
7
|
size?: "xxs" | "xs" | "sm" | "md" | "lg" | "xl";
|
|
6
8
|
tint: Color3;
|
|
7
9
|
selected?: boolean;
|
|
@@ -10,9 +10,11 @@ local canActivate = TS.import(script, script.Parent.Parent.Parent, "button", "co
|
|
|
10
10
|
local iconSpinnerPixels = TS.import(script, script.Parent.Parent.Parent, "button", "components", "buttonLook").iconSpinnerPixels
|
|
11
11
|
local CircularProgress = TS.import(script, script.Parent.Parent.Parent, "circularProgress").CircularProgress
|
|
12
12
|
local useIconButtonStyles = TS.import(script, script.Parent, "IconButton.styles").default
|
|
13
|
+
local transportGlyph = TS.import(script, script.Parent, "transportGlyph").transportGlyph
|
|
13
14
|
local function IconButton(props)
|
|
14
15
|
local _binding = props
|
|
15
16
|
local icon = _binding.icon
|
|
17
|
+
local glyph = _binding.glyph
|
|
16
18
|
local selected = _binding.selected
|
|
17
19
|
local tint = _binding.tint
|
|
18
20
|
local disabled = _binding.disabled
|
|
@@ -31,6 +33,7 @@ local function IconButton(props)
|
|
|
31
33
|
local corner = _binding_1.corner
|
|
32
34
|
local reducedMotion = useReducedMotion(reducedProp)
|
|
33
35
|
local active = canActivate(disabled, loading)
|
|
36
|
+
local drawn = if glyph ~= nil then transportGlyph(glyph) else nil
|
|
34
37
|
local hovering, setHovering = useState(false)
|
|
35
38
|
local focused, setFocused = useState(false)
|
|
36
39
|
useEffect(function()
|
|
@@ -63,8 +66,8 @@ local function IconButton(props)
|
|
|
63
66
|
_attributes.AutoButtonColor = active
|
|
64
67
|
_attributes.Selectable = active
|
|
65
68
|
_attributes.BackgroundTransparency = if loading then 1 elseif not active or hovering or selected or focused then 0.5 else 1
|
|
66
|
-
_attributes.Image = tostring(icon)
|
|
67
|
-
_attributes.ImageTransparency = if loading then 1 else 0
|
|
69
|
+
_attributes.Image = if drawn ~= nil then "" else tostring(icon)
|
|
70
|
+
_attributes.ImageTransparency = if drawn ~= nil or loading then 1 else 0
|
|
68
71
|
_attributes.ImageColor3 = tint or container.ImageColor3
|
|
69
72
|
_attributes.Event = {
|
|
70
73
|
MouseButton1Click = function()
|
|
@@ -91,7 +94,38 @@ local function IconButton(props)
|
|
|
91
94
|
}
|
|
92
95
|
local _attributes_1 = table.clone(corner)
|
|
93
96
|
setmetatable(_attributes_1, nil)
|
|
94
|
-
|
|
97
|
+
local _exp = React.createElement("uicorner", _attributes_1)
|
|
98
|
+
local _result
|
|
99
|
+
if drawn ~= nil then
|
|
100
|
+
-- ▼ ReadonlyArray.map ▼
|
|
101
|
+
local _newValue = table.create(#drawn)
|
|
102
|
+
local _callback = function(part, index)
|
|
103
|
+
return React.createElement("frame", {
|
|
104
|
+
key = `g-{index}`,
|
|
105
|
+
Position = UDim2.fromOffset(part.x, part.y),
|
|
106
|
+
Size = UDim2.fromOffset(math.max(part.w, 1), math.max(part.h, 1)),
|
|
107
|
+
BackgroundColor3 = tint,
|
|
108
|
+
BorderSizePixel = 0,
|
|
109
|
+
ZIndex = 12001,
|
|
110
|
+
})
|
|
111
|
+
end
|
|
112
|
+
for _k, _v in drawn do
|
|
113
|
+
_newValue[_k] = _callback(_v, _k - 1, drawn)
|
|
114
|
+
end
|
|
115
|
+
-- ▲ ReadonlyArray.map ▲
|
|
116
|
+
_result = (React.createElement("frame", {
|
|
117
|
+
key = "Glyph",
|
|
118
|
+
AnchorPoint = Vector2.new(0.5, 0.5),
|
|
119
|
+
Position = UDim2.fromScale(0.5, 0.5),
|
|
120
|
+
Size = UDim2.fromOffset(16, 16),
|
|
121
|
+
BackgroundTransparency = 1,
|
|
122
|
+
BorderSizePixel = 0,
|
|
123
|
+
ZIndex = 12001,
|
|
124
|
+
}, _newValue))
|
|
125
|
+
else
|
|
126
|
+
_result = nil
|
|
127
|
+
end
|
|
128
|
+
return React.createElement(SxHost, _attributes, _exp, _result, loading and (React.createElement(CircularProgress, {
|
|
95
129
|
size = iconSpinnerPixels(props.size),
|
|
96
130
|
thickness = 2,
|
|
97
131
|
color = tint,
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type TransportGlyph = "play" | "pause" | "previous" | "next";
|
|
2
|
+
export interface GlyphRect {
|
|
3
|
+
x: number;
|
|
4
|
+
y: number;
|
|
5
|
+
w: number;
|
|
6
|
+
h: number;
|
|
7
|
+
}
|
|
8
|
+
/** Play, pause, previous, and next as a few rectangles. Not an icon font. */
|
|
9
|
+
export declare function transportGlyph(name: TransportGlyph, size?: number): GlyphRect[];
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local function wedge(size, pointRight)
|
|
3
|
+
local steps = 6
|
|
4
|
+
local h = math.max(1, math.floor(size / steps))
|
|
5
|
+
local mid = (steps - 1) / 2
|
|
6
|
+
local parts = {}
|
|
7
|
+
for i = 0, steps - 1 do
|
|
8
|
+
local reach = 1 - math.abs(i - mid) / mid
|
|
9
|
+
local w = math.max(1, math.floor(reach * size))
|
|
10
|
+
local x = if pointRight then 0 else size - w
|
|
11
|
+
local _arg0 = {
|
|
12
|
+
x = x,
|
|
13
|
+
y = i * h,
|
|
14
|
+
w = w,
|
|
15
|
+
h = h,
|
|
16
|
+
}
|
|
17
|
+
table.insert(parts, _arg0)
|
|
18
|
+
end
|
|
19
|
+
return parts
|
|
20
|
+
end
|
|
21
|
+
--* Play, pause, previous, and next as a few rectangles. Not an icon font.
|
|
22
|
+
local function transportGlyph(name, size)
|
|
23
|
+
if size == nil then
|
|
24
|
+
size = 16
|
|
25
|
+
end
|
|
26
|
+
local box = math.max(4, math.floor(size))
|
|
27
|
+
if name == "pause" then
|
|
28
|
+
local bar = math.max(2, math.floor(box / 5))
|
|
29
|
+
local gap = bar
|
|
30
|
+
local span = bar * 2 + gap
|
|
31
|
+
local x0 = math.floor((box - span) / 2)
|
|
32
|
+
return { {
|
|
33
|
+
x = x0,
|
|
34
|
+
y = 0,
|
|
35
|
+
w = bar,
|
|
36
|
+
h = box,
|
|
37
|
+
}, {
|
|
38
|
+
x = x0 + bar + gap,
|
|
39
|
+
y = 0,
|
|
40
|
+
w = bar,
|
|
41
|
+
h = box,
|
|
42
|
+
} }
|
|
43
|
+
end
|
|
44
|
+
if name == "play" then
|
|
45
|
+
return wedge(box, true)
|
|
46
|
+
end
|
|
47
|
+
local bar = math.max(2, math.floor(box / 6))
|
|
48
|
+
local mark = {
|
|
49
|
+
x = if name == "previous" then 0 else box - bar,
|
|
50
|
+
y = 0,
|
|
51
|
+
w = bar,
|
|
52
|
+
h = box,
|
|
53
|
+
}
|
|
54
|
+
local inner = math.max(4, box - bar - 1)
|
|
55
|
+
local shift = if name == "previous" then bar + 1 else 0
|
|
56
|
+
local moved = {}
|
|
57
|
+
for _, part in wedge(inner, name ~= "previous") do
|
|
58
|
+
local _arg0 = {
|
|
59
|
+
x = part.x + shift,
|
|
60
|
+
y = part.y,
|
|
61
|
+
w = part.w,
|
|
62
|
+
h = part.h,
|
|
63
|
+
}
|
|
64
|
+
table.insert(moved, _arg0)
|
|
65
|
+
end
|
|
66
|
+
local _array = { mark }
|
|
67
|
+
local _length = #_array
|
|
68
|
+
table.move(moved, 1, #moved, _length + 1, _array)
|
|
69
|
+
return _array
|
|
70
|
+
end
|
|
71
|
+
return {
|
|
72
|
+
transportGlyph = transportGlyph,
|
|
73
|
+
}
|