@rbxts/uiblox 0.2.0-alpha.2 → 0.2.0-alpha.20

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 (234) hide show
  1. package/README.md +2 -0
  2. package/out/theme/constants/NumberConstants.d.ts +2 -0
  3. package/out/theme/constants/NumberConstants.luau +3 -0
  4. package/out/theme/interfaces/spacing/Shape.d.ts +3 -0
  5. package/out/theme/interfaces/typography/FontSizes.d.ts +1 -1
  6. package/out/theme/interfaces/typography/FontSizes.luau +15 -8
  7. package/out/theme/interfaces/typography/ThemeTypography.d.ts +3 -0
  8. package/out/theme/interfaces/typography/Variants.d.ts +14 -15
  9. package/out/theme/interfaces/typography/Variants.luau +68 -18
  10. package/out/theme/themes/DarkTheme.luau +4 -0
  11. package/out/theme/themes/LightTheme.luau +4 -0
  12. package/out/ui/packages/accordion/components/Accordion.d.ts +2 -0
  13. package/out/ui/packages/accordion/components/Accordion.luau +36 -16
  14. package/out/ui/packages/accordion/components/Accordion.styles.d.ts +1 -0
  15. package/out/ui/packages/accordion/components/Accordion.styles.luau +16 -4
  16. package/out/ui/packages/accordion/components/accordionOpen.d.ts +1 -0
  17. package/out/ui/packages/accordion/components/accordionOpen.luau +4 -0
  18. package/out/ui/packages/alert/components/Alert.d.ts +2 -0
  19. package/out/ui/packages/alert/components/Alert.luau +40 -27
  20. package/out/ui/packages/alert/components/Alert.styles.d.ts +2 -0
  21. package/out/ui/packages/alert/components/Alert.styles.luau +17 -8
  22. package/out/ui/packages/appBar/components/AppBar.d.ts +2 -1
  23. package/out/ui/packages/appBar/components/AppBar.luau +5 -0
  24. package/out/ui/packages/appBar/components/AppBar.styles.d.ts +2 -0
  25. package/out/ui/packages/appBar/components/AppBar.styles.luau +6 -2
  26. package/out/ui/packages/autocomplete/components/Autocomplete.luau +8 -0
  27. package/out/ui/packages/avatar/components/Avatar.d.ts +2 -0
  28. package/out/ui/packages/avatar/components/Avatar.luau +20 -12
  29. package/out/ui/packages/avatar/components/Avatar.styles.d.ts +2 -0
  30. package/out/ui/packages/avatar/components/Avatar.styles.luau +5 -1
  31. package/out/ui/packages/backdrop/components/Backdrop.d.ts +10 -0
  32. package/out/ui/packages/backdrop/components/Backdrop.luau +58 -0
  33. package/out/ui/packages/backdrop/components/Backdrop.styles.d.ts +4 -0
  34. package/out/ui/packages/backdrop/components/Backdrop.styles.luau +24 -0
  35. package/out/ui/packages/backdrop/index.d.ts +2 -0
  36. package/out/ui/packages/backdrop/init.luau +5 -0
  37. package/out/ui/packages/badge/components/Badge.d.ts +3 -0
  38. package/out/ui/packages/badge/components/Badge.luau +23 -8
  39. package/out/ui/packages/badge/components/Badge.styles.d.ts +5 -1
  40. package/out/ui/packages/badge/components/Badge.styles.luau +20 -8
  41. package/out/ui/packages/bottomNavigation/components/BottomNavigation.d.ts +1 -0
  42. package/out/ui/packages/bottomNavigation/components/BottomNavigation.luau +8 -2
  43. package/out/ui/packages/bottomNavigation/components/BottomNavigation.styles.d.ts +3 -1
  44. package/out/ui/packages/bottomNavigation/components/BottomNavigation.styles.luau +6 -2
  45. package/out/ui/packages/breadcrumbs/components/Breadcrumbs.d.ts +1 -0
  46. package/out/ui/packages/breadcrumbs/components/Breadcrumbs.luau +58 -24
  47. package/out/ui/packages/breadcrumbs/components/breadcrumbItems.d.ts +9 -0
  48. package/out/ui/packages/breadcrumbs/components/breadcrumbItems.luau +68 -0
  49. package/out/ui/packages/breadcrumbs/index.d.ts +1 -0
  50. package/out/ui/packages/breadcrumbs/init.luau +3 -0
  51. package/out/ui/packages/brickColorPicker/components/brickColorCatalog.luau +1 -1
  52. package/out/ui/packages/button/components/Button.luau +9 -5
  53. package/out/ui/packages/card/components/Card.d.ts +1 -0
  54. package/out/ui/packages/card/components/Card.luau +2 -0
  55. package/out/ui/packages/checkbox/components/checkboxLook.d.ts +1 -1
  56. package/out/ui/packages/chip/components/Chip.d.ts +6 -1
  57. package/out/ui/packages/chip/components/Chip.luau +49 -2
  58. package/out/ui/packages/chip/components/Chip.styles.d.ts +6 -0
  59. package/out/ui/packages/chip/components/Chip.styles.luau +55 -10
  60. package/out/ui/packages/circularProgress/components/CircularProgress.luau +13 -2
  61. package/out/ui/packages/dialog/components/Dialog.d.ts +1 -1
  62. package/out/ui/packages/dialog/components/Dialog.luau +27 -18
  63. package/out/ui/packages/divider/components/Divider.d.ts +1 -0
  64. package/out/ui/packages/divider/components/Divider.luau +48 -0
  65. package/out/ui/packages/divider/components/Divider.styles.luau +29 -0
  66. package/out/ui/packages/divider/components/dividerLabel.d.ts +1 -0
  67. package/out/ui/packages/divider/components/dividerLabel.luau +10 -0
  68. package/out/ui/packages/drawer/components/Drawer.d.ts +1 -0
  69. package/out/ui/packages/drawer/components/Drawer.luau +4 -1
  70. package/out/ui/packages/drawer/components/Drawer.styles.d.ts +3 -1
  71. package/out/ui/packages/drawer/components/Drawer.styles.luau +3 -2
  72. package/out/ui/packages/fab/components/Fab.d.ts +3 -0
  73. package/out/ui/packages/fab/components/Fab.luau +62 -25
  74. package/out/ui/packages/fab/components/Fab.styles.d.ts +3 -0
  75. package/out/ui/packages/fab/components/Fab.styles.luau +33 -3
  76. package/out/ui/packages/fab/components/fabSize.d.ts +1 -0
  77. package/out/ui/packages/fab/components/fabSize.luau +4 -0
  78. package/out/ui/packages/fab/index.d.ts +1 -1
  79. package/out/ui/packages/fab/init.luau +1 -0
  80. package/out/ui/packages/formText/components/FormHelperText.d.ts +8 -0
  81. package/out/ui/packages/formText/components/FormHelperText.luau +44 -0
  82. package/out/ui/packages/formText/components/FormLabel.d.ts +9 -0
  83. package/out/ui/packages/formText/components/FormLabel.luau +46 -0
  84. package/out/ui/packages/formText/components/FormText.styles.d.ts +5 -0
  85. package/out/ui/packages/formText/components/FormText.styles.luau +33 -0
  86. package/out/ui/packages/formText/index.d.ts +4 -0
  87. package/out/ui/packages/formText/init.luau +6 -0
  88. package/out/ui/packages/iconButton/components/IconButton.luau +7 -2
  89. package/out/ui/packages/iconButton/components/IconButton.styles.luau +3 -0
  90. package/out/ui/packages/imageList/components/ImageList.d.ts +14 -0
  91. package/out/ui/packages/imageList/components/ImageList.luau +100 -0
  92. package/out/ui/packages/imageList/components/ImageList.styles.d.ts +6 -0
  93. package/out/ui/packages/imageList/components/ImageList.styles.luau +73 -0
  94. package/out/ui/packages/imageList/components/imageListLayout.d.ts +4 -0
  95. package/out/ui/packages/imageList/components/imageListLayout.luau +31 -0
  96. package/out/ui/packages/imageList/index.d.ts +2 -0
  97. package/out/ui/packages/imageList/init.luau +5 -0
  98. package/out/ui/packages/index.d.ts +7 -0
  99. package/out/ui/packages/init.luau +21 -0
  100. package/out/ui/packages/input/components/Input.d.ts +1 -0
  101. package/out/ui/packages/input/components/Input.luau +8 -3
  102. package/out/ui/packages/layout/components/Box.d.ts +11 -0
  103. package/out/ui/packages/layout/components/Box.luau +49 -0
  104. package/out/ui/packages/layout/components/Box.styles.d.ts +7 -0
  105. package/out/ui/packages/layout/components/Box.styles.luau +34 -0
  106. package/out/ui/packages/layout/components/Container.d.ts +10 -0
  107. package/out/ui/packages/layout/components/Container.luau +54 -0
  108. package/out/ui/packages/layout/components/Container.styles.d.ts +6 -0
  109. package/out/ui/packages/layout/components/Container.styles.luau +41 -0
  110. package/out/ui/packages/layout/components/Grid.d.ts +1 -1
  111. package/out/ui/packages/layout/components/Stack.d.ts +12 -0
  112. package/out/ui/packages/layout/components/Stack.luau +49 -0
  113. package/out/ui/packages/layout/components/Stack.styles.d.ts +8 -0
  114. package/out/ui/packages/layout/components/Stack.styles.luau +72 -0
  115. package/out/ui/packages/layout/components/boxPad.d.ts +14 -0
  116. package/out/ui/packages/layout/components/boxPad.luau +59 -0
  117. package/out/ui/packages/layout/components/containerWidth.d.ts +2 -0
  118. package/out/ui/packages/layout/components/containerWidth.luau +17 -0
  119. package/out/ui/packages/layout/components/stackAlign.d.ts +8 -0
  120. package/out/ui/packages/layout/components/stackAlign.luau +29 -0
  121. package/out/ui/packages/layout/index.d.ts +10 -0
  122. package/out/ui/packages/layout/init.luau +4 -0
  123. package/out/ui/packages/link/components/Link.d.ts +11 -0
  124. package/out/ui/packages/link/components/Link.luau +83 -0
  125. package/out/ui/packages/link/components/Link.styles.d.ts +8 -0
  126. package/out/ui/packages/link/components/Link.styles.luau +59 -0
  127. package/out/ui/packages/link/index.d.ts +3 -0
  128. package/out/ui/packages/link/init.luau +5 -0
  129. package/out/ui/packages/listItem/components/ListItem.d.ts +2 -0
  130. package/out/ui/packages/listItem/components/ListItem.luau +22 -1
  131. package/out/ui/packages/listItem/components/ListItem.styles.d.ts +1 -0
  132. package/out/ui/packages/listItem/components/ListItem.styles.luau +16 -5
  133. package/out/ui/packages/loadingStroke/components/LoadingStroke.d.ts +2 -0
  134. package/out/ui/packages/loadingStroke/components/LoadingStroke.luau +23 -19
  135. package/out/ui/packages/menu/components/Menu.d.ts +5 -0
  136. package/out/ui/packages/menu/components/Menu.luau +54 -23
  137. package/out/ui/packages/menu/components/Menu.styles.luau +5 -1
  138. package/out/ui/packages/modal/components/Modal.d.ts +1 -1
  139. package/out/ui/packages/modal/components/Modal.luau +55 -37
  140. package/out/ui/packages/motion/index.d.ts +1 -1
  141. package/out/ui/packages/motion/init.luau +1 -0
  142. package/out/ui/packages/motion/unit.d.ts +5 -0
  143. package/out/ui/packages/motion/unit.luau +23 -0
  144. package/out/ui/packages/numberInput/components/NumberInput.d.ts +1 -0
  145. package/out/ui/packages/numberInput/components/NumberInput.luau +2 -0
  146. package/out/ui/packages/pagination/components/Pagination.d.ts +4 -1
  147. package/out/ui/packages/pagination/components/Pagination.luau +41 -22
  148. package/out/ui/packages/pagination/components/Pagination.styles.d.ts +4 -1
  149. package/out/ui/packages/pagination/components/Pagination.styles.luau +19 -4
  150. package/out/ui/packages/pagination/components/pageRange.d.ts +2 -1
  151. package/out/ui/packages/pagination/components/pageRange.luau +91 -8
  152. package/out/ui/packages/pagination/index.d.ts +1 -0
  153. package/out/ui/packages/pagination/init.luau +1 -0
  154. package/out/ui/packages/paper/components/Paper.d.ts +2 -1
  155. package/out/ui/packages/paper/components/Paper.luau +14 -3
  156. package/out/ui/packages/paper/components/Paper.styles.d.ts +1 -1
  157. package/out/ui/packages/paper/components/Paper.styles.luau +6 -0
  158. package/out/ui/packages/popup/index.d.ts +1 -0
  159. package/out/ui/packages/popup/init.luau +1 -0
  160. package/out/ui/packages/radioGroup/components/RadioGroup.d.ts +1 -0
  161. package/out/ui/packages/radioGroup/components/RadioGroup.luau +4 -2
  162. package/out/ui/packages/radioGroup/components/RadioGroup.styles.d.ts +1 -0
  163. package/out/ui/packages/radioGroup/components/RadioGroup.styles.luau +4 -1
  164. package/out/ui/packages/rating/components/Rating.d.ts +11 -0
  165. package/out/ui/packages/rating/components/Rating.luau +101 -0
  166. package/out/ui/packages/rating/components/Rating.styles.d.ts +6 -0
  167. package/out/ui/packages/rating/components/Rating.styles.luau +44 -0
  168. package/out/ui/packages/rating/index.d.ts +2 -0
  169. package/out/ui/packages/rating/init.luau +5 -0
  170. package/out/ui/packages/select/components/Select.d.ts +5 -0
  171. package/out/ui/packages/select/components/Select.luau +48 -24
  172. package/out/ui/packages/select/components/Select.styles.luau +1 -1
  173. package/out/ui/packages/skeleton/components/Skeleton.luau +3 -2
  174. package/out/ui/packages/skeleton/components/Skeleton.styles.luau +7 -2
  175. package/out/ui/packages/skeleton/components/skeletonMotion.luau +1 -1
  176. package/out/ui/packages/skeleton/components/skeletonTone.d.ts +20 -0
  177. package/out/ui/packages/skeleton/components/skeletonTone.luau +14 -0
  178. package/out/ui/packages/slider/components/Slider.d.ts +3 -0
  179. package/out/ui/packages/slider/components/Slider.luau +32 -3
  180. package/out/ui/packages/slider/components/Slider.styles.d.ts +2 -0
  181. package/out/ui/packages/slider/components/Slider.styles.luau +14 -1
  182. package/out/ui/packages/slider/components/sliderMarks.d.ts +1 -0
  183. package/out/ui/packages/slider/components/sliderMarks.luau +37 -0
  184. package/out/ui/packages/snackbar/components/Snackbar.d.ts +2 -0
  185. package/out/ui/packages/snackbar/components/Snackbar.luau +5 -0
  186. package/out/ui/packages/snackbar/components/snackbarAction.d.ts +1 -0
  187. package/out/ui/packages/snackbar/components/snackbarAction.luau +10 -0
  188. package/out/ui/packages/speedDial/components/SpeedDial.d.ts +19 -0
  189. package/out/ui/packages/speedDial/components/SpeedDial.luau +101 -0
  190. package/out/ui/packages/speedDial/components/SpeedDial.styles.d.ts +5 -0
  191. package/out/ui/packages/speedDial/components/SpeedDial.styles.luau +31 -0
  192. package/out/ui/packages/speedDial/index.d.ts +3 -0
  193. package/out/ui/packages/speedDial/init.luau +5 -0
  194. package/out/ui/packages/splitPane/components/splitLook.d.ts +1 -1
  195. package/out/ui/packages/stateMatrix.d.ts +2 -0
  196. package/out/ui/packages/stateMatrix.luau +809 -252
  197. package/out/ui/packages/stepper/components/Stepper.d.ts +1 -0
  198. package/out/ui/packages/stepper/components/Stepper.luau +7 -1
  199. package/out/ui/packages/stepper/components/Stepper.styles.d.ts +3 -1
  200. package/out/ui/packages/stepper/components/Stepper.styles.luau +6 -2
  201. package/out/ui/packages/switch/components/Switch.d.ts +2 -0
  202. package/out/ui/packages/switch/components/Switch.luau +5 -0
  203. package/out/ui/packages/switch/components/Switch.styles.d.ts +2 -0
  204. package/out/ui/packages/switch/components/Switch.styles.luau +7 -2
  205. package/out/ui/packages/switch/components/switchLook.d.ts +1 -1
  206. package/out/ui/packages/table/components/Table.d.ts +1 -0
  207. package/out/ui/packages/table/components/Table.luau +4 -1
  208. package/out/ui/packages/table/components/Table.styles.d.ts +3 -1
  209. package/out/ui/packages/table/components/Table.styles.luau +10 -6
  210. package/out/ui/packages/tabs/components/Tabs.d.ts +3 -0
  211. package/out/ui/packages/tabs/components/Tabs.luau +12 -3
  212. package/out/ui/packages/tabs/components/Tabs.styles.d.ts +5 -1
  213. package/out/ui/packages/tabs/components/Tabs.styles.luau +26 -10
  214. package/out/ui/packages/tabs/components/tabsOrientation.d.ts +2 -0
  215. package/out/ui/packages/tabs/components/tabsOrientation.luau +7 -0
  216. package/out/ui/packages/tabs/index.d.ts +1 -0
  217. package/out/ui/packages/tabs/init.luau +1 -0
  218. package/out/ui/packages/toast/components/Toast.d.ts +2 -0
  219. package/out/ui/packages/toast/components/Toast.luau +26 -1
  220. package/out/ui/packages/toast/components/Toast.styles.luau +22 -4
  221. package/out/ui/packages/toggleButton/components/ToggleButton.d.ts +19 -0
  222. package/out/ui/packages/toggleButton/components/ToggleButton.luau +135 -0
  223. package/out/ui/packages/toggleButton/components/ToggleButton.styles.d.ts +7 -0
  224. package/out/ui/packages/toggleButton/components/ToggleButton.styles.luau +65 -0
  225. package/out/ui/packages/toggleButton/index.d.ts +2 -0
  226. package/out/ui/packages/toggleButton/init.luau +7 -0
  227. package/out/ui/packages/typography/components/Typography.styles.luau +4 -5
  228. package/out/ui/packages/virtualList/components/EmptyListHint.d.ts +6 -0
  229. package/out/ui/packages/virtualList/components/EmptyListHint.luau +32 -0
  230. package/out/ui/packages/virtualList/components/EmptyListHint.styles.d.ts +5 -0
  231. package/out/ui/packages/virtualList/components/EmptyListHint.styles.luau +26 -0
  232. package/out/ui/packages/virtualList/index.d.ts +2 -0
  233. package/out/ui/packages/virtualList/init.luau +1 -0
  234. package/package.json +2 -2
package/README.md CHANGED
@@ -36,6 +36,8 @@ npm install @rbxts/uiblox
36
36
  4. Use packaged components from `@rbxts/uiblox` (`Button`, `Input`, `Select`, …).
37
37
  5. Preview components in [Storyblox](https://github.com/bjlarouche/storyblox) with `*.stories` modules.
38
38
 
39
+ Token reference (spacing, density, typography, shape, palette, `resolveStyle`): [docs/STYLING.md](docs/STYLING.md).
40
+
39
41
  ```tsx
40
42
  import React from "@rbxts/react";
41
43
  import { Button, DarkTheme, ThemeProvider } from "@rbxts/uiblox";
@@ -2,5 +2,7 @@ import { IconSizes } from "../interfaces/iconSizes/index";
2
2
  export declare const SPACING_BASE = 8;
3
3
  export declare const PADDING_BASE = 4;
4
4
  export declare const BORDER_RADIUS = 4;
5
+ /** UICorner scale for pill/capsule controls (1 = fully round). */
6
+ export declare const PILL_SCALE = 1;
5
7
  export declare const CONTENT_WIDTH = 1024;
6
8
  export declare const ICON_SIZES: IconSizes;
@@ -2,6 +2,8 @@
2
2
  local SPACING_BASE = 8
3
3
  local PADDING_BASE = 4
4
4
  local BORDER_RADIUS = 4
5
+ --* UICorner scale for pill/capsule controls (1 = fully round).
6
+ local PILL_SCALE = 1
5
7
  local CONTENT_WIDTH = 1024
6
8
  local ICON_SIZES = {
7
9
  small = 16,
@@ -12,6 +14,7 @@ return {
12
14
  SPACING_BASE = SPACING_BASE,
13
15
  PADDING_BASE = PADDING_BASE,
14
16
  BORDER_RADIUS = BORDER_RADIUS,
17
+ PILL_SCALE = PILL_SCALE,
15
18
  CONTENT_WIDTH = CONTENT_WIDTH,
16
19
  ICON_SIZES = ICON_SIZES,
17
20
  }
@@ -1,3 +1,6 @@
1
1
  export default interface Shape {
2
+ /** Pixel radius for squared controls (Button, Input, Paper). */
2
3
  borderRadius: number;
4
+ /** UICorner scale for capsules (Switch, Chip). Use `new UDim(pillScale, 0)`. */
5
+ pillScale: number;
3
6
  }
@@ -1,3 +1,3 @@
1
1
  import { FontSizeOptions } from "./FontSizeOptions";
2
- export declare const baseFontSize = 14;
2
+ export declare const baseFontSize: number;
3
3
  export declare const allFontSizes: FontSizeOptions;
@@ -1,13 +1,20 @@
1
1
  -- Compiled with roblox-ts v3.0.0
2
- local baseFontSize = 14
2
+ local TS = _G[script]
3
+ local allTypographyVariants = TS.import(script, script.Parent, "Variants").allTypographyVariants
4
+ local baseFontSize = allTypographyVariants.body.size
3
5
  local allFontSizes = {
4
- h1 = 28,
5
- h2 = 22,
6
- h3 = 18,
7
- body = baseFontSize,
8
- caption = 12,
9
- overline = 10,
10
- button = 13,
6
+ h1 = allTypographyVariants.h1.size,
7
+ h2 = allTypographyVariants.h2.size,
8
+ h3 = allTypographyVariants.h3.size,
9
+ h4 = allTypographyVariants.h4.size,
10
+ h5 = allTypographyVariants.h5.size,
11
+ h6 = allTypographyVariants.h6.size,
12
+ subtitle1 = allTypographyVariants.subtitle1.size,
13
+ subtitle2 = allTypographyVariants.subtitle2.size,
14
+ body = allTypographyVariants.body.size,
15
+ caption = allTypographyVariants.caption.size,
16
+ overline = allTypographyVariants.overline.size,
17
+ button = allTypographyVariants.button.size,
11
18
  }
12
19
  return {
13
20
  baseFontSize = baseFontSize,
@@ -1,7 +1,10 @@
1
1
  import { FontFamilyOptions } from "./FontFamilyOptions";
2
2
  import { FontSizeOptions } from "./FontSizeOptions";
3
+ import { FontSizeVariant } from "./FontSizeOptions";
4
+ import { TypographyVariantSpec } from "./Variants";
3
5
  interface ThemeTypography {
4
6
  fontSizes: FontSizeOptions;
5
7
  fontFamilies: FontFamilyOptions;
8
+ variants: Record<FontSizeVariant, TypographyVariantSpec>;
6
9
  }
7
10
  export default ThemeTypography;
@@ -1,18 +1,17 @@
1
- import { Tokens } from "../tokens/Tokens";
2
- export type TypographyTokens = {
3
- [key in Tokens]: string;
4
- };
5
- export interface TypographyWeights {
1
+ import { FontFamilyVariant } from "./FontFamilyOptions";
2
+ import { FontSizeVariant } from "./FontSizeOptions";
3
+ export interface TypographyVariantSpec {
4
+ size: number;
5
+ family: FontFamilyVariant;
6
+ /** Approx CSS weight; Roblox TextLabel uses `family` / FontFace */
7
+ weight: number;
8
+ }
9
+ export type TypographyVariants = FontSizeVariant;
10
+ /** Size + family + weight per typography variant. */
11
+ export declare const allTypographyVariants: Record<FontSizeVariant, TypographyVariantSpec>;
12
+ /** @deprecated prefer allTypographyVariants[*].weight */
13
+ export declare const TypographyWeights: {
6
14
  title: number;
7
15
  heading: number;
8
16
  body: number;
9
- xl?: number;
10
- lg?: number;
11
- md?: number;
12
- sm?: number;
13
- xs?: number;
14
- default?: number;
15
- }
16
- export type TypographyVariants = keyof TypographyWeights;
17
- export declare const TypographyWeights: TypographyWeights;
18
- export declare const TypographyTokens: TypographyTokens;
17
+ };
@@ -1,24 +1,74 @@
1
1
  -- Compiled with roblox-ts v3.0.0
2
- local TypographyWeights = {
3
- title = 800,
4
- heading = 500,
5
- body = 300,
2
+ --* Size + family + weight per typography variant.
3
+ local allTypographyVariants = {
4
+ h1 = {
5
+ size = 28,
6
+ family = "bold",
7
+ weight = 700,
8
+ },
9
+ h2 = {
10
+ size = 22,
11
+ family = "bold",
12
+ weight = 700,
13
+ },
14
+ h3 = {
15
+ size = 18,
16
+ family = "semibold",
17
+ weight = 600,
18
+ },
19
+ h4 = {
20
+ size = 16,
21
+ family = "semibold",
22
+ weight = 600,
23
+ },
24
+ h5 = {
25
+ size = 14,
26
+ family = "semibold",
27
+ weight = 600,
28
+ },
29
+ h6 = {
30
+ size = 14,
31
+ family = "semibold",
32
+ weight = 600,
33
+ },
34
+ subtitle1 = {
35
+ size = 16,
36
+ family = "default",
37
+ weight = 400,
38
+ },
39
+ subtitle2 = {
40
+ size = 14,
41
+ family = "semibold",
42
+ weight = 600,
43
+ },
44
+ body = {
45
+ size = 14,
46
+ family = "default",
47
+ weight = 400,
48
+ },
49
+ button = {
50
+ size = 13,
51
+ family = "semibold",
52
+ weight = 600,
53
+ },
54
+ caption = {
55
+ size = 12,
56
+ family = "default",
57
+ weight = 400,
58
+ },
59
+ overline = {
60
+ size = 10,
61
+ family = "default",
62
+ weight = 400,
63
+ },
6
64
  }
7
- local TypographyTokens = {
8
- [120] = "64px",
9
- [110] = "48px",
10
- [100] = "40px",
11
- [90] = "32px",
12
- [80] = "28px",
13
- [70] = "24px",
14
- [60] = "20px",
15
- [50] = "18px",
16
- [40] = "16px",
17
- [30] = "14px",
18
- [20] = "12px",
19
- [10] = "10px",
65
+ --* @deprecated prefer allTypographyVariants[*].weight
66
+ local TypographyWeights = {
67
+ title = 700,
68
+ heading = 600,
69
+ body = 400,
20
70
  }
21
71
  return {
22
- TypographyTokens = TypographyTokens,
72
+ allTypographyVariants = allTypographyVariants,
23
73
  TypographyWeights = TypographyWeights,
24
74
  }
@@ -6,9 +6,11 @@ local BORDER_RADIUS = _NumberConstants.BORDER_RADIUS
6
6
  local CONTENT_WIDTH = _NumberConstants.CONTENT_WIDTH
7
7
  local ICON_SIZES = _NumberConstants.ICON_SIZES
8
8
  local PADDING_BASE = _NumberConstants.PADDING_BASE
9
+ local PILL_SCALE = _NumberConstants.PILL_SCALE
9
10
  local SPACING_BASE = _NumberConstants.SPACING_BASE
10
11
  local DEFAULT_BORDERS = TS.import(script, script.Parent.Parent, "constants", "ColorConstants").DEFAULT_BORDERS
11
12
  local allFontFamilies = TS.import(script, script.Parent.Parent, "interfaces", "typography", "FontFamilies").allFontFamilies
13
+ local allTypographyVariants = TS.import(script, script.Parent.Parent, "interfaces", "typography", "Variants").allTypographyVariants
12
14
  local createDarkPalette = TS.import(script, script.Parent, "createPalette").createDarkPalette
13
15
  local DarkTheme = {
14
16
  type = "Dark",
@@ -28,10 +30,12 @@ local DarkTheme = {
28
30
  },
29
31
  shape = {
30
32
  borderRadius = BORDER_RADIUS,
33
+ pillScale = PILL_SCALE,
31
34
  },
32
35
  typography = {
33
36
  fontSizes = allFontSizes,
34
37
  fontFamilies = allFontFamilies,
38
+ variants = allTypographyVariants,
35
39
  },
36
40
  options = {
37
41
  constants = {
@@ -6,9 +6,11 @@ local BORDER_RADIUS = _NumberConstants.BORDER_RADIUS
6
6
  local CONTENT_WIDTH = _NumberConstants.CONTENT_WIDTH
7
7
  local ICON_SIZES = _NumberConstants.ICON_SIZES
8
8
  local PADDING_BASE = _NumberConstants.PADDING_BASE
9
+ local PILL_SCALE = _NumberConstants.PILL_SCALE
9
10
  local SPACING_BASE = _NumberConstants.SPACING_BASE
10
11
  local DEFAULT_BORDERS = TS.import(script, script.Parent.Parent, "constants", "ColorConstants").DEFAULT_BORDERS
11
12
  local allFontFamilies = TS.import(script, script.Parent.Parent, "interfaces", "typography", "FontFamilies").allFontFamilies
13
+ local allTypographyVariants = TS.import(script, script.Parent.Parent, "interfaces", "typography", "Variants").allTypographyVariants
12
14
  local createLightPalette = TS.import(script, script.Parent, "createPalette").createLightPalette
13
15
  local LightTheme = {
14
16
  type = "Light",
@@ -28,10 +30,12 @@ local LightTheme = {
28
30
  },
29
31
  shape = {
30
32
  borderRadius = BORDER_RADIUS,
33
+ pillScale = PILL_SCALE,
31
34
  },
32
35
  typography = {
33
36
  fontSizes = allFontSizes,
34
37
  fontFamilies = allFontFamilies,
38
+ variants = allTypographyVariants,
35
39
  },
36
40
  options = {
37
41
  constants = {
@@ -4,6 +4,8 @@ export interface AccordionProps {
4
4
  title: string;
5
5
  open?: boolean;
6
6
  defaultOpen?: boolean;
7
+ disabled?: boolean;
8
+ square?: boolean;
7
9
  onChange?: (open: boolean) => void;
8
10
  children?: React.ReactNode;
9
11
  }
@@ -3,13 +3,18 @@ local TS = _G[script]
3
3
  local _react = TS.import(script, TS.getModule(script, "@rbxts", "react"))
4
4
  local React = _react
5
5
  local useState = _react.useState
6
- local accordionOpen = TS.import(script, script.Parent, "accordionOpen").accordionOpen
6
+ local Icons = TS.import(script, script.Parent.Parent.Parent.Parent, "enums").Icons
7
+ local _accordionOpen = TS.import(script, script.Parent, "accordionOpen")
8
+ local accordionGlyph = _accordionOpen.accordionGlyph
9
+ local accordionOpen = _accordionOpen.accordionOpen
7
10
  local useAccordionStyles = TS.import(script, script.Parent, "Accordion.styles").default
8
11
  local function Accordion(props)
9
12
  local _binding = props
10
13
  local title = _binding.title
11
14
  local controlled = _binding.open
12
15
  local defaultOpen = _binding.defaultOpen
16
+ local disabled = _binding.disabled
17
+ local square = _binding.square
13
18
  local onChange = _binding.onChange
14
19
  local children = _binding.children
15
20
  local className = _binding.className
@@ -20,8 +25,12 @@ local function Accordion(props)
20
25
  local open = accordionOpen(localOpen, controlled)
21
26
  local styles = useAccordionStyles({
22
27
  open = open,
28
+ disabled = disabled,
23
29
  })
24
30
  local toggle = function()
31
+ if disabled == true then
32
+ return nil
33
+ end
25
34
  local nextOpen = not open
26
35
  if controlled == nil then
27
36
  setLocalOpen(nextOpen)
@@ -51,32 +60,43 @@ local function Accordion(props)
51
60
  _attributes[_k] = _v
52
61
  end
53
62
  end
54
- local _attributes_1 = table.clone(styles.corner)
63
+ local _condition_1 = square ~= true
64
+ if _condition_1 then
65
+ local _attributes_1 = table.clone(styles.corner)
66
+ setmetatable(_attributes_1, nil)
67
+ _condition_1 = React.createElement("uicorner", _attributes_1)
68
+ end
69
+ local _attributes_1 = table.clone(styles.list)
55
70
  setmetatable(_attributes_1, nil)
56
- local _exp = React.createElement("uicorner", _attributes_1)
57
- local _attributes_2 = table.clone(styles.list)
58
- setmetatable(_attributes_2, nil)
59
- local _exp_1 = React.createElement("uilistlayout", _attributes_2)
60
- local _attributes_3 = {
71
+ local _exp = React.createElement("uilistlayout", _attributes_1)
72
+ local _attributes_2 = {
61
73
  key = "Header",
62
74
  }
63
75
  for _k, _v in styles.header do
64
- _attributes_3[_k] = _v
76
+ _attributes_2[_k] = _v
65
77
  end
66
- _attributes_3.Event = {
78
+ _attributes_2.Event = {
67
79
  Activated = toggle,
68
80
  }
69
- local _attributes_4 = table.clone(styles.padding)
70
- setmetatable(_attributes_4, nil)
71
- local _exp_2 = React.createElement("uipadding", _attributes_4)
72
- local _attributes_5 = {
81
+ local _attributes_3 = table.clone(styles.padding)
82
+ setmetatable(_attributes_3, nil)
83
+ local _exp_1 = React.createElement("uipadding", _attributes_3)
84
+ local _attributes_4 = {
73
85
  key = "Title",
74
86
  }
75
87
  for _k, _v in styles.title do
88
+ _attributes_4[_k] = _v
89
+ end
90
+ _attributes_4.Text = title
91
+ local _exp_2 = React.createElement("textlabel", _attributes_4)
92
+ local _attributes_5 = {
93
+ key = "Icon",
94
+ }
95
+ for _k, _v in styles.icon do
76
96
  _attributes_5[_k] = _v
77
97
  end
78
- _attributes_5.Text = title
79
- local _exp_3 = React.createElement("textbutton", _attributes_3, _exp_2, React.createElement("textlabel", _attributes_5))
98
+ _attributes_5.Image = if accordionGlyph(open) == "expanded" then Icons.Expanded else Icons.Collapsed
99
+ local _exp_3 = React.createElement("textbutton", _attributes_2, _exp_1, _exp_2, React.createElement("imagelabel", _attributes_5))
80
100
  local _attributes_6 = {
81
101
  key = "Body",
82
102
  }
@@ -85,7 +105,7 @@ local function Accordion(props)
85
105
  end
86
106
  local _attributes_7 = table.clone(styles.padding)
87
107
  setmetatable(_attributes_7, nil)
88
- return React.createElement("frame", _attributes, _exp, _exp_1, _exp_3, React.createElement("frame", _attributes_6, React.createElement("uipadding", _attributes_7), children))
108
+ return React.createElement("frame", _attributes, _condition_1, _exp, _exp_3, React.createElement("frame", _attributes_6, React.createElement("uipadding", _attributes_7), children))
89
109
  end
90
110
  local default = Accordion
91
111
  return {
@@ -1,4 +1,5 @@
1
1
  declare const useAccordionStyles: (props: {
2
2
  open?: boolean;
3
+ disabled?: boolean;
3
4
  }) => import("../../../../theme/index").ClassNameMap<string>;
4
5
  export default useAccordionStyles;
@@ -8,6 +8,7 @@ local useAccordionStyles = componentStyles("Accordion", function(theme, _param)
8
8
  if open == nil then
9
9
  open = false
10
10
  end
11
+ local disabled = _param.disabled
11
12
  return createStyles({
12
13
  root = {
13
14
  AutomaticSize = Enum.AutomaticSize.Y,
@@ -27,19 +28,30 @@ local useAccordionStyles = componentStyles("Accordion", function(theme, _param)
27
28
  BorderSizePixel = 0,
28
29
  AutoButtonColor = false,
29
30
  Text = "",
30
- Active = true,
31
- Selectable = true,
31
+ Active = disabled ~= true,
32
+ Selectable = disabled ~= true,
32
33
  },
33
34
  title = {
34
- AutomaticSize = Enum.AutomaticSize.XY,
35
- Size = UDim2.fromScale(0, 0),
35
+ AutomaticSize = Enum.AutomaticSize.Y,
36
+ Size = UDim2.new(1, -theme.spacing.calc(4), 0, 0),
36
37
  BackgroundTransparency = 1,
37
38
  BorderSizePixel = 0,
38
39
  Font = theme.typography.fontFamilies.default,
39
40
  TextSize = theme.typography.fontSizes.body,
40
41
  TextColor3 = theme.palette.text.primary,
42
+ TextTransparency = if disabled == true then 0.5 else 0,
41
43
  TextXAlignment = Enum.TextXAlignment.Left,
42
44
  },
45
+ icon = {
46
+ Size = UDim2.fromOffset(theme.options.constants.iconSizes.small, theme.options.constants.iconSizes.small),
47
+ Position = UDim2.new(1, -theme.padding.calc(1.5), 0.5, 0),
48
+ AnchorPoint = Vector2.new(1, 0.5),
49
+ BackgroundTransparency = 1,
50
+ BorderSizePixel = 0,
51
+ ScaleType = Enum.ScaleType.Fit,
52
+ ImageColor3 = theme.palette.text.primary,
53
+ ImageTransparency = if disabled == true then 0.5 else 0,
54
+ },
43
55
  padding = {
44
56
  PaddingTop = UDim.new(0, theme.padding.calc(1)),
45
57
  PaddingBottom = UDim.new(0, theme.padding.calc(1)),
@@ -1 +1,2 @@
1
1
  export declare function accordionOpen(expanded: boolean | undefined, controlled: boolean | undefined): boolean;
2
+ export declare function accordionGlyph(open?: boolean): "expanded" | "collapsed";
@@ -5,6 +5,10 @@ local function accordionOpen(expanded, controlled)
5
5
  end
6
6
  return expanded == true
7
7
  end
8
+ local function accordionGlyph(open)
9
+ return if open == true then "expanded" else "collapsed"
10
+ end
8
11
  return {
9
12
  accordionOpen = accordionOpen,
13
+ accordionGlyph = accordionGlyph,
10
14
  }
@@ -5,6 +5,8 @@ export interface AlertProps {
5
5
  title?: string;
6
6
  message: string;
7
7
  onClose?: () => void;
8
+ filled?: boolean;
9
+ square?: boolean;
8
10
  }
9
11
  declare function Alert(props: CustomizedProps<Frame, AlertProps>): JSX.Element;
10
12
  export default Alert;
@@ -9,12 +9,17 @@ local function Alert(props)
9
9
  local title = _binding.title
10
10
  local message = _binding.message
11
11
  local onClose = _binding.onClose
12
+ local filled = _binding.filled
13
+ local square = _binding.square
12
14
  local className = _binding.className
13
15
  local sx = _binding.sx
14
16
  local id = _binding.id
15
17
  local ref = _binding.ref
18
+ local dismissible = onClose ~= nil
16
19
  local styles = useAlertStyles({
17
20
  severity = severity,
21
+ dismissible = dismissible,
22
+ filled = filled,
18
23
  })
19
24
  local _attributes = {}
20
25
  local _condition = id
@@ -39,17 +44,42 @@ local function Alert(props)
39
44
  local _attributes_1 = table.clone(styles.padding)
40
45
  setmetatable(_attributes_1, nil)
41
46
  local _exp = React.createElement("uipadding", _attributes_1)
42
- local _attributes_2 = table.clone(styles.corner)
47
+ local _condition_1 = square ~= true
48
+ if _condition_1 then
49
+ local _attributes_2 = table.clone(styles.corner)
50
+ setmetatable(_attributes_2, nil)
51
+ _condition_1 = React.createElement("uicorner", _attributes_2)
52
+ end
53
+ local _attributes_2 = table.clone(styles.stroke)
43
54
  setmetatable(_attributes_2, nil)
44
- local _exp_1 = React.createElement("uicorner", _attributes_2)
45
- local _attributes_3 = table.clone(styles.stroke)
46
- setmetatable(_attributes_3, nil)
47
- local _exp_2 = React.createElement("uistroke", _attributes_3)
55
+ local _exp_1 = React.createElement("uistroke", _attributes_2)
56
+ local _condition_2 = dismissible
57
+ if _condition_2 then
58
+ local _attributes_3 = {
59
+ key = "Close",
60
+ }
61
+ for _k, _v in styles.close do
62
+ _attributes_3[_k] = _v
63
+ end
64
+ _attributes_3.Image = tostring(Icons.Close)
65
+ _attributes_3.Event = {
66
+ Activated = function()
67
+ return onClose()
68
+ end,
69
+ }
70
+ _condition_2 = (React.createElement("imagebutton", _attributes_3))
71
+ end
72
+ local _attributes_3 = {
73
+ key = "Body",
74
+ }
75
+ for _k, _v in styles.body do
76
+ _attributes_3[_k] = _v
77
+ end
48
78
  local _attributes_4 = table.clone(styles.layout)
49
79
  setmetatable(_attributes_4, nil)
50
- local _exp_3 = React.createElement("uilistlayout", _attributes_4)
51
- local _condition_1 = title ~= nil and title ~= ""
52
- if _condition_1 then
80
+ local _exp_2 = React.createElement("uilistlayout", _attributes_4)
81
+ local _condition_3 = title ~= nil and title ~= ""
82
+ if _condition_3 then
53
83
  local _attributes_5 = {
54
84
  key = "Title",
55
85
  }
@@ -57,7 +87,7 @@ local function Alert(props)
57
87
  _attributes_5[_k] = _v
58
88
  end
59
89
  _attributes_5.Text = title
60
- _condition_1 = React.createElement("textlabel", _attributes_5)
90
+ _condition_3 = React.createElement("textlabel", _attributes_5)
61
91
  end
62
92
  local _attributes_5 = {
63
93
  key = "Message",
@@ -66,24 +96,7 @@ local function Alert(props)
66
96
  _attributes_5[_k] = _v
67
97
  end
68
98
  _attributes_5.Text = message
69
- local _exp_4 = React.createElement("textlabel", _attributes_5)
70
- local _condition_2 = onClose ~= nil
71
- if _condition_2 then
72
- local _attributes_6 = {
73
- key = "Close",
74
- }
75
- for _k, _v in styles.close do
76
- _attributes_6[_k] = _v
77
- end
78
- _attributes_6.Image = tostring(Icons.Close)
79
- _attributes_6.Event = {
80
- Activated = function()
81
- return onClose()
82
- end,
83
- }
84
- _condition_2 = (React.createElement("imagebutton", _attributes_6))
85
- end
86
- return React.createElement("frame", _attributes, _exp, _exp_1, _exp_2, _exp_3, _condition_1, _exp_4, _condition_2)
99
+ return React.createElement("frame", _attributes, _exp, _condition_1, _exp_1, _condition_2, React.createElement("frame", _attributes_3, _exp_2, _condition_3, React.createElement("textlabel", _attributes_5)))
87
100
  end
88
101
  local default = Alert
89
102
  return {
@@ -1,5 +1,7 @@
1
1
  import { AlertSeverity } from "./alertTone";
2
2
  declare const useAlertStyles: (props: {
3
3
  severity?: AlertSeverity;
4
+ dismissible?: boolean;
5
+ filled?: boolean;
4
6
  }) => import("../../../../theme/index").ClassNameMap<string>;
5
7
  export default useAlertStyles;
@@ -6,12 +6,15 @@ local createStyles = _theme.createStyles
6
6
  local alertSeverity = TS.import(script, script.Parent, "alertTone").alertSeverity
7
7
  local useAlertStyles = componentStyles("Alert", function(theme, _param)
8
8
  local severity = _param.severity
9
+ local dismissible = _param.dismissible
10
+ local filled = _param.filled
9
11
  local tone = theme.palette.status[alertSeverity(severity)]
12
+ local closeSize = theme.spacing.calc(2)
10
13
  local _object = {
11
14
  root = {
12
15
  AutomaticSize = Enum.AutomaticSize.Y,
13
16
  Size = UDim2.new(1, 0, 0, 0),
14
- BackgroundColor3 = tone.surface,
17
+ BackgroundColor3 = if filled == true then tone.main else tone.surface,
15
18
  BorderSizePixel = 0,
16
19
  },
17
20
  padding = {
@@ -24,11 +27,17 @@ local useAlertStyles = componentStyles("Alert", function(theme, _param)
24
27
  CornerRadius = UDim.new(0, theme.shape.borderRadius),
25
28
  },
26
29
  stroke = {
27
- Color = tone.border,
30
+ Color = if filled == true then tone.main else tone.border,
28
31
  Thickness = 1,
29
- Transparency = 0,
32
+ Transparency = if filled == true then 1 else 0,
30
33
  ApplyStrokeMode = Enum.ApplyStrokeMode.Border,
31
34
  },
35
+ body = {
36
+ AutomaticSize = Enum.AutomaticSize.Y,
37
+ Size = UDim2.new(1, if dismissible == true then -(closeSize + theme.padding.calc(1)) else 0, 0, 0),
38
+ BackgroundTransparency = 1,
39
+ BorderSizePixel = 0,
40
+ },
32
41
  layout = {
33
42
  FillDirection = Enum.FillDirection.Vertical,
34
43
  HorizontalAlignment = Enum.HorizontalAlignment.Left,
@@ -43,7 +52,7 @@ local useAlertStyles = componentStyles("Alert", function(theme, _param)
43
52
  BorderSizePixel = 0,
44
53
  Font = theme.typography.fontFamilies.default,
45
54
  TextSize = theme.typography.fontSizes.body,
46
- TextColor3 = tone.main,
55
+ TextColor3 = if filled == true then tone.on else tone.main,
47
56
  TextXAlignment = Enum.TextXAlignment.Left,
48
57
  LayoutOrder = 1,
49
58
  },
@@ -62,18 +71,18 @@ local useAlertStyles = componentStyles("Alert", function(theme, _param)
62
71
  _condition = theme.typography.fontSizes.body
63
72
  end
64
73
  _object_1[_left_1] = _condition
65
- _object_1.TextColor3 = theme.palette.text.primary
74
+ _object_1.TextColor3 = if filled == true then tone.on else theme.palette.text.primary
66
75
  _object_1.TextXAlignment = Enum.TextXAlignment.Left
67
76
  _object_1.TextWrapped = true
68
77
  _object_1.LayoutOrder = 2
69
78
  _object[_left] = _object_1
70
79
  _object.close = {
71
- Size = UDim2.fromOffset(theme.spacing.calc(2), theme.spacing.calc(2)),
72
- Position = UDim2.new(1, -theme.padding.calc(1), 0, theme.padding.calc(1)),
80
+ Size = UDim2.fromOffset(closeSize, closeSize),
81
+ Position = UDim2.new(1, 0, 0, 0),
73
82
  AnchorPoint = Vector2.new(1, 0),
74
83
  BackgroundTransparency = 1,
75
84
  BorderSizePixel = 0,
76
- ImageColor3 = theme.palette.text.secondary,
85
+ ImageColor3 = if filled == true then tone.on else theme.palette.text.secondary,
77
86
  ScaleType = Enum.ScaleType.Fit,
78
87
  ZIndex = 2,
79
88
  }
@@ -1,9 +1,10 @@
1
1
  import React from "@rbxts/react";
2
2
  import { CustomizedProps } from "../../../../theme/index";
3
- import { AppBarElevation } from "./AppBar.styles";
3
+ import { AppBarColor, AppBarElevation } from "./AppBar.styles";
4
4
  export interface AppBarProps {
5
5
  title?: string;
6
6
  elevation?: AppBarElevation;
7
+ color?: AppBarColor;
7
8
  children?: React.ReactNode;
8
9
  }
9
10
  declare function AppBar(props: CustomizedProps<Frame, AppBarProps>): JSX.Element;
@@ -13,6 +13,10 @@ local function AppBar(props)
13
13
  if elevation == nil then
14
14
  elevation = "raised"
15
15
  end
16
+ local color = _binding.color
17
+ if color == nil then
18
+ color = "default"
19
+ end
16
20
  local children = _binding.children
17
21
  local className = _binding.className
18
22
  local sx = _binding.sx
@@ -20,6 +24,7 @@ local function AppBar(props)
20
24
  local ref = _binding.ref
21
25
  local styles = useAppBarStyles({
22
26
  elevation = elevation,
27
+ color = color,
23
28
  hasActions = children ~= nil,
24
29
  })
25
30
  local _attributes = {}