@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
@@ -7,6 +7,9 @@ local useIconStyles = componentStyles("Icon", function(theme, props)
7
7
  local getIconSize = function(props)
8
8
  local _binding = props
9
9
  local size = _binding.size
10
+ if type(size) == "number" then
11
+ return UDim2.fromOffset(size, size)
12
+ end
10
13
  repeat
11
14
  if size == "xxs" then
12
15
  return UDim2.new(0, theme.spacing.calc(1), 0, theme.spacing.calc(1))
@@ -0,0 +1,28 @@
1
+ export type Glyph = "close" | "chevronDown" | "chevronRight" | "check" | "add" | "remove" | "search" | "menu" | "more" | "error" | "warning" | "info" | "success" | "folder" | "expand";
2
+ /** On a 24-unit grid. Bars run between two points, rings and dots sit on a center, boxes span a corner and size. */
3
+ export type GlyphPart = {
4
+ kind: "bar";
5
+ x1: number;
6
+ y1: number;
7
+ x2: number;
8
+ y2: number;
9
+ } | {
10
+ kind: "ring";
11
+ x: number;
12
+ y: number;
13
+ d: number;
14
+ } | {
15
+ kind: "dot";
16
+ x: number;
17
+ y: number;
18
+ d: number;
19
+ } | {
20
+ kind: "box";
21
+ x: number;
22
+ y: number;
23
+ w: number;
24
+ h: number;
25
+ };
26
+ export declare function glyphParts(name: Glyph): GlyphPart[];
27
+ /** Stroke weight for a glyph drawn at `size` pixels. */
28
+ export declare function glyphStroke(size: number): number;
@@ -0,0 +1,64 @@
1
+ -- Compiled with roblox-ts v3.0.0
2
+ --* On a 24-unit grid. Bars run between two points, rings and dots sit on a center, boxes span a corner and size.
3
+ local bar = function(x1, y1, x2, y2)
4
+ return {
5
+ kind = "bar",
6
+ x1 = x1,
7
+ y1 = y1,
8
+ x2 = x2,
9
+ y2 = y2,
10
+ }
11
+ end
12
+ local ring = function(x, y, d)
13
+ return {
14
+ kind = "ring",
15
+ x = x,
16
+ y = y,
17
+ d = d,
18
+ }
19
+ end
20
+ local dot = function(x, y, d)
21
+ return {
22
+ kind = "dot",
23
+ x = x,
24
+ y = y,
25
+ d = d,
26
+ }
27
+ end
28
+ local box = function(x, y, w, h)
29
+ return {
30
+ kind = "box",
31
+ x = x,
32
+ y = y,
33
+ w = w,
34
+ h = h,
35
+ }
36
+ end
37
+ local GLYPHS = {
38
+ close = { bar(6, 6, 18, 18), bar(18, 6, 6, 18) },
39
+ chevronDown = { bar(6, 9, 12, 15), bar(12, 15, 18, 9) },
40
+ chevronRight = { bar(9, 6, 15, 12), bar(15, 12, 9, 18) },
41
+ check = { bar(5, 12.5, 10, 17.5), bar(10, 17.5, 19, 7.5) },
42
+ add = { bar(12, 5, 12, 19), bar(5, 12, 19, 12) },
43
+ remove = { bar(5, 12, 19, 12) },
44
+ search = { ring(10.5, 10.5, 11), bar(15, 15, 19.5, 19.5) },
45
+ menu = { bar(4, 7, 20, 7), bar(4, 12, 20, 12), bar(4, 17, 20, 17) },
46
+ more = { dot(5.5, 12, 3.5), dot(12, 12, 3.5), dot(18.5, 12, 3.5) },
47
+ error = { ring(12, 12, 18), bar(12, 7.5, 12, 12.5), dot(12, 16, 2.5) },
48
+ warning = { bar(12, 4, 21, 19.5), bar(21, 19.5, 3, 19.5), bar(3, 19.5, 12, 4), bar(12, 9.5, 12, 14), dot(12, 17, 2.5) },
49
+ info = { ring(12, 12, 18), dot(12, 8, 2.5), bar(12, 11, 12, 16.5) },
50
+ success = { ring(12, 12, 18), bar(8, 12.5, 11, 15.5), bar(11, 15.5, 16.5, 9) },
51
+ folder = { box(3, 8, 18, 11), box(3, 5, 7, 4) },
52
+ expand = { bar(4, 9, 4, 4), bar(4, 4, 9, 4), bar(15, 4, 20, 4), bar(20, 4, 20, 9), bar(20, 15, 20, 20), bar(20, 20, 15, 20), bar(9, 20, 4, 20), bar(4, 20, 4, 15) },
53
+ }
54
+ local function glyphParts(name)
55
+ return GLYPHS[name]
56
+ end
57
+ --* Stroke weight for a glyph drawn at `size` pixels.
58
+ local function glyphStroke(size)
59
+ return math.max(1, math.floor(size / 9))
60
+ end
61
+ return {
62
+ glyphParts = glyphParts,
63
+ glyphStroke = glyphStroke,
64
+ }
@@ -1,3 +1,4 @@
1
1
  export { default as Icon } from "./components/Icon";
2
2
  export { IconProps } from "./components/Icon";
3
3
  export * from "./components/Icon";
4
+ export { Glyph } from "./components/glyphs";
@@ -1,9 +1,12 @@
1
1
  import { Icons } from "../../../enums/index";
2
2
  import { CustomizedProps } from "../../../../theme/index";
3
+ import { Glyph } from "../../icon/components/glyphs";
3
4
  import { TransportGlyph } from "./transportGlyph";
4
5
  export interface IconButtonProps {
5
- icon: Icons;
6
- glyph?: TransportGlyph;
6
+ icon?: Icons;
7
+ glyph?: TransportGlyph | Glyph;
8
+ /** Glyph pixels, usually `controlMetrics().icon`. `size` stays the hit target. */
9
+ iconSize?: number;
7
10
  size?: "xxs" | "xs" | "sm" | "md" | "lg" | "xl";
8
11
  tint: Color3;
9
12
  selected?: boolean;
@@ -5,16 +5,27 @@ local React = _react
5
5
  local useEffect = _react.useEffect
6
6
  local useState = _react.useState
7
7
  local useReducedMotion = TS.import(script, script.Parent.Parent.Parent.Parent.Parent, "hooks").useReducedMotion
8
+ local _theme = TS.import(script, script.Parent.Parent.Parent.Parent.Parent, "theme")
9
+ local focusRing = _theme.focusRing
10
+ local useTheme = _theme.useTheme
8
11
  local SxHost = TS.import(script, script.Parent.Parent.Parent, "host").SxHost
9
12
  local canActivate = TS.import(script, script.Parent.Parent.Parent, "button", "components", "activation").canActivate
10
13
  local iconSpinnerPixels = TS.import(script, script.Parent.Parent.Parent, "button", "components", "buttonLook").iconSpinnerPixels
11
14
  local CircularProgress = TS.import(script, script.Parent.Parent.Parent, "circularProgress").CircularProgress
15
+ local DrawnGlyph = TS.import(script, script.Parent.Parent.Parent, "icon", "components", "DrawnGlyph").DrawnGlyph
16
+ local _iconButtonBox = TS.import(script, script.Parent, "iconButtonBox")
17
+ local iconButtonFace = _iconButtonBox.iconButtonFace
18
+ local iconButtonScale = _iconButtonBox.iconButtonScale
19
+ local iconGlyphExtent = _iconButtonBox.iconGlyphExtent
12
20
  local useIconButtonStyles = TS.import(script, script.Parent, "IconButton.styles").default
13
- local transportGlyph = TS.import(script, script.Parent, "transportGlyph").transportGlyph
21
+ local _transportGlyph = TS.import(script, script.Parent, "transportGlyph")
22
+ local isTransportGlyph = _transportGlyph.isTransportGlyph
23
+ local transportGlyph = _transportGlyph.transportGlyph
14
24
  local function IconButton(props)
15
25
  local _binding = props
16
26
  local icon = _binding.icon
17
27
  local glyph = _binding.glyph
28
+ local iconSize = _binding.iconSize
18
29
  local selected = _binding.selected
19
30
  local tint = _binding.tint
20
31
  local disabled = _binding.disabled
@@ -31,28 +42,52 @@ local function IconButton(props)
31
42
  local _binding_1 = useIconButtonStyles(props)
32
43
  local container = _binding_1.container
33
44
  local corner = _binding_1.corner
45
+ local _binding_2 = useTheme()
46
+ local theme = _binding_2.theme
34
47
  local reducedMotion = useReducedMotion(reducedProp)
35
48
  local active = canActivate(disabled, loading)
36
- local drawn = if glyph ~= nil then transportGlyph(glyph) else nil
49
+ local extent = theme.spacing.calc(iconButtonScale(props.size))
50
+ local _condition = iconSize
51
+ if _condition == nil then
52
+ _condition = iconGlyphExtent(extent)
53
+ end
54
+ local glyphBox = _condition
55
+ local drawn = if glyph ~= nil and isTransportGlyph(glyph) and not loading then transportGlyph(glyph, glyphBox) else nil
56
+ local sketched = if glyph ~= nil and not isTransportGlyph(glyph) and not loading then glyph else nil
37
57
  local hovering, setHovering = useState(false)
58
+ local down, setDown = useState(false)
38
59
  local focused, setFocused = useState(false)
60
+ local face = iconButtonFace({
61
+ disabled = disabled == true,
62
+ loading = loading,
63
+ selected = selected == true,
64
+ hover = hovering and active,
65
+ down = down and active,
66
+ })
67
+ local fill = if face == "pressed" then theme.palette.action.pressed elseif face == "selected" then theme.palette.action.selected else theme.palette.action.hover
68
+ local mark = if disabled == true and not loading then 0.45 else 0
39
69
  useEffect(function()
40
70
  if active then
41
71
  return nil
42
72
  end
43
73
  setHovering(false)
74
+ setDown(false)
44
75
  setFocused(false)
45
76
  end, { active })
46
77
  local _attributes = {
47
78
  tag = "imagebutton",
48
79
  }
49
- local _condition = id
50
- if not (_condition ~= 0 and _condition == _condition and _condition ~= "" and _condition) then
51
- _condition = "IconButton"
80
+ local _condition_1 = id
81
+ if not (_condition_1 ~= 0 and _condition_1 == _condition_1 and _condition_1 ~= "" and _condition_1) then
82
+ _condition_1 = "IconButton"
52
83
  end
53
- _attributes.key = _condition
84
+ _attributes.key = _condition_1
54
85
  _attributes.hostRef = ref
55
- _attributes.base = container
86
+ local _object = table.clone(container)
87
+ setmetatable(_object, nil)
88
+ _object.BackgroundColor3 = fill
89
+ _object.BackgroundTransparency = if face == "clear" then 1 else 0
90
+ _attributes.base = _object
56
91
  _attributes.className = className
57
92
  _attributes.sx = sx
58
93
  _attributes.state = {
@@ -60,14 +95,14 @@ local function IconButton(props)
60
95
  loading = loading,
61
96
  selected = selected,
62
97
  hover = hovering,
98
+ pressed = down,
63
99
  focused = focused,
64
100
  }
65
101
  _attributes.Active = active
66
- _attributes.AutoButtonColor = active
102
+ _attributes.AutoButtonColor = false
67
103
  _attributes.Selectable = active
68
- _attributes.BackgroundTransparency = if loading then 1 elseif not active or hovering or selected or focused then 0.5 else 1
69
- _attributes.Image = if drawn ~= nil then "" else tostring(icon)
70
- _attributes.ImageTransparency = if drawn ~= nil or loading then 1 else 0
104
+ _attributes.Image = if drawn ~= nil or sketched ~= nil or icon == nil then "" else tostring(icon)
105
+ _attributes.ImageTransparency = if drawn ~= nil or sketched ~= nil or loading then 1 else mark
71
106
  _attributes.ImageColor3 = tint or container.ImageColor3
72
107
  _attributes.Event = {
73
108
  MouseButton1Click = function()
@@ -75,13 +110,22 @@ local function IconButton(props)
75
110
  onClick()
76
111
  end
77
112
  end,
113
+ MouseButton1Down = function()
114
+ if active then
115
+ setDown(true)
116
+ end
117
+ end,
118
+ MouseButton1Up = function()
119
+ return setDown(false)
120
+ end,
78
121
  MouseEnter = function()
79
122
  if active then
80
123
  setHovering(true)
81
124
  end
82
125
  end,
83
126
  MouseLeave = function()
84
- return setHovering(false)
127
+ setHovering(false)
128
+ setDown(false)
85
129
  end,
86
130
  SelectionGained = function()
87
131
  if active then
@@ -96,6 +140,14 @@ local function IconButton(props)
96
140
  setmetatable(_attributes_1, nil)
97
141
  local _exp = React.createElement("uicorner", _attributes_1)
98
142
  local _result
143
+ if focused and active then
144
+ local _attributes_2 = table.clone(focusRing(theme.palette.focus))
145
+ setmetatable(_attributes_2, nil)
146
+ _result = React.createElement("uistroke", _attributes_2)
147
+ else
148
+ _result = nil
149
+ end
150
+ local _result_1
99
151
  if drawn ~= nil then
100
152
  -- ▼ ReadonlyArray.map ▼
101
153
  local _newValue = table.create(#drawn)
@@ -105,6 +157,7 @@ local function IconButton(props)
105
157
  Position = UDim2.fromOffset(part.x, part.y),
106
158
  Size = UDim2.fromOffset(math.max(part.w, 1), math.max(part.h, 1)),
107
159
  BackgroundColor3 = tint,
160
+ BackgroundTransparency = mark,
108
161
  BorderSizePixel = 0,
109
162
  ZIndex = 12001,
110
163
  })
@@ -113,19 +166,33 @@ local function IconButton(props)
113
166
  _newValue[_k] = _callback(_v, _k - 1, drawn)
114
167
  end
115
168
  -- ▲ ReadonlyArray.map ▲
116
- _result = (React.createElement("frame", {
169
+ _result_1 = (React.createElement("frame", {
117
170
  key = "Glyph",
118
171
  AnchorPoint = Vector2.new(0.5, 0.5),
119
172
  Position = UDim2.fromScale(0.5, 0.5),
120
- Size = UDim2.fromOffset(16, 16),
173
+ Size = UDim2.fromOffset(glyphBox, glyphBox),
121
174
  BackgroundTransparency = 1,
122
175
  BorderSizePixel = 0,
123
176
  ZIndex = 12001,
124
177
  }, _newValue))
125
178
  else
126
- _result = nil
179
+ _result_1 = nil
127
180
  end
128
- return React.createElement(SxHost, _attributes, _exp, _result, loading and (React.createElement(CircularProgress, {
181
+ return React.createElement(SxHost, _attributes, _exp, _result, _result_1, sketched ~= nil and (React.createElement("frame", {
182
+ key = "Glyph",
183
+ AnchorPoint = Vector2.new(0.5, 0.5),
184
+ Position = UDim2.fromScale(0.5, 0.5),
185
+ Size = UDim2.fromOffset(glyphBox, glyphBox),
186
+ BackgroundTransparency = 1,
187
+ BorderSizePixel = 0,
188
+ ZIndex = 12001,
189
+ }, React.createElement(DrawnGlyph, {
190
+ name = sketched,
191
+ size = glyphBox,
192
+ color = tint,
193
+ transparency = mark,
194
+ zIndex = 12001,
195
+ }))), loading and (React.createElement(CircularProgress, {
129
196
  size = iconSpinnerPixels(props.size),
130
197
  thickness = 2,
131
198
  color = tint,
@@ -3,35 +3,12 @@ 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 iconButtonScale = TS.import(script, script.Parent, "iconButtonBox").iconButtonScale
6
7
  local useIconButtonStyles = componentStyles("IconButton", function(theme, props)
7
- local getIconSize = function(props)
8
- local _binding = props
9
- local size = _binding.size
10
- repeat
11
- if size == "xxs" then
12
- return UDim2.new(0, theme.spacing.calc(1), 0, theme.spacing.calc(1))
13
- end
14
- if size == "xs" then
15
- return UDim2.new(0, theme.spacing.calc(1.5), 0, theme.spacing.calc(1.5))
16
- end
17
- if size == "sm" then
18
- return UDim2.new(0, theme.spacing.calc(2), 0, theme.spacing.calc(2))
19
- end
20
- if size == "md" then
21
- return UDim2.new(0, theme.spacing.calc(3), 0, theme.spacing.calc(3))
22
- end
23
- if size == "lg" then
24
- return UDim2.new(0, theme.spacing.calc(4), 0, theme.spacing.calc(4))
25
- end
26
- if size == "xl" then
27
- return UDim2.new(0, theme.spacing.calc(5), 0, theme.spacing.calc(5))
28
- end
29
- return UDim2.new(0, theme.spacing.calc(2), 0, theme.spacing.calc(2))
30
- until true
31
- end
8
+ local extent = theme.spacing.calc(iconButtonScale(props.size))
32
9
  return createStyles({
33
10
  container = {
34
- Size = getIconSize(props),
11
+ Size = UDim2.new(0, extent, 0, extent),
35
12
  BackgroundColor3 = theme.palette.primary.main,
36
13
  ImageColor3 = theme.palette.text.primary,
37
14
  BackgroundTransparency = 1,
@@ -40,7 +17,7 @@ local useIconButtonStyles = componentStyles("IconButton", function(theme, props)
40
17
  ZIndex = 12000,
41
18
  },
42
19
  corner = {
43
- CornerRadius = UDim.new(0, theme.shape.borderRadius),
20
+ CornerRadius = UDim.new(theme.shape.pillScale / 2, 0),
44
21
  },
45
22
  })
46
23
  end)
@@ -0,0 +1,11 @@
1
+ export declare function iconButtonScale(size?: string): 4 | 1 | 2 | 3 | 5 | 1.5;
2
+ /** Glyph box inside the button. A fixed 16px mark overflows the small sizes and looks lost in the large ones. */
3
+ export declare function iconGlyphExtent(button: number): number;
4
+ export type IconButtonFace = "clear" | "hover" | "pressed" | "selected";
5
+ export declare function iconButtonFace(input: {
6
+ disabled: boolean;
7
+ loading: boolean;
8
+ selected: boolean;
9
+ hover: boolean;
10
+ down: boolean;
11
+ }): IconButtonFace;
@@ -0,0 +1,48 @@
1
+ -- Compiled with roblox-ts v3.0.0
2
+ local function iconButtonScale(size)
3
+ repeat
4
+ if size == "xxs" then
5
+ return 1
6
+ end
7
+ if size == "xs" then
8
+ return 1.5
9
+ end
10
+ if size == "sm" then
11
+ return 2
12
+ end
13
+ if size == "md" then
14
+ return 3
15
+ end
16
+ if size == "lg" then
17
+ return 4
18
+ end
19
+ if size == "xl" then
20
+ return 5
21
+ end
22
+ return 2
23
+ until true
24
+ end
25
+ --* Glyph box inside the button. A fixed 16px mark overflows the small sizes and looks lost in the large ones.
26
+ local function iconGlyphExtent(button)
27
+ return math.max(4, math.floor(button * 0.62))
28
+ end
29
+ local function iconButtonFace(input)
30
+ if input.disabled or input.loading then
31
+ return "clear"
32
+ end
33
+ if input.down then
34
+ return "pressed"
35
+ end
36
+ if input.selected then
37
+ return "selected"
38
+ end
39
+ if input.hover then
40
+ return "hover"
41
+ end
42
+ return "clear"
43
+ end
44
+ return {
45
+ iconButtonScale = iconButtonScale,
46
+ iconGlyphExtent = iconGlyphExtent,
47
+ iconButtonFace = iconButtonFace,
48
+ }
@@ -1,4 +1,5 @@
1
1
  export type TransportGlyph = "play" | "pause" | "previous" | "next";
2
+ export declare function isTransportGlyph(name: string): name is TransportGlyph;
2
3
  export interface GlyphRect {
3
4
  x: number;
4
5
  y: number;
@@ -1,4 +1,7 @@
1
1
  -- Compiled with roblox-ts v3.0.0
2
+ local function isTransportGlyph(name)
3
+ return name == "play" or name == "pause" or name == "previous" or name == "next"
4
+ end
2
5
  local function wedge(size, pointRight)
3
6
  local steps = 6
4
7
  local h = math.max(1, math.floor(size / steps))
@@ -69,5 +72,6 @@ local function transportGlyph(name, size)
69
72
  return _array
70
73
  end
71
74
  return {
75
+ isTransportGlyph = isTransportGlyph,
72
76
  transportGlyph = transportGlyph,
73
77
  }
@@ -1,15 +1,12 @@
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 TextService = TS.import(script, TS.getModule(script, "@rbxts", "services")).TextService
5
- local useTheme = TS.import(script, script.Parent.Parent.Parent.Parent.Parent, "theme").useTheme
6
4
  local SxHost = TS.import(script, script.Parent.Parent.Parent, "host").SxHost
7
5
  local _imageListLayout = TS.import(script, script.Parent, "imageListLayout")
8
6
  local imageListCell = _imageListLayout.imageListCell
9
7
  local imageListItemAspect = _imageListLayout.imageListItemAspect
10
8
  local imageListSelected = _imageListLayout.imageListSelected
11
9
  local imageListTitle = _imageListLayout.imageListTitle
12
- local imageListTitleWrap = _imageListLayout.imageListTitleWrap
13
10
  local useImageListStyles = TS.import(script, script.Parent, "ImageList.styles").default
14
11
  local function ImageList(props)
15
12
  local _binding = props
@@ -24,30 +21,20 @@ local function ImageList(props)
24
21
  local sx = _binding.sx
25
22
  local id = _binding.id
26
23
  local ref = _binding.ref
27
- local _binding_1 = useTheme()
28
- local theme = _binding_1.theme
29
24
  local styles = useImageListStyles({
30
25
  cols = cols,
31
26
  gap = gap,
32
27
  itemSize = itemSize,
33
28
  aspect = aspect,
34
29
  })
35
- local font = theme.typography.fontFamilies.default or Enum.Font.SourceSans
36
- local _condition = theme.typography.fontSizes.caption
37
- if _condition == nil then
38
- _condition = 12
39
- end
40
- local textSize = _condition
41
- local pad = theme.spacing.calc(0.5) * 2
42
- local bar = theme.spacing.calc(2.5)
43
30
  local _attributes = {
44
31
  tag = "frame",
45
32
  }
46
- local _condition_1 = id
47
- if not (_condition_1 ~= 0 and _condition_1 == _condition_1 and _condition_1 ~= "" and _condition_1) then
48
- _condition_1 = "ImageList"
33
+ local _condition = id
34
+ if not (_condition ~= 0 and _condition == _condition and _condition ~= "" and _condition) then
35
+ _condition = "ImageList"
49
36
  end
50
- _attributes.key = _condition_1
37
+ _attributes.key = _condition
51
38
  _attributes.hostRef = ref
52
39
  _attributes.base = styles.root
53
40
  _attributes.className = className
@@ -61,8 +48,6 @@ local function ImageList(props)
61
48
  local title = imageListTitle(item.title)
62
49
  local picked = imageListSelected(selected, index)
63
50
  local cell = imageListCell(itemSize, imageListItemAspect(item.aspect, aspect))
64
- local textWidth = if title ~= nil then TextService:GetTextSize(title, textSize, font, Vector2.new(10000, 100)).X else 0
65
- local wrap = title ~= nil and imageListTitleWrap(textWidth, cell.width - pad)
66
51
  local _attributes_2 = {
67
52
  key = `Tile-{index}`,
68
53
  }
@@ -88,11 +73,11 @@ local function ImageList(props)
88
73
  local _attributes_3 = table.clone(styles.corner)
89
74
  setmetatable(_attributes_3, nil)
90
75
  local _exp_1 = React.createElement("uicorner", _attributes_3)
91
- local _condition_2 = picked
92
- if _condition_2 then
76
+ local _condition_1 = picked
77
+ if _condition_1 then
93
78
  local _attributes_4 = table.clone(styles.selected)
94
79
  setmetatable(_attributes_4, nil)
95
- _condition_2 = React.createElement("uistroke", _attributes_4)
80
+ _condition_1 = React.createElement("uistroke", _attributes_4)
96
81
  end
97
82
  local _attributes_4 = {
98
83
  key = "Image",
@@ -102,8 +87,8 @@ local function ImageList(props)
102
87
  end
103
88
  _attributes_4.Image = item.src
104
89
  local _exp_2 = React.createElement("imagelabel", _attributes_4)
105
- local _condition_3 = title ~= nil
106
- if _condition_3 then
90
+ local _condition_2 = title ~= nil
91
+ if _condition_2 then
107
92
  local _attributes_5 = {
108
93
  key = "Title",
109
94
  }
@@ -111,21 +96,11 @@ local function ImageList(props)
111
96
  _attributes_5[_k] = _v
112
97
  end
113
98
  _attributes_5.Text = title
114
- for _k, _v in (if wrap then {
115
- AnchorPoint = Vector2.new(0, 1),
116
- Position = UDim2.new(0, 0, 1, 0),
117
- Size = UDim2.new(1, 0, 0, bar),
118
- AutomaticSize = Enum.AutomaticSize.Y,
119
- TextWrapped = true,
120
- TextTruncate = Enum.TextTruncate.None,
121
- } else {}) do
122
- _attributes_5[_k] = _v
123
- end
124
99
  local _attributes_6 = table.clone(styles.titlePad)
125
100
  setmetatable(_attributes_6, nil)
126
- _condition_3 = (React.createElement("textlabel", _attributes_5, React.createElement("uipadding", _attributes_6)))
101
+ _condition_2 = (React.createElement("textlabel", _attributes_5, React.createElement("uipadding", _attributes_6)))
127
102
  end
128
- return React.createElement("imagebutton", _attributes_2, _exp_1, _condition_2, _exp_2, _condition_3)
103
+ return React.createElement("imagebutton", _attributes_2, _exp_1, _condition_1, _exp_2, _condition_2)
129
104
  end
130
105
  for _k, _v in items do
131
106
  _newValue[_k] = _callback(_v, _k - 1, items)
@@ -65,6 +65,7 @@ local useImageListStyles = componentStyles("ImageList", function(theme, _param)
65
65
  TextColor3 = Common.White,
66
66
  TextXAlignment = Enum.TextXAlignment.Left,
67
67
  TextTruncate = Enum.TextTruncate.AtEnd,
68
+ TextWrapped = false,
68
69
  ZIndex = 2,
69
70
  },
70
71
  titlePad = {
@@ -10,5 +10,3 @@ export declare function imageListCell(itemSize?: number, aspect?: number): {
10
10
  };
11
11
  export declare function imageListSelected(selected: ReadonlyArray<number> | undefined, index: number): boolean;
12
12
  export declare function imageListTitle(title?: string): string | undefined;
13
- /** A title wider than the tile wraps. A short title stays one line. */
14
- export declare function imageListTitleWrap(textWidth: number, box: number): boolean;
@@ -55,13 +55,6 @@ local function imageListTitle(title)
55
55
  end
56
56
  return title
57
57
  end
58
- --* A title wider than the tile wraps. A short title stays one line.
59
- local function imageListTitleWrap(textWidth, box)
60
- if box <= 0 then
61
- return false
62
- end
63
- return textWidth > box
64
- end
65
58
  return {
66
59
  imageListCols = imageListCols,
67
60
  imageListGap = imageListGap,
@@ -71,5 +64,4 @@ return {
71
64
  imageListCell = imageListCell,
72
65
  imageListSelected = imageListSelected,
73
66
  imageListTitle = imageListTitle,
74
- imageListTitleWrap = imageListTitleWrap,
75
67
  }
@@ -26,6 +26,7 @@ export * from "./copyButton/index";
26
26
  export * from "./checkbox/index";
27
27
  export * from "./colorPicker/index";
28
28
  export * from "./fontEditor/index";
29
+ export * from "./codeEditor/index";
29
30
  export * from "./loadingStroke/index";
30
31
  export * from "./numberInput/index";
31
32
  export * from "./numberRangeEditor/index";
@@ -85,6 +85,9 @@ end
85
85
  for _k, _v in TS.import(script, script, "fontEditor") or {} do
86
86
  exports[_k] = _v
87
87
  end
88
+ for _k, _v in TS.import(script, script, "codeEditor") or {} do
89
+ exports[_k] = _v
90
+ end
88
91
  for _k, _v in TS.import(script, script, "loadingStroke") or {} do
89
92
  exports[_k] = _v
90
93
  end