@rbxts/uiblox 0.2.0-alpha.0 → 0.2.0-alpha.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +51 -34
- package/out/theme/constants/NumberConstants.d.ts +4 -2
- package/out/theme/constants/NumberConstants.luau +6 -4
- package/out/theme/context/ThemeProvider.d.ts +1 -1
- package/out/theme/hooks/useTheme.d.ts +1 -1
- package/out/theme/interfaces/palette/colorTokens/ColorTokens.d.ts +1 -1
- package/out/theme/interfaces/spacing/Shape.d.ts +3 -0
- package/out/theme/interfaces/typography/FontSizes.d.ts +1 -1
- package/out/theme/interfaces/typography/FontSizes.luau +15 -8
- package/out/theme/interfaces/typography/ThemeTypography.d.ts +3 -0
- package/out/theme/interfaces/typography/Variants.d.ts +14 -15
- package/out/theme/interfaces/typography/Variants.luau +68 -18
- package/out/theme/styles/utilities/index.d.ts +1 -1
- package/out/theme/styles/utilities/init.luau +3 -1
- package/out/theme/styles/utilities/resolveStyle.d.ts +32 -0
- package/out/theme/styles/utilities/resolveStyle.luau +66 -0
- package/out/theme/themes/DarkTheme.luau +4 -0
- package/out/theme/themes/LightTheme.luau +4 -0
- package/out/theme/types/types.d.ts +1 -1
- package/out/ui/packages/accordion/components/Accordion.d.ts +1 -0
- package/out/ui/packages/accordion/components/Accordion.luau +5 -0
- package/out/ui/packages/accordion/components/Accordion.styles.d.ts +1 -0
- package/out/ui/packages/accordion/components/Accordion.styles.luau +4 -2
- package/out/ui/packages/alert/components/Alert.d.ts +10 -0
- package/out/ui/packages/alert/components/Alert.luau +98 -0
- package/out/ui/packages/alert/components/Alert.styles.d.ts +6 -0
- package/out/ui/packages/alert/components/Alert.styles.luau +93 -0
- package/out/ui/packages/alert/components/alertTone.d.ts +2 -0
- package/out/ui/packages/alert/components/alertTone.luau +7 -0
- package/out/ui/packages/alert/index.d.ts +3 -0
- package/out/ui/packages/alert/init.luau +6 -0
- package/out/ui/packages/appBar/components/AppBar.d.ts +10 -0
- package/out/ui/packages/appBar/components/AppBar.luau +77 -0
- package/out/ui/packages/appBar/components/AppBar.styles.d.ts +6 -0
- package/out/ui/packages/appBar/components/AppBar.styles.luau +66 -0
- package/out/ui/packages/appBar/index.d.ts +3 -0
- package/out/ui/packages/appBar/init.luau +5 -0
- package/out/ui/packages/autocomplete/components/Autocomplete.luau +10 -0
- package/out/ui/packages/backdrop/components/Backdrop.d.ts +10 -0
- package/out/ui/packages/backdrop/components/Backdrop.luau +58 -0
- package/out/ui/packages/backdrop/components/Backdrop.styles.d.ts +4 -0
- package/out/ui/packages/backdrop/components/Backdrop.styles.luau +24 -0
- package/out/ui/packages/backdrop/index.d.ts +2 -0
- package/out/ui/packages/backdrop/init.luau +5 -0
- package/out/ui/packages/badge/components/Badge.styles.luau +6 -3
- package/out/ui/packages/bottomNavigation/components/BottomNavigation.d.ts +10 -0
- package/out/ui/packages/bottomNavigation/components/BottomNavigation.luau +86 -0
- package/out/ui/packages/bottomNavigation/components/BottomNavigation.styles.d.ts +2 -0
- package/out/ui/packages/bottomNavigation/components/BottomNavigation.styles.luau +58 -0
- package/out/ui/packages/bottomNavigation/index.d.ts +2 -0
- package/out/ui/packages/bottomNavigation/init.luau +5 -0
- package/out/ui/packages/breadcrumbs/components/Breadcrumbs.d.ts +1 -0
- package/out/ui/packages/breadcrumbs/components/Breadcrumbs.luau +58 -24
- package/out/ui/packages/breadcrumbs/components/breadcrumbItems.d.ts +9 -0
- package/out/ui/packages/breadcrumbs/components/breadcrumbItems.luau +68 -0
- package/out/ui/packages/breadcrumbs/index.d.ts +1 -0
- package/out/ui/packages/breadcrumbs/init.luau +3 -0
- package/out/ui/packages/brickColorPicker/components/brickColorCatalog.luau +1 -1
- package/out/ui/packages/button/components/Button.luau +9 -5
- package/out/ui/packages/button/components/Button.styles.luau +0 -6
- package/out/ui/packages/button/components/buttonLook.d.ts +2 -2
- package/out/ui/packages/checkbox/components/checkboxLook.d.ts +1 -1
- package/out/ui/packages/chip/components/Chip.d.ts +3 -1
- package/out/ui/packages/chip/components/Chip.luau +39 -2
- package/out/ui/packages/chip/components/Chip.styles.d.ts +3 -0
- package/out/ui/packages/chip/components/Chip.styles.luau +40 -6
- package/out/ui/packages/circularProgress/components/CircularProgress.luau +13 -2
- package/out/ui/packages/dialog/components/Dialog.d.ts +1 -1
- package/out/ui/packages/dialog/components/Dialog.luau +27 -18
- package/out/ui/packages/fab/components/Fab.d.ts +14 -0
- package/out/ui/packages/fab/components/Fab.luau +160 -0
- package/out/ui/packages/fab/components/Fab.styles.d.ts +8 -0
- package/out/ui/packages/fab/components/Fab.styles.luau +65 -0
- package/out/ui/packages/fab/components/fabSize.d.ts +4 -0
- package/out/ui/packages/fab/components/fabSize.luau +33 -0
- package/out/ui/packages/fab/index.d.ts +3 -0
- package/out/ui/packages/fab/init.luau +9 -0
- package/out/ui/packages/formText/components/FormHelperText.d.ts +8 -0
- package/out/ui/packages/formText/components/FormHelperText.luau +44 -0
- package/out/ui/packages/formText/components/FormLabel.d.ts +9 -0
- package/out/ui/packages/formText/components/FormLabel.luau +46 -0
- package/out/ui/packages/formText/components/FormText.styles.d.ts +5 -0
- package/out/ui/packages/formText/components/FormText.styles.luau +33 -0
- package/out/ui/packages/formText/index.d.ts +4 -0
- package/out/ui/packages/formText/init.luau +6 -0
- package/out/ui/packages/icon/components/Icon.styles.luau +4 -4
- package/out/ui/packages/iconButton/components/IconButton.luau +7 -2
- package/out/ui/packages/iconButton/components/IconButton.styles.luau +7 -4
- package/out/ui/packages/imageList/components/ImageList.d.ts +14 -0
- package/out/ui/packages/imageList/components/ImageList.luau +84 -0
- package/out/ui/packages/imageList/components/ImageList.styles.d.ts +6 -0
- package/out/ui/packages/imageList/components/ImageList.styles.luau +54 -0
- package/out/ui/packages/imageList/components/imageListLayout.d.ts +3 -0
- package/out/ui/packages/imageList/components/imageListLayout.luau +24 -0
- package/out/ui/packages/imageList/index.d.ts +2 -0
- package/out/ui/packages/imageList/init.luau +5 -0
- package/out/ui/packages/index.d.ts +11 -0
- package/out/ui/packages/init.luau +33 -0
- package/out/ui/packages/input/components/Input.d.ts +2 -0
- package/out/ui/packages/input/components/Input.luau +64 -27
- package/out/ui/packages/input/components/Input.styles.luau +6 -2
- package/out/ui/packages/layout/components/Box.d.ts +11 -0
- package/out/ui/packages/layout/components/Box.luau +49 -0
- package/out/ui/packages/layout/components/Box.styles.d.ts +7 -0
- package/out/ui/packages/layout/components/Box.styles.luau +34 -0
- package/out/ui/packages/layout/components/Container.d.ts +10 -0
- package/out/ui/packages/layout/components/Container.luau +54 -0
- package/out/ui/packages/layout/components/Container.styles.d.ts +6 -0
- package/out/ui/packages/layout/components/Container.styles.luau +41 -0
- package/out/ui/packages/layout/components/Grid.d.ts +1 -1
- package/out/ui/packages/layout/components/Stack.d.ts +12 -0
- package/out/ui/packages/layout/components/Stack.luau +49 -0
- package/out/ui/packages/layout/components/Stack.styles.d.ts +8 -0
- package/out/ui/packages/layout/components/Stack.styles.luau +72 -0
- package/out/ui/packages/layout/components/boxPad.d.ts +14 -0
- package/out/ui/packages/layout/components/boxPad.luau +59 -0
- package/out/ui/packages/layout/components/containerWidth.d.ts +2 -0
- package/out/ui/packages/layout/components/containerWidth.luau +17 -0
- package/out/ui/packages/layout/components/stackAlign.d.ts +8 -0
- package/out/ui/packages/layout/components/stackAlign.luau +29 -0
- package/out/ui/packages/layout/index.d.ts +10 -0
- package/out/ui/packages/layout/init.luau +4 -0
- package/out/ui/packages/link/components/Link.d.ts +11 -0
- package/out/ui/packages/link/components/Link.luau +83 -0
- package/out/ui/packages/link/components/Link.styles.d.ts +8 -0
- package/out/ui/packages/link/components/Link.styles.luau +59 -0
- package/out/ui/packages/link/index.d.ts +3 -0
- package/out/ui/packages/link/init.luau +5 -0
- package/out/ui/packages/listItem/components/ListItem.d.ts +1 -0
- package/out/ui/packages/listItem/components/ListItem.luau +5 -0
- package/out/ui/packages/listItem/components/ListItem.styles.d.ts +1 -0
- package/out/ui/packages/listItem/components/ListItem.styles.luau +10 -5
- package/out/ui/packages/loadingStroke/components/LoadingStroke.d.ts +2 -0
- package/out/ui/packages/loadingStroke/components/LoadingStroke.luau +23 -19
- package/out/ui/packages/menu/components/Menu.d.ts +3 -0
- package/out/ui/packages/menu/components/Menu.luau +48 -23
- package/out/ui/packages/menu/components/Menu.styles.luau +5 -1
- package/out/ui/packages/modal/components/Modal.d.ts +1 -1
- package/out/ui/packages/modal/components/Modal.luau +55 -37
- package/out/ui/packages/motion/index.d.ts +1 -1
- package/out/ui/packages/motion/init.luau +1 -0
- package/out/ui/packages/motion/unit.d.ts +5 -0
- package/out/ui/packages/motion/unit.luau +23 -0
- package/out/ui/packages/numberInput/components/NumberInput.d.ts +2 -0
- package/out/ui/packages/numberInput/components/NumberInput.luau +4 -0
- package/out/ui/packages/pagination/components/Pagination.d.ts +2 -0
- package/out/ui/packages/pagination/components/Pagination.luau +37 -21
- package/out/ui/packages/pagination/components/Pagination.styles.luau +9 -0
- package/out/ui/packages/pagination/components/pageRange.d.ts +2 -1
- package/out/ui/packages/pagination/components/pageRange.luau +91 -8
- package/out/ui/packages/pagination/index.d.ts +1 -0
- package/out/ui/packages/pagination/init.luau +1 -0
- package/out/ui/packages/paper/components/Paper.d.ts +1 -0
- package/out/ui/packages/paper/components/Paper.luau +8 -3
- package/out/ui/packages/popup/index.d.ts +1 -0
- package/out/ui/packages/popup/init.luau +1 -0
- package/out/ui/packages/radioGroup/components/RadioGroup.d.ts +1 -0
- package/out/ui/packages/radioGroup/components/RadioGroup.luau +4 -2
- package/out/ui/packages/radioGroup/components/RadioGroup.styles.d.ts +1 -0
- package/out/ui/packages/radioGroup/components/RadioGroup.styles.luau +4 -1
- package/out/ui/packages/rating/components/Rating.d.ts +9 -0
- package/out/ui/packages/rating/components/Rating.luau +95 -0
- package/out/ui/packages/rating/components/Rating.styles.d.ts +4 -0
- package/out/ui/packages/rating/components/Rating.styles.luau +39 -0
- package/out/ui/packages/rating/index.d.ts +2 -0
- package/out/ui/packages/rating/init.luau +5 -0
- package/out/ui/packages/select/components/Select.d.ts +6 -0
- package/out/ui/packages/select/components/Select.luau +74 -27
- package/out/ui/packages/select/components/Select.styles.luau +3 -3
- package/out/ui/packages/sidebar/components/Sidebar.styles.luau +2 -2
- package/out/ui/packages/skeleton/components/Skeleton.luau +3 -2
- package/out/ui/packages/skeleton/components/Skeleton.styles.luau +7 -2
- package/out/ui/packages/skeleton/components/skeletonMotion.luau +1 -1
- package/out/ui/packages/skeleton/components/skeletonTone.d.ts +20 -0
- package/out/ui/packages/skeleton/components/skeletonTone.luau +14 -0
- package/out/ui/packages/slider/components/Slider.d.ts +1 -0
- package/out/ui/packages/slider/components/Slider.luau +24 -1
- package/out/ui/packages/slider/components/Slider.styles.luau +8 -0
- package/out/ui/packages/slider/components/sliderMarks.d.ts +1 -0
- package/out/ui/packages/slider/components/sliderMarks.luau +37 -0
- package/out/ui/packages/speedDial/components/SpeedDial.d.ts +17 -0
- package/out/ui/packages/speedDial/components/SpeedDial.luau +92 -0
- package/out/ui/packages/speedDial/components/SpeedDial.styles.d.ts +2 -0
- package/out/ui/packages/speedDial/components/SpeedDial.styles.luau +26 -0
- package/out/ui/packages/speedDial/index.d.ts +2 -0
- package/out/ui/packages/speedDial/init.luau +5 -0
- package/out/ui/packages/splitPane/components/splitLook.d.ts +1 -1
- package/out/ui/packages/stateMatrix.d.ts +2 -0
- package/out/ui/packages/stateMatrix.luau +1843 -1335
- package/out/ui/packages/switch/components/Switch.styles.luau +1 -1
- package/out/ui/packages/switch/components/switchLook.d.ts +1 -1
- package/out/ui/packages/tabs/components/Tabs.d.ts +2 -0
- package/out/ui/packages/tabs/components/Tabs.luau +10 -3
- package/out/ui/packages/tabs/components/Tabs.styles.d.ts +4 -1
- package/out/ui/packages/tabs/components/Tabs.styles.luau +24 -10
- package/out/ui/packages/tabs/components/tabsOrientation.d.ts +2 -0
- package/out/ui/packages/tabs/components/tabsOrientation.luau +7 -0
- package/out/ui/packages/tabs/index.d.ts +1 -0
- package/out/ui/packages/tabs/init.luau +1 -0
- package/out/ui/packages/toast/components/Toast.styles.luau +1 -1
- package/out/ui/packages/toggleButton/components/ToggleButton.d.ts +17 -0
- package/out/ui/packages/toggleButton/components/ToggleButton.luau +126 -0
- package/out/ui/packages/toggleButton/components/ToggleButton.styles.d.ts +5 -0
- package/out/ui/packages/toggleButton/components/ToggleButton.styles.luau +58 -0
- package/out/ui/packages/toggleButton/index.d.ts +2 -0
- package/out/ui/packages/toggleButton/init.luau +7 -0
- package/out/ui/packages/treeView/components/TreeView.luau +3 -3
- package/out/ui/packages/treeView/components/TreeView.styles.luau +3 -3
- package/out/ui/packages/typography/components/Typography.styles.luau +4 -5
- package/out/ui/packages/virtualList/components/EmptyListHint.d.ts +6 -0
- package/out/ui/packages/virtualList/components/EmptyListHint.luau +32 -0
- package/out/ui/packages/virtualList/components/EmptyListHint.styles.d.ts +5 -0
- package/out/ui/packages/virtualList/components/EmptyListHint.styles.luau +26 -0
- package/out/ui/packages/virtualList/index.d.ts +2 -0
- package/out/ui/packages/virtualList/init.luau +1 -0
- package/package.json +2 -2
- package/out/theme/styles/utilities/interaction.d.ts +0 -13
- package/out/theme/styles/utilities/interaction.luau +0 -68
package/README.md
CHANGED
|
@@ -2,35 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
# uiblox-rbxts
|
|
4
4
|
|
|
5
|
-
> This package is a work in progress.
|
|
6
|
-
|
|
7
5
|
UI library and theming for roblox-ts projects.
|
|
8
6
|
|
|
9
|
-
## Background
|
|
10
|
-
|
|
11
|
-
Roblox has their own internal design system, coined "uiblox-web", that it uses for its new
|
|
12
|
-
web-facing products. This system offers reusable components, implemented in
|
|
13
|
-
React Typescript, that are derived from material UI (MUI). As well, it offers a
|
|
14
|
-
common theme/pallete for consistent UI/UX.
|
|
15
|
-
|
|
16
|
-
Anyone is able to view their design system as
|
|
17
|
-
[UIBlox-Web](https://uiblox.roblox.com). You can see that they leverage
|
|
18
|
-
[Storybook](https://storybook.js.org), a UI component explorer for frontend
|
|
19
|
-
developers, to render component previews.
|
|
20
|
-
|
|
21
|
-
Design systems all help engineers cut down on implementation time and ensure
|
|
22
|
-
consitent UX across products.
|
|
23
|
-
|
|
24
7
|
## Overview
|
|
25
8
|
|
|
26
|
-
|
|
27
|
-
uiblox-web for games written using roblox-ts.
|
|
9
|
+
Uiblox is a roblox-ts UI kit: semantic themes, `makeStyles` / `createStyles`, and typed React components for Studio and games. Public APIs aim for familiar Material UI–style capability (props and behavior), implemented independently for Roblox Instances, input modes, and performance.
|
|
28
10
|
|
|
29
|
-
|
|
30
|
-
anyone who installs this npm package. It also offers a theme and styling system
|
|
31
|
-
that aids UI/UX consistentency.
|
|
32
|
-
|
|
33
|
-
How does it do this? Well, there are two main exports from this package:
|
|
11
|
+
Main exports from `@rbxts/uiblox`:
|
|
34
12
|
|
|
35
13
|
- @rbxts/uiblox -> theme
|
|
36
14
|
- An extensible Theme type + default Dark (default) and Light themes
|
|
@@ -46,9 +24,47 @@ How does it do this? Well, there are two main exports from this package:
|
|
|
46
24
|
|
|
47
25
|
### Installation
|
|
48
26
|
|
|
49
|
-
|
|
27
|
+
```
|
|
28
|
+
npm install @rbxts/uiblox
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Quickstart
|
|
32
|
+
|
|
33
|
+
1. Wrap your app (or a subtree) in `ThemeProvider` with `DarkTheme` or `LightTheme`.
|
|
34
|
+
2. Build styles with `makeStyles` / `createStyles` (or `componentStyles`) and spread them onto Instances.
|
|
35
|
+
3. For hover/press/focus/disabled (and list `_first` / `_last`), put `_hover`-style keys on the style table and call `resolveStyle(style, state)` before spreading.
|
|
36
|
+
4. Use packaged components from `@rbxts/uiblox` (`Button`, `Input`, `Select`, …).
|
|
37
|
+
5. Preview components in [Storyblox](https://github.com/bjlarouche/storyblox) with `*.stories` modules.
|
|
38
|
+
|
|
39
|
+
Token reference (spacing, density, typography, shape, palette, `resolveStyle`): [docs/STYLING.md](docs/STYLING.md).
|
|
40
|
+
|
|
41
|
+
```tsx
|
|
42
|
+
import React from "@rbxts/react";
|
|
43
|
+
import { Button, DarkTheme, ThemeProvider } from "@rbxts/uiblox";
|
|
44
|
+
|
|
45
|
+
export function App() {
|
|
46
|
+
return (
|
|
47
|
+
<ThemeProvider theme={DarkTheme}>
|
|
48
|
+
<Button text="Continue" onLeftClick={() => {}} />
|
|
49
|
+
</ThemeProvider>
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Parity checklist
|
|
55
|
+
|
|
56
|
+
Capability parity, not pixel parity. For each public component, expect:
|
|
57
|
+
|
|
58
|
+
- [ ] Typed controlled props where interaction needs state
|
|
59
|
+
- [ ] Theme tokens (light/dark) via `ThemeProvider`
|
|
60
|
+
- [ ] Style slots / variants through the styling helpers
|
|
61
|
+
- [ ] Disabled / loading / error when the control type warrants it
|
|
62
|
+
- [ ] Mouse, touch, and gamepad-friendly activation where interactive
|
|
63
|
+
- [ ] Cleanup and focused unit checks in-repo
|
|
64
|
+
- [ ] `stateMatrix` rows for visual capture planning
|
|
65
|
+
- [ ] A Storyblox story (dev fixtures OK)
|
|
50
66
|
|
|
51
|
-
|
|
67
|
+
Skipped on purpose: browser-only addons (MDX, iframes, hosted visual-review clouds).
|
|
52
68
|
|
|
53
69
|
## Example
|
|
54
70
|
|
|
@@ -253,14 +269,15 @@ keeps the spinner still.
|
|
|
253
269
|
|
|
254
270
|
`stateMatrix` is the gallery list for Storyblox. Each row is one shot: `theme`
|
|
255
271
|
(`Dark` or `Light`), `width`, and `pointer` (`rest`, `hover`, `press`, or
|
|
256
|
-
`focus`).
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
`
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
272
|
+
`focus`). Rows are built in small helper functions and concatenated so the
|
|
273
|
+
compiled Luau chunk stays under the 200-local register limit. `open` means the
|
|
274
|
+
Select list is showing. `options` and `disabledOption` build RadioGroup, Select,
|
|
275
|
+
and Tabs. `selected` and `filter` are TreeView. `value`, `text`, `disabled`,
|
|
276
|
+
`loading`, `mixed`, `hasError`, and `placeholder` are that control's props.
|
|
277
|
+
`variant`, `animation` (`pulse`, `shimmer`, or `false`), `reducedMotion`, and
|
|
278
|
+
`indeterminate` cover skeleton and progress shots. Those shots stay still when
|
|
279
|
+
`animation` is `false` or `reducedMotion` is set. Hover, press, and focus rows
|
|
280
|
+
are only there when the control actually changes.
|
|
264
281
|
|
|
265
282
|
### Client
|
|
266
283
|
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { IconSizes } from "../interfaces/index";
|
|
2
|
-
export declare const SPACING_BASE =
|
|
1
|
+
import { IconSizes } from "../interfaces/iconSizes/index";
|
|
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;
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
-- Compiled with roblox-ts v3.0.0
|
|
2
|
-
local SPACING_BASE =
|
|
2
|
+
local SPACING_BASE = 8
|
|
3
3
|
local PADDING_BASE = 4
|
|
4
|
-
-- align with UIBlox design
|
|
5
4
|
local BORDER_RADIUS = 4
|
|
5
|
+
--* UICorner scale for pill/capsule controls (1 = fully round).
|
|
6
|
+
local PILL_SCALE = 1
|
|
6
7
|
local CONTENT_WIDTH = 1024
|
|
7
8
|
local ICON_SIZES = {
|
|
8
9
|
small = 16,
|
|
9
|
-
medium =
|
|
10
|
-
large =
|
|
10
|
+
medium = 24,
|
|
11
|
+
large = 32,
|
|
11
12
|
}
|
|
12
13
|
return {
|
|
13
14
|
SPACING_BASE = SPACING_BASE,
|
|
14
15
|
PADDING_BASE = PADDING_BASE,
|
|
15
16
|
BORDER_RADIUS = BORDER_RADIUS,
|
|
17
|
+
PILL_SCALE = PILL_SCALE,
|
|
16
18
|
CONTENT_WIDTH = CONTENT_WIDTH,
|
|
17
19
|
ICON_SIZES = ICON_SIZES,
|
|
18
20
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "@rbxts/react";
|
|
2
|
-
import { Theme } from "../interfaces/index";
|
|
2
|
+
import { Theme } from "../interfaces/theme/index";
|
|
3
3
|
import { CustomizedProps } from "../types/index";
|
|
4
4
|
import { ThemeScope } from "./themeScope";
|
|
5
5
|
export declare const ThemeContext: React.Context<ThemeScope<Theme> | undefined>;
|
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
-- Compiled with roblox-ts v3.0.0
|
|
2
|
-
local
|
|
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 =
|
|
5
|
-
h2 =
|
|
6
|
-
h3 =
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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 {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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
|
-
|
|
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
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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
|
-
|
|
72
|
+
allTypographyVariants = allTypographyVariants,
|
|
23
73
|
TypographyWeights = TypographyWeights,
|
|
24
74
|
}
|
|
@@ -4,4 +4,4 @@ export { default as classNames, cx } from "./classNames";
|
|
|
4
4
|
export { applyVariants, CompoundVariant } from "./variants";
|
|
5
5
|
export { default as componentStyles } from "./componentStyles";
|
|
6
6
|
export { resolveResponsive, Responsive } from "../../../hooks/breakpoints";
|
|
7
|
-
export { interactionStyle, InteractionSlots, InteractionState } from "./
|
|
7
|
+
export { interactionStyle, InteractionSlots, InteractionState, resolveStyle, StyleSelectorKey, StyleState, StyleWithSelectors, } from "./resolveStyle";
|
|
@@ -9,5 +9,7 @@ exports.cx = _classNames.cx
|
|
|
9
9
|
exports.applyVariants = TS.import(script, script, "variants").applyVariants
|
|
10
10
|
exports.componentStyles = TS.import(script, script, "componentStyles").default
|
|
11
11
|
exports.resolveResponsive = TS.import(script, script.Parent.Parent.Parent, "hooks", "breakpoints").resolveResponsive
|
|
12
|
-
|
|
12
|
+
local _resolveStyle = TS.import(script, script, "resolveStyle")
|
|
13
|
+
exports.interactionStyle = _resolveStyle.interactionStyle
|
|
14
|
+
exports.resolveStyle = _resolveStyle.resolveStyle
|
|
13
15
|
return exports
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export type StyleSelectorKey = "_hover" | "_pressed" | "_focus" | "_disabled" | "_selected" | "_checked" | "_first" | "_last";
|
|
2
|
+
export interface StyleState {
|
|
3
|
+
hover?: boolean;
|
|
4
|
+
pressed?: boolean;
|
|
5
|
+
focused?: boolean;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
selected?: boolean;
|
|
8
|
+
checked?: boolean;
|
|
9
|
+
first?: boolean;
|
|
10
|
+
last?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export type StyleWithSelectors<T extends object = object> = T & {
|
|
13
|
+
_hover?: Partial<T>;
|
|
14
|
+
_pressed?: Partial<T>;
|
|
15
|
+
_focus?: Partial<T>;
|
|
16
|
+
_disabled?: Partial<T>;
|
|
17
|
+
_selected?: Partial<T>;
|
|
18
|
+
_checked?: Partial<T>;
|
|
19
|
+
_first?: Partial<T>;
|
|
20
|
+
_last?: Partial<T>;
|
|
21
|
+
};
|
|
22
|
+
export interface InteractionSlots<T extends object = object> {
|
|
23
|
+
hover?: T;
|
|
24
|
+
pressed?: T;
|
|
25
|
+
focused?: T;
|
|
26
|
+
disabled?: T;
|
|
27
|
+
}
|
|
28
|
+
export type InteractionState = Pick<StyleState, "hover" | "pressed" | "focused" | "disabled">;
|
|
29
|
+
/** Peels `_hover` / `_pressed` / `_focus` / … and merges active ones onto the Instance props. */
|
|
30
|
+
export declare function resolveStyle<T extends object>(style: StyleWithSelectors<T>, state?: StyleState): T;
|
|
31
|
+
/** Prefer `resolveStyle` with `_hover` keys. Kept for existing call sites. */
|
|
32
|
+
export declare function interactionStyle<T extends object>(base: T, slots: InteractionSlots<T>, state: InteractionState): T;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
--* Order matters: later keys win. Structural first, then interaction; `_disabled` last.
|
|
3
|
+
local SELECTORS = { { "_first", "first" }, { "_last", "last" }, { "_selected", "selected" }, { "_checked", "checked" }, { "_hover", "hover" }, { "_pressed", "pressed" }, { "_focus", "focused" }, { "_disabled", "disabled" } }
|
|
4
|
+
local SELECTOR_FLAGS = {
|
|
5
|
+
_hover = true,
|
|
6
|
+
_pressed = true,
|
|
7
|
+
_focus = true,
|
|
8
|
+
_selected = true,
|
|
9
|
+
_checked = true,
|
|
10
|
+
_first = true,
|
|
11
|
+
_last = true,
|
|
12
|
+
_disabled = true,
|
|
13
|
+
}
|
|
14
|
+
--* Peels `_hover` / `_pressed` / `_focus` / … and merges active ones onto the Instance props.
|
|
15
|
+
local function resolveStyle(style, state)
|
|
16
|
+
if state == nil then
|
|
17
|
+
state = {}
|
|
18
|
+
end
|
|
19
|
+
local base = {}
|
|
20
|
+
local patches = {}
|
|
21
|
+
for key, value in pairs(style) do
|
|
22
|
+
local name = key
|
|
23
|
+
if SELECTOR_FLAGS[name] == true then
|
|
24
|
+
patches[name] = value
|
|
25
|
+
else
|
|
26
|
+
base[name] = value
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
local painted = base
|
|
30
|
+
for _, _binding in SELECTORS do
|
|
31
|
+
local selector = _binding[1]
|
|
32
|
+
local flag = _binding[2]
|
|
33
|
+
local patch = patches[selector]
|
|
34
|
+
if state[flag] == true and patch ~= nil then
|
|
35
|
+
local _object = {}
|
|
36
|
+
if painted then
|
|
37
|
+
for _k, _v in painted do
|
|
38
|
+
_object[_k] = _v
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
for _k, _v in patch do
|
|
42
|
+
_object[_k] = _v
|
|
43
|
+
end
|
|
44
|
+
painted = _object
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
return painted
|
|
48
|
+
end
|
|
49
|
+
--* Prefer `resolveStyle` with `_hover` keys. Kept for existing call sites.
|
|
50
|
+
local function interactionStyle(base, slots, state)
|
|
51
|
+
local _object = {}
|
|
52
|
+
if base then
|
|
53
|
+
for _k, _v in base do
|
|
54
|
+
_object[_k] = _v
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
_object._hover = slots.hover
|
|
58
|
+
_object._pressed = slots.pressed
|
|
59
|
+
_object._focus = slots.focused
|
|
60
|
+
_object._disabled = slots.disabled
|
|
61
|
+
return resolveStyle(_object, state)
|
|
62
|
+
end
|
|
63
|
+
return {
|
|
64
|
+
resolveStyle = resolveStyle,
|
|
65
|
+
interactionStyle = interactionStyle,
|
|
66
|
+
}
|
|
@@ -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 = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { PropsWithChildren } from "@rbxts/react";
|
|
2
|
-
import { WriteableStyle } from "../
|
|
2
|
+
import { WriteableStyle } from "../styles/index";
|
|
3
3
|
export interface CommonProps<T extends Instance> extends PropsWithChildren {
|
|
4
4
|
className?: WriteableStyle<T>;
|
|
5
5
|
sx?: WriteableStyle<T>;
|
|
@@ -10,6 +10,7 @@ local function Accordion(props)
|
|
|
10
10
|
local title = _binding.title
|
|
11
11
|
local controlled = _binding.open
|
|
12
12
|
local defaultOpen = _binding.defaultOpen
|
|
13
|
+
local disabled = _binding.disabled
|
|
13
14
|
local onChange = _binding.onChange
|
|
14
15
|
local children = _binding.children
|
|
15
16
|
local className = _binding.className
|
|
@@ -20,8 +21,12 @@ local function Accordion(props)
|
|
|
20
21
|
local open = accordionOpen(localOpen, controlled)
|
|
21
22
|
local styles = useAccordionStyles({
|
|
22
23
|
open = open,
|
|
24
|
+
disabled = disabled,
|
|
23
25
|
})
|
|
24
26
|
local toggle = function()
|
|
27
|
+
if disabled == true then
|
|
28
|
+
return nil
|
|
29
|
+
end
|
|
25
30
|
local nextOpen = not open
|
|
26
31
|
if controlled == nil then
|
|
27
32
|
setLocalOpen(nextOpen)
|
|
@@ -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,8 +28,8 @@ 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
35
|
AutomaticSize = Enum.AutomaticSize.XY,
|
|
@@ -38,6 +39,7 @@ local useAccordionStyles = componentStyles("Accordion", function(theme, _param)
|
|
|
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
|
},
|
|
43
45
|
padding = {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { CustomizedProps } from "../../../../theme/index";
|
|
2
|
+
import { AlertSeverity } from "./alertTone";
|
|
3
|
+
export interface AlertProps {
|
|
4
|
+
severity?: AlertSeverity;
|
|
5
|
+
title?: string;
|
|
6
|
+
message: string;
|
|
7
|
+
onClose?: () => void;
|
|
8
|
+
}
|
|
9
|
+
declare function Alert(props: CustomizedProps<Frame, AlertProps>): JSX.Element;
|
|
10
|
+
export default Alert;
|