@rbxts/uiblox 0.2.0-alpha.37 → 0.2.0-alpha.38

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.
Files changed (212) hide show
  1. package/README.md +1 -18
  2. package/out/theme/constants/NumberConstants.d.ts +10 -0
  3. package/out/theme/constants/NumberConstants.luau +12 -0
  4. package/out/theme/interfaces/density/controlMetrics.luau +2 -2
  5. package/out/theme/interfaces/palette/Palette.d.ts +7 -0
  6. package/out/theme/interfaces/spacing/Shape.d.ts +6 -0
  7. package/out/theme/interfaces/theme/Theme.d.ts +6 -0
  8. package/out/theme/interfaces/typography/FontFamilies.luau +1 -0
  9. package/out/theme/interfaces/typography/FontFamilyOptions.d.ts +1 -1
  10. package/out/theme/interfaces/typography/FontSizeOptions.d.ts +1 -1
  11. package/out/theme/interfaces/typography/FontSizes.luau +2 -0
  12. package/out/theme/interfaces/typography/Variants.d.ts +3 -1
  13. package/out/theme/interfaces/typography/Variants.luau +25 -1
  14. package/out/theme/styles/utilities/focusRing.d.ts +2 -0
  15. package/out/theme/styles/utilities/focusRing.luau +3 -0
  16. package/out/theme/styles/utilities/index.d.ts +1 -1
  17. package/out/theme/styles/utilities/init.luau +3 -1
  18. package/out/theme/themes/DarkTheme.luau +4 -0
  19. package/out/theme/themes/LightTheme.luau +4 -0
  20. package/out/theme/themes/createPalette.luau +15 -0
  21. package/out/ui/packages/accordion/components/Accordion.luau +84 -40
  22. package/out/ui/packages/accordion/components/Accordion.styles.luau +35 -17
  23. package/out/ui/packages/alert/components/Alert.luau +15 -11
  24. package/out/ui/packages/alert/components/Alert.styles.luau +37 -26
  25. package/out/ui/packages/appBar/components/AppBar.luau +35 -13
  26. package/out/ui/packages/appBar/components/AppBar.styles.luau +41 -35
  27. package/out/ui/packages/autocomplete/components/Autocomplete.luau +4 -0
  28. package/out/ui/packages/avatar/components/Avatar.d.ts +2 -0
  29. package/out/ui/packages/avatar/components/Avatar.luau +9 -2
  30. package/out/ui/packages/avatar/components/Avatar.styles.luau +7 -0
  31. package/out/ui/packages/avatarGroup/components/AvatarGroup.luau +9 -4
  32. package/out/ui/packages/avatarGroup/components/AvatarGroup.styles.luau +6 -1
  33. package/out/ui/packages/badge/components/Badge.luau +14 -11
  34. package/out/ui/packages/badge/components/Badge.styles.luau +5 -1
  35. package/out/ui/packages/bottomNavigation/components/BottomNavigation.styles.luau +4 -3
  36. package/out/ui/packages/breadcrumbs/components/Breadcrumbs.luau +6 -2
  37. package/out/ui/packages/breadcrumbs/components/Breadcrumbs.styles.luau +4 -0
  38. package/out/ui/packages/brickColorPicker/components/BrickColorPicker.luau +20 -2
  39. package/out/ui/packages/brickColorPicker/components/BrickColorPicker.styles.luau +72 -66
  40. package/out/ui/packages/button/components/Button.luau +61 -34
  41. package/out/ui/packages/button/components/buttonPaint.d.ts +16 -0
  42. package/out/ui/packages/button/components/buttonPaint.luau +70 -0
  43. package/out/ui/packages/buttonGroup/components/ButtonGroup.d.ts +1 -0
  44. package/out/ui/packages/buttonGroup/components/ButtonGroup.luau +17 -2
  45. package/out/ui/packages/card/components/Card.styles.luau +4 -2
  46. package/out/ui/packages/cframeEditor/components/CFrameEditor.luau +9 -1
  47. package/out/ui/packages/cframeEditor/components/CFrameEditor.styles.luau +50 -41
  48. package/out/ui/packages/checkbox/components/Checkbox.luau +5 -4
  49. package/out/ui/packages/checkbox/components/checkboxLook.d.ts +2 -2
  50. package/out/ui/packages/checkbox/components/checkboxLook.luau +2 -2
  51. package/out/ui/packages/chip/components/Chip.luau +16 -14
  52. package/out/ui/packages/chip/components/Chip.styles.luau +7 -4
  53. package/out/ui/packages/circularProgress/components/CircularProgress.luau +10 -3
  54. package/out/ui/packages/codeEditor/components/CodeEditor.d.ts +12 -0
  55. package/out/ui/packages/codeEditor/components/CodeEditor.luau +262 -0
  56. package/out/ui/packages/codeEditor/components/CodeEditor.styles.d.ts +6 -0
  57. package/out/ui/packages/codeEditor/components/CodeEditor.styles.luau +124 -0
  58. package/out/ui/packages/codeEditor/highlightCode.d.ts +11 -0
  59. package/out/ui/packages/codeEditor/highlightCode.luau +503 -0
  60. package/out/ui/packages/codeEditor/index.d.ts +2 -0
  61. package/out/ui/packages/codeEditor/init.luau +5 -0
  62. package/out/ui/packages/colorPicker/components/ColorPicker.luau +9 -1
  63. package/out/ui/packages/colorPicker/components/ColorPicker.styles.luau +74 -67
  64. package/out/ui/packages/colorPicker/components/ColorSequenceEditor.luau +12 -4
  65. package/out/ui/packages/colorPicker/components/NumberSequenceEditor.luau +12 -4
  66. package/out/ui/packages/dateRange/components/DateRangePicker.luau +31 -19
  67. package/out/ui/packages/dialog/components/Dialog.styles.luau +4 -2
  68. package/out/ui/packages/divider/components/Divider.luau +3 -1
  69. package/out/ui/packages/divider/components/Divider.styles.luau +1 -0
  70. package/out/ui/packages/drawer/components/Drawer.d.ts +1 -0
  71. package/out/ui/packages/drawer/components/Drawer.luau +43 -14
  72. package/out/ui/packages/drawer/components/Drawer.styles.luau +13 -5
  73. package/out/ui/packages/drawer/components/drawerPlacement.d.ts +2 -0
  74. package/out/ui/packages/drawer/components/drawerPlacement.luau +18 -0
  75. package/out/ui/packages/editorFace.d.ts +22 -0
  76. package/out/ui/packages/editorFace.luau +49 -0
  77. package/out/ui/packages/fab/components/Fab.luau +19 -6
  78. package/out/ui/packages/fab/components/Fab.styles.luau +4 -3
  79. package/out/ui/packages/fab/components/fabSize.d.ts +1 -1
  80. package/out/ui/packages/fontEditor/components/FontEditor.luau +13 -3
  81. package/out/ui/packages/fontEditor/components/FontEditor.styles.luau +36 -27
  82. package/out/ui/packages/gradientEditor/components/GradientEditor.luau +21 -13
  83. package/out/ui/packages/gradientEditor/components/GradientEditor.styles.luau +52 -44
  84. package/out/ui/packages/icon/components/DrawnGlyph.d.ts +11 -0
  85. package/out/ui/packages/icon/components/DrawnGlyph.luau +87 -0
  86. package/out/ui/packages/icon/components/Icon.d.ts +6 -2
  87. package/out/ui/packages/icon/components/Icon.luau +23 -3
  88. package/out/ui/packages/icon/components/Icon.styles.luau +3 -0
  89. package/out/ui/packages/icon/components/glyphs.d.ts +28 -0
  90. package/out/ui/packages/icon/components/glyphs.luau +64 -0
  91. package/out/ui/packages/icon/index.d.ts +1 -0
  92. package/out/ui/packages/iconButton/components/IconButton.d.ts +5 -2
  93. package/out/ui/packages/iconButton/components/IconButton.luau +83 -16
  94. package/out/ui/packages/iconButton/components/IconButton.styles.luau +4 -27
  95. package/out/ui/packages/iconButton/components/iconButtonBox.d.ts +11 -0
  96. package/out/ui/packages/iconButton/components/iconButtonBox.luau +48 -0
  97. package/out/ui/packages/iconButton/components/transportGlyph.d.ts +1 -0
  98. package/out/ui/packages/iconButton/components/transportGlyph.luau +4 -0
  99. package/out/ui/packages/imageList/components/ImageList.luau +11 -36
  100. package/out/ui/packages/imageList/components/ImageList.styles.luau +1 -0
  101. package/out/ui/packages/imageList/components/imageListLayout.d.ts +0 -2
  102. package/out/ui/packages/imageList/components/imageListLayout.luau +0 -8
  103. package/out/ui/packages/index.d.ts +1 -0
  104. package/out/ui/packages/init.luau +3 -0
  105. package/out/ui/packages/input/components/Input.luau +46 -29
  106. package/out/ui/packages/input/components/Input.styles.luau +8 -11
  107. package/out/ui/packages/input/components/fieldChrome.d.ts +5 -0
  108. package/out/ui/packages/input/components/fieldChrome.luau +11 -0
  109. package/out/ui/packages/layout/components/Box.luau +92 -13
  110. package/out/ui/packages/layout/components/Box.styles.d.ts +0 -2
  111. package/out/ui/packages/layout/components/Box.styles.luau +0 -9
  112. package/out/ui/packages/layout/components/Grid.luau +81 -16
  113. package/out/ui/packages/layout/components/Pad.d.ts +24 -0
  114. package/out/ui/packages/layout/components/Pad.luau +88 -0
  115. package/out/ui/packages/layout/components/Stack.luau +79 -13
  116. package/out/ui/packages/link/components/Link.luau +19 -13
  117. package/out/ui/packages/link/components/Link.styles.luau +10 -1
  118. package/out/ui/packages/listItem/components/ListItem.luau +61 -4
  119. package/out/ui/packages/listItem/components/ListItem.styles.d.ts +1 -0
  120. package/out/ui/packages/listItem/components/ListItem.styles.luau +28 -11
  121. package/out/ui/packages/listItem/components/listItemInk.d.ts +1 -1
  122. package/out/ui/packages/listItem/components/listItemLayout.d.ts +12 -2
  123. package/out/ui/packages/listItem/components/listItemLayout.luau +29 -2
  124. package/out/ui/packages/markdown/components/Markdown.luau +163 -50
  125. package/out/ui/packages/markdown/components/Markdown.styles.luau +125 -76
  126. package/out/ui/packages/markdown/components/MarkdownEditor.luau +215 -146
  127. package/out/ui/packages/markdown/components/MarkdownEditor.styles.d.ts +1 -0
  128. package/out/ui/packages/markdown/components/MarkdownEditor.styles.luau +153 -83
  129. package/out/ui/packages/markdown/index.d.ts +1 -1
  130. package/out/ui/packages/markdown/parseMarkdown.d.ts +9 -1
  131. package/out/ui/packages/markdown/parseMarkdown.luau +350 -29
  132. package/out/ui/packages/menu/components/Menu.d.ts +1 -1
  133. package/out/ui/packages/menu/components/Menu.luau +12 -11
  134. package/out/ui/packages/menu/components/Menu.styles.luau +6 -1
  135. package/out/ui/packages/menu/components/menuIcon.d.ts +1 -1
  136. package/out/ui/packages/numberInput/components/NumberInput.luau +19 -4
  137. package/out/ui/packages/numberRangeEditor/components/NumberRangeEditor.luau +9 -1
  138. package/out/ui/packages/numberRangeEditor/components/NumberRangeEditor.styles.luau +23 -16
  139. package/out/ui/packages/pager/components/Pager.luau +15 -13
  140. package/out/ui/packages/pager/components/Pager.styles.luau +5 -0
  141. package/out/ui/packages/pagination/components/Pagination.styles.luau +4 -1
  142. package/out/ui/packages/paper/components/Paper.luau +17 -11
  143. package/out/ui/packages/paper/components/Paper.styles.luau +12 -5
  144. package/out/ui/packages/physicalPropertiesEditor/components/PhysicalPropertiesEditor.luau +9 -1
  145. package/out/ui/packages/physicalPropertiesEditor/components/PhysicalPropertiesEditor.styles.luau +24 -19
  146. package/out/ui/packages/popover/components/Popover.d.ts +1 -1
  147. package/out/ui/packages/popover/components/Popover.luau +6 -4
  148. package/out/ui/packages/popover/components/Popover.styles.luau +6 -0
  149. package/out/ui/packages/popup/components/Popup.d.ts +2 -0
  150. package/out/ui/packages/popup/components/Popup.luau +64 -2
  151. package/out/ui/packages/popup/components/placement.luau +6 -4
  152. package/out/ui/packages/progressBar/components/ProgressBar.luau +1 -1
  153. package/out/ui/packages/progressBar/components/ProgressBar.styles.luau +3 -2
  154. package/out/ui/packages/radioGroup/components/RadioGroup.luau +2 -1
  155. package/out/ui/packages/rating/components/Rating.luau +45 -3
  156. package/out/ui/packages/rating/components/Rating.styles.luau +1 -1
  157. package/out/ui/packages/rayEditor/components/RayEditor.luau +9 -1
  158. package/out/ui/packages/rayEditor/components/RayEditor.styles.luau +17 -11
  159. package/out/ui/packages/rectEditor/components/RectEditor.luau +9 -1
  160. package/out/ui/packages/rectEditor/components/RectEditor.styles.luau +49 -42
  161. package/out/ui/packages/select/components/Select.d.ts +2 -0
  162. package/out/ui/packages/select/components/Select.luau +148 -106
  163. package/out/ui/packages/select/components/Select.styles.d.ts +2 -0
  164. package/out/ui/packages/select/components/Select.styles.luau +29 -5
  165. package/out/ui/packages/shadow/components/Shadow.luau +188 -19
  166. package/out/ui/packages/sidebar/components/Sidebar.styles.luau +1 -0
  167. package/out/ui/packages/skeleton/components/Skeleton.luau +4 -0
  168. package/out/ui/packages/slider/components/RangeSlider.luau +6 -5
  169. package/out/ui/packages/slider/components/Slider.luau +11 -16
  170. package/out/ui/packages/sparkline/components/Sparkline.luau +7 -5
  171. package/out/ui/packages/speedDial/components/SpeedDial.luau +4 -1
  172. package/out/ui/packages/speedDial/components/SpeedDial.styles.luau +5 -0
  173. package/out/ui/packages/speedDial/components/speedDialLabel.d.ts +1 -1
  174. package/out/ui/packages/splitPane/components/splitLook.d.ts +1 -1
  175. package/out/ui/packages/stepper/components/Stepper.styles.luau +9 -6
  176. package/out/ui/packages/switch/components/Switch.luau +2 -2
  177. package/out/ui/packages/switch/components/switchLook.d.ts +3 -3
  178. package/out/ui/packages/switch/components/switchLook.luau +4 -10
  179. package/out/ui/packages/table/components/Table.d.ts +1 -0
  180. package/out/ui/packages/table/components/Table.luau +92 -53
  181. package/out/ui/packages/table/components/Table.styles.luau +23 -6
  182. package/out/ui/packages/table/components/tableColumns.d.ts +2 -0
  183. package/out/ui/packages/table/components/tableColumns.luau +2 -0
  184. package/out/ui/packages/tabs/components/Tabs.luau +7 -4
  185. package/out/ui/packages/tabs/components/Tabs.styles.luau +12 -11
  186. package/out/ui/packages/tabs/components/tabIndicator.d.ts +7 -0
  187. package/out/ui/packages/tabs/components/tabIndicator.luau +21 -0
  188. package/out/ui/packages/text/components/Text.d.ts +2 -0
  189. package/out/ui/packages/text/components/Text.luau +12 -2
  190. package/out/ui/packages/timeField/components/TimeField.luau +11 -7
  191. package/out/ui/packages/timeline/components/Timeline.luau +35 -32
  192. package/out/ui/packages/timeline/components/Timeline.styles.luau +19 -10
  193. package/out/ui/packages/toast/components/Toast.luau +168 -72
  194. package/out/ui/packages/toast/components/Toast.styles.luau +36 -19
  195. package/out/ui/packages/toast/components/toastPlace.d.ts +4 -0
  196. package/out/ui/packages/toast/components/toastPlace.luau +13 -0
  197. package/out/ui/packages/toast/enums/ToastVariants.d.ts +2 -1
  198. package/out/ui/packages/toast/enums/ToastVariants.luau +1 -0
  199. package/out/ui/packages/toggleButton/components/ToggleButton.luau +43 -4
  200. package/out/ui/packages/toggleButton/components/ToggleButton.styles.luau +1 -1
  201. package/out/ui/packages/tooltip/components/Tooltip.styles.luau +2 -2
  202. package/out/ui/packages/treeView/components/TreeView.luau +12 -13
  203. package/out/ui/packages/treeView/components/TreeView.styles.luau +6 -0
  204. package/out/ui/packages/typography/components/Typography.d.ts +2 -0
  205. package/out/ui/packages/typography/components/Typography.luau +8 -0
  206. package/out/ui/packages/typography/components/Typography.styles.luau +3 -1
  207. package/out/ui/packages/udimEditor/components/UDimEditor.luau +9 -1
  208. package/out/ui/packages/udimEditor/components/UDimEditor.styles.luau +25 -18
  209. package/out/ui/packages/vectorEditor/components/VectorEditor.luau +17 -3
  210. package/out/ui/packages/vectorEditor/components/VectorEditor.styles.luau +30 -16
  211. package/out/ui/packages/virtualList/components/VirtualList.styles.luau +1 -0
  212. package/package.json +69 -67
@@ -30,11 +30,15 @@ local useBadgeStyles = componentStyles("Badge", function(theme, _param)
30
30
  BorderSizePixel = 0,
31
31
  Font = theme.typography.fontFamilies.default,
32
32
  TextSize = theme.typography.fontSizes.caption,
33
- TextColor3 = if color == "error" then theme.palette.text.inverse else tone.on,
33
+ TextColor3 = tone.on,
34
34
  TextXAlignment = Enum.TextXAlignment.Center,
35
35
  TextYAlignment = Enum.TextYAlignment.Center,
36
36
  ZIndex = 2,
37
37
  },
38
+ inset = {
39
+ PaddingTop = UDim.new(0, diameter / 2),
40
+ PaddingRight = UDim.new(0, diameter / 2),
41
+ },
38
42
  padding = {
39
43
  PaddingLeft = UDim.new(0, if variant == "dot" then 0 else theme.padding.calc(0.5)),
40
44
  PaddingRight = UDim.new(0, if variant == "dot" then 0 else theme.padding.calc(0.5)),
@@ -41,7 +41,7 @@ local useBottomNavigationStyles = componentStyles("BottomNavigation", function(t
41
41
  _object_1.TextTruncate = Enum.TextTruncate.AtEnd
42
42
  _object[_left] = _object_1
43
43
  _object.selected = {
44
- TextColor3 = theme.palette.primary.main,
44
+ TextColor3 = theme.palette.text.primary,
45
45
  BackgroundColor3 = theme.palette.action.selected,
46
46
  BackgroundTransparency = 0.85,
47
47
  }
@@ -49,8 +49,9 @@ local useBottomNavigationStyles = componentStyles("BottomNavigation", function(t
49
49
  TextTransparency = 0.5,
50
50
  }
51
51
  _object.indicator = {
52
- Size = UDim2.new(1, 0, 0, 2),
53
- Position = UDim2.new(0, 0, 0, 0),
52
+ Size = UDim2.new(1, -theme.padding.calc(3), 0, 2),
53
+ Position = UDim2.new(0.5, 0, 0, theme.padding.calc(0.5)),
54
+ AnchorPoint = Vector2.new(0.5, 0),
54
55
  BackgroundColor3 = theme.palette.primary.main,
55
56
  BorderSizePixel = 0,
56
57
  }
@@ -66,7 +66,9 @@ local function Breadcrumbs(props)
66
66
  return setOpened(true)
67
67
  end,
68
68
  }
69
- _result = (React.createElement("textbutton", _attributes_2))
69
+ local _attributes_3 = table.clone(styles.cap)
70
+ setmetatable(_attributes_3, nil)
71
+ _result = (React.createElement("textbutton", _attributes_2, React.createElement("uisizeconstraint", _attributes_3)))
70
72
  else
71
73
  local _attributes_2 = table.clone(cx(styles.item, current and styles.current))
72
74
  setmetatable(_attributes_2, nil)
@@ -102,7 +104,9 @@ local function Breadcrumbs(props)
102
104
  return _result_1
103
105
  end,
104
106
  }
105
- _result = (React.createElement("textbutton", _attributes_2))
107
+ local _attributes_3 = table.clone(styles.cap)
108
+ setmetatable(_attributes_3, nil)
109
+ _result = (React.createElement("textbutton", _attributes_2, React.createElement("uisizeconstraint", _attributes_3)))
106
110
  end
107
111
  return React.createElement(React.Fragment, {
108
112
  key = `{entry.label}-{order}`,
@@ -32,6 +32,10 @@ local useBreadcrumbStyles = componentStyles("Breadcrumbs", function(theme)
32
32
  Font = theme.typography.fontFamilies.default,
33
33
  TextSize = theme.typography.fontSizes.body,
34
34
  TextColor3 = theme.palette.text.link,
35
+ TextTruncate = Enum.TextTruncate.AtEnd,
36
+ },
37
+ cap = {
38
+ MaxSize = Vector2.new(theme.spacing.calc(20), math.huge),
35
39
  },
36
40
  current = {
37
41
  TextColor3 = theme.palette.text.primary,
@@ -7,6 +7,7 @@ local useState = _react.useState
7
7
  local _theme = TS.import(script, script.Parent.Parent.Parent.Parent.Parent, "theme")
8
8
  local cx = _theme.cx
9
9
  local useTheme = _theme.useTheme
10
+ local useEditorHover = TS.import(script, script.Parent.Parent.Parent, "editorFace").useEditorHover
10
11
  local SxHost = TS.import(script, script.Parent.Parent.Parent, "host").SxHost
11
12
  local canActivate = TS.import(script, script.Parent.Parent.Parent, "button", "components", "activation").canActivate
12
13
  local Input = TS.import(script, script.Parent.Parent.Parent, "input").Input
@@ -30,12 +31,14 @@ local function BrickColorPicker(props)
30
31
  local id = _binding.id
31
32
  local ref = _binding.ref
32
33
  local styles = useBrickColorPickerStyles()
34
+ local hover = useEditorHover(disabled)
33
35
  local _binding_1 = useTheme()
34
36
  local theme = _binding_1.theme
35
37
  local active = canActivate(disabled)
36
38
  local anchor, setAnchor = useState()
37
39
  local open, setOpen = useState(false)
38
40
  local query, setQuery = useState("")
41
+ local over, setOver = useState("")
39
42
  local catalog = useMemo(function()
40
43
  return brickColorCatalog()
41
44
  end, {})
@@ -74,12 +77,18 @@ local function BrickColorPicker(props)
74
77
  end
75
78
  _attributes.key = _condition
76
79
  _attributes.hostRef = ref
77
- _attributes.base = styles.root
80
+ local _object = table.clone(styles.root)
81
+ setmetatable(_object, nil)
82
+ for _k, _v in hover.face do
83
+ _object[_k] = _v
84
+ end
85
+ _attributes.base = _object
78
86
  _attributes.className = className
79
87
  _attributes.sx = sx
80
88
  _attributes.state = {
81
89
  disabled = disabled,
82
90
  }
91
+ _attributes.Event = hover.event
83
92
  local _attributes_1 = {
84
93
  key = "Trigger",
85
94
  ref = setAnchor,
@@ -87,6 +96,9 @@ local function BrickColorPicker(props)
87
96
  for _k, _v in styles.trigger do
88
97
  _attributes_1[_k] = _v
89
98
  end
99
+ for _k, _v in (if hover.active then hover.face else {}) do
100
+ _attributes_1[_k] = _v
101
+ end
90
102
  _attributes_1.Active = active
91
103
  _attributes_1.Selectable = active
92
104
  _attributes_1.Event = {
@@ -188,11 +200,17 @@ local function BrickColorPicker(props)
188
200
  className = styles.list,
189
201
  renderItem = function(color)
190
202
  local picked = color.Number == value.Number
191
- local _attributes_14 = table.clone(cx(styles.option, picked and styles.selected))
203
+ local _attributes_14 = table.clone(cx(styles.option, over == color.Name and styles.highlighted, picked and styles.selected))
192
204
  setmetatable(_attributes_14, nil)
193
205
  _attributes_14.Active = true
194
206
  _attributes_14.Selectable = true
195
207
  _attributes_14.Event = {
208
+ MouseEnter = function()
209
+ return setOver(color.Name)
210
+ end,
211
+ MouseLeave = function()
212
+ return setOver("")
213
+ end,
196
214
  Activated = function()
197
215
  onChange(color)
198
216
  close()
@@ -3,8 +3,11 @@ local TS = _G[script]
3
3
  local _theme = TS.import(script, script.Parent.Parent.Parent.Parent.Parent, "theme")
4
4
  local createStyles = _theme.createStyles
5
5
  local componentStyles = _theme.componentStyles
6
+ local _editorFace = TS.import(script, script.Parent.Parent.Parent, "editorFace")
7
+ local editorPad = _editorFace.editorPad
8
+ local editorText = _editorFace.editorText
6
9
  local useBrickColorPickerStyles = componentStyles("BrickColorPicker", function(theme)
7
- return createStyles({
10
+ local _object = {
8
11
  root = {
9
12
  Size = UDim2.new(1, 0, 0, theme.spacing.calc(2)),
10
13
  BackgroundTransparency = 1,
@@ -12,7 +15,7 @@ local useBrickColorPickerStyles = componentStyles("BrickColorPicker", function(t
12
15
  },
13
16
  row = {
14
17
  FillDirection = Enum.FillDirection.Horizontal,
15
- Padding = UDim.new(0, theme.padding.calc(1)),
18
+ Padding = UDim.new(0, editorPad(theme)),
16
19
  VerticalAlignment = Enum.VerticalAlignment.Center,
17
20
  SortOrder = Enum.SortOrder.LayoutOrder,
18
21
  },
@@ -27,70 +30,73 @@ local useBrickColorPickerStyles = componentStyles("BrickColorPicker", function(t
27
30
  Size = UDim2.fromOffset(theme.spacing.calc(1.5), theme.spacing.calc(1.5)),
28
31
  BorderSizePixel = 0,
29
32
  },
30
- label = {
31
- Size = UDim2.new(1, -theme.spacing.calc(2.5), 1, 0),
32
- BackgroundTransparency = 1,
33
- BorderSizePixel = 0,
34
- Font = theme.typography.fontFamilies.default,
35
- TextSize = theme.typography.fontSizes.body,
36
- TextColor3 = theme.palette.text.primary,
37
- TextXAlignment = Enum.TextXAlignment.Left,
38
- TextTruncate = Enum.TextTruncate.AtEnd,
39
- },
40
- menu = {
41
- Size = UDim2.fromScale(1, 1),
42
- BackgroundColor3 = theme.palette.surface.elevated,
43
- BorderSizePixel = 0,
44
- },
45
- search = {
46
- Size = UDim2.new(1, 0, 0, theme.spacing.calc(2)),
47
- BackgroundTransparency = 1,
48
- },
49
- list = {
50
- Size = UDim2.fromScale(1, 1),
51
- BackgroundColor3 = theme.palette.surface.elevated,
52
- BorderSizePixel = 0,
53
- ScrollBarThickness = theme.padding.default,
54
- ScrollBarImageColor3 = theme.palette.text.secondary,
55
- ScrollingDirection = Enum.ScrollingDirection.Y,
56
- },
57
- option = {
58
- Size = UDim2.fromScale(1, 1),
59
- BackgroundColor3 = theme.palette.action.hover,
60
- BackgroundTransparency = 1,
61
- BorderSizePixel = 0,
62
- AutoButtonColor = false,
63
- Text = "",
64
- },
65
- highlighted = {
66
- BackgroundTransparency = 0,
67
- },
68
- selected = {
69
- BackgroundColor3 = theme.palette.action.selected,
70
- BackgroundTransparency = 0,
71
- },
72
- optionLabel = {
73
- Size = UDim2.new(1, -theme.spacing.calc(2.5), 1, 0),
74
- BackgroundTransparency = 1,
75
- BorderSizePixel = 0,
76
- Font = theme.typography.fontFamilies.default,
77
- TextSize = theme.typography.fontSizes.body,
78
- TextColor3 = theme.palette.text.primary,
79
- TextXAlignment = Enum.TextXAlignment.Left,
80
- TextTruncate = Enum.TextTruncate.AtEnd,
81
- },
82
- padding = {
83
- PaddingLeft = UDim.new(0, theme.padding.calc(1)),
84
- PaddingRight = UDim.new(0, theme.padding.calc(1)),
85
- },
86
- corner = {
87
- CornerRadius = UDim.new(0, theme.shape.borderRadius),
88
- },
89
- stroke = {
90
- Color = theme.palette.border,
91
- ApplyStrokeMode = Enum.ApplyStrokeMode.Border,
92
- },
93
- })
33
+ }
34
+ local _left = "label"
35
+ local _object_1 = {
36
+ Size = UDim2.new(1, -theme.spacing.calc(2.5), 1, 0),
37
+ BackgroundTransparency = 1,
38
+ BorderSizePixel = 0,
39
+ TextColor3 = theme.palette.text.primary,
40
+ }
41
+ for _k, _v in editorText(theme) do
42
+ _object_1[_k] = _v
43
+ end
44
+ _object[_left] = _object_1
45
+ _object.menu = {
46
+ Size = UDim2.fromScale(1, 1),
47
+ BackgroundColor3 = theme.palette.surface.elevated,
48
+ BorderSizePixel = 0,
49
+ }
50
+ _object.search = {
51
+ Size = UDim2.new(1, 0, 0, theme.spacing.calc(2)),
52
+ BackgroundTransparency = 1,
53
+ }
54
+ _object.list = {
55
+ Size = UDim2.fromScale(1, 1),
56
+ BackgroundColor3 = theme.palette.surface.elevated,
57
+ BorderSizePixel = 0,
58
+ ScrollBarThickness = editorPad(theme),
59
+ ScrollBarImageColor3 = theme.palette.text.secondary,
60
+ ScrollingDirection = Enum.ScrollingDirection.Y,
61
+ }
62
+ _object.option = {
63
+ Size = UDim2.fromScale(1, 1),
64
+ BackgroundColor3 = theme.palette.action.hover,
65
+ BackgroundTransparency = 1,
66
+ BorderSizePixel = 0,
67
+ AutoButtonColor = false,
68
+ Text = "",
69
+ }
70
+ _object.highlighted = {
71
+ BackgroundTransparency = 0,
72
+ }
73
+ _object.selected = {
74
+ BackgroundColor3 = theme.palette.action.selected,
75
+ BackgroundTransparency = 0,
76
+ }
77
+ local _left_1 = "optionLabel"
78
+ local _object_2 = {
79
+ Size = UDim2.new(1, -theme.spacing.calc(2.5), 1, 0),
80
+ BackgroundTransparency = 1,
81
+ BorderSizePixel = 0,
82
+ TextColor3 = theme.palette.text.primary,
83
+ }
84
+ for _k, _v in editorText(theme) do
85
+ _object_2[_k] = _v
86
+ end
87
+ _object[_left_1] = _object_2
88
+ _object.padding = {
89
+ PaddingLeft = UDim.new(0, editorPad(theme)),
90
+ PaddingRight = UDim.new(0, editorPad(theme)),
91
+ }
92
+ _object.corner = {
93
+ CornerRadius = UDim.new(0, theme.shape.borderRadius),
94
+ }
95
+ _object.stroke = {
96
+ Color = theme.palette.border,
97
+ ApplyStrokeMode = Enum.ApplyStrokeMode.Border,
98
+ }
99
+ return createStyles(_object)
94
100
  end)
95
101
  local default = useBrickColorPickerStyles
96
102
  return {
@@ -17,7 +17,9 @@ local buttonFace = _buttonLook.buttonFace
17
17
  local buttonIcon = _buttonLook.buttonIcon
18
18
  local spinnerPixels = _buttonLook.spinnerPixels
19
19
  local spinnerPlace = _buttonLook.spinnerPlace
20
+ local buttonPaint = TS.import(script, script.Parent, "buttonPaint").buttonPaint
20
21
  local useButtonStyles = TS.import(script, script.Parent, "Button.styles").default
22
+ local buttonColors
21
23
  local function Button(props)
22
24
  local _binding = props
23
25
  local text = _binding.text
@@ -81,20 +83,30 @@ local function Button(props)
81
83
  local grow = glyph ~= nil and props.fullWidth ~= true
82
84
  local reducedMotion = useReducedMotion(reducedProp)
83
85
  local hovering, setHovering = useState(false)
86
+ local down, setDown = useState(false)
84
87
  local focused, setFocused = useState(false)
85
88
  local active = canActivate(disabled, loading)
86
- local pressed = disabled or (not hoveringDisabled and active and (hovering or focused))
87
89
  local face = buttonFace(text, loading, loadingLabel)
88
90
  local place = spinnerPlace(loadingPosition)
89
91
  local busy = loading or animating
92
+ local sweep = animating and not loading
90
93
  local branded = (props.color or "primary") == "primary"
91
- local spinnerColor = if variant == "contained" then if branded then theme.palette.primary.on else theme.palette.text.inverse elseif branded then theme.palette.primary.main else theme.palette.text.primary
94
+ local paint = buttonPaint({
95
+ variant = variant,
96
+ branded = branded,
97
+ disabled = disabled,
98
+ hover = hovering and not hoveringDisabled and active,
99
+ down = down and active,
100
+ })
101
+ local colors = buttonColors(theme, paint)
102
+ local labelTransparency = if face.hideText then 1 else paint.labelTransparency
92
103
  useEffect(function()
93
104
  if active then
94
105
  return nil
95
106
  end
96
107
  setHovering(false)
97
108
  setFocused(false)
109
+ setDown(false)
98
110
  end, { active })
99
111
  local _attributes = {
100
112
  tag = "textbutton",
@@ -110,46 +122,30 @@ local function Button(props)
110
122
  for _k, _v in font do
111
123
  _object[_k] = _v
112
124
  end
125
+ _object.BackgroundColor3 = colors.fill
126
+ _object.BackgroundTransparency = paint.fillTransparency
127
+ _object.TextColor3 = colors.label
128
+ _object.TextTransparency = labelTransparency
113
129
  _attributes.base = _object
114
130
  _attributes.className = className
115
131
  _attributes.sx = sx
116
132
  _attributes.state = {
117
133
  disabled = disabled,
118
134
  loading = loading,
119
- hover = hovering,
120
- pressed = pressed,
135
+ hover = hovering and not hoveringDisabled,
136
+ pressed = down,
121
137
  focused = focused,
122
138
  }
123
139
  _attributes.Active = active
124
- _attributes.AutoButtonColor = active
140
+ _attributes.AutoButtonColor = false
125
141
  _attributes.Selectable = active
126
142
  _attributes.Text = if glyph ~= nil then "" else face.text
127
- for _k, _v in (if glyph ~= nil then {} elseif face.hideText then {
128
- TextTransparency = 1,
129
- } else {}) do
130
- _attributes[_k] = _v
131
- end
132
143
  for _k, _v in (if grow then {
133
144
  AutomaticSize = Enum.AutomaticSize.X,
134
145
  Size = UDim2.new(0, 0, 0, metrics.buttonHeight),
135
146
  } else {}) do
136
147
  _attributes[_k] = _v
137
148
  end
138
- local _result
139
- if pressed then
140
- _result = 0.75
141
- else
142
- local _result_1 = className
143
- if _result_1 ~= nil then
144
- _result_1 = _result_1.BackgroundTransparency
145
- end
146
- local _condition_1 = _result_1
147
- if _condition_1 == nil then
148
- _condition_1 = (if variant == "outlined" or variant == "text" then 1 else 0)
149
- end
150
- _result = _condition_1
151
- end
152
- _attributes.BackgroundTransparency = _result
153
149
  _attributes.Event = {
154
150
  MouseEnter = function()
155
151
  if not active then
@@ -162,6 +158,7 @@ local function Button(props)
162
158
  end,
163
159
  MouseLeave = function()
164
160
  setHovering(false)
161
+ setDown(false)
165
162
  if mouseLeave then
166
163
  mouseLeave()
167
164
  end
@@ -180,11 +177,16 @@ local function Button(props)
180
177
  end
181
178
  end,
182
179
  MouseButton1Down = function()
183
- if active and onLeftDown then
180
+ if not active then
181
+ return nil
182
+ end
183
+ setDown(true)
184
+ if onLeftDown then
184
185
  onLeftDown()
185
186
  end
186
187
  end,
187
188
  MouseButton1Up = function()
189
+ setDown(false)
188
190
  if active and onLeftUp then
189
191
  onLeftUp()
190
192
  end
@@ -205,21 +207,21 @@ local function Button(props)
205
207
  end
206
208
  end,
207
209
  }
208
- local _condition_1 = not busy and focused
210
+ local _condition_1 = not sweep and focused
209
211
  if _condition_1 then
210
212
  local _attributes_1 = table.clone(focus)
211
213
  setmetatable(_attributes_1, nil)
212
214
  _condition_1 = React.createElement("uistroke", _attributes_1)
213
215
  end
214
- local _condition_2 = not busy and not focused and variant == "outlined"
216
+ local _condition_2 = not sweep and not focused and variant == "outlined"
215
217
  if _condition_2 then
216
218
  local _attributes_1 = table.clone(stroke)
217
219
  setmetatable(_attributes_1, nil)
218
220
  _condition_2 = React.createElement("uistroke", _attributes_1)
219
221
  end
220
- local _exp = busy and React.createElement(LoadingStroke, {
221
- animating = busy and not reducedMotion,
222
- color = spinnerColor,
222
+ local _exp = sweep and React.createElement(LoadingStroke, {
223
+ animating = not reducedMotion,
224
+ color = colors.label,
223
225
  })
224
226
  local _condition_3 = rounded
225
227
  if _condition_3 then
@@ -230,7 +232,7 @@ local function Button(props)
230
232
  return React.createElement(SxHost, _attributes, _condition_1, _condition_2, _exp, _condition_3, loading and (React.createElement(CircularProgress, {
231
233
  size = spinnerPixels(props.size),
232
234
  thickness = 2,
233
- color = spinnerColor,
235
+ color = colors.label,
234
236
  reducedMotion = reducedMotion,
235
237
  className = {
236
238
  AnchorPoint = Vector2.new(place.anchorX, 0.5),
@@ -253,7 +255,8 @@ local function Button(props)
253
255
  BorderSizePixel = 0,
254
256
  ScaleType = Enum.ScaleType.Fit,
255
257
  Image = glyph,
256
- ImageColor3 = spinnerColor,
258
+ ImageColor3 = colors.label,
259
+ ImageTransparency = labelTransparency,
257
260
  Size = UDim2.fromOffset(metrics.icon, metrics.icon),
258
261
  }), React.createElement("textlabel", {
259
262
  key = "Label",
@@ -264,10 +267,34 @@ local function Button(props)
264
267
  Size = UDim2.fromScale(0, 0),
265
268
  Font = theme.typography.fontFamilies.default,
266
269
  TextSize = metrics.font,
267
- TextColor3 = spinnerColor,
270
+ TextColor3 = colors.label,
271
+ TextTransparency = labelTransparency,
268
272
  Text = face.text,
269
273
  }))), children)
270
274
  end
275
+ function buttonColors(theme, paint)
276
+ local brand = theme.palette.primary
277
+ local fills = {
278
+ primary = brand.main,
279
+ primaryHover = brand.hover,
280
+ primaryPressed = brand.pressed,
281
+ ink = theme.palette.text.primary,
282
+ actionHover = theme.palette.action.hover,
283
+ actionPressed = theme.palette.action.pressed,
284
+ none = theme.palette.surface.paper,
285
+ }
286
+ local labels = {
287
+ onPrimary = brand.on,
288
+ inverse = theme.palette.text.inverse,
289
+ primary = brand.main,
290
+ ink = theme.palette.text.primary,
291
+ disabled = theme.palette.text.disabled,
292
+ }
293
+ return {
294
+ fill = fills[paint.fill],
295
+ label = labels[paint.label],
296
+ }
297
+ end
271
298
  local default = Button
272
299
  return {
273
300
  default = default,
@@ -0,0 +1,16 @@
1
+ export type ButtonVariantName = "contained" | "outlined" | "text";
2
+ export type ButtonFill = "primary" | "primaryHover" | "primaryPressed" | "ink" | "actionHover" | "actionPressed" | "none";
3
+ export type ButtonLabel = "onPrimary" | "inverse" | "primary" | "ink" | "disabled";
4
+ export interface ButtonPaint {
5
+ fill: ButtonFill;
6
+ label: ButtonLabel;
7
+ fillTransparency: number;
8
+ labelTransparency: number;
9
+ }
10
+ export declare function buttonPaint(input: {
11
+ variant: ButtonVariantName;
12
+ branded: boolean;
13
+ disabled: boolean;
14
+ hover: boolean;
15
+ down: boolean;
16
+ }): ButtonPaint;
@@ -0,0 +1,70 @@
1
+ -- Compiled with roblox-ts v3.0.0
2
+ local function buttonPaint(input)
3
+ local contained = input.variant ~= "outlined" and input.variant ~= "text"
4
+ if input.disabled then
5
+ if contained then
6
+ return {
7
+ fill = if input.branded then "primary" else "ink",
8
+ label = if input.branded then "onPrimary" else "inverse",
9
+ fillTransparency = 0.45,
10
+ labelTransparency = 0.35,
11
+ }
12
+ end
13
+ return {
14
+ fill = "none",
15
+ label = "disabled",
16
+ fillTransparency = 1,
17
+ labelTransparency = 0,
18
+ }
19
+ end
20
+ if contained then
21
+ if input.down then
22
+ return {
23
+ fill = if input.branded then "primaryPressed" else "actionPressed",
24
+ label = if input.branded then "onPrimary" else "ink",
25
+ fillTransparency = 0,
26
+ labelTransparency = 0,
27
+ }
28
+ end
29
+ if input.hover then
30
+ return {
31
+ fill = if input.branded then "primaryHover" else "actionHover",
32
+ label = if input.branded then "onPrimary" else "ink",
33
+ fillTransparency = 0,
34
+ labelTransparency = 0,
35
+ }
36
+ end
37
+ return {
38
+ fill = if input.branded then "primary" else "ink",
39
+ label = if input.branded then "onPrimary" else "inverse",
40
+ fillTransparency = 0,
41
+ labelTransparency = 0,
42
+ }
43
+ end
44
+ local label = if input.branded then "primary" else "ink"
45
+ if input.down then
46
+ return {
47
+ fill = "actionPressed",
48
+ label = label,
49
+ fillTransparency = 0,
50
+ labelTransparency = 0,
51
+ }
52
+ end
53
+ if input.hover then
54
+ return {
55
+ fill = "actionHover",
56
+ label = label,
57
+ fillTransparency = 0,
58
+ labelTransparency = 0,
59
+ }
60
+ end
61
+ return {
62
+ fill = "none",
63
+ label = label,
64
+ fillTransparency = 1,
65
+ labelTransparency = 0,
66
+ }
67
+ end
68
+ return {
69
+ buttonPaint = buttonPaint,
70
+ }
@@ -8,6 +8,7 @@ export interface ButtonGroupProps {
8
8
  onItem?: (index: number) => void;
9
9
  disabled?: boolean;
10
10
  size?: ControlSize;
11
+ selected?: number;
11
12
  }
12
13
  declare function ButtonGroup(props: CustomizedProps<Frame, ButtonGroupProps>): JSX.Element;
13
14
  export default ButtonGroup;
@@ -1,6 +1,7 @@
1
1
  -- Compiled with roblox-ts v3.0.0
2
2
  local TS = _G[script]
3
3
  local React = TS.import(script, TS.getModule(script, "@rbxts", "react"))
4
+ local useTheme = TS.import(script, script.Parent.Parent.Parent.Parent.Parent, "theme").useTheme
4
5
  local canActivate = TS.import(script, script.Parent.Parent.Parent, "button", "components", "activation").canActivate
5
6
  local SxHost = TS.import(script, script.Parent.Parent.Parent, "host").SxHost
6
7
  local buttonGroupEdge = TS.import(script, script.Parent, "buttonGroupEdge").buttonGroupEdge
@@ -11,6 +12,7 @@ local function ButtonGroup(props)
11
12
  local onItem = _binding.onItem
12
13
  local disabled = _binding.disabled
13
14
  local size = _binding.size
15
+ local selected = _binding.selected
14
16
  local className = _binding.className
15
17
  local sx = _binding.sx
16
18
  local id = _binding.id
@@ -18,6 +20,8 @@ local function ButtonGroup(props)
18
20
  local styles = useButtonGroupStyles({
19
21
  size = size,
20
22
  })
23
+ local _binding_1 = useTheme()
24
+ local theme = _binding_1.theme
21
25
  local count = #items
22
26
  local groupOff = disabled == true
23
27
  local _attributes = {
@@ -49,6 +53,7 @@ local function ButtonGroup(props)
49
53
  local _callback = function(item, index)
50
54
  local off = groupOff or item.disabled == true
51
55
  local active = canActivate(off)
56
+ local picked = not off and index == selected
52
57
  local edge = buttonGroupEdge(index, count)
53
58
  local rule = edge == "start" or edge == "middle"
54
59
  local _attributes_4 = {
@@ -58,6 +63,9 @@ local function ButtonGroup(props)
58
63
  _attributes_4[_k] = _v
59
64
  end
60
65
  _attributes_4.Text = item.label
66
+ _attributes_4.TextColor3 = if picked then theme.palette.primary.on else theme.palette.text.primary
67
+ _attributes_4.BackgroundColor3 = theme.palette.primary.main
68
+ _attributes_4.BackgroundTransparency = if picked then 0 else 1
61
69
  _attributes_4.TextTransparency = if off then 0.5 else 0
62
70
  _attributes_4.Active = active
63
71
  _attributes_4.Selectable = active
@@ -74,7 +82,14 @@ local function ButtonGroup(props)
74
82
  }
75
83
  local _attributes_5 = table.clone(styles.pad)
76
84
  setmetatable(_attributes_5, nil)
77
- local _exp_3 = React.createElement("textbutton", _attributes_4, React.createElement("uipadding", _attributes_5))
85
+ local _exp_3 = React.createElement("uipadding", _attributes_5)
86
+ local _condition_1 = picked and edge ~= "middle"
87
+ if _condition_1 then
88
+ local _attributes_6 = table.clone(styles.corner)
89
+ setmetatable(_attributes_6, nil)
90
+ _condition_1 = React.createElement("uicorner", _attributes_6)
91
+ end
92
+ local _exp_4 = React.createElement("textbutton", _attributes_4, _exp_3, _condition_1)
78
93
  local _result
79
94
  if rule then
80
95
  local _attributes_6 = {
@@ -88,7 +103,7 @@ local function ButtonGroup(props)
88
103
  else
89
104
  _result = nil
90
105
  end
91
- return React.createElement(React.Fragment, nil, _exp_3, _result)
106
+ return React.createElement(React.Fragment, nil, _exp_4, _result)
92
107
  end
93
108
  for _k, _v in items do
94
109
  _newValue[_k] = _callback(_v, _k - 1, items)