@rbxts/uiblox 0.2.0-alpha.0 → 0.2.0-alpha.1
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 +40 -26
- package/out/theme/constants/NumberConstants.d.ts +1 -1
- package/out/theme/constants/NumberConstants.luau +3 -4
- package/out/theme/interfaces/typography/FontSizes.d.ts +1 -1
- package/out/theme/interfaces/typography/FontSizes.luau +7 -7
- 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/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 +2 -0
- 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/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/fab/components/Fab.d.ts +13 -0
- package/out/ui/packages/fab/components/Fab.luau +128 -0
- package/out/ui/packages/fab/components/Fab.styles.d.ts +7 -0
- package/out/ui/packages/fab/components/Fab.styles.luau +40 -0
- package/out/ui/packages/fab/components/fabSize.d.ts +3 -0
- package/out/ui/packages/fab/components/fabSize.luau +29 -0
- package/out/ui/packages/fab/index.d.ts +3 -0
- package/out/ui/packages/fab/init.luau +8 -0
- package/out/ui/packages/icon/components/Icon.styles.luau +4 -4
- package/out/ui/packages/iconButton/components/IconButton.styles.luau +4 -4
- package/out/ui/packages/index.d.ts +3 -0
- package/out/ui/packages/init.luau +9 -0
- package/out/ui/packages/input/components/Input.d.ts +2 -0
- package/out/ui/packages/input/components/Input.luau +63 -26
- package/out/ui/packages/input/components/Input.styles.luau +6 -2
- 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/select/components/Select.d.ts +1 -0
- package/out/ui/packages/select/components/Select.luau +26 -3
- package/out/ui/packages/select/components/Select.styles.luau +2 -2
- package/out/ui/packages/sidebar/components/Sidebar.styles.luau +2 -2
- package/out/ui/packages/splitPane/components/splitLook.d.ts +1 -1
- package/out/ui/packages/stateMatrix.luau +528 -426
- package/out/ui/packages/switch/components/switchLook.d.ts +3 -3
- package/out/ui/packages/tabs/components/Tabs.styles.luau +1 -1
- package/out/ui/packages/treeView/components/TreeView.luau +3 -3
- package/out/ui/packages/treeView/components/TreeView.styles.luau +3 -3
- 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,45 @@ 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
|
+
```tsx
|
|
40
|
+
import React from "@rbxts/react";
|
|
41
|
+
import { Button, DarkTheme, ThemeProvider } from "@rbxts/uiblox";
|
|
42
|
+
|
|
43
|
+
export function App() {
|
|
44
|
+
return (
|
|
45
|
+
<ThemeProvider theme={DarkTheme}>
|
|
46
|
+
<Button text="Continue" onLeftClick={() => {}} />
|
|
47
|
+
</ThemeProvider>
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Parity checklist
|
|
53
|
+
|
|
54
|
+
Capability parity, not pixel parity. For each public component, expect:
|
|
55
|
+
|
|
56
|
+
- [ ] Typed controlled props where interaction needs state
|
|
57
|
+
- [ ] Theme tokens (light/dark) via `ThemeProvider`
|
|
58
|
+
- [ ] Style slots / variants through the styling helpers
|
|
59
|
+
- [ ] Disabled / loading / error when the control type warrants it
|
|
60
|
+
- [ ] Mouse, touch, and gamepad-friendly activation where interactive
|
|
61
|
+
- [ ] Cleanup and focused unit checks in-repo
|
|
62
|
+
- [ ] `stateMatrix` rows for visual capture planning
|
|
63
|
+
- [ ] A Storyblox story (dev fixtures OK)
|
|
50
64
|
|
|
51
|
-
|
|
65
|
+
Skipped on purpose: browser-only addons (MDX, iframes, hosted visual-review clouds).
|
|
52
66
|
|
|
53
67
|
## Example
|
|
54
68
|
|
|
@@ -1,13 +1,12 @@
|
|
|
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
|
|
6
5
|
local CONTENT_WIDTH = 1024
|
|
7
6
|
local ICON_SIZES = {
|
|
8
7
|
small = 16,
|
|
9
|
-
medium =
|
|
10
|
-
large =
|
|
8
|
+
medium = 24,
|
|
9
|
+
large = 32,
|
|
11
10
|
}
|
|
12
11
|
return {
|
|
13
12
|
SPACING_BASE = SPACING_BASE,
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
-- Compiled with roblox-ts v3.0.0
|
|
2
|
-
local baseFontSize =
|
|
2
|
+
local baseFontSize = 14
|
|
3
3
|
local allFontSizes = {
|
|
4
|
-
h1 =
|
|
5
|
-
h2 =
|
|
6
|
-
h3 =
|
|
4
|
+
h1 = 28,
|
|
5
|
+
h2 = 22,
|
|
6
|
+
h3 = 18,
|
|
7
7
|
body = baseFontSize,
|
|
8
|
-
caption =
|
|
9
|
-
overline =
|
|
10
|
-
button =
|
|
8
|
+
caption = 12,
|
|
9
|
+
overline = 10,
|
|
10
|
+
button = 13,
|
|
11
11
|
}
|
|
12
12
|
return {
|
|
13
13
|
baseFontSize = baseFontSize,
|
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from "@rbxts/react";
|
|
2
|
+
import { CustomizedProps } from "../../../../theme/index";
|
|
3
|
+
import { AppBarElevation } from "./AppBar.styles";
|
|
4
|
+
export interface AppBarProps {
|
|
5
|
+
title?: string;
|
|
6
|
+
elevation?: AppBarElevation;
|
|
7
|
+
children?: React.ReactNode;
|
|
8
|
+
}
|
|
9
|
+
declare function AppBar(props: CustomizedProps<Frame, AppBarProps>): JSX.Element;
|
|
10
|
+
export default AppBar;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
local React = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
4
|
+
local Shadow = TS.import(script, script.Parent.Parent.Parent, "shadow").Shadow
|
|
5
|
+
local useAppBarStyles = TS.import(script, script.Parent, "AppBar.styles").default
|
|
6
|
+
local function AppBar(props)
|
|
7
|
+
local _binding = props
|
|
8
|
+
local title = _binding.title
|
|
9
|
+
if title == nil then
|
|
10
|
+
title = ""
|
|
11
|
+
end
|
|
12
|
+
local elevation = _binding.elevation
|
|
13
|
+
if elevation == nil then
|
|
14
|
+
elevation = "raised"
|
|
15
|
+
end
|
|
16
|
+
local children = _binding.children
|
|
17
|
+
local className = _binding.className
|
|
18
|
+
local sx = _binding.sx
|
|
19
|
+
local id = _binding.id
|
|
20
|
+
local ref = _binding.ref
|
|
21
|
+
local styles = useAppBarStyles({
|
|
22
|
+
elevation = elevation,
|
|
23
|
+
hasActions = children ~= nil,
|
|
24
|
+
})
|
|
25
|
+
local _attributes = {}
|
|
26
|
+
local _condition = id
|
|
27
|
+
if not (_condition ~= 0 and _condition == _condition and _condition ~= "" and _condition) then
|
|
28
|
+
_condition = "AppBar"
|
|
29
|
+
end
|
|
30
|
+
_attributes.key = _condition
|
|
31
|
+
_attributes.ref = ref
|
|
32
|
+
for _k, _v in styles.root do
|
|
33
|
+
_attributes[_k] = _v
|
|
34
|
+
end
|
|
35
|
+
if className then
|
|
36
|
+
for _k, _v in className do
|
|
37
|
+
_attributes[_k] = _v
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
if sx then
|
|
41
|
+
for _k, _v in sx do
|
|
42
|
+
_attributes[_k] = _v
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
local _attributes_1 = table.clone(styles.padding)
|
|
46
|
+
setmetatable(_attributes_1, nil)
|
|
47
|
+
local _exp = React.createElement("uipadding", _attributes_1)
|
|
48
|
+
local _exp_1 = elevation == "raised" and React.createElement(Shadow)
|
|
49
|
+
local _condition_1 = title ~= ""
|
|
50
|
+
if _condition_1 then
|
|
51
|
+
local _attributes_2 = {
|
|
52
|
+
key = "Title",
|
|
53
|
+
}
|
|
54
|
+
for _k, _v in styles.title do
|
|
55
|
+
_attributes_2[_k] = _v
|
|
56
|
+
end
|
|
57
|
+
_attributes_2.Text = title
|
|
58
|
+
_condition_1 = React.createElement("textlabel", _attributes_2)
|
|
59
|
+
end
|
|
60
|
+
local _condition_2 = children ~= nil
|
|
61
|
+
if _condition_2 then
|
|
62
|
+
local _attributes_2 = {
|
|
63
|
+
key = "Actions",
|
|
64
|
+
}
|
|
65
|
+
for _k, _v in styles.actions do
|
|
66
|
+
_attributes_2[_k] = _v
|
|
67
|
+
end
|
|
68
|
+
local _attributes_3 = table.clone(styles.actionsLayout)
|
|
69
|
+
setmetatable(_attributes_3, nil)
|
|
70
|
+
_condition_2 = (React.createElement("frame", _attributes_2, React.createElement("uilistlayout", _attributes_3), children))
|
|
71
|
+
end
|
|
72
|
+
return React.createElement("frame", _attributes, _exp, _exp_1, _condition_1, _condition_2)
|
|
73
|
+
end
|
|
74
|
+
local default = AppBar
|
|
75
|
+
return {
|
|
76
|
+
default = default,
|
|
77
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
local _theme = TS.import(script, script.Parent.Parent.Parent.Parent.Parent, "theme")
|
|
4
|
+
local componentStyles = _theme.componentStyles
|
|
5
|
+
local createStyles = _theme.createStyles
|
|
6
|
+
local useAppBarStyles = componentStyles("AppBar", function(theme, _param)
|
|
7
|
+
local elevation = _param.elevation
|
|
8
|
+
if elevation == nil then
|
|
9
|
+
elevation = "raised"
|
|
10
|
+
end
|
|
11
|
+
local hasActions = _param.hasActions
|
|
12
|
+
if hasActions == nil then
|
|
13
|
+
hasActions = false
|
|
14
|
+
end
|
|
15
|
+
local _object = {
|
|
16
|
+
root = {
|
|
17
|
+
Size = UDim2.new(1, 0, 0, theme.spacing.calc(7)),
|
|
18
|
+
BackgroundColor3 = if elevation == "raised" then theme.palette.surface.elevated else theme.palette.surface.paper,
|
|
19
|
+
BorderSizePixel = 0,
|
|
20
|
+
ZIndex = 11000,
|
|
21
|
+
},
|
|
22
|
+
padding = {
|
|
23
|
+
PaddingLeft = UDim.new(0, theme.padding.calc(2)),
|
|
24
|
+
PaddingRight = UDim.new(0, theme.padding.calc(2)),
|
|
25
|
+
},
|
|
26
|
+
}
|
|
27
|
+
local _left = "title"
|
|
28
|
+
local _object_1 = {
|
|
29
|
+
Size = UDim2.new(1, if hasActions then -theme.spacing.calc(8) else 0, 1, 0),
|
|
30
|
+
BackgroundTransparency = 1,
|
|
31
|
+
BorderSizePixel = 0,
|
|
32
|
+
Font = theme.typography.fontFamilies.default,
|
|
33
|
+
}
|
|
34
|
+
local _left_1 = "TextSize"
|
|
35
|
+
local _condition = theme.typography.fontSizes.h3
|
|
36
|
+
if _condition == nil then
|
|
37
|
+
_condition = theme.typography.fontSizes.body
|
|
38
|
+
end
|
|
39
|
+
_object_1[_left_1] = _condition
|
|
40
|
+
_object_1.TextColor3 = theme.palette.text.primary
|
|
41
|
+
_object_1.TextXAlignment = Enum.TextXAlignment.Left
|
|
42
|
+
_object_1.TextYAlignment = Enum.TextYAlignment.Center
|
|
43
|
+
_object_1.TextTruncate = Enum.TextTruncate.AtEnd
|
|
44
|
+
_object[_left] = _object_1
|
|
45
|
+
_object.actions = {
|
|
46
|
+
AutomaticSize = Enum.AutomaticSize.X,
|
|
47
|
+
Size = UDim2.new(0, 0, 1, 0),
|
|
48
|
+
Position = UDim2.new(1, 0, 0, 0),
|
|
49
|
+
AnchorPoint = Vector2.new(1, 0),
|
|
50
|
+
BackgroundTransparency = 1,
|
|
51
|
+
BorderSizePixel = 0,
|
|
52
|
+
ZIndex = 2,
|
|
53
|
+
}
|
|
54
|
+
_object.actionsLayout = {
|
|
55
|
+
FillDirection = Enum.FillDirection.Horizontal,
|
|
56
|
+
HorizontalAlignment = Enum.HorizontalAlignment.Right,
|
|
57
|
+
VerticalAlignment = Enum.VerticalAlignment.Center,
|
|
58
|
+
SortOrder = Enum.SortOrder.LayoutOrder,
|
|
59
|
+
Padding = UDim.new(0, theme.padding.calc(1)),
|
|
60
|
+
}
|
|
61
|
+
return createStyles(_object)
|
|
62
|
+
end)
|
|
63
|
+
local default = useAppBarStyles
|
|
64
|
+
return {
|
|
65
|
+
default = default,
|
|
66
|
+
}
|
|
@@ -10,6 +10,7 @@ local function Autocomplete(props)
|
|
|
10
10
|
local options = _binding.options
|
|
11
11
|
local onChange = _binding.onChange
|
|
12
12
|
local disabled = _binding.disabled
|
|
13
|
+
local loading = _binding.loading
|
|
13
14
|
local placeholder = _binding.placeholder
|
|
14
15
|
local searchable = _binding.searchable
|
|
15
16
|
local reducedMotion = _binding.reducedMotion
|
|
@@ -24,6 +25,7 @@ local function Autocomplete(props)
|
|
|
24
25
|
options = options,
|
|
25
26
|
onChange = onChange,
|
|
26
27
|
disabled = disabled,
|
|
28
|
+
loading = loading,
|
|
27
29
|
placeholder = placeholder,
|
|
28
30
|
searchable = autocompleteSearchable(searchable),
|
|
29
31
|
reducedMotion = reducedMotion,
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { CustomizedProps } from "../../../../theme/index";
|
|
2
|
+
import { ChoiceOption } from "../../radioGroup/index";
|
|
3
|
+
export interface BottomNavigationProps<T> {
|
|
4
|
+
value: T;
|
|
5
|
+
options: ChoiceOption<T>[];
|
|
6
|
+
onChange: (value: T) => void;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
}
|
|
9
|
+
declare function BottomNavigation<T>(props: CustomizedProps<Frame, BottomNavigationProps<T>>): JSX.Element;
|
|
10
|
+
export default BottomNavigation;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
local React = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
4
|
+
local cx = TS.import(script, script.Parent.Parent.Parent.Parent.Parent, "theme").cx
|
|
5
|
+
local canActivate = TS.import(script, script.Parent.Parent.Parent, "button", "components", "activation").canActivate
|
|
6
|
+
local useBottomNavigationStyles = TS.import(script, script.Parent, "BottomNavigation.styles").default
|
|
7
|
+
local function BottomNavigation(props)
|
|
8
|
+
local _binding = props
|
|
9
|
+
local value = _binding.value
|
|
10
|
+
local options = _binding.options
|
|
11
|
+
local onChange = _binding.onChange
|
|
12
|
+
local disabled = _binding.disabled
|
|
13
|
+
local className = _binding.className
|
|
14
|
+
local sx = _binding.sx
|
|
15
|
+
local id = _binding.id
|
|
16
|
+
local ref = _binding.ref
|
|
17
|
+
local styles = useBottomNavigationStyles()
|
|
18
|
+
local count = math.max(#options, 1)
|
|
19
|
+
local _attributes = {}
|
|
20
|
+
local _condition = id
|
|
21
|
+
if not (_condition ~= 0 and _condition == _condition and _condition ~= "" and _condition) then
|
|
22
|
+
_condition = "BottomNavigation"
|
|
23
|
+
end
|
|
24
|
+
_attributes.key = _condition
|
|
25
|
+
_attributes.ref = ref
|
|
26
|
+
for _k, _v in styles.root do
|
|
27
|
+
_attributes[_k] = _v
|
|
28
|
+
end
|
|
29
|
+
if className then
|
|
30
|
+
for _k, _v in className do
|
|
31
|
+
_attributes[_k] = _v
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
if sx then
|
|
35
|
+
for _k, _v in sx do
|
|
36
|
+
_attributes[_k] = _v
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
local _attributes_1 = table.clone(styles.list)
|
|
40
|
+
setmetatable(_attributes_1, nil)
|
|
41
|
+
local _exp = React.createElement("uilistlayout", _attributes_1)
|
|
42
|
+
-- ▼ ReadonlyArray.map ▼
|
|
43
|
+
local _newValue = table.create(#options)
|
|
44
|
+
local _callback = function(choice, index)
|
|
45
|
+
local active = canActivate(disabled or choice.disabled)
|
|
46
|
+
local selected = choice.value == value
|
|
47
|
+
local _attributes_2 = {
|
|
48
|
+
key = `{choice.label}-{index}`,
|
|
49
|
+
}
|
|
50
|
+
for _k, _v in cx(styles.item, selected and styles.selected, not active and styles.disabledItem) do
|
|
51
|
+
_attributes_2[_k] = _v
|
|
52
|
+
end
|
|
53
|
+
_attributes_2.Size = UDim2.new(1 / count, 0, 1, 0)
|
|
54
|
+
_attributes_2.Text = choice.label
|
|
55
|
+
_attributes_2.LayoutOrder = index
|
|
56
|
+
_attributes_2.Active = active
|
|
57
|
+
_attributes_2.Selectable = active
|
|
58
|
+
_attributes_2.Event = {
|
|
59
|
+
Activated = function()
|
|
60
|
+
if active and choice.value ~= value then
|
|
61
|
+
onChange(choice.value)
|
|
62
|
+
end
|
|
63
|
+
end,
|
|
64
|
+
}
|
|
65
|
+
local _condition_1 = selected
|
|
66
|
+
if _condition_1 then
|
|
67
|
+
local _attributes_3 = {
|
|
68
|
+
key = "Indicator",
|
|
69
|
+
}
|
|
70
|
+
for _k, _v in styles.indicator do
|
|
71
|
+
_attributes_3[_k] = _v
|
|
72
|
+
end
|
|
73
|
+
_condition_1 = React.createElement("frame", _attributes_3)
|
|
74
|
+
end
|
|
75
|
+
return React.createElement("textbutton", _attributes_2, _condition_1)
|
|
76
|
+
end
|
|
77
|
+
for _k, _v in options do
|
|
78
|
+
_newValue[_k] = _callback(_v, _k - 1, options)
|
|
79
|
+
end
|
|
80
|
+
-- ▲ ReadonlyArray.map ▲
|
|
81
|
+
return React.createElement("frame", _attributes, _exp, _newValue)
|
|
82
|
+
end
|
|
83
|
+
local default = BottomNavigation
|
|
84
|
+
return {
|
|
85
|
+
default = default,
|
|
86
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
local _theme = TS.import(script, script.Parent.Parent.Parent.Parent.Parent, "theme")
|
|
4
|
+
local componentStyles = _theme.componentStyles
|
|
5
|
+
local createStyles = _theme.createStyles
|
|
6
|
+
local useBottomNavigationStyles = componentStyles("BottomNavigation", function(theme)
|
|
7
|
+
local _object = {
|
|
8
|
+
root = {
|
|
9
|
+
Size = UDim2.new(1, 0, 0, theme.spacing.calc(7)),
|
|
10
|
+
BackgroundColor3 = theme.palette.surface.elevated,
|
|
11
|
+
BorderSizePixel = 0,
|
|
12
|
+
ZIndex = 11000,
|
|
13
|
+
},
|
|
14
|
+
list = {
|
|
15
|
+
FillDirection = Enum.FillDirection.Horizontal,
|
|
16
|
+
HorizontalAlignment = Enum.HorizontalAlignment.Center,
|
|
17
|
+
VerticalAlignment = Enum.VerticalAlignment.Center,
|
|
18
|
+
SortOrder = Enum.SortOrder.LayoutOrder,
|
|
19
|
+
Padding = UDim.new(0, 0),
|
|
20
|
+
},
|
|
21
|
+
}
|
|
22
|
+
local _left = "item"
|
|
23
|
+
local _object_1 = {
|
|
24
|
+
Size = UDim2.new(0, 0, 1, 0),
|
|
25
|
+
BackgroundTransparency = 1,
|
|
26
|
+
BorderSizePixel = 0,
|
|
27
|
+
AutoButtonColor = false,
|
|
28
|
+
Font = theme.typography.fontFamilies.default,
|
|
29
|
+
}
|
|
30
|
+
local _left_1 = "TextSize"
|
|
31
|
+
local _condition = theme.typography.fontSizes.caption
|
|
32
|
+
if _condition == nil then
|
|
33
|
+
_condition = theme.typography.fontSizes.body
|
|
34
|
+
end
|
|
35
|
+
_object_1[_left_1] = _condition
|
|
36
|
+
_object_1.TextColor3 = theme.palette.text.secondary
|
|
37
|
+
_object_1.TextTruncate = Enum.TextTruncate.AtEnd
|
|
38
|
+
_object[_left] = _object_1
|
|
39
|
+
_object.selected = {
|
|
40
|
+
TextColor3 = theme.palette.primary.main,
|
|
41
|
+
BackgroundColor3 = theme.palette.action.selected,
|
|
42
|
+
BackgroundTransparency = 0.85,
|
|
43
|
+
}
|
|
44
|
+
_object.disabledItem = {
|
|
45
|
+
TextTransparency = 0.5,
|
|
46
|
+
}
|
|
47
|
+
_object.indicator = {
|
|
48
|
+
Size = UDim2.new(1, 0, 0, 2),
|
|
49
|
+
Position = UDim2.new(0, 0, 0, 0),
|
|
50
|
+
BackgroundColor3 = theme.palette.primary.main,
|
|
51
|
+
BorderSizePixel = 0,
|
|
52
|
+
}
|
|
53
|
+
return createStyles(_object)
|
|
54
|
+
end)
|
|
55
|
+
local default = useBottomNavigationStyles
|
|
56
|
+
return {
|
|
57
|
+
default = default,
|
|
58
|
+
}
|
|
@@ -6,9 +6,6 @@ local createStyles = _theme.createStyles
|
|
|
6
6
|
local componentStyles = _theme.componentStyles
|
|
7
7
|
local makeRootStyles = function(theme, _param)
|
|
8
8
|
local size = _param.size
|
|
9
|
-
if size == nil then
|
|
10
|
-
size = "small"
|
|
11
|
-
end
|
|
12
9
|
local color = _param.color
|
|
13
10
|
local fullWidth = _param.fullWidth
|
|
14
11
|
local variant = _param.variant
|
|
@@ -92,9 +89,6 @@ local makeRootStyles = function(theme, _param)
|
|
|
92
89
|
end
|
|
93
90
|
local useButtonStyles = componentStyles("Button", function(theme, _param)
|
|
94
91
|
local size = _param.size
|
|
95
|
-
if size == nil then
|
|
96
|
-
size = "small"
|
|
97
|
-
end
|
|
98
92
|
local color = _param.color
|
|
99
93
|
if color == nil then
|
|
100
94
|
color = "primary"
|
|
@@ -8,5 +8,5 @@ export declare function spinnerPlace(position?: LoadingPosition): {
|
|
|
8
8
|
xOffset: number;
|
|
9
9
|
anchorX: number;
|
|
10
10
|
};
|
|
11
|
-
export declare function spinnerPixels(size?: "small" | "medium" | "large"): 16 |
|
|
12
|
-
export declare function iconSpinnerPixels(size?: string): 16 |
|
|
11
|
+
export declare function spinnerPixels(size?: "small" | "medium" | "large"): 16 | 14 | 12;
|
|
12
|
+
export declare function iconSpinnerPixels(size?: string): 16 | 12 | 8;
|
|
@@ -2,4 +2,4 @@ export type CheckboxPointer = "rest" | "hover" | "press" | "focus";
|
|
|
2
2
|
export declare function checkboxMark(value: boolean, mixed?: boolean): "" | "–" | "✓";
|
|
3
3
|
export declare function checkboxPointer(hovering: boolean, pressed: boolean, focused: boolean): CheckboxPointer;
|
|
4
4
|
export declare function checkboxBoxTransparency(filled: boolean, disabled: boolean, pointer: CheckboxPointer): 1 | 0 | 0.7 | 0.55 | 0.85;
|
|
5
|
-
export declare function checkboxStrokeTransparency(filled: boolean, disabled: boolean, pointer: CheckboxPointer): 0 | 0
|
|
5
|
+
export declare function checkboxStrokeTransparency(filled: boolean, disabled: boolean, pointer: CheckboxPointer): 0.45 | 0 | 0.25 | 0.55 | 0.2;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { CustomizedProps } from "../../../../theme/index";
|
|
2
|
+
import { Icons } from "../../../enums/index";
|
|
3
|
+
import { FabSize } from "./fabSize";
|
|
4
|
+
export interface FabProps {
|
|
5
|
+
icon: Icons;
|
|
6
|
+
size?: FabSize;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
loading?: boolean;
|
|
9
|
+
reducedMotion?: boolean;
|
|
10
|
+
onClick?: () => void;
|
|
11
|
+
}
|
|
12
|
+
declare function Fab(props: CustomizedProps<TextButton, FabProps>): JSX.Element;
|
|
13
|
+
export default Fab;
|